meta-cloud-api 1.0.0 → 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.
Files changed (133) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +405 -0
  3. package/dist/BusinessProfileApi-WXscSgo-.d.ts +353 -0
  4. package/dist/EncryptionApi-D7pt-OXT.d.ts +22 -0
  5. package/dist/FlowApi-UAvzhJfV.d.ts +136 -0
  6. package/dist/MediaApi-BrEKpqi_.d.ts +90 -0
  7. package/dist/MessageApi-Circorzz.d.ts +587 -0
  8. package/dist/PhoneNumberApi-DKlu9PHl.d.ts +142 -0
  9. package/dist/QrCodeApi-7vDwIBHR.d.ts +98 -0
  10. package/dist/RegistrationApi-qO_qoti9.d.ts +47 -0
  11. package/dist/TemplateApi-xGgIZt89.d.ts +161 -0
  12. package/dist/TwoStepVerificationApi-DfNPIz-C.d.ts +33 -0
  13. package/dist/WabaApi-DqQi_68m.d.ts +175 -0
  14. package/dist/WebhookProcessor-ByAe7Kf_.d.ts +707 -0
  15. package/dist/WhatsApp-BIBtT-y9.d.ts +82 -0
  16. package/dist/api/encryption/index.d.ts +10 -0
  17. package/dist/api/encryption/index.js +2 -0
  18. package/dist/api/encryption/index.js.map +1 -0
  19. package/dist/api/flow/index.d.ts +10 -0
  20. package/dist/api/flow/index.js +2 -0
  21. package/dist/api/flow/index.js.map +1 -0
  22. package/dist/api/index.d.ts +16 -0
  23. package/dist/api/index.js +2 -0
  24. package/dist/api/index.js.map +1 -0
  25. package/dist/api/media/index.d.ts +10 -0
  26. package/dist/api/media/index.js +2 -0
  27. package/dist/api/media/index.js.map +1 -0
  28. package/dist/api/messages/index.d.ts +10 -0
  29. package/dist/api/messages/index.js +2 -0
  30. package/dist/api/messages/index.js.map +1 -0
  31. package/dist/api/phone/index.d.ts +10 -0
  32. package/dist/api/phone/index.js +2 -0
  33. package/dist/api/phone/index.js.map +1 -0
  34. package/dist/api/profile/index.d.ts +10 -0
  35. package/dist/api/profile/index.js +2 -0
  36. package/dist/api/profile/index.js.map +1 -0
  37. package/dist/api/qrCode/index.d.ts +10 -0
  38. package/dist/api/qrCode/index.js +2 -0
  39. package/dist/api/qrCode/index.js.map +1 -0
  40. package/dist/api/registration/index.d.ts +10 -0
  41. package/dist/api/registration/index.js +2 -0
  42. package/dist/api/registration/index.js.map +1 -0
  43. package/dist/api/template/index.d.ts +215 -0
  44. package/dist/api/template/index.js +2 -0
  45. package/dist/api/template/index.js.map +1 -0
  46. package/dist/api/twoStepVerification/index.d.ts +10 -0
  47. package/dist/api/twoStepVerification/index.js +2 -0
  48. package/dist/api/twoStepVerification/index.js.map +1 -0
  49. package/dist/api/waba/index.d.ts +10 -0
  50. package/dist/api/waba/index.js +2 -0
  51. package/dist/api/waba/index.js.map +1 -0
  52. package/dist/base-CdGDdVEl.d.ts +18 -0
  53. package/dist/chunk-7QBIZCJ4.js +2 -0
  54. package/dist/chunk-7QBIZCJ4.js.map +1 -0
  55. package/dist/chunk-AMHQGG6Z.js +2 -0
  56. package/dist/chunk-AMHQGG6Z.js.map +1 -0
  57. package/dist/chunk-B7DCL6I7.js +10 -0
  58. package/dist/chunk-B7DCL6I7.js.map +1 -0
  59. package/dist/chunk-CRZ7EUYR.js +2 -0
  60. package/dist/chunk-CRZ7EUYR.js.map +1 -0
  61. package/dist/chunk-FKXSL2JK.js +3 -0
  62. package/dist/chunk-FKXSL2JK.js.map +1 -0
  63. package/dist/chunk-FSKBLPGE.js +2 -0
  64. package/dist/chunk-FSKBLPGE.js.map +1 -0
  65. package/dist/chunk-HJGN3PO4.js +3 -0
  66. package/dist/chunk-HJGN3PO4.js.map +1 -0
  67. package/dist/chunk-IYSR44P6.js +2 -0
  68. package/dist/chunk-IYSR44P6.js.map +1 -0
  69. package/dist/chunk-JC6YMVID.js +2 -0
  70. package/dist/chunk-JC6YMVID.js.map +1 -0
  71. package/dist/chunk-JPAV644F.js +2 -0
  72. package/dist/chunk-JPAV644F.js.map +1 -0
  73. package/dist/chunk-JXCLRKQ7.js +2 -0
  74. package/dist/chunk-JXCLRKQ7.js.map +1 -0
  75. package/dist/chunk-KMAH6636.js +2 -0
  76. package/dist/chunk-KMAH6636.js.map +1 -0
  77. package/dist/chunk-L4ESAO2S.js +2 -0
  78. package/dist/chunk-L4ESAO2S.js.map +1 -0
  79. package/dist/chunk-LV3TULSI.js +2 -0
  80. package/dist/chunk-LV3TULSI.js.map +1 -0
  81. package/dist/chunk-MJEG3K4V.js +2 -0
  82. package/dist/chunk-MJEG3K4V.js.map +1 -0
  83. package/dist/chunk-NLF2JGYY.js +2 -0
  84. package/dist/chunk-NLF2JGYY.js.map +1 -0
  85. package/dist/chunk-OA2SW4AF.js +2 -0
  86. package/dist/chunk-OA2SW4AF.js.map +1 -0
  87. package/dist/chunk-PHPQ5HP3.js +2 -0
  88. package/dist/chunk-PHPQ5HP3.js.map +1 -0
  89. package/dist/chunk-RIL6QABY.js +2 -0
  90. package/dist/chunk-RIL6QABY.js.map +1 -0
  91. package/dist/chunk-RWCVPWRC.js +2 -0
  92. package/dist/chunk-RWCVPWRC.js.map +1 -0
  93. package/dist/chunk-SNNRWNGZ.js +2 -0
  94. package/dist/chunk-SNNRWNGZ.js.map +1 -0
  95. package/dist/chunk-UCBYECNQ.js +2 -0
  96. package/dist/chunk-UCBYECNQ.js.map +1 -0
  97. package/dist/chunk-VHAODWCN.js +2 -0
  98. package/dist/chunk-VHAODWCN.js.map +1 -0
  99. package/dist/chunk-WGGN32O2.js +2 -0
  100. package/dist/chunk-WGGN32O2.js.map +1 -0
  101. package/dist/common-DDXsNyLF.d.ts +376 -0
  102. package/dist/core/webhook/frameworks/express.d.ts +48 -0
  103. package/dist/core/webhook/frameworks/express.js +2 -0
  104. package/dist/core/webhook/frameworks/express.js.map +1 -0
  105. package/dist/core/webhook/frameworks/nextjs.d.ts +44 -0
  106. package/dist/core/webhook/frameworks/nextjs.js +2 -0
  107. package/dist/core/webhook/frameworks/nextjs.js.map +1 -0
  108. package/dist/core/webhook/index.d.ts +26 -0
  109. package/dist/core/webhook/index.js +2 -0
  110. package/dist/core/webhook/index.js.map +1 -0
  111. package/dist/core/whatsapp/index.d.ts +40 -0
  112. package/dist/core/whatsapp/index.js +2 -0
  113. package/dist/core/whatsapp/index.js.map +1 -0
  114. package/dist/enums-BZd9T2ul.d.ts +707 -0
  115. package/dist/httpsClient-v4gmltzS.d.ts +19 -0
  116. package/dist/index.d.ts +22 -0
  117. package/dist/index.js +2 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/logger-BdE0Vyim.d.ts +9 -0
  120. package/dist/request-vYMaEfk5.d.ts +50 -0
  121. package/dist/types/config.d.ts +78 -0
  122. package/dist/types/config.js +2 -0
  123. package/dist/types/config.js.map +1 -0
  124. package/dist/types/enums.d.ts +1 -0
  125. package/dist/types/enums.js +2 -0
  126. package/dist/types/enums.js.map +1 -0
  127. package/dist/types/index.d.ts +6 -0
  128. package/dist/types/index.js +2 -0
  129. package/dist/types/index.js.map +1 -0
  130. package/dist/utils/index.d.ts +98 -0
  131. package/dist/utils/index.js +2 -0
  132. package/dist/utils/index.js.map +1 -0
  133. package/package.json +240 -8
@@ -0,0 +1,82 @@
1
+ import { WabaConfigType, WhatsAppConfig } from './types/config.js';
2
+ import { H as HttpMethodsEnum, l as SDKEnums } from './enums-BZd9T2ul.js';
3
+ import { R as RequesterClass } from './request-vYMaEfk5.js';
4
+ import { H as HttpsClientClass, a as HttpsClientResponseClass } from './httpsClient-v4gmltzS.js';
5
+ import { Agent } from 'https';
6
+ import { E as EncryptionApi } from './EncryptionApi-D7pt-OXT.js';
7
+ import { F as FlowApi } from './FlowApi-UAvzhJfV.js';
8
+ import { M as MediaApi } from './MediaApi-BrEKpqi_.js';
9
+ import { M as MessagesApi } from './MessageApi-Circorzz.js';
10
+ import { P as PhoneNumberApi } from './PhoneNumberApi-DKlu9PHl.js';
11
+ import { B as BusinessProfileApi } from './BusinessProfileApi-WXscSgo-.js';
12
+ import { Q as QrCodeApi } from './QrCodeApi-7vDwIBHR.js';
13
+ import { R as RegistrationApi } from './RegistrationApi-qO_qoti9.js';
14
+ import { T as TemplateApi } from './TemplateApi-xGgIZt89.js';
15
+ import { T as TwoStepVerificationApi } from './TwoStepVerificationApi-DfNPIz-C.js';
16
+ import { W as WabaApi } from './WabaApi-DqQi_68m.js';
17
+
18
+ declare class HttpsClient implements HttpsClientClass {
19
+ agent: Agent;
20
+ constructor();
21
+ clearSockets(): boolean;
22
+ sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
23
+ }
24
+
25
+ declare class Requester implements RequesterClass {
26
+ client: Readonly<HttpsClient>;
27
+ accessToken: Readonly<string>;
28
+ phoneNumberId: Readonly<number>;
29
+ businessAcctId: Readonly<string>;
30
+ apiVersion: Readonly<string>;
31
+ userAgent: Readonly<string>;
32
+ host: Readonly<string>;
33
+ protocol: Readonly<string>;
34
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
35
+ buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
36
+ buildCAPIPath(endpoint: string): string;
37
+ sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
38
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
39
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
40
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
41
+ }
42
+
43
+ /**
44
+ * WhatsApp SDK Main Class following official patterns
45
+ * Provides unified access to WhatsApp Cloud API and Flows API
46
+ */
47
+ declare class WhatsApp {
48
+ config: WabaConfigType;
49
+ requester: Readonly<Requester>;
50
+ messages: MessagesApi;
51
+ media: MediaApi;
52
+ phoneNumbers: PhoneNumberApi;
53
+ twoStepVerification: TwoStepVerificationApi;
54
+ flows: FlowApi;
55
+ businessProfile: BusinessProfileApi;
56
+ templates: TemplateApi;
57
+ encryption: EncryptionApi;
58
+ qrCode: QrCodeApi;
59
+ registration: RegistrationApi;
60
+ waba: WabaApi;
61
+ constructor(config?: WhatsAppConfig);
62
+ /**
63
+ * Runtime configuration updates following official patterns
64
+ */
65
+ updateTimeout(timeout: number): void;
66
+ updateSenderNumberId(phoneNumberId: number): void;
67
+ updateAccessToken(accessToken: string): void;
68
+ /**
69
+ * Get SDK version
70
+ */
71
+ version(): string;
72
+ /**
73
+ * Static enums access
74
+ */
75
+ static get Enums(): typeof SDKEnums;
76
+ /**
77
+ * Get User-Agent string
78
+ */
79
+ getUserAgent(): string;
80
+ }
81
+
82
+ export { WhatsApp as W };
@@ -0,0 +1,10 @@
1
+ import { E as EncryptionApi } from '../../EncryptionApi-D7pt-OXT.js';
2
+ export { a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../../EncryptionApi-D7pt-OXT.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { EncryptionApi, EncryptionApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as EncryptionApi,b as default}from'../../chunk-IYSR44P6.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { F as FlowApi } from '../../FlowApi-UAvzhJfV.js';
2
+ export { C as CreateFlowResponse, F as Flow, b as FlowActionEnum, c as FlowAssetsResponse, d as FlowCategoryEnum, e as FlowClass, f as FlowEndpointRequest, g as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, a as FlowType, l as FlowTypeEnum, m as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../common-DDXsNyLF.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { FlowApi, FlowApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as FlowApi,b as default}from'../../chunk-JC6YMVID.js';export{a as FlowTypeEnum}from'../../chunk-NLF2JGYY.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,16 @@
1
+ export { E as EncryptionApi, a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../EncryptionApi-D7pt-OXT.js';
2
+ export { F as FlowApi } from '../FlowApi-UAvzhJfV.js';
3
+ export { C as CreateFlowResponse, F as Flow, b as FlowActionEnum, c as FlowAssetsResponse, d as FlowCategoryEnum, e as FlowClass, f as FlowEndpointRequest, g as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, a as FlowType, l as FlowTypeEnum, m as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../common-DDXsNyLF.js';
4
+ export { M as MediaApi, a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from '../MediaApi-BrEKpqi_.js';
5
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, M as MessagesApi, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../MessageApi-Circorzz.js';
6
+ export { A as AccountMode, C as CodeVerificationStatus, a as Cursors, H as HealthStatus, b as HealthStatusEntity, M as MessagingLimitTier, P as PhoneNumberApi, c as PhoneNumberClass, d as PhoneNumberResponse, e as PhoneNumbersResponse, f as PlatformType, Q as QualityRating, g as QualityScore, R as RequestVerificationCodeRequest, T as Throughput, h as ThroughputLevel, i as TwoStepVerificationParams, V as VerifyCodeRequest } from '../PhoneNumberApi-DKlu9PHl.js';
7
+ export { B as BusinessProfileApi, a as BusinessProfileClass, b as BusinessProfileData, c as BusinessProfileField, d as BusinessProfileFieldsParam, e as BusinessProfileResponse, C as CreateUploadSessionParams, G as GetUploadHandleParams, U as UpdateBusinessProfileRequest, f as UploadBusinessProfileResponse, g as UploadHandle, h as UploadMediaParams, i as UploadSession, j as UploadSessionResponse } from '../BusinessProfileApi-WXscSgo-.js';
8
+ export { C as CreateQrCodeRequest, Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse, c as QrCodesResponse, U as UpdateQrCodeRequest } from '../QrCodeApi-7vDwIBHR.js';
9
+ export { R as RegistrationApi, a as RegistrationClass, b as RegistrationRequest } from '../RegistrationApi-qO_qoti9.js';
10
+ export { T as TemplateApi, a as TemplateClass, b as TemplateDeleteParams, c as TemplateGetParams, d as TemplateRequestBody, e as TemplateResponse } from '../TemplateApi-xGgIZt89.js';
11
+ export { T as TwoStepVerificationApi, a as TwoStepVerificationClass, b as TwoStepVerificationRequest } from '../TwoStepVerificationApi-DfNPIz-C.js';
12
+ export { U as UpdateWabaSubscription, b as WABAClass, a as WabaAccount, W as WabaApi, c as WabaSubscriptions } from '../WabaApi-DqQi_68m.js';
13
+ import '../base-CdGDdVEl.js';
14
+ import '../types/config.js';
15
+ import '../enums-BZd9T2ul.js';
16
+ import '../request-vYMaEfk5.js';
@@ -0,0 +1,2 @@
1
+ import'../chunk-AMHQGG6Z.js';export{b as QrCodeApi}from'../chunk-JPAV644F.js';export{b as RegistrationApi}from'../chunk-PHPQ5HP3.js';export{b as EncryptionApi}from'../chunk-IYSR44P6.js';export{b as TwoStepVerificationApi}from'../chunk-SNNRWNGZ.js';export{b as WabaApi}from'../chunk-L4ESAO2S.js';export{b as MessagesApi}from'../chunk-7QBIZCJ4.js';export{b as MediaApi}from'../chunk-JXCLRKQ7.js';export{b as BusinessProfileApi}from'../chunk-LV3TULSI.js';import'../chunk-CRZ7EUYR.js';export{b as FlowApi}from'../chunk-JC6YMVID.js';import'../chunk-NLF2JGYY.js';export{b as PhoneNumberApi}from'../chunk-FSKBLPGE.js';export{a as TemplateApi}from'../chunk-VHAODWCN.js';import'../chunk-MJEG3K4V.js';import'../chunk-RIL6QABY.js';import'../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { M as MediaApi } from '../../MediaApi-BrEKpqi_.js';
2
+ export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from '../../MediaApi-BrEKpqi_.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { MediaApi, MediaApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as MediaApi,b as default}from'../../chunk-JXCLRKQ7.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { M as MessagesApi } from '../../MessageApi-Circorzz.js';
2
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../../MessageApi-Circorzz.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { MessagesApi as MessageApi, MessagesApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as MessageApi,b as default}from'../../chunk-7QBIZCJ4.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { P as PhoneNumberApi } from '../../PhoneNumberApi-DKlu9PHl.js';
2
+ export { A as AccountMode, C as CodeVerificationStatus, a as Cursors, H as HealthStatus, b as HealthStatusEntity, M as MessagingLimitTier, c as PhoneNumberClass, d as PhoneNumberResponse, e as PhoneNumbersResponse, f as PlatformType, Q as QualityRating, g as QualityScore, R as RequestVerificationCodeRequest, T as Throughput, h as ThroughputLevel, i as TwoStepVerificationParams, V as VerifyCodeRequest } from '../../PhoneNumberApi-DKlu9PHl.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { PhoneNumberApi, PhoneNumberApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as PhoneNumberApi,b as default}from'../../chunk-FSKBLPGE.js';import'../../chunk-MJEG3K4V.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { B as BusinessProfileApi } from '../../BusinessProfileApi-WXscSgo-.js';
2
+ export { a as BusinessProfileClass, b as BusinessProfileData, c as BusinessProfileField, d as BusinessProfileFieldsParam, e as BusinessProfileResponse, C as CreateUploadSessionParams, G as GetUploadHandleParams, U as UpdateBusinessProfileRequest, f as UploadBusinessProfileResponse, g as UploadHandle, h as UploadMediaParams, i as UploadSession, j as UploadSessionResponse } from '../../BusinessProfileApi-WXscSgo-.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { BusinessProfileApi, BusinessProfileApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as BusinessProfileApi,b as default}from'../../chunk-LV3TULSI.js';import'../../chunk-CRZ7EUYR.js';import'../../chunk-MJEG3K4V.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { Q as QrCodeApi } from '../../QrCodeApi-7vDwIBHR.js';
2
+ export { C as CreateQrCodeRequest, a as QrCodeClass, b as QrCodeResponse, c as QrCodesResponse, U as UpdateQrCodeRequest } from '../../QrCodeApi-7vDwIBHR.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { QrCodeApi, QrCodeApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as QrCodeApi,b as default}from'../../chunk-JPAV644F.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { R as RegistrationApi } from '../../RegistrationApi-qO_qoti9.js';
2
+ export { a as RegistrationClass, b as RegistrationRequest } from '../../RegistrationApi-qO_qoti9.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { RegistrationApi, RegistrationApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as RegistrationApi,b as default}from'../../chunk-PHPQ5HP3.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,215 @@
1
+ import { f as TemplateFormat, d as TemplateRequestBody } from '../../TemplateApi-xGgIZt89.js';
2
+ export { C as CatalogButton, g as ComponentTypes, h as CopyCodeButton, F as FlowButton, M as MPMButton, q as MediaCarouselCard, O as OTPButton, P as PhoneNumberButton, r as ProductCarouselCard, Q as QuickReplyButton, S as SPMButton, T as TemplateApi, i as TemplateBody, j as TemplateButton, k as TemplateButtons, l as TemplateCarousel, a as TemplateClass, b as TemplateDeleteParams, m as TemplateFooter, c as TemplateGetParams, n as TemplateHeader, o as TemplateHeaderExample, p as TemplateLimitedTimeOffer, e as TemplateResponse, U as URLButton, T as default } from '../../TemplateApi-xGgIZt89.js';
3
+ import { L as LanguagesEnum, i as CurrencyCodesEnum, a as CategoryEnum } from '../../enums-BZd9T2ul.js';
4
+ import '../../base-CdGDdVEl.js';
5
+ import '../../types/config.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+ interface TextParameter {
9
+ type: 'text';
10
+ value: string;
11
+ }
12
+ interface CurrencyParameter {
13
+ type: 'currency';
14
+ amount_1000: number;
15
+ code: CurrencyCodesEnum;
16
+ fallback_value: string;
17
+ }
18
+ interface DateTimeParameter {
19
+ type: 'date_time';
20
+ fallback_value: string;
21
+ }
22
+ interface MediaParameter {
23
+ type: 'image' | 'video' | 'document';
24
+ handle?: string;
25
+ link?: string;
26
+ }
27
+ interface LocationParameter {
28
+ type: 'location';
29
+ latitude?: number;
30
+ longitude?: number;
31
+ name?: string;
32
+ address?: string;
33
+ }
34
+ interface ProductParameter {
35
+ type: 'product';
36
+ product_retailer_id: string;
37
+ }
38
+ type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
39
+ interface HeaderOptions {
40
+ format: TemplateFormat;
41
+ text?: string;
42
+ parameters?: TemplateParameter[];
43
+ example?: {
44
+ header_text?: string[];
45
+ header_text_named_params?: Array<{
46
+ param_name: string;
47
+ example: string;
48
+ }>;
49
+ header_handle?: string[];
50
+ };
51
+ }
52
+ interface BodyOptions {
53
+ text: string;
54
+ parameters?: TemplateParameter[];
55
+ example?: {
56
+ body_text?: string[][];
57
+ body_text_named_params?: Array<{
58
+ param_name: string;
59
+ example: string;
60
+ }>;
61
+ };
62
+ }
63
+ interface FooterOptions {
64
+ text: string;
65
+ }
66
+ interface ButtonOptions {
67
+ phone_number?: {
68
+ text: string;
69
+ phone_number: string;
70
+ };
71
+ url?: {
72
+ text: string;
73
+ url: string;
74
+ example?: string;
75
+ };
76
+ quick_reply?: {
77
+ text: string;
78
+ }[];
79
+ copy_code?: {
80
+ example: string;
81
+ };
82
+ flow?: {
83
+ text: string;
84
+ flow_id?: string;
85
+ flow_name?: string;
86
+ flow_json?: string;
87
+ flow_action?: 'navigate' | 'data_exchange';
88
+ navigate_screen?: string;
89
+ };
90
+ mpm?: boolean;
91
+ otp?: boolean;
92
+ spm?: boolean;
93
+ }
94
+ interface CarouselCard {
95
+ image?: string;
96
+ video?: string;
97
+ product?: string;
98
+ body?: string;
99
+ bodyParameters?: TemplateParameter[];
100
+ buttons?: ButtonOptions;
101
+ }
102
+ interface CarouselOptions {
103
+ cards: CarouselCard[];
104
+ }
105
+ interface LimitedTimeOfferOptions {
106
+ expiration_time_ms: number;
107
+ }
108
+ interface ProductSection {
109
+ title?: string;
110
+ product_items: Array<{
111
+ product_retailer_id: string;
112
+ }>;
113
+ }
114
+ interface TemplateOptions {
115
+ name: string;
116
+ language: LanguagesEnum;
117
+ category: CategoryEnum;
118
+ header?: HeaderOptions;
119
+ body?: BodyOptions;
120
+ footer?: FooterOptions;
121
+ buttons?: ButtonOptions;
122
+ carousel?: CarouselOptions;
123
+ limitedTimeOffer?: LimitedTimeOfferOptions;
124
+ }
125
+ interface OTPTemplateOptions {
126
+ name: string;
127
+ language: LanguagesEnum;
128
+ code_expiration_minutes?: number;
129
+ add_security_recommendation?: boolean;
130
+ }
131
+ interface AuthenticationTemplateOptions {
132
+ name: string;
133
+ language: LanguagesEnum;
134
+ code_expiration_minutes?: number;
135
+ add_security_recommendation?: boolean;
136
+ copy_code_button?: boolean;
137
+ }
138
+ interface CatalogTemplateOptions {
139
+ name: string;
140
+ language: LanguagesEnum;
141
+ header?: Omit<HeaderOptions, 'format'>;
142
+ body: BodyOptions;
143
+ footer?: FooterOptions;
144
+ thumbnail_product_retailer_id: string;
145
+ }
146
+ interface CouponTemplateOptions {
147
+ name: string;
148
+ language: LanguagesEnum;
149
+ header?: Omit<HeaderOptions, 'format'>;
150
+ body: BodyOptions;
151
+ footer?: FooterOptions;
152
+ coupon_code: string;
153
+ }
154
+ interface LimitedTimeOfferTemplateOptions {
155
+ name: string;
156
+ language: LanguagesEnum;
157
+ header?: Omit<HeaderOptions, 'format'>;
158
+ body: BodyOptions;
159
+ footer?: FooterOptions;
160
+ expiration_time_ms: number;
161
+ }
162
+ interface MediaCardCarouselTemplateOptions {
163
+ name: string;
164
+ language: LanguagesEnum;
165
+ cards: Array<{
166
+ header: {
167
+ format: 'IMAGE' | 'VIDEO';
168
+ example: {
169
+ header_handle: string[];
170
+ };
171
+ };
172
+ body: BodyOptions;
173
+ buttons?: ButtonOptions;
174
+ }>;
175
+ }
176
+ interface MPMTemplateOptions {
177
+ name: string;
178
+ language: LanguagesEnum;
179
+ header?: Omit<HeaderOptions, 'format'>;
180
+ body: BodyOptions;
181
+ footer?: FooterOptions;
182
+ thumbnail_product_retailer_id: string;
183
+ sections: ProductSection[];
184
+ }
185
+ interface ProductCardCarouselTemplateOptions {
186
+ name: string;
187
+ language: LanguagesEnum;
188
+ header?: Omit<HeaderOptions, 'format'>;
189
+ body: BodyOptions;
190
+ footer?: FooterOptions;
191
+ cards: Array<{
192
+ product_retailer_id: string;
193
+ }>;
194
+ }
195
+ interface SPMTemplateOptions {
196
+ name: string;
197
+ language: LanguagesEnum;
198
+ header?: Omit<HeaderOptions, 'format'>;
199
+ body: BodyOptions;
200
+ footer?: FooterOptions;
201
+ product_retailer_id: string;
202
+ }
203
+
204
+ declare function createTemplate(options: TemplateOptions): TemplateRequestBody;
205
+ declare function createOTPTemplate(options: OTPTemplateOptions): TemplateRequestBody;
206
+ declare function createAuthenticationTemplate(options: AuthenticationTemplateOptions): TemplateRequestBody;
207
+ declare function createCatalogTemplate(options: CatalogTemplateOptions): TemplateRequestBody;
208
+ declare function createCouponTemplate(options: CouponTemplateOptions): TemplateRequestBody;
209
+ declare function createLimitedTimeOfferTemplate(options: LimitedTimeOfferTemplateOptions): TemplateRequestBody;
210
+ declare function createMediaCardCarouselTemplate(options: MediaCardCarouselTemplateOptions): TemplateRequestBody;
211
+ declare function createMPMTemplate(options: MPMTemplateOptions): TemplateRequestBody;
212
+ declare function createProductCardCarouselTemplate(options: ProductCardCarouselTemplateOptions): TemplateRequestBody;
213
+ declare function createSPMTemplate(options: SPMTemplateOptions): TemplateRequestBody;
214
+
215
+ export { type AuthenticationTemplateOptions, type BodyOptions, type ButtonOptions, type CarouselCard, type CarouselOptions, type CatalogTemplateOptions, type CouponTemplateOptions, type CurrencyParameter, type DateTimeParameter, type FooterOptions, type HeaderOptions, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type LocationParameter, type MPMTemplateOptions, type MediaCardCarouselTemplateOptions, type MediaParameter, type OTPTemplateOptions, type ProductCardCarouselTemplateOptions, type ProductParameter, type ProductSection, type SPMTemplateOptions, TemplateFormat, type TemplateOptions, type TemplateParameter, TemplateRequestBody, type TextParameter, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate };
@@ -0,0 +1,2 @@
1
+ export{a as TemplateApi,d as createAuthenticationTemplate,e as createCatalogTemplate,f as createCouponTemplate,g as createLimitedTimeOfferTemplate,i as createMPMTemplate,h as createMediaCardCarouselTemplate,c as createOTPTemplate,j as createProductCardCarouselTemplate,k as createSPMTemplate,b as createTemplate,a as default}from'../../chunk-VHAODWCN.js';import'../../chunk-MJEG3K4V.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-DfNPIz-C.js';
2
+ export { a as TwoStepVerificationClass, b as TwoStepVerificationRequest } from '../../TwoStepVerificationApi-DfNPIz-C.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { TwoStepVerificationApi, TwoStepVerificationApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as TwoStepVerificationApi,b as default}from'../../chunk-SNNRWNGZ.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import { W as WabaApi } from '../../WabaApi-DqQi_68m.js';
2
+ export { U as UpdateWabaSubscription, b as WABAClass, a as WabaAccount, c as WabaSubscriptions } from '../../WabaApi-DqQi_68m.js';
3
+ import '../../base-CdGDdVEl.js';
4
+ import '../../types/config.js';
5
+ import '../../enums-BZd9T2ul.js';
6
+ import '../../request-vYMaEfk5.js';
7
+
8
+
9
+
10
+ export { WabaApi, WabaApi as default };
@@ -0,0 +1,2 @@
1
+ export{a as WabaApi,b as default}from'../../chunk-L4ESAO2S.js';import'../../chunk-CRZ7EUYR.js';import'../../chunk-RIL6QABY.js';import'../../chunk-KMAH6636.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,18 @@
1
+ import { WabaConfigType } from './types/config.js';
2
+ import { H as HttpMethodsEnum } from './enums-BZd9T2ul.js';
3
+ import { R as RequesterClass } from './request-vYMaEfk5.js';
4
+
5
+ declare class BaseClass {
6
+ constructor(config: WabaConfigType);
7
+ }
8
+
9
+ declare class BaseAPI implements BaseClass {
10
+ protected config: WabaConfigType;
11
+ protected client: RequesterClass;
12
+ constructor(config: WabaConfigType, client: RequesterClass);
13
+ protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
14
+ protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
15
+ protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
16
+ }
17
+
18
+ export { BaseAPI as B, BaseClass as a };
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-RIL6QABY.js';var i=class extends a{commonMethod="POST";commonEndpoint="messages";constructor(e,s){super(e,s);}bodyBuilder(e,s,a,t){let n={messaging_product:"whatsapp",recipient_type:"individual",to:a,type:e,[e]:s};return t&&(n.context={message_id:t}),n}send(e){return this.sendJson(this.commonMethod,`${this.config.WA_PHONE_NUMBER_ID}/${this.commonEndpoint}`,this.config.REQUEST_TIMEOUT,e)}async audio(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("audio",s,a,t)))}async contacts(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("contacts",s,a,t)))}async document(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("document",s,a,t)))}async image(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("image",s,a,t)))}async interactive(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("interactive",s,a,t)))}async location(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("location",s,a,t)))}async sticker(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("sticker",s,a,t)))}async template(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("template",s,a,t)))}async text(e){let{body:s,to:a,replyMessageId:t,previewUrl:n}=e,o=typeof s=="string"?{body:s,preview_url:n}:{...s,preview_url:n??s.preview_url};return this.send(JSON.stringify(this.bodyBuilder("text",o,a,t)))}async video(e){let{body:s,to:a,replyMessageId:t}=e;return this.send(JSON.stringify(this.bodyBuilder("video",s,a,t)))}async status(e){let s={messaging_product:"whatsapp",status:e.status,message_id:e.messageId,...e.typingIndicator&&{typing_indicator:e.typingIndicator}};return this.send(JSON.stringify(s))}async markAsRead(e){return this.status({status:"read",messageId:e.messageId})}async showTypingIndicator(e){return this.status({status:"read",messageId:e.messageId,typingIndicator:{type:"text"}})}async interactiveList(e){return this.interactive(e)}async interactiveCtaUrl(e){return this.interactive(e)}async interactiveLocationRequest(e){return this.interactive(e)}async interactiveAddressMessage(e){return this.interactive(e)}async interactiveReplyButtons(e){return this.interactive(e)}async interactiveFlow(e){return this.interactive(e)}async reaction(e){let s={message_id:e.messageId,emoji:e.emoji};return this.send(JSON.stringify(this.bodyBuilder("reaction",s,e.to)))}};var g=i;export{i as a,g as b};//# sourceMappingURL=chunk-7QBIZCJ4.js.map
2
+ //# sourceMappingURL=chunk-7QBIZCJ4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/messages/MessageApi.ts","../src/api/messages/index.ts"],"names":["MessagesApi","BaseAPI","config","client","type","payload","to","replyMessageId","body","params","previewUrl","textPayload","reactionPayload","messages_default"],"mappings":"oCAwCA,IAAqBA,CAAAA,CAArB,cAAyCC,CAAmC,CACvD,YAAA,CAAA,MAAA,CACA,cAAA,CAAiB,UAAA,CAElC,WAAA,CAAYC,CAAAA,CAAwBC,CAAAA,CAAwB,CACxD,KAAA,CAAMD,CAAAA,CAAQC,CAAM,EACxB,CAUA,WAAA,CACIC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACF,CACE,IAAMC,CAAAA,CAAgC,CAClC,iBAAA,CAAmB,UAAA,CACnB,cAAA,CAAgB,aAChB,EAAA,CAAAF,CAAAA,CACA,IAAA,CAAAF,CAAAA,CACA,CAACA,CAAI,EAAGC,CACZ,CAAA,CAEA,OAAIE,CAAAA,GAAgBC,CAAAA,CAAK,OAAA,CAAa,CAAE,UAAA,CAAYD,CAAe,CAAA,CAAA,CAE5DC,CACX,CAOQ,IAAA,CAAKA,CAAAA,CAAoD,CAC7D,OAAO,IAAA,CAAK,QAAA,CACR,IAAA,CAAK,YAAA,CACL,CAAA,EAAG,IAAA,CAAK,MAAA,CAAO,kBAA6B,CAAA,CAAA,EAAI,KAAK,cAAc,CAAA,CAAA,CACnE,IAAA,CAAK,MAAA,CAAO,eAAA,CACZA,CACJ,CACJ,CAOA,MAAM,KAAA,CAAMC,CAAAA,CAAiF,CACzF,GAAM,CAAE,IAAA,CAAAD,CAAAA,CAAM,EAAA,CAAAF,CAAAA,CAAI,cAAA,CAAAC,CAAe,CAAA,CAAIE,CAAAA,CACrC,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,SAAA,CAAU,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AC3B,OAAO,KAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,iBAAA,CACFA,CAAAA,CAC2B,CAC3B,OAAO,IAAA,CAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,0BAAA,CACFA,EAC2B,CAC3B,OAAO,IAAA,CAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,yBAAA,CACFA,CAAAA,CAC2B,CAC3B,OAAO,IAAA,CAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,uBAAA,CACFA,CAAAA,CAC2B,CAC3B,OAAO,IAAA,CAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,eAAA,CACFA,CAAAA,CAC2B,CAC3B,OAAO,KAAK,WAAA,CAAYA,CAAM,CAClC,CAOA,MAAM,QAAA,CAASA,CAAAA,CAAuD,CAClE,IAAMG,CAAAA,CAAkB,CACpB,UAAA,CAAYH,CAAAA,CAAO,SAAA,CACnB,KAAA,CAAOA,CAAAA,CAAO,KAClB,CAAA,CAEA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,WAAA,CAAA,UAAA,CAAuCG,CAAAA,CAAiBH,CAAAA,CAAO,EAAE,CAAC,CAAC,CAC5G,CACJ,MC5TOI,CAAAA,CAAQb","file":"chunk-7QBIZCJ4.js","sourcesContent":["import { BaseAPI } from '../../types/base';\nimport type { WabaConfigType } from '../../types/config';\nimport {\n type ComponentTypesEnum,\n HttpMethodsEnum,\n type InteractiveTypesEnum,\n MessageTypesEnum,\n WabaConfigEnum,\n} from '../../types/enums';\nimport type { RequesterClass } from '../../types/request';\n\nimport type * as m from './types';\n\n/**\n * Maps each message type to its appropriate payload type\n */\nexport type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio\n ? m.AudioMediaObject\n : T extends MessageTypesEnum.Contacts\n ? [m.ContactObject]\n : T extends MessageTypesEnum.Document\n ? m.DocumentMediaObject\n : T extends MessageTypesEnum.Image\n ? m.ImageMediaObject\n : T extends MessageTypesEnum.Interactive\n ? m.InteractiveObject\n : T extends MessageTypesEnum.Location\n ? m.LocationObject\n : T extends MessageTypesEnum.Template\n ? m.MessageTemplateObject<ComponentTypesEnum>\n : T extends MessageTypesEnum.Sticker\n ? m.StickerMediaObject\n : T extends MessageTypesEnum.Text\n ? m.TextObject\n : T extends MessageTypesEnum.Video\n ? m.VideoMediaObject\n : T extends MessageTypesEnum.Reaction\n ? { message_id: string; emoji: string }\n : never;\n\nexport default class MessagesApi extends BaseAPI implements m.MessagesClass {\n private readonly commonMethod = HttpMethodsEnum.Post;\n private readonly commonEndpoint = 'messages';\n\n constructor(config: WabaConfigType, client: RequesterClass) {\n super(config, client);\n }\n\n /**\n * Builds the request body for WhatsApp API messages\n * @param type The type of message to send\n * @param payload The message payload object\n * @param to The recipient's phone number\n * @param replyMessageId Optional message ID to reply to\n * @returns The formatted request body\n */\n bodyBuilder<T extends MessageTypesEnum>(\n type: T,\n payload: MessagePayloadType<T>,\n to: string,\n replyMessageId?: string,\n ) {\n const body: m.MessageRequestBody<T> = {\n messaging_product: 'whatsapp',\n recipient_type: 'individual',\n to,\n type,\n [type]: payload,\n };\n\n if (replyMessageId) body['context'] = { message_id: replyMessageId };\n\n return body;\n }\n\n /**\n * Sends a request to the WhatsApp API\n * @param body The request body to send\n * @returns Promise with the API response\n */\n private send(body: BodyInit | null): Promise<m.MessagesResponse> {\n return this.sendJson(\n this.commonMethod,\n `${this.config[WabaConfigEnum.PhoneNumberId]}/${this.commonEndpoint}`,\n this.config[WabaConfigEnum.RequestTimeout],\n body,\n );\n }\n\n /**\n * Sends an audio message via WhatsApp\n * @param params The audio message parameter object\n * @returns Promise with the message response\n */\n async audio(params: m.MessageRequestParams<m.AudioMediaObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Audio, body, to, replyMessageId)));\n }\n\n /**\n * Sends a contact card via WhatsApp\n * @param params The contact message parameter object\n * @returns Promise with the message response\n */\n async contacts(params: m.MessageRequestParams<[m.ContactObject]>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Contacts, body, to, replyMessageId)));\n }\n\n /**\n * Sends a document via WhatsApp\n * @param params The document message parameter object\n * @returns Promise with the message response\n */\n async document(params: m.MessageRequestParams<m.DocumentMediaObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Document, body, to, replyMessageId)));\n }\n\n /**\n * Sends an image via WhatsApp\n * @param params The image message parameter object\n * @returns Promise with the message response\n */\n async image(params: m.MessageRequestParams<m.ImageMediaObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Image, body, to, replyMessageId)));\n }\n\n /**\n * Sends an interactive message via WhatsApp\n * @param params The interactive message parameter object\n * @returns Promise with the message response\n */\n async interactive(params: m.MessageRequestParams<m.InteractiveObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Interactive, body, to, replyMessageId)));\n }\n\n /**\n * Sends a location via WhatsApp\n * @param params The location message parameter object\n * @returns Promise with the message response\n */\n async location(params: m.MessageRequestParams<m.LocationObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Location, body, to, replyMessageId)));\n }\n\n /**\n * Sends a sticker via WhatsApp\n * @param params The sticker message parameter object\n * @returns Promise with the message response\n */\n async sticker(params: m.MessageRequestParams<m.StickerMediaObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Sticker, body, to, replyMessageId)));\n }\n\n /**\n * Sends a template message via WhatsApp\n * @param params The template message parameter object\n * @returns Promise with the message response\n */\n async template(\n params: m.MessageRequestParams<m.MessageTemplateObject<ComponentTypesEnum>>,\n ): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Template, body, to, replyMessageId)));\n }\n\n /**\n * Sends a text message via WhatsApp\n * @param params The text message parameter object\n * @returns Promise with the message response\n */\n async text(params: m.TextMessageParams): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId, previewUrl } = params;\n\n // Handle both string and TextObject types\n const textPayload: m.TextObject =\n typeof body === 'string'\n ? { body, preview_url: previewUrl }\n : { ...body, preview_url: previewUrl ?? body.preview_url };\n\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Text, textPayload, to, replyMessageId)));\n }\n\n /**\n * Sends a video message via WhatsApp\n * @param params The video message parameter object\n * @returns Promise with the message response\n */\n async video(params: m.MessageRequestParams<m.VideoMediaObject>): Promise<m.MessagesResponse> {\n const { body, to, replyMessageId } = params;\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Video, body, to, replyMessageId)));\n }\n\n /**\n * Updates message status (mark as read, etc.)\n * @param params The status update parameters\n * @returns Promise with the API response\n */\n async status(params: m.StatusParams): Promise<m.MessagesResponse> {\n const body = {\n messaging_product: 'whatsapp',\n status: params.status,\n message_id: params.messageId,\n ...(params.typingIndicator && { typing_indicator: params.typingIndicator }),\n };\n\n return this.send(JSON.stringify(body));\n }\n\n /**\n * Marks a message as read\n * @param params Object containing messageId\n * @returns Promise with the API response\n */\n async markAsRead(params: { messageId: string }): Promise<m.MessagesResponse> {\n return this.status({\n status: 'read',\n messageId: params.messageId,\n });\n }\n\n /**\n * Shows typing indicator\n * @param params Object containing messageId\n * @returns Promise with the API response\n */\n async showTypingIndicator(params: { messageId: string }): Promise<m.MessagesResponse> {\n return this.status({\n status: 'read',\n messageId: params.messageId,\n typingIndicator: { type: 'text' },\n });\n }\n\n /**\n * Sends a list interactive message\n * @param params The list interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveList(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.List }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends a CTA URL interactive message\n * @param params The CTA URL interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveCtaUrl(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.CtaUrl }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends a location request interactive message\n * @param params The location request interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveLocationRequest(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.LocationRequest }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends an address message interactive message\n * @param params The address message interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveAddressMessage(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.AddressMessage }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends a reply buttons interactive message\n * @param params The reply buttons interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveReplyButtons(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.Button }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends a flow interactive message\n * @param params The flow interactive message parameters\n * @returns Promise with the message response\n */\n async interactiveFlow(\n params: m.MessageRequestParams<m.InteractiveObject & { type: InteractiveTypesEnum.Flow }>,\n ): Promise<m.MessagesResponse> {\n return this.interactive(params);\n }\n\n /**\n * Sends a reaction to a message\n * @param params The reaction parameters\n * @returns Promise with the message response\n */\n async reaction(params: m.ReactionParams): Promise<m.MessagesResponse> {\n const reactionPayload = {\n message_id: params.messageId,\n emoji: params.emoji,\n };\n\n return this.send(JSON.stringify(this.bodyBuilder(MessageTypesEnum.Reaction, reactionPayload, params.to)));\n }\n}\n","import MessageApi from './MessageApi';\n\nexport default MessageApi;\n\nexport { MessageApi };\n\nexport type {\n AudioMediaObject,\n ContactObject,\n DocumentMediaObject,\n ImageMediaObject,\n InteractiveObject,\n LocationObject,\n MessageRequestParams,\n MessageTemplateObject,\n MessagesResponse,\n ReactionParams,\n StatusParams,\n StickerMediaObject,\n TextMessageParams,\n TextObject,\n VideoMediaObject,\n} from './types';\n"]}
@@ -0,0 +1,2 @@
1
+ //# sourceMappingURL=chunk-AMHQGG6Z.js.map
2
+ //# sourceMappingURL=chunk-AMHQGG6Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-AMHQGG6Z.js"}