meta-cloud-api 0.2.44 → 1.0.1
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/README.md +180 -64
- package/dist/{BusinessProfileApi-DE7Nnuy_.d.ts → BusinessProfileApi-WXscSgo-.d.ts} +4 -3
- package/dist/{EncryptionApi-PHxeI2G_.d.ts → EncryptionApi-D7pt-OXT.d.ts} +3 -2
- package/dist/FlowApi-UAvzhJfV.d.ts +136 -0
- package/dist/{MediaApi-B2vtjiCm.d.ts → MediaApi-BrEKpqi_.d.ts} +3 -2
- package/dist/{MessageApi-ptFlWg3O.d.ts → MessageApi-Circorzz.d.ts} +4 -3
- package/dist/{PhoneNumberApi-DMb_G3uw.d.ts → PhoneNumberApi-DKlu9PHl.d.ts} +4 -3
- package/dist/{QrCodeApi-D3rVKuxV.d.ts → QrCodeApi-7vDwIBHR.d.ts} +3 -2
- package/dist/{RegistrationApi-DZBJWAZS.d.ts → RegistrationApi-qO_qoti9.d.ts} +4 -3
- package/dist/{TemplateApi-BFeM9qJS.d.ts → TemplateApi-xGgIZt89.d.ts} +5 -4
- package/dist/{TwoStepVerificationApi-6jV5pDxS.d.ts → TwoStepVerificationApi-DfNPIz-C.d.ts} +3 -2
- package/dist/{WabaApi-B8Gv2UNE.d.ts → WabaApi-DqQi_68m.d.ts} +3 -2
- package/dist/{WebhookHandler-Bxxi6SdT.d.ts → WebhookProcessor-ByAe7Kf_.d.ts} +22 -32
- package/dist/WhatsApp-BIBtT-y9.d.ts +82 -0
- package/dist/api/encryption/index.d.ts +10 -0
- package/dist/api/encryption/index.js +2 -0
- package/dist/api/flow/index.d.ts +10 -0
- package/dist/api/flow/index.js +2 -0
- package/dist/api/index.d.ts +16 -0
- package/dist/api/index.js +2 -0
- package/dist/api/media/index.d.ts +10 -0
- package/dist/api/media/index.js +2 -0
- package/dist/{features → api}/messages/index.d.ts +6 -5
- package/dist/api/messages/index.js +2 -0
- package/dist/{features → api}/phone/index.d.ts +6 -5
- package/dist/api/phone/index.js +2 -0
- package/dist/{features → api}/profile/index.d.ts +6 -5
- package/dist/api/profile/index.js +2 -0
- package/dist/api/qrCode/index.d.ts +10 -0
- package/dist/api/qrCode/index.js +2 -0
- package/dist/api/registration/index.d.ts +10 -0
- package/dist/api/registration/index.js +2 -0
- package/dist/{features → api}/template/index.d.ts +6 -5
- package/dist/api/template/index.js +2 -0
- package/dist/api/twoStepVerification/index.d.ts +10 -0
- package/dist/api/twoStepVerification/index.js +2 -0
- package/dist/api/waba/index.d.ts +10 -0
- package/dist/api/waba/index.js +2 -0
- package/dist/api/waba/index.js.map +1 -0
- package/dist/base-CdGDdVEl.d.ts +18 -0
- package/dist/{chunk-2NJVBJUN.js → chunk-7QBIZCJ4.js} +2 -2
- package/dist/chunk-7QBIZCJ4.js.map +1 -0
- package/dist/chunk-AMHQGG6Z.js +2 -0
- package/dist/{chunk-4C666HHU.js.map → chunk-AMHQGG6Z.js.map} +1 -1
- package/dist/chunk-B7DCL6I7.js +10 -0
- package/dist/chunk-B7DCL6I7.js.map +1 -0
- package/dist/{chunk-7GL74SXM.js → chunk-CRZ7EUYR.js} +2 -2
- package/dist/chunk-CRZ7EUYR.js.map +1 -0
- package/dist/chunk-FKXSL2JK.js +3 -0
- package/dist/chunk-FKXSL2JK.js.map +1 -0
- package/dist/chunk-FSKBLPGE.js +2 -0
- package/dist/chunk-FSKBLPGE.js.map +1 -0
- package/dist/chunk-HJGN3PO4.js +3 -0
- package/dist/chunk-HJGN3PO4.js.map +1 -0
- package/dist/{chunk-7NQLQPLH.js → chunk-IYSR44P6.js} +2 -2
- package/dist/chunk-IYSR44P6.js.map +1 -0
- package/dist/chunk-JC6YMVID.js +2 -0
- package/dist/chunk-JC6YMVID.js.map +1 -0
- package/dist/{chunk-GT3XQN7Y.js → chunk-JPAV644F.js} +2 -2
- package/dist/chunk-JPAV644F.js.map +1 -0
- package/dist/{chunk-XPPDOFBN.js → chunk-JXCLRKQ7.js} +2 -2
- package/dist/chunk-JXCLRKQ7.js.map +1 -0
- package/dist/chunk-KMAH6636.js +2 -0
- package/dist/chunk-KMAH6636.js.map +1 -0
- package/dist/{chunk-5JGM556C.js → chunk-L4ESAO2S.js} +2 -2
- package/dist/chunk-L4ESAO2S.js.map +1 -0
- package/dist/chunk-LV3TULSI.js +2 -0
- package/dist/chunk-LV3TULSI.js.map +1 -0
- package/dist/{chunk-BZ5QDXNR.js → chunk-MJEG3K4V.js} +2 -2
- package/dist/chunk-MJEG3K4V.js.map +1 -0
- package/dist/chunk-NLF2JGYY.js +2 -0
- package/dist/chunk-NLF2JGYY.js.map +1 -0
- package/dist/chunk-OA2SW4AF.js +2 -0
- package/dist/chunk-OA2SW4AF.js.map +1 -0
- package/dist/chunk-PHPQ5HP3.js +2 -0
- package/dist/chunk-PHPQ5HP3.js.map +1 -0
- package/dist/chunk-RIL6QABY.js +2 -0
- package/dist/chunk-RIL6QABY.js.map +1 -0
- package/dist/chunk-RWCVPWRC.js +2 -0
- package/dist/chunk-RWCVPWRC.js.map +1 -0
- package/dist/chunk-SNNRWNGZ.js +2 -0
- package/dist/chunk-SNNRWNGZ.js.map +1 -0
- package/dist/chunk-UCBYECNQ.js +2 -0
- package/dist/chunk-UCBYECNQ.js.map +1 -0
- package/dist/chunk-VHAODWCN.js +2 -0
- package/dist/chunk-VHAODWCN.js.map +1 -0
- package/dist/chunk-WGGN32O2.js +2 -0
- package/dist/chunk-WGGN32O2.js.map +1 -0
- package/dist/{FlowApi-CASVC-Al.d.ts → common-DDXsNyLF.d.ts} +2 -133
- package/dist/core/webhook/frameworks/express.d.ts +48 -0
- package/dist/core/webhook/frameworks/express.js +2 -0
- package/dist/core/webhook/frameworks/express.js.map +1 -0
- package/dist/core/webhook/frameworks/nextjs.d.ts +44 -0
- package/dist/core/webhook/frameworks/nextjs.js +2 -0
- package/dist/core/webhook/frameworks/nextjs.js.map +1 -0
- package/dist/core/webhook/index.d.ts +21 -16
- package/dist/core/webhook/index.js +1 -1
- package/dist/core/whatsapp/index.d.ts +39 -15
- package/dist/core/whatsapp/index.js +1 -1
- package/dist/{enums-DvwSJq9w.d.ts → enums-BZd9T2ul.d.ts} +1 -1
- package/dist/httpsClient-v4gmltzS.d.ts +19 -0
- package/dist/index.d.ts +21 -82
- package/dist/index.js +1 -1
- package/dist/logger-BdE0Vyim.d.ts +9 -0
- package/dist/{base-BhCbbsxB.d.ts → request-vYMaEfk5.d.ts} +2 -16
- package/dist/{shared/types → types}/config.d.ts +1 -1
- package/dist/types/enums.d.ts +1 -0
- package/dist/{shared/types → types}/enums.js +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +98 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +91 -34
- package/dist/chunk-2NJVBJUN.js.map +0 -1
- package/dist/chunk-3MO3BTBC.js +0 -2
- package/dist/chunk-3MO3BTBC.js.map +0 -1
- package/dist/chunk-4C666HHU.js +0 -2
- package/dist/chunk-4O3T25CT.js +0 -2
- package/dist/chunk-4O3T25CT.js.map +0 -1
- package/dist/chunk-5JGM556C.js.map +0 -1
- package/dist/chunk-5O5GLWIE.js +0 -3
- package/dist/chunk-5O5GLWIE.js.map +0 -1
- package/dist/chunk-7GL74SXM.js.map +0 -1
- package/dist/chunk-7NQLQPLH.js.map +0 -1
- package/dist/chunk-BZ5QDXNR.js.map +0 -1
- package/dist/chunk-CNGQISKS.js +0 -2
- package/dist/chunk-CNGQISKS.js.map +0 -1
- package/dist/chunk-GIQLIMOD.js +0 -2
- package/dist/chunk-GIQLIMOD.js.map +0 -1
- package/dist/chunk-GT3XQN7Y.js.map +0 -1
- package/dist/chunk-I222VSWK.js +0 -2
- package/dist/chunk-I222VSWK.js.map +0 -1
- package/dist/chunk-JGX3AVD7.js +0 -3
- package/dist/chunk-JGX3AVD7.js.map +0 -1
- package/dist/chunk-KFPOVYEJ.js +0 -2
- package/dist/chunk-KFPOVYEJ.js.map +0 -1
- package/dist/chunk-LGLRGXCE.js +0 -2
- package/dist/chunk-LGLRGXCE.js.map +0 -1
- package/dist/chunk-O2OTHNWM.js +0 -2
- package/dist/chunk-O2OTHNWM.js.map +0 -1
- package/dist/chunk-R36L2XYO.js +0 -2
- package/dist/chunk-R36L2XYO.js.map +0 -1
- package/dist/chunk-UQPD6GIF.js +0 -2
- package/dist/chunk-UQPD6GIF.js.map +0 -1
- package/dist/chunk-VW3LGHTJ.js +0 -2
- package/dist/chunk-VW3LGHTJ.js.map +0 -1
- package/dist/chunk-XPPDOFBN.js.map +0 -1
- package/dist/features/encryption/index.d.ts +0 -9
- package/dist/features/encryption/index.js +0 -2
- package/dist/features/flow/index.d.ts +0 -9
- package/dist/features/flow/index.js +0 -2
- package/dist/features/media/index.d.ts +0 -9
- package/dist/features/media/index.js +0 -2
- package/dist/features/messages/index.js +0 -2
- package/dist/features/phone/index.js +0 -2
- package/dist/features/profile/index.js +0 -2
- package/dist/features/qrCode/index.d.ts +0 -9
- package/dist/features/qrCode/index.js +0 -2
- package/dist/features/registration/index.d.ts +0 -9
- package/dist/features/registration/index.js +0 -2
- package/dist/features/template/index.js +0 -2
- package/dist/features/twoStepVerification/index.d.ts +0 -9
- package/dist/features/twoStepVerification/index.js +0 -2
- package/dist/features/waba/index.d.ts +0 -9
- package/dist/features/waba/index.js +0 -2
- package/dist/index-DiCI1vEz.d.ts +0 -100
- package/dist/shared/types/enums.d.ts +0 -1
- package/dist/shared/utils/isMetaError.d.ts +0 -21
- package/dist/shared/utils/isMetaError.js +0 -2
- package/dist/shared/utils/isMetaError.js.map +0 -1
- /package/dist/{features → api}/encryption/index.js.map +0 -0
- /package/dist/{features → api}/flow/index.js.map +0 -0
- /package/dist/{features/media → api}/index.js.map +0 -0
- /package/dist/{features/messages → api/media}/index.js.map +0 -0
- /package/dist/{features/phone → api/messages}/index.js.map +0 -0
- /package/dist/{features/profile → api/phone}/index.js.map +0 -0
- /package/dist/{features/qrCode → api/profile}/index.js.map +0 -0
- /package/dist/{features/registration → api/qrCode}/index.js.map +0 -0
- /package/dist/{features/template → api/registration}/index.js.map +0 -0
- /package/dist/{features/twoStepVerification → api/template}/index.js.map +0 -0
- /package/dist/{features/waba → api/twoStepVerification}/index.js.map +0 -0
- /package/dist/{shared/types → types}/config.js +0 -0
- /package/dist/{shared/types → types}/config.js.map +0 -0
- /package/dist/{shared/types → types}/enums.js.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/webhook/frameworks/nextjs.ts"],"names":["webhookHandler","config","processor","WebhookProcessor","req","res","mode","token","challenge","result","key","value","fullUrl","constructFullUrl","webRequest","error"],"mappings":"sCA0BO,SAASA,CAAAA,CACZC,GAAAA,CACF,CACE,IAAMC,GAAAA,CAAY,IAAIC,CAAAA,CAAiBF,GAAM,CAAA,CAE7C,OAAO,CAEH,OAAA,CAAS,MAAOG,CAAAA,CAAeC,CAAAA,GAAmB,CAC9C,GAAI,CACA,GAAID,CAAAA,CAAI,MAAA,GAAW,KAAA,CAAO,CACtB,GAAM,CAAE,UAAA,CAAYE,CAAAA,CAAM,kBAAA,CAAoBC,EAAO,eAAA,CAAiBC,CAAU,CAAA,CAAIJ,CAAAA,CAAI,KAAA,CAElFK,CAAAA,CAAS,MAAMP,GAAAA,CAAU,mBAAA,CAC1BI,CAAAA,EAAmB,IAAA,CACnBC,CAAAA,EAAoB,IAAA,CACpBC,CAAAA,EAAwB,IAC7B,CAAA,CAEA,cAAO,OAAA,CAAQC,CAAAA,CAAO,OAAO,CAAA,CAAE,OAAA,CAAQ,CAAC,CAACC,CAAAA,CAAKC,CAAK,CAAA,GAAM,CACrDN,CAAAA,CAAI,SAAA,CAAUK,CAAAA,CAAKC,CAAK,EAC5B,CAAC,CAAA,CAEMN,CAAAA,CAAI,MAAA,CAAOI,CAAAA,CAAO,MAAM,CAAA,CAAE,IAAA,CAAKA,CAAAA,CAAO,IAAI,CACrD,CAEA,G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R,CAAAA,CAAI,MAAA,CACZ,OAAA,CAASA,CAAAA,CAAI,QACb,IAAA,CAAMA,CAAAA,CAAI,MAAA,GAAW,MAAA,CAAS,IAAA,CAAK,SAAA,CAAUA,CAAAA,CAAI,IAAI,CAAA,CAAI,KAAA,CAC7D,CAAC,CAAA,CAEKK,CAAAA,CAAS,MAAMP,GAAAA,CAAU,WAAA,CAAYY,CAAU,CAAA,CAErD,OAAA,MAAA,CAAO,OAAA,CAAQL,CAAAA,CAAO,OAAO,CAAA,CAAE,OAAA,CAAQ,CAAC,CAACC,CAAAA,CAAKC,CAAK,CAAA,GAAM,CACrDN,CAAAA,CAAI,SAAA,CAAUK,CAAAA,CAAKC,CAAK,EAC5B,CAAC,CAAA,CAEMN,CAAAA,CAAI,MAAA,CAAOI,CAAAA,CAAO,MAAM,CAAA,CAAE,IAAA,CAAKA,CAAAA,CAAO,IAAI,CACrD,CAAA,MAASM,CAAAA,CAAO,CACZ,OAAA,OAAA,CAAQ,MAAM,aAAA,CAAeA,CAAK,CAAA,CAC3BV,CAAAA,CAAI,MAAA,CAAO,GAAG,CAAA,CAAE,IAAA,CAAK,CAAE,KAAA,CAAO,uBAAwB,CAAC,CAClE,CACJ,CAAA,CAGA,SAAA,CAAAH,GACJ,CACJ","file":"chunk-UCBYECNQ.js","sourcesContent":["import { WhatsAppConfig } from '../../../types/config';\nimport { WebhookProcessor } from '../WebhookProcessor';\nimport { constructFullUrl } from '../utils/webhookUtils';\n\n// Generic interfaces for better type compatibility\nexport interface BaseApiRequest {\n method?: string;\n url?: string;\n headers: Record<string, string | string[] | undefined>;\n body?: any;\n query: Partial<Record<string, string | string[]>>;\n rawBody?: any;\n}\n\nexport interface BaseApiResponse {\n status(code: number): any;\n json(data: any): void | any;\n send(data?: any): void | any;\n setHeader(name: string, value: string): void;\n}\n\nexport interface NextJsWebhookConfig extends WhatsAppConfig {\n // Next.js specific config can be added here\n}\n\n// Generic webhook handler that accepts any compatible request/response types\nexport function webhookHandler<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(\n config: NextJsWebhookConfig,\n) {\n const processor = new WebhookProcessor(config);\n\n return {\n // Main webhook handler\n webhook: async (req: TRequest, res: TResponse) => {\n try {\n if (req.method === 'GET') {\n const { 'hub.mode': mode, 'hub.verify_token': token, 'hub.challenge': challenge } = req.query;\n\n const result = await processor.processVerification(\n (mode as string) || null,\n (token as string) || null,\n (challenge as string) || null,\n );\n\n Object.entries(result.headers).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n\n return res.status(result.status).send(result.body);\n }\n\n if (req.method === 'POST') {\n // Create Web Standard Request from Next.js request\n const fullUrl = constructFullUrl(req.headers, req.url);\n\n const webRequest = new Request(fullUrl, {\n method: req.method,\n headers: req.headers as HeadersInit,\n body: JSON.stringify(req.body),\n });\n\n const result = await processor.processWebhook(webRequest);\n\n Object.entries(result.headers).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n\n return res.status(result.status).send(result.body);\n }\n\n return res.status(405).json({ error: 'Method Not Allowed' });\n } catch (error) {\n console.error('Webhook error:', error);\n return res.status(500).json({ error: 'Internal Server Error' });\n }\n },\n\n // Flow handler\n flow: async (req: TRequest, res: TResponse) => {\n try {\n const fullUrl = constructFullUrl(req.headers, req.url);\n\n const webRequest = new Request(fullUrl, {\n method: req.method,\n headers: req.headers as HeadersInit,\n body: req.method === 'POST' ? JSON.stringify(req.body) : undefined,\n });\n\n const result = await processor.processFlow(webRequest);\n\n Object.entries(result.headers).forEach(([key, value]) => {\n res.setHeader(key, value);\n });\n\n return res.status(result.status).send(result.body);\n } catch (error) {\n console.error('Flow error:', error);\n return res.status(500).json({ error: 'Internal Server Error' });\n }\n },\n\n // Expose processor for handler registration\n processor,\n };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-MJEG3K4V.js';import {a}from'./chunk-RIL6QABY.js';var p=class extends a{endpoint="message_templates";constructor(t,a){super(t,a);}async getTemplate(t){return this.sendJson("GET",`${t}`,this.config.REQUEST_TIMEOUT,null)}async updateTemplate(t,a){return this.sendJson("POST",`${t}`,this.config.REQUEST_TIMEOUT,JSON.stringify(a))}async getTemplates(t){return this.sendJson("GET",`${this.config.WA_BUSINESS_ACCOUNT_ID}/${this.endpoint}${a$1(t??{})}`,this.config.REQUEST_TIMEOUT,null)}async createTemplate(t){return this.sendJson("POST",`${this.config.WA_BUSINESS_ACCOUNT_ID}/${this.endpoint}`,this.config.REQUEST_TIMEOUT,JSON.stringify(t))}async deleteTemplate(t){return this.sendJson("DELETE",`${this.config.WA_BUSINESS_ACCOUNT_ID}/${this.endpoint}${a$1(t)}`,this.config.REQUEST_TIMEOUT,null)}};function o(e){let t={type:"HEADER",format:e.format};return e.text&&(t.text=e.text),e.example&&(t.example=e.example),t}function n(e){let t={type:"BODY",text:e.text};return e.example&&(t.example=e.example),t}function m(e){return {type:"FOOTER",text:e.text}}function i(e){let t=[];if(e.phone_number&&t.push({type:"PHONE_NUMBER",text:e.phone_number.text,phone_number:e.phone_number.phone_number}),e.url){let a={type:"URL",text:e.url.text,url:e.url.url};e.url.example&&(a.example=[e.url.example]),t.push(a);}if(e.quick_reply&&e.quick_reply.forEach(a=>{t.push({type:"QUICK_REPLY",text:a.text});}),e.copy_code&&t.push({type:"COPY_CODE",example:e.copy_code.example}),e.flow){let a={type:"FLOW",text:e.flow.text};e.flow.flow_id&&(a.flow_id=e.flow.flow_id),e.flow.flow_name&&(a.flow_name=e.flow.flow_name),e.flow.flow_json&&(a.flow_json=e.flow.flow_json),e.flow.flow_action&&(a.flow_action=e.flow.flow_action),e.flow.navigate_screen&&(a.navigate_screen=e.flow.navigate_screen),t.push(a);}return e.mpm&&t.push({type:"MPM"}),e.otp&&t.push({type:"OTP"}),e.spm&&t.push({type:"SPM"}),t.length>0?[{type:"BUTTONS",buttons:t}]:[]}function f(e){return e.map(t=>{switch(t.type){case "text":return t.value;case "currency":return t.fallback_value;case "date_time":return t.fallback_value;case "image":case "video":case "document":return t.handle||t.link||"";case "location":return t.name||"";case "product":return t.product_retailer_id;default:return ""}})}function T(e){let t=[];if(e.header&&t.push(o(e.header)),e.body&&t.push(n(e.body)),e.footer&&t.push(m(e.footer)),e.buttons&&t.push(...i(e.buttons)),e.carousel){let a=[];e.carousel.cards.forEach((r,s)=>{if(r.image||r.video||r.product){let u=r.image?"IMAGE":r.video?"VIDEO":"DOCUMENT",d=r.image||r.video||r.product||"";a.push({type:"HEADER",format:u,example:{header_handle:[d]}});}r.body&&a.push({type:"BODY",text:r.body,example:r.bodyParameters?{body_text:[f(r.bodyParameters)]}:void 0}),r.buttons&&a.push(...i(r.buttons));}),t.push(...a);}return e.limitedTimeOffer&&t.push({type:"LIMITED_TIME_OFFER",limited_time_offer:{expiration_time_ms:e.limitedTimeOffer.expiration_time_ms}}),{name:e.name,language:e.language,category:e.category,components:t.length>0?t:void 0}}function y(e){let t=[],a="*{{1}}* is your verification code.";return e.add_security_recommendation&&(a+=" For your security, do not share this code."),e.code_expiration_minutes&&(a+=` This code expires in ${e.code_expiration_minutes} minutes.`),t.push({type:"BODY",text:a,example:{body_text:[["123456"]]}}),t.push({type:"BUTTONS",buttons:[{type:"OTP"}]}),{name:e.name,language:e.language,category:"AUTHENTICATION",components:t}}function h(e){let t=[],a="Your security code is *{{1}}*.";return e.add_security_recommendation&&(a+=" Do not share this code with anyone."),e.code_expiration_minutes&&(a+=` This code expires in ${e.code_expiration_minutes} minutes.`),t.push({type:"BODY",text:a,example:{body_text:[["ABCD1234"]]}}),e.copy_code_button&&t.push({type:"BUTTONS",buttons:[{type:"COPY_CODE",example:"ABCD1234"}]}),{name:e.name,language:e.language,category:"AUTHENTICATION",components:t}}function g(e){let t=[];return e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer)),t.push({type:"BUTTONS",buttons:[{type:"CATALOG",action:{thumbnail_product_retailer_id:e.thumbnail_product_retailer_id}}]}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function _(e){let t=[];return e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer)),t.push({type:"BUTTONS",buttons:[{type:"COPY_CODE",example:e.coupon_code}]}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function x(e){let t=[];return t.push({type:"LIMITED_TIME_OFFER",limited_time_offer:{expiration_time_ms:e.expiration_time_ms}}),e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer)),{name:e.name,language:e.language,category:"MARKETING",components:t}}function C(e){let t=[],a=[];return e.cards.forEach((r,s)=>{let u=[];u.push({type:"HEADER",format:r.header.format,example:r.header.example}),u.push(n(r.body)),r.buttons&&u.push(...i(r.buttons)),a.push({card_index:s,components:u});}),t.push({type:"CAROUSEL",cards:a}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function O(e){let t=[];return e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer)),t.push({type:"BUTTONS",buttons:[{type:"MPM",action:{thumbnail_product_retailer_id:e.thumbnail_product_retailer_id,sections:e.sections}}]}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function P(e){let t=[];e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer));let a=e.cards.map((r,s)=>({card_index:s,components:[{type:"HEADER",format:"PRODUCT",example:{header_handle:[r.product_retailer_id]}}]}));return t.push({type:"CAROUSEL",cards:a}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function B(e){let t=[];return e.header&&t.push(o({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer)),t.push({type:"BUTTONS",buttons:[{type:"SPM",action:{product_retailer_id:e.product_retailer_id}}]}),{name:e.name,language:e.language,category:"MARKETING",components:t}}export{p as a,T as b,y as c,h as d,g as e,_ as f,x as g,C as h,O as i,P as j,B as k};//# sourceMappingURL=chunk-VHAODWCN.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-VHAODWCN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/template/TemplateApi.ts","../src/api/template/factories/index.ts"],"names":["TemplateApi","BaseAPI","config","client","templateId","template","params","objectToQueryString","createHeader","options","header","createBody","body","createFooter","createButtons","buttons","urlButton","qr","flowButton","formatParameterExamples","parameters","param","createTemplate","components","carouselComponents","card","index","format","handle","createOTPTemplate","bodyText","createAuthenticationTemplate","createCatalogTemplate","createCouponTemplate","createLimitedTimeOfferTemplate","createMediaCardCarouselTemplate","carouselCards","cardComponents","createMPMTemplate","createProductCardCarouselTemplate","createSPMTemplate"],"mappings":"+EAaA,IAAqBA,EAArB,cAAyCC,CAAiC,CACrD,QAAA,CAAW,oBAE5B,WAAA,CAAYC,CAAAA,CAAwBC,CAAAA,CAAwB,CACxD,MAAMD,CAAAA,CAAQC,CAAM,EACxB,CAEA,MAAM,WAAA,CAAYC,CAAAA,CAA+C,CAC7D,OAAO,KAAK,QAAA,CAAA,KAAA,CAA8B,CAAA,EAAGA,CAAU,CAAA,CAAA,CAAI,KAAK,MAAA,CAAO,eAAA,CAAgC,IAAI,CAC/G,CAEA,MAAM,cAAA,CAAeA,CAAAA,CAAoBC,CAAAA,CAAkE,CACvG,OAAO,IAAA,CAAK,QAAA,CAAA,MAAA,CAER,CAAA,EAAGD,CAAU,CAAA,CAAA,CACb,IAAA,CAAK,MAAA,CAAO,eAAA,CACZ,KAAK,SAAA,CAAUC,CAAQ,CAC3B,CACJ,CAEA,MAAM,YAAA,CAAaC,CAAAA,CAA2E,CAC1F,OAAO,IAAA,CAAK,QAAA,CAAA,KAAA,CAER,CAAA,EAAG,IAAA,CAAK,OAAO,sBAA8B,CAAA,CAAA,EAAI,IAAA,CAAK,QAAQ,GAAGC,GAAAA,CAAoBD,CAAAA,EAAU,EAAE,CAAC,CAAA,CAAA,CAClG,IAAA,CAAK,MAAA,CAAO,eAAA,CACZ,IACJ,CACJ,CAEA,MAAM,cAAA,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AA,CAAK,CACZ,KAAM,UAAA,CACN,KAAA,CAAOa,CACX,CAAC,EAEM,CACH,IAAA,CAAM3B,CAAAA,CAAQ,IAAA,CACd,SAAUA,CAAAA,CAAQ,QAAA,CAClB,QAAA,CAAA,WAAA,CACA,UAAA,CAAAc,CACJ,CACJ,CAGO,SAASiB,CAAAA,CAAkB/B,EAAkD,CAChF,IAAMc,CAAAA,CAA+B,GAErC,OAAId,CAAAA,CAAQ,MAAA,EACRc,CAAAA,CAAW,KAAKf,CAAAA,CAAa,CAAE,GAAGC,CAAAA,CAAQ,OAAQ,MAAA,CAAQ,MAAO,CAAC,CAAC,EAGvEc,CAAAA,CAAW,IAAA,CAAKZ,CAAAA,CAAWF,CAAAA,CAAQ,IAAI,CAAC,CAAA,CAEpCA,CAAAA,CAAQ,MAAA,EACRc,EAAW,IAAA,CAAKV,CAAAA,CAAaJ,CAAAA,CAAQ,MAAM,CAAC,CAAA,CAIhDc,CAAAA,CAAW,IAAA,CAAK,CACZ,KAAM,SAAA,CACN,OAAA,CAAS,CACL,CACI,KAAM,KAAA,CACN,MAAA,CAAQ,CACJ,mBAAA,CAAqBd,EAAQ,mBACjC,CACJ,CACJ,CACJ,CAAC,CAAA,CAEM,CACH,IAAA,CAAMA,CAAAA,CAAQ,KACd,QAAA,CAAUA,CAAAA,CAAQ,SAClB,QAAA,CAAA,WAAA,CACA,UAAA,CAAAc,CACJ,CACJ","file":"chunk-VHAODWCN.js","sourcesContent":["import { BaseAPI } from '../../types/base';\nimport type { WabaConfigType } from '../../types/config';\nimport { HttpMethodsEnum, WabaConfigEnum } from '../../types/enums';\nimport type { RequesterClass, ResponsePagination, ResponseSuccess } from '../../types/request';\nimport { objectToQueryString } from '../../utils/objectToQueryString';\nimport type {\n TemplateClass,\n TemplateDeleteParams,\n TemplateGetParams,\n TemplateRequestBody,\n TemplateResponse,\n} from './types';\n\nexport default class TemplateApi extends BaseAPI implements TemplateClass {\n private readonly endpoint = 'message_templates';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n async getTemplate(templateId: string): Promise<TemplateResponse> {\n return this.sendJson(HttpMethodsEnum.Get, `${templateId}`, this.config[WabaConfigEnum.RequestTimeout], null);\n }\n\n async updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess> {\n return this.sendJson(\n HttpMethodsEnum.Post,\n `${templateId}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>> {\n return this.sendJson(\n HttpMethodsEnum.Get,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params ?? {})}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n\n async createTemplate(template: TemplateRequestBody): Promise<TemplateResponse> {\n return this.sendJson(\n HttpMethodsEnum.Post,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n JSON.stringify(template),\n );\n }\n\n async deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess> {\n return this.sendJson(\n HttpMethodsEnum.Delete,\n `${this.config[WabaConfigEnum.BusinessAcctId]}/${this.endpoint}${objectToQueryString(params)}`,\n this.config[WabaConfigEnum.RequestTimeout],\n null,\n );\n }\n}\n","import { CategoryEnum } from '../../../types/enums';\nimport type {\n ComponentTypes,\n MediaCarouselCard,\n ProductCarouselCard,\n TemplateBody,\n TemplateButton,\n TemplateButtons,\n TemplateFooter,\n TemplateHeader,\n TemplateRequestBody,\n} from '../types';\nimport type {\n AuthenticationTemplateOptions,\n BodyOptions,\n ButtonOptions,\n CatalogTemplateOptions,\n CouponTemplateOptions,\n FooterOptions,\n HeaderOptions,\n LimitedTimeOfferTemplateOptions,\n MediaCardCarouselTemplateOptions,\n MPMTemplateOptions,\n OTPTemplateOptions,\n ProductCardCarouselTemplateOptions,\n SPMTemplateOptions,\n TemplateOptions,\n TemplateParameter,\n} from '../types';\n\n// Helper function to create header component\nfunction createHeader(options: HeaderOptions): TemplateHeader {\n const header: TemplateHeader = {\n type: 'HEADER',\n format: options.format,\n };\n\n if (options.text) {\n header.text = options.text;\n }\n\n if (options.example) {\n header.example = options.example;\n }\n\n return header;\n}\n\n// Helper function to create body component\nfunction createBody(options: BodyOptions): TemplateBody {\n const body: TemplateBody = {\n type: 'BODY',\n text: options.text,\n };\n\n if (options.example) {\n body.example = options.example;\n }\n\n return body;\n}\n\n// Helper function to create footer component\nfunction createFooter(options: FooterOptions): TemplateFooter {\n return {\n type: 'FOOTER',\n text: options.text,\n };\n}\n\n// Helper function to create buttons\nfunction createButtons(options: ButtonOptions): ComponentTypes[] {\n const buttons: TemplateButton[] = [];\n\n if (options.phone_number) {\n buttons.push({\n type: 'PHONE_NUMBER',\n text: options.phone_number.text,\n phone_number: options.phone_number.phone_number,\n });\n }\n\n if (options.url) {\n const urlButton: any = {\n type: 'URL',\n text: options.url.text,\n url: options.url.url,\n };\n if (options.url.example) {\n urlButton.example = [options.url.example];\n }\n buttons.push(urlButton);\n }\n\n if (options.quick_reply) {\n options.quick_reply.forEach((qr) => {\n buttons.push({\n type: 'QUICK_REPLY',\n text: qr.text,\n });\n });\n }\n\n if (options.copy_code) {\n buttons.push({\n type: 'COPY_CODE',\n example: options.copy_code.example,\n });\n }\n\n if (options.flow) {\n const flowButton: any = {\n type: 'FLOW',\n text: options.flow.text,\n };\n if (options.flow.flow_id) flowButton.flow_id = options.flow.flow_id;\n if (options.flow.flow_name) flowButton.flow_name = options.flow.flow_name;\n if (options.flow.flow_json) flowButton.flow_json = options.flow.flow_json;\n if (options.flow.flow_action) flowButton.flow_action = options.flow.flow_action;\n if (options.flow.navigate_screen) flowButton.navigate_screen = options.flow.navigate_screen;\n buttons.push(flowButton);\n }\n\n if (options.mpm) {\n buttons.push({ type: 'MPM' });\n }\n\n if (options.otp) {\n buttons.push({ type: 'OTP' });\n }\n\n if (options.spm) {\n buttons.push({ type: 'SPM' });\n }\n\n return buttons.length > 0\n ? [\n {\n type: 'BUTTONS',\n buttons: buttons,\n },\n ]\n : [];\n}\n\n// Helper function to format parameter examples\nfunction formatParameterExamples(parameters: TemplateParameter[]): string[] {\n return parameters.map((param) => {\n switch (param.type) {\n case 'text':\n return param.value;\n case 'currency':\n return param.fallback_value;\n case 'date_time':\n return param.fallback_value;\n case 'image':\n case 'video':\n case 'document':\n return param.handle || param.link || '';\n case 'location':\n return param.name || '';\n case 'product':\n return param.product_retailer_id;\n default:\n return '';\n }\n });\n}\n\n// Generic template factory\nexport function createTemplate(options: TemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader(options.header));\n }\n\n if (options.body) {\n components.push(createBody(options.body));\n }\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n if (options.buttons) {\n components.push(...createButtons(options.buttons));\n }\n\n if (options.carousel) {\n // Handle carousel components\n const carouselComponents: ComponentTypes[] = [];\n options.carousel.cards.forEach((card, index) => {\n if (card.image || card.video || card.product) {\n const format = card.image ? 'IMAGE' : card.video ? 'VIDEO' : 'DOCUMENT';\n const handle = card.image || card.video || card.product || '';\n carouselComponents.push({\n type: 'HEADER',\n format: format,\n example: {\n header_handle: [handle],\n },\n });\n }\n if (card.body) {\n carouselComponents.push({\n type: 'BODY',\n text: card.body,\n example: card.bodyParameters\n ? {\n body_text: [formatParameterExamples(card.bodyParameters)],\n }\n : undefined,\n });\n }\n if (card.buttons) {\n carouselComponents.push(...createButtons(card.buttons));\n }\n });\n components.push(...carouselComponents);\n }\n\n if (options.limitedTimeOffer) {\n components.push({\n type: 'LIMITED_TIME_OFFER',\n limited_time_offer: {\n expiration_time_ms: options.limitedTimeOffer.expiration_time_ms,\n },\n });\n }\n\n return {\n name: options.name,\n language: options.language,\n category: options.category,\n components: components.length > 0 ? components : undefined,\n };\n}\n\n// OTP Template Factory\nexport function createOTPTemplate(options: OTPTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n // Add security recommendation if requested\n let bodyText = '*{{1}}* is your verification code.';\n if (options.add_security_recommendation) {\n bodyText += ' For your security, do not share this code.';\n }\n if (options.code_expiration_minutes) {\n bodyText += ` This code expires in ${options.code_expiration_minutes} minutes.`;\n }\n\n components.push({\n type: 'BODY',\n text: bodyText,\n example: {\n body_text: [['123456']], // Example OTP code\n },\n });\n\n // Add OTP button\n components.push({\n type: 'BUTTONS',\n buttons: [{ type: 'OTP' }],\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Authentication,\n components,\n };\n}\n\n// Authentication Template Factory\nexport function createAuthenticationTemplate(options: AuthenticationTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n // Add security message\n let bodyText = 'Your security code is *{{1}}*.';\n if (options.add_security_recommendation) {\n bodyText += ' Do not share this code with anyone.';\n }\n if (options.code_expiration_minutes) {\n bodyText += ` This code expires in ${options.code_expiration_minutes} minutes.`;\n }\n\n components.push({\n type: 'BODY',\n text: bodyText,\n example: {\n body_text: [['ABCD1234']], // Example auth code\n },\n });\n\n // Add copy code button if requested\n if (options.copy_code_button) {\n components.push({\n type: 'BUTTONS',\n buttons: [\n {\n type: 'COPY_CODE',\n example: 'ABCD1234',\n },\n ],\n });\n }\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Authentication,\n components,\n };\n}\n\n// Catalog Template Factory\nexport function createCatalogTemplate(options: CatalogTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n // Add catalog button\n components.push({\n type: 'BUTTONS',\n buttons: [\n {\n type: 'CATALOG',\n action: {\n thumbnail_product_retailer_id: options.thumbnail_product_retailer_id,\n },\n },\n ],\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// Coupon Template Factory\nexport function createCouponTemplate(options: CouponTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n // Add copy code button\n components.push({\n type: 'BUTTONS',\n buttons: [\n {\n type: 'COPY_CODE',\n example: options.coupon_code,\n },\n ],\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// Limited Time Offer Template Factory\nexport function createLimitedTimeOfferTemplate(options: LimitedTimeOfferTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n // Add limited time offer component first\n components.push({\n type: 'LIMITED_TIME_OFFER',\n limited_time_offer: {\n expiration_time_ms: options.expiration_time_ms,\n },\n });\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// Media Card Carousel Template Factory\nexport function createMediaCardCarouselTemplate(options: MediaCardCarouselTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n // Add carousel component\n const carouselCards: MediaCarouselCard[] = [];\n options.cards.forEach((card, index) => {\n const cardComponents: (TemplateHeader | TemplateBody | TemplateButtons)[] = [];\n\n // Add header (media)\n cardComponents.push({\n type: 'HEADER' as const,\n format: card.header.format,\n example: card.header.example,\n });\n\n // Add body\n cardComponents.push(createBody(card.body));\n\n // Add buttons if any\n if (card.buttons) {\n cardComponents.push(...(createButtons(card.buttons) as TemplateButtons[]));\n }\n\n carouselCards.push({\n card_index: index,\n components: cardComponents,\n });\n });\n\n components.push({\n type: 'CAROUSEL',\n cards: carouselCards,\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// MPM (Multi-Product Message) Template Factory\nexport function createMPMTemplate(options: MPMTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n // Add MPM button\n components.push({\n type: 'BUTTONS',\n buttons: [\n {\n type: 'MPM',\n action: {\n thumbnail_product_retailer_id: options.thumbnail_product_retailer_id,\n sections: options.sections,\n },\n },\n ],\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// Product Card Carousel Template Factory\nexport function createProductCardCarouselTemplate(options: ProductCardCarouselTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n // Add carousel with product cards\n const carouselCards: ProductCarouselCard[] = options.cards.map((card, index) => ({\n card_index: index,\n components: [\n {\n type: 'HEADER' as const,\n format: 'PRODUCT' as const,\n example: {\n header_handle: [card.product_retailer_id],\n },\n },\n ],\n }));\n\n components.push({\n type: 'CAROUSEL',\n cards: carouselCards,\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n\n// SPM (Single-Product Message) Template Factory\nexport function createSPMTemplate(options: SPMTemplateOptions): TemplateRequestBody {\n const components: ComponentTypes[] = [];\n\n if (options.header) {\n components.push(createHeader({ ...options.header, format: 'TEXT' }));\n }\n\n components.push(createBody(options.body));\n\n if (options.footer) {\n components.push(createFooter(options.footer));\n }\n\n // Add SPM button\n components.push({\n type: 'BUTTONS',\n buttons: [\n {\n type: 'SPM',\n action: {\n product_retailer_id: options.product_retailer_id,\n },\n },\n ],\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function c(n){return typeof n=="object"&&n!==null}function o(n){return typeof n=="string"}var f=["data_exchange","INIT","BACK"],E=["data_exchange","INIT"];function w(n){if(!("flow_token"in n&&o(n.flow_token)&&"action"in n))return false;let{action:e,version:i,screen:t,data:s}=n,r=i==="3.0",a=f.includes(e),l=typeof t>"u"||o(t)&&t!=="SUCCESS",u=e==="data_exchange"||c(s);return r&&a&&l&&u}function A(n){if(!("flow_token"in n&&o(n.flow_token)&&"action"in n))return false;let{action:e,screen:i,data:t}=n,s=E.includes(e),r=o(i),a=c(t)&&"error_key"in t&&o(t.error)&&"error_message"in t&&o(t.error_message);return s&&r&&a}function d(n){return "action"in n&&n.action==="ping"}export{w as a,A as b,d as c};//# sourceMappingURL=chunk-WGGN32O2.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-WGGN32O2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/flowTypeGuards.ts"],"names":["isObject","value","isString","DATA_EXCHANGE_ACTIONS","ERROR_ACTIONS","isFlowDataExchangeRequest","request","action","version","screen","data","hasValidVersion","hasValidAction","hasValidScreen","hasValidData","isFlowErrorRequest","isFlowPingRequest"],"mappings":"AAaA,SAASA,CAAAA,CAASC,CAAAA,CAAkD,CAChE,OAAO,OAAOA,CAAAA,EAAU,QAAA,EAAYA,CAAAA,GAAU,IAClD,CAOA,SAASC,CAAAA,CAASD,CAAAA,CAAiC,CAC/C,OAAO,OAAOA,CAAAA,EAAU,QAC5B,CAGA,IAAME,CAAAA,CAAwB,CAAA,eAAA,CAAA,MAAA,CAAA,MAAuE,CAAA,CAG/FC,EAAgB,CAAA,eAAA,CAAA,MAAkD,CAAA,CASjE,SAASC,CAAAA,CAA0BC,EAKxC,CAEE,GAAI,EAAE,YAAA,GAAgBA,GAAWJ,CAAAA,CAASI,CAAAA,CAAQ,UAAU,CAAA,EAAK,QAAA,GAAYA,CAAAA,CAAAA,C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,\n FlowDataExchangeRequest,\n FlowEndpointRequest,\n FlowErrorNotificationRequest,\n FlowHealthCheckRequest,\n} from '@api/flow/types';\n\n/**\n * Helper function to check if a value is an object\n * @param value The value to check\n * @returns True if the value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Helper function to check if a value is a string\n * @param value The value to check\n * @returns True if the value is a string\n */\nfunction isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n\n// Array of allowed action types for data exchange requests\nconst DATA_EXCHANGE_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK] as const;\n\n// Array of allowed action types for error notification requests\nconst ERROR_ACTIONS = [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT] as const;\n\n/**\n * Type guard to check if a request is a Data Exchange request\n * Validates the request structure according to the Flow API specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Data Exchange request, false otherwise\n */\nexport function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {\n action: (typeof DATA_EXCHANGE_ACTIONS)[number];\n screen?: string;\n flow_token: string;\n data?: Record<string, any>;\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, version, screen, data } = request;\n\n // Validate API version\n const hasValidVersion = version === '3.0';\n\n // Check if the action is one of the allowed actions for data exchange\n const hasValidAction = DATA_EXCHANGE_ACTIONS.includes(action as any);\n\n // Screen is optional, but when present must be a string and not 'SUCCESS'\n const hasValidScreen = typeof screen === 'undefined' || (isString(screen) && screen !== 'SUCCESS');\n\n // Data is required except for DATA_EXCHANGE action\n const hasValidData = action === FlowActionEnum.DATA_EXCHANGE || isObject(data);\n\n // All conditions must be met for a valid data exchange request\n return hasValidVersion && hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is an Error Notification request\n * Validates the request structure according to the Flow API error specifications\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a valid Error Notification request, false otherwise\n */\nexport function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {\n action: (typeof ERROR_ACTIONS)[number];\n screen: string;\n flow_token: string;\n data: {\n error: string;\n error_message: string;\n };\n} {\n // Check for basic required fields\n if (!('flow_token' in request && isString(request.flow_token) && 'action' in request)) {\n return false;\n }\n\n const { action, screen, data } = request;\n\n // Check if the action is one of the allowed actions for error notifications\n const hasValidAction = ERROR_ACTIONS.includes(action as any);\n\n // Screen is required for error notifications\n const hasValidScreen = isString(screen);\n\n // Validate error data structure\n const hasValidData =\n isObject(data) &&\n 'error_key' in data &&\n isString(data.error) &&\n 'error_message' in data &&\n isString(data.error_message);\n\n // All conditions must be met for a valid error notification request\n return hasValidAction && hasValidScreen && hasValidData;\n}\n\n/**\n * Type guard to check if a request is a Ping (health check) request\n * Simple validation for health check endpoints in the Flow API\n *\n * @param request The Flow endpoint request to check\n * @returns True if the request is a Ping request, false otherwise\n */\nexport function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest {\n // A ping request only requires the 'action' field with value 'ping'\n return 'action' in request && request.action === 'ping';\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WabaConfigType } from './shared/types/config.js';
|
|
1
|
+
import { e as ResponseSuccess } from './request-vYMaEfk5.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Enum for Flow Status
|
|
@@ -374,134 +373,4 @@ interface FlowClass {
|
|
|
374
373
|
}): Promise<FlowMigrationResponse>;
|
|
375
374
|
}
|
|
376
375
|
|
|
377
|
-
|
|
378
|
-
* API for managing WhatsApp Flows.
|
|
379
|
-
*
|
|
380
|
-
* This API allows you to:
|
|
381
|
-
* - List flows
|
|
382
|
-
* - Create flows
|
|
383
|
-
* - Get flow details and previews
|
|
384
|
-
* - Update flow metadata and JSON
|
|
385
|
-
* - Delete flows
|
|
386
|
-
* - Publish and deprecate flows
|
|
387
|
-
* - Migrate flows between WABAs
|
|
388
|
-
* - Validate flow JSON
|
|
389
|
-
*/
|
|
390
|
-
declare class FlowApi extends BaseAPI implements FlowClass {
|
|
391
|
-
constructor(config: WabaConfigType, client: RequesterClass);
|
|
392
|
-
/**
|
|
393
|
-
* List Flows
|
|
394
|
-
*
|
|
395
|
-
* @param wabaId - The WABA ID
|
|
396
|
-
* @returns Promise with the list of flows
|
|
397
|
-
*/
|
|
398
|
-
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
399
|
-
/**
|
|
400
|
-
* Create Flow
|
|
401
|
-
*
|
|
402
|
-
* @param wabaId - The WABA ID
|
|
403
|
-
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
404
|
-
* @returns Promise with the created flow ID and validation errors if any
|
|
405
|
-
*/
|
|
406
|
-
createFlow(wabaId: string, data: {
|
|
407
|
-
name: string;
|
|
408
|
-
categories?: FlowCategoryEnum[];
|
|
409
|
-
endpoint_uri?: string;
|
|
410
|
-
clone_flow_id?: string;
|
|
411
|
-
flow_json?: string;
|
|
412
|
-
publish?: boolean;
|
|
413
|
-
}): Promise<CreateFlowResponse>;
|
|
414
|
-
/**
|
|
415
|
-
* Get Flow details
|
|
416
|
-
*
|
|
417
|
-
* @param flowId - The flow ID
|
|
418
|
-
* @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
|
|
419
|
-
* @param dateFormat - Optional date format
|
|
420
|
-
* @returns Promise with the flow details or preview response
|
|
421
|
-
*/
|
|
422
|
-
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
423
|
-
/**
|
|
424
|
-
* Get Flow Preview URL
|
|
425
|
-
*
|
|
426
|
-
* @param flowId - The flow ID
|
|
427
|
-
* @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
|
|
428
|
-
* @returns Promise with the flow preview details
|
|
429
|
-
*/
|
|
430
|
-
getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
|
|
431
|
-
/**
|
|
432
|
-
* Update Flow Metadata
|
|
433
|
-
*
|
|
434
|
-
* @param flowId - The flow ID
|
|
435
|
-
* @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
|
|
436
|
-
* @returns Promise with the success status
|
|
437
|
-
*/
|
|
438
|
-
updateFlowMetadata(flowId: string, data: {
|
|
439
|
-
name?: string;
|
|
440
|
-
categories?: FlowCategoryEnum[];
|
|
441
|
-
endpoint_uri?: string;
|
|
442
|
-
application_id?: string;
|
|
443
|
-
}): Promise<ResponseSuccess>;
|
|
444
|
-
/**
|
|
445
|
-
* Delete Flow (only works if the Flow is in DRAFT status)
|
|
446
|
-
*
|
|
447
|
-
* @param flowId - The flow ID
|
|
448
|
-
* @returns Promise with the success status
|
|
449
|
-
*/
|
|
450
|
-
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
451
|
-
/**
|
|
452
|
-
* List Assets (e.g., get Flow JSON download URL)
|
|
453
|
-
*
|
|
454
|
-
* @param flowId - The flow ID
|
|
455
|
-
* @returns Promise with the list of assets
|
|
456
|
-
*/
|
|
457
|
-
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
458
|
-
/**
|
|
459
|
-
* Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
|
|
460
|
-
*
|
|
461
|
-
* @param flowId - The flow ID
|
|
462
|
-
* @param data - Object containing the file data and optional name.
|
|
463
|
-
* @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
464
|
-
* @param data.name - Optional name for the asset, defaults to 'flow.json'.
|
|
465
|
-
* @returns Promise with the success status and validation errors, if any.
|
|
466
|
-
*/
|
|
467
|
-
updateFlowJson(flowId: string, data: {
|
|
468
|
-
file: Blob | Buffer | object;
|
|
469
|
-
name?: string;
|
|
470
|
-
}): Promise<UpdateFlowResponse>;
|
|
471
|
-
/**
|
|
472
|
-
* Validate Flow JSON by attempting an update without publishing.
|
|
473
|
-
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
474
|
-
*
|
|
475
|
-
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
476
|
-
* @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
|
|
477
|
-
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
478
|
-
*/
|
|
479
|
-
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
480
|
-
/**
|
|
481
|
-
* Publish Flow
|
|
482
|
-
*
|
|
483
|
-
* @param flowId - The flow ID
|
|
484
|
-
* @returns Promise with the success status
|
|
485
|
-
*/
|
|
486
|
-
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
487
|
-
/**
|
|
488
|
-
* Deprecate Flow
|
|
489
|
-
*
|
|
490
|
-
* @param flowId - The flow ID
|
|
491
|
-
* @returns Promise with the success status
|
|
492
|
-
*/
|
|
493
|
-
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
494
|
-
/**
|
|
495
|
-
* Migrate Flows between WABAs
|
|
496
|
-
*
|
|
497
|
-
* @param destinationWabaId - The destination WABA ID
|
|
498
|
-
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
499
|
-
* @returns Promise with migration results (successes and failures)
|
|
500
|
-
*/
|
|
501
|
-
migrateFlows(destinationWabaId: string, data: {
|
|
502
|
-
source_waba_id: string;
|
|
503
|
-
source_flow_names?: string[];
|
|
504
|
-
}): Promise<FlowMigrationResponse>;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
export { type CreateFlowResponse as C, FlowApi as F, type UpdateFlowResponse as U, type ValidateFlowJsonResponse as V, type Flow as a, type FlowType as b, FlowActionEnum as c, type FlowAssetsResponse as d, FlowCategoryEnum as e, type FlowClass as f, type FlowEndpointRequest as g, type FlowEndpointResponse as h, type FlowMigrationResponse as i, type FlowPreviewResponse as j, type FlowsListResponse as k, FlowStatusEnum as l, type FlowValidationError as m, FlowTypeEnum as n, type FlowDataExchangeRequest as o, type FlowErrorNotificationRequest as p, type FlowHealthCheckRequest as q };
|
|
376
|
+
export { type CreateFlowResponse as C, type Flow as F, type UpdateFlowResponse as U, type ValidateFlowJsonResponse as V, type FlowType as a, FlowActionEnum as b, type FlowAssetsResponse as c, FlowCategoryEnum as d, type FlowClass as e, type FlowEndpointRequest as f, type FlowEndpointResponse as g, type FlowMigrationResponse as h, type FlowPreviewResponse as i, type FlowsListResponse as j, FlowStatusEnum as k, FlowTypeEnum as l, type FlowValidationError as m, type FlowDataExchangeRequest as n, type FlowErrorNotificationRequest as o, type FlowHealthCheckRequest as p };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { WhatsAppConfig } from '../../../types/config.js';
|
|
2
|
+
import { c as WebhookProcessor } from '../../../WebhookProcessor-ByAe7Kf_.js';
|
|
3
|
+
import '../../../enums-BZd9T2ul.js';
|
|
4
|
+
import '../../../common-DDXsNyLF.js';
|
|
5
|
+
import '../../../request-vYMaEfk5.js';
|
|
6
|
+
import '../../../WhatsApp-BIBtT-y9.js';
|
|
7
|
+
import '../../../httpsClient-v4gmltzS.js';
|
|
8
|
+
import 'https';
|
|
9
|
+
import '../../../EncryptionApi-D7pt-OXT.js';
|
|
10
|
+
import '../../../base-CdGDdVEl.js';
|
|
11
|
+
import '../../../FlowApi-UAvzhJfV.js';
|
|
12
|
+
import '../../../MediaApi-BrEKpqi_.js';
|
|
13
|
+
import '../../../MessageApi-Circorzz.js';
|
|
14
|
+
import '../../../PhoneNumberApi-DKlu9PHl.js';
|
|
15
|
+
import '../../../BusinessProfileApi-WXscSgo-.js';
|
|
16
|
+
import '../../../QrCodeApi-7vDwIBHR.js';
|
|
17
|
+
import '../../../RegistrationApi-qO_qoti9.js';
|
|
18
|
+
import '../../../TemplateApi-xGgIZt89.js';
|
|
19
|
+
import '../../../TwoStepVerificationApi-DfNPIz-C.js';
|
|
20
|
+
import '../../../WabaApi-DqQi_68m.js';
|
|
21
|
+
|
|
22
|
+
interface ExpressRequest {
|
|
23
|
+
method: string;
|
|
24
|
+
url: string;
|
|
25
|
+
headers: Record<string, string | string[] | undefined>;
|
|
26
|
+
body?: any;
|
|
27
|
+
query: Record<string, any>;
|
|
28
|
+
rawBody?: any;
|
|
29
|
+
}
|
|
30
|
+
interface ExpressResponse {
|
|
31
|
+
status(code: number): ExpressResponse;
|
|
32
|
+
json(data: any): ExpressResponse;
|
|
33
|
+
send(data?: any): ExpressResponse;
|
|
34
|
+
setHeader(name: string, value: string): void;
|
|
35
|
+
}
|
|
36
|
+
interface NextFunction {
|
|
37
|
+
(error?: any): void;
|
|
38
|
+
}
|
|
39
|
+
interface ExpressWebhookConfig extends WhatsAppConfig {
|
|
40
|
+
path?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function webhookHandler(config: ExpressWebhookConfig): {
|
|
43
|
+
webhook: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse | undefined>;
|
|
44
|
+
flow: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse | undefined>;
|
|
45
|
+
processor: WebhookProcessor;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { type ExpressRequest, type ExpressResponse, type ExpressWebhookConfig, type NextFunction, webhookHandler };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{a as webhookHandler}from'../../../chunk-OA2SW4AF.js';import'../../../chunk-HJGN3PO4.js';import'../../../chunk-WGGN32O2.js';import'../../../chunk-B7DCL6I7.js';import'../../../chunk-FKXSL2JK.js';import'../../../chunk-AMHQGG6Z.js';import'../../../chunk-JPAV644F.js';import'../../../chunk-PHPQ5HP3.js';import'../../../chunk-IYSR44P6.js';import'../../../chunk-SNNRWNGZ.js';import'../../../chunk-L4ESAO2S.js';import'../../../chunk-7QBIZCJ4.js';import'../../../chunk-JXCLRKQ7.js';import'../../../chunk-LV3TULSI.js';import'../../../chunk-CRZ7EUYR.js';import'../../../chunk-JC6YMVID.js';import'../../../chunk-NLF2JGYY.js';import'../../../chunk-FSKBLPGE.js';import'../../../chunk-VHAODWCN.js';import'../../../chunk-MJEG3K4V.js';import'../../../chunk-RIL6QABY.js';import'../../../chunk-KMAH6636.js';//# sourceMappingURL=express.js.map
|
|
2
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"express.js"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { WhatsAppConfig } from '../../../types/config.js';
|
|
2
|
+
import { c as WebhookProcessor } from '../../../WebhookProcessor-ByAe7Kf_.js';
|
|
3
|
+
import '../../../enums-BZd9T2ul.js';
|
|
4
|
+
import '../../../common-DDXsNyLF.js';
|
|
5
|
+
import '../../../request-vYMaEfk5.js';
|
|
6
|
+
import '../../../WhatsApp-BIBtT-y9.js';
|
|
7
|
+
import '../../../httpsClient-v4gmltzS.js';
|
|
8
|
+
import 'https';
|
|
9
|
+
import '../../../EncryptionApi-D7pt-OXT.js';
|
|
10
|
+
import '../../../base-CdGDdVEl.js';
|
|
11
|
+
import '../../../FlowApi-UAvzhJfV.js';
|
|
12
|
+
import '../../../MediaApi-BrEKpqi_.js';
|
|
13
|
+
import '../../../MessageApi-Circorzz.js';
|
|
14
|
+
import '../../../PhoneNumberApi-DKlu9PHl.js';
|
|
15
|
+
import '../../../BusinessProfileApi-WXscSgo-.js';
|
|
16
|
+
import '../../../QrCodeApi-7vDwIBHR.js';
|
|
17
|
+
import '../../../RegistrationApi-qO_qoti9.js';
|
|
18
|
+
import '../../../TemplateApi-xGgIZt89.js';
|
|
19
|
+
import '../../../TwoStepVerificationApi-DfNPIz-C.js';
|
|
20
|
+
import '../../../WabaApi-DqQi_68m.js';
|
|
21
|
+
|
|
22
|
+
interface BaseApiRequest {
|
|
23
|
+
method?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
headers: Record<string, string | string[] | undefined>;
|
|
26
|
+
body?: any;
|
|
27
|
+
query: Partial<Record<string, string | string[]>>;
|
|
28
|
+
rawBody?: any;
|
|
29
|
+
}
|
|
30
|
+
interface BaseApiResponse {
|
|
31
|
+
status(code: number): any;
|
|
32
|
+
json(data: any): void | any;
|
|
33
|
+
send(data?: any): void | any;
|
|
34
|
+
setHeader(name: string, value: string): void;
|
|
35
|
+
}
|
|
36
|
+
interface NextJsWebhookConfig extends WhatsAppConfig {
|
|
37
|
+
}
|
|
38
|
+
declare function webhookHandler<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
|
|
39
|
+
webhook: (req: TRequest, res: TResponse) => Promise<any>;
|
|
40
|
+
flow: (req: TRequest, res: TResponse) => Promise<any>;
|
|
41
|
+
processor: WebhookProcessor;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { type BaseApiRequest, type BaseApiResponse, type NextJsWebhookConfig, webhookHandler };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{a as webhookHandler}from'../../../chunk-UCBYECNQ.js';import'../../../chunk-HJGN3PO4.js';import'../../../chunk-WGGN32O2.js';import'../../../chunk-B7DCL6I7.js';import'../../../chunk-FKXSL2JK.js';import'../../../chunk-AMHQGG6Z.js';import'../../../chunk-JPAV644F.js';import'../../../chunk-PHPQ5HP3.js';import'../../../chunk-IYSR44P6.js';import'../../../chunk-SNNRWNGZ.js';import'../../../chunk-L4ESAO2S.js';import'../../../chunk-7QBIZCJ4.js';import'../../../chunk-JXCLRKQ7.js';import'../../../chunk-LV3TULSI.js';import'../../../chunk-CRZ7EUYR.js';import'../../../chunk-JC6YMVID.js';import'../../../chunk-NLF2JGYY.js';import'../../../chunk-FSKBLPGE.js';import'../../../chunk-VHAODWCN.js';import'../../../chunk-MJEG3K4V.js';import'../../../chunk-RIL6QABY.js';import'../../../chunk-KMAH6636.js';//# sourceMappingURL=nextjs.js.map
|
|
2
|
+
//# sourceMappingURL=nextjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"nextjs.js"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '../../
|
|
5
|
-
import '../../enums-
|
|
6
|
-
import '../../
|
|
7
|
-
import '../../
|
|
8
|
-
import '../../
|
|
9
|
-
import '../../
|
|
10
|
-
import '../../PhoneNumberApi-DMb_G3uw.js';
|
|
11
|
-
import '../../BusinessProfileApi-DE7Nnuy_.js';
|
|
12
|
-
import '../../QrCodeApi-D3rVKuxV.js';
|
|
13
|
-
import '../../RegistrationApi-DZBJWAZS.js';
|
|
14
|
-
import '../../TemplateApi-BFeM9qJS.js';
|
|
15
|
-
import '../../TwoStepVerificationApi-6jV5pDxS.js';
|
|
16
|
-
import '../../WabaApi-B8Gv2UNE.js';
|
|
1
|
+
export { ExpressRequest, ExpressResponse, webhookHandler as ExpressWebhook, ExpressWebhookConfig, NextFunction } from './frameworks/express.js';
|
|
2
|
+
export { webhookHandler as NextJsWebhook, NextJsWebhookConfig } from './frameworks/nextjs.js';
|
|
3
|
+
export { F as FlowHandler, e as MessageHandler, M as MessageStatus, W as WebhookContact, a as WebhookEvent, b as WebhookMessage, c as WebhookProcessor, d as WebhookResponse, g as constructFullUrl, f as processFlowRequest, p as processWebhookMessages } from '../../WebhookProcessor-ByAe7Kf_.js';
|
|
4
|
+
import '../../types/config.js';
|
|
5
|
+
import '../../enums-BZd9T2ul.js';
|
|
6
|
+
import '../../common-DDXsNyLF.js';
|
|
7
|
+
import '../../request-vYMaEfk5.js';
|
|
8
|
+
import '../../WhatsApp-BIBtT-y9.js';
|
|
9
|
+
import '../../httpsClient-v4gmltzS.js';
|
|
17
10
|
import 'https';
|
|
11
|
+
import '../../EncryptionApi-D7pt-OXT.js';
|
|
12
|
+
import '../../base-CdGDdVEl.js';
|
|
13
|
+
import '../../FlowApi-UAvzhJfV.js';
|
|
14
|
+
import '../../MediaApi-BrEKpqi_.js';
|
|
15
|
+
import '../../MessageApi-Circorzz.js';
|
|
16
|
+
import '../../PhoneNumberApi-DKlu9PHl.js';
|
|
17
|
+
import '../../BusinessProfileApi-WXscSgo-.js';
|
|
18
|
+
import '../../QrCodeApi-7vDwIBHR.js';
|
|
19
|
+
import '../../RegistrationApi-qO_qoti9.js';
|
|
20
|
+
import '../../TemplateApi-xGgIZt89.js';
|
|
21
|
+
import '../../TwoStepVerificationApi-DfNPIz-C.js';
|
|
22
|
+
import '../../WabaApi-DqQi_68m.js';
|
|
18
23
|
|
|
19
24
|
declare const generateXHub256Sig: (body: string, appSecret: string) => string;
|
|
20
25
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a as generateXHub256Sig}from'../../chunk-RWCVPWRC.js';export{a as ExpressWebhook}from'../../chunk-OA2SW4AF.js';export{a as NextJsWebhook}from'../../chunk-UCBYECNQ.js';export{d as WebhookProcessor,c as constructFullUrl,b as processFlowRequest,a as processWebhookMessages}from'../../chunk-HJGN3PO4.js';import'../../chunk-WGGN32O2.js';import'../../chunk-B7DCL6I7.js';import'../../chunk-FKXSL2JK.js';import'../../chunk-AMHQGG6Z.js';import'../../chunk-JPAV644F.js';import'../../chunk-PHPQ5HP3.js';import'../../chunk-IYSR44P6.js';import'../../chunk-SNNRWNGZ.js';import'../../chunk-L4ESAO2S.js';import'../../chunk-7QBIZCJ4.js';import'../../chunk-JXCLRKQ7.js';import'../../chunk-LV3TULSI.js';import'../../chunk-CRZ7EUYR.js';import'../../chunk-JC6YMVID.js';import'../../chunk-NLF2JGYY.js';import'../../chunk-FSKBLPGE.js';import'../../chunk-VHAODWCN.js';import'../../chunk-MJEG3K4V.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
import '../../
|
|
3
|
-
import '../../
|
|
4
|
-
import '../../
|
|
5
|
-
import '../../
|
|
6
|
-
import '../../
|
|
7
|
-
import '../../
|
|
8
|
-
import '../../
|
|
9
|
-
import '../../
|
|
10
|
-
import '../../
|
|
11
|
-
import '../../
|
|
12
|
-
import '../../
|
|
13
|
-
|
|
14
|
-
import '../../
|
|
15
|
-
import '../../
|
|
1
|
+
import { E as EncryptionApi } from '../../EncryptionApi-D7pt-OXT.js';
|
|
2
|
+
import { F as FlowApi } from '../../FlowApi-UAvzhJfV.js';
|
|
3
|
+
import { WhatsAppConfig } from '../../types/config.js';
|
|
4
|
+
import { M as MediaApi } from '../../MediaApi-BrEKpqi_.js';
|
|
5
|
+
import { M as MessagesApi } from '../../MessageApi-Circorzz.js';
|
|
6
|
+
import { P as PhoneNumberApi } from '../../PhoneNumberApi-DKlu9PHl.js';
|
|
7
|
+
import { B as BusinessProfileApi } from '../../BusinessProfileApi-WXscSgo-.js';
|
|
8
|
+
import { Q as QrCodeApi } from '../../QrCodeApi-7vDwIBHR.js';
|
|
9
|
+
import { R as RegistrationApi } from '../../RegistrationApi-qO_qoti9.js';
|
|
10
|
+
import { T as TemplateApi } from '../../TemplateApi-xGgIZt89.js';
|
|
11
|
+
import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-DfNPIz-C.js';
|
|
12
|
+
import { W as WabaApi } from '../../WabaApi-DqQi_68m.js';
|
|
13
|
+
export { W as WhatsApp } from '../../WhatsApp-BIBtT-y9.js';
|
|
14
|
+
import '../../base-CdGDdVEl.js';
|
|
15
|
+
import '../../enums-BZd9T2ul.js';
|
|
16
|
+
import '../../request-vYMaEfk5.js';
|
|
17
|
+
import '../../common-DDXsNyLF.js';
|
|
18
|
+
import '../../httpsClient-v4gmltzS.js';
|
|
16
19
|
import 'https';
|
|
20
|
+
|
|
21
|
+
declare class WhatsAppClass {
|
|
22
|
+
constructor(config?: WhatsAppConfig);
|
|
23
|
+
readonly messages: MessagesApi;
|
|
24
|
+
readonly templates: TemplateApi;
|
|
25
|
+
readonly phoneNumber: PhoneNumberApi;
|
|
26
|
+
readonly qrCode: QrCodeApi;
|
|
27
|
+
readonly encryption: EncryptionApi;
|
|
28
|
+
readonly twoStepVerification: TwoStepVerificationApi;
|
|
29
|
+
readonly registration: RegistrationApi;
|
|
30
|
+
readonly media: MediaApi;
|
|
31
|
+
readonly waba: WabaApi;
|
|
32
|
+
readonly flow: FlowApi;
|
|
33
|
+
readonly businessProfile: BusinessProfileApi;
|
|
34
|
+
updateTimeout(ms: number): boolean;
|
|
35
|
+
updatePhoneNumberId(phoneNumberId: number): boolean;
|
|
36
|
+
updateAccessToken(accessToken: string): boolean;
|
|
37
|
+
updateWabaId(wabaId: string): boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { WhatsAppClass };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as WhatsApp}from'../../chunk-
|
|
1
|
+
export{b as WhatsApp}from'../../chunk-B7DCL6I7.js';import'../../chunk-FKXSL2JK.js';import'../../chunk-AMHQGG6Z.js';import'../../chunk-JPAV644F.js';import'../../chunk-PHPQ5HP3.js';import'../../chunk-IYSR44P6.js';import'../../chunk-SNNRWNGZ.js';import'../../chunk-L4ESAO2S.js';import'../../chunk-7QBIZCJ4.js';import'../../chunk-JXCLRKQ7.js';import'../../chunk-LV3TULSI.js';import'../../chunk-CRZ7EUYR.js';import'../../chunk-JC6YMVID.js';import'../../chunk-NLF2JGYY.js';import'../../chunk-FSKBLPGE.js';import'../../chunk-VHAODWCN.js';import'../../chunk-MJEG3K4V.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -704,4 +704,4 @@ declare namespace SDKEnums {
|
|
|
704
704
|
export { SDKEnums_AudioMediaTypesEnum as AudioMediaTypesEnum, SDKEnums_BusinessVerticalEnum as BusinessVerticalEnum, SDKEnums_ButtonPositionEnum as ButtonPositionEnum, SDKEnums_CategoryEnum as CategoryEnum, SDKEnums_ComponentTypesEnum as ComponentTypesEnum, SDKEnums_ConversationTypesEnum as ConversationTypesEnum, SDKEnums_CurrencyCodesEnum as CurrencyCodesEnum, SDKEnums_DataLocalizationRegionEnum as DataLocalizationRegionEnum, SDKEnums_DocumentMediaTypesEnum as DocumentMediaTypesEnum, SDKEnums_HttpMethodsEnum as HttpMethodsEnum, SDKEnums_ImageMediaTypesEnum as ImageMediaTypesEnum, SDKEnums_InteractiveTypesEnum as InteractiveTypesEnum, SDKEnums_LanguagesEnum as LanguagesEnum, SDKEnums_MessageTypesEnum as MessageTypesEnum, SDKEnums_ParametersTypesEnum as ParametersTypesEnum, SDKEnums_ReferralSourceTypesEnum as ReferralSourceTypesEnum, SDKEnums_RequestCodeMethodsEnum as RequestCodeMethodsEnum, SDKEnums_StatusEnum as StatusEnum, SDKEnums_StickerMediaTypesEnum as StickerMediaTypesEnum, SDKEnums_SubTypeEnum as SubTypeEnum, SDKEnums_SystemChangeTypesEnum as SystemChangeTypesEnum, SDKEnums_TemplateStatusEnum as TemplateStatusEnum, SDKEnums_VideoMediaTypesEnum as VideoMediaTypesEnum, SDKEnums_WabaConfigEnum as WabaConfigEnum, SDKEnums_WebhookTypesEnum as WebhookTypesEnum };
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
-
export { AudioMediaTypesEnum as A,
|
|
707
|
+
export { AudioMediaTypesEnum as A, ButtonPositionEnum as B, ComponentTypesEnum as C, DocumentMediaTypesEnum as D, HttpMethodsEnum as H, InteractiveTypesEnum as I, LanguagesEnum as L, MessageTypesEnum as M, ParametersTypesEnum as P, ReferralSourceTypesEnum as R, SubTypeEnum as S, TemplateStatusEnum as T, VideoMediaTypesEnum as V, WabaConfigEnum as W, CategoryEnum as a, ConversationTypesEnum as b, StatusEnum as c, StickerMediaTypesEnum as d, ImageMediaTypesEnum as e, WebhookTypesEnum as f, SystemChangeTypesEnum as g, RequestCodeMethodsEnum as h, CurrencyCodesEnum as i, DataLocalizationRegionEnum as j, BusinessVerticalEnum as k, SDKEnums as l };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { H as HttpMethodsEnum } from './enums-BZd9T2ul.js';
|
|
2
|
+
|
|
3
|
+
type ResponseHeaderValue = string | string[] | undefined;
|
|
4
|
+
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
5
|
+
type ResponseJSONBody = Record<string, unknown>;
|
|
6
|
+
declare class HttpsClientResponseClass {
|
|
7
|
+
constructor(resp: Response);
|
|
8
|
+
statusCode: () => number;
|
|
9
|
+
headers: () => ResponseHeaders;
|
|
10
|
+
rawResponse: () => Response;
|
|
11
|
+
json: () => Promise<ResponseJSONBody>;
|
|
12
|
+
}
|
|
13
|
+
declare class HttpsClientClass {
|
|
14
|
+
constructor();
|
|
15
|
+
clearSockets: () => boolean;
|
|
16
|
+
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { HttpsClientClass as H, type ResponseHeaders as R, HttpsClientResponseClass as a, type ResponseHeaderValue as b, type ResponseJSONBody as c };
|