@opens/gateways 1.1.0 → 1.3.0
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.mts +249 -1
- package/dist/index.d.ts +249 -1
- package/dist/index.js +93 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -62,6 +62,38 @@ interface WorkGroupResponse {
|
|
|
62
62
|
/** Response returned by the Customer Service API when fetching members of a work group. */
|
|
63
63
|
type WorkGroupMembersResponse = WorkGroupMember[];
|
|
64
64
|
|
|
65
|
+
interface User {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string;
|
|
68
|
+
email: string;
|
|
69
|
+
profile: 'p_admin' | 'p_manager' | 'p_corporative' | 'p_agent';
|
|
70
|
+
status: 'new' | 'activated' | 'disabled';
|
|
71
|
+
avatar: string | null;
|
|
72
|
+
type: string;
|
|
73
|
+
companyId: string;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
interface GetAllUsersParams {
|
|
78
|
+
status?: string;
|
|
79
|
+
includeWorkGroups?: boolean;
|
|
80
|
+
withoutOpensUsers?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface GetAllUsersResponse {
|
|
83
|
+
users: User[];
|
|
84
|
+
}
|
|
85
|
+
interface ManagedUser {
|
|
86
|
+
id: string;
|
|
87
|
+
username: string;
|
|
88
|
+
email: string;
|
|
89
|
+
profile: string;
|
|
90
|
+
status: string;
|
|
91
|
+
companyId: string;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
}
|
|
95
|
+
type GetManagedUsersResponse = ManagedUser[];
|
|
96
|
+
|
|
65
97
|
/**
|
|
66
98
|
* Gateway for interacting with the Customer Service API.
|
|
67
99
|
*/
|
|
@@ -96,6 +128,8 @@ declare class CustomerServiceGateway {
|
|
|
96
128
|
* @returns The members of the work group.
|
|
97
129
|
*/
|
|
98
130
|
getWorkGroupMembers(groupId: string, companyId?: string, profile?: string[]): Promise<WorkGroupMembersResponse>;
|
|
131
|
+
getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse>;
|
|
132
|
+
getManagedUsers(managerId: string): Promise<GetManagedUsersResponse>;
|
|
99
133
|
}
|
|
100
134
|
|
|
101
135
|
/** A provider entity returned by the Chat Config API. */
|
|
@@ -199,6 +233,104 @@ interface Queue {
|
|
|
199
233
|
members: QueueMember[];
|
|
200
234
|
distributionType: DistributionType;
|
|
201
235
|
}
|
|
236
|
+
/** Response returned when listing queues. */
|
|
237
|
+
interface QueueListResponse {
|
|
238
|
+
queues: Queue[];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Representation of a button in a Meta template. */
|
|
242
|
+
interface MetaTemplateButton {
|
|
243
|
+
/** Unique identifier of the button. */
|
|
244
|
+
id: string;
|
|
245
|
+
/** Type of the button (e.g. 'URL', 'PHONE_NUMBER', 'QUICK_REPLY'). */
|
|
246
|
+
type: string;
|
|
247
|
+
/** Text displayed on the button. */
|
|
248
|
+
text: string;
|
|
249
|
+
/** Value of the button (e.g. URL or phone number). */
|
|
250
|
+
value?: string | null;
|
|
251
|
+
/** Dynamic variable of the button. */
|
|
252
|
+
variable?: string | null;
|
|
253
|
+
/** ID of the template configuration to which the button belongs. */
|
|
254
|
+
templateConfigId: string;
|
|
255
|
+
/** Creation date of the record. */
|
|
256
|
+
createdAt?: string;
|
|
257
|
+
/** Update date of the record. */
|
|
258
|
+
updatedAt?: string;
|
|
259
|
+
}
|
|
260
|
+
/** Detailed configuration of a Meta template. */
|
|
261
|
+
interface MetaTemplateConfigResponse {
|
|
262
|
+
/** Unique identifier of the template configuration. */
|
|
263
|
+
id: string;
|
|
264
|
+
/** Name of the template in Meta. */
|
|
265
|
+
name: string;
|
|
266
|
+
/** Identifier of the template in Meta. */
|
|
267
|
+
templateId: string;
|
|
268
|
+
/** Company identifier in Meta. */
|
|
269
|
+
companyId: string;
|
|
270
|
+
/** Format of the template (e.g. TEXT, IMAGE, VIDEO). */
|
|
271
|
+
format?: string | null;
|
|
272
|
+
/** Content of the template header. */
|
|
273
|
+
headerContent?: string | null;
|
|
274
|
+
/** Defines if the header has dynamic content (parameters). */
|
|
275
|
+
isDynamicHeader: boolean;
|
|
276
|
+
/** Type of the header (e.g. TEXT, IMAGE, DOCUMENT, VIDEO). */
|
|
277
|
+
headerType?: string | null;
|
|
278
|
+
/** Content of the template body. */
|
|
279
|
+
bodyContent?: string | null;
|
|
280
|
+
/** Type of the body (e.g. TEXT). */
|
|
281
|
+
bodyType?: string | null;
|
|
282
|
+
/** Content of the template footer. */
|
|
283
|
+
footerContent?: string | null;
|
|
284
|
+
/** Type of the footer (e.g. TEXT). */
|
|
285
|
+
footerType?: string | null;
|
|
286
|
+
/** ID of the configuration associated with the template. */
|
|
287
|
+
configId?: string | null;
|
|
288
|
+
/** ID of the provider associated with the template. */
|
|
289
|
+
providerId?: string | null;
|
|
290
|
+
/** Creation date of the record. */
|
|
291
|
+
createdAt?: string;
|
|
292
|
+
/** Update date of the record. */
|
|
293
|
+
updatedAt?: string;
|
|
294
|
+
/** List of buttons in the template. */
|
|
295
|
+
buttons?: MetaTemplateButton[];
|
|
296
|
+
}
|
|
297
|
+
/** Response containing the list of template configurations associated with a configuration. */
|
|
298
|
+
interface MetaTemplateConfigsResponse {
|
|
299
|
+
/** List of Meta template configurations. */
|
|
300
|
+
templatesConfig: MetaTemplateConfigResponse[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Request payload for finding or creating a queue rule. */
|
|
304
|
+
interface FindOrCreateQueueRuleRequest {
|
|
305
|
+
companyId: string;
|
|
306
|
+
queueId: string;
|
|
307
|
+
configId: string;
|
|
308
|
+
}
|
|
309
|
+
/** Response returned when finding or creating a queue rule. */
|
|
310
|
+
interface QueueRule {
|
|
311
|
+
id: string;
|
|
312
|
+
companyId: string;
|
|
313
|
+
name: string;
|
|
314
|
+
action: string;
|
|
315
|
+
message?: string;
|
|
316
|
+
automaticMessage?: Record<string, unknown>;
|
|
317
|
+
callOnQueue?: Record<string, unknown>;
|
|
318
|
+
uraDescription: string;
|
|
319
|
+
interactiveMessageId: string | null;
|
|
320
|
+
configId?: string;
|
|
321
|
+
queueId?: string;
|
|
322
|
+
redirectQueue: Record<string, unknown> | null;
|
|
323
|
+
redirectRuleId?: string;
|
|
324
|
+
questionnaire?: Record<string, unknown>;
|
|
325
|
+
webhook?: Record<string, unknown>;
|
|
326
|
+
isRoot: boolean;
|
|
327
|
+
redirectDefault: boolean;
|
|
328
|
+
redirectTimeout?: number;
|
|
329
|
+
delay?: number;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
updatedAt: string;
|
|
332
|
+
flow?: Record<string, unknown>[];
|
|
333
|
+
}
|
|
202
334
|
|
|
203
335
|
/**
|
|
204
336
|
* Gateway for interacting with the Chat Config API.
|
|
@@ -225,6 +357,25 @@ declare class ChatConfigGateway {
|
|
|
225
357
|
* @returns The queue data.
|
|
226
358
|
*/
|
|
227
359
|
getQueueById(queueId: string): Promise<Queue>;
|
|
360
|
+
getQueues(): Promise<Queue[]>;
|
|
361
|
+
/**
|
|
362
|
+
* Retrieves a Meta template configuration by its ID.
|
|
363
|
+
* @param templateId - The unique identifier of the template.
|
|
364
|
+
* @returns The Meta template configuration.
|
|
365
|
+
*/
|
|
366
|
+
getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse>;
|
|
367
|
+
/**
|
|
368
|
+
* Retrieves template configurations associated with a configuration ID.
|
|
369
|
+
* @param configId - The configuration identifier.
|
|
370
|
+
* @returns The list of template configurations.
|
|
371
|
+
*/
|
|
372
|
+
getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse>;
|
|
373
|
+
/**
|
|
374
|
+
* Finds an existing queue rule or creates a new one if it does not exist.
|
|
375
|
+
* @param payload - The payload containing companyId, queueId, and configId.
|
|
376
|
+
* @returns The found or created queue rule.
|
|
377
|
+
*/
|
|
378
|
+
findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule>;
|
|
228
379
|
}
|
|
229
380
|
|
|
230
381
|
/** Campaign status literals. */
|
|
@@ -338,6 +489,12 @@ interface CampaignQueryParams {
|
|
|
338
489
|
limit?: number;
|
|
339
490
|
skip?: number;
|
|
340
491
|
}
|
|
492
|
+
/** User entity returned by the Campaigns API. */
|
|
493
|
+
interface CampaignUser {
|
|
494
|
+
id: string;
|
|
495
|
+
name: string;
|
|
496
|
+
status: 'new' | 'activated' | 'disabled';
|
|
497
|
+
}
|
|
341
498
|
|
|
342
499
|
/**
|
|
343
500
|
* Gateway for interacting with the Campaigns API.
|
|
@@ -377,6 +534,93 @@ declare class CampaignsGateway {
|
|
|
377
534
|
* @returns The removed campaign.
|
|
378
535
|
*/
|
|
379
536
|
remove(id: string): Promise<Campaign>;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieves all users associated with campaigns.
|
|
539
|
+
* @returns The list of campaign users.
|
|
540
|
+
*/
|
|
541
|
+
getUsers(): Promise<CampaignUser[]>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Parameters for retrieving configuration templates. */
|
|
545
|
+
interface GetConfigTemplatesParams {
|
|
546
|
+
/** Optional template name filter. */
|
|
547
|
+
templateName?: string;
|
|
548
|
+
/** Optional maximum number of templates to return. */
|
|
549
|
+
limit?: number;
|
|
550
|
+
/** Optional status filter (e.g. 'APPROVED', 'REJECTED', 'PENDING'). */
|
|
551
|
+
status?: string;
|
|
552
|
+
/** Optional category filter (e.g. 'UTILITY', 'MARKETING', 'AUTHENTICATION'). */
|
|
553
|
+
category?: string;
|
|
554
|
+
/** Optional pagination cursor token/URL. */
|
|
555
|
+
next?: string;
|
|
556
|
+
/** Optional pagination cursor 'after' parameter. */
|
|
557
|
+
after?: string;
|
|
558
|
+
}
|
|
559
|
+
/** Component of a message template. */
|
|
560
|
+
interface MessageTemplateComponent {
|
|
561
|
+
/** Type of the component (e.g. 'HEADER', 'BODY', 'FOOTER', 'BUTTONS'). */
|
|
562
|
+
type: string;
|
|
563
|
+
/** Format of the component (e.g. 'TEXT', 'IMAGE', 'DOCUMENT', 'VIDEO'). */
|
|
564
|
+
format?: string;
|
|
565
|
+
/** Text content of the component. */
|
|
566
|
+
text?: string;
|
|
567
|
+
/** List of buttons in the component if type is 'BUTTONS'. */
|
|
568
|
+
buttons?: Array<{
|
|
569
|
+
type: string;
|
|
570
|
+
text: string;
|
|
571
|
+
url?: string;
|
|
572
|
+
phoneNumber?: string;
|
|
573
|
+
}>;
|
|
574
|
+
}
|
|
575
|
+
/** Details of a message template. */
|
|
576
|
+
interface MessageTemplate {
|
|
577
|
+
/** Name of the message template. */
|
|
578
|
+
name: string;
|
|
579
|
+
/** Status of the template (e.g. 'APPROVED', 'REJECTED', 'PENDING'). */
|
|
580
|
+
status: string;
|
|
581
|
+
/** Category of the template (e.g. 'UTILITY', 'MARKETING', 'AUTHENTICATION'). */
|
|
582
|
+
category: string;
|
|
583
|
+
/** Language locale of the template (e.g. 'pt_BR', 'en_US'). */
|
|
584
|
+
language: string;
|
|
585
|
+
/** Components that build up the template content. */
|
|
586
|
+
components: MessageTemplateComponent[];
|
|
587
|
+
/** Unique identifier of the template. */
|
|
588
|
+
id: string;
|
|
589
|
+
}
|
|
590
|
+
/** Pagination information for the template query response. */
|
|
591
|
+
interface ConfigTemplatesPaging {
|
|
592
|
+
/** Cursors used to paginate results. */
|
|
593
|
+
cursors?: {
|
|
594
|
+
/** Cursor pointing to the start of the current range. */
|
|
595
|
+
before?: string;
|
|
596
|
+
/** Cursor pointing to the end of the current range. */
|
|
597
|
+
after?: string;
|
|
598
|
+
};
|
|
599
|
+
/** URL for the next page of results. */
|
|
600
|
+
next?: string;
|
|
601
|
+
}
|
|
602
|
+
/** Response containing the list of message templates configured. */
|
|
603
|
+
interface GetConfigTemplatesResponse {
|
|
604
|
+
/** List of message templates. */
|
|
605
|
+
data: MessageTemplate[];
|
|
606
|
+
/** Pagination information. */
|
|
607
|
+
paging?: ConfigTemplatesPaging;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Gateway for interacting with the Chat Adapter API.
|
|
612
|
+
*/
|
|
613
|
+
declare class ChatAdapterGateway {
|
|
614
|
+
private readonly httpClient;
|
|
615
|
+
private readonly baseUrl;
|
|
616
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
617
|
+
/**
|
|
618
|
+
* Retrieves message templates associated with a configuration.
|
|
619
|
+
* @param configId - The unique identifier of the configuration.
|
|
620
|
+
* @param params - Optional query parameters for filtering and pagination.
|
|
621
|
+
* @returns A promise that resolves to the template list response.
|
|
622
|
+
*/
|
|
623
|
+
getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse>;
|
|
380
624
|
}
|
|
381
625
|
|
|
382
626
|
/**
|
|
@@ -391,6 +635,7 @@ type GatewayMap = {
|
|
|
391
635
|
'customer-service': CustomerServiceGateway;
|
|
392
636
|
'chat-config': ChatConfigGateway;
|
|
393
637
|
'campaigns': CampaignsGateway;
|
|
638
|
+
'chat-adapter': ChatAdapterGateway;
|
|
394
639
|
};
|
|
395
640
|
/**
|
|
396
641
|
* Parameters required to configure the SDK client.
|
|
@@ -412,6 +657,9 @@ interface GatewayClientParams {
|
|
|
412
657
|
campaigns?: {
|
|
413
658
|
baseUrl: string;
|
|
414
659
|
};
|
|
660
|
+
chatAdapter?: {
|
|
661
|
+
baseUrl: string;
|
|
662
|
+
};
|
|
415
663
|
};
|
|
416
664
|
}
|
|
417
665
|
|
|
@@ -438,4 +686,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
438
686
|
*/
|
|
439
687
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
440
688
|
|
|
441
|
-
export { type Campaign, type CampaignContactFilter, type CampaignPaginatedResponse, type CampaignProvider, type CampaignQueryParams, type CampaignSchedule, type CampaignStatus, type CompanyData, type CompanyResponse, type Config, type ConfigListByProviderResponse, type ConfigProvider, type CreateCampaignRequest, type DistributionType, type GetConfigsByProviderParams, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueMember, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
|
689
|
+
export { type Campaign, type CampaignContactFilter, type CampaignPaginatedResponse, type CampaignProvider, type CampaignQueryParams, type CampaignSchedule, type CampaignStatus, type CampaignUser, type CompanyData, type CompanyResponse, type Config, type ConfigListByProviderResponse, type ConfigProvider, type ConfigTemplatesPaging, type CreateCampaignRequest, type DistributionType, type FindOrCreateQueueRuleRequest, type GetAllUsersParams, type GetAllUsersResponse, type GetConfigTemplatesParams, type GetConfigTemplatesResponse, type GetConfigsByProviderParams, type GetManagedUsersResponse, type ManagedUser, type MessageTemplate, type MessageTemplateComponent, type MetaTemplateButton, type MetaTemplateConfigResponse, type MetaTemplateConfigsResponse, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueListResponse, type QueueMember, type QueueRule, type User, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,38 @@ interface WorkGroupResponse {
|
|
|
62
62
|
/** Response returned by the Customer Service API when fetching members of a work group. */
|
|
63
63
|
type WorkGroupMembersResponse = WorkGroupMember[];
|
|
64
64
|
|
|
65
|
+
interface User {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string;
|
|
68
|
+
email: string;
|
|
69
|
+
profile: 'p_admin' | 'p_manager' | 'p_corporative' | 'p_agent';
|
|
70
|
+
status: 'new' | 'activated' | 'disabled';
|
|
71
|
+
avatar: string | null;
|
|
72
|
+
type: string;
|
|
73
|
+
companyId: string;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
interface GetAllUsersParams {
|
|
78
|
+
status?: string;
|
|
79
|
+
includeWorkGroups?: boolean;
|
|
80
|
+
withoutOpensUsers?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface GetAllUsersResponse {
|
|
83
|
+
users: User[];
|
|
84
|
+
}
|
|
85
|
+
interface ManagedUser {
|
|
86
|
+
id: string;
|
|
87
|
+
username: string;
|
|
88
|
+
email: string;
|
|
89
|
+
profile: string;
|
|
90
|
+
status: string;
|
|
91
|
+
companyId: string;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
}
|
|
95
|
+
type GetManagedUsersResponse = ManagedUser[];
|
|
96
|
+
|
|
65
97
|
/**
|
|
66
98
|
* Gateway for interacting with the Customer Service API.
|
|
67
99
|
*/
|
|
@@ -96,6 +128,8 @@ declare class CustomerServiceGateway {
|
|
|
96
128
|
* @returns The members of the work group.
|
|
97
129
|
*/
|
|
98
130
|
getWorkGroupMembers(groupId: string, companyId?: string, profile?: string[]): Promise<WorkGroupMembersResponse>;
|
|
131
|
+
getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse>;
|
|
132
|
+
getManagedUsers(managerId: string): Promise<GetManagedUsersResponse>;
|
|
99
133
|
}
|
|
100
134
|
|
|
101
135
|
/** A provider entity returned by the Chat Config API. */
|
|
@@ -199,6 +233,104 @@ interface Queue {
|
|
|
199
233
|
members: QueueMember[];
|
|
200
234
|
distributionType: DistributionType;
|
|
201
235
|
}
|
|
236
|
+
/** Response returned when listing queues. */
|
|
237
|
+
interface QueueListResponse {
|
|
238
|
+
queues: Queue[];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Representation of a button in a Meta template. */
|
|
242
|
+
interface MetaTemplateButton {
|
|
243
|
+
/** Unique identifier of the button. */
|
|
244
|
+
id: string;
|
|
245
|
+
/** Type of the button (e.g. 'URL', 'PHONE_NUMBER', 'QUICK_REPLY'). */
|
|
246
|
+
type: string;
|
|
247
|
+
/** Text displayed on the button. */
|
|
248
|
+
text: string;
|
|
249
|
+
/** Value of the button (e.g. URL or phone number). */
|
|
250
|
+
value?: string | null;
|
|
251
|
+
/** Dynamic variable of the button. */
|
|
252
|
+
variable?: string | null;
|
|
253
|
+
/** ID of the template configuration to which the button belongs. */
|
|
254
|
+
templateConfigId: string;
|
|
255
|
+
/** Creation date of the record. */
|
|
256
|
+
createdAt?: string;
|
|
257
|
+
/** Update date of the record. */
|
|
258
|
+
updatedAt?: string;
|
|
259
|
+
}
|
|
260
|
+
/** Detailed configuration of a Meta template. */
|
|
261
|
+
interface MetaTemplateConfigResponse {
|
|
262
|
+
/** Unique identifier of the template configuration. */
|
|
263
|
+
id: string;
|
|
264
|
+
/** Name of the template in Meta. */
|
|
265
|
+
name: string;
|
|
266
|
+
/** Identifier of the template in Meta. */
|
|
267
|
+
templateId: string;
|
|
268
|
+
/** Company identifier in Meta. */
|
|
269
|
+
companyId: string;
|
|
270
|
+
/** Format of the template (e.g. TEXT, IMAGE, VIDEO). */
|
|
271
|
+
format?: string | null;
|
|
272
|
+
/** Content of the template header. */
|
|
273
|
+
headerContent?: string | null;
|
|
274
|
+
/** Defines if the header has dynamic content (parameters). */
|
|
275
|
+
isDynamicHeader: boolean;
|
|
276
|
+
/** Type of the header (e.g. TEXT, IMAGE, DOCUMENT, VIDEO). */
|
|
277
|
+
headerType?: string | null;
|
|
278
|
+
/** Content of the template body. */
|
|
279
|
+
bodyContent?: string | null;
|
|
280
|
+
/** Type of the body (e.g. TEXT). */
|
|
281
|
+
bodyType?: string | null;
|
|
282
|
+
/** Content of the template footer. */
|
|
283
|
+
footerContent?: string | null;
|
|
284
|
+
/** Type of the footer (e.g. TEXT). */
|
|
285
|
+
footerType?: string | null;
|
|
286
|
+
/** ID of the configuration associated with the template. */
|
|
287
|
+
configId?: string | null;
|
|
288
|
+
/** ID of the provider associated with the template. */
|
|
289
|
+
providerId?: string | null;
|
|
290
|
+
/** Creation date of the record. */
|
|
291
|
+
createdAt?: string;
|
|
292
|
+
/** Update date of the record. */
|
|
293
|
+
updatedAt?: string;
|
|
294
|
+
/** List of buttons in the template. */
|
|
295
|
+
buttons?: MetaTemplateButton[];
|
|
296
|
+
}
|
|
297
|
+
/** Response containing the list of template configurations associated with a configuration. */
|
|
298
|
+
interface MetaTemplateConfigsResponse {
|
|
299
|
+
/** List of Meta template configurations. */
|
|
300
|
+
templatesConfig: MetaTemplateConfigResponse[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Request payload for finding or creating a queue rule. */
|
|
304
|
+
interface FindOrCreateQueueRuleRequest {
|
|
305
|
+
companyId: string;
|
|
306
|
+
queueId: string;
|
|
307
|
+
configId: string;
|
|
308
|
+
}
|
|
309
|
+
/** Response returned when finding or creating a queue rule. */
|
|
310
|
+
interface QueueRule {
|
|
311
|
+
id: string;
|
|
312
|
+
companyId: string;
|
|
313
|
+
name: string;
|
|
314
|
+
action: string;
|
|
315
|
+
message?: string;
|
|
316
|
+
automaticMessage?: Record<string, unknown>;
|
|
317
|
+
callOnQueue?: Record<string, unknown>;
|
|
318
|
+
uraDescription: string;
|
|
319
|
+
interactiveMessageId: string | null;
|
|
320
|
+
configId?: string;
|
|
321
|
+
queueId?: string;
|
|
322
|
+
redirectQueue: Record<string, unknown> | null;
|
|
323
|
+
redirectRuleId?: string;
|
|
324
|
+
questionnaire?: Record<string, unknown>;
|
|
325
|
+
webhook?: Record<string, unknown>;
|
|
326
|
+
isRoot: boolean;
|
|
327
|
+
redirectDefault: boolean;
|
|
328
|
+
redirectTimeout?: number;
|
|
329
|
+
delay?: number;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
updatedAt: string;
|
|
332
|
+
flow?: Record<string, unknown>[];
|
|
333
|
+
}
|
|
202
334
|
|
|
203
335
|
/**
|
|
204
336
|
* Gateway for interacting with the Chat Config API.
|
|
@@ -225,6 +357,25 @@ declare class ChatConfigGateway {
|
|
|
225
357
|
* @returns The queue data.
|
|
226
358
|
*/
|
|
227
359
|
getQueueById(queueId: string): Promise<Queue>;
|
|
360
|
+
getQueues(): Promise<Queue[]>;
|
|
361
|
+
/**
|
|
362
|
+
* Retrieves a Meta template configuration by its ID.
|
|
363
|
+
* @param templateId - The unique identifier of the template.
|
|
364
|
+
* @returns The Meta template configuration.
|
|
365
|
+
*/
|
|
366
|
+
getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse>;
|
|
367
|
+
/**
|
|
368
|
+
* Retrieves template configurations associated with a configuration ID.
|
|
369
|
+
* @param configId - The configuration identifier.
|
|
370
|
+
* @returns The list of template configurations.
|
|
371
|
+
*/
|
|
372
|
+
getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse>;
|
|
373
|
+
/**
|
|
374
|
+
* Finds an existing queue rule or creates a new one if it does not exist.
|
|
375
|
+
* @param payload - The payload containing companyId, queueId, and configId.
|
|
376
|
+
* @returns The found or created queue rule.
|
|
377
|
+
*/
|
|
378
|
+
findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule>;
|
|
228
379
|
}
|
|
229
380
|
|
|
230
381
|
/** Campaign status literals. */
|
|
@@ -338,6 +489,12 @@ interface CampaignQueryParams {
|
|
|
338
489
|
limit?: number;
|
|
339
490
|
skip?: number;
|
|
340
491
|
}
|
|
492
|
+
/** User entity returned by the Campaigns API. */
|
|
493
|
+
interface CampaignUser {
|
|
494
|
+
id: string;
|
|
495
|
+
name: string;
|
|
496
|
+
status: 'new' | 'activated' | 'disabled';
|
|
497
|
+
}
|
|
341
498
|
|
|
342
499
|
/**
|
|
343
500
|
* Gateway for interacting with the Campaigns API.
|
|
@@ -377,6 +534,93 @@ declare class CampaignsGateway {
|
|
|
377
534
|
* @returns The removed campaign.
|
|
378
535
|
*/
|
|
379
536
|
remove(id: string): Promise<Campaign>;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieves all users associated with campaigns.
|
|
539
|
+
* @returns The list of campaign users.
|
|
540
|
+
*/
|
|
541
|
+
getUsers(): Promise<CampaignUser[]>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Parameters for retrieving configuration templates. */
|
|
545
|
+
interface GetConfigTemplatesParams {
|
|
546
|
+
/** Optional template name filter. */
|
|
547
|
+
templateName?: string;
|
|
548
|
+
/** Optional maximum number of templates to return. */
|
|
549
|
+
limit?: number;
|
|
550
|
+
/** Optional status filter (e.g. 'APPROVED', 'REJECTED', 'PENDING'). */
|
|
551
|
+
status?: string;
|
|
552
|
+
/** Optional category filter (e.g. 'UTILITY', 'MARKETING', 'AUTHENTICATION'). */
|
|
553
|
+
category?: string;
|
|
554
|
+
/** Optional pagination cursor token/URL. */
|
|
555
|
+
next?: string;
|
|
556
|
+
/** Optional pagination cursor 'after' parameter. */
|
|
557
|
+
after?: string;
|
|
558
|
+
}
|
|
559
|
+
/** Component of a message template. */
|
|
560
|
+
interface MessageTemplateComponent {
|
|
561
|
+
/** Type of the component (e.g. 'HEADER', 'BODY', 'FOOTER', 'BUTTONS'). */
|
|
562
|
+
type: string;
|
|
563
|
+
/** Format of the component (e.g. 'TEXT', 'IMAGE', 'DOCUMENT', 'VIDEO'). */
|
|
564
|
+
format?: string;
|
|
565
|
+
/** Text content of the component. */
|
|
566
|
+
text?: string;
|
|
567
|
+
/** List of buttons in the component if type is 'BUTTONS'. */
|
|
568
|
+
buttons?: Array<{
|
|
569
|
+
type: string;
|
|
570
|
+
text: string;
|
|
571
|
+
url?: string;
|
|
572
|
+
phoneNumber?: string;
|
|
573
|
+
}>;
|
|
574
|
+
}
|
|
575
|
+
/** Details of a message template. */
|
|
576
|
+
interface MessageTemplate {
|
|
577
|
+
/** Name of the message template. */
|
|
578
|
+
name: string;
|
|
579
|
+
/** Status of the template (e.g. 'APPROVED', 'REJECTED', 'PENDING'). */
|
|
580
|
+
status: string;
|
|
581
|
+
/** Category of the template (e.g. 'UTILITY', 'MARKETING', 'AUTHENTICATION'). */
|
|
582
|
+
category: string;
|
|
583
|
+
/** Language locale of the template (e.g. 'pt_BR', 'en_US'). */
|
|
584
|
+
language: string;
|
|
585
|
+
/** Components that build up the template content. */
|
|
586
|
+
components: MessageTemplateComponent[];
|
|
587
|
+
/** Unique identifier of the template. */
|
|
588
|
+
id: string;
|
|
589
|
+
}
|
|
590
|
+
/** Pagination information for the template query response. */
|
|
591
|
+
interface ConfigTemplatesPaging {
|
|
592
|
+
/** Cursors used to paginate results. */
|
|
593
|
+
cursors?: {
|
|
594
|
+
/** Cursor pointing to the start of the current range. */
|
|
595
|
+
before?: string;
|
|
596
|
+
/** Cursor pointing to the end of the current range. */
|
|
597
|
+
after?: string;
|
|
598
|
+
};
|
|
599
|
+
/** URL for the next page of results. */
|
|
600
|
+
next?: string;
|
|
601
|
+
}
|
|
602
|
+
/** Response containing the list of message templates configured. */
|
|
603
|
+
interface GetConfigTemplatesResponse {
|
|
604
|
+
/** List of message templates. */
|
|
605
|
+
data: MessageTemplate[];
|
|
606
|
+
/** Pagination information. */
|
|
607
|
+
paging?: ConfigTemplatesPaging;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Gateway for interacting with the Chat Adapter API.
|
|
612
|
+
*/
|
|
613
|
+
declare class ChatAdapterGateway {
|
|
614
|
+
private readonly httpClient;
|
|
615
|
+
private readonly baseUrl;
|
|
616
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
617
|
+
/**
|
|
618
|
+
* Retrieves message templates associated with a configuration.
|
|
619
|
+
* @param configId - The unique identifier of the configuration.
|
|
620
|
+
* @param params - Optional query parameters for filtering and pagination.
|
|
621
|
+
* @returns A promise that resolves to the template list response.
|
|
622
|
+
*/
|
|
623
|
+
getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse>;
|
|
380
624
|
}
|
|
381
625
|
|
|
382
626
|
/**
|
|
@@ -391,6 +635,7 @@ type GatewayMap = {
|
|
|
391
635
|
'customer-service': CustomerServiceGateway;
|
|
392
636
|
'chat-config': ChatConfigGateway;
|
|
393
637
|
'campaigns': CampaignsGateway;
|
|
638
|
+
'chat-adapter': ChatAdapterGateway;
|
|
394
639
|
};
|
|
395
640
|
/**
|
|
396
641
|
* Parameters required to configure the SDK client.
|
|
@@ -412,6 +657,9 @@ interface GatewayClientParams {
|
|
|
412
657
|
campaigns?: {
|
|
413
658
|
baseUrl: string;
|
|
414
659
|
};
|
|
660
|
+
chatAdapter?: {
|
|
661
|
+
baseUrl: string;
|
|
662
|
+
};
|
|
415
663
|
};
|
|
416
664
|
}
|
|
417
665
|
|
|
@@ -438,4 +686,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
438
686
|
*/
|
|
439
687
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
440
688
|
|
|
441
|
-
export { type Campaign, type CampaignContactFilter, type CampaignPaginatedResponse, type CampaignProvider, type CampaignQueryParams, type CampaignSchedule, type CampaignStatus, type CompanyData, type CompanyResponse, type Config, type ConfigListByProviderResponse, type ConfigProvider, type CreateCampaignRequest, type DistributionType, type GetConfigsByProviderParams, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueMember, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
|
689
|
+
export { type Campaign, type CampaignContactFilter, type CampaignPaginatedResponse, type CampaignProvider, type CampaignQueryParams, type CampaignSchedule, type CampaignStatus, type CampaignUser, type CompanyData, type CompanyResponse, type Config, type ConfigListByProviderResponse, type ConfigProvider, type ConfigTemplatesPaging, type CreateCampaignRequest, type DistributionType, type FindOrCreateQueueRuleRequest, type GetAllUsersParams, type GetAllUsersResponse, type GetConfigTemplatesParams, type GetConfigTemplatesResponse, type GetConfigsByProviderParams, type GetManagedUsersResponse, type ManagedUser, type MessageTemplate, type MessageTemplateComponent, type MetaTemplateButton, type MetaTemplateConfigResponse, type MetaTemplateConfigsResponse, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueListResponse, type QueueMember, type QueueRule, type User, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
package/dist/index.js
CHANGED
|
@@ -85,6 +85,19 @@ var CustomerServiceGateway = class {
|
|
|
85
85
|
);
|
|
86
86
|
return data;
|
|
87
87
|
}
|
|
88
|
+
async getAllUsers(params) {
|
|
89
|
+
const { data } = await this.httpClient.get(
|
|
90
|
+
`${this.baseUrl}/companies/users`,
|
|
91
|
+
{ params }
|
|
92
|
+
);
|
|
93
|
+
return data;
|
|
94
|
+
}
|
|
95
|
+
async getManagedUsers(managerId) {
|
|
96
|
+
const { data } = await this.httpClient.get(
|
|
97
|
+
`${this.baseUrl}/users/managed/${managerId}`
|
|
98
|
+
);
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
88
101
|
};
|
|
89
102
|
|
|
90
103
|
// src/chat-config/index.ts
|
|
@@ -125,6 +138,44 @@ var ChatConfigGateway = class {
|
|
|
125
138
|
const { data } = await this.httpClient.get(`${this.baseUrl}/queue/${queueId}`);
|
|
126
139
|
return data;
|
|
127
140
|
}
|
|
141
|
+
async getQueues() {
|
|
142
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/queues`);
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Retrieves a Meta template configuration by its ID.
|
|
147
|
+
* @param templateId - The unique identifier of the template.
|
|
148
|
+
* @returns The Meta template configuration.
|
|
149
|
+
*/
|
|
150
|
+
async getMetaTemplateById(templateId) {
|
|
151
|
+
const { data } = await this.httpClient.get(
|
|
152
|
+
`${this.baseUrl}/meta-templates-config/${templateId}`
|
|
153
|
+
);
|
|
154
|
+
return data;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Retrieves template configurations associated with a configuration ID.
|
|
158
|
+
* @param configId - The configuration identifier.
|
|
159
|
+
* @returns The list of template configurations.
|
|
160
|
+
*/
|
|
161
|
+
async getTemplateConfigsByConfigId(configId) {
|
|
162
|
+
const { data } = await this.httpClient.get(
|
|
163
|
+
`${this.baseUrl}/meta-templates-config/config/${configId}`
|
|
164
|
+
);
|
|
165
|
+
return data;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Finds an existing queue rule or creates a new one if it does not exist.
|
|
169
|
+
* @param payload - The payload containing companyId, queueId, and configId.
|
|
170
|
+
* @returns The found or created queue rule.
|
|
171
|
+
*/
|
|
172
|
+
async findOrCreateQueueRule(payload) {
|
|
173
|
+
const { data } = await this.httpClient.put(
|
|
174
|
+
`${this.baseUrl}/rules/queue/find-or-create`,
|
|
175
|
+
payload
|
|
176
|
+
);
|
|
177
|
+
return data;
|
|
178
|
+
}
|
|
128
179
|
};
|
|
129
180
|
|
|
130
181
|
// src/campaigns/index.ts
|
|
@@ -183,6 +234,37 @@ var CampaignsGateway = class {
|
|
|
183
234
|
const { data } = await this.httpClient.delete(`${this.baseUrl}/campaigns/${id}`);
|
|
184
235
|
return data;
|
|
185
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Retrieves all users associated with campaigns.
|
|
239
|
+
* @returns The list of campaign users.
|
|
240
|
+
*/
|
|
241
|
+
async getUsers() {
|
|
242
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/users`);
|
|
243
|
+
return data;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// src/chat-adapter/index.ts
|
|
248
|
+
var ChatAdapterGateway = class {
|
|
249
|
+
constructor(httpClient, baseUrl) {
|
|
250
|
+
this.httpClient = httpClient;
|
|
251
|
+
this.baseUrl = baseUrl;
|
|
252
|
+
}
|
|
253
|
+
httpClient;
|
|
254
|
+
baseUrl;
|
|
255
|
+
/**
|
|
256
|
+
* Retrieves message templates associated with a configuration.
|
|
257
|
+
* @param configId - The unique identifier of the configuration.
|
|
258
|
+
* @param params - Optional query parameters for filtering and pagination.
|
|
259
|
+
* @returns A promise that resolves to the template list response.
|
|
260
|
+
*/
|
|
261
|
+
async getConfigTemplates(configId, params) {
|
|
262
|
+
const { data } = await this.httpClient.get(
|
|
263
|
+
`${this.baseUrl}/message-templates/${configId}`,
|
|
264
|
+
{ params }
|
|
265
|
+
);
|
|
266
|
+
return data;
|
|
267
|
+
}
|
|
186
268
|
};
|
|
187
269
|
|
|
188
270
|
// src/@common/client.ts
|
|
@@ -190,10 +272,12 @@ var SDKGateways = class {
|
|
|
190
272
|
customerService;
|
|
191
273
|
chatConfig;
|
|
192
274
|
campaigns;
|
|
193
|
-
|
|
275
|
+
chatAdapter;
|
|
276
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter) {
|
|
194
277
|
this.customerService = customerService;
|
|
195
278
|
this.chatConfig = chatConfig;
|
|
196
279
|
this.campaigns = campaigns;
|
|
280
|
+
this.chatAdapter = chatAdapter;
|
|
197
281
|
}
|
|
198
282
|
};
|
|
199
283
|
function createClient(params) {
|
|
@@ -201,14 +285,16 @@ function createClient(params) {
|
|
|
201
285
|
const customerService = params.services.customerService ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl) : null;
|
|
202
286
|
const chatConfig = params.services.chatConfig ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl) : null;
|
|
203
287
|
const campaigns = params.services.campaigns ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl) : null;
|
|
204
|
-
|
|
288
|
+
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
289
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter);
|
|
205
290
|
}
|
|
206
291
|
|
|
207
292
|
// src/@common/enums.ts
|
|
208
293
|
var SERVICE_GATEWAYS = {
|
|
209
294
|
CUSTOMER_SERVICE: "customer-service",
|
|
210
295
|
CHAT_CONFIG: "chat-config",
|
|
211
|
-
CAMPAIGNS: "campaigns"
|
|
296
|
+
CAMPAIGNS: "campaigns",
|
|
297
|
+
CHAT_ADAPTER: "chat-adapter"
|
|
212
298
|
};
|
|
213
299
|
|
|
214
300
|
// src/index.ts
|
|
@@ -240,6 +326,10 @@ function gateway(service) {
|
|
|
240
326
|
if (!sdk.client.campaigns)
|
|
241
327
|
throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);
|
|
242
328
|
return sdk.client.campaigns;
|
|
329
|
+
case SERVICE_GATEWAYS.CHAT_ADAPTER:
|
|
330
|
+
if (!sdk.client.chatAdapter)
|
|
331
|
+
throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);
|
|
332
|
+
return sdk.client.chatAdapter;
|
|
243
333
|
default:
|
|
244
334
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
245
335
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/@common/client.ts","../src/@common/enums.ts"],"sourcesContent":["import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\n","import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type { WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse } from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(groupId: string, companyId?: string, profile?: string[]): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type { WorkGroup, WorkGroupMember, WorkGroupMembersResponse, WorkGroupListResponse, WorkGroupResponse } from './contracts/work-group';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport { Queue } from './contracts/queues';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n} from './contracts/campaign';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n} from './contracts/campaign';","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n constructor(customerService: CustomerServiceGateway | null, chatConfig: ChatConfigGateway | null, campaigns: CampaignsGateway | null) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests. */\n axiosClient: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient;\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qBAAqB,SAAS,EAAE;AAC3G,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,WA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;AACd,cAAM,IAAI,MAAM,4EAA4E;AAC9F,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/@common/client.ts","../src/@common/enums.ts"],"sourcesContent":["import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\n","import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type { FindOrCreateQueueRuleRequest, QueueRule } from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(\n `${this.baseUrl}/rules/queue/find-or-create`,\n payload,\n );\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves all users associated with campaigns.\n * @returns The list of campaign users.\n */\n async getUsers(): Promise<CampaignUser[]> {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(\n configId: string,\n params?: GetConfigTemplatesParams,\n ): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests. */\n axiosClient: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient;\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qBAAqB,SAAS,EAAE;AAC3G,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,WAAmD;AACrE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW;AAAA,MACrC,GAAG,KAAK,OAAO;AAAA,MACf,EAAE,QAAQ,EAAE,YAAY,UAAU,EAAE;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,aAAqB,WAAgD;AAC1F,UAAM,SAAS,YAAY,EAAE,YAAY,UAAU,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AI,OAAO;AACd,cAAM,IAAI,MAAM,8EAA8E;AAChG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,4EAA4E;AAC9F,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,+EAA+E;AACjG,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -58,6 +58,19 @@ var CustomerServiceGateway = class {
|
|
|
58
58
|
);
|
|
59
59
|
return data;
|
|
60
60
|
}
|
|
61
|
+
async getAllUsers(params) {
|
|
62
|
+
const { data } = await this.httpClient.get(
|
|
63
|
+
`${this.baseUrl}/companies/users`,
|
|
64
|
+
{ params }
|
|
65
|
+
);
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
async getManagedUsers(managerId) {
|
|
69
|
+
const { data } = await this.httpClient.get(
|
|
70
|
+
`${this.baseUrl}/users/managed/${managerId}`
|
|
71
|
+
);
|
|
72
|
+
return data;
|
|
73
|
+
}
|
|
61
74
|
};
|
|
62
75
|
|
|
63
76
|
// src/chat-config/index.ts
|
|
@@ -98,6 +111,44 @@ var ChatConfigGateway = class {
|
|
|
98
111
|
const { data } = await this.httpClient.get(`${this.baseUrl}/queue/${queueId}`);
|
|
99
112
|
return data;
|
|
100
113
|
}
|
|
114
|
+
async getQueues() {
|
|
115
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/queues`);
|
|
116
|
+
return data;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves a Meta template configuration by its ID.
|
|
120
|
+
* @param templateId - The unique identifier of the template.
|
|
121
|
+
* @returns The Meta template configuration.
|
|
122
|
+
*/
|
|
123
|
+
async getMetaTemplateById(templateId) {
|
|
124
|
+
const { data } = await this.httpClient.get(
|
|
125
|
+
`${this.baseUrl}/meta-templates-config/${templateId}`
|
|
126
|
+
);
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves template configurations associated with a configuration ID.
|
|
131
|
+
* @param configId - The configuration identifier.
|
|
132
|
+
* @returns The list of template configurations.
|
|
133
|
+
*/
|
|
134
|
+
async getTemplateConfigsByConfigId(configId) {
|
|
135
|
+
const { data } = await this.httpClient.get(
|
|
136
|
+
`${this.baseUrl}/meta-templates-config/config/${configId}`
|
|
137
|
+
);
|
|
138
|
+
return data;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Finds an existing queue rule or creates a new one if it does not exist.
|
|
142
|
+
* @param payload - The payload containing companyId, queueId, and configId.
|
|
143
|
+
* @returns The found or created queue rule.
|
|
144
|
+
*/
|
|
145
|
+
async findOrCreateQueueRule(payload) {
|
|
146
|
+
const { data } = await this.httpClient.put(
|
|
147
|
+
`${this.baseUrl}/rules/queue/find-or-create`,
|
|
148
|
+
payload
|
|
149
|
+
);
|
|
150
|
+
return data;
|
|
151
|
+
}
|
|
101
152
|
};
|
|
102
153
|
|
|
103
154
|
// src/campaigns/index.ts
|
|
@@ -156,6 +207,37 @@ var CampaignsGateway = class {
|
|
|
156
207
|
const { data } = await this.httpClient.delete(`${this.baseUrl}/campaigns/${id}`);
|
|
157
208
|
return data;
|
|
158
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Retrieves all users associated with campaigns.
|
|
212
|
+
* @returns The list of campaign users.
|
|
213
|
+
*/
|
|
214
|
+
async getUsers() {
|
|
215
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/users`);
|
|
216
|
+
return data;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// src/chat-adapter/index.ts
|
|
221
|
+
var ChatAdapterGateway = class {
|
|
222
|
+
constructor(httpClient, baseUrl) {
|
|
223
|
+
this.httpClient = httpClient;
|
|
224
|
+
this.baseUrl = baseUrl;
|
|
225
|
+
}
|
|
226
|
+
httpClient;
|
|
227
|
+
baseUrl;
|
|
228
|
+
/**
|
|
229
|
+
* Retrieves message templates associated with a configuration.
|
|
230
|
+
* @param configId - The unique identifier of the configuration.
|
|
231
|
+
* @param params - Optional query parameters for filtering and pagination.
|
|
232
|
+
* @returns A promise that resolves to the template list response.
|
|
233
|
+
*/
|
|
234
|
+
async getConfigTemplates(configId, params) {
|
|
235
|
+
const { data } = await this.httpClient.get(
|
|
236
|
+
`${this.baseUrl}/message-templates/${configId}`,
|
|
237
|
+
{ params }
|
|
238
|
+
);
|
|
239
|
+
return data;
|
|
240
|
+
}
|
|
159
241
|
};
|
|
160
242
|
|
|
161
243
|
// src/@common/client.ts
|
|
@@ -163,10 +245,12 @@ var SDKGateways = class {
|
|
|
163
245
|
customerService;
|
|
164
246
|
chatConfig;
|
|
165
247
|
campaigns;
|
|
166
|
-
|
|
248
|
+
chatAdapter;
|
|
249
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter) {
|
|
167
250
|
this.customerService = customerService;
|
|
168
251
|
this.chatConfig = chatConfig;
|
|
169
252
|
this.campaigns = campaigns;
|
|
253
|
+
this.chatAdapter = chatAdapter;
|
|
170
254
|
}
|
|
171
255
|
};
|
|
172
256
|
function createClient(params) {
|
|
@@ -174,14 +258,16 @@ function createClient(params) {
|
|
|
174
258
|
const customerService = params.services.customerService ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl) : null;
|
|
175
259
|
const chatConfig = params.services.chatConfig ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl) : null;
|
|
176
260
|
const campaigns = params.services.campaigns ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl) : null;
|
|
177
|
-
|
|
261
|
+
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
262
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter);
|
|
178
263
|
}
|
|
179
264
|
|
|
180
265
|
// src/@common/enums.ts
|
|
181
266
|
var SERVICE_GATEWAYS = {
|
|
182
267
|
CUSTOMER_SERVICE: "customer-service",
|
|
183
268
|
CHAT_CONFIG: "chat-config",
|
|
184
|
-
CAMPAIGNS: "campaigns"
|
|
269
|
+
CAMPAIGNS: "campaigns",
|
|
270
|
+
CHAT_ADAPTER: "chat-adapter"
|
|
185
271
|
};
|
|
186
272
|
|
|
187
273
|
// src/index.ts
|
|
@@ -213,6 +299,10 @@ function gateway(service) {
|
|
|
213
299
|
if (!sdk.client.campaigns)
|
|
214
300
|
throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);
|
|
215
301
|
return sdk.client.campaigns;
|
|
302
|
+
case SERVICE_GATEWAYS.CHAT_ADAPTER:
|
|
303
|
+
if (!sdk.client.chatAdapter)
|
|
304
|
+
throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);
|
|
305
|
+
return sdk.client.chatAdapter;
|
|
216
306
|
default:
|
|
217
307
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
218
308
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/@common/client.ts","../src/@common/enums.ts","../src/index.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type { WorkGroupListResponse, WorkGroupMembersResponse, WorkGroupResponse } from './contracts/work-group';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(groupId: string, companyId?: string, profile?: string[]): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type { WorkGroup, WorkGroupMember, WorkGroupMembersResponse, WorkGroupListResponse, WorkGroupResponse } from './contracts/work-group';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport { Queue } from './contracts/queues';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n} from './contracts/campaign';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n} from './contracts/campaign';","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n constructor(customerService: CustomerServiceGateway | null, chatConfig: ChatConfigGateway | null, campaigns: CampaignsGateway | null) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests. */\n axiosClient: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient;\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n","import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\n"],"mappings":";AAOO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qB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AAI,MAAM,8EAA8E;AAChG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,4EAA4E;AAC9F,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/@common/client.ts","../src/@common/enums.ts","../src/index.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport type { CompanyResponse } from './contracts/company';\nimport type {\n WorkGroupListResponse,\n WorkGroupMembersResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nimport type {\n GetAllUsersParams,\n GetAllUsersResponse,\n GetManagedUsersResponse,\n} from './contracts/user';\n\n/**\n * Gateway for interacting with the Customer Service API.\n */\nexport class CustomerServiceGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a company by its unique identifier.\n * @param companyId - The unique identifier of the company.\n * @returns The company data wrapped in a {@link CompanyResponse}.\n */\n async getCompanyById(companyId: string): Promise<CompanyResponse> {\n const { data } = await this.httpClient.get<CompanyResponse>(`${this.baseUrl}/companies/search/${companyId}`);\n return data;\n }\n\n /**\n * Retrieves all work groups for a company.\n * @param companyId - The unique identifier of the company.\n * @returns The work groups for the given company.\n */\n async getWorkGroups(companyId: string): Promise<WorkGroupListResponse> {\n const { data } = await this.httpClient.get<WorkGroupListResponse>(\n `${this.baseUrl}/companies/work-groups`,\n { params: { company_id: companyId } },\n );\n return data;\n }\n\n /**\n * Retrieves a work group by its unique identifier.\n * @param workGroupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @returns The work group data wrapped in a {@link WorkGroupResponse}.\n */\n async getWorkGroupById(workGroupId: string, companyId?: string): Promise<WorkGroupResponse> {\n const params = companyId ? { company_id: companyId } : undefined;\n const { data } = await this.httpClient.get<WorkGroupResponse>(\n `${this.baseUrl}/companies/work-groups/${workGroupId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves the members of a work group by its identifier.\n * @param groupId - The unique identifier of the work group.\n * @param companyId - The unique identifier of the company (optional, sent as query parameter).\n * @param profile - Filter members by profile (optional).\n * @returns The members of the work group.\n */\n async getWorkGroupMembers(\n groupId: string,\n companyId?: string,\n profile?: string[],\n ): Promise<WorkGroupMembersResponse> {\n const params: { company_id?: string; profile?: string[] } = {};\n if (companyId) params.company_id = companyId;\n if (profile) params.profile = profile;\n const { data } = await this.httpClient.get<WorkGroupMembersResponse>(\n `${this.baseUrl}/bonds/work-groups/${groupId}`,\n { params },\n );\n return data;\n }\n\n async getAllUsers(params?: GetAllUsersParams): Promise<GetAllUsersResponse> {\n const { data } = await this.httpClient.get<GetAllUsersResponse>(\n `${this.baseUrl}/companies/users`,\n { params },\n );\n return data;\n }\n\n async getManagedUsers(managerId: string): Promise<GetManagedUsersResponse> {\n const { data } = await this.httpClient.get<GetManagedUsersResponse>(\n `${this.baseUrl}/users/managed/${managerId}`,\n );\n return data;\n }\n}\n\nexport type { CompanyResponse, CompanyData } from './contracts/company';\nexport type {\n WorkGroup,\n WorkGroupMember,\n WorkGroupMembersResponse,\n WorkGroupListResponse,\n WorkGroupResponse,\n} from './contracts/work-group';\nexport type {\n User,\n GetAllUsersParams,\n GetAllUsersResponse,\n ManagedUser,\n GetManagedUsersResponse,\n} from './contracts/user';","import type { AxiosInstance } from 'axios';\nimport type { ProviderListResponse } from './contracts/provider';\nimport type { ConfigListByProviderResponse, GetConfigsByProviderParams } from './contracts/config';\nimport type { Queue, QueueListResponse } from './contracts/queues';\nimport type { MetaTemplateConfigResponse, MetaTemplateConfigsResponse } from './contracts/meta-template';\nimport type { FindOrCreateQueueRuleRequest, QueueRule } from './contracts/rule';\n\n/**\n * Gateway for interacting with the Chat Config API.\n */\nexport class ChatConfigGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves all available providers.\n * @returns The list of providers.\n */\n async getProviders(): Promise<ProviderListResponse> {\n const { data } = await this.httpClient.get<ProviderListResponse>(`${this.baseUrl}/providers`);\n return data;\n }\n\n /**\n * Retrieves configurations filtered by provider.\n * @param providerId - The unique identifier of the provider.\n * @param params - Optional query parameters for filtering configurations.\n * @returns The configurations for the given provider.\n */\n async getConfigsByProvider(\n providerId: string,\n params?: GetConfigsByProviderParams,\n ): Promise<ConfigListByProviderResponse> {\n const { data } = await this.httpClient.get<ConfigListByProviderResponse>(\n `${this.baseUrl}/config/provider/${providerId}`,\n { params },\n );\n return data;\n }\n\n /**\n * Retrieves a queue by its ID.\n * @param queueId - The unique identifier of the queue.\n * @returns The queue data.\n */\n async getQueueById(queueId: string): Promise<Queue> {\n const { data } = await this.httpClient.get<Queue>(`${this.baseUrl}/queue/${queueId}`);\n return data;\n }\n\n async getQueues(): Promise<Queue[]> {\n const { data } = await this.httpClient.get<Queue[]>(`${this.baseUrl}/queues`);\n return data;\n }\n\n /**\n * Retrieves a Meta template configuration by its ID.\n * @param templateId - The unique identifier of the template.\n * @returns The Meta template configuration.\n */\n async getMetaTemplateById(templateId: string): Promise<MetaTemplateConfigResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigResponse>(\n `${this.baseUrl}/meta-templates-config/${templateId}`,\n );\n return data;\n }\n\n /**\n * Retrieves template configurations associated with a configuration ID.\n * @param configId - The configuration identifier.\n * @returns The list of template configurations.\n */\n async getTemplateConfigsByConfigId(configId: string): Promise<MetaTemplateConfigsResponse> {\n const { data } = await this.httpClient.get<MetaTemplateConfigsResponse>(\n `${this.baseUrl}/meta-templates-config/config/${configId}`,\n );\n return data;\n }\n\n /**\n * Finds an existing queue rule or creates a new one if it does not exist.\n * @param payload - The payload containing companyId, queueId, and configId.\n * @returns The found or created queue rule.\n */\n async findOrCreateQueueRule(payload: FindOrCreateQueueRuleRequest): Promise<QueueRule> {\n const { data } = await this.httpClient.put<QueueRule>(\n `${this.baseUrl}/rules/queue/find-or-create`,\n payload,\n );\n return data;\n }\n}\n\nexport type { Queue, QueueMember, DistributionType, QueueListResponse } from './contracts/queues';\nexport type { ProviderListResponse, Provider } from './contracts/provider';\nexport type {\n ConfigListByProviderResponse,\n Config,\n ConfigProvider,\n GetConfigsByProviderParams,\n} from './contracts/config';\nexport type {\n MetaTemplateButton,\n MetaTemplateConfigResponse,\n MetaTemplateConfigsResponse,\n} from './contracts/meta-template';\nexport type { FindOrCreateQueueRuleRequest, QueueRule } from './contracts/rule';\n","import type { AxiosInstance } from 'axios';\nimport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\n\n/**\n * Gateway for interacting with the Campaigns API.\n */\nexport class CampaignsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves a paginated list of campaigns.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaigns response.\n */\n async find(query?: CampaignQueryParams): Promise<CampaignPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignPaginatedResponse>(`${this.baseUrl}/campaigns`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The campaign data.\n */\n async get(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.get<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign.\n * @param payload - The campaign data to create.\n * @returns The created campaign.\n */\n async create(payload: CreateCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.post<Campaign>(`${this.baseUrl}/campaigns`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign.\n * @param id - The unique identifier of the campaign.\n * @param payload - The fields to update.\n * @returns The updated campaign.\n */\n async patch(id: string, payload: PatchCampaignRequest): Promise<Campaign> {\n const { data } = await this.httpClient.patch<Campaign>(`${this.baseUrl}/campaigns/${id}`, payload);\n return data;\n }\n\n /**\n * Removes a campaign by its unique identifier.\n * @param id - The unique identifier of the campaign.\n * @returns The removed campaign.\n */\n async remove(id: string): Promise<Campaign> {\n const { data } = await this.httpClient.delete<Campaign>(`${this.baseUrl}/campaigns/${id}`);\n return data;\n }\n\n /**\n * Retrieves all users associated with campaigns.\n * @returns The list of campaign users.\n */\n async getUsers(): Promise<CampaignUser[]> {\n const { data } = await this.httpClient.get<CampaignUser[]>(`${this.baseUrl}/users`);\n return data;\n }\n}\n\nexport type {\n Campaign,\n CampaignPaginatedResponse,\n CampaignQueryParams,\n CampaignStatus,\n CampaignProvider,\n WhatsAppPayload,\n WhatsAppTemplateComponent,\n CampaignContactFilter,\n CampaignSchedule,\n CreateCampaignRequest,\n PatchCampaignRequest,\n CampaignUser,\n} from './contracts/campaign';\n","import type { AxiosInstance } from 'axios';\nimport type { GetConfigTemplatesResponse, GetConfigTemplatesParams } from './contracts/chat-adapter';\n\n/**\n * Gateway for interacting with the Chat Adapter API.\n */\nexport class ChatAdapterGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n\n /**\n * Retrieves message templates associated with a configuration.\n * @param configId - The unique identifier of the configuration.\n * @param params - Optional query parameters for filtering and pagination.\n * @returns A promise that resolves to the template list response.\n */\n async getConfigTemplates(\n configId: string,\n params?: GetConfigTemplatesParams,\n ): Promise<GetConfigTemplatesResponse> {\n const { data } = await this.httpClient.get<GetConfigTemplatesResponse>(\n `${this.baseUrl}/message-templates/${configId}`,\n { params },\n );\n return data;\n }\n}\n\nexport type {\n GetConfigTemplatesResponse,\n GetConfigTemplatesParams,\n MessageTemplate,\n MessageTemplateComponent,\n ConfigTemplatesPaging,\n} from './contracts/chat-adapter';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AxiosInstance } from 'axios';\n\n/**\n * Maps service identifiers to their corresponding gateway types.\n * Used by the `gateway()` function to infer the correct return type\n * based on the service name passed as argument.\n *\n * When adding a new service, add an entry here with the service\n * identifier as the key and the gateway class as the value.\n */\nexport type GatewayMap = {\n 'customer-service': CustomerServiceGateway;\n 'chat-config': ChatConfigGateway;\n 'campaigns': CampaignsGateway;\n 'chat-adapter': ChatAdapterGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n }\n}\n\n/**\n * Parameters required to configure the SDK client.\n * Each service configuration is optional, only provide the services you need.\n */\nexport interface GatewayClientParams {\n /** An Axios instance used as the HTTP client for all gateway requests. */\n axiosClient: AxiosInstance;\n /** API token used for authentication across all services. */\n apiToken: string;\n /** Configuration for each service gateway. Only the services you configure will be available. */\n services: {\n customerService?: {\n baseUrl: string;\n };\n chatConfig?: {\n baseUrl: string;\n };\n campaigns?: {\n baseUrl: string;\n };\n chatAdapter?: {\n baseUrl: string;\n };\n };\n}\n\n/**\n * Creates an SDKGateways instance with all service gateways initialized\n * using the provided configuration parameters.\n * Services without configuration will be set to null and will throw\n * an error if accessed via `gateway()`.\n */\nexport function createClient(params: GatewayClientParams) {\n const httpClient = params.axiosClient;\n const customerService = params.services.customerService\n ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl)\n : null;\n const chatConfig = params.services.chatConfig\n ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl)\n : null;\n const campaigns = params.services.campaigns\n ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl)\n : null;\n const chatAdapter = params.services.chatAdapter\n ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter);\n}\n","export const SERVICE_GATEWAYS = {\n CUSTOMER_SERVICE: 'customer-service',\n CHAT_CONFIG: 'chat-config',\n CAMPAIGNS: 'campaigns',\n CHAT_ADAPTER: 'chat-adapter',\n} as const;\n\nexport type SERVICE_GATEWAYS = (typeof SERVICE_GATEWAYS)[keyof typeof SERVICE_GATEWAYS];\n","import { createClient, SDKGatewaysInterface, GatewayClientParams, GatewayMap } from './@common/client';\nimport { SERVICE_GATEWAYS } from './@common/enums';\n\nclass SDK {\n client: SDKGatewaysInterface | null = null;\n\n configure(params: GatewayClientParams) {\n this.client = createClient(params);\n }\n}\nconst sdk = new SDK();\n\n/**\n * Initializes the SDK with the required configuration parameters.\n * Must be called before using {@link gateway}.\n */\nexport const configure = (params: GatewayClientParams) => {\n sdk.configure(params);\n};\n\n/**\n * Returns the gateway instance for the specified service.\n *\n * @typeParam T - A service identifier key from {@link GatewayMap}.\n * @param service - The service identifier (e.g. `SERVICE_GATEWAYS.CUSTOMER_SERVICE`).\n * @returns The corresponding gateway instance with all its methods.\n * @throws {Error} If the SDK has not been configured via {@link configure}.\n * @throws {Error} If an unknown service identifier is provided.\n *\n * @example\n * ```ts\n * configure({ axiosClient, apiToken: '...', services: { customerService: { baseUrl: '...' } } });\n * const customer = gateway('customer-service');\n * const company = await customer.getCompanyById('123');\n * ```\n */\nexport function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];\nexport function gateway(service: SERVICE_GATEWAYS) {\n if (!sdk.client)\n throw new Error(\n 'SDK not configured. Please call configure() with the appropriate parameters before using the SDK.',\n );\n\n switch (service) {\n case SERVICE_GATEWAYS.CUSTOMER_SERVICE:\n if (!sdk.client.customerService)\n throw new Error(`Service 'customer-service' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.customerService;\n case SERVICE_GATEWAYS.CHAT_CONFIG:\n if (!sdk.client.chatConfig)\n throw new Error(`Service 'chat-config' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatConfig;\n case SERVICE_GATEWAYS.CAMPAIGNS:\n if (!sdk.client.campaigns)\n throw new Error(`Service 'campaigns' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.campaigns;\n case SERVICE_GATEWAYS.CHAT_ADAPTER:\n if (!sdk.client.chatAdapter)\n throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.chatAdapter;\n default:\n throw new Error(`Unknown service gateway: ${service}`);\n }\n}\n\nexport * from './campaigns/contracts';\nexport * from './chat-config/contracts';\nexport * from './customer-service/contracts';\nexport * from './chat-adapter/contracts';\n"],"mappings":";AAgBO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YACmB,YACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnB,MAAM,eAAe,WAA6C;AAChE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW,IAAqB,GAAG,KAAK,OAAO,qBAAqB,SAAS,EAAE;AAC3G,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,WAAmD;AACrE,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,WAAW;AAAA,MACrC,GAAG,KAAK,OAAO;AAAA,MACf,EAAE,QAAQ,EAAE,YAAY,UAAU,EAAE;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,aAAqB,WAAgD;AAC1F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