better-zap 0.0.2 → 0.0.4

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.
@@ -635,6 +635,7 @@ type TemplateParameterInputMap = {
635
635
  type SupportedTemplateParameterType = keyof TemplateParameterInputMap;
636
636
  interface TemplateParameterDefinition<TType extends SupportedTemplateParameterType = SupportedTemplateParameterType> {
637
637
  name: string;
638
+ parameterName?: string;
638
639
  type: TType;
639
640
  }
640
641
  type TemplateComponentDefinition = {
@@ -635,6 +635,7 @@ type TemplateParameterInputMap = {
635
635
  type SupportedTemplateParameterType = keyof TemplateParameterInputMap;
636
636
  interface TemplateParameterDefinition<TType extends SupportedTemplateParameterType = SupportedTemplateParameterType> {
637
637
  name: string;
638
+ parameterName?: string;
638
639
  type: TType;
639
640
  }
640
641
  type TemplateComponentDefinition = {
package/dist/client.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as ZapClient, r as createZapClient, t as BetterZapClientError } from "./client-B_VYCUHu.cjs";
1
+ import { n as ZapClient, r as createZapClient, t as BetterZapClientError } from "./client-CRwYOHIG.cjs";
2
2
  export { BetterZapClientError, ZapClient, createZapClient };
package/dist/client.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as ZapClient, r as createZapClient, t as BetterZapClientError } from "./client-D-wgralM.mjs";
1
+ import { n as ZapClient, r as createZapClient, t as BetterZapClientError } from "./client-s6x3lYea.mjs";
2
2
  export { BetterZapClientError, ZapClient, createZapClient };
package/dist/index.cjs CHANGED
@@ -623,37 +623,46 @@ function serializeTemplateFromRegistry(templates, templateName, options) {
623
623
  };
624
624
  }
625
625
  function serializeTemplateParameter(parameter, value) {
626
+ const metaParameterName = parameter.parameterName ? { parameter_name: parameter.parameterName } : {};
626
627
  switch (parameter.type) {
627
628
  case "text": return {
628
629
  type: "text",
630
+ ...metaParameterName,
629
631
  text: value
630
632
  };
631
633
  case "payload": return {
632
634
  type: "payload",
635
+ ...metaParameterName,
633
636
  payload: value
634
637
  };
635
638
  case "location": return {
636
639
  type: "location",
640
+ ...metaParameterName,
637
641
  location: value
638
642
  };
639
643
  case "image": return {
640
644
  type: "image",
645
+ ...metaParameterName,
641
646
  image: value
642
647
  };
643
648
  case "video": return {
644
649
  type: "video",
650
+ ...metaParameterName,
645
651
  video: value
646
652
  };
647
653
  case "document": return {
648
654
  type: "document",
655
+ ...metaParameterName,
649
656
  document: value
650
657
  };
651
658
  case "currency": return {
652
659
  type: "currency",
660
+ ...metaParameterName,
653
661
  currency: value
654
662
  };
655
663
  case "date_time": return {
656
664
  type: "date_time",
665
+ ...metaParameterName,
657
666
  date_time: value
658
667
  };
659
668
  }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as UIMessage, A as createLogger, B as ConversationRecord, C as WhatsAppLogRecord, D as LogLevel, E as WhatsAppStatus, F as NewMessageEvent, G as MessageError, H as IncomingMessage, I as StatusUpdateEvent, J as SendMessageError, K as MessageStatus, L as SyncEvent, M as serializeError, N as ConversationSummary, O as Logger, P as ConversationUpdateEvent, Q as TemplateParameter, R as WhatsAppConfig, S as WhatsAppDirection, T as WhatsAppMessageType, U as InteractiveMediaCarouselCardInput, V as FreeformMessageWindow, W as MediaMessage, X as SendResult, Y as SendMessageResponse, Z as TemplateComponent, _ as OutgoingLoggingMetadata, a as SupportedTemplateParameterType, at as WebhookPayload, b as MessageLoggerService, c as TemplateName, ct as WhatsAppInteractiveButtonsMessage, d as TemplateParams, dt as WhatsAppLocationMessage, et as UIMessageStatus, f as TemplateRegistry, ft as WhatsAppTemplateMessage, g as serializeTemplateFromRegistry, h as hasConfiguredTemplates, i as EMPTY_TEMPLATE_REGISTRY, it as WebhookError, j as noopLogger, k as LoggerConfig, l as TemplateParameterDefinition, lt as WhatsAppInteractiveListMessage, m as getTemplateNames, n as ZapClient, nt as WebhookContact, o as TemplateComponentDefinition, ot as WebhookValue, p as defineTemplates, pt as WhatsAppTextMessage, q as SendInteractiveMediaCarouselData, r as createZapClient, rt as WebhookEntry, s as TemplateDefinition, st as WhatsAppCarouselCard, t as BetterZapClientError, tt as WebhookChange, u as TemplateParameterInputMap, ut as WhatsAppInteractiveMediaCarouselMessage, v as WhatsAppService, w as WhatsAppLogStore, x as WHATSAPP_MESSAGE_TYPES, y as MessageLoggerNotifier, z as Conversation } from "./client-B_VYCUHu.cjs";
1
+ import { $ as UIMessage, A as createLogger, B as ConversationRecord, C as WhatsAppLogRecord, D as LogLevel, E as WhatsAppStatus, F as NewMessageEvent, G as MessageError, H as IncomingMessage, I as StatusUpdateEvent, J as SendMessageError, K as MessageStatus, L as SyncEvent, M as serializeError, N as ConversationSummary, O as Logger, P as ConversationUpdateEvent, Q as TemplateParameter, R as WhatsAppConfig, S as WhatsAppDirection, T as WhatsAppMessageType, U as InteractiveMediaCarouselCardInput, V as FreeformMessageWindow, W as MediaMessage, X as SendResult, Y as SendMessageResponse, Z as TemplateComponent, _ as OutgoingLoggingMetadata, a as SupportedTemplateParameterType, at as WebhookPayload, b as MessageLoggerService, c as TemplateName, ct as WhatsAppInteractiveButtonsMessage, d as TemplateParams, dt as WhatsAppLocationMessage, et as UIMessageStatus, f as TemplateRegistry, ft as WhatsAppTemplateMessage, g as serializeTemplateFromRegistry, h as hasConfiguredTemplates, i as EMPTY_TEMPLATE_REGISTRY, it as WebhookError, j as noopLogger, k as LoggerConfig, l as TemplateParameterDefinition, lt as WhatsAppInteractiveListMessage, m as getTemplateNames, n as ZapClient, nt as WebhookContact, o as TemplateComponentDefinition, ot as WebhookValue, p as defineTemplates, pt as WhatsAppTextMessage, q as SendInteractiveMediaCarouselData, r as createZapClient, rt as WebhookEntry, s as TemplateDefinition, st as WhatsAppCarouselCard, t as BetterZapClientError, tt as WebhookChange, u as TemplateParameterInputMap, ut as WhatsAppInteractiveMediaCarouselMessage, v as WhatsAppService, w as WhatsAppLogStore, x as WHATSAPP_MESSAGE_TYPES, y as MessageLoggerNotifier, z as Conversation } from "./client-CRwYOHIG.cjs";
2
2
 
3
3
  //#region src/freeform-message-window.d.ts
4
4
  declare const FREEFORM_MESSAGE_WINDOW_MS: number;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as UIMessage, A as createLogger, B as ConversationRecord, C as WhatsAppLogRecord, D as LogLevel, E as WhatsAppStatus, F as NewMessageEvent, G as MessageError, H as IncomingMessage, I as StatusUpdateEvent, J as SendMessageError, K as MessageStatus, L as SyncEvent, M as serializeError, N as ConversationSummary, O as Logger, P as ConversationUpdateEvent, Q as TemplateParameter, R as WhatsAppConfig, S as WhatsAppDirection, T as WhatsAppMessageType, U as InteractiveMediaCarouselCardInput, V as FreeformMessageWindow, W as MediaMessage, X as SendResult, Y as SendMessageResponse, Z as TemplateComponent, _ as OutgoingLoggingMetadata, a as SupportedTemplateParameterType, at as WebhookPayload, b as MessageLoggerService, c as TemplateName, ct as WhatsAppInteractiveButtonsMessage, d as TemplateParams, dt as WhatsAppLocationMessage, et as UIMessageStatus, f as TemplateRegistry, ft as WhatsAppTemplateMessage, g as serializeTemplateFromRegistry, h as hasConfiguredTemplates, i as EMPTY_TEMPLATE_REGISTRY, it as WebhookError, j as noopLogger, k as LoggerConfig, l as TemplateParameterDefinition, lt as WhatsAppInteractiveListMessage, m as getTemplateNames, n as ZapClient, nt as WebhookContact, o as TemplateComponentDefinition, ot as WebhookValue, p as defineTemplates, pt as WhatsAppTextMessage, q as SendInteractiveMediaCarouselData, r as createZapClient, rt as WebhookEntry, s as TemplateDefinition, st as WhatsAppCarouselCard, t as BetterZapClientError, tt as WebhookChange, u as TemplateParameterInputMap, ut as WhatsAppInteractiveMediaCarouselMessage, v as WhatsAppService, w as WhatsAppLogStore, x as WHATSAPP_MESSAGE_TYPES, y as MessageLoggerNotifier, z as Conversation } from "./client-D-wgralM.mjs";
1
+ import { $ as UIMessage, A as createLogger, B as ConversationRecord, C as WhatsAppLogRecord, D as LogLevel, E as WhatsAppStatus, F as NewMessageEvent, G as MessageError, H as IncomingMessage, I as StatusUpdateEvent, J as SendMessageError, K as MessageStatus, L as SyncEvent, M as serializeError, N as ConversationSummary, O as Logger, P as ConversationUpdateEvent, Q as TemplateParameter, R as WhatsAppConfig, S as WhatsAppDirection, T as WhatsAppMessageType, U as InteractiveMediaCarouselCardInput, V as FreeformMessageWindow, W as MediaMessage, X as SendResult, Y as SendMessageResponse, Z as TemplateComponent, _ as OutgoingLoggingMetadata, a as SupportedTemplateParameterType, at as WebhookPayload, b as MessageLoggerService, c as TemplateName, ct as WhatsAppInteractiveButtonsMessage, d as TemplateParams, dt as WhatsAppLocationMessage, et as UIMessageStatus, f as TemplateRegistry, ft as WhatsAppTemplateMessage, g as serializeTemplateFromRegistry, h as hasConfiguredTemplates, i as EMPTY_TEMPLATE_REGISTRY, it as WebhookError, j as noopLogger, k as LoggerConfig, l as TemplateParameterDefinition, lt as WhatsAppInteractiveListMessage, m as getTemplateNames, n as ZapClient, nt as WebhookContact, o as TemplateComponentDefinition, ot as WebhookValue, p as defineTemplates, pt as WhatsAppTextMessage, q as SendInteractiveMediaCarouselData, r as createZapClient, rt as WebhookEntry, s as TemplateDefinition, st as WhatsAppCarouselCard, t as BetterZapClientError, tt as WebhookChange, u as TemplateParameterInputMap, ut as WhatsAppInteractiveMediaCarouselMessage, v as WhatsAppService, w as WhatsAppLogStore, x as WHATSAPP_MESSAGE_TYPES, y as MessageLoggerNotifier, z as Conversation } from "./client-s6x3lYea.mjs";
2
2
 
3
3
  //#region src/freeform-message-window.d.ts
4
4
  declare const FREEFORM_MESSAGE_WINDOW_MS: number;
package/dist/index.mjs CHANGED
@@ -622,37 +622,46 @@ function serializeTemplateFromRegistry(templates, templateName, options) {
622
622
  };
623
623
  }
624
624
  function serializeTemplateParameter(parameter, value) {
625
+ const metaParameterName = parameter.parameterName ? { parameter_name: parameter.parameterName } : {};
625
626
  switch (parameter.type) {
626
627
  case "text": return {
627
628
  type: "text",
629
+ ...metaParameterName,
628
630
  text: value
629
631
  };
630
632
  case "payload": return {
631
633
  type: "payload",
634
+ ...metaParameterName,
632
635
  payload: value
633
636
  };
634
637
  case "location": return {
635
638
  type: "location",
639
+ ...metaParameterName,
636
640
  location: value
637
641
  };
638
642
  case "image": return {
639
643
  type: "image",
644
+ ...metaParameterName,
640
645
  image: value
641
646
  };
642
647
  case "video": return {
643
648
  type: "video",
649
+ ...metaParameterName,
644
650
  video: value
645
651
  };
646
652
  case "document": return {
647
653
  type: "document",
654
+ ...metaParameterName,
648
655
  document: value
649
656
  };
650
657
  case "currency": return {
651
658
  type: "currency",
659
+ ...metaParameterName,
652
660
  currency: value
653
661
  };
654
662
  case "date_time": return {
655
663
  type: "date_time",
664
+ ...metaParameterName,
656
665
  date_time: value
657
666
  };
658
667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-zap",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Framework-agnostic Better Zap core for typed WhatsApp integrations.",
5
5
  "license": "ISC",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.4.0",
36
36
  "tsdown": "^0.21.2",
37
- "typescript": "^5.9.3",
37
+ "typescript": "^6.0.2",
38
38
  "vitest": "^4.1.0"
39
39
  },
40
40
  "scripts": {