@great-detail/support-sdk 0.31.0 → 0.32.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.ts CHANGED
@@ -3047,7 +3047,7 @@ type WhatsappAccountTemplate = {
3047
3047
  type: "BODY";
3048
3048
  text?: string;
3049
3049
  example?: {
3050
- body_text: string[];
3050
+ body_text: [string[]];
3051
3051
  } | {
3052
3052
  body_text_named_params: {
3053
3053
  param_name: string;
@@ -4120,12 +4120,13 @@ declare const eventWebhookSchema: z.ZodObject<{
4120
4120
  }, z.core.$strip>;
4121
4121
  }, z.core.$strip>;
4122
4122
  }, z.core.$strip>;
4123
- type WebhookEventType = AccountWebhookWebhookEventType | AccountAccessTokenWebhookEventType | AccountNotificationEventEventType | ContactWebhookEventType | ConversationWebhookEventType | MessageWebhookEventType | ImportWebhookEventType | WebhookSubscriptionWebhookEventType;
4123
+ type WebhookEventType = AccountWebhookWebhookEventType | AccountAccessTokenWebhookEventType | AccountNotificationEventEventType | ContactWebhookEventType | ConversationWebhookEventType | ConversationFeedbackWebhookEventType | MessageWebhookEventType | ImportWebhookEventType | WebhookSubscriptionWebhookEventType;
4124
4124
  type AccountWebhookWebhookEventType = "account.created" | "account.updated";
4125
4125
  type AccountAccessTokenWebhookEventType = "accountAccessToken.created" | "accountAccessToken.deleted";
4126
4126
  type AccountNotificationEventEventType = "accountNotificationEvent.created" | "accountNotificationEvent.read";
4127
4127
  type ContactWebhookEventType = "contact.created" | "contact.updated" | "contact.deleted";
4128
4128
  type ConversationWebhookEventType = "conversation.created" | "conversation.updated" | "conversation.closed" | "conversation.received" | "conversation.resolved" | "conversation.sent";
4129
+ type ConversationFeedbackWebhookEventType = "conversation-feedback.created" | "conversation-feedback.deleted";
4129
4130
  type MessageWebhookEventType = "message.created" | "message.updated" | "message.delivered" | "message.failed" | "message.read" | "message.received" | "message.sent";
4130
4131
  type ImportWebhookEventType = "import.created" | "import.started" | "import.completed" | "import.failed" | "import.deleted";
4131
4132
  type WebhookSubscriptionWebhookEventType = "webhook-subscription.created" | "webhook-subscription.updated" | "webhook-subscription.deleted" | "webhook-subscription.test";
@@ -4159,6 +4160,11 @@ type WebhookEventPayload = {
4159
4160
  payload: {
4160
4161
  conversation: string;
4161
4162
  };
4163
+ } | {
4164
+ type: ConversationFeedbackWebhookEventType;
4165
+ payload: {
4166
+ conversationFeedback: string;
4167
+ };
4162
4168
  } | {
4163
4169
  type: MessageWebhookEventType;
4164
4170
  payload: {
@@ -4299,6 +4305,11 @@ declare class WebhookAPI {
4299
4305
  payload: {
4300
4306
  conversation: string;
4301
4307
  };
4308
+ } | {
4309
+ type: ConversationFeedbackWebhookEventType;
4310
+ payload: {
4311
+ conversationFeedback: string;
4312
+ };
4302
4313
  } | {
4303
4314
  type: MessageWebhookEventType;
4304
4315
  payload: {
@@ -4559,6 +4570,6 @@ declare namespace index {
4559
4570
  }
4560
4571
 
4561
4572
  /** SDK Version */
4562
- declare const SDK_VERSION = "0.31.0";
4573
+ declare const SDK_VERSION = "0.32.0";
4563
4574
 
4564
- export { type Account, type AccountAccessToken, type AccountAccessTokenID, type AccountAccessTokenWebhookEventType, type AccountConversationSettings, type AccountID, type AccountNotificationEvent, type AccountNotificationEventEventType, type AccountStatus, type AccountWebhookWebhookEventType, type Action, type ActionID, type ActionStatus, type ActiveConversationStatus, type BoilerplateCategory, type BoilerplateCategoryID, type BoilerplateContent, type BoilerplateContentID, type Channel, type ChannelConversationSettings, type ChannelID, type ChannelStatus, Client, type CompositionSection, type CompositionSectionID, type CompositionSectionLocation, type ConcludedConversationStatus, type Contact, type ContactCustomMetadata, type ContactID, type ContactStatus, type ContactType, type ContactWebhookEventType, type Conversation, type ConversationCustomMetadata, type ConversationFeedback, type ConversationID, type ConversationSettings, type ConversationStatus, type ConversationWebhookEventType, type CountResponsePagination, type CreateAccountAccessTokenOptions, type CreateAccountAccessTokenPayload, type CreateAccountAccessTokenResponse, type CreateAccountOptions, type CreateAccountPayload, type CreateAccountResponse, type CreateBoilerplateCategoryOptions, type CreateBoilerplateCategoryPayload, type CreateBoilerplateCategoryResponse, type CreateBoilerplateContentOptions, type CreateBoilerplateContentPayload, type CreateBoilerplateContentResponse, type CreateChannelOptions, type CreateChannelPayload, type CreateChannelResponse, type CreateCompositionSectionOptions, type CreateCompositionSectionPayload, type CreateCompositionSectionResponse, type CreateContactOptions, type CreateContactPayload, type CreateContactResponse, type CreateConversationFeedbackOptions, type CreateConversationFeedbackPayload, type CreateConversationFeedbackResponse, type CreateConversationOptions, type CreateConversationPayload, type CreateConversationResponse, type CreateEscalationOptions, type CreateEscalationPayload, type CreateEscalationResponse, type CreateImportOptions, type CreateImportPayload, type CreateImportResponse, type CreateLabelOptions, type CreateLabelPayload, type CreateLabelResponse, type CreateMessageOptions, type CreateMessagePayload, type CreateMessageResponse, type CreateModelConfigOptions, type CreateModelConfigPayload, type CreateModelConfigResponse, type CreateNoteOptions, type CreateNotePayload, type CreateNoteResponse, type CreateUploadIncludeOptions, type CreateUploadOptions, type CreateUploadResponse, type CreateWebhookSubscriptionOptions, type CreateWebhookSubscriptionPayload, type CreateWebhookSubscriptionResponse, type CurrentAccountID, type CursorResponsePagination, type CustomChannelCustomMetadata, DEFAULT_SUPPORT_BASE_URL, type DeleteAccountAccessTokenOptions, type DeleteAccountAccessTokenPayload, type DeleteAccountAccessTokenResponse, type DeleteAccountOptions, type DeleteAccountResponse, type DeleteBoilerplateCategoryOptions, type DeleteBoilerplateCategoryResponse, type DeleteBoilerplateContentOptions, type DeleteBoilerplateContentResponse, type DeleteChannelOptions, type DeleteChannelResponse, type DeleteContactOptions, type DeleteContactResponse, type DeleteConversationFeedbackOptions, type DeleteConversationFeedbackResponse, type DeleteConversationOptions, type DeleteConversationResponse, type DeleteEscalationOptions, type DeleteEscalationResponse, type DeleteLabelOptions, type DeleteLabelResponse, type DeleteMessageOptions, type DeleteMessageResponse, type DeleteModelConfigOptions, type DeleteModelConfigResponse, type DeleteUploadOptions, type DeleteUploadResponse, type DeleteWebhookSubscriptionOptions, type DeleteWebhookSubscriptionResponse, type DeleteWhatsappAccountTemplateOptions, type DeleteWhatsappAccountTemplateResponse, index as Error, type ErrorResponse, type ErrorSourcePath, type ErrorSourcePrefix, type ErrorType, type Escalation, type EventWebhookOptions, type GetAccountAccessTokenOptions, type GetAccountAccessTokenResponse, type GetAccountConversationSettingsOptions, type GetAccountConversationSettingsResponse, type GetAccountNotificationEventOptions, type GetAccountNotificationEventResponse, type GetAccountOptions, type GetAccountResponse, type GetActionOptions, type GetActionResponse, type GetBoilerplateCategoryOptions, type GetBoilerplateCategoryResponse, type GetBoilerplateContentOptions, type GetBoilerplateContentResponse, type GetChannelConversationSettingsOptions, type GetChannelConversationSettingsResponse, type GetChannelOptions, type GetChannelResponse, type GetCompositionSectionOptions, type GetCompositionSectionResponse, type GetContactIncludeOptions, type GetContactOptions, type GetContactResponse, type GetContactVCFOptions, type GetConversationFeedbackOptions, type GetConversationFeedbackResponse, type GetConversationIncludeOptions, type GetConversationOptions, type GetConversationResponse, type GetEscalationOptions, type GetEscalationResponse, type GetImportOptions, type GetImportResponse, type GetLabelOptions, type GetLabelResponse, type GetMessageOptions, type GetMessageResponse, type GetMetadataVersionOptions, type GetMetadataVersionResponse, type GetModelConfigOptions, type GetModelConfigResponse, type GetModelInterfaceOptions, type GetModelInterfaceResponse, type GetNoteOptions, type GetNoteResponse, type GetSourceOptions, type GetSourceResponse, type GetUploadIncludeOptions, type GetUploadOptions, type GetUploadResponse, type GetWebhookSubscriptionOptions, type GetWebhookSubscriptionResponse, type GetWhatsappAccountIncludeOptions, type GetWhatsappAccountOptions, type GetWhatsappAccountResponse, type GetWhatsappAccountTemplateOptions, type GetWhatsappAccountTemplateResponse, type GetWhatsappBusinessProfileOptions, type GetWhatsappBusinessProfileResponse, type GetWhatsappPhoneNumberIncludeOptions, type GetWhatsappPhoneNumberOptions, type GetWhatsappPhoneNumberResponse, type Import, type ImportID, type ImportStatus, type ImportType, type ImportWebhookEventType, type Label, type LabelID, type LexicalDirection, type LexicalHeadingNode, type LexicalHorizontalRuleNode, type LexicalIndent, type LexicalLinkNode, type LexicalListItemNode, type LexicalListNode, type LexicalParagraphNode, type LexicalQuoteNode, type LexicalRootNode, type LexicalTextNode, type LexicalUploadNode, type ListAccountAccessTokensOptions, type ListAccountAccessTokensResponse, type ListAccountNotificationEventsFilterOptions, type ListAccountNotificationEventsOptions, type ListAccountNotificationEventsResponse, type ListAccountsOptions, type ListAccountsResponse, type ListActionsOptions, type ListActionsResponse, type ListBoilerplateCategoriesIncludeOptions, type ListBoilerplateCategoriesOptions, type ListBoilerplateCategoriesResponse, type ListBoilerplateContentsOptions, type ListBoilerplateContentsResponse, type ListChannelsOptions, type ListChannelsResponse, type ListCompositionSectionsOptions, type ListCompositionSectionsResponse, type ListContactsOptions, type ListContactsResponse, type ListConversationFeedbackOptions, type ListConversationFeedbackResponse, type ListConversationOptions, type ListConversationsFilterOptions, type ListConversationsIncludeOptions, type ListConversationsResponse, type ListEscalationsOptions, type ListEscalationsResponse, type ListImportsOptions, type ListImportsResponse, type ListLabelsIncludeOptions, type ListLabelsOptions, type ListLabelsResponse, type ListMessagesIncludeOptions, type ListMessagesOptions, type ListMessagesResponse, type ListModelConfigsOptions, type ListModelConfigsResponse, type ListModelInterfacesOptions, type ListModelInterfacesResponse, type ListNotesOptions, type ListNotesResponse, type ListSourcesOptions, type ListSourcesResponse, type ListUploadsIncludeOptions, type ListUploadsOptions, type ListUploadsResponse, type ListWebhookSubscriptionsOptions, type ListWebhookSubscriptionsResponse, type ListWhatsappAccountTemplatesOptions, type ListWhatsappAccountTemplatesResponse, type ListWhatsappAccountsOptions, type ListWhatsappAccountsResponse, type ListWhatsappPhoneNumbersOptions, type ListWhatsappPhoneNumbersResponse, type Message, type MessageCustomMetadata, type MessageEventType, type MessageID, type MessageRole, type MessageStatus, type MessageType, type MessageVisibility, type MessageWebhookEventType, type ModelConfig, type ModelInterface, type ModelInterfaceID, type Note, type NoteID, type NotificationEvent, type Options$1 as Options, type ResponseData, type ResponseMeta, type ResponseTimestamp, SDK_VERSION, type SelfCursorResponsePagination, type SendChannelSyncPayload, type SendgridChannelSyncOptions, type SendgridChannelSyncResponse, type SortOptions, type Source, type SourceAdornment, type SourceID, SupportError, type TestWebhookSubscriptionOptions, type TestWebhookSubscriptionResponse, type Options$5 as TransportOptions, type TriggerResponseConversationOptions, type TriggerResponseConversationResponse, type UpdateAccountConversationSettingsOptions, type UpdateAccountConversationSettingsPayload, type UpdateAccountConversationSettingsResponse, type UpdateAccountOptions, type UpdateAccountPayload, type UpdateAccountResponse, type UpdateBoilerplateCategoryOptions, type UpdateBoilerplateCategoryPayload, type UpdateBoilerplateCategoryResponse, type UpdateBoilerplateContentOptions, type UpdateBoilerplateContentPayload, type UpdateBoilerplateContentResponse, type UpdateChannelConversationSettingsOptions, type UpdateChannelConversationSettingsPayload, type UpdateChannelConversationSettingsResponse, type UpdateChannelOptions, type UpdateChannelPayload, type UpdateChannelResponse, type UpdateCompositionSectionOptions, type UpdateCompositionSectionPayload, type UpdateCompositionSectionResponse, type UpdateContactOptions, type UpdateContactPayload, type UpdateContactResponse, type UpdateConversationOptions, type UpdateConversationPayload, type UpdateConversationResponse, type UpdateLabelOptions, type UpdateLabelPayload, type UpdateLabelResponse, type UpdateModelConfigOptions, type UpdateModelConfigPayload, type UpdateModelConfigResponse, type UpdateNoteOptions, type UpdateNotePayload, type UpdateNoteResponse, type UpdateWhatsappBusinessProfileOptions, type UpdateWhatsappBusinessProfilePayload, type UpdateWhatsappBusinessProfileResponse, type UpdateWhatsappPhoneNumberOptions, type UpdateWhatsappPhoneNumberPayload, type UpdateWhatsappPhoneNumberResponse, type Upload, type UploadID, WHATSAPP_BUSINESS_PROFILE_VERTICAL, WHATSAPP_TEMPLATE_CATEGORIES, WHATSAPP_TEMPLATE_INDUSTRIES, WHATSAPP_TEMPLATE_LANGUAGES, WHATSAPP_TEMPLATE_QUALITY_SCORES, WHATSAPP_TEMPLATE_STATUSES, WHATSAPP_TEMPLATE_SUBCATEGORIES, WHATSAPP_TEMPLATE_TOPICS, WHATSAPP_TEMPLATE_USECASES, type WebhookEventPayload, type WebhookEventType, type WebhookResponse, type WebhookSubscription, type WebhookSubscriptionID, type WebhookSubscriptionWebhookEventType, type WhatsappAccount, type WhatsappAccountDetail, type WhatsappAccountTemplate, type WhatsappBusinessProfileDetail, type WhatsappLibraryTemplate, type WhatsappPhoneNumber, type WhatsappTemplateButton, type WhatsappTemplateCategory, type WhatsappTemplateIndustry, type WhatsappTemplateLanguage, type WhatsappTemplateParameterFormat, type WhatsappTemplateQualityScore, type WhatsappTemplateRejectionReason, type WhatsappTemplateStatus, type WhatsappTemplateSubcategory, type WhatsappTemplateTopic, type WhatsappTemplateUseCase, Client as default, eventWebhookSchema };
4575
+ export { type Account, type AccountAccessToken, type AccountAccessTokenID, type AccountAccessTokenWebhookEventType, type AccountConversationSettings, type AccountID, type AccountNotificationEvent, type AccountNotificationEventEventType, type AccountStatus, type AccountWebhookWebhookEventType, type Action, type ActionID, type ActionStatus, type ActiveConversationStatus, type BoilerplateCategory, type BoilerplateCategoryID, type BoilerplateContent, type BoilerplateContentID, type Channel, type ChannelConversationSettings, type ChannelID, type ChannelStatus, Client, type CompositionSection, type CompositionSectionID, type CompositionSectionLocation, type ConcludedConversationStatus, type Contact, type ContactCustomMetadata, type ContactID, type ContactStatus, type ContactType, type ContactWebhookEventType, type Conversation, type ConversationCustomMetadata, type ConversationFeedback, type ConversationFeedbackWebhookEventType, type ConversationID, type ConversationSettings, type ConversationStatus, type ConversationWebhookEventType, type CountResponsePagination, type CreateAccountAccessTokenOptions, type CreateAccountAccessTokenPayload, type CreateAccountAccessTokenResponse, type CreateAccountOptions, type CreateAccountPayload, type CreateAccountResponse, type CreateBoilerplateCategoryOptions, type CreateBoilerplateCategoryPayload, type CreateBoilerplateCategoryResponse, type CreateBoilerplateContentOptions, type CreateBoilerplateContentPayload, type CreateBoilerplateContentResponse, type CreateChannelOptions, type CreateChannelPayload, type CreateChannelResponse, type CreateCompositionSectionOptions, type CreateCompositionSectionPayload, type CreateCompositionSectionResponse, type CreateContactOptions, type CreateContactPayload, type CreateContactResponse, type CreateConversationFeedbackOptions, type CreateConversationFeedbackPayload, type CreateConversationFeedbackResponse, type CreateConversationOptions, type CreateConversationPayload, type CreateConversationResponse, type CreateEscalationOptions, type CreateEscalationPayload, type CreateEscalationResponse, type CreateImportOptions, type CreateImportPayload, type CreateImportResponse, type CreateLabelOptions, type CreateLabelPayload, type CreateLabelResponse, type CreateMessageOptions, type CreateMessagePayload, type CreateMessageResponse, type CreateModelConfigOptions, type CreateModelConfigPayload, type CreateModelConfigResponse, type CreateNoteOptions, type CreateNotePayload, type CreateNoteResponse, type CreateUploadIncludeOptions, type CreateUploadOptions, type CreateUploadResponse, type CreateWebhookSubscriptionOptions, type CreateWebhookSubscriptionPayload, type CreateWebhookSubscriptionResponse, type CurrentAccountID, type CursorResponsePagination, type CustomChannelCustomMetadata, DEFAULT_SUPPORT_BASE_URL, type DeleteAccountAccessTokenOptions, type DeleteAccountAccessTokenPayload, type DeleteAccountAccessTokenResponse, type DeleteAccountOptions, type DeleteAccountResponse, type DeleteBoilerplateCategoryOptions, type DeleteBoilerplateCategoryResponse, type DeleteBoilerplateContentOptions, type DeleteBoilerplateContentResponse, type DeleteChannelOptions, type DeleteChannelResponse, type DeleteContactOptions, type DeleteContactResponse, type DeleteConversationFeedbackOptions, type DeleteConversationFeedbackResponse, type DeleteConversationOptions, type DeleteConversationResponse, type DeleteEscalationOptions, type DeleteEscalationResponse, type DeleteLabelOptions, type DeleteLabelResponse, type DeleteMessageOptions, type DeleteMessageResponse, type DeleteModelConfigOptions, type DeleteModelConfigResponse, type DeleteUploadOptions, type DeleteUploadResponse, type DeleteWebhookSubscriptionOptions, type DeleteWebhookSubscriptionResponse, type DeleteWhatsappAccountTemplateOptions, type DeleteWhatsappAccountTemplateResponse, index as Error, type ErrorResponse, type ErrorSourcePath, type ErrorSourcePrefix, type ErrorType, type Escalation, type EventWebhookOptions, type GetAccountAccessTokenOptions, type GetAccountAccessTokenResponse, type GetAccountConversationSettingsOptions, type GetAccountConversationSettingsResponse, type GetAccountNotificationEventOptions, type GetAccountNotificationEventResponse, type GetAccountOptions, type GetAccountResponse, type GetActionOptions, type GetActionResponse, type GetBoilerplateCategoryOptions, type GetBoilerplateCategoryResponse, type GetBoilerplateContentOptions, type GetBoilerplateContentResponse, type GetChannelConversationSettingsOptions, type GetChannelConversationSettingsResponse, type GetChannelOptions, type GetChannelResponse, type GetCompositionSectionOptions, type GetCompositionSectionResponse, type GetContactIncludeOptions, type GetContactOptions, type GetContactResponse, type GetContactVCFOptions, type GetConversationFeedbackOptions, type GetConversationFeedbackResponse, type GetConversationIncludeOptions, type GetConversationOptions, type GetConversationResponse, type GetEscalationOptions, type GetEscalationResponse, type GetImportOptions, type GetImportResponse, type GetLabelOptions, type GetLabelResponse, type GetMessageOptions, type GetMessageResponse, type GetMetadataVersionOptions, type GetMetadataVersionResponse, type GetModelConfigOptions, type GetModelConfigResponse, type GetModelInterfaceOptions, type GetModelInterfaceResponse, type GetNoteOptions, type GetNoteResponse, type GetSourceOptions, type GetSourceResponse, type GetUploadIncludeOptions, type GetUploadOptions, type GetUploadResponse, type GetWebhookSubscriptionOptions, type GetWebhookSubscriptionResponse, type GetWhatsappAccountIncludeOptions, type GetWhatsappAccountOptions, type GetWhatsappAccountResponse, type GetWhatsappAccountTemplateOptions, type GetWhatsappAccountTemplateResponse, type GetWhatsappBusinessProfileOptions, type GetWhatsappBusinessProfileResponse, type GetWhatsappPhoneNumberIncludeOptions, type GetWhatsappPhoneNumberOptions, type GetWhatsappPhoneNumberResponse, type Import, type ImportID, type ImportStatus, type ImportType, type ImportWebhookEventType, type Label, type LabelID, type LexicalDirection, type LexicalHeadingNode, type LexicalHorizontalRuleNode, type LexicalIndent, type LexicalLinkNode, type LexicalListItemNode, type LexicalListNode, type LexicalParagraphNode, type LexicalQuoteNode, type LexicalRootNode, type LexicalTextNode, type LexicalUploadNode, type ListAccountAccessTokensOptions, type ListAccountAccessTokensResponse, type ListAccountNotificationEventsFilterOptions, type ListAccountNotificationEventsOptions, type ListAccountNotificationEventsResponse, type ListAccountsOptions, type ListAccountsResponse, type ListActionsOptions, type ListActionsResponse, type ListBoilerplateCategoriesIncludeOptions, type ListBoilerplateCategoriesOptions, type ListBoilerplateCategoriesResponse, type ListBoilerplateContentsOptions, type ListBoilerplateContentsResponse, type ListChannelsOptions, type ListChannelsResponse, type ListCompositionSectionsOptions, type ListCompositionSectionsResponse, type ListContactsOptions, type ListContactsResponse, type ListConversationFeedbackOptions, type ListConversationFeedbackResponse, type ListConversationOptions, type ListConversationsFilterOptions, type ListConversationsIncludeOptions, type ListConversationsResponse, type ListEscalationsOptions, type ListEscalationsResponse, type ListImportsOptions, type ListImportsResponse, type ListLabelsIncludeOptions, type ListLabelsOptions, type ListLabelsResponse, type ListMessagesIncludeOptions, type ListMessagesOptions, type ListMessagesResponse, type ListModelConfigsOptions, type ListModelConfigsResponse, type ListModelInterfacesOptions, type ListModelInterfacesResponse, type ListNotesOptions, type ListNotesResponse, type ListSourcesOptions, type ListSourcesResponse, type ListUploadsIncludeOptions, type ListUploadsOptions, type ListUploadsResponse, type ListWebhookSubscriptionsOptions, type ListWebhookSubscriptionsResponse, type ListWhatsappAccountTemplatesOptions, type ListWhatsappAccountTemplatesResponse, type ListWhatsappAccountsOptions, type ListWhatsappAccountsResponse, type ListWhatsappPhoneNumbersOptions, type ListWhatsappPhoneNumbersResponse, type Message, type MessageCustomMetadata, type MessageEventType, type MessageID, type MessageRole, type MessageStatus, type MessageType, type MessageVisibility, type MessageWebhookEventType, type ModelConfig, type ModelInterface, type ModelInterfaceID, type Note, type NoteID, type NotificationEvent, type Options$1 as Options, type ResponseData, type ResponseMeta, type ResponseTimestamp, SDK_VERSION, type SelfCursorResponsePagination, type SendChannelSyncPayload, type SendgridChannelSyncOptions, type SendgridChannelSyncResponse, type SortOptions, type Source, type SourceAdornment, type SourceID, SupportError, type TestWebhookSubscriptionOptions, type TestWebhookSubscriptionResponse, type Options$5 as TransportOptions, type TriggerResponseConversationOptions, type TriggerResponseConversationResponse, type UpdateAccountConversationSettingsOptions, type UpdateAccountConversationSettingsPayload, type UpdateAccountConversationSettingsResponse, type UpdateAccountOptions, type UpdateAccountPayload, type UpdateAccountResponse, type UpdateBoilerplateCategoryOptions, type UpdateBoilerplateCategoryPayload, type UpdateBoilerplateCategoryResponse, type UpdateBoilerplateContentOptions, type UpdateBoilerplateContentPayload, type UpdateBoilerplateContentResponse, type UpdateChannelConversationSettingsOptions, type UpdateChannelConversationSettingsPayload, type UpdateChannelConversationSettingsResponse, type UpdateChannelOptions, type UpdateChannelPayload, type UpdateChannelResponse, type UpdateCompositionSectionOptions, type UpdateCompositionSectionPayload, type UpdateCompositionSectionResponse, type UpdateContactOptions, type UpdateContactPayload, type UpdateContactResponse, type UpdateConversationOptions, type UpdateConversationPayload, type UpdateConversationResponse, type UpdateLabelOptions, type UpdateLabelPayload, type UpdateLabelResponse, type UpdateModelConfigOptions, type UpdateModelConfigPayload, type UpdateModelConfigResponse, type UpdateNoteOptions, type UpdateNotePayload, type UpdateNoteResponse, type UpdateWhatsappBusinessProfileOptions, type UpdateWhatsappBusinessProfilePayload, type UpdateWhatsappBusinessProfileResponse, type UpdateWhatsappPhoneNumberOptions, type UpdateWhatsappPhoneNumberPayload, type UpdateWhatsappPhoneNumberResponse, type Upload, type UploadID, WHATSAPP_BUSINESS_PROFILE_VERTICAL, WHATSAPP_TEMPLATE_CATEGORIES, WHATSAPP_TEMPLATE_INDUSTRIES, WHATSAPP_TEMPLATE_LANGUAGES, WHATSAPP_TEMPLATE_QUALITY_SCORES, WHATSAPP_TEMPLATE_STATUSES, WHATSAPP_TEMPLATE_SUBCATEGORIES, WHATSAPP_TEMPLATE_TOPICS, WHATSAPP_TEMPLATE_USECASES, type WebhookEventPayload, type WebhookEventType, type WebhookResponse, type WebhookSubscription, type WebhookSubscriptionID, type WebhookSubscriptionWebhookEventType, type WhatsappAccount, type WhatsappAccountDetail, type WhatsappAccountTemplate, type WhatsappBusinessProfileDetail, type WhatsappLibraryTemplate, type WhatsappPhoneNumber, type WhatsappTemplateButton, type WhatsappTemplateCategory, type WhatsappTemplateIndustry, type WhatsappTemplateLanguage, type WhatsappTemplateParameterFormat, type WhatsappTemplateQualityScore, type WhatsappTemplateRejectionReason, type WhatsappTemplateStatus, type WhatsappTemplateSubcategory, type WhatsappTemplateTopic, type WhatsappTemplateUseCase, Client as default, eventWebhookSchema };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var nt=Object.defineProperty;var rt=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})};var K="https://api.support.greatdetail.com",Q={"x-powered-by":"GDS/JavaScript"};var u=class{constructor(t){this._transport=t}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/accounts",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}get(t,{request:e={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{filter:e,pagination:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/notifications/events/account",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/actions/${encodeURIComponent(t)}`,{...e,method:"GET"})}list({filter:t,sort:e,pagination:o,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t})})}};var J="SUPPORT_ACCESS_TOKEN",X="SUPPORT_KEY_NAME",Z="SUPPORT_KEY_PASSWORD",z="SUPPORT_SIGNING_KEY",tt="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[X],password:e=process.env[Z]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){let t=typeof this.name=="function"?this.name():this.name,e=typeof this.#t=="function"?this.#t():this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var C=class{#t;constructor({token:t=process.env[J]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?this.#t():this.#t}`}}};var T=class{getHeaders(){return{}}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/boilerplates/categories",{...n,method:"GET",searchParams:this._transport.query.build({include:o,pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/boilerplates/categories/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/boilerplates/categories/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/boilerplates/contents/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/boilerplates/contents/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"DELETE"})}sendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/sendgrid/sync",{...o,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/composition-sections",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({pagination:t,filter:e,sort:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:this._transport.query.build({pagination:t,sort:o,filter:e})})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}merge(t,e,{request:o={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}/merge`,{...o,method:"POST",json:{contact:e}})}};var b=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({filter:t,sort:e,pagination:o,include:n,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t,include:n})})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}triggerResponse(t,{request:e={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}/response`,{...e,method:"POST"})}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/conversation/${encodeURIComponent(t)}/context`,{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/conversation/${encodeURIComponent(t)}/context`,{...o,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/feedback/conversation",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/escalations",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/escalations/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var S=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/imports/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/imports",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/imports",{...e,method:"POST",json:t})}delete(t,{body:e,request:o={}}){return this._transport.send("v1/imports/"+encodeURIComponent(t),{...o,method:"DELETE",json:e})}};var y=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/accounts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({request:t={}}={}){return this._transport.send("v1/integrations/whatsapp/accounts",{...t,method:"GET"})}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t)+"/business-profile",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t)+"/business-profile",{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({whatsappAccount:t,channel:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers",{...o,method:"GET",searchParams:this._transport.query.build({filter:{whatsappAccount:t,channel:e}})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var P=class{constructor(t){this._transport=t}listByAccount(t,{search:e,status:o,quality:n,category:s,language:p,request:i={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates`,{...i,method:"GET",searchParams:this._transport.query.build({filter:{search:e,status:o,quality:n,category:s,language:p}})})}getByAccount(t,e,{request:o={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates/${e}`,{...o,method:"GET"})}deleteByAccount(t,e,{request:o={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates/${e}`,{...o,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t,include:o})})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/messages/${encodeURIComponent(t)}`,{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:this._transport.query.build({pagination:e,include:o,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/messages/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}getVersion({request:t={}}={}){return this._transport.send("v1/metadata/version",{...t,method:"GET"})}};var W=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/models/configs",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/models/configs",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/interfaces/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models/interfaces",{...t,method:"GET"})}};var M=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/notes",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let s=Array.isArray(e)?e:[e];for(let p of s)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var B=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import st,{HTTPError as pt}from"ky";var w=class extends Error{constructor(e,o,{requestID:n,body:s,...p}){super(`GDS(ERR): [${e.status}] ${o.method}:${e.url}${s?" - "+s:""}`,p);this.response=e;this.request=o;this.requestID=n}requestID};function m(r){return typeof r=="function"&&(r=r()),typeof r.toString=="function"?r.toString():typeof r=="string"?r:String(r)}var H=class r{static _filterExemptColumns=["filter"];static build({sort:t,pagination:e,filter:o,include:n,custom:s}){return[...Object.entries(o??{}).flatMap(([p,i])=>r._filterExemptColumns.includes(p)?[]:this.query(`filter[${p}]`,i)),...this.query("filter",o?.filter),...Object.entries(n??{}).flatMap(([p,i])=>i?this.query("include",p):[]),...Object.entries(t??{}).flatMap(([p,i])=>i===void 0?[]:this.query("sort",(i==="desc"?"-":"")+m(p))),...this.paginationCursor(e),...this.query("page[size]",e?.size),...Object.entries(s??{}).flatMap(([p,i])=>this.query(p,i))]}static query(t,e){let o=[];if(e===void 0)return o;if(e===null)return[...o,[t,"null"]];for(let n of Array.isArray(e)?e:[e])o.push([t,m(n)]);return o}static paginationCursor({before:t,after:e,preferred:o="after"}={}){let n=[];if(t===void 0&&e===void 0)return n;let s=t?{dir:"before",value:m(t)}:void 0,p=e?{dir:"after",value:m(e)}:void 0,i=o==="after"?p||s:s||p;return i&&n.push([`page[${i.dir}]`,i.value]),n}};var q=class{client;options;query=H;constructor({baseURL:t,authentication:e,...o}){this.options={authentication:e,baseURL:t},this.client=st.create({prefixUrl:this.options.baseURL,headers:Q,timeout:12e3,...o.request})}getURL(t){return new URL(t,this.options.baseURL).toString()}_generateRequestId(){let t="";if(globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"){let n=new Uint8Array(21);return globalThis.crypto.getRandomValues(n),t+Array.from(n,s=>s.toString(16).padStart(2,"0")).join("")}if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return t+globalThis.crypto.randomUUID();let e=Date.now().toString(36),o=Math.random().toString(36).slice(2);return`${t}${e}-${o}`}send(t,e={}){let o=this._generateRequestId(),n=e.authentication??this.options.authentication,p=this.client.extend({headers:{...n.getHeaders(),"x-request-id":o}})(t,e).catch(async i=>{throw i instanceof pt?new w(i.response,i.request,{requestID:o,body:await i.response.text(),cause:i}):i});return{requestID:o,response:()=>p,json:async()=>(await p).json()}}};var j=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({filter:t,include:e,pagination:o,request:n={}}={}){return this._transport.send("v1/uploads",{...n,method:"GET",searchParams:this._transport.query.build({filter:t,include:e,pagination:o})})}create({files:t,include:e,request:o={}}){let n=new FormData;for(let s of t)n.append("file",s);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:e}),body:n})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};import{z as a}from"zod";var et=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string(),a.string()),createdAt:a.iso.datetime()})})});var V=class{constructor(t){this._transport=t}async event({key:t=process.env[z],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+z);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:s}=et.parse(o.body);return{event:s.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let s of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(s)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var $=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class r{static DEFAULT_BASE_URL=K;static PublicAuthentication=T;static BasicAuthentication=c;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationContext;conversationFeedback;escalation;label;import;integration;message;metadata;modelConfig;modelInterface;note;source;statistics;upload;webhook;webhookSubscription;constructor(t=new c,{baseURL:e,...o}={}){this._transport=new q({authentication:t,...o,baseURL:e?.toString()??r.getBaseURL()}),this.account=new u(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.accountNotificationEvent=new h(this._transport),this.action=new f(this._transport),this.boilerplateCategory=new A(this._transport),this.boilerplateContent=new E(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new _(this._transport),this.compositionSection=new g(this._transport),this.contact=new O(this._transport),this.conversation=new b(this._transport),this.conversationContext=new x(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new v(this._transport),this.label=new L(this._transport),this.import=new S(this._transport),this.integration={whatsapp:{account:new y(this._transport),phoneNumber:new U(this._transport),businessProfile:new D(this._transport),template:new P(this._transport)}},this.message=new G(this._transport),this.metadata=new N(this._transport),this.modelConfig=new W(this._transport),this.modelInterface=new k(this._transport),this.note=new M(this._transport),this.source=new F(this._transport),this.statistics=new B(this._transport),this.upload=new j(this._transport),this.webhook=new V(this._transport),this.webhookSubscription=new $(this._transport)}static getBaseURL(){return process.env[tt]??this.DEFAULT_BASE_URL}$request(t,e){return this._transport.send(t,e)}};var ot={};rt(ot,{SupportError:()=>w});var Hn=["ALCOHOL","APPAREL","AUTO","BEAUTY","EDU","ENTERTAIN","EVENT_PLAN","FINANCE","GOVT","GROCERY","HEALTH","HOTEL","NONPROFIT","ONLINE_GAMBLING","OTC_DRUGS","OTHER","PHYSICAL_GAMBLING","PROF_SERVICES","RESTAURANT","RETAIL","TRAVEL"];var Zn=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],tr=["af","sq","ar","ar_EG","ar_AE","ar_LB","ar_MA","ar_QA","az","be_BY","bn","bn_IN","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","prs_AF","nl","nl_BE","en","en_GB","en_US","en_AE","en_AU","en_CA","en_GH","en_IE","en_IN","en_JM","en_MY","en_NZ","en_QA","en_SG","en_UG","en_ZA","et","fil","fi","fr","fr_BE","fr_CA","fr_CH","fr_CI","fr_MA","ka","de","de_AT","de_CH","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","rw_RW","ko","ky_KG","lo","lv","lt","mk","ms","ml","mr","nb","ps_AF","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","si_LK","sk","sl","es","es_AR","es_CL","es_CO","es_CR","es_DO","es_EC","es_HN","es_MX","es_PA","es_PE","es_ES","es_UY","sw","sv","ta","te","th","th","tr","uk","ur","uz","vi","zu"],er=["AUTHENTICATION","MARKETING","UTILITY"],or=["ORDER_DETAILS","ORDER_STATUS"],nr=["E_COMMERCE","FINANCIAL_SERVICES"],rr=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],sr=["ACCOUNT_CREATION_CONFIRMATION","PAYMENT_DUE_REMINDER","FEEDBACK_SURVEY","PAYMENT_ACTION_REQUIRED","SHIPMENT_CONFIRMATION","PAYMENT_OVERDUE","DELIVERY_UPDATE","PAYMENT_CONFIRMATION","ORDER_DELAY","FRAUD_ALERT","DELIVERY_FAILED","AUTO_PAY_REMINDER","DELIVERY_CONFIRMATION","PAYMENT_SCHEDULED","ORDER_PICK_UP","PAYMENT_REJECT_FAIL","ORDER_ACTION_NEEDED","STATEMENT_AVAILABLE","ORDER_CONFIRMATION","LOW_BALANCE_WARNING","ORDER_OR_TRANSACTION_CANCEL","RECEIPT_ATTACHMENT","RETURN_CONFIRMATION","STATEMENT_ATTACHMENT","TRANSACTION_ALERT"],pr=["GREEN","YELLOW","RED","UNKNOWN"];var ls="0.31.0";export{Y as Client,K as DEFAULT_SUPPORT_BASE_URL,ot as Error,ls as SDK_VERSION,w as SupportError,Hn as WHATSAPP_BUSINESS_PROFILE_VERTICAL,er as WHATSAPP_TEMPLATE_CATEGORIES,nr as WHATSAPP_TEMPLATE_INDUSTRIES,tr as WHATSAPP_TEMPLATE_LANGUAGES,pr as WHATSAPP_TEMPLATE_QUALITY_SCORES,Zn as WHATSAPP_TEMPLATE_STATUSES,or as WHATSAPP_TEMPLATE_SUBCATEGORIES,rr as WHATSAPP_TEMPLATE_TOPICS,sr as WHATSAPP_TEMPLATE_USECASES,Y as default,et as eventWebhookSchema};
1
+ var nt=Object.defineProperty;var rt=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})};var K="https://api.support.greatdetail.com",Q={"x-powered-by":"GDS/JavaScript"};var u=class{constructor(t){this._transport=t}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/accounts",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}get(t,{request:e={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/accounts",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var l=class{constructor(t){this._transport=t}get(t,e,{request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...o,method:"GET"})}list(t,{filter:e,pagination:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}delete(t,e,{body:o,request:n={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...n,method:"DELETE",json:o})}create(t,{body:e={},request:o={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...o,method:"POST",json:e})}};var d=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var h=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/notifications/events/account",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notifications/events/account/"+encodeURIComponent(t),{...o,method:"PATCH",json:{...e,readAt:e.readAt instanceof Date&&typeof e.readAt.getMonth=="function"?e.readAt.toISOString():e.readAt}})}};var f=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/actions/${encodeURIComponent(t)}`,{...e,method:"GET"})}list({filter:t,sort:e,pagination:o,request:n={}}={}){return this._transport.send("v1/actions",{...n,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t})})}};var J="SUPPORT_ACCESS_TOKEN",X="SUPPORT_KEY_NAME",Z="SUPPORT_KEY_PASSWORD",z="SUPPORT_SIGNING_KEY",tt="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[X],password:e=process.env[Z]}={}){if(!t)throw new Error("Name option must be specified when using Basic Authentication");if(!e)throw new Error("Password option must be specified when using Basic Authentication");this.name=t,this.#t=e}getHeaders(){let t=typeof this.name=="function"?this.name():this.name,e=typeof this.#t=="function"?this.#t():this.#t;return{Authorization:`Basic ${btoa(t+":"+e)}`}}};var C=class{#t;constructor({token:t=process.env[J]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}getHeaders(){return{Authorization:`Bearer ${typeof this.#t=="function"?this.#t():this.#t}`}}};var T=class{getHeaders(){return{}}};var A=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/categories/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/boilerplates/categories",{...n,method:"GET",searchParams:this._transport.query.build({include:o,pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/categories",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/boilerplates/categories/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/boilerplates/categories/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var E=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/boilerplates/contents/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/boilerplates/contents",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/boilerplates/contents",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/boilerplates/contents/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/boilerplates/contents/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var R=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/channels",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}create({body:t,request:e={}}){return this._transport.send("v1/channels",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t),{...e,method:"DELETE"})}sendgridChannelSync(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/sendgrid/sync",{...o,method:"POST",json:e})}};var _=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/conversation-settings",{...o,method:"PATCH",json:e})}};var g=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/composition-sections",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/composition-sections",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/composition-sections/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var b=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}getRelativeVCFURL(t,{vcf:e={}}={}){let o=e.variant??"vcard",n=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(n)}getVCFURL(t,e={}){return this._transport.getURL(this.getRelativeVCFURL(t,e))}getVCF(t,e={}){return this._transport.send(this.getVCFURL(t,e),{method:"GET"})}list({pagination:t,filter:e,sort:o,request:n={}}={}){return this._transport.send("v1/contacts",{...n,method:"GET",searchParams:this._transport.query.build({pagination:t,sort:o,filter:e})})}create({body:t,request:e={}}){return this._transport.send("v1/contacts",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}merge(t,e,{request:o={}}={}){return this._transport.send(`v1/contacts/${encodeURIComponent(t)}/merge`,{...o,method:"POST",json:{contact:e}})}};var O=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({filter:t,sort:e,pagination:o,include:n,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t,include:n})})}create({body:t,request:e={}}){return this._transport.send("v1/conversations",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}triggerResponse(t,{request:e={}}={}){return this._transport.send(`v1/conversations/${encodeURIComponent(t)}/response`,{...e,method:"POST"})}};var x=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/conversation/${encodeURIComponent(t)}/context`,{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send(`v1/conversation/${encodeURIComponent(t)}/context`,{...o,method:"PATCH",json:e})}};var I=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/feedback/conversation",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/feedback/conversation",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/feedback/conversation/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var v=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/escalations/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/escalations",{...o,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/escalations",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/escalations/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var y=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/imports/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/imports",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/imports",{...e,method:"POST",json:t})}delete(t,{body:e,request:o={}}){return this._transport.send("v1/imports/"+encodeURIComponent(t),{...o,method:"DELETE",json:e})}};var S=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/accounts/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({request:t={}}={}){return this._transport.send("v1/integrations/whatsapp/accounts",{...t,method:"GET"})}};var D=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t)+"/business-profile",{...e,method:"GET"})}update(t,{body:e,request:o={}}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t)+"/business-profile",{...o,method:"PATCH",json:e})}};var U=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({whatsappAccount:t,channel:e,request:o={}}={}){return this._transport.send("v1/integrations/whatsapp/phone-numbers",{...o,method:"GET",searchParams:this._transport.query.build({filter:{whatsappAccount:t,channel:e}})})}update(t,{body:e,request:o={}}){return this._transport.send("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var P=class{constructor(t){this._transport=t}listByAccount(t,{search:e,status:o,quality:n,category:s,language:p,request:i={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates`,{...i,method:"GET",searchParams:this._transport.query.build({filter:{search:e,status:o,quality:n,category:s,language:p}})})}getByAccount(t,e,{request:o={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates/${e}`,{...o,method:"GET"})}deleteByAccount(t,e,{request:o={}}={}){return this._transport.send(`v1/integrations/whatsapp/accounts/${t}/templates/${e}`,{...o,method:"DELETE"})}};var L=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/labels",{...n,method:"GET",searchParams:this._transport.query.build({pagination:e,filter:t,include:o})})}create({body:t,request:e={}}){return this._transport.send("v1/labels",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var G=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send(`v1/messages/${encodeURIComponent(t)}`,{...e,method:"GET"})}list({filter:t,pagination:e,include:o,request:n={}}={}){return this._transport.send("v1/messages",{...n,method:"GET",searchParams:this._transport.query.build({pagination:e,include:o,filter:t})})}create({body:t,request:e={}}){return this._transport.send("v1/messages",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send(`v1/messages/${encodeURIComponent(t)}`,{...e,method:"DELETE"})}};var N=class{constructor(t){this._transport=t}getVersion({request:t={}}={}){return this._transport.send("v1/metadata/version",{...t,method:"GET"})}};var k=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/models/configs",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}create({body:t,request:e={}}){return this._transport.send("v1/models/configs",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}delete(t,{request:e={}}={}){return this._transport.send("v1/models/configs/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var W=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/models/interfaces/"+encodeURIComponent(t),{...e,method:"GET"})}list({request:t={}}={}){return this._transport.send("v1/models/interfaces",{...t,method:"GET"})}};var F=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...e,method:"GET"})}list({filter:t,pagination:e,request:o={}}={}){return this._transport.send("v1/notes",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:t,request:e={}}){return this._transport.send("v1/notes",{...e,method:"POST",json:t})}update(t,{body:e,request:o={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...o,method:"PATCH",json:e})}};var M=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"})}list({featured:t,category:e,request:o={}}={}){let n=[];if(e){let s=Array.isArray(e)?e:[e];for(let p of s)n.push(["category",p])}return t!==void 0&&n.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:n})}};var B=class{constructor(t){this._transport=t}getMessageFrequency({request:t={}}={}){return this._transport.send("v1/statistics/message-frequency",{...t,method:"GET"})}getChannelMessageFrequency(t,{request:e={}}={}){return this._transport.send("v1/channels/"+encodeURIComponent(t)+"/statistics/message-frequency",{...e,method:"GET"})}getModelUsage({request:t={}}={}){return this._transport.send("v1/statistics/model-usage",{...t,method:"GET"})}};import st,{HTTPError as pt}from"ky";var w=class extends Error{constructor(e,o,{requestID:n,body:s,...p}){super(`GDS(ERR): [${e.status}] ${o.method}:${e.url}${s?" - "+s:""}`,p);this.response=e;this.request=o;this.requestID=n}requestID};function m(r){return typeof r=="function"&&(r=r()),typeof r.toString=="function"?r.toString():typeof r=="string"?r:String(r)}var H=class r{static _filterExemptColumns=["filter"];static build({sort:t,pagination:e,filter:o,include:n,custom:s}){return[...Object.entries(o??{}).flatMap(([p,i])=>r._filterExemptColumns.includes(p)?[]:this.query(`filter[${p}]`,i)),...this.query("filter",o?.filter),...Object.entries(n??{}).flatMap(([p,i])=>i?this.query("include",p):[]),...Object.entries(t??{}).flatMap(([p,i])=>i===void 0?[]:this.query("sort",(i==="desc"?"-":"")+m(p))),...this.paginationCursor(e),...this.query("page[size]",e?.size),...Object.entries(s??{}).flatMap(([p,i])=>this.query(p,i))]}static query(t,e){let o=[];if(e===void 0)return o;if(e===null)return[...o,[t,"null"]];for(let n of Array.isArray(e)?e:[e])o.push([t,m(n)]);return o}static paginationCursor({before:t,after:e,preferred:o="after"}={}){let n=[];if(t===void 0&&e===void 0)return n;let s=t?{dir:"before",value:m(t)}:void 0,p=e?{dir:"after",value:m(e)}:void 0,i=o==="after"?p||s:s||p;return i&&n.push([`page[${i.dir}]`,i.value]),n}};var q=class{client;options;query=H;constructor({baseURL:t,authentication:e,...o}){this.options={authentication:e,baseURL:t},this.client=st.create({prefixUrl:this.options.baseURL,headers:Q,timeout:12e3,...o.request})}getURL(t){return new URL(t,this.options.baseURL).toString()}_generateRequestId(){let t="";if(globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"){let n=new Uint8Array(21);return globalThis.crypto.getRandomValues(n),t+Array.from(n,s=>s.toString(16).padStart(2,"0")).join("")}if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return t+globalThis.crypto.randomUUID();let e=Date.now().toString(36),o=Math.random().toString(36).slice(2);return`${t}${e}-${o}`}send(t,e={}){let o=this._generateRequestId(),n=e.authentication??this.options.authentication,p=this.client.extend({headers:{...n.getHeaders(),"x-request-id":o}})(t,e).catch(async i=>{throw i instanceof pt?new w(i.response,i.request,{requestID:o,body:await i.response.text(),cause:i}):i});return{requestID:o,response:()=>p,json:async()=>(await p).json()}}};var j=class{constructor(t){this._transport=t}get(t,{include:e,request:o={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...o,method:"GET",searchParams:this._transport.query.build({include:e})})}list({filter:t,include:e,pagination:o,request:n={}}={}){return this._transport.send("v1/uploads",{...n,method:"GET",searchParams:this._transport.query.build({filter:t,include:e,pagination:o})})}create({files:t,include:e,request:o={}}){let n=new FormData;for(let s of t)n.append("file",s);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:e}),body:n})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};import{z as a}from"zod";var et=a.object({data:a.object({event:a.object({id:a.string(),type:a.string(),payload:a.record(a.string(),a.string()),createdAt:a.iso.datetime()})})});var V=class{constructor(t){this._transport=t}async event({key:t=process.env[z],maxSignatures:e=3,request:o}){let n=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+z);if(!n)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(n)?n.slice(0,e):[n]))throw new Error("Untrusted signature")}let{data:s}=et.parse(o.body);return{event:s.event}}async _verifySignature(t,e,o){let n=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);for(let s of o)if(await crypto.subtle.verify("HMAC",n,new TextEncoder().encode(atob(s)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var $=class{constructor(t){this._transport=t}get(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"GET"})}list({pagination:t,filter:e,request:o={}}={}){return this._transport.send("v1/webhooks/subscriptions",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,pagination:t})})}test(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t)+"/test",{...e,method:"POST"})}create({body:t,request:e={}}){return this._transport.send("v1/webhooks/subscriptions",{...e,method:"POST",json:t})}delete(t,{request:e={}}={}){return this._transport.send("v1/webhooks/subscriptions/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var Y=class r{static DEFAULT_BASE_URL=K;static PublicAuthentication=T;static BasicAuthentication=c;static BearerAuthentication=C;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationContext;conversationFeedback;escalation;label;import;integration;message;metadata;modelConfig;modelInterface;note;source;statistics;upload;webhook;webhookSubscription;constructor(t=new c,{baseURL:e,...o}={}){this._transport=new q({authentication:t,...o,baseURL:e?.toString()??r.getBaseURL()}),this.account=new u(this._transport),this.accountAccessToken=new l(this._transport),this.accountConversationSettings=new d(this._transport),this.accountNotificationEvent=new h(this._transport),this.action=new f(this._transport),this.boilerplateCategory=new A(this._transport),this.boilerplateContent=new E(this._transport),this.channel=new R(this._transport),this.channelConversationSettings=new _(this._transport),this.compositionSection=new g(this._transport),this.contact=new b(this._transport),this.conversation=new O(this._transport),this.conversationContext=new x(this._transport),this.conversationFeedback=new I(this._transport),this.escalation=new v(this._transport),this.label=new L(this._transport),this.import=new y(this._transport),this.integration={whatsapp:{account:new S(this._transport),phoneNumber:new U(this._transport),businessProfile:new D(this._transport),template:new P(this._transport)}},this.message=new G(this._transport),this.metadata=new N(this._transport),this.modelConfig=new k(this._transport),this.modelInterface=new W(this._transport),this.note=new F(this._transport),this.source=new M(this._transport),this.statistics=new B(this._transport),this.upload=new j(this._transport),this.webhook=new V(this._transport),this.webhookSubscription=new $(this._transport)}static getBaseURL(){return process.env[tt]??this.DEFAULT_BASE_URL}$request(t,e){return this._transport.send(t,e)}};var ot={};rt(ot,{SupportError:()=>w});var Hn=["ALCOHOL","APPAREL","AUTO","BEAUTY","EDU","ENTERTAIN","EVENT_PLAN","FINANCE","GOVT","GROCERY","HEALTH","HOTEL","NONPROFIT","ONLINE_GAMBLING","OTC_DRUGS","OTHER","PHYSICAL_GAMBLING","PROF_SERVICES","RESTAURANT","RETAIL","TRAVEL"];var Zn=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],tr=["af","sq","ar","ar_EG","ar_AE","ar_LB","ar_MA","ar_QA","az","be_BY","bn","bn_IN","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","prs_AF","nl","nl_BE","en","en_GB","en_US","en_AE","en_AU","en_CA","en_GH","en_IE","en_IN","en_JM","en_MY","en_NZ","en_QA","en_SG","en_UG","en_ZA","et","fil","fi","fr","fr_BE","fr_CA","fr_CH","fr_CI","fr_MA","ka","de","de_AT","de_CH","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","rw_RW","ko","ky_KG","lo","lv","lt","mk","ms","ml","mr","nb","ps_AF","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","si_LK","sk","sl","es","es_AR","es_CL","es_CO","es_CR","es_DO","es_EC","es_HN","es_MX","es_PA","es_PE","es_ES","es_UY","sw","sv","ta","te","th","th","tr","uk","ur","uz","vi","zu"],er=["AUTHENTICATION","MARKETING","UTILITY"],or=["ORDER_DETAILS","ORDER_STATUS"],nr=["E_COMMERCE","FINANCIAL_SERVICES"],rr=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],sr=["ACCOUNT_CREATION_CONFIRMATION","PAYMENT_DUE_REMINDER","FEEDBACK_SURVEY","PAYMENT_ACTION_REQUIRED","SHIPMENT_CONFIRMATION","PAYMENT_OVERDUE","DELIVERY_UPDATE","PAYMENT_CONFIRMATION","ORDER_DELAY","FRAUD_ALERT","DELIVERY_FAILED","AUTO_PAY_REMINDER","DELIVERY_CONFIRMATION","PAYMENT_SCHEDULED","ORDER_PICK_UP","PAYMENT_REJECT_FAIL","ORDER_ACTION_NEEDED","STATEMENT_AVAILABLE","ORDER_CONFIRMATION","LOW_BALANCE_WARNING","ORDER_OR_TRANSACTION_CANCEL","RECEIPT_ATTACHMENT","RETURN_CONFIRMATION","STATEMENT_ATTACHMENT","TRANSACTION_ALERT"],pr=["GREEN","YELLOW","RED","UNKNOWN"];var ls="0.32.0";export{Y as Client,K as DEFAULT_SUPPORT_BASE_URL,ot as Error,ls as SDK_VERSION,w as SupportError,Hn as WHATSAPP_BUSINESS_PROFILE_VERTICAL,er as WHATSAPP_TEMPLATE_CATEGORIES,nr as WHATSAPP_TEMPLATE_INDUSTRIES,tr as WHATSAPP_TEMPLATE_LANGUAGES,pr as WHATSAPP_TEMPLATE_QUALITY_SCORES,Zn as WHATSAPP_TEMPLATE_STATUSES,or as WHATSAPP_TEMPLATE_SUBCATEGORIES,rr as WHATSAPP_TEMPLATE_TOPICS,sr as WHATSAPP_TEMPLATE_USECASES,Y as default,et as eventWebhookSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",