@opens/gateways 1.3.0 → 1.5.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 +175 -7
- package/dist/index.d.ts +175 -7
- package/dist/index.js +97 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -486,8 +486,8 @@ interface CampaignQueryParams {
|
|
|
486
486
|
createdBy?: string;
|
|
487
487
|
assignedTo?: string;
|
|
488
488
|
name?: string;
|
|
489
|
-
limit?: number;
|
|
490
|
-
skip?: number;
|
|
489
|
+
$limit?: number;
|
|
490
|
+
$skip?: number;
|
|
491
491
|
}
|
|
492
492
|
/** User entity returned by the Campaigns API. */
|
|
493
493
|
interface CampaignUser {
|
|
@@ -496,6 +496,107 @@ interface CampaignUser {
|
|
|
496
496
|
status: 'new' | 'activated' | 'disabled';
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
/** Dispatch status literals for a campaign contact. */
|
|
500
|
+
type CampaignContactDispatchStatus = 'scheduled' | 'queued' | 'delivered' | 'converted' | 'failed';
|
|
501
|
+
/** Campaign status literals accepted by campaign contact queries. */
|
|
502
|
+
type CampaignContactCampaignStatus = 'ongoing' | 'finished';
|
|
503
|
+
/** Primitive values accepted by REST query filters. */
|
|
504
|
+
type CampaignContactQueryValue = string | number | boolean;
|
|
505
|
+
/** Sort direction accepted by REST query parameters. */
|
|
506
|
+
type CampaignContactSortDirection = 1 | -1;
|
|
507
|
+
/** Query operators accepted by REST query filters. */
|
|
508
|
+
type CampaignContactQueryOperators<T extends CampaignContactQueryValue> = {
|
|
509
|
+
$eq?: T;
|
|
510
|
+
$ne?: T;
|
|
511
|
+
$in?: T[];
|
|
512
|
+
$nin?: T[];
|
|
513
|
+
$lt?: T;
|
|
514
|
+
$lte?: T;
|
|
515
|
+
$gt?: T;
|
|
516
|
+
$gte?: T;
|
|
517
|
+
};
|
|
518
|
+
/** Case-insensitive LIKE operator accepted by contact name and endpoint filters. */
|
|
519
|
+
type CampaignContactLikeQueryOperators = {
|
|
520
|
+
$ilike?: string;
|
|
521
|
+
};
|
|
522
|
+
/** Campaign contact entity returned by the Campaign Contacts API. */
|
|
523
|
+
interface CampaignContactResponse {
|
|
524
|
+
id: string;
|
|
525
|
+
contactId: string;
|
|
526
|
+
campaignId: string;
|
|
527
|
+
createdAt: string;
|
|
528
|
+
updatedAt: string;
|
|
529
|
+
contactEndpointId?: string;
|
|
530
|
+
dispatchStatusMessage: string;
|
|
531
|
+
contactName?: string;
|
|
532
|
+
contactEndpoint?: string;
|
|
533
|
+
metadata?: unknown;
|
|
534
|
+
communicationChannelId: string;
|
|
535
|
+
dispatchStatus: CampaignContactDispatchStatus;
|
|
536
|
+
isMessageRead?: boolean;
|
|
537
|
+
}
|
|
538
|
+
/** Paginated response returned by the Campaign Contacts API for list endpoints. */
|
|
539
|
+
type CampaignContactPaginatedResponse = {
|
|
540
|
+
total: number;
|
|
541
|
+
limit: number;
|
|
542
|
+
skip: number;
|
|
543
|
+
data: CampaignContactResponse[];
|
|
544
|
+
};
|
|
545
|
+
/** Request payload for creating a campaign contact. */
|
|
546
|
+
type CreateCampaignContactRequest = {
|
|
547
|
+
contactId: string;
|
|
548
|
+
campaignId: string;
|
|
549
|
+
contactEndpointId?: string;
|
|
550
|
+
contactName?: string;
|
|
551
|
+
contactEndpoint?: string;
|
|
552
|
+
metadata?: unknown;
|
|
553
|
+
};
|
|
554
|
+
/** Request payload for partially updating a campaign contact. */
|
|
555
|
+
type PatchCampaignContactRequest = {
|
|
556
|
+
id?: string;
|
|
557
|
+
contactId?: string;
|
|
558
|
+
campaignId?: string;
|
|
559
|
+
createdAt?: string;
|
|
560
|
+
updatedAt?: string;
|
|
561
|
+
contactEndpointId?: string;
|
|
562
|
+
dispatchStatusMessage?: string;
|
|
563
|
+
contactName?: string;
|
|
564
|
+
contactEndpoint?: string;
|
|
565
|
+
metadata?: unknown;
|
|
566
|
+
communicationChannelId?: string;
|
|
567
|
+
dispatchStatus?: CampaignContactDispatchStatus;
|
|
568
|
+
isMessageRead?: boolean;
|
|
569
|
+
};
|
|
570
|
+
/** Sort fields accepted when listing campaign contacts. */
|
|
571
|
+
type CampaignContactSortParams = {
|
|
572
|
+
contactId?: CampaignContactSortDirection;
|
|
573
|
+
createdAt?: CampaignContactSortDirection;
|
|
574
|
+
updatedAt?: CampaignContactSortDirection;
|
|
575
|
+
campaignId?: CampaignContactSortDirection;
|
|
576
|
+
dispatchStatus?: CampaignContactSortDirection;
|
|
577
|
+
contactName?: CampaignContactSortDirection;
|
|
578
|
+
contactEndpoint?: CampaignContactSortDirection;
|
|
579
|
+
contactEndpointId?: CampaignContactSortDirection;
|
|
580
|
+
communicationChannelId?: CampaignContactSortDirection;
|
|
581
|
+
};
|
|
582
|
+
/** Query parameters for listing campaign contacts. */
|
|
583
|
+
type CampaignContactQueryParams = {
|
|
584
|
+
contactId?: string | CampaignContactQueryOperators<string>;
|
|
585
|
+
createdAt?: string | CampaignContactQueryOperators<string>;
|
|
586
|
+
updatedAt?: string | CampaignContactQueryOperators<string>;
|
|
587
|
+
campaignId?: string | CampaignContactQueryOperators<string>;
|
|
588
|
+
dispatchStatus?: CampaignContactDispatchStatus | CampaignContactQueryOperators<CampaignContactDispatchStatus>;
|
|
589
|
+
contactName?: string | CampaignContactQueryOperators<string> | CampaignContactLikeQueryOperators;
|
|
590
|
+
contactEndpoint?: string | CampaignContactQueryOperators<string> | CampaignContactLikeQueryOperators;
|
|
591
|
+
contactEndpointId?: string | CampaignContactQueryOperators<string>;
|
|
592
|
+
communicationChannelId?: string | CampaignContactQueryOperators<string>;
|
|
593
|
+
'campaign.status'?: CampaignContactCampaignStatus | CampaignContactQueryOperators<CampaignContactCampaignStatus>;
|
|
594
|
+
$limit?: number;
|
|
595
|
+
$skip?: number;
|
|
596
|
+
$sort?: CampaignContactSortParams;
|
|
597
|
+
$select?: (keyof CampaignContactResponse)[];
|
|
598
|
+
};
|
|
599
|
+
|
|
499
600
|
/**
|
|
500
601
|
* Gateway for interacting with the Campaigns API.
|
|
501
602
|
*/
|
|
@@ -535,9 +636,36 @@ declare class CampaignsGateway {
|
|
|
535
636
|
*/
|
|
536
637
|
remove(id: string): Promise<Campaign>;
|
|
537
638
|
/**
|
|
538
|
-
* Retrieves
|
|
539
|
-
* @
|
|
639
|
+
* Retrieves a paginated list of campaign contacts.
|
|
640
|
+
* @param query - Optional query parameters for filtering and pagination.
|
|
641
|
+
* @returns The paginated campaign contacts response.
|
|
540
642
|
*/
|
|
643
|
+
findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse>;
|
|
644
|
+
/**
|
|
645
|
+
* Retrieves a campaign contact by its unique identifier.
|
|
646
|
+
* @param id - The unique identifier of the campaign contact.
|
|
647
|
+
* @returns The campaign contact data.
|
|
648
|
+
*/
|
|
649
|
+
getCampaignContacts(id: string): Promise<CampaignContactResponse>;
|
|
650
|
+
/**
|
|
651
|
+
* Creates a new campaign contact.
|
|
652
|
+
* @param payload - The campaign contact data to create.
|
|
653
|
+
* @returns The created campaign contact.
|
|
654
|
+
*/
|
|
655
|
+
createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse>;
|
|
656
|
+
/**
|
|
657
|
+
* Partially updates an existing campaign contact.
|
|
658
|
+
* @param id - The unique identifier of the campaign contact.
|
|
659
|
+
* @param payload - The fields to update.
|
|
660
|
+
* @returns The updated campaign contact.
|
|
661
|
+
*/
|
|
662
|
+
patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse>;
|
|
663
|
+
/**
|
|
664
|
+
* Removes a campaign contact by its unique identifier.
|
|
665
|
+
* @param id - The unique identifier of the campaign contact.
|
|
666
|
+
* @returns The removed campaign contact.
|
|
667
|
+
*/
|
|
668
|
+
removeCampaignContact(id: string): Promise<CampaignContactResponse>;
|
|
541
669
|
getUsers(): Promise<CampaignUser[]>;
|
|
542
670
|
}
|
|
543
671
|
|
|
@@ -623,6 +751,42 @@ declare class ChatAdapterGateway {
|
|
|
623
751
|
getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse>;
|
|
624
752
|
}
|
|
625
753
|
|
|
754
|
+
/** Request payload for obtaining a presigned upload URL. */
|
|
755
|
+
interface GetPresignedUrlRequest {
|
|
756
|
+
/** The name of the file to upload. */
|
|
757
|
+
fileName: string;
|
|
758
|
+
/** The destination key for the file in the bucket. */
|
|
759
|
+
key: string;
|
|
760
|
+
/** The unique identifier of the company. */
|
|
761
|
+
companyId: string;
|
|
762
|
+
}
|
|
763
|
+
/** Response returned when generating a presigned URL. */
|
|
764
|
+
interface UploadPresignedUrlResponse {
|
|
765
|
+
/** The destination key for the file. */
|
|
766
|
+
key: string;
|
|
767
|
+
/** The destination bucket. */
|
|
768
|
+
bucket: string;
|
|
769
|
+
/** The presigned URL to upload the file to. */
|
|
770
|
+
presignedUrl: string;
|
|
771
|
+
}
|
|
772
|
+
/** Alias for UploadPresignedUrlResponse to support legacy imports. */
|
|
773
|
+
type IUploadPresignedUrlResponse = UploadPresignedUrlResponse;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Gateway for interacting with the Assets API.
|
|
777
|
+
*/
|
|
778
|
+
declare class AssetsGateway {
|
|
779
|
+
private readonly httpClient;
|
|
780
|
+
private readonly baseUrl;
|
|
781
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
782
|
+
/**
|
|
783
|
+
* Retrieves a presigned URL to upload a file to the Assets API.
|
|
784
|
+
* @param params - The configuration options and parameters for the presigned URL.
|
|
785
|
+
* @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.
|
|
786
|
+
*/
|
|
787
|
+
getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse>;
|
|
788
|
+
}
|
|
789
|
+
|
|
626
790
|
/**
|
|
627
791
|
* Maps service identifiers to their corresponding gateway types.
|
|
628
792
|
* Used by the `gateway()` function to infer the correct return type
|
|
@@ -636,14 +800,15 @@ type GatewayMap = {
|
|
|
636
800
|
'chat-config': ChatConfigGateway;
|
|
637
801
|
'campaigns': CampaignsGateway;
|
|
638
802
|
'chat-adapter': ChatAdapterGateway;
|
|
803
|
+
'assets': AssetsGateway;
|
|
639
804
|
};
|
|
640
805
|
/**
|
|
641
806
|
* Parameters required to configure the SDK client.
|
|
642
807
|
* Each service configuration is optional, only provide the services you need.
|
|
643
808
|
*/
|
|
644
809
|
interface GatewayClientParams {
|
|
645
|
-
/** An Axios instance used as the HTTP client for all gateway requests. */
|
|
646
|
-
axiosClient
|
|
810
|
+
/** An Axios instance used as the HTTP client for all gateway requests (optional). */
|
|
811
|
+
axiosClient?: AxiosInstance;
|
|
647
812
|
/** API token used for authentication across all services. */
|
|
648
813
|
apiToken: string;
|
|
649
814
|
/** Configuration for each service gateway. Only the services you configure will be available. */
|
|
@@ -660,6 +825,9 @@ interface GatewayClientParams {
|
|
|
660
825
|
chatAdapter?: {
|
|
661
826
|
baseUrl: string;
|
|
662
827
|
};
|
|
828
|
+
assets?: {
|
|
829
|
+
baseUrl: string;
|
|
830
|
+
};
|
|
663
831
|
};
|
|
664
832
|
}
|
|
665
833
|
|
|
@@ -686,4 +854,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
686
854
|
*/
|
|
687
855
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
688
856
|
|
|
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 };
|
|
857
|
+
export { type Campaign, type CampaignContactCampaignStatus, type CampaignContactDispatchStatus, type CampaignContactFilter, type CampaignContactLikeQueryOperators, type CampaignContactPaginatedResponse, type CampaignContactQueryOperators, type CampaignContactQueryParams, type CampaignContactQueryValue, type CampaignContactResponse, type CampaignContactSortDirection, type CampaignContactSortParams, 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 CreateCampaignContactRequest, type CreateCampaignRequest, type DistributionType, type FindOrCreateQueueRuleRequest, type GetAllUsersParams, type GetAllUsersResponse, type GetConfigTemplatesParams, type GetConfigTemplatesResponse, type GetConfigsByProviderParams, type GetManagedUsersResponse, type GetPresignedUrlRequest, type IUploadPresignedUrlResponse, type ManagedUser, type MessageTemplate, type MessageTemplateComponent, type MetaTemplateButton, type MetaTemplateConfigResponse, type MetaTemplateConfigsResponse, type PatchCampaignContactRequest, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueListResponse, type QueueMember, type QueueRule, type UploadPresignedUrlResponse, type User, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
package/dist/index.d.ts
CHANGED
|
@@ -486,8 +486,8 @@ interface CampaignQueryParams {
|
|
|
486
486
|
createdBy?: string;
|
|
487
487
|
assignedTo?: string;
|
|
488
488
|
name?: string;
|
|
489
|
-
limit?: number;
|
|
490
|
-
skip?: number;
|
|
489
|
+
$limit?: number;
|
|
490
|
+
$skip?: number;
|
|
491
491
|
}
|
|
492
492
|
/** User entity returned by the Campaigns API. */
|
|
493
493
|
interface CampaignUser {
|
|
@@ -496,6 +496,107 @@ interface CampaignUser {
|
|
|
496
496
|
status: 'new' | 'activated' | 'disabled';
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
/** Dispatch status literals for a campaign contact. */
|
|
500
|
+
type CampaignContactDispatchStatus = 'scheduled' | 'queued' | 'delivered' | 'converted' | 'failed';
|
|
501
|
+
/** Campaign status literals accepted by campaign contact queries. */
|
|
502
|
+
type CampaignContactCampaignStatus = 'ongoing' | 'finished';
|
|
503
|
+
/** Primitive values accepted by REST query filters. */
|
|
504
|
+
type CampaignContactQueryValue = string | number | boolean;
|
|
505
|
+
/** Sort direction accepted by REST query parameters. */
|
|
506
|
+
type CampaignContactSortDirection = 1 | -1;
|
|
507
|
+
/** Query operators accepted by REST query filters. */
|
|
508
|
+
type CampaignContactQueryOperators<T extends CampaignContactQueryValue> = {
|
|
509
|
+
$eq?: T;
|
|
510
|
+
$ne?: T;
|
|
511
|
+
$in?: T[];
|
|
512
|
+
$nin?: T[];
|
|
513
|
+
$lt?: T;
|
|
514
|
+
$lte?: T;
|
|
515
|
+
$gt?: T;
|
|
516
|
+
$gte?: T;
|
|
517
|
+
};
|
|
518
|
+
/** Case-insensitive LIKE operator accepted by contact name and endpoint filters. */
|
|
519
|
+
type CampaignContactLikeQueryOperators = {
|
|
520
|
+
$ilike?: string;
|
|
521
|
+
};
|
|
522
|
+
/** Campaign contact entity returned by the Campaign Contacts API. */
|
|
523
|
+
interface CampaignContactResponse {
|
|
524
|
+
id: string;
|
|
525
|
+
contactId: string;
|
|
526
|
+
campaignId: string;
|
|
527
|
+
createdAt: string;
|
|
528
|
+
updatedAt: string;
|
|
529
|
+
contactEndpointId?: string;
|
|
530
|
+
dispatchStatusMessage: string;
|
|
531
|
+
contactName?: string;
|
|
532
|
+
contactEndpoint?: string;
|
|
533
|
+
metadata?: unknown;
|
|
534
|
+
communicationChannelId: string;
|
|
535
|
+
dispatchStatus: CampaignContactDispatchStatus;
|
|
536
|
+
isMessageRead?: boolean;
|
|
537
|
+
}
|
|
538
|
+
/** Paginated response returned by the Campaign Contacts API for list endpoints. */
|
|
539
|
+
type CampaignContactPaginatedResponse = {
|
|
540
|
+
total: number;
|
|
541
|
+
limit: number;
|
|
542
|
+
skip: number;
|
|
543
|
+
data: CampaignContactResponse[];
|
|
544
|
+
};
|
|
545
|
+
/** Request payload for creating a campaign contact. */
|
|
546
|
+
type CreateCampaignContactRequest = {
|
|
547
|
+
contactId: string;
|
|
548
|
+
campaignId: string;
|
|
549
|
+
contactEndpointId?: string;
|
|
550
|
+
contactName?: string;
|
|
551
|
+
contactEndpoint?: string;
|
|
552
|
+
metadata?: unknown;
|
|
553
|
+
};
|
|
554
|
+
/** Request payload for partially updating a campaign contact. */
|
|
555
|
+
type PatchCampaignContactRequest = {
|
|
556
|
+
id?: string;
|
|
557
|
+
contactId?: string;
|
|
558
|
+
campaignId?: string;
|
|
559
|
+
createdAt?: string;
|
|
560
|
+
updatedAt?: string;
|
|
561
|
+
contactEndpointId?: string;
|
|
562
|
+
dispatchStatusMessage?: string;
|
|
563
|
+
contactName?: string;
|
|
564
|
+
contactEndpoint?: string;
|
|
565
|
+
metadata?: unknown;
|
|
566
|
+
communicationChannelId?: string;
|
|
567
|
+
dispatchStatus?: CampaignContactDispatchStatus;
|
|
568
|
+
isMessageRead?: boolean;
|
|
569
|
+
};
|
|
570
|
+
/** Sort fields accepted when listing campaign contacts. */
|
|
571
|
+
type CampaignContactSortParams = {
|
|
572
|
+
contactId?: CampaignContactSortDirection;
|
|
573
|
+
createdAt?: CampaignContactSortDirection;
|
|
574
|
+
updatedAt?: CampaignContactSortDirection;
|
|
575
|
+
campaignId?: CampaignContactSortDirection;
|
|
576
|
+
dispatchStatus?: CampaignContactSortDirection;
|
|
577
|
+
contactName?: CampaignContactSortDirection;
|
|
578
|
+
contactEndpoint?: CampaignContactSortDirection;
|
|
579
|
+
contactEndpointId?: CampaignContactSortDirection;
|
|
580
|
+
communicationChannelId?: CampaignContactSortDirection;
|
|
581
|
+
};
|
|
582
|
+
/** Query parameters for listing campaign contacts. */
|
|
583
|
+
type CampaignContactQueryParams = {
|
|
584
|
+
contactId?: string | CampaignContactQueryOperators<string>;
|
|
585
|
+
createdAt?: string | CampaignContactQueryOperators<string>;
|
|
586
|
+
updatedAt?: string | CampaignContactQueryOperators<string>;
|
|
587
|
+
campaignId?: string | CampaignContactQueryOperators<string>;
|
|
588
|
+
dispatchStatus?: CampaignContactDispatchStatus | CampaignContactQueryOperators<CampaignContactDispatchStatus>;
|
|
589
|
+
contactName?: string | CampaignContactQueryOperators<string> | CampaignContactLikeQueryOperators;
|
|
590
|
+
contactEndpoint?: string | CampaignContactQueryOperators<string> | CampaignContactLikeQueryOperators;
|
|
591
|
+
contactEndpointId?: string | CampaignContactQueryOperators<string>;
|
|
592
|
+
communicationChannelId?: string | CampaignContactQueryOperators<string>;
|
|
593
|
+
'campaign.status'?: CampaignContactCampaignStatus | CampaignContactQueryOperators<CampaignContactCampaignStatus>;
|
|
594
|
+
$limit?: number;
|
|
595
|
+
$skip?: number;
|
|
596
|
+
$sort?: CampaignContactSortParams;
|
|
597
|
+
$select?: (keyof CampaignContactResponse)[];
|
|
598
|
+
};
|
|
599
|
+
|
|
499
600
|
/**
|
|
500
601
|
* Gateway for interacting with the Campaigns API.
|
|
501
602
|
*/
|
|
@@ -535,9 +636,36 @@ declare class CampaignsGateway {
|
|
|
535
636
|
*/
|
|
536
637
|
remove(id: string): Promise<Campaign>;
|
|
537
638
|
/**
|
|
538
|
-
* Retrieves
|
|
539
|
-
* @
|
|
639
|
+
* Retrieves a paginated list of campaign contacts.
|
|
640
|
+
* @param query - Optional query parameters for filtering and pagination.
|
|
641
|
+
* @returns The paginated campaign contacts response.
|
|
540
642
|
*/
|
|
643
|
+
findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse>;
|
|
644
|
+
/**
|
|
645
|
+
* Retrieves a campaign contact by its unique identifier.
|
|
646
|
+
* @param id - The unique identifier of the campaign contact.
|
|
647
|
+
* @returns The campaign contact data.
|
|
648
|
+
*/
|
|
649
|
+
getCampaignContacts(id: string): Promise<CampaignContactResponse>;
|
|
650
|
+
/**
|
|
651
|
+
* Creates a new campaign contact.
|
|
652
|
+
* @param payload - The campaign contact data to create.
|
|
653
|
+
* @returns The created campaign contact.
|
|
654
|
+
*/
|
|
655
|
+
createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse>;
|
|
656
|
+
/**
|
|
657
|
+
* Partially updates an existing campaign contact.
|
|
658
|
+
* @param id - The unique identifier of the campaign contact.
|
|
659
|
+
* @param payload - The fields to update.
|
|
660
|
+
* @returns The updated campaign contact.
|
|
661
|
+
*/
|
|
662
|
+
patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse>;
|
|
663
|
+
/**
|
|
664
|
+
* Removes a campaign contact by its unique identifier.
|
|
665
|
+
* @param id - The unique identifier of the campaign contact.
|
|
666
|
+
* @returns The removed campaign contact.
|
|
667
|
+
*/
|
|
668
|
+
removeCampaignContact(id: string): Promise<CampaignContactResponse>;
|
|
541
669
|
getUsers(): Promise<CampaignUser[]>;
|
|
542
670
|
}
|
|
543
671
|
|
|
@@ -623,6 +751,42 @@ declare class ChatAdapterGateway {
|
|
|
623
751
|
getConfigTemplates(configId: string, params?: GetConfigTemplatesParams): Promise<GetConfigTemplatesResponse>;
|
|
624
752
|
}
|
|
625
753
|
|
|
754
|
+
/** Request payload for obtaining a presigned upload URL. */
|
|
755
|
+
interface GetPresignedUrlRequest {
|
|
756
|
+
/** The name of the file to upload. */
|
|
757
|
+
fileName: string;
|
|
758
|
+
/** The destination key for the file in the bucket. */
|
|
759
|
+
key: string;
|
|
760
|
+
/** The unique identifier of the company. */
|
|
761
|
+
companyId: string;
|
|
762
|
+
}
|
|
763
|
+
/** Response returned when generating a presigned URL. */
|
|
764
|
+
interface UploadPresignedUrlResponse {
|
|
765
|
+
/** The destination key for the file. */
|
|
766
|
+
key: string;
|
|
767
|
+
/** The destination bucket. */
|
|
768
|
+
bucket: string;
|
|
769
|
+
/** The presigned URL to upload the file to. */
|
|
770
|
+
presignedUrl: string;
|
|
771
|
+
}
|
|
772
|
+
/** Alias for UploadPresignedUrlResponse to support legacy imports. */
|
|
773
|
+
type IUploadPresignedUrlResponse = UploadPresignedUrlResponse;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Gateway for interacting with the Assets API.
|
|
777
|
+
*/
|
|
778
|
+
declare class AssetsGateway {
|
|
779
|
+
private readonly httpClient;
|
|
780
|
+
private readonly baseUrl;
|
|
781
|
+
constructor(httpClient: AxiosInstance, baseUrl: string);
|
|
782
|
+
/**
|
|
783
|
+
* Retrieves a presigned URL to upload a file to the Assets API.
|
|
784
|
+
* @param params - The configuration options and parameters for the presigned URL.
|
|
785
|
+
* @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.
|
|
786
|
+
*/
|
|
787
|
+
getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse>;
|
|
788
|
+
}
|
|
789
|
+
|
|
626
790
|
/**
|
|
627
791
|
* Maps service identifiers to their corresponding gateway types.
|
|
628
792
|
* Used by the `gateway()` function to infer the correct return type
|
|
@@ -636,14 +800,15 @@ type GatewayMap = {
|
|
|
636
800
|
'chat-config': ChatConfigGateway;
|
|
637
801
|
'campaigns': CampaignsGateway;
|
|
638
802
|
'chat-adapter': ChatAdapterGateway;
|
|
803
|
+
'assets': AssetsGateway;
|
|
639
804
|
};
|
|
640
805
|
/**
|
|
641
806
|
* Parameters required to configure the SDK client.
|
|
642
807
|
* Each service configuration is optional, only provide the services you need.
|
|
643
808
|
*/
|
|
644
809
|
interface GatewayClientParams {
|
|
645
|
-
/** An Axios instance used as the HTTP client for all gateway requests. */
|
|
646
|
-
axiosClient
|
|
810
|
+
/** An Axios instance used as the HTTP client for all gateway requests (optional). */
|
|
811
|
+
axiosClient?: AxiosInstance;
|
|
647
812
|
/** API token used for authentication across all services. */
|
|
648
813
|
apiToken: string;
|
|
649
814
|
/** Configuration for each service gateway. Only the services you configure will be available. */
|
|
@@ -660,6 +825,9 @@ interface GatewayClientParams {
|
|
|
660
825
|
chatAdapter?: {
|
|
661
826
|
baseUrl: string;
|
|
662
827
|
};
|
|
828
|
+
assets?: {
|
|
829
|
+
baseUrl: string;
|
|
830
|
+
};
|
|
663
831
|
};
|
|
664
832
|
}
|
|
665
833
|
|
|
@@ -686,4 +854,4 @@ declare const configure: (params: GatewayClientParams) => void;
|
|
|
686
854
|
*/
|
|
687
855
|
declare function gateway<T extends keyof GatewayMap>(service: T): GatewayMap[T];
|
|
688
856
|
|
|
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 };
|
|
857
|
+
export { type Campaign, type CampaignContactCampaignStatus, type CampaignContactDispatchStatus, type CampaignContactFilter, type CampaignContactLikeQueryOperators, type CampaignContactPaginatedResponse, type CampaignContactQueryOperators, type CampaignContactQueryParams, type CampaignContactQueryValue, type CampaignContactResponse, type CampaignContactSortDirection, type CampaignContactSortParams, 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 CreateCampaignContactRequest, type CreateCampaignRequest, type DistributionType, type FindOrCreateQueueRuleRequest, type GetAllUsersParams, type GetAllUsersResponse, type GetConfigTemplatesParams, type GetConfigTemplatesResponse, type GetConfigsByProviderParams, type GetManagedUsersResponse, type GetPresignedUrlRequest, type IUploadPresignedUrlResponse, type ManagedUser, type MessageTemplate, type MessageTemplateComponent, type MetaTemplateButton, type MetaTemplateConfigResponse, type MetaTemplateConfigsResponse, type PatchCampaignContactRequest, type PatchCampaignRequest, type Provider, type ProviderListResponse, type Queue, type QueueListResponse, type QueueMember, type QueueRule, type UploadPresignedUrlResponse, type User, type WhatsAppPayload, type WhatsAppTemplateComponent, type WorkGroup, type WorkGroupListResponse, type WorkGroupMember, type WorkGroupMembersResponse, type WorkGroupResponse, configure, gateway };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -235,9 +245,56 @@ var CampaignsGateway = class {
|
|
|
235
245
|
return data;
|
|
236
246
|
}
|
|
237
247
|
/**
|
|
238
|
-
* Retrieves
|
|
239
|
-
* @
|
|
248
|
+
* Retrieves a paginated list of campaign contacts.
|
|
249
|
+
* @param query - Optional query parameters for filtering and pagination.
|
|
250
|
+
* @returns The paginated campaign contacts response.
|
|
251
|
+
*/
|
|
252
|
+
async findCampaignContacts(query) {
|
|
253
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/campaign-contacts`, {
|
|
254
|
+
params: query
|
|
255
|
+
});
|
|
256
|
+
return data;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Retrieves a campaign contact by its unique identifier.
|
|
260
|
+
* @param id - The unique identifier of the campaign contact.
|
|
261
|
+
* @returns The campaign contact data.
|
|
240
262
|
*/
|
|
263
|
+
async getCampaignContacts(id) {
|
|
264
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/campaign-contacts/${id}`);
|
|
265
|
+
return data;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Creates a new campaign contact.
|
|
269
|
+
* @param payload - The campaign contact data to create.
|
|
270
|
+
* @returns The created campaign contact.
|
|
271
|
+
*/
|
|
272
|
+
async createCampaignContact(payload) {
|
|
273
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/campaign-contacts`, payload);
|
|
274
|
+
return data;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Partially updates an existing campaign contact.
|
|
278
|
+
* @param id - The unique identifier of the campaign contact.
|
|
279
|
+
* @param payload - The fields to update.
|
|
280
|
+
* @returns The updated campaign contact.
|
|
281
|
+
*/
|
|
282
|
+
async patchCampaignContact(id, payload) {
|
|
283
|
+
const { data } = await this.httpClient.patch(
|
|
284
|
+
`${this.baseUrl}/campaign-contacts/${id}`,
|
|
285
|
+
payload
|
|
286
|
+
);
|
|
287
|
+
return data;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Removes a campaign contact by its unique identifier.
|
|
291
|
+
* @param id - The unique identifier of the campaign contact.
|
|
292
|
+
* @returns The removed campaign contact.
|
|
293
|
+
*/
|
|
294
|
+
async removeCampaignContact(id) {
|
|
295
|
+
const { data } = await this.httpClient.delete(`${this.baseUrl}/campaign-contacts/${id}`);
|
|
296
|
+
return data;
|
|
297
|
+
}
|
|
241
298
|
async getUsers() {
|
|
242
299
|
const { data } = await this.httpClient.get(`${this.baseUrl}/users`);
|
|
243
300
|
return data;
|
|
@@ -267,26 +324,55 @@ var ChatAdapterGateway = class {
|
|
|
267
324
|
}
|
|
268
325
|
};
|
|
269
326
|
|
|
327
|
+
// src/assets/index.ts
|
|
328
|
+
var AssetsGateway = class {
|
|
329
|
+
constructor(httpClient, baseUrl) {
|
|
330
|
+
this.httpClient = httpClient;
|
|
331
|
+
this.baseUrl = baseUrl;
|
|
332
|
+
}
|
|
333
|
+
httpClient;
|
|
334
|
+
baseUrl;
|
|
335
|
+
/**
|
|
336
|
+
* Retrieves a presigned URL to upload a file to the Assets API.
|
|
337
|
+
* @param params - The configuration options and parameters for the presigned URL.
|
|
338
|
+
* @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.
|
|
339
|
+
*/
|
|
340
|
+
async getPresignedUrl(params) {
|
|
341
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/uploads/presigned-url`, {
|
|
342
|
+
params
|
|
343
|
+
});
|
|
344
|
+
return data;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
270
348
|
// src/@common/client.ts
|
|
349
|
+
var import_axios = __toESM(require("axios"));
|
|
271
350
|
var SDKGateways = class {
|
|
272
351
|
customerService;
|
|
273
352
|
chatConfig;
|
|
274
353
|
campaigns;
|
|
275
354
|
chatAdapter;
|
|
276
|
-
|
|
355
|
+
assets;
|
|
356
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter, assets) {
|
|
277
357
|
this.customerService = customerService;
|
|
278
358
|
this.chatConfig = chatConfig;
|
|
279
359
|
this.campaigns = campaigns;
|
|
280
360
|
this.chatAdapter = chatAdapter;
|
|
361
|
+
this.assets = assets;
|
|
281
362
|
}
|
|
282
363
|
};
|
|
283
364
|
function createClient(params) {
|
|
284
|
-
const httpClient = params.axiosClient
|
|
365
|
+
const httpClient = params.axiosClient || import_axios.default.create({
|
|
366
|
+
headers: {
|
|
367
|
+
Authorization: `Bearer ${params.apiToken}`
|
|
368
|
+
}
|
|
369
|
+
});
|
|
285
370
|
const customerService = params.services.customerService ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl) : null;
|
|
286
371
|
const chatConfig = params.services.chatConfig ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl) : null;
|
|
287
372
|
const campaigns = params.services.campaigns ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl) : null;
|
|
288
373
|
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
289
|
-
|
|
374
|
+
const assets = params.services.assets ? new AssetsGateway(httpClient, params.services.assets.baseUrl) : null;
|
|
375
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets);
|
|
290
376
|
}
|
|
291
377
|
|
|
292
378
|
// src/@common/enums.ts
|
|
@@ -294,7 +380,8 @@ var SERVICE_GATEWAYS = {
|
|
|
294
380
|
CUSTOMER_SERVICE: "customer-service",
|
|
295
381
|
CHAT_CONFIG: "chat-config",
|
|
296
382
|
CAMPAIGNS: "campaigns",
|
|
297
|
-
CHAT_ADAPTER: "chat-adapter"
|
|
383
|
+
CHAT_ADAPTER: "chat-adapter",
|
|
384
|
+
ASSETS: "assets"
|
|
298
385
|
};
|
|
299
386
|
|
|
300
387
|
// src/index.ts
|
|
@@ -330,6 +417,10 @@ function gateway(service) {
|
|
|
330
417
|
if (!sdk.client.chatAdapter)
|
|
331
418
|
throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);
|
|
332
419
|
return sdk.client.chatAdapter;
|
|
420
|
+
case SERVICE_GATEWAYS.ASSETS:
|
|
421
|
+
if (!sdk.client.assets)
|
|
422
|
+
throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);
|
|
423
|
+
return sdk.client.assets;
|
|
333
424
|
default:
|
|
334
425
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
335
426
|
}
|
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/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;AAA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W;AAAA,EACX,cAAc;AAChB;;;ANFA,IAAM,MAAN,MAAU;AAAA,EACR,SAAsC;AAAA,EAEtC,UAAU,QAA6B;AACrC,SAAK,SAAS,aAAa,MAAM;AAAA,EACnC;AACF;AACA,IAAM,MAAM,IAAI,IAAI;AAMb,IAAM,YAAY,CAAC,WAAgC;AACxD,MAAI,UAAU,MAAM;AACtB;AAmBO,SAAS,QAAQ,SAA2B;AACjD,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEF,UAAQ,SAAS;AAAA,IACf,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,mFAAmF;AACrG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,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":[]}
|
|
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/assets/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 case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\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';\nexport * from './assets/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';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\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 a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\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';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\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 type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n} from './contracts/assets';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport axios, { 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 'assets': AssetsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\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 (optional). */\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 assets?: {\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 || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\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 const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets);\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 ASSETS: 'assets',\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;AA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,OAAO,EAAE;AAAA,EACzD;AACF;","names":["axios"]}
|
package/dist/index.mjs
CHANGED
|
@@ -208,9 +208,56 @@ var CampaignsGateway = class {
|
|
|
208
208
|
return data;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
|
-
* Retrieves
|
|
212
|
-
* @
|
|
211
|
+
* Retrieves a paginated list of campaign contacts.
|
|
212
|
+
* @param query - Optional query parameters for filtering and pagination.
|
|
213
|
+
* @returns The paginated campaign contacts response.
|
|
214
|
+
*/
|
|
215
|
+
async findCampaignContacts(query) {
|
|
216
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/campaign-contacts`, {
|
|
217
|
+
params: query
|
|
218
|
+
});
|
|
219
|
+
return data;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Retrieves a campaign contact by its unique identifier.
|
|
223
|
+
* @param id - The unique identifier of the campaign contact.
|
|
224
|
+
* @returns The campaign contact data.
|
|
213
225
|
*/
|
|
226
|
+
async getCampaignContacts(id) {
|
|
227
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/campaign-contacts/${id}`);
|
|
228
|
+
return data;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Creates a new campaign contact.
|
|
232
|
+
* @param payload - The campaign contact data to create.
|
|
233
|
+
* @returns The created campaign contact.
|
|
234
|
+
*/
|
|
235
|
+
async createCampaignContact(payload) {
|
|
236
|
+
const { data } = await this.httpClient.post(`${this.baseUrl}/campaign-contacts`, payload);
|
|
237
|
+
return data;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Partially updates an existing campaign contact.
|
|
241
|
+
* @param id - The unique identifier of the campaign contact.
|
|
242
|
+
* @param payload - The fields to update.
|
|
243
|
+
* @returns The updated campaign contact.
|
|
244
|
+
*/
|
|
245
|
+
async patchCampaignContact(id, payload) {
|
|
246
|
+
const { data } = await this.httpClient.patch(
|
|
247
|
+
`${this.baseUrl}/campaign-contacts/${id}`,
|
|
248
|
+
payload
|
|
249
|
+
);
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Removes a campaign contact by its unique identifier.
|
|
254
|
+
* @param id - The unique identifier of the campaign contact.
|
|
255
|
+
* @returns The removed campaign contact.
|
|
256
|
+
*/
|
|
257
|
+
async removeCampaignContact(id) {
|
|
258
|
+
const { data } = await this.httpClient.delete(`${this.baseUrl}/campaign-contacts/${id}`);
|
|
259
|
+
return data;
|
|
260
|
+
}
|
|
214
261
|
async getUsers() {
|
|
215
262
|
const { data } = await this.httpClient.get(`${this.baseUrl}/users`);
|
|
216
263
|
return data;
|
|
@@ -240,26 +287,55 @@ var ChatAdapterGateway = class {
|
|
|
240
287
|
}
|
|
241
288
|
};
|
|
242
289
|
|
|
290
|
+
// src/assets/index.ts
|
|
291
|
+
var AssetsGateway = class {
|
|
292
|
+
constructor(httpClient, baseUrl) {
|
|
293
|
+
this.httpClient = httpClient;
|
|
294
|
+
this.baseUrl = baseUrl;
|
|
295
|
+
}
|
|
296
|
+
httpClient;
|
|
297
|
+
baseUrl;
|
|
298
|
+
/**
|
|
299
|
+
* Retrieves a presigned URL to upload a file to the Assets API.
|
|
300
|
+
* @param params - The configuration options and parameters for the presigned URL.
|
|
301
|
+
* @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.
|
|
302
|
+
*/
|
|
303
|
+
async getPresignedUrl(params) {
|
|
304
|
+
const { data } = await this.httpClient.get(`${this.baseUrl}/uploads/presigned-url`, {
|
|
305
|
+
params
|
|
306
|
+
});
|
|
307
|
+
return data;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
243
311
|
// src/@common/client.ts
|
|
312
|
+
import axios from "axios";
|
|
244
313
|
var SDKGateways = class {
|
|
245
314
|
customerService;
|
|
246
315
|
chatConfig;
|
|
247
316
|
campaigns;
|
|
248
317
|
chatAdapter;
|
|
249
|
-
|
|
318
|
+
assets;
|
|
319
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter, assets) {
|
|
250
320
|
this.customerService = customerService;
|
|
251
321
|
this.chatConfig = chatConfig;
|
|
252
322
|
this.campaigns = campaigns;
|
|
253
323
|
this.chatAdapter = chatAdapter;
|
|
324
|
+
this.assets = assets;
|
|
254
325
|
}
|
|
255
326
|
};
|
|
256
327
|
function createClient(params) {
|
|
257
|
-
const httpClient = params.axiosClient
|
|
328
|
+
const httpClient = params.axiosClient || axios.create({
|
|
329
|
+
headers: {
|
|
330
|
+
Authorization: `Bearer ${params.apiToken}`
|
|
331
|
+
}
|
|
332
|
+
});
|
|
258
333
|
const customerService = params.services.customerService ? new CustomerServiceGateway(httpClient, params.services.customerService.baseUrl) : null;
|
|
259
334
|
const chatConfig = params.services.chatConfig ? new ChatConfigGateway(httpClient, params.services.chatConfig.baseUrl) : null;
|
|
260
335
|
const campaigns = params.services.campaigns ? new CampaignsGateway(httpClient, params.services.campaigns.baseUrl) : null;
|
|
261
336
|
const chatAdapter = params.services.chatAdapter ? new ChatAdapterGateway(httpClient, params.services.chatAdapter.baseUrl) : null;
|
|
262
|
-
|
|
337
|
+
const assets = params.services.assets ? new AssetsGateway(httpClient, params.services.assets.baseUrl) : null;
|
|
338
|
+
return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets);
|
|
263
339
|
}
|
|
264
340
|
|
|
265
341
|
// src/@common/enums.ts
|
|
@@ -267,7 +343,8 @@ var SERVICE_GATEWAYS = {
|
|
|
267
343
|
CUSTOMER_SERVICE: "customer-service",
|
|
268
344
|
CHAT_CONFIG: "chat-config",
|
|
269
345
|
CAMPAIGNS: "campaigns",
|
|
270
|
-
CHAT_ADAPTER: "chat-adapter"
|
|
346
|
+
CHAT_ADAPTER: "chat-adapter",
|
|
347
|
+
ASSETS: "assets"
|
|
271
348
|
};
|
|
272
349
|
|
|
273
350
|
// src/index.ts
|
|
@@ -303,6 +380,10 @@ function gateway(service) {
|
|
|
303
380
|
if (!sdk.client.chatAdapter)
|
|
304
381
|
throw new Error(`Service 'chat-adapter' is not configured. Provide its baseUrl in configure().`);
|
|
305
382
|
return sdk.client.chatAdapter;
|
|
383
|
+
case SERVICE_GATEWAYS.ASSETS:
|
|
384
|
+
if (!sdk.client.assets)
|
|
385
|
+
throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);
|
|
386
|
+
return sdk.client.assets;
|
|
306
387
|
default:
|
|
307
388
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
308
389
|
}
|
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/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;A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AAI,OAAO;AACd,cAAM,IAAI,MAAM,mFAAmF;AACrG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/customer-service/index.ts","../src/chat-config/index.ts","../src/campaigns/index.ts","../src/chat-adapter/index.ts","../src/assets/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';\nimport type {\n CampaignContactPaginatedResponse,\n CampaignContactQueryParams,\n CampaignContactResponse,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\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 a paginated list of campaign contacts.\n * @param query - Optional query parameters for filtering and pagination.\n * @returns The paginated campaign contacts response.\n */\n async findCampaignContacts(query?: CampaignContactQueryParams): Promise<CampaignContactPaginatedResponse> {\n const { data } = await this.httpClient.get<CampaignContactPaginatedResponse>(`${this.baseUrl}/campaign-contacts`, {\n params: query,\n });\n return data;\n }\n\n /**\n * Retrieves a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The campaign contact data.\n */\n async getCampaignContacts(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.get<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n /**\n * Creates a new campaign contact.\n * @param payload - The campaign contact data to create.\n * @returns The created campaign contact.\n */\n async createCampaignContact(payload: CreateCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.post<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts`, payload);\n return data;\n }\n\n /**\n * Partially updates an existing campaign contact.\n * @param id - The unique identifier of the campaign contact.\n * @param payload - The fields to update.\n * @returns The updated campaign contact.\n */\n async patchCampaignContact(id: string, payload: PatchCampaignContactRequest): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.patch<CampaignContactResponse>(\n `${this.baseUrl}/campaign-contacts/${id}`,\n payload,\n );\n return data;\n }\n\n /**\n * Removes a campaign contact by its unique identifier.\n * @param id - The unique identifier of the campaign contact.\n * @returns The removed campaign contact.\n */\n async removeCampaignContact(id: string): Promise<CampaignContactResponse> {\n const { data } = await this.httpClient.delete<CampaignContactResponse>(`${this.baseUrl}/campaign-contacts/${id}`);\n return data;\n }\n\n async getUsers() {\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';\nexport type {\n CampaignContactCampaignStatus,\n CampaignContactDispatchStatus,\n CampaignContactLikeQueryOperators,\n CampaignContactPaginatedResponse,\n CampaignContactQueryOperators,\n CampaignContactQueryParams,\n CampaignContactQueryValue,\n CampaignContactResponse,\n CampaignContactSortDirection,\n CampaignContactSortParams,\n CreateCampaignContactRequest,\n PatchCampaignContactRequest,\n} from './contracts/campaign-contacts';\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 type { AxiosInstance } from 'axios';\nimport type { GetPresignedUrlRequest, UploadPresignedUrlResponse } from './contracts/assets';\n\n/**\n * Gateway for interacting with the Assets API.\n */\nexport class AssetsGateway {\n constructor(\n private readonly httpClient: AxiosInstance,\n private readonly baseUrl: string,\n ) {}\n /**\n * Retrieves a presigned URL to upload a file to the Assets API.\n * @param params - The configuration options and parameters for the presigned URL.\n * @returns The presigned URL details wrapped in a {@link UploadPresignedUrlResponse}.\n */\n async getPresignedUrl(params: GetPresignedUrlRequest): Promise<UploadPresignedUrlResponse> {\n const { data } = await this.httpClient.get<UploadPresignedUrlResponse>(`${this.baseUrl}/uploads/presigned-url`, {\n params,\n });\n return data;\n }\n}\n\nexport type {\n GetPresignedUrlRequest,\n UploadPresignedUrlResponse,\n IUploadPresignedUrlResponse,\n} from './contracts/assets';\n","import { CustomerServiceGateway } from '../customer-service';\nimport { ChatConfigGateway } from '../chat-config';\nimport { CampaignsGateway } from '../campaigns';\nimport { ChatAdapterGateway } from '../chat-adapter';\nimport { AssetsGateway } from '../assets';\nimport axios, { 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 'assets': AssetsGateway;\n};\n\nexport interface SDKGatewaysInterface {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n}\n\nclass SDKGateways {\n customerService: CustomerServiceGateway | null;\n chatConfig: ChatConfigGateway | null;\n campaigns: CampaignsGateway | null;\n chatAdapter: ChatAdapterGateway | null;\n assets: AssetsGateway | null;\n constructor(\n customerService: CustomerServiceGateway | null,\n chatConfig: ChatConfigGateway | null,\n campaigns: CampaignsGateway | null,\n chatAdapter: ChatAdapterGateway | null,\n assets: AssetsGateway | null,\n ) {\n this.customerService = customerService;\n this.chatConfig = chatConfig;\n this.campaigns = campaigns;\n this.chatAdapter = chatAdapter;\n this.assets = assets;\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 (optional). */\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 assets?: {\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 || axios.create({\n headers: {\n Authorization: `Bearer ${params.apiToken}`,\n },\n });\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 const assets = params.services.assets\n ? new AssetsGateway(httpClient, params.services.assets.baseUrl)\n : null;\n return new SDKGateways(customerService, chatConfig, campaigns, chatAdapter, assets);\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 ASSETS: 'assets',\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 case SERVICE_GATEWAYS.ASSETS:\n if (!sdk.client.assets)\n throw new Error(`Service 'assets' is not configured. Provide its baseUrl in configure().`);\n return sdk.client.assets;\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';\nexport * from './assets/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,aAAq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b,IAAM,YAAY,CAAC,WAAgC;AACxD,MAAI,UAAU,MAAM;AACtB;AAmBO,SAAS,QAAQ,SAA2B;AACjD,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEF,UAAQ,SAAS;AAAA,IACf,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,mFAAmF;AACrG,aAAO,IAAI,OAAO;AAAA,IACpB,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,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,KAAK,iBAAiB;AACpB,UAAI,CAAC,IAAI,OAAO;AACd,cAAM,IAAI,MAAM,yEAAyE;AAC3F,aAAO,IAAI,OAAO;AAAA,IACpB;AACE,YAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE;AAAA,EACzD;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.5.0",
|
|
3
3
|
"description": "A simple package to help with some common tasks",
|
|
4
4
|
"name": "@opens/gateways",
|
|
5
5
|
"private": false,
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"vitest": "^3.0.7"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"axios": "^1.
|
|
54
|
+
"axios": "^1.18.0"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|