@final-commerce/command-frame 0.1.4 → 0.1.5
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/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/pubsub/topics/customers/customer-assigned/types.d.ts +12 -0
- package/dist/pubsub/topics/customers/customer-assigned/types.js +1 -0
- package/dist/pubsub/topics/customers/customer-created/types.d.ts +12 -0
- package/dist/pubsub/topics/customers/customer-created/types.js +1 -0
- package/dist/pubsub/topics/customers/customer-note-added/types.d.ts +13 -0
- package/dist/pubsub/topics/customers/customer-note-added/types.js +1 -0
- package/dist/pubsub/topics/customers/customer-note-deleted/types.d.ts +13 -0
- package/dist/pubsub/topics/customers/customer-note-deleted/types.js +1 -0
- package/dist/pubsub/topics/customers/customer-unassigned/types.d.ts +12 -0
- package/dist/pubsub/topics/customers/customer-unassigned/types.js +1 -0
- package/dist/pubsub/topics/customers/customer-updated/types.d.ts +12 -0
- package/dist/pubsub/topics/customers/customer-updated/types.js +1 -0
- package/dist/pubsub/topics/customers/index.d.ts +7 -0
- package/dist/pubsub/topics/customers/index.js +43 -0
- package/dist/pubsub/topics/customers/types.d.ts +18 -0
- package/dist/pubsub/topics/customers/types.js +11 -0
- package/dist/pubsub/topics/index.d.ts +5 -0
- package/dist/pubsub/topics/index.js +5 -0
- package/dist/pubsub/topics.d.ts +36 -0
- package/dist/pubsub/topics.js +52 -0
- package/package.json +1 -1
- /package/dist/pubsub/{index.d.ts → topic.d.ts} +0 -0
- /package/dist/pubsub/{index.js → topic.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -108,5 +108,7 @@ 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 type { CustomerCreatedPayload, CustomerUpdatedPayload, CustomerNoteAddedPayload, CustomerNoteDeletedPayload, CustomerAssignedPayload, CustomerUnassignedPayload, CustomerCreatedEvent, CustomerUpdatedEvent, CustomerNoteAddedEvent, CustomerNoteDeletedEvent, CustomerAssignedEvent, CustomerUnassignedEvent, CustomersEventType, CustomersEventPayload } from "./pubsub/topics/customers/types";
|
package/dist/index.js
CHANGED
|
@@ -122,4 +122,6 @@ 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";
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,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
|
File without changes
|
|
File without changes
|