@final-commerce/command-frame 0.1.4 → 0.1.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.
Files changed (77) hide show
  1. package/dist/index.d.ts +13 -1
  2. package/dist/index.js +8 -1
  3. package/dist/pubsub/topics/cart/cart-created/types.d.ts +12 -0
  4. package/dist/pubsub/topics/cart/cart-created/types.js +1 -0
  5. package/dist/pubsub/topics/cart/cart-discount-added/types.d.ts +12 -0
  6. package/dist/pubsub/topics/cart/cart-discount-added/types.js +1 -0
  7. package/dist/pubsub/topics/cart/cart-discount-removed/types.d.ts +10 -0
  8. package/dist/pubsub/topics/cart/cart-discount-removed/types.js +1 -0
  9. package/dist/pubsub/topics/cart/cart-fee-added/types.d.ts +12 -0
  10. package/dist/pubsub/topics/cart/cart-fee-added/types.js +1 -0
  11. package/dist/pubsub/topics/cart/cart-fee-removed/types.d.ts +11 -0
  12. package/dist/pubsub/topics/cart/cart-fee-removed/types.js +1 -0
  13. package/dist/pubsub/topics/cart/customer-assigned/types.d.ts +12 -0
  14. package/dist/pubsub/topics/cart/customer-assigned/types.js +1 -0
  15. package/dist/pubsub/topics/cart/index.d.ts +7 -0
  16. package/dist/pubsub/topics/cart/index.js +53 -0
  17. package/dist/pubsub/topics/cart/product-added/types.d.ts +12 -0
  18. package/dist/pubsub/topics/cart/product-added/types.js +1 -0
  19. package/dist/pubsub/topics/cart/product-deleted/types.d.ts +13 -0
  20. package/dist/pubsub/topics/cart/product-deleted/types.js +1 -0
  21. package/dist/pubsub/topics/cart/types.d.ts +22 -0
  22. package/dist/pubsub/topics/cart/types.js +13 -0
  23. package/dist/pubsub/topics/customers/customer-assigned/types.d.ts +12 -0
  24. package/dist/pubsub/topics/customers/customer-assigned/types.js +1 -0
  25. package/dist/pubsub/topics/customers/customer-created/types.d.ts +12 -0
  26. package/dist/pubsub/topics/customers/customer-created/types.js +1 -0
  27. package/dist/pubsub/topics/customers/customer-note-added/types.d.ts +13 -0
  28. package/dist/pubsub/topics/customers/customer-note-added/types.js +1 -0
  29. package/dist/pubsub/topics/customers/customer-note-deleted/types.d.ts +13 -0
  30. package/dist/pubsub/topics/customers/customer-note-deleted/types.js +1 -0
  31. package/dist/pubsub/topics/customers/customer-unassigned/types.d.ts +12 -0
  32. package/dist/pubsub/topics/customers/customer-unassigned/types.js +1 -0
  33. package/dist/pubsub/topics/customers/customer-updated/types.d.ts +12 -0
  34. package/dist/pubsub/topics/customers/customer-updated/types.js +1 -0
  35. package/dist/pubsub/topics/customers/index.d.ts +7 -0
  36. package/dist/pubsub/topics/customers/index.js +43 -0
  37. package/dist/pubsub/topics/customers/types.d.ts +18 -0
  38. package/dist/pubsub/topics/customers/types.js +11 -0
  39. package/dist/pubsub/topics/index.d.ts +10 -0
  40. package/dist/pubsub/topics/index.js +10 -0
  41. package/dist/pubsub/topics/orders/index.d.ts +7 -0
  42. package/dist/pubsub/topics/orders/index.js +23 -0
  43. package/dist/pubsub/topics/orders/order-created/types.d.ts +12 -0
  44. package/dist/pubsub/topics/orders/order-created/types.js +1 -0
  45. package/dist/pubsub/topics/orders/order-updated/types.d.ts +12 -0
  46. package/dist/pubsub/topics/orders/order-updated/types.js +1 -0
  47. package/dist/pubsub/topics/orders/types.d.ts +10 -0
  48. package/dist/pubsub/topics/orders/types.js +7 -0
  49. package/dist/pubsub/topics/payments/index.d.ts +7 -0
  50. package/dist/pubsub/topics/payments/index.js +23 -0
  51. package/dist/pubsub/topics/payments/payment-done/types.d.ts +14 -0
  52. package/dist/pubsub/topics/payments/payment-done/types.js +1 -0
  53. package/dist/pubsub/topics/payments/payment-err/types.d.ts +14 -0
  54. package/dist/pubsub/topics/payments/payment-err/types.js +1 -0
  55. package/dist/pubsub/topics/payments/types.d.ts +10 -0
  56. package/dist/pubsub/topics/payments/types.js +7 -0
  57. package/dist/pubsub/topics/products/index.d.ts +7 -0
  58. package/dist/pubsub/topics/products/index.js +23 -0
  59. package/dist/pubsub/topics/products/product-created/types.d.ts +12 -0
  60. package/dist/pubsub/topics/products/product-created/types.js +1 -0
  61. package/dist/pubsub/topics/products/product-updated/types.d.ts +12 -0
  62. package/dist/pubsub/topics/products/product-updated/types.js +1 -0
  63. package/dist/pubsub/topics/products/types.d.ts +10 -0
  64. package/dist/pubsub/topics/products/types.js +7 -0
  65. package/dist/pubsub/topics/refunds/index.d.ts +7 -0
  66. package/dist/pubsub/topics/refunds/index.js +23 -0
  67. package/dist/pubsub/topics/refunds/refund-created/types.d.ts +13 -0
  68. package/dist/pubsub/topics/refunds/refund-created/types.js +1 -0
  69. package/dist/pubsub/topics/refunds/refund-updated/types.d.ts +13 -0
  70. package/dist/pubsub/topics/refunds/refund-updated/types.js +1 -0
  71. package/dist/pubsub/topics/refunds/types.d.ts +10 -0
  72. package/dist/pubsub/topics/refunds/types.js +7 -0
  73. package/dist/pubsub/topics.d.ts +36 -0
  74. package/dist/pubsub/topics.js +52 -0
  75. package/package.json +1 -1
  76. /package/dist/pubsub/{index.d.ts → topic.d.ts} +0 -0
  77. /package/dist/pubsub/{index.js → topic.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -108,5 +108,17 @@ export type { TriggerZapierWebhook, TriggerZapierWebhookParams, TriggerZapierWeb
108
108
  export * from "./CommonTypes";
109
109
  export { commandFrameClient, CommandFrameClient } from "./client";
110
110
  export type { PostMessageRequest, PostMessageResponse } from "./client";
111
- export { topics } from "./pubsub";
111
+ export { topics } from "./pubsub/topic";
112
112
  export type { TopicDefinition, TopicEvent, TopicEventType, TopicSubscriptionCallback, TopicSubscription } from "./pubsub/types";
113
+ export { customersTopic } from "./pubsub/topics/customers";
114
+ export { ordersTopic } from "./pubsub/topics/orders";
115
+ export { refundsTopic } from "./pubsub/topics/refunds";
116
+ export { productsTopic } from "./pubsub/topics/products";
117
+ export { cartTopic } from "./pubsub/topics/cart";
118
+ export { paymentsTopic } from "./pubsub/topics/payments";
119
+ export type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomersEventType, CustomersEventPayload } from "./pubsub/topics/customers/types";
120
+ export type { OrderCreatedPayload, OrderUpdatedPayload, OrderCreatedEvent, OrderUpdatedEvent, OrdersEventType, OrdersEventPayload } from "./pubsub/topics/orders/types";
121
+ export type { RefundCreatedPayload, RefundUpdatedPayload, RefundCreatedEvent, RefundUpdatedEvent, RefundsEventType, RefundsEventPayload } from "./pubsub/topics/refunds/types";
122
+ export type { ProductCreatedPayload, ProductUpdatedPayload, ProductCreatedEvent, ProductUpdatedEvent, ProductsEventType, ProductsEventPayload } from "./pubsub/topics/products/types";
123
+ export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPayload, ProductDeletedPayload, CartDiscountAddedPayload, CartDiscountRemovedPayload, CartFeeAddedPayload, CartFeeRemovedPayload, CartCreatedEvent, CartCustomerAssignedEvent, ProductAddedEvent, ProductDeletedEvent, CartDiscountAddedEvent, CartDiscountRemovedEvent, CartFeeAddedEvent, CartFeeRemovedEvent, CartEventType, CartEventPayload } from "./pubsub/topics/cart/types";
124
+ export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
package/dist/index.js CHANGED
@@ -122,4 +122,11 @@ export * from "./CommonTypes";
122
122
  // Export client
123
123
  export { commandFrameClient, CommandFrameClient } from "./client";
124
124
  // Export Pub/Sub
125
- export { topics } from "./pubsub";
125
+ export { topics } from "./pubsub/topic";
126
+ // Export Pub/Sub Topics
127
+ export { customersTopic } from "./pubsub/topics/customers";
128
+ export { ordersTopic } from "./pubsub/topics/orders";
129
+ export { refundsTopic } from "./pubsub/topics/refunds";
130
+ export { productsTopic } from "./pubsub/topics/products";
131
+ export { cartTopic } from "./pubsub/topics/cart";
132
+ export { paymentsTopic } from "./pubsub/topics/payments";
@@ -0,0 +1,12 @@
1
+ import type { CFActiveCart } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for cart-created event
5
+ */
6
+ export interface CartCreatedPayload {
7
+ cart: CFActiveCart;
8
+ }
9
+ /**
10
+ * Typed event for cart-created
11
+ */
12
+ export type CartCreatedEvent = TopicEvent<CartCreatedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { CFDiscount } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for cart-discount-added event
5
+ */
6
+ export interface CartDiscountAddedPayload {
7
+ discount: CFDiscount;
8
+ }
9
+ /**
10
+ * Typed event for cart-discount-added
11
+ */
12
+ export type CartDiscountAddedEvent = TopicEvent<CartDiscountAddedPayload>;
@@ -0,0 +1,10 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for cart-discount-removed event
4
+ */
5
+ export interface CartDiscountRemovedPayload {
6
+ }
7
+ /**
8
+ * Typed event for cart-discount-removed
9
+ */
10
+ export type CartDiscountRemovedEvent = TopicEvent<CartDiscountRemovedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { CFCustomFee } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for cart-fee-added event
5
+ */
6
+ export interface CartFeeAddedPayload {
7
+ fee: CFCustomFee;
8
+ }
9
+ /**
10
+ * Typed event for cart-fee-added
11
+ */
12
+ export type CartFeeAddedEvent = TopicEvent<CartFeeAddedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for cart-fee-removed event
4
+ */
5
+ export interface CartFeeRemovedPayload {
6
+ feeIndex: number;
7
+ }
8
+ /**
9
+ * Typed event for cart-fee-removed
10
+ */
11
+ export type CartFeeRemovedEvent = TopicEvent<CartFeeRemovedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { CFCustomer } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-assigned event (in cart context)
5
+ */
6
+ export interface CartCustomerAssignedPayload {
7
+ customer: CFCustomer;
8
+ }
9
+ /**
10
+ * Typed event for customer-assigned (in cart context)
11
+ */
12
+ export type CartCustomerAssignedEvent = TopicEvent<CartCustomerAssignedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Cart Topic Definition
3
+ * Defines the cart topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const cartTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Cart Topic Definition
3
+ * Defines the cart topic and its available event types
4
+ */
5
+ export const cartTopic = {
6
+ id: "cart",
7
+ name: "Cart",
8
+ description: "Topic for cart-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "cart-created",
12
+ name: "Cart Created",
13
+ description: "Fired when a new cart is created"
14
+ },
15
+ {
16
+ id: "customer-assigned",
17
+ name: "Customer Assigned",
18
+ description: "Fired when a customer is assigned to the cart"
19
+ },
20
+ {
21
+ id: "product-added",
22
+ name: "Product Added",
23
+ description: "Fired when a product is added to the cart"
24
+ },
25
+ {
26
+ id: "product-deleted",
27
+ name: "Product Deleted",
28
+ description: "Fired when a product is removed from the cart"
29
+ },
30
+ {
31
+ id: "cart-discount-added",
32
+ name: "Cart Discount Added",
33
+ description: "Fired when a discount is added to the cart"
34
+ },
35
+ {
36
+ id: "cart-discount-removed",
37
+ name: "Cart Discount Removed",
38
+ description: "Fired when a discount is removed from the cart"
39
+ },
40
+ {
41
+ id: "cart-fee-added",
42
+ name: "Cart Fee Added",
43
+ description: "Fired when a fee is added to the cart"
44
+ },
45
+ {
46
+ id: "cart-fee-removed",
47
+ name: "Cart Fee Removed",
48
+ description: "Fired when a fee is removed from the cart"
49
+ }
50
+ ]
51
+ };
52
+ // Re-export types
53
+ export * from "./types";
@@ -0,0 +1,12 @@
1
+ import type { CFActiveProduct } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for product-added event
5
+ */
6
+ export interface ProductAddedPayload {
7
+ product: CFActiveProduct;
8
+ }
9
+ /**
10
+ * Typed event for product-added
11
+ */
12
+ export type ProductAddedEvent = TopicEvent<ProductAddedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { CFActiveProduct } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for product-deleted event
5
+ */
6
+ export interface ProductDeletedPayload {
7
+ product: CFActiveProduct;
8
+ internalId: string;
9
+ }
10
+ /**
11
+ * Typed event for product-deleted
12
+ */
13
+ export type ProductDeletedEvent = TopicEvent<ProductDeletedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Cart Topic Types
3
+ * Aggregated types for all cart-related events
4
+ */
5
+ export * from "./cart-created/types";
6
+ export * from "./customer-assigned/types";
7
+ export * from "./product-added/types";
8
+ export * from "./product-deleted/types";
9
+ export * from "./cart-discount-added/types";
10
+ export * from "./cart-discount-removed/types";
11
+ export * from "./cart-fee-added/types";
12
+ export * from "./cart-fee-removed/types";
13
+ import type { CartCreatedPayload } from "./cart-created/types";
14
+ import type { CartCustomerAssignedPayload } from "./customer-assigned/types";
15
+ import type { ProductAddedPayload } from "./product-added/types";
16
+ import type { ProductDeletedPayload } from "./product-deleted/types";
17
+ import type { CartDiscountAddedPayload } from "./cart-discount-added/types";
18
+ import type { CartDiscountRemovedPayload } from "./cart-discount-removed/types";
19
+ import type { CartFeeAddedPayload } from "./cart-fee-added/types";
20
+ import type { CartFeeRemovedPayload } from "./cart-fee-removed/types";
21
+ export type CartEventPayload = CartCreatedPayload | CartCustomerAssignedPayload | ProductAddedPayload | ProductDeletedPayload | CartDiscountAddedPayload | CartDiscountRemovedPayload | CartFeeAddedPayload | CartFeeRemovedPayload;
22
+ export type CartEventType = "cart-created" | "customer-assigned" | "product-added" | "product-deleted" | "cart-discount-added" | "cart-discount-removed" | "cart-fee-added" | "cart-fee-removed";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Cart Topic Types
3
+ * Aggregated types for all cart-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./cart-created/types";
7
+ export * from "./customer-assigned/types";
8
+ export * from "./product-added/types";
9
+ export * from "./product-deleted/types";
10
+ export * from "./cart-discount-added/types";
11
+ export * from "./cart-discount-removed/types";
12
+ export * from "./cart-fee-added/types";
13
+ export * from "./cart-fee-removed/types";
@@ -0,0 +1,12 @@
1
+ import type { CFCustomer } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-assigned event
5
+ */
6
+ export interface CustomerAssignedPayload {
7
+ customer: CFCustomer;
8
+ }
9
+ /**
10
+ * Typed event for customer-assigned
11
+ */
12
+ export type CustomerAssignedEvent = TopicEvent<CustomerAssignedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { CFCustomer } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-created event
5
+ */
6
+ export interface CustomerCreatedPayload {
7
+ customer: CFCustomer;
8
+ }
9
+ /**
10
+ * Typed event for customer-created
11
+ */
12
+ export type CustomerCreatedEvent = TopicEvent<CustomerCreatedPayload>;
@@ -0,0 +1,13 @@
1
+ import type { CFCustomer, CFCustomerNote } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-note-added event
5
+ */
6
+ export interface CustomerNoteAddedPayload {
7
+ customer: CFCustomer;
8
+ note: CFCustomerNote;
9
+ }
10
+ /**
11
+ * Typed event for customer-note-added
12
+ */
13
+ export type CustomerNoteAddedEvent = TopicEvent<CustomerNoteAddedPayload>;
@@ -0,0 +1,13 @@
1
+ import type { CFCustomer, CFCustomerNote } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-note-deleted event
5
+ */
6
+ export interface CustomerNoteDeletedPayload {
7
+ customer: CFCustomer;
8
+ note: CFCustomerNote;
9
+ }
10
+ /**
11
+ * Typed event for customer-note-deleted
12
+ */
13
+ export type CustomerNoteDeletedEvent = TopicEvent<CustomerNoteDeletedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { CFCustomer } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-unassigned event
5
+ */
6
+ export interface CustomerUnassignedPayload {
7
+ customer: CFCustomer;
8
+ }
9
+ /**
10
+ * Typed event for customer-unassigned
11
+ */
12
+ export type CustomerUnassignedEvent = TopicEvent<CustomerUnassignedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { CFCustomer } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for customer-updated event
5
+ */
6
+ export interface CustomerUpdatedPayload {
7
+ customer: CFCustomer;
8
+ }
9
+ /**
10
+ * Typed event for customer-updated
11
+ */
12
+ export type CustomerUpdatedEvent = TopicEvent<CustomerUpdatedPayload>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Customers Topic Definition
3
+ * Defines the customers topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const customersTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Customers Topic Definition
3
+ * Defines the customers topic and its available event types
4
+ */
5
+ export const customersTopic = {
6
+ id: "customers",
7
+ name: "Customers",
8
+ description: "Topic for customer-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "customer-created",
12
+ name: "Customer Created",
13
+ description: "Fired when a new customer is created"
14
+ },
15
+ {
16
+ id: "customer-updated",
17
+ name: "Customer Updated",
18
+ description: "Fired when a customer is updated"
19
+ },
20
+ {
21
+ id: "customer-note-added",
22
+ name: "Customer Note Added",
23
+ description: "Fired when a note is added to a customer"
24
+ },
25
+ {
26
+ id: "customer-note-deleted",
27
+ name: "Customer Note Deleted",
28
+ description: "Fired when a note is deleted from a customer"
29
+ },
30
+ {
31
+ id: "customer-assigned",
32
+ name: "Customer Assigned",
33
+ description: "Fired when a customer is assigned to the cart"
34
+ },
35
+ {
36
+ id: "customer-unassigned",
37
+ name: "Customer Unassigned",
38
+ description: "Fired when a customer is unassigned from the cart"
39
+ }
40
+ ]
41
+ };
42
+ // Re-export types
43
+ export * from "./types";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Customers Topic Types
3
+ * Aggregated types for all customer-related events
4
+ */
5
+ export * from "./customer-created/types";
6
+ export * from "./customer-updated/types";
7
+ export * from "./customer-note-added/types";
8
+ export * from "./customer-note-deleted/types";
9
+ export * from "./customer-assigned/types";
10
+ export * from "./customer-unassigned/types";
11
+ import type { CustomerCreatedPayload } from "./customer-created/types";
12
+ import type { CustomerUpdatedPayload } from "./customer-updated/types";
13
+ import type { CustomerNoteAddedPayload } from "./customer-note-added/types";
14
+ import type { CustomerNoteDeletedPayload } from "./customer-note-deleted/types";
15
+ import type { CustomerAssignedPayload } from "./customer-assigned/types";
16
+ import type { CustomerUnassignedPayload } from "./customer-unassigned/types";
17
+ export type CustomersEventPayload = CustomerCreatedPayload | CustomerUpdatedPayload | CustomerNoteAddedPayload | CustomerNoteDeletedPayload | CustomerAssignedPayload | CustomerUnassignedPayload;
18
+ export type CustomersEventType = "customer-created" | "customer-updated" | "customer-note-added" | "customer-note-deleted" | "customer-assigned" | "customer-unassigned";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Customers Topic Types
3
+ * Aggregated types for all customer-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./customer-created/types";
7
+ export * from "./customer-updated/types";
8
+ export * from "./customer-note-added/types";
9
+ export * from "./customer-note-deleted/types";
10
+ export * from "./customer-assigned/types";
11
+ export * from "./customer-unassigned/types";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pub/Sub Topics
3
+ * Export all available topics and their types
4
+ */
5
+ export * from "./customers";
6
+ export * from "./orders";
7
+ export * from "./refunds";
8
+ export * from "./products";
9
+ export * from "./cart";
10
+ export * from "./payments";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pub/Sub Topics
3
+ * Export all available topics and their types
4
+ */
5
+ export * from "./customers";
6
+ export * from "./orders";
7
+ export * from "./refunds";
8
+ export * from "./products";
9
+ export * from "./cart";
10
+ export * from "./payments";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Orders Topic Definition
3
+ * Defines the orders topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const ordersTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Orders Topic Definition
3
+ * Defines the orders topic and its available event types
4
+ */
5
+ export const ordersTopic = {
6
+ id: "orders",
7
+ name: "Orders",
8
+ description: "Topic for order-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "order-created",
12
+ name: "Order Created",
13
+ description: "Fired when a new order is created"
14
+ },
15
+ {
16
+ id: "order-updated",
17
+ name: "Order Updated",
18
+ description: "Fired when an order is updated"
19
+ }
20
+ ]
21
+ };
22
+ // Re-export types
23
+ export * from "./types";
@@ -0,0 +1,12 @@
1
+ import type { CFOrder } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for order-created event
5
+ */
6
+ export interface OrderCreatedPayload {
7
+ order: CFOrder;
8
+ }
9
+ /**
10
+ * Typed event for order-created
11
+ */
12
+ export type OrderCreatedEvent = TopicEvent<OrderCreatedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { CFOrder } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for order-updated event
5
+ */
6
+ export interface OrderUpdatedPayload {
7
+ order: CFOrder;
8
+ }
9
+ /**
10
+ * Typed event for order-updated
11
+ */
12
+ export type OrderUpdatedEvent = TopicEvent<OrderUpdatedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Orders Topic Types
3
+ * Aggregated types for all order-related events
4
+ */
5
+ export * from "./order-created/types";
6
+ export * from "./order-updated/types";
7
+ import type { OrderCreatedPayload } from "./order-created/types";
8
+ import type { OrderUpdatedPayload } from "./order-updated/types";
9
+ export type OrdersEventPayload = OrderCreatedPayload | OrderUpdatedPayload;
10
+ export type OrdersEventType = "order-created" | "order-updated";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Orders Topic Types
3
+ * Aggregated types for all order-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./order-created/types";
7
+ export * from "./order-updated/types";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Payments Topic Definition
3
+ * Defines the payments topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const paymentsTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Payments Topic Definition
3
+ * Defines the payments topic and its available event types
4
+ */
5
+ export const paymentsTopic = {
6
+ id: "payments",
7
+ name: "Payments",
8
+ description: "Topic for payment-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "payment-done",
12
+ name: "Payment Done",
13
+ description: "Fired when a payment is successfully completed"
14
+ },
15
+ {
16
+ id: "payment-err",
17
+ name: "Payment Error",
18
+ description: "Fired when a payment error occurs"
19
+ }
20
+ ]
21
+ };
22
+ // Re-export types
23
+ export * from "./types";
@@ -0,0 +1,14 @@
1
+ import type { CFPaymentMethod, CFOrder } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for payment-done event
5
+ */
6
+ export interface PaymentDonePayload {
7
+ payment: CFPaymentMethod;
8
+ order: CFOrder;
9
+ amount: string;
10
+ }
11
+ /**
12
+ * Typed event for payment-done
13
+ */
14
+ export type PaymentDoneEvent = TopicEvent<PaymentDonePayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { TopicEvent } from "../../../types";
2
+ /**
3
+ * Payload for payment-err event
4
+ */
5
+ export interface PaymentErrPayload {
6
+ error: string;
7
+ errorCode?: string;
8
+ paymentType?: string;
9
+ amount?: string;
10
+ }
11
+ /**
12
+ * Typed event for payment-err
13
+ */
14
+ export type PaymentErrEvent = TopicEvent<PaymentErrPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Payments Topic Types
3
+ * Aggregated types for all payment-related events
4
+ */
5
+ export * from "./payment-done/types";
6
+ export * from "./payment-err/types";
7
+ import type { PaymentDonePayload } from "./payment-done/types";
8
+ import type { PaymentErrPayload } from "./payment-err/types";
9
+ export type PaymentsEventPayload = PaymentDonePayload | PaymentErrPayload;
10
+ export type PaymentsEventType = "payment-done" | "payment-err";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Payments Topic Types
3
+ * Aggregated types for all payment-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./payment-done/types";
7
+ export * from "./payment-err/types";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Products Topic Definition
3
+ * Defines the products topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const productsTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Products Topic Definition
3
+ * Defines the products topic and its available event types
4
+ */
5
+ export const productsTopic = {
6
+ id: "products",
7
+ name: "Products",
8
+ description: "Topic for product-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "product-created",
12
+ name: "Product Created",
13
+ description: "Fired when a new product is synced/created"
14
+ },
15
+ {
16
+ id: "product-updated",
17
+ name: "Product Updated",
18
+ description: "Fired when a product is synced/updated"
19
+ }
20
+ ]
21
+ };
22
+ // Re-export types
23
+ export * from "./types";
@@ -0,0 +1,12 @@
1
+ import type { CFProduct } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for product-created event
5
+ */
6
+ export interface ProductCreatedPayload {
7
+ product: CFProduct;
8
+ }
9
+ /**
10
+ * Typed event for product-created
11
+ */
12
+ export type ProductCreatedEvent = TopicEvent<ProductCreatedPayload>;
@@ -0,0 +1,12 @@
1
+ import type { CFProduct } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for product-updated event
5
+ */
6
+ export interface ProductUpdatedPayload {
7
+ product: CFProduct;
8
+ }
9
+ /**
10
+ * Typed event for product-updated
11
+ */
12
+ export type ProductUpdatedEvent = TopicEvent<ProductUpdatedPayload>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Products Topic Types
3
+ * Aggregated types for all product-related events
4
+ */
5
+ export * from "./product-created/types";
6
+ export * from "./product-updated/types";
7
+ import type { ProductCreatedPayload } from "./product-created/types";
8
+ import type { ProductUpdatedPayload } from "./product-updated/types";
9
+ export type ProductsEventPayload = ProductCreatedPayload | ProductUpdatedPayload;
10
+ export type ProductsEventType = "product-created" | "product-updated";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Products Topic Types
3
+ * Aggregated types for all product-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./product-created/types";
7
+ export * from "./product-updated/types";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Refunds Topic Definition
3
+ * Defines the refunds topic and its available event types
4
+ */
5
+ import type { TopicDefinition } from "../../types";
6
+ export declare const refundsTopic: TopicDefinition;
7
+ export * from "./types";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Refunds Topic Definition
3
+ * Defines the refunds topic and its available event types
4
+ */
5
+ export const refundsTopic = {
6
+ id: "refunds",
7
+ name: "Refunds",
8
+ description: "Topic for refund-related events",
9
+ eventTypes: [
10
+ {
11
+ id: "refund-created",
12
+ name: "Refund Created",
13
+ description: "Fired when a new refund is created"
14
+ },
15
+ {
16
+ id: "refund-updated",
17
+ name: "Refund Updated",
18
+ description: "Fired when a refund is updated"
19
+ }
20
+ ]
21
+ };
22
+ // Re-export types
23
+ export * from "./types";
@@ -0,0 +1,13 @@
1
+ import type { CFRefundItem } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for refund-created event
5
+ */
6
+ export interface RefundCreatedPayload {
7
+ refund: CFRefundItem;
8
+ orderId: string;
9
+ }
10
+ /**
11
+ * Typed event for refund-created
12
+ */
13
+ export type RefundCreatedEvent = TopicEvent<RefundCreatedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { CFRefundItem } from "../../../../CommonTypes";
2
+ import type { TopicEvent } from "../../../types";
3
+ /**
4
+ * Payload for refund-updated event
5
+ */
6
+ export interface RefundUpdatedPayload {
7
+ refund: CFRefundItem;
8
+ orderId: string;
9
+ }
10
+ /**
11
+ * Typed event for refund-updated
12
+ */
13
+ export type RefundUpdatedEvent = TopicEvent<RefundUpdatedPayload>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Refunds Topic Types
3
+ * Aggregated types for all refund-related events
4
+ */
5
+ export * from "./refund-created/types";
6
+ export * from "./refund-updated/types";
7
+ import type { RefundCreatedPayload } from "./refund-created/types";
8
+ import type { RefundUpdatedPayload } from "./refund-updated/types";
9
+ export type RefundsEventPayload = RefundCreatedPayload | RefundUpdatedPayload;
10
+ export type RefundsEventType = "refund-created" | "refund-updated";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Refunds Topic Types
3
+ * Aggregated types for all refund-related events
4
+ */
5
+ // Re-export all event types
6
+ export * from "./refund-created/types";
7
+ export * from "./refund-updated/types";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Pub/Sub module for Command Frame
3
+ * Provides topic subscription functionality for iframe apps
4
+ */
5
+ export * from "./types";
6
+ export { TopicSubscriber } from "./subscriber";
7
+ import { TopicSubscriber } from "./subscriber";
8
+ /**
9
+ * Get or create the singleton TopicSubscriber instance
10
+ */
11
+ export declare function getTopicSubscriber(options?: {
12
+ origin?: string;
13
+ debug?: boolean;
14
+ }): TopicSubscriber;
15
+ /**
16
+ * Topics API for iframe apps
17
+ */
18
+ declare const topicsApi: {
19
+ /**
20
+ * Subscribe to a topic
21
+ */
22
+ subscribe: <T = any>(topic: string, callback: (event: import("./types").TopicEvent<T>) => void) => string;
23
+ /**
24
+ * Unsubscribe from a topic
25
+ */
26
+ unsubscribe: (topic: string, subscriptionId: string) => boolean;
27
+ /**
28
+ * Unsubscribe all callbacks for a topic
29
+ */
30
+ unsubscribeAll: (topic: string) => number;
31
+ /**
32
+ * Get available topics
33
+ */
34
+ getTopics: () => Promise<import("./types").TopicDefinition[]>;
35
+ };
36
+ export { topicsApi as topics };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Pub/Sub module for Command Frame
3
+ * Provides topic subscription functionality for iframe apps
4
+ */
5
+ export * from "./types";
6
+ export { TopicSubscriber } from "./subscriber";
7
+ // Singleton instance
8
+ import { TopicSubscriber } from "./subscriber";
9
+ let subscriberInstance = null;
10
+ /**
11
+ * Get or create the singleton TopicSubscriber instance
12
+ */
13
+ export function getTopicSubscriber(options) {
14
+ if (!subscriberInstance) {
15
+ subscriberInstance = new TopicSubscriber(options);
16
+ }
17
+ return subscriberInstance;
18
+ }
19
+ /**
20
+ * Topics API for iframe apps
21
+ */
22
+ const topicsApi = {
23
+ /**
24
+ * Subscribe to a topic
25
+ */
26
+ subscribe: (topic, callback) => {
27
+ const subscriber = getTopicSubscriber();
28
+ return subscriber.subscribe(topic, callback);
29
+ },
30
+ /**
31
+ * Unsubscribe from a topic
32
+ */
33
+ unsubscribe: (topic, subscriptionId) => {
34
+ const subscriber = getTopicSubscriber();
35
+ return subscriber.unsubscribe(topic, subscriptionId);
36
+ },
37
+ /**
38
+ * Unsubscribe all callbacks for a topic
39
+ */
40
+ unsubscribeAll: (topic) => {
41
+ const subscriber = getTopicSubscriber();
42
+ return subscriber.unsubscribeAll(topic);
43
+ },
44
+ /**
45
+ * Get available topics
46
+ */
47
+ getTopics: async () => {
48
+ const subscriber = getTopicSubscriber();
49
+ return await subscriber.getTopics();
50
+ }
51
+ };
52
+ export { topicsApi as topics };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes
File without changes