@final-commerce/command-frame 0.2.0-beta.1 → 0.3.0-beta.3
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 +28 -26
- package/dist/CommonTypes.d.ts +79 -534
- package/dist/CommonTypes.js +5 -65
- package/dist/actions/add-customer-note/mock.js +24 -15
- package/dist/actions/add-customer-note/types.d.ts +3 -2
- package/dist/actions/add-product/mock.js +12 -6
- package/dist/actions/add-product-discount/mock.js +5 -5
- package/dist/actions/add-product-fee/mock.js +6 -6
- package/dist/actions/cash-payment/types.d.ts +0 -5
- package/dist/actions/delete-parked-order/types.d.ts +0 -3
- package/dist/actions/edit-product/mock.js +5 -3
- package/dist/actions/extension-payment/types.d.ts +4 -5
- package/dist/actions/get-context/mock.js +12 -6
- package/dist/actions/get-products/mock.js +3 -3
- package/dist/actions/get-roles/mock.js +35 -41
- package/dist/actions/get-smart-grid-layout/action.d.ts +2 -0
- package/dist/actions/get-smart-grid-layout/action.js +4 -0
- package/dist/actions/get-smart-grid-layout/mock.d.ts +2 -0
- package/dist/actions/get-smart-grid-layout/mock.js +7 -0
- package/dist/actions/get-smart-grid-layout/types.d.ts +12 -0
- package/dist/actions/get-users/mock.js +16 -25
- package/dist/actions/initiate-refund/types.d.ts +0 -3
- package/dist/actions/integration-payment/action.d.ts +5 -0
- package/dist/actions/integration-payment/action.js +7 -0
- package/dist/actions/integration-payment/mock.d.ts +2 -0
- package/dist/actions/integration-payment/mock.js +4 -0
- package/dist/actions/integration-payment/types.d.ts +16 -0
- package/dist/actions/open-extension-overlay/action.d.ts +2 -0
- package/dist/actions/open-extension-overlay/action.js +4 -0
- package/dist/actions/open-extension-overlay/mock.d.ts +2 -0
- package/dist/actions/open-extension-overlay/mock.js +1 -0
- package/dist/actions/open-extension-overlay/types.d.ts +9 -0
- package/dist/actions/park-order/types.d.ts +0 -3
- package/dist/actions/partial-payment/types.d.ts +0 -5
- package/dist/actions/print/mock.js +3 -6
- package/dist/actions/print/types.d.ts +1 -7
- package/dist/actions/process-partial-refund/types.d.ts +0 -3
- package/dist/actions/remove-customer-note/mock.js +14 -5
- package/dist/actions/resolve-extension-overlay/action.d.ts +2 -0
- package/dist/actions/resolve-extension-overlay/action.js +4 -0
- package/dist/actions/resolve-extension-overlay/mock.d.ts +2 -0
- package/dist/actions/resolve-extension-overlay/mock.js +1 -0
- package/dist/actions/resolve-extension-overlay/types.d.ts +9 -0
- package/dist/actions/resume-parked-order/mock.js +1 -1
- package/dist/actions/resume-parked-order/types.d.ts +0 -3
- package/dist/actions/save-smart-grid-layout/action.d.ts +2 -0
- package/dist/actions/save-smart-grid-layout/action.js +4 -0
- package/dist/actions/save-smart-grid-layout/mock.d.ts +2 -0
- package/dist/actions/save-smart-grid-layout/mock.js +7 -0
- package/dist/actions/save-smart-grid-layout/types.d.ts +12 -0
- package/dist/actions/set-active-product-discount/mock.js +1 -1
- package/dist/actions/set-active-product-fee/mock.js +1 -1
- package/dist/actions/tap-to-pay-payment/types.d.ts +0 -5
- package/dist/actions/terminal-payment/types.d.ts +0 -5
- package/dist/actions/vendara-payment/types.d.ts +0 -5
- package/dist/common-types/index.d.ts +0 -1
- package/dist/common-types/index.js +0 -1
- package/dist/demo/database.d.ts +21 -21
- package/dist/demo/database.js +36 -51
- package/dist/index.d.ts +124 -116
- package/dist/index.js +19 -15
- package/dist/interceptors/types.d.ts +34 -0
- package/dist/interceptors/types.js +1 -0
- package/dist/projects/render/mocks.js +10 -8
- package/dist/projects/render/types.d.ts +6 -5
- package/dist/pubsub/topics/attributes/attribute-created/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/attribute-created/types.js +1 -0
- package/dist/pubsub/topics/attributes/attribute-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/attribute-updated/types.js +1 -0
- package/dist/pubsub/topics/attributes/index.d.ts +3 -0
- package/dist/pubsub/topics/attributes/index.js +18 -0
- package/dist/pubsub/topics/attributes/types.d.ts +6 -0
- package/dist/pubsub/topics/attributes/types.js +2 -0
- package/dist/pubsub/topics/categories/category-created/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/category-created/types.js +1 -0
- package/dist/pubsub/topics/categories/category-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/category-updated/types.js +1 -0
- package/dist/pubsub/topics/categories/index.d.ts +3 -0
- package/dist/pubsub/topics/categories/index.js +18 -0
- package/dist/pubsub/topics/categories/types.d.ts +6 -0
- package/dist/pubsub/topics/categories/types.js +2 -0
- package/dist/pubsub/topics/index.d.ts +4 -0
- package/dist/pubsub/topics/index.js +4 -0
- package/dist/pubsub/topics/orders/index.js +0 -10
- package/dist/pubsub/topics/orders/types.d.ts +2 -6
- package/dist/pubsub/topics/orders/types.js +0 -2
- package/dist/pubsub/topics/print/print-completed/types.d.ts +1 -1
- package/dist/pubsub/topics/print/print-error/types.d.ts +1 -1
- package/dist/pubsub/topics/print/print-started/types.d.ts +1 -1
- package/dist/pubsub/topics/products/product-get-active/types.d.ts +6 -2
- package/dist/pubsub/topics/transactions/index.d.ts +3 -0
- package/dist/pubsub/topics/transactions/index.js +18 -0
- package/dist/pubsub/topics/transactions/transaction-created/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/transaction-created/types.js +1 -0
- package/dist/pubsub/topics/transactions/transaction-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/transaction-updated/types.js +1 -0
- package/dist/pubsub/topics/transactions/types.d.ts +6 -0
- package/dist/pubsub/topics/transactions/types.js +2 -0
- package/dist/pubsub/topics/types.d.ts +8 -0
- package/dist/pubsub/topics/users/index.js +10 -0
- package/dist/pubsub/topics/users/types.d.ts +6 -2
- package/dist/pubsub/topics/users/types.js +2 -0
- package/dist/pubsub/topics/users/user-created/types.d.ts +6 -0
- package/dist/pubsub/topics/users/user-created/types.js +1 -0
- package/dist/pubsub/topics/users/user-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/users/user-updated/types.js +1 -0
- package/dist/pubsub/topics/variants/index.d.ts +3 -0
- package/dist/pubsub/topics/variants/index.js +18 -0
- package/dist/pubsub/topics/variants/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/types.js +2 -0
- package/dist/pubsub/topics/variants/variant-created/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/variant-created/types.js +1 -0
- package/dist/pubsub/topics/variants/variant-updated/types.d.ts +6 -0
- package/dist/pubsub/topics/variants/variant-updated/types.js +1 -0
- package/package.json +15 -12
- package/dist/actions/can-transition/action.d.ts +0 -2
- package/dist/actions/can-transition/action.js +0 -4
- package/dist/actions/can-transition/mock.d.ts +0 -6
- package/dist/actions/can-transition/mock.js +0 -28
- package/dist/actions/can-transition/types.d.ts +0 -11
- package/dist/actions/get-available-transitions/action.d.ts +0 -2
- package/dist/actions/get-available-transitions/action.js +0 -4
- package/dist/actions/get-available-transitions/mock.d.ts +0 -6
- package/dist/actions/get-available-transitions/mock.js +0 -26
- package/dist/actions/get-available-transitions/types.d.ts +0 -9
- package/dist/actions/trigger-webhook/action.d.ts +0 -6
- package/dist/actions/trigger-webhook/action.js +0 -8
- package/dist/actions/trigger-webhook/mock.d.ts +0 -2
- package/dist/actions/trigger-webhook/mock.js +0 -8
- package/dist/actions/trigger-webhook/types.d.ts +0 -21
- package/dist/actions/trigger-webhook/types.js +0 -2
- package/dist/actions/trigger-zapier-webhook/action.d.ts +0 -6
- package/dist/actions/trigger-zapier-webhook/action.js +0 -8
- package/dist/actions/trigger-zapier-webhook/mock.d.ts +0 -2
- package/dist/actions/trigger-zapier-webhook/mock.js +0 -8
- package/dist/actions/trigger-zapier-webhook/types.d.ts +0 -9
- package/dist/common-types/order-state.d.ts +0 -32
- package/dist/common-types/order-state.js +0 -6
- package/dist/common-types/state-fragment.d.ts +0 -77
- package/dist/common-types/state-fragment.js +0 -10
- package/dist/fragments/index.d.ts +0 -1
- package/dist/fragments/index.js +0 -1
- package/dist/fragments/preorder-no-deposit.d.ts +0 -26
- package/dist/fragments/preorder-no-deposit.js +0 -166
- package/dist/pubsub/topics/orders/state-transition-blocked/types.d.ts +0 -16
- package/dist/pubsub/topics/orders/state-transition-completed/types.d.ts +0 -15
- /package/dist/actions/{can-transition → get-smart-grid-layout}/types.js +0 -0
- /package/dist/actions/{get-available-transitions → integration-payment}/types.js +0 -0
- /package/dist/actions/{trigger-zapier-webhook → open-extension-overlay}/types.js +0 -0
- /package/dist/{pubsub/topics/orders/state-transition-blocked → actions/resolve-extension-overlay}/types.js +0 -0
- /package/dist/{pubsub/topics/orders/state-transition-completed → actions/save-smart-grid-layout}/types.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const categoriesTopic = {
|
|
2
|
+
id: "categories",
|
|
3
|
+
name: "Categories",
|
|
4
|
+
description: "Topic for product category changes synced from the database",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "category-created",
|
|
8
|
+
name: "Category Created",
|
|
9
|
+
description: "Published when a new category is synced/created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "category-updated",
|
|
13
|
+
name: "Category Updated",
|
|
14
|
+
description: "Published when a category is synced/updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./category-created/types";
|
|
2
|
+
export * from "./category-updated/types";
|
|
3
|
+
import type { CategoryCreatedPayload } from "./category-created/types";
|
|
4
|
+
import type { CategoryUpdatedPayload } from "./category-updated/types";
|
|
5
|
+
export type CategoriesEventPayload = CategoryCreatedPayload | CategoryUpdatedPayload;
|
|
6
|
+
export type CategoriesEventType = "category-created" | "category-updated";
|
|
@@ -26,16 +26,6 @@ export const ordersTopic = {
|
|
|
26
26
|
id: "get-active-order",
|
|
27
27
|
name: "Get Active Order",
|
|
28
28
|
description: "Published when the active order is retrieved for listeners"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "state-transition-completed",
|
|
32
|
-
name: "State Transition Completed",
|
|
33
|
-
description: "Published when an order state transition completes successfully"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "state-transition-blocked",
|
|
37
|
-
name: "State Transition Blocked",
|
|
38
|
-
description: "Published when an order state transition is blocked by the state machine"
|
|
39
29
|
}
|
|
40
30
|
]
|
|
41
31
|
};
|
|
@@ -6,13 +6,9 @@ export * from "./order-created/types";
|
|
|
6
6
|
export * from "./order-updated/types";
|
|
7
7
|
export * from "./set-active-order/types";
|
|
8
8
|
export * from "./get-active-order/types";
|
|
9
|
-
export * from "./state-transition-completed/types";
|
|
10
|
-
export * from "./state-transition-blocked/types";
|
|
11
9
|
import type { OrderCreatedPayload } from "./order-created/types";
|
|
12
10
|
import type { OrderUpdatedPayload } from "./order-updated/types";
|
|
13
11
|
import type { OrderActiveSetPayload } from "./set-active-order/types";
|
|
14
12
|
import type { OrderActiveGetPayload } from "./get-active-order/types";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderActiveSetPayload | OrderActiveGetPayload | OrderStateTransitionCompletedPayload | OrderStateTransitionBlockedPayload;
|
|
18
|
-
export type OrdersEventType = "order-created" | "order-updated" | "set-active-order" | "get-active-order" | "state-transition-completed" | "state-transition-blocked";
|
|
13
|
+
export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload | OrderActiveSetPayload | OrderActiveGetPayload;
|
|
14
|
+
export type OrdersEventType = "order-created" | "order-updated" | "set-active-order" | "get-active-order";
|
|
@@ -7,5 +7,3 @@ export * from "./order-created/types";
|
|
|
7
7
|
export * from "./order-updated/types";
|
|
8
8
|
export * from "./set-active-order/types";
|
|
9
9
|
export * from "./get-active-order/types";
|
|
10
|
-
export * from "./state-transition-completed/types";
|
|
11
|
-
export * from "./state-transition-blocked/types";
|
|
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
|
|
|
3
3
|
* Payload for print-completed event
|
|
4
4
|
*/
|
|
5
5
|
export interface PrintCompletedPayload {
|
|
6
|
-
type: "image" | "html" | "
|
|
6
|
+
type: "image" | "html" | "receipt";
|
|
7
7
|
orderId?: string;
|
|
8
8
|
globalBlockId?: string;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ import type { TopicEvent } from "../../../types";
|
|
|
3
3
|
* Payload for print-error event
|
|
4
4
|
*/
|
|
5
5
|
export interface PrintErrorPayload {
|
|
6
|
-
type: "image" | "html" | "
|
|
6
|
+
type: "image" | "html" | "receipt";
|
|
7
7
|
error: string;
|
|
8
8
|
orderId?: string;
|
|
9
9
|
globalBlockId?: string;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { CFActiveProduct } from "../../../../CommonTypes";
|
|
2
2
|
import type { TopicEvent } from "../../../types";
|
|
3
3
|
/**
|
|
4
|
-
* Payload for product-get-active event
|
|
4
|
+
* Payload for product-get-active event.
|
|
5
|
+
*
|
|
6
|
+
* `product` is nullable: the host publishes this event unconditionally, including
|
|
7
|
+
* with `null` when there is no active selection (e.g. after the active product is
|
|
8
|
+
* cleared). Subscribers must handle the null case. [FI-6491]
|
|
5
9
|
*/
|
|
6
10
|
export interface ProductGetActivePayload {
|
|
7
|
-
product: CFActiveProduct;
|
|
11
|
+
product: CFActiveProduct | null;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
14
|
* Typed event for product-get-active
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const transactionsTopic = {
|
|
2
|
+
id: "transactions",
|
|
3
|
+
name: "Transactions",
|
|
4
|
+
description: "Topic for payment transaction events",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "transaction-created",
|
|
8
|
+
name: "Transaction Created",
|
|
9
|
+
description: "Published when a new transaction is created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "transaction-updated",
|
|
13
|
+
name: "Transaction Updated",
|
|
14
|
+
description: "Published when a transaction is updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CFTransaction } from "../../../../CommonTypes";
|
|
2
|
+
import type { TopicEvent } from "../../../types";
|
|
3
|
+
export interface TransactionCreatedPayload {
|
|
4
|
+
transaction: CFTransaction;
|
|
5
|
+
}
|
|
6
|
+
export type TransactionCreatedEvent = TopicEvent<TransactionCreatedPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CFTransaction } from "../../../../CommonTypes";
|
|
2
|
+
import type { TopicEvent } from "../../../types";
|
|
3
|
+
export interface TransactionUpdatedPayload {
|
|
4
|
+
transaction: CFTransaction;
|
|
5
|
+
}
|
|
6
|
+
export type TransactionUpdatedEvent = TopicEvent<TransactionUpdatedPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./transaction-created/types";
|
|
2
|
+
export * from "./transaction-updated/types";
|
|
3
|
+
import type { TransactionCreatedPayload } from "./transaction-created/types";
|
|
4
|
+
import type { TransactionUpdatedPayload } from "./transaction-updated/types";
|
|
5
|
+
export type TransactionsEventPayload = TransactionCreatedPayload | TransactionUpdatedPayload;
|
|
6
|
+
export type TransactionsEventType = "transaction-created" | "transaction-updated";
|
|
@@ -10,6 +10,10 @@ import { OutletEventType, OutletEventPayload } from "./outlet/types";
|
|
|
10
10
|
import { StationEventType, StationEventPayload } from "./station/types";
|
|
11
11
|
import { SessionEventType, SessionEventPayload } from "./session/types";
|
|
12
12
|
import { UsersEventType, UsersEventPayload } from "./users/types";
|
|
13
|
+
import { VariantsEventType, VariantsEventPayload } from "./variants/types";
|
|
14
|
+
import { TransactionsEventType, TransactionsEventPayload } from "./transactions/types";
|
|
15
|
+
import { CategoriesEventType, CategoriesEventPayload } from "./categories/types";
|
|
16
|
+
import { AttributesEventType, AttributesEventPayload } from "./attributes/types";
|
|
13
17
|
export interface TopicEventPayloadMap {
|
|
14
18
|
customers: Record<CustomersEventType, CustomersEventPayload>;
|
|
15
19
|
orders: Record<OrdersEventType, OrdersEventPayload>;
|
|
@@ -23,4 +27,8 @@ export interface TopicEventPayloadMap {
|
|
|
23
27
|
station: Record<StationEventType, StationEventPayload>;
|
|
24
28
|
session: Record<SessionEventType, SessionEventPayload>;
|
|
25
29
|
users: Record<UsersEventType, UsersEventPayload>;
|
|
30
|
+
variants: Record<VariantsEventType, VariantsEventPayload>;
|
|
31
|
+
transactions: Record<TransactionsEventType, TransactionsEventPayload>;
|
|
32
|
+
categories: Record<CategoriesEventType, CategoriesEventPayload>;
|
|
33
|
+
attributes: Record<AttributesEventType, AttributesEventPayload>;
|
|
26
34
|
}
|
|
@@ -12,6 +12,16 @@ export const usersTopic = {
|
|
|
12
12
|
id: "get-active-user",
|
|
13
13
|
name: "Get Active User",
|
|
14
14
|
description: "Published when the active user is published to listeners"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "user-created",
|
|
18
|
+
name: "User Created",
|
|
19
|
+
description: "Published when a new user record is synced/created in the database"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "user-updated",
|
|
23
|
+
name: "User Updated",
|
|
24
|
+
description: "Published when any user record is synced/updated in the database"
|
|
15
25
|
}
|
|
16
26
|
]
|
|
17
27
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from "./set-active-user/types";
|
|
2
2
|
export * from "./get-active-user/types";
|
|
3
|
+
export * from "./user-created/types";
|
|
4
|
+
export * from "./user-updated/types";
|
|
3
5
|
import type { UserActiveSetPayload } from "./set-active-user/types";
|
|
4
6
|
import type { UserActiveGetPayload } from "./get-active-user/types";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
import type { UserCreatedPayload } from "./user-created/types";
|
|
8
|
+
import type { UserUpdatedPayload } from "./user-updated/types";
|
|
9
|
+
export type UsersEventPayload = UserActiveSetPayload | UserActiveGetPayload | UserCreatedPayload | UserUpdatedPayload;
|
|
10
|
+
export type UsersEventType = "set-active-user" | "get-active-user" | "user-created" | "user-updated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const variantsTopic = {
|
|
2
|
+
id: "variants",
|
|
3
|
+
name: "Variants",
|
|
4
|
+
description: "Topic for product variant changes synced from the database",
|
|
5
|
+
eventTypes: [
|
|
6
|
+
{
|
|
7
|
+
id: "variant-created",
|
|
8
|
+
name: "Variant Created",
|
|
9
|
+
description: "Published when a new product variant is synced/created"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "variant-updated",
|
|
13
|
+
name: "Variant Updated",
|
|
14
|
+
description: "Published when a product variant is synced/updated"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
export * from "./types";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./variant-created/types";
|
|
2
|
+
export * from "./variant-updated/types";
|
|
3
|
+
import type { VariantCreatedPayload } from "./variant-created/types";
|
|
4
|
+
import type { VariantUpdatedPayload } from "./variant-updated/types";
|
|
5
|
+
export type VariantsEventPayload = VariantCreatedPayload | VariantUpdatedPayload;
|
|
6
|
+
export type VariantsEventType = "variant-created" | "variant-updated";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/command-frame",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta.3",
|
|
4
4
|
"description": "Commands Frame library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"package.json"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"preinstall": "node -e \"if(process.cwd()===process.env.INIT_CWD&&!process.env.NPM_REGISTRY_TOKEN){try{require('child_process').execSync('npx google-artifactregistry-auth',{stdio:'inherit'})}catch(e){}}\"",
|
|
14
15
|
"build": "tsc",
|
|
15
16
|
"build:clean": "rm -rf dist && npm run build",
|
|
16
17
|
"dev": "tsc --watch",
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"test:run": "vitest run",
|
|
19
20
|
"prepublishOnly": "npm run build",
|
|
20
21
|
"prepare": "husky && npm run build",
|
|
21
|
-
"lint": "eslint .
|
|
22
|
+
"lint": "eslint .",
|
|
22
23
|
"format": "prettier --write .",
|
|
23
24
|
"format:check": "prettier --check .",
|
|
24
25
|
"publish:npm": "npm publish --registry=https://registry.npmjs.org",
|
|
@@ -35,8 +36,7 @@
|
|
|
35
36
|
"author": "Final Commerce",
|
|
36
37
|
"license": "MIT",
|
|
37
38
|
"publishConfig": {
|
|
38
|
-
"access": "public"
|
|
39
|
-
"registry": "https://registry.npmjs.org/"
|
|
39
|
+
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
@@ -56,18 +56,21 @@
|
|
|
56
56
|
"ignoredBranchesPattern": "^(main|master|develop|release-staging.*|pre-prod)$",
|
|
57
57
|
"ignoreBranchesMissingTickets": true
|
|
58
58
|
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@final-commerce/common": "^2.0.2"
|
|
61
|
+
},
|
|
59
62
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"eslint": "^
|
|
63
|
-
"eslint
|
|
64
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
65
|
-
"eslint-plugin-react-refresh": "^0.4.26",
|
|
63
|
+
"@commitlint/cli": "^19.0.0",
|
|
64
|
+
"@commitlint/config-conventional": "^19.0.0",
|
|
65
|
+
"@eslint/js": "^9.0.0",
|
|
66
|
+
"eslint": "^9.0.0",
|
|
66
67
|
"husky": "^9.1.7",
|
|
67
68
|
"jira-prepare-commit-msg": "^1.7.2",
|
|
68
69
|
"lint-staged": "^16.2.7",
|
|
69
70
|
"prettier": "^3.7.1",
|
|
70
71
|
"typescript": "^5.0.0",
|
|
71
|
-
"
|
|
72
|
-
|
|
72
|
+
"typescript-eslint": "^8.0.0",
|
|
73
|
+
"vitest": "^4.0.0"
|
|
74
|
+
},
|
|
75
|
+
"prettier": "@final-commerce/common/prettier"
|
|
73
76
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CanTransitionParams, CanTransitionResponse } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Mock implementation: allows all transitions except a few known-invalid ones
|
|
4
|
-
* so the demo app can show both allowed and blocked responses.
|
|
5
|
-
*/
|
|
6
|
-
export declare const canTransitionMock: (params: CanTransitionParams) => Promise<CanTransitionResponse>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock implementation: allows all transitions except a few known-invalid ones
|
|
3
|
-
* so the demo app can show both allowed and blocked responses.
|
|
4
|
-
*/
|
|
5
|
-
export const canTransitionMock = async (params) => {
|
|
6
|
-
const to = params.to;
|
|
7
|
-
if (to.payment === "refunded" && to.fulfillment === "draft") {
|
|
8
|
-
return {
|
|
9
|
-
result: {
|
|
10
|
-
allowed: false,
|
|
11
|
-
blockedBy: "financial_invariant",
|
|
12
|
-
guard: "no-refund-in-draft",
|
|
13
|
-
reason: "Cannot refund an order that is still in draft",
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (to.payment === "paid" && to.fulfillment === "cancelled") {
|
|
18
|
-
return {
|
|
19
|
-
result: {
|
|
20
|
-
allowed: false,
|
|
21
|
-
blockedBy: "cross_axis_rule",
|
|
22
|
-
guard: "no-pay-cancelled",
|
|
23
|
-
reason: "Cannot mark a cancelled order as paid",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return { result: { allowed: true } };
|
|
28
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CFStatePair, CFTransitionResult } from "../../common-types/order-state";
|
|
2
|
-
export interface CanTransitionParams {
|
|
3
|
-
/** Order to evaluate. If omitted, evaluates against a new order (from = null). */
|
|
4
|
-
orderId?: string;
|
|
5
|
-
/** Target state pair to transition to. */
|
|
6
|
-
to: CFStatePair;
|
|
7
|
-
}
|
|
8
|
-
export interface CanTransitionResponse {
|
|
9
|
-
result: CFTransitionResult;
|
|
10
|
-
}
|
|
11
|
-
export type CanTransition = (params: CanTransitionParams) => Promise<CanTransitionResponse>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { GetAvailableTransitionsParams, GetAvailableTransitionsResponse } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Mock implementation: returns a fixed set of plausible transitions
|
|
4
|
-
* so the demo app has data to render.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getAvailableTransitionsMock: (_params: GetAvailableTransitionsParams) => Promise<GetAvailableTransitionsResponse>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock implementation: returns a fixed set of plausible transitions
|
|
3
|
-
* so the demo app has data to render.
|
|
4
|
-
*/
|
|
5
|
-
export const getAvailableTransitionsMock = async (_params) => ({
|
|
6
|
-
transitions: [
|
|
7
|
-
{
|
|
8
|
-
to: { payment: "refunded", fulfillment: "returned" },
|
|
9
|
-
displayLabel: "Full Refund",
|
|
10
|
-
conditions: [{ met: true, description: "Order is paid" }],
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
to: { payment: "partially_refunded", fulfillment: "partially_returned" },
|
|
14
|
-
displayLabel: "Partial Refund",
|
|
15
|
-
conditions: [{ met: true, description: "Order is paid" }],
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
to: { payment: "voided", fulfillment: "cancelled" },
|
|
19
|
-
displayLabel: "Void Order",
|
|
20
|
-
conditions: [
|
|
21
|
-
{ met: true, description: "Order exists" },
|
|
22
|
-
{ met: false, description: "No payments captured (mock: skipped)" },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CFAvailableTransition } from "../../common-types/order-state";
|
|
2
|
-
export interface GetAvailableTransitionsParams {
|
|
3
|
-
/** Order to evaluate. Required — we need the current state. */
|
|
4
|
-
orderId: string;
|
|
5
|
-
}
|
|
6
|
-
export interface GetAvailableTransitionsResponse {
|
|
7
|
-
transitions: CFAvailableTransition[];
|
|
8
|
-
}
|
|
9
|
-
export type GetAvailableTransitions = (params: GetAvailableTransitionsParams) => Promise<GetAvailableTransitionsResponse>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trigger webhook action
|
|
3
|
-
* Calls the triggerWebhook action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const triggerWebhook = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("triggerWebhook", params);
|
|
8
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type TriggerWebhookPresetType = 'product' | 'cart' | 'order' | 'customer';
|
|
2
|
-
export interface TriggerWebhookParams {
|
|
3
|
-
webhookUrl: string;
|
|
4
|
-
/** Public key for authentication. */
|
|
5
|
-
publicKey?: string;
|
|
6
|
-
/** Defaults to false. */
|
|
7
|
-
presetData?: boolean;
|
|
8
|
-
presetType?: TriggerWebhookPresetType;
|
|
9
|
-
/** Defaults to false. */
|
|
10
|
-
isCustomHook?: boolean;
|
|
11
|
-
customHookData?: string;
|
|
12
|
-
/** 'json' or 'form-urlencoded'. Defaults to 'json'. */
|
|
13
|
-
payloadType?: string;
|
|
14
|
-
dynamicDataFields?: unknown[];
|
|
15
|
-
}
|
|
16
|
-
export interface TriggerWebhookResponse {
|
|
17
|
-
success: boolean;
|
|
18
|
-
webhookUrl: string;
|
|
19
|
-
timestamp: string;
|
|
20
|
-
}
|
|
21
|
-
export type TriggerWebhook = (params?: TriggerWebhookParams) => Promise<TriggerWebhookResponse>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trigger Zapier webhook action
|
|
3
|
-
* Calls the triggerZapierWebhook action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from "../../client";
|
|
6
|
-
export const triggerZapierWebhook = async (params) => {
|
|
7
|
-
return await commandFrameClient.call("triggerZapierWebhook", params);
|
|
8
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface TriggerZapierWebhookParams {
|
|
2
|
-
triggerUrl: string;
|
|
3
|
-
}
|
|
4
|
-
export interface TriggerZapierWebhookResponse {
|
|
5
|
-
success: boolean;
|
|
6
|
-
triggerUrl: string;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
}
|
|
9
|
-
export type TriggerZapierWebhook = (params?: TriggerZapierWebhookParams) => Promise<TriggerZapierWebhookResponse>;
|