@great-detail/support-sdk 0.28.1 → 0.30.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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var pt=Object.create;var Y=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty;var Z=(n,t)=>{for(var e in t)Y(n,e,{get:t[e],enumerable:!0})},tt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of at(t))!mt.call(n,r)&&r!==e&&Y(n,r,{get:()=>t[r],enumerable:!(o=it(t,r))||o.enumerable});return n};var ut=(n,t,e)=>(e=n!=null?pt(ct(n)):{},tt(t||!n||!n.__esModule?Y(e,"default",{value:n,enumerable:!0}):e,n)),lt=n=>tt(Y({},"__esModule",{value:!0}),n);var Ot={};Z(Ot,{Client:()=>l,DEFAULT_SUPPORT_BASE_URL:()=>K,Error:()=>X,SDK_VERSION:()=>gt,SupportError:()=>m,WHATSAPP_BUSINESS_PROFILE_VERTICAL:()=>dt,WHATSAPP_TEMPLATE_CATEGORIES:()=>Ct,WHATSAPP_TEMPLATE_INDUSTRIES:()=>At,WHATSAPP_TEMPLATE_LANGUAGES:()=>ht,WHATSAPP_TEMPLATE_QUALITY_SCORES:()=>_t,WHATSAPP_TEMPLATE_STATUSES:()=>ft,WHATSAPP_TEMPLATE_SUBCATEGORIES:()=>Tt,WHATSAPP_TEMPLATE_TOPICS:()=>Et,WHATSAPP_TEMPLATE_USECASES:()=>Rt,default:()=>l,eventWebhookSchema:()=>J});module.exports=lt(Ot);var K="https://api.support.greatdetail.com",et={"x-powered-by":"GDS/JavaScript"};var d=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 f=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:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}delete(t,e,{body:o,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,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 h=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 C=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})})}listByAccount(t,{filter:e,pagination:o,request:r={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}/notifications/events`,{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}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 T=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:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t})})}};var ot="SUPPORT_ACCESS_TOKEN",nt="SUPPORT_KEY_NAME",rt="SUPPORT_KEY_PASSWORD",Q="SUPPORT_SIGNING_KEY",st="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[nt],password:e=process.env[rt]}={}){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 A=class{#t;constructor({token:t=process.env[ot]}={}){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 E=class{getHeaders(){return{}}};var R=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:r={}}={}){return this._transport.send("v1/boilerplates/categories",{...r,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 _=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 g=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 O=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 b=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 I=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",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}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:r={}}={}){return this._transport.send("v1/contacts",{...r,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 x=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:r,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t,include:r})})}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 v=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 S=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 y=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 D=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 U=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 L=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 P=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}})})}};var G=class{constructor(t){this._transport=t}listByAccount(t,{search:e,status:o,quality:r,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:r,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 N=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:r={}}={}){return this._transport.send("v1/labels",{...r,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 W=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:r={}}={}){return this._transport.send("v1/messages",{...r,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 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 M=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 B=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 r=[];if(e){let s=Array.isArray(e)?e:[e];for(let p of s)r.push(["category",p])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var w=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"})}};var z=ut(require("ky"),1);var m=class extends Error{constructor(e,o,{requestID:r,body:s,...p}){super(`GDS(ERR): [${e.status}] ${o.method}:${e.url}${s?" - "+s:""}`,p);this.response=e;this.request=o;this.requestID=r}requestID};function u(n){return typeof n=="function"&&(n=n()),typeof n.toString=="function"?n.toString():typeof n=="string"?n:String(n)}var q=class n{static _filterExemptColumns=["filter"];static build({sort:t,pagination:e,filter:o,include:r,custom:s}){return[...Object.entries(o??{}).flatMap(([p,i])=>n._filterExemptColumns.includes(p)?[]:this.query(`filter[${p}]`,i)),...this.query("filter",o?.filter),...Object.entries(r??{}).flatMap(([p,i])=>i?this.query("include",p):[]),...Object.entries(t??{}).flatMap(([p,i])=>i===void 0?[]:this.query("sort",(i==="desc"?"-":"")+u(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 r of Array.isArray(e)?e:[e])o.push([t,u(r)]);return o}static paginationCursor({before:t,after:e,preferred:o="after"}={}){let r=[];if(t===void 0&&e===void 0)return r;let s=t?{dir:"before",value:u(t)}:void 0,p=e?{dir:"after",value:u(e)}:void 0,i=o==="after"?p||s:s||p;return i&&r.push([`page[${i.dir}]`,i.value]),r}};var H=class{client;options;query=q;constructor({baseURL:t,authentication:e,...o}){this.options={authentication:e,baseURL:t},this.client=z.default.create({prefixUrl:this.options.baseURL,headers:et,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 r=new Uint8Array(21);return globalThis.crypto.getRandomValues(r),t+Array.from(r,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(),r=e.authentication??this.options.authentication,p=this.client.extend({headers:{...r.getHeaders(),"x-request-id":o}})(t,e).catch(async i=>{throw i instanceof z.HTTPError?new m(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:r={}}={}){return this._transport.send("v1/uploads",{...r,method:"GET",searchParams:this._transport.query.build({filter:t,include:e,pagination:o})})}create({files:t,include:e,request:o={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:e}),body:r})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),J=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string(),a.z.string()),createdAt:a.z.iso.datetime()})})});var V=class{constructor(t){this._transport=t}async event({key:t=process.env[Q],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+Q);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:s}=J.parse(o.body);return{event:s.event}}async _verifySignature(t,e,o){let r=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",r,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 l=class n{static DEFAULT_BASE_URL=K;static PublicAuthentication=E;static BasicAuthentication=c;static BearerAuthentication=A;_transport;account;accountAccessToken;accountConversationSettings;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSettings;compositionSection;contact;conversation;conversationContext;conversationFeedback;escalation;label;import;integration;message;modelConfig;modelInterface;note;source;statistics;upload;webhook;webhookSubscription;constructor(t=new c,{baseURL:e,...o}={}){this._transport=new H({authentication:t,...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new d(this._transport),this.accountAccessToken=new f(this._transport),this.accountConversationSettings=new h(this._transport),this.accountNotificationEvent=new C(this._transport),this.action=new T(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new _(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new I(this._transport),this.conversation=new x(this._transport),this.conversationContext=new v(this._transport),this.conversationFeedback=new S(this._transport),this.escalation=new y(this._transport),this.label=new N(this._transport),this.import=new D(this._transport),this.integration={whatsapp:{account:new U(this._transport),phoneNumber:new P(this._transport),businessProfile:new L(this._transport),template:new G(this._transport)}},this.message=new W(this._transport),this.modelConfig=new k(this._transport),this.modelInterface=new M(this._transport),this.note=new F(this._transport),this.source=new B(this._transport),this.statistics=new w(this._transport),this.upload=new j(this._transport),this.webhook=new V(this._transport),this.webhookSubscription=new $(this._transport)}static getBaseURL(){return process.env[st]??this.DEFAULT_BASE_URL}$request(t,e){return this._transport.send(t,e)}};var X={};Z(X,{SupportError:()=>m});var dt=["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 ft=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],ht=["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"],Ct=["AUTHENTICATION","MARKETING","UTILITY"],Tt=["ORDER_DETAILS","ORDER_STATUS"],At=["E_COMMERCE","FINANCIAL_SERVICES"],Et=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],Rt=["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"],_t=["GREEN","YELLOW","RED","UNKNOWN"];var gt="0.28.1";0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SDK_VERSION,SupportError,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,eventWebhookSchema});
1
+ "use strict";var it=Object.create;var K=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var tt=(n,t)=>{for(var e in t)K(n,e,{get:t[e],enumerable:!0})},et=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ct(t))!ut.call(n,r)&&r!==e&&K(n,r,{get:()=>t[r],enumerable:!(o=at(t,r))||o.enumerable});return n};var lt=(n,t,e)=>(e=n!=null?it(mt(n)):{},et(t||!n||!n.__esModule?K(e,"default",{value:n,enumerable:!0}):e,n)),dt=n=>et(K({},"__esModule",{value:!0}),n);var bt={};tt(bt,{Client:()=>l,DEFAULT_SUPPORT_BASE_URL:()=>z,Error:()=>Z,SDK_VERSION:()=>Ot,SupportError:()=>m,WHATSAPP_BUSINESS_PROFILE_VERTICAL:()=>ht,WHATSAPP_TEMPLATE_CATEGORIES:()=>Tt,WHATSAPP_TEMPLATE_INDUSTRIES:()=>Et,WHATSAPP_TEMPLATE_LANGUAGES:()=>Ct,WHATSAPP_TEMPLATE_QUALITY_SCORES:()=>gt,WHATSAPP_TEMPLATE_STATUSES:()=>ft,WHATSAPP_TEMPLATE_SUBCATEGORIES:()=>At,WHATSAPP_TEMPLATE_TOPICS:()=>Rt,WHATSAPP_TEMPLATE_USECASES:()=>_t,default:()=>l,eventWebhookSchema:()=>X});module.exports=dt(bt);var z="https://api.support.greatdetail.com",ot={"x-powered-by":"GDS/JavaScript"};var d=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 h=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:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}delete(t,e,{body:o,request:r={}}={}){return this._transport.send("v1/accounts/"+encodeURIComponent(t)+"/access-tokens/"+encodeURIComponent(e),{...r,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 f=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 C=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 T=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:r={}}={}){return this._transport.send("v1/actions",{...r,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t})})}};var nt="SUPPORT_ACCESS_TOKEN",rt="SUPPORT_KEY_NAME",st="SUPPORT_KEY_PASSWORD",J="SUPPORT_SIGNING_KEY",pt="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[rt],password:e=process.env[st]}={}){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 A=class{#t;constructor({token:t=process.env[nt]}={}){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 E=class{getHeaders(){return{}}};var R=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:r={}}={}){return this._transport.send("v1/boilerplates/categories",{...r,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 _=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 g=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 O=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 b=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 x=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",r=e.format??(o==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}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:r={}}={}){return this._transport.send("v1/contacts",{...r,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 I=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:r,request:s={}}={}){return this._transport.send("v1/conversations",{...s,method:"GET",searchParams:this._transport.query.build({sort:e,pagination:o,filter:t,include:r})})}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 v=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 S=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 y=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 D=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 U=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 P=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 L=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 G=class{constructor(t){this._transport=t}listByAccount(t,{search:e,status:o,quality:r,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:r,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 N=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:r={}}={}){return this._transport.send("v1/labels",{...r,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 W=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:r={}}={}){return this._transport.send("v1/messages",{...r,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 k=class{constructor(t){this._transport=t}getVersion({request:t={}}={}){return this._transport.send("v1/metadata/version",{...t,method:"GET"})}};var M=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 F=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 B=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 w=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 r=[];if(e){let s=Array.isArray(e)?e:[e];for(let p of s)r.push(["category",p])}return t!==void 0&&r.push(["featured",String(t)]),this._transport.send("v1/sources",{...o,method:"GET",searchParams:r})}};var H=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"})}};var Q=lt(require("ky"),1);var m=class extends Error{constructor(e,o,{requestID:r,body:s,...p}){super(`GDS(ERR): [${e.status}] ${o.method}:${e.url}${s?" - "+s:""}`,p);this.response=e;this.request=o;this.requestID=r}requestID};function u(n){return typeof n=="function"&&(n=n()),typeof n.toString=="function"?n.toString():typeof n=="string"?n:String(n)}var q=class n{static _filterExemptColumns=["filter"];static build({sort:t,pagination:e,filter:o,include:r,custom:s}){return[...Object.entries(o??{}).flatMap(([p,i])=>n._filterExemptColumns.includes(p)?[]:this.query(`filter[${p}]`,i)),...this.query("filter",o?.filter),...Object.entries(r??{}).flatMap(([p,i])=>i?this.query("include",p):[]),...Object.entries(t??{}).flatMap(([p,i])=>i===void 0?[]:this.query("sort",(i==="desc"?"-":"")+u(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 r of Array.isArray(e)?e:[e])o.push([t,u(r)]);return o}static paginationCursor({before:t,after:e,preferred:o="after"}={}){let r=[];if(t===void 0&&e===void 0)return r;let s=t?{dir:"before",value:u(t)}:void 0,p=e?{dir:"after",value:u(e)}:void 0,i=o==="after"?p||s:s||p;return i&&r.push([`page[${i.dir}]`,i.value]),r}};var j=class{client;options;query=q;constructor({baseURL:t,authentication:e,...o}){this.options={authentication:e,baseURL:t},this.client=Q.default.create({prefixUrl:this.options.baseURL,headers:ot,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 r=new Uint8Array(21);return globalThis.crypto.getRandomValues(r),t+Array.from(r,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(),r=e.authentication??this.options.authentication,p=this.client.extend({headers:{...r.getHeaders(),"x-request-id":o}})(t,e).catch(async i=>{throw i instanceof Q.HTTPError?new m(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 V=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:r={}}={}){return this._transport.send("v1/uploads",{...r,method:"GET",searchParams:this._transport.query.build({filter:t,include:e,pagination:o})})}create({files:t,include:e,request:o={}}){let r=new FormData;for(let s of t)r.append("file",s);return this._transport.send("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:e}),body:r})}delete(t,{request:e={}}={}){return this._transport.send("v1/uploads/"+encodeURIComponent(t),{...e,method:"DELETE"})}};var a=require("zod"),X=a.z.object({data:a.z.object({event:a.z.object({id:a.z.string(),type:a.z.string(),payload:a.z.record(a.z.string(),a.z.string()),createdAt:a.z.iso.datetime()})})});var $=class{constructor(t){this._transport=t}async event({key:t=process.env[J],maxSignatures:e=3,request:o}){let r=o.headers["gds-signature"];if(t!==!1){if(t===void 0)throw new Error("Missing webhook signing key in process.env."+J);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(t,o.body,Array.isArray(r)?r.slice(0,e):[r]))throw new Error("Untrusted signature")}let{data:s}=X.parse(o.body);return{event:s.event}}async _verifySignature(t,e,o){let r=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",r,new TextEncoder().encode(atob(s)),new TextEncoder().encode(JSON.stringify(e))))return!0;return!1}};var Y=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 l=class n{static DEFAULT_BASE_URL=z;static PublicAuthentication=E;static BasicAuthentication=c;static BearerAuthentication=A;_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 j({authentication:t,...o,baseURL:e?.toString()??n.getBaseURL()}),this.account=new d(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSettings=new f(this._transport),this.accountNotificationEvent=new C(this._transport),this.action=new T(this._transport),this.boilerplateCategory=new R(this._transport),this.boilerplateContent=new _(this._transport),this.channel=new g(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new b(this._transport),this.contact=new x(this._transport),this.conversation=new I(this._transport),this.conversationContext=new v(this._transport),this.conversationFeedback=new S(this._transport),this.escalation=new y(this._transport),this.label=new N(this._transport),this.import=new D(this._transport),this.integration={whatsapp:{account:new U(this._transport),phoneNumber:new L(this._transport),businessProfile:new P(this._transport),template:new G(this._transport)}},this.message=new W(this._transport),this.metadata=new k(this._transport),this.modelConfig=new M(this._transport),this.modelInterface=new F(this._transport),this.note=new B(this._transport),this.source=new w(this._transport),this.statistics=new H(this._transport),this.upload=new V(this._transport),this.webhook=new $(this._transport),this.webhookSubscription=new Y(this._transport)}static getBaseURL(){return process.env[pt]??this.DEFAULT_BASE_URL}$request(t,e){return this._transport.send(t,e)}};var Z={};tt(Z,{SupportError:()=>m});var ht=["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 ft=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],Ct=["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"],Tt=["AUTHENTICATION","MARKETING","UTILITY"],At=["ORDER_DETAILS","ORDER_STATUS"],Et=["E_COMMERCE","FINANCIAL_SERVICES"],Rt=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],_t=["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"],gt=["GREEN","YELLOW","RED","UNKNOWN"];var Ot="0.30.0";0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,SDK_VERSION,SupportError,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,eventWebhookSchema});
package/dist/index.d.cts CHANGED
@@ -536,6 +536,7 @@ type Channel = {
536
536
  source: "whatsapp";
537
537
  whatsapp: {
538
538
  id: string;
539
+ whatsappAccount: string;
539
540
  whatsappPhoneNumber: string;
540
541
  };
541
542
  } | {
@@ -792,12 +793,6 @@ declare class AccountNotificationEventAPI {
792
793
  response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
793
794
  json: () => Promise<ListAccountNotificationEventsResponse>;
794
795
  };
795
- /** @deprecated will be removed in v0.29.0 */
796
- listByAccount(account: CurrentAccountID | AccountID, { filter, pagination, request, }?: ListAccountNotificationEventsOptions): {
797
- requestID: string;
798
- response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
799
- json: () => Promise<ListAccountNotificationEventsResponse>;
800
- };
801
796
  update(id: AccountNotificationEventID, { body, request }: UpdateAccountNotificationEventOptions): {
802
797
  requestID: string;
803
798
  response: () => Promise<ky.KyResponse<UpdateAccountNotificationEventResponse>>;
@@ -2925,6 +2920,24 @@ type ListWhatsappPhoneNumbersResponse = ResponseData<{
2925
2920
  whatsappPhoneNumber: WhatsappPhoneNumber;
2926
2921
  }[]>;
2927
2922
 
2923
+ /**
2924
+ * Great Detail Support System.
2925
+ *
2926
+ * @copyright 2025 Great Detail Ltd
2927
+ * @author Great Detail Ltd <info@greatdetail.com>
2928
+ * @author Dom Webber <dom.webber@greatdetail.com>
2929
+ * @see https://greatdetail.com
2930
+ */
2931
+
2932
+ type UpdateWhatsappPhoneNumberPayload = {
2933
+ displayName?: string;
2934
+ };
2935
+ interface UpdateWhatsappPhoneNumberOptions {
2936
+ body: UpdateWhatsappPhoneNumberPayload;
2937
+ request?: SendOptions;
2938
+ }
2939
+ type UpdateWhatsappPhoneNumberResponse = Record<string, unknown>;
2940
+
2928
2941
  declare class WhatsappPhoneNumberAPI {
2929
2942
  protected _transport: FetchTransport;
2930
2943
  constructor(_transport: FetchTransport);
@@ -2938,6 +2951,11 @@ declare class WhatsappPhoneNumberAPI {
2938
2951
  response: () => Promise<ky.KyResponse<ListWhatsappPhoneNumbersResponse>>;
2939
2952
  json: () => Promise<ListWhatsappPhoneNumbersResponse>;
2940
2953
  };
2954
+ update(id: string, { body, request }: UpdateWhatsappPhoneNumberOptions): {
2955
+ requestID: string;
2956
+ response: () => Promise<ky.KyResponse<UpdateWhatsappPhoneNumberResponse>>;
2957
+ json: () => Promise<UpdateWhatsappPhoneNumberResponse>;
2958
+ };
2941
2959
  }
2942
2960
 
2943
2961
  /**
@@ -3411,6 +3429,33 @@ declare class MessageAPI {
3411
3429
  };
3412
3430
  }
3413
3431
 
3432
+ /**
3433
+ * Great Detail Support System.
3434
+ *
3435
+ * @copyright 2025 Great Detail Ltd
3436
+ * @author Great Detail Ltd <info@greatdetail.com>
3437
+ * @author Dom Webber <dom.webber@greatdetail.com>
3438
+ * @see https://greatdetail.com
3439
+ */
3440
+
3441
+ interface GetMetadataVersionOptions {
3442
+ request?: SendOptions;
3443
+ }
3444
+ type GetMetadataVersionResponse = ResponseMeta<{
3445
+ epoch: string;
3446
+ version: string;
3447
+ }>;
3448
+
3449
+ declare class MetadataAPI {
3450
+ protected _transport: FetchTransport;
3451
+ constructor(_transport: FetchTransport);
3452
+ getVersion({ request }?: GetMetadataVersionOptions): {
3453
+ requestID: string;
3454
+ response: () => Promise<ky.KyResponse<GetMetadataVersionResponse>>;
3455
+ json: () => Promise<GetMetadataVersionResponse>;
3456
+ };
3457
+ }
3458
+
3414
3459
  /**
3415
3460
  * Great Detail Support System.
3416
3461
  *
@@ -4440,6 +4485,7 @@ declare class Client {
4440
4485
  };
4441
4486
  };
4442
4487
  message: MessageAPI;
4488
+ metadata: MetadataAPI;
4443
4489
  modelConfig: ModelConfigAPI;
4444
4490
  modelInterface: ModelInterfaceAPI;
4445
4491
  note: NoteAPI;
@@ -4513,6 +4559,6 @@ declare namespace index {
4513
4559
  }
4514
4560
 
4515
4561
  /** SDK Version */
4516
- declare const SDK_VERSION = "0.28.1";
4562
+ declare const SDK_VERSION = "0.30.0";
4517
4563
 
4518
- 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 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -536,6 +536,7 @@ type Channel = {
536
536
  source: "whatsapp";
537
537
  whatsapp: {
538
538
  id: string;
539
+ whatsappAccount: string;
539
540
  whatsappPhoneNumber: string;
540
541
  };
541
542
  } | {
@@ -792,12 +793,6 @@ declare class AccountNotificationEventAPI {
792
793
  response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
793
794
  json: () => Promise<ListAccountNotificationEventsResponse>;
794
795
  };
795
- /** @deprecated will be removed in v0.29.0 */
796
- listByAccount(account: CurrentAccountID | AccountID, { filter, pagination, request, }?: ListAccountNotificationEventsOptions): {
797
- requestID: string;
798
- response: () => Promise<ky.KyResponse<ListAccountNotificationEventsResponse>>;
799
- json: () => Promise<ListAccountNotificationEventsResponse>;
800
- };
801
796
  update(id: AccountNotificationEventID, { body, request }: UpdateAccountNotificationEventOptions): {
802
797
  requestID: string;
803
798
  response: () => Promise<ky.KyResponse<UpdateAccountNotificationEventResponse>>;
@@ -2925,6 +2920,24 @@ type ListWhatsappPhoneNumbersResponse = ResponseData<{
2925
2920
  whatsappPhoneNumber: WhatsappPhoneNumber;
2926
2921
  }[]>;
2927
2922
 
2923
+ /**
2924
+ * Great Detail Support System.
2925
+ *
2926
+ * @copyright 2025 Great Detail Ltd
2927
+ * @author Great Detail Ltd <info@greatdetail.com>
2928
+ * @author Dom Webber <dom.webber@greatdetail.com>
2929
+ * @see https://greatdetail.com
2930
+ */
2931
+
2932
+ type UpdateWhatsappPhoneNumberPayload = {
2933
+ displayName?: string;
2934
+ };
2935
+ interface UpdateWhatsappPhoneNumberOptions {
2936
+ body: UpdateWhatsappPhoneNumberPayload;
2937
+ request?: SendOptions;
2938
+ }
2939
+ type UpdateWhatsappPhoneNumberResponse = Record<string, unknown>;
2940
+
2928
2941
  declare class WhatsappPhoneNumberAPI {
2929
2942
  protected _transport: FetchTransport;
2930
2943
  constructor(_transport: FetchTransport);
@@ -2938,6 +2951,11 @@ declare class WhatsappPhoneNumberAPI {
2938
2951
  response: () => Promise<ky.KyResponse<ListWhatsappPhoneNumbersResponse>>;
2939
2952
  json: () => Promise<ListWhatsappPhoneNumbersResponse>;
2940
2953
  };
2954
+ update(id: string, { body, request }: UpdateWhatsappPhoneNumberOptions): {
2955
+ requestID: string;
2956
+ response: () => Promise<ky.KyResponse<UpdateWhatsappPhoneNumberResponse>>;
2957
+ json: () => Promise<UpdateWhatsappPhoneNumberResponse>;
2958
+ };
2941
2959
  }
2942
2960
 
2943
2961
  /**
@@ -3411,6 +3429,33 @@ declare class MessageAPI {
3411
3429
  };
3412
3430
  }
3413
3431
 
3432
+ /**
3433
+ * Great Detail Support System.
3434
+ *
3435
+ * @copyright 2025 Great Detail Ltd
3436
+ * @author Great Detail Ltd <info@greatdetail.com>
3437
+ * @author Dom Webber <dom.webber@greatdetail.com>
3438
+ * @see https://greatdetail.com
3439
+ */
3440
+
3441
+ interface GetMetadataVersionOptions {
3442
+ request?: SendOptions;
3443
+ }
3444
+ type GetMetadataVersionResponse = ResponseMeta<{
3445
+ epoch: string;
3446
+ version: string;
3447
+ }>;
3448
+
3449
+ declare class MetadataAPI {
3450
+ protected _transport: FetchTransport;
3451
+ constructor(_transport: FetchTransport);
3452
+ getVersion({ request }?: GetMetadataVersionOptions): {
3453
+ requestID: string;
3454
+ response: () => Promise<ky.KyResponse<GetMetadataVersionResponse>>;
3455
+ json: () => Promise<GetMetadataVersionResponse>;
3456
+ };
3457
+ }
3458
+
3414
3459
  /**
3415
3460
  * Great Detail Support System.
3416
3461
  *
@@ -4440,6 +4485,7 @@ declare class Client {
4440
4485
  };
4441
4486
  };
4442
4487
  message: MessageAPI;
4488
+ metadata: MetadataAPI;
4443
4489
  modelConfig: ModelConfigAPI;
4444
4490
  modelInterface: ModelInterfaceAPI;
4445
4491
  note: NoteAPI;
@@ -4513,6 +4559,6 @@ declare namespace index {
4513
4559
  }
4514
4560
 
4515
4561
  /** SDK Version */
4516
- declare const SDK_VERSION = "0.28.1";
4562
+ declare const SDK_VERSION = "0.30.0";
4517
4563
 
4518
- 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 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 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 };
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 };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var ot=Object.defineProperty;var nt=(r,t)=>{for(var e in t)ot(r,e,{get:t[e],enumerable:!0})};var Y="https://api.support.greatdetail.com",z={"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 f=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})})}listByAccount(t,{filter:e,pagination:o,request:n={}}={}){return this._transport.send(`v1/accounts/${encodeURIComponent(t)}/notifications/events`,{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e})})}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 h=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 Q="SUPPORT_ACCESS_TOKEN",J="SUPPORT_KEY_NAME",X="SUPPORT_KEY_PASSWORD",K="SUPPORT_SIGNING_KEY",Z="SUPPORT_BASE_URL";var c=class{name;#t;constructor({name:t=process.env[J],password:e=process.env[X]}={}){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[Q]}={}){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 I=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 x=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}})})}};var L=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 P=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}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 k=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 F=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 rt,{HTTPError as st}from"ky";var B=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 w=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=w;constructor({baseURL:t,authentication:e,...o}){this.options={authentication:e,baseURL:t},this.client=rt.create({prefixUrl:this.options.baseURL,headers:z,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 st?new B(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 H=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 tt=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 j=class{constructor(t){this._transport=t}async event({key:t=process.env[K],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."+K);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}=tt.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 V=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 $=class r{static DEFAULT_BASE_URL=Y;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;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 f(this._transport),this.action=new h(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 I(this._transport),this.conversationFeedback=new x(this._transport),this.escalation=new v(this._transport),this.label=new P(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 L(this._transport)}},this.message=new G(this._transport),this.modelConfig=new N(this._transport),this.modelInterface=new W(this._transport),this.note=new k(this._transport),this.source=new M(this._transport),this.statistics=new F(this._transport),this.upload=new H(this._transport),this.webhook=new j(this._transport),this.webhookSubscription=new V(this._transport)}static getBaseURL(){return process.env[Z]??this.DEFAULT_BASE_URL}$request(t,e){return this._transport.send(t,e)}};var et={};nt(et,{SupportError:()=>B});var Fn=["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"],Qn=["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"],Jn=["AUTHENTICATION","MARKETING","UTILITY"],Xn=["ORDER_DETAILS","ORDER_STATUS"],Zn=["E_COMMERCE","FINANCIAL_SERVICES"],tr=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],er=["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"],or=["GREEN","YELLOW","RED","UNKNOWN"];var ps="0.28.1";export{$ as Client,Y as DEFAULT_SUPPORT_BASE_URL,et as Error,ps as SDK_VERSION,B as SupportError,Fn as WHATSAPP_BUSINESS_PROFILE_VERTICAL,Jn as WHATSAPP_TEMPLATE_CATEGORIES,Zn as WHATSAPP_TEMPLATE_INDUSTRIES,Qn as WHATSAPP_TEMPLATE_LANGUAGES,or as WHATSAPP_TEMPLATE_QUALITY_SCORES,zn as WHATSAPP_TEMPLATE_STATUSES,Xn as WHATSAPP_TEMPLATE_SUBCATEGORIES,tr as WHATSAPP_TEMPLATE_TOPICS,er as WHATSAPP_TEMPLATE_USECASES,$ as default,tt 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 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.30.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.28.1",
3
+ "version": "0.30.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>",