meta-cloud-api 0.2.39 → 0.2.40

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.
@@ -105,6 +105,14 @@ type TemplateCarousel = {
105
105
  components: ComponentTypes[];
106
106
  }>;
107
107
  };
108
+ type MediaCarouselCard = {
109
+ card_index: number;
110
+ components: (TemplateHeader | TemplateBody | TemplateButtons)[];
111
+ };
112
+ type ProductCarouselCard = {
113
+ card_index: number;
114
+ components: TemplateHeader[];
115
+ };
108
116
  type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
109
117
  type TemplateRequestBody = GeneralRequestBody & {
110
118
  name: string;
@@ -149,4 +157,4 @@ declare class TemplateApi extends BaseAPI implements TemplateClass {
149
157
  deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
150
158
  }
151
159
 
152
- export { type CatalogButton as C, type FlowButton as F, type MPMButton as M, type OTPButton as O, type PhoneNumberButton as P, type QuickReplyButton as Q, type SPMButton as S, type TemplateFormat as T, type URLButton as U, type TemplateRequestBody as a, TemplateClass as b, type TemplateDeleteParams as c, type TemplateGetParams as d, type TemplateResponse as e, TemplateApi as f, type ComponentTypes as g, type CopyCodeButton as h, type TemplateBody as i, type TemplateButton as j, type TemplateButtons as k, type TemplateCarousel as l, type TemplateFooter as m, type TemplateHeader as n, type TemplateHeaderExample as o, type TemplateLimitedTimeOffer as p };
160
+ export { type CatalogButton as C, type FlowButton as F, type MPMButton as M, type OTPButton as O, type PhoneNumberButton as P, type QuickReplyButton as Q, type SPMButton as S, type TemplateFormat as T, type URLButton as U, type TemplateRequestBody as a, TemplateClass as b, type TemplateDeleteParams as c, type TemplateGetParams as d, type TemplateResponse as e, TemplateApi as f, type ComponentTypes as g, type CopyCodeButton as h, type TemplateBody as i, type TemplateButton as j, type TemplateButtons as k, type TemplateCarousel as l, type TemplateFooter as m, type TemplateHeader as n, type TemplateHeaderExample as o, type TemplateLimitedTimeOffer as p, type MediaCarouselCard as q, type ProductCarouselCard as r };
@@ -1,7 +1,7 @@
1
1
  import { WabaConfigType, WhatsAppConfig } from './shared/types/config.js';
2
2
  import { M as MessageTypesEnum } from './enums-DvwSJq9w.js';
3
3
  import { g as FlowEndpointRequest, n as FlowTypeEnum } from './FlowApi-CASVC-Al.js';
4
- import { W as WhatsApp } from './index-CaRxVWvr.js';
4
+ import { W as WhatsApp } from './index-BJ5dLlEF.js';
5
5
 
6
6
  interface WebhookContact {
7
7
  /**
@@ -1,2 +1,2 @@
1
- function m(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 u(e){return {type:"FOOTER",text:e.text}}function l(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 s(e){let t=[];if(e.header&&t.push(m(e.header)),e.body&&t.push(n(e.body)),e.footer&&t.push(u(e.footer)),e.buttons&&t.push(...l(e.buttons)),e.carousel){let a=[];e.carousel.cards.forEach((r,p)=>{if(r.image||r.video||r.product){let o=r.image?"IMAGE":r.video?"VIDEO":"DOCUMENT",c=r.image||r.video||r.product||"";a.push({type:"HEADER",format:o,example:{header_handle:[c]}});}r.body&&a.push({type:"BODY",text:r.body,example:r.bodyParameters?{body_text:[f(r.bodyParameters)]}:void 0}),r.buttons&&a.push(...l(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 d(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 i(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 y(e){let t=[];return e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(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 T(e){let t=[];return e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(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 h(e){let t=[];return t.push({type:"LIMITED_TIME_OFFER",limited_time_offer:{expiration_time_ms:e.expiration_time_ms}}),e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(e.footer)),{name:e.name,language:e.language,category:"MARKETING",components:t}}function _(e){let t=[],a=[];return e.cards.forEach((r,p)=>{let o=[];o.push({type:"HEADER",format:r.header.format,example:r.header.example}),o.push(n(r.body)),r.buttons&&o.push(...l(r.buttons)),a.push({card_index:p,components:o});}),t.push({type:"CAROUSEL",cards:a}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function g(e){let t=[];return e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(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 x(e){let t=[];e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(e.footer));let a=e.cards.map((r,p)=>({card_index:p,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 O(e){let t=[];return e.header&&t.push(m({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(u(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{s as a,d as b,i as c,y as d,T as e,h as f,_ as g,g as h,x as i,O as j};//# sourceMappingURL=chunk-FLDBNTNY.js.map
2
- //# sourceMappingURL=chunk-FLDBNTNY.js.map
1
+ function u(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 p(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 d(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 f(e){let t=[];if(e.header&&t.push(u(e.header)),e.body&&t.push(n(e.body)),e.footer&&t.push(m(e.footer)),e.buttons&&t.push(...p(e.buttons)),e.carousel){let a=[];e.carousel.cards.forEach((r,l)=>{if(r.image||r.video||r.product){let o=r.image?"IMAGE":r.video?"VIDEO":"DOCUMENT",c=r.image||r.video||r.product||"";a.push({type:"HEADER",format:o,example:{header_handle:[c]}});}r.body&&a.push({type:"BODY",text:r.body,example:r.bodyParameters?{body_text:[d(r.bodyParameters)]}:void 0}),r.buttons&&a.push(...p(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 s(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 i(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 T(e){let t=[];return e.header&&t.push(u({...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 y(e){let t=[];return e.header&&t.push(u({...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 h(e){let t=[];return t.push({type:"LIMITED_TIME_OFFER",limited_time_offer:{expiration_time_ms:e.expiration_time_ms}}),e.header&&t.push(u({...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 _(e){let t=[],a=[];return e.cards.forEach((r,l)=>{let o=[];o.push({type:"HEADER",format:r.header.format,example:r.header.example}),o.push(n(r.body)),r.buttons&&o.push(...p(r.buttons)),a.push({card_index:l,components:o});}),t.push({type:"CAROUSEL",cards:a}),{name:e.name,language:e.language,category:"MARKETING",components:t}}function g(e){let t=[];return e.header&&t.push(u({...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 x(e){let t=[];e.header&&t.push(u({...e.header,format:"TEXT"})),t.push(n(e.body)),e.footer&&t.push(m(e.footer));let a=e.cards.map((r,l)=>({card_index:l,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 O(e){let t=[];return e.header&&t.push(u({...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{f as a,s as b,i as c,T as d,y as e,h as f,_ as g,g as h,x as i,O as j};//# sourceMappingURL=chunk-CNGQISKS.js.map
2
+ //# sourceMappingURL=chunk-CNGQISKS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/features/template/factories/index.ts"],"names":["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":"AA+BA,SAASA,CAAaC,CAAAA,CAAAA,CAAwC,CAC1D,IAAMC,EAAyB,CAC3B,IAAA,CAAM,QACN,CAAA,MAAA,CAAQD,CAAQ,CAAA,MACpB,CAEA,CAAA,OAAIA,EAAQ,I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A,CAChF,IAAMc,CAA+B,CAAA,EAErC,CAAA,OAAId,CAAQ,CAAA,MAAA,EACRc,CAAW,CAAA,IAAA,CAAKf,EAAa,CAAE,GAAGC,CAAQ,CAAA,MAAA,CAAQ,MAAQ,CAAA,MAAO,CAAC,CAAC,EAGvEc,CAAW,CAAA,IAAA,CAAKZ,CAAWF,CAAAA,CAAAA,CAAQ,IAAI,CAAC,CAEpCA,CAAAA,CAAAA,CAAQ,QACRc,CAAW,CAAA,IAAA,CAAKV,CAAaJ,CAAAA,CAAAA,CAAQ,MAAM,CAAC,CAIhDc,CAAAA,CAAAA,CAAW,KAAK,CACZ,IAAA,CAAM,SACN,CAAA,OAAA,CAAS,CACL,CACI,IAAM,CAAA,KAAA,CACN,OAAQ,CACJ,mBAAA,CAAqBd,CAAQ,CAAA,mBACjC,CACJ,CACJ,CACJ,CAAC,EAEM,CACH,IAAA,CAAMA,CAAQ,CAAA,IAAA,CACd,SAAUA,CAAQ,CAAA,QAAA,CAClB,QACA,CAAA,WAAA,CAAA,UAAA,CAAAc,CACJ,CACJ","file":"chunk-CNGQISKS.js","sourcesContent":["import { CategoryEnum } from '@shared/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/common';\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/factory';\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"]}
@@ -1,9 +1,9 @@
1
- export { F as FlowHandler, M as MessageStatus, W as WebhookContact, a as WebhookEvent, c as WebhookHandler, b as WebhookMessage, e as WebhookRequest, f as WebhookResponse, p as processFlowRequest, d as processWebhookMessages, v as verifyWebhook } from '../../WebhookHandler-Bo70U_Cu.js';
1
+ export { F as FlowHandler, M as MessageStatus, W as WebhookContact, a as WebhookEvent, c as WebhookHandler, b as WebhookMessage, e as WebhookRequest, f as WebhookResponse, p as processFlowRequest, d as processWebhookMessages, v as verifyWebhook } from '../../WebhookHandler-ZZQSTfZb.js';
2
2
  import '../../shared/types/config.js';
3
3
  import '../../enums-DvwSJq9w.js';
4
4
  import '../../FlowApi-CASVC-Al.js';
5
5
  import '../../base-BhCbbsxB.js';
6
- import '../../index-CaRxVWvr.js';
6
+ import '../../index-BJ5dLlEF.js';
7
7
  import '../../EncryptionApi-PHxeI2G_.js';
8
8
  import '../../MediaApi-B2vtjiCm.js';
9
9
  import '../../MessageApi-B5xedsTj.js';
@@ -11,7 +11,7 @@ import '../../PhoneNumberApi-DMb_G3uw.js';
11
11
  import '../../BusinessProfileApi-DE7Nnuy_.js';
12
12
  import '../../QrCodeApi-D3rVKuxV.js';
13
13
  import '../../RegistrationApi-DZBJWAZS.js';
14
- import '../../TemplateApi-BA19cqfG.js';
14
+ import '../../TemplateApi-BFeM9qJS.js';
15
15
  import '../../TwoStepVerificationApi-6jV5pDxS.js';
16
16
  import '../../WabaApi-B8Gv2UNE.js';
17
17
  import 'https';
@@ -1,4 +1,4 @@
1
- export { W as WhatsApp, d as WhatsAppClass } from '../../index-CaRxVWvr.js';
1
+ export { W as WhatsApp, d as WhatsAppClass } from '../../index-BJ5dLlEF.js';
2
2
  import '../../EncryptionApi-PHxeI2G_.js';
3
3
  import '../../base-BhCbbsxB.js';
4
4
  import '../../shared/types/config.js';
@@ -10,7 +10,7 @@ import '../../PhoneNumberApi-DMb_G3uw.js';
10
10
  import '../../BusinessProfileApi-DE7Nnuy_.js';
11
11
  import '../../QrCodeApi-D3rVKuxV.js';
12
12
  import '../../RegistrationApi-DZBJWAZS.js';
13
- import '../../TemplateApi-BA19cqfG.js';
13
+ import '../../TemplateApi-BFeM9qJS.js';
14
14
  import '../../TwoStepVerificationApi-6jV5pDxS.js';
15
15
  import '../../WabaApi-B8Gv2UNE.js';
16
16
  import 'https';
@@ -1,5 +1,5 @@
1
- import { T as TemplateFormat, a as TemplateRequestBody } from '../../TemplateApi-BA19cqfG.js';
2
- export { C as CatalogButton, g as ComponentTypes, h as CopyCodeButton, F as FlowButton, M as MPMButton, O as OTPButton, P as PhoneNumberButton, Q as QuickReplyButton, S as SPMButton, f as TemplateApi, i as TemplateBody, j as TemplateButton, k as TemplateButtons, l as TemplateCarousel, b as TemplateClass, c as TemplateDeleteParams, m as TemplateFooter, d as TemplateGetParams, n as TemplateHeader, o as TemplateHeaderExample, p as TemplateLimitedTimeOffer, e as TemplateResponse, U as URLButton, f as default } from '../../TemplateApi-BA19cqfG.js';
1
+ import { T as TemplateFormat, a as TemplateRequestBody } from '../../TemplateApi-BFeM9qJS.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, f as TemplateApi, i as TemplateBody, j as TemplateButton, k as TemplateButtons, l as TemplateCarousel, b as TemplateClass, c as TemplateDeleteParams, m as TemplateFooter, d as TemplateGetParams, n as TemplateHeader, o as TemplateHeaderExample, p as TemplateLimitedTimeOffer, e as TemplateResponse, U as URLButton, f as default } from '../../TemplateApi-BFeM9qJS.js';
3
3
  import { L as LanguagesEnum, C as CurrencyCodesEnum, a as CategoryEnum } from '../../enums-DvwSJq9w.js';
4
4
  import '../../base-BhCbbsxB.js';
5
5
  import '../../shared/types/config.js';
@@ -1,2 +1,2 @@
1
- export{c as createAuthenticationTemplate,d as createCatalogTemplate,e as createCouponTemplate,f as createLimitedTimeOfferTemplate,h as createMPMTemplate,g as createMediaCardCarouselTemplate,b as createOTPTemplate,i as createProductCardCarouselTemplate,j as createSPMTemplate,a as createTemplate}from'../../chunk-FLDBNTNY.js';export{a as TemplateApi,a as default}from'../../chunk-R36L2XYO.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-4O3T25CT.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
1
+ export{c as createAuthenticationTemplate,d as createCatalogTemplate,e as createCouponTemplate,f as createLimitedTimeOfferTemplate,h as createMPMTemplate,g as createMediaCardCarouselTemplate,b as createOTPTemplate,i as createProductCardCarouselTemplate,j as createSPMTemplate,a as createTemplate}from'../../chunk-CNGQISKS.js';export{a as TemplateApi,a as default}from'../../chunk-R36L2XYO.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-4O3T25CT.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -7,7 +7,7 @@ import { P as PhoneNumberApi } from './PhoneNumberApi-DMb_G3uw.js';
7
7
  import { B as BusinessProfileApi } from './BusinessProfileApi-DE7Nnuy_.js';
8
8
  import { Q as QrCodeApi } from './QrCodeApi-D3rVKuxV.js';
9
9
  import { R as RegistrationApi } from './RegistrationApi-DZBJWAZS.js';
10
- import { f as TemplateApi } from './TemplateApi-BA19cqfG.js';
10
+ import { f as TemplateApi } from './TemplateApi-BFeM9qJS.js';
11
11
  import { T as TwoStepVerificationApi } from './TwoStepVerificationApi-6jV5pDxS.js';
12
12
  import { W as WabaApi } from './WabaApi-B8Gv2UNE.js';
13
13
  import { H as HttpMethodsEnum, l as SDKEnums } from './enums-DvwSJq9w.js';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { W as WebhookContact, a as WebhookEvent, c as WebhookHandler, b as WebhookMessage } from './WebhookHandler-Bo70U_Cu.js';
1
+ export { W as WebhookContact, a as WebhookEvent, c as WebhookHandler, b as WebhookMessage } from './WebhookHandler-ZZQSTfZb.js';
2
2
  import { g as FlowEndpointRequest, o as FlowDataExchangeRequest, c as FlowActionEnum, p as FlowErrorNotificationRequest, q as FlowHealthCheckRequest } from './FlowApi-CASVC-Al.js';
3
3
  export { a as Flow, F as FlowApi, f as FlowClass, h as FlowEndpointResponse, b as FlowType, n as FlowTypeEnum } from './FlowApi-CASVC-Al.js';
4
4
  export { B as BaseAPI, d as BaseClass, e as GeneralHeaderInterface, G as GeneralRequestBody, P as Paging, a as RequesterClass, f as RequesterResponseInterface, c as ResponseData, b as ResponsePagination, R as ResponseSuccess } from './base-BhCbbsxB.js';
5
5
  export { WabaConfigType, WhatsAppConfig } from './shared/types/config.js';
6
- export { H as HttpsClientClass, a as HttpsClientResponseClass, b as ResponseHeaderValue, R as ResponseHeaders, c as ResponseJSONBody, W as WhatsApp } from './index-CaRxVWvr.js';
6
+ export { H as HttpsClientClass, a as HttpsClientResponseClass, b as ResponseHeaderValue, R as ResponseHeaders, c as ResponseJSONBody, W as WhatsApp } from './index-BJ5dLlEF.js';
7
7
  export { A as AudioMediaTypesEnum, B as BusinessVerticalEnum, b as ButtonPositionEnum, a as CategoryEnum, c as ComponentTypesEnum, d as ConversationTypesEnum, C as CurrencyCodesEnum, D as DataLocalizationRegionEnum, h as DocumentMediaTypesEnum, H as HttpMethodsEnum, g as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, k as RequestCodeMethodsEnum, e as StatusEnum, f as StickerMediaTypesEnum, S as SubTypeEnum, j as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, W as WabaConfigEnum, i as WebhookTypesEnum } from './enums-DvwSJq9w.js';
8
8
  export { E as EncryptionApi } from './EncryptionApi-PHxeI2G_.js';
9
9
  export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from './MediaApi-B2vtjiCm.js';
@@ -12,7 +12,7 @@ export { P as PhoneNumberApi, c as PhoneNumberClass, d as PhoneNumberResponse }
12
12
  export { B as BusinessProfileApi, a as BusinessProfileClass, e as BusinessProfileResponse } from './BusinessProfileApi-DE7Nnuy_.js';
13
13
  export { Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-D3rVKuxV.js';
14
14
  export { R as RegistrationApi, a as RegistrationClass } from './RegistrationApi-DZBJWAZS.js';
15
- export { f as TemplateApi, b as TemplateClass, e as TemplateResponse } from './TemplateApi-BA19cqfG.js';
15
+ export { f as TemplateApi, b as TemplateClass, e as TemplateResponse } from './TemplateApi-BFeM9qJS.js';
16
16
  export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-6jV5pDxS.js';
17
17
  export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-B8Gv2UNE.js';
18
18
  export { MetaError, isMetaError } from './shared/utils/isMetaError.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import'./chunk-FLDBNTNY.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';export{g as WebhookHandler,a as isFlowDataExchangeRequest,b as isFlowErrorRequest,c as isFlowPingRequest}from'./chunk-Y5L5GUKB.js';export{b as WhatsApp}from'./chunk-5O5GLWIE.js';export{a as isMetaError}from'./chunk-3MO3BTBC.js';export{a as TemplateApi}from'./chunk-R36L2XYO.js';import'./chunk-GT3XQN7Y.js';export{b as RegistrationApi}from'./chunk-O2OTHNWM.js';export{b as EncryptionApi}from'./chunk-7NQLQPLH.js';export{b as TwoStepVerificationApi}from'./chunk-UQPD6GIF.js';export{b as WabaApi}from'./chunk-5JGM556C.js';export{b as MessagesApi}from'./chunk-2NJVBJUN.js';import'./chunk-XPPDOFBN.js';export{b as BusinessProfileApi}from'./chunk-KFPOVYEJ.js';export{a as buildFieldsQueryString}from'./chunk-7GL74SXM.js';export{c as FlowApi}from'./chunk-LGLRGXCE.js';export{b as PhoneNumberApi}from'./chunk-GIQLIMOD.js';export{a as objectToQueryString}from'./chunk-BZ5QDXNR.js';export{b as BaseAPI,a as Logger}from'./chunk-VW3LGHTJ.js';export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,g as ButtonPositionEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,h as SubTypeEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'./chunk-4O3T25CT.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
1
+ import'./chunk-CNGQISKS.js';export{a as QrCodeApi}from'./chunk-I222VSWK.js';export{g as WebhookHandler,a as isFlowDataExchangeRequest,b as isFlowErrorRequest,c as isFlowPingRequest}from'./chunk-Y5L5GUKB.js';export{b as WhatsApp}from'./chunk-5O5GLWIE.js';export{a as isMetaError}from'./chunk-3MO3BTBC.js';export{a as TemplateApi}from'./chunk-R36L2XYO.js';import'./chunk-GT3XQN7Y.js';export{b as RegistrationApi}from'./chunk-O2OTHNWM.js';export{b as EncryptionApi}from'./chunk-7NQLQPLH.js';export{b as TwoStepVerificationApi}from'./chunk-UQPD6GIF.js';export{b as WabaApi}from'./chunk-5JGM556C.js';export{b as MessagesApi}from'./chunk-2NJVBJUN.js';import'./chunk-XPPDOFBN.js';export{b as BusinessProfileApi}from'./chunk-KFPOVYEJ.js';export{a as buildFieldsQueryString}from'./chunk-7GL74SXM.js';export{c as FlowApi}from'./chunk-LGLRGXCE.js';export{b as PhoneNumberApi}from'./chunk-GIQLIMOD.js';export{a as objectToQueryString}from'./chunk-BZ5QDXNR.js';export{b as BaseAPI,a as Logger}from'./chunk-VW3LGHTJ.js';export{q as AudioMediaTypesEnum,y as BusinessVerticalEnum,g as ButtonPositionEnum,a as CategoryEnum,i as ComponentTypesEnum,k as ConversationTypesEnum,w as CurrencyCodesEnum,x as DataLocalizationRegionEnum,p as DocumentMediaTypesEnum,c as HttpMethodsEnum,o as ImageMediaTypesEnum,f as InteractiveTypesEnum,v as LanguagesEnum,d as MessageTypesEnum,e as ParametersTypesEnum,t as ReferralSourceTypesEnum,u as RequestCodeMethodsEnum,l as StatusEnum,n as StickerMediaTypesEnum,h as SubTypeEnum,s as SystemChangeTypesEnum,b as TemplateStatusEnum,m as VideoMediaTypesEnum,j as WabaConfigEnum,r as WebhookTypesEnum}from'./chunk-4O3T25CT.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meta-cloud-api",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "TypeScript wrapper for Meta's Cloud API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/features/template/factories/index.ts"],"names":["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":"AA4BA,SAASA,CAAaC,CAAAA,CAAAA,CAAwC,CAC1D,IAAMC,EAAyB,CAC3B,IAAA,CAAM,QACN,CAAA,MAAA,CAAQD,CAAQ,CAAA,MACpB,CAEA,CAAA,OAAIA,EAAQ,IACRC,GAAAA,CAAAA,CAAO,IAAOD,CAAAA,CAAAA,CAAQ,IAGtBA,CAAAA,CAAAA,CAAAA,CAAQ,OACRC,GAAAA,CAAAA,CAAO,QAAUD,CAAQ,CAAA,OAAA,CAAA,CAGtBC,CACX,CAGA,SAASC,CAAAA,CAAWF,CAAoC,CAAA,CACpD,IAAMG,CAAqB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A,CAAAA,CAAQ,IAAI,CAAC,CAEpCA,CAAAA,CAAAA,CAAQ,QACRc,CAAW,CAAA,IAAA,CAAKV,CAAaJ,CAAAA,CAAAA,CAAQ,MAAM,CAAC,CAIhDc,CAAAA,CAAAA,CAAW,KAAK,CACZ,IAAA,CAAM,SACN,CAAA,OAAA,CAAS,CACL,CACI,IAAM,CAAA,KAAA,CACN,OAAQ,CACJ,mBAAA,CAAqBd,CAAQ,CAAA,mBACjC,CACJ,CACJ,CACJ,CAAC,EAEM,CACH,IAAA,CAAMA,CAAQ,CAAA,IAAA,CACd,SAAUA,CAAQ,CAAA,QAAA,CAClB,QACA,CAAA,WAAA,CAAA,UAAA,CAAAc,CACJ,CACJ","file":"chunk-FLDBNTNY.js","sourcesContent":["import { CategoryEnum } from '@shared/types/enums';\nimport type {\n ComponentTypes,\n TemplateBody,\n TemplateButton,\n TemplateFooter,\n TemplateHeader,\n TemplateRequestBody,\n} from '../types/common';\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/factory';\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 as any,\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 } as any);\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' }] as any,\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 ] as any,\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 ] as any,\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 ] as any,\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 } as any);\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: any[] = [];\n options.cards.forEach((card, index) => {\n const cardComponents: any[] = [];\n\n // Add header (media)\n cardComponents.push({\n type: 'HEADER',\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));\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 } as any);\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 ] as any,\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: any[] = options.cards.map((card, index) => ({\n card_index: index,\n components: [\n {\n type: 'HEADER',\n format: 'PRODUCT',\n example: {\n header_handle: [card.product_retailer_id],\n },\n },\n ],\n }));\n\n components.push({\n type: 'CAROUSEL',\n cards: carouselCards,\n } as any);\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 ] as any,\n });\n\n return {\n name: options.name,\n language: options.language,\n category: CategoryEnum.Marketing,\n components,\n };\n}\n"]}