@segment/action-destinations 3.187.1-TempPublishBranch.6 → 3.189.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/dist/destinations/app-fit/index.js +2 -2
  2. package/dist/destinations/app-fit/index.js.map +1 -1
  3. package/dist/destinations/app-fit/track/index.js +1 -1
  4. package/dist/destinations/app-fit/track/index.js.map +1 -1
  5. package/dist/destinations/attio/api/index.d.ts +30 -0
  6. package/dist/destinations/attio/api/index.js +28 -0
  7. package/dist/destinations/attio/api/index.js.map +1 -0
  8. package/dist/destinations/attio/assertRecord/generated-types.d.ts +8 -0
  9. package/dist/destinations/attio/assertRecord/generated-types.js.map +1 -0
  10. package/dist/destinations/attio/assertRecord/index.d.ts +6 -0
  11. package/dist/destinations/attio/assertRecord/index.js +84 -0
  12. package/dist/destinations/attio/assertRecord/index.js.map +1 -0
  13. package/dist/destinations/attio/generated-types.d.ts +2 -0
  14. package/dist/destinations/attio/generated-types.js.map +1 -0
  15. package/dist/destinations/attio/groupWorkspace/generated-types.d.ts +10 -0
  16. package/dist/destinations/attio/groupWorkspace/generated-types.js.map +1 -0
  17. package/dist/destinations/attio/groupWorkspace/index.js +82 -0
  18. package/dist/destinations/attio/groupWorkspace/index.js.map +1 -0
  19. package/dist/destinations/attio/identifyUser/generated-types.d.ts +10 -0
  20. package/dist/destinations/attio/identifyUser/generated-types.js.map +1 -0
  21. package/dist/destinations/attio/identifyUser/index.js +74 -0
  22. package/dist/destinations/attio/identifyUser/index.js.map +1 -0
  23. package/dist/destinations/attio/index.d.ts +4 -0
  24. package/dist/destinations/attio/index.js +48 -0
  25. package/dist/destinations/attio/index.js.map +1 -0
  26. package/dist/destinations/{engage-messaging-twilio/utils/types.js → engage/sendgrid/Profile.js} +1 -1
  27. package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
  28. package/dist/destinations/engage/sendgrid/destinationDefinition.d.ts +3 -0
  29. package/dist/destinations/engage/sendgrid/destinationDefinition.js +70 -0
  30. package/dist/destinations/engage/sendgrid/destinationDefinition.js.map +1 -0
  31. package/dist/destinations/engage/sendgrid/generated-types.d.ts +1 -0
  32. package/dist/destinations/engage/sendgrid/generated-types.js +14 -0
  33. package/dist/destinations/engage/sendgrid/generated-types.js.map +1 -0
  34. package/dist/destinations/engage/sendgrid/index.d.ts +2 -0
  35. package/dist/destinations/engage/sendgrid/index.js +5 -0
  36. package/dist/destinations/engage/sendgrid/index.js.map +1 -0
  37. package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.d.ts → engage/sendgrid/previewApiLookup/actionDefinition.d.ts} +1 -2
  38. package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.js → engage/sendgrid/previewApiLookup/actionDefinition.js} +4 -4
  39. package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js.map +1 -0
  40. package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.d.ts +2 -4
  41. package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.js +1 -15
  42. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
  43. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.d.ts +1 -0
  44. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js +14 -0
  45. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js.map +1 -0
  46. package/dist/destinations/engage/sendgrid/previewApiLookup/index.d.ts +2 -0
  47. package/dist/destinations/{engage-messaging-twilio/utils → engage/sendgrid/previewApiLookup}/index.js +2 -6
  48. package/dist/destinations/engage/sendgrid/previewApiLookup/index.js.map +1 -0
  49. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +42 -0
  50. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +318 -0
  51. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -0
  52. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.d.ts +12 -0
  53. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js +3 -0
  54. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js.map +1 -0
  55. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.d.ts +4 -0
  56. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js +236 -0
  57. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js.map +1 -0
  58. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.d.ts +1 -0
  59. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js +14 -0
  60. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js.map +1 -0
  61. package/dist/destinations/engage/sendgrid/sendEmail/index.d.ts +1 -0
  62. package/dist/destinations/engage/sendgrid/sendEmail/index.js +14 -0
  63. package/dist/destinations/engage/sendgrid/sendEmail/index.js.map +1 -0
  64. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.d.ts +1 -0
  65. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js +23 -0
  66. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js.map +1 -0
  67. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.d.ts +1 -0
  68. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js +14 -0
  69. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js.map +1 -0
  70. package/dist/destinations/engage/twilio/destinationDefinition.d.ts +3 -0
  71. package/dist/destinations/engage/twilio/destinationDefinition.js +172 -0
  72. package/dist/destinations/engage/twilio/destinationDefinition.js.map +1 -0
  73. package/dist/destinations/engage/twilio/generated-types.d.ts +1 -0
  74. package/dist/destinations/engage/twilio/generated-types.js +14 -0
  75. package/dist/destinations/engage/twilio/generated-types.js.map +1 -0
  76. package/dist/destinations/engage/twilio/index.d.ts +2 -0
  77. package/dist/destinations/engage/twilio/index.js +5 -0
  78. package/dist/destinations/engage/twilio/index.js.map +1 -0
  79. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.d.ts +27 -0
  80. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +142 -0
  81. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -0
  82. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.d.ts +4 -0
  83. package/dist/destinations/{engage-messaging-twilio/sendMobilePush/index.js → engage/twilio/sendMobilePush/actionDefinition.js} +5 -5
  84. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js.map +1 -0
  85. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.d.ts +1 -0
  86. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js +14 -0
  87. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js.map +1 -0
  88. package/dist/destinations/engage/twilio/sendMobilePush/index.d.ts +1 -0
  89. package/dist/destinations/engage/twilio/sendMobilePush/index.js +14 -0
  90. package/dist/destinations/engage/twilio/sendMobilePush/index.js.map +1 -0
  91. package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.d.ts +9 -0
  92. package/dist/destinations/{engage-messaging-twilio/sendSms/sms-sender.js → engage/twilio/sendSms/SmsMessageSender.js} +5 -32
  93. package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.js.map +1 -0
  94. package/dist/destinations/engage/twilio/sendSms/actionDefinition.d.ts +4 -0
  95. package/dist/destinations/{engage-messaging-twilio/sendSms/index.js → engage/twilio/sendSms/actionDefinition.js} +5 -5
  96. package/dist/destinations/engage/twilio/sendSms/actionDefinition.js.map +1 -0
  97. package/dist/destinations/engage/twilio/sendSms/generated-types.d.ts +1 -0
  98. package/dist/destinations/engage/twilio/sendSms/generated-types.js +14 -0
  99. package/dist/destinations/engage/twilio/sendSms/generated-types.js.map +1 -0
  100. package/dist/destinations/engage/twilio/sendSms/index.d.ts +1 -0
  101. package/dist/destinations/engage/twilio/sendSms/index.js +14 -0
  102. package/dist/destinations/engage/twilio/sendSms/index.js.map +1 -0
  103. package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +8 -0
  104. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js → engage/twilio/sendWhatsApp/WhatsAppMessageSender.js} +8 -4
  105. package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js.map +1 -0
  106. package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.d.ts +4 -0
  107. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/index.js → engage/twilio/sendWhatsApp/actionDefinition.js} +5 -5
  108. package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.js.map +1 -0
  109. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.d.ts +1 -0
  110. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js +14 -0
  111. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js.map +1 -0
  112. package/dist/destinations/engage/twilio/sendWhatsApp/index.d.ts +1 -0
  113. package/dist/destinations/engage/twilio/sendWhatsApp/index.js +14 -0
  114. package/dist/destinations/engage/twilio/sendWhatsApp/index.js.map +1 -0
  115. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +16 -0
  116. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +57 -0
  117. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -0
  118. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.d.ts +16 -0
  119. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js +109 -0
  120. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js.map +1 -0
  121. package/dist/destinations/engage/twilio/utils/index.d.ts +2 -0
  122. package/dist/destinations/engage/twilio/utils/index.js +15 -0
  123. package/dist/destinations/engage/twilio/utils/index.js.map +1 -0
  124. package/dist/destinations/{engage-messaging-twilio → engage/twilio}/utils/types.d.ts +0 -16
  125. package/dist/destinations/engage/twilio/utils/types.js.map +1 -0
  126. package/dist/destinations/engage/utils/AggregateError.d.ts +14 -0
  127. package/dist/destinations/engage/utils/AggregateError.js +26 -0
  128. package/dist/destinations/engage/utils/AggregateError.js.map +1 -0
  129. package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +41 -0
  130. package/dist/destinations/engage/utils/EngageActionPerformer.js +135 -0
  131. package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -0
  132. package/dist/destinations/{engage-messaging-twilio/utils/MessageLogger.d.ts → engage/utils/EngageLogger.d.ts} +8 -5
  133. package/dist/destinations/engage/utils/EngageLogger.js +52 -0
  134. package/dist/destinations/engage/utils/EngageLogger.js.map +1 -0
  135. package/dist/destinations/engage/utils/EngageStats.d.ts +18 -0
  136. package/dist/destinations/{engage-messaging-twilio/utils/MessageStats.js → engage/utils/EngageStats.js} +28 -14
  137. package/dist/destinations/engage/utils/EngageStats.js.map +1 -0
  138. package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.d.ts +2 -2
  139. package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.js +1 -1
  140. package/dist/destinations/engage/utils/IntegrationErrorWrapper.js.map +1 -0
  141. package/dist/destinations/engage/utils/MessageSendPerformer.d.ts +63 -0
  142. package/dist/destinations/engage/utils/MessageSendPerformer.js +191 -0
  143. package/dist/destinations/engage/utils/MessageSendPerformer.js.map +1 -0
  144. package/dist/destinations/engage/utils/ResponseError.d.ts +20 -0
  145. package/dist/destinations/engage/utils/ResponseError.js +17 -0
  146. package/dist/destinations/engage/utils/ResponseError.js.map +1 -0
  147. package/dist/destinations/engage/utils/getProfileApiEndpoint.d.ts +2 -0
  148. package/dist/destinations/engage/utils/getProfileApiEndpoint.js +10 -0
  149. package/dist/destinations/engage/utils/getProfileApiEndpoint.js.map +1 -0
  150. package/dist/destinations/engage/utils/index.d.ts +9 -0
  151. package/dist/destinations/engage/utils/index.js +22 -0
  152. package/dist/destinations/engage/utils/index.js.map +1 -0
  153. package/dist/destinations/engage/utils/isDestinationActionService.js.map +1 -0
  154. package/dist/destinations/engage/utils/isRetryableError.d.ts +2 -0
  155. package/dist/destinations/engage/utils/isRetryableError.js +33 -0
  156. package/dist/destinations/engage/utils/isRetryableError.js.map +1 -0
  157. package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js.map +1 -0
  158. package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js.map +1 -0
  159. package/dist/destinations/engage/utils/operationTracking/OperationDuration.js.map +1 -0
  160. package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js.map +1 -0
  161. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.d.ts +4 -0
  162. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.js +2 -0
  163. package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -0
  164. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.d.ts +2 -1
  165. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.js +22 -25
  166. package/dist/destinations/engage/utils/operationTracking/OperationLogger.js.map +1 -0
  167. package/dist/destinations/engage/utils/operationTracking/OperationStats.js.map +1 -0
  168. package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js.map +1 -0
  169. package/dist/destinations/engage/utils/operationTracking/OperationTree.js.map +1 -0
  170. package/dist/destinations/engage/utils/operationTracking/TrackedError.js.map +1 -0
  171. package/dist/destinations/engage/utils/operationTracking/index.js.map +1 -0
  172. package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js.map +1 -0
  173. package/dist/destinations/engage/utils/testUtils.d.ts +6 -0
  174. package/dist/destinations/engage/utils/testUtils.js +26 -0
  175. package/dist/destinations/engage/utils/testUtils.js.map +1 -0
  176. package/dist/destinations/engage/utils/track.d.ts +52 -0
  177. package/dist/destinations/engage/utils/track.js +9 -0
  178. package/dist/destinations/engage/utils/track.js.map +1 -0
  179. package/dist/destinations/engage-messaging-sendgrid/index.d.ts +2 -3
  180. package/dist/destinations/engage-messaging-sendgrid/index.js +13 -67
  181. package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
  182. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js +3 -0
  183. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js.map +1 -0
  184. package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js +3 -0
  185. package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js.map +1 -0
  186. package/dist/destinations/engage-messaging-twilio/index.d.ts +2 -3
  187. package/dist/destinations/engage-messaging-twilio/index.js +13 -169
  188. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  189. package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js +3 -0
  190. package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js.map +1 -0
  191. package/dist/destinations/engage-messaging-twilio/sendSms.types.js +3 -0
  192. package/dist/destinations/engage-messaging-twilio/sendSms.types.js.map +1 -0
  193. package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js +3 -0
  194. package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js.map +1 -0
  195. package/dist/destinations/hilo/generated-types.d.ts +3 -0
  196. package/dist/destinations/hilo/generated-types.js.map +1 -0
  197. package/dist/destinations/hilo/group/generated-types.d.ts +9 -0
  198. package/dist/destinations/hilo/group/generated-types.js +3 -0
  199. package/dist/destinations/hilo/group/generated-types.js.map +1 -0
  200. package/dist/destinations/{engage-messaging-sendgrid/sendEmail → hilo/group}/index.d.ts +1 -1
  201. package/dist/destinations/hilo/group/index.js +59 -0
  202. package/dist/destinations/hilo/group/index.js.map +1 -0
  203. package/dist/destinations/hilo/identify/generated-types.d.ts +8 -0
  204. package/dist/destinations/hilo/identify/generated-types.js +3 -0
  205. package/dist/destinations/hilo/identify/generated-types.js.map +1 -0
  206. package/dist/destinations/{engage-messaging-twilio/sendMobilePush → hilo/identify}/index.d.ts +1 -1
  207. package/dist/destinations/hilo/identify/index.js +51 -0
  208. package/dist/destinations/hilo/identify/index.js.map +1 -0
  209. package/dist/destinations/hilo/index.d.ts +4 -0
  210. package/dist/destinations/hilo/index.js +103 -0
  211. package/dist/destinations/hilo/index.js.map +1 -0
  212. package/dist/destinations/hilo/page/generated-types.d.ts +9 -0
  213. package/dist/destinations/hilo/page/generated-types.js +3 -0
  214. package/dist/destinations/hilo/page/generated-types.js.map +1 -0
  215. package/dist/destinations/hilo/page/index.d.ts +5 -0
  216. package/dist/destinations/hilo/page/index.js +59 -0
  217. package/dist/destinations/hilo/page/index.js.map +1 -0
  218. package/dist/destinations/hilo/screen/generated-types.d.ts +9 -0
  219. package/dist/destinations/hilo/screen/generated-types.js +3 -0
  220. package/dist/destinations/hilo/screen/generated-types.js.map +1 -0
  221. package/dist/destinations/hilo/screen/index.d.ts +5 -0
  222. package/dist/destinations/hilo/screen/index.js +59 -0
  223. package/dist/destinations/hilo/screen/index.js.map +1 -0
  224. package/dist/destinations/hilo/track/generated-types.d.ts +9 -0
  225. package/dist/destinations/hilo/track/generated-types.js +3 -0
  226. package/dist/destinations/hilo/track/generated-types.js.map +1 -0
  227. package/dist/destinations/hilo/track/index.d.ts +5 -0
  228. package/dist/destinations/hilo/track/index.js +59 -0
  229. package/dist/destinations/hilo/track/index.js.map +1 -0
  230. package/dist/destinations/hubspot/api/index.d.ts +11 -5
  231. package/dist/destinations/hubspot/api/index.js +59 -24
  232. package/dist/destinations/hubspot/api/index.js.map +1 -1
  233. package/dist/destinations/hubspot/errors.d.ts +2 -0
  234. package/dist/destinations/hubspot/errors.js +3 -1
  235. package/dist/destinations/hubspot/errors.js.map +1 -1
  236. package/dist/destinations/hubspot/upsertCompany/index.js +1 -1
  237. package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -1
  238. package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.d.ts +5 -0
  239. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +113 -22
  240. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
  241. package/dist/destinations/hubspot/utils.d.ts +23 -0
  242. package/dist/destinations/hubspot/utils.js +7 -1
  243. package/dist/destinations/hubspot/utils.js.map +1 -1
  244. package/dist/destinations/index.js +5 -2
  245. package/dist/destinations/index.js.map +1 -1
  246. package/dist/destinations/iterable/generated-types.d.ts +1 -0
  247. package/dist/destinations/iterable/index.js +20 -1
  248. package/dist/destinations/iterable/index.js.map +1 -1
  249. package/dist/destinations/iterable/index.test.d.ts +1 -0
  250. package/dist/destinations/iterable/index.test.js +46 -0
  251. package/dist/destinations/iterable/index.test.js.map +1 -0
  252. package/dist/destinations/iterable/shared-fields.d.ts +1 -0
  253. package/dist/destinations/iterable/trackEvent/index.js +3 -2
  254. package/dist/destinations/iterable/trackEvent/index.js.map +1 -1
  255. package/dist/destinations/iterable/trackPurchase/index.js +3 -2
  256. package/dist/destinations/iterable/trackPurchase/index.js.map +1 -1
  257. package/dist/destinations/iterable/updateCart/index.js +3 -2
  258. package/dist/destinations/iterable/updateCart/index.js.map +1 -1
  259. package/dist/destinations/iterable/updateUser/index.js +3 -2
  260. package/dist/destinations/iterable/updateUser/index.js.map +1 -1
  261. package/dist/destinations/iterable/utils.d.ts +9 -1
  262. package/dist/destinations/iterable/utils.js +18 -1
  263. package/dist/destinations/iterable/utils.js.map +1 -1
  264. package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js +1 -1
  265. package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js.map +1 -1
  266. package/dist/destinations/rehook/generated-types.d.ts +4 -0
  267. package/dist/destinations/rehook/generated-types.js +3 -0
  268. package/dist/destinations/rehook/generated-types.js.map +1 -0
  269. package/dist/destinations/rehook/identifyUser/generated-types.d.ts +7 -0
  270. package/dist/destinations/rehook/identifyUser/generated-types.js +3 -0
  271. package/dist/destinations/rehook/identifyUser/generated-types.js.map +1 -0
  272. package/dist/destinations/rehook/identifyUser/index.d.ts +5 -0
  273. package/dist/destinations/rehook/identifyUser/index.js +44 -0
  274. package/dist/destinations/rehook/identifyUser/index.js.map +1 -0
  275. package/dist/destinations/rehook/index.d.ts +4 -0
  276. package/dist/destinations/rehook/index.js +47 -0
  277. package/dist/destinations/rehook/index.js.map +1 -0
  278. package/dist/destinations/rehook/trackEvent/generated-types.d.ts +7 -0
  279. package/dist/destinations/rehook/trackEvent/generated-types.js +3 -0
  280. package/dist/destinations/rehook/trackEvent/generated-types.js.map +1 -0
  281. package/dist/destinations/rehook/trackEvent/index.d.ts +5 -0
  282. package/dist/destinations/rehook/trackEvent/index.js +48 -0
  283. package/dist/destinations/rehook/trackEvent/index.js.map +1 -0
  284. package/dist/destinations/the-trade-desk-crm/functions.js +4 -0
  285. package/dist/destinations/the-trade-desk-crm/functions.js.map +1 -1
  286. package/dist/destinations/the-trade-desk-crm/properties.d.ts +1 -0
  287. package/dist/destinations/the-trade-desk-crm/properties.js +8 -1
  288. package/dist/destinations/the-trade-desk-crm/properties.js.map +1 -1
  289. package/dist/destinations/the-trade-desk-crm/syncAudience/generated-types.d.ts +1 -0
  290. package/dist/destinations/the-trade-desk-crm/syncAudience/index.js +2 -1
  291. package/dist/destinations/the-trade-desk-crm/syncAudience/index.js.map +1 -1
  292. package/package.json +4 -4
  293. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js.map +0 -1
  294. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js.map +0 -1
  295. package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
  296. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +0 -578
  297. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +0 -1
  298. package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.js.map +0 -1
  299. package/dist/destinations/engage-messaging-sendgrid/utils/types.js.map +0 -1
  300. package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.js.map +0 -1
  301. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.js.map +0 -1
  302. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.js.map +0 -1
  303. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.js.map +0 -1
  304. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.js.map +0 -1
  305. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.js.map +0 -1
  306. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.js.map +0 -1
  307. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.js.map +0 -1
  308. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.js.map +0 -1
  309. package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.js.map +0 -1
  310. package/dist/destinations/engage-messaging-twilio/operationTracking/index.js.map +0 -1
  311. package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.js.map +0 -1
  312. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +0 -1
  313. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +0 -1
  314. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +0 -17
  315. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +0 -182
  316. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +0 -1
  317. package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.js.map +0 -1
  318. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +0 -1
  319. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -9
  320. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
  321. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
  322. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
  323. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -7
  324. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
  325. package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.js.map +0 -1
  326. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js +0 -36
  327. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js.map +0 -1
  328. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.d.ts +0 -14
  329. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.js.map +0 -1
  330. package/dist/destinations/engage-messaging-twilio/utils/index.d.ts +0 -6
  331. package/dist/destinations/engage-messaging-twilio/utils/index.js.map +0 -1
  332. package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.js.map +0 -1
  333. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -43
  334. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -203
  335. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
  336. package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +0 -19
  337. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +0 -97
  338. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +0 -1
  339. package/dist/destinations/engage-messaging-twilio/utils/track.d.ts +0 -45
  340. package/dist/destinations/engage-messaging-twilio/utils/track.js +0 -9
  341. package/dist/destinations/engage-messaging-twilio/utils/track.js.map +0 -1
  342. package/dist/destinations/engage-messaging-twilio/utils/types.js.map +0 -1
  343. /package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup → attio/assertRecord}/generated-types.js +0 -0
  344. /package/dist/destinations/{engage-messaging-sendgrid/sendEmail → attio}/generated-types.js +0 -0
  345. /package/dist/destinations/{engage-messaging-twilio/sendMobilePush → attio/groupWorkspace}/generated-types.js +0 -0
  346. /package/dist/destinations/{engage-messaging-twilio/sendSms → attio/groupWorkspace}/index.d.ts +0 -0
  347. /package/dist/destinations/{engage-messaging-twilio/sendSms → attio/identifyUser}/generated-types.js +0 -0
  348. /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → attio/identifyUser}/index.d.ts +0 -0
  349. /package/dist/destinations/{engage-messaging-sendgrid/utils/types.d.ts → engage/sendgrid/Profile.d.ts} +0 -0
  350. /package/dist/destinations/{engage-messaging-sendgrid → engage/twilio}/utils/types.js +0 -0
  351. /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.d.ts +0 -0
  352. /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.js +0 -0
  353. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.d.ts +0 -0
  354. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.js +0 -0
  355. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.d.ts +0 -0
  356. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.js +0 -0
  357. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.d.ts +0 -0
  358. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.js +0 -0
  359. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.d.ts +0 -0
  360. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.js +0 -0
  361. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.d.ts +0 -0
  362. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.js +0 -0
  363. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.d.ts +0 -0
  364. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.js +0 -0
  365. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.d.ts +0 -0
  366. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.js +0 -0
  367. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.d.ts +0 -0
  368. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.js +0 -0
  369. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.d.ts +0 -0
  370. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.js +0 -0
  371. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.d.ts +0 -0
  372. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.js +0 -0
  373. /package/dist/destinations/engage-messaging-sendgrid/{previewApiLookup/generated-types.d.ts → previewApiLookup.types.d.ts} +0 -0
  374. /package/dist/destinations/engage-messaging-sendgrid/{sendEmail/generated-types.d.ts → sendEmail.types.d.ts} +0 -0
  375. /package/dist/destinations/engage-messaging-twilio/{sendMobilePush/generated-types.d.ts → sendMobilePush.types.d.ts} +0 -0
  376. /package/dist/destinations/engage-messaging-twilio/{sendSms/generated-types.d.ts → sendSms.types.d.ts} +0 -0
  377. /package/dist/destinations/engage-messaging-twilio/{sendWhatsApp/generated-types.d.ts → sendWhatsApp.types.d.ts} +0 -0
  378. /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → hilo}/generated-types.js +0 -0
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PushSender = exports.MobilePushExtIdTypes = void 0;
10
+ const utils_1 = require("../utils");
11
+ const utils_2 = require("../../utils");
12
+ const actions_core_1 = require("@segment/actions-core");
13
+ var MobilePushExtIdTypes;
14
+ (function (MobilePushExtIdTypes) {
15
+ MobilePushExtIdTypes["IOS"] = "ios.push_token";
16
+ MobilePushExtIdTypes["ANDROID"] = "android.push_token";
17
+ })(MobilePushExtIdTypes = exports.MobilePushExtIdTypes || (exports.MobilePushExtIdTypes = {}));
18
+ class PushSender extends utils_1.TwilioMessageSender {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.supportedTemplateTypes = ['twilio/text', 'twilio/media'];
22
+ this.DEFAULT_HOSTNAME = 'push.ashburn.us1.twilio.com';
23
+ }
24
+ getChannelType() {
25
+ return 'mobilepush';
26
+ }
27
+ isSupportedExternalId(externalId) {
28
+ return PushSender.externalIdTypes.includes(externalId.type);
29
+ }
30
+ get twilioHostname() {
31
+ return this.settings.twilioHostname?.length ? this.settings.twilioHostname : this.DEFAULT_HOSTNAME;
32
+ }
33
+ get twilioToken() {
34
+ return Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
35
+ }
36
+ async beforeSend(recepients) {
37
+ if (this.payload.send && recepients.length > 0) {
38
+ this.bodyCustomDataBundle = await this.getBody();
39
+ }
40
+ }
41
+ async sendToRecepient(recipientDevice) {
42
+ const { requestBody, customData } = this.bodyCustomDataBundle;
43
+ const webhookUrl = this.getWebhookUrlWithParams(recipientDevice.type, recipientDevice.id);
44
+ const body = new URLSearchParams(requestBody);
45
+ if (recipientDevice?.type?.toLowerCase() === MobilePushExtIdTypes.IOS) {
46
+ body.append('Recipients', JSON.stringify({
47
+ apn: [{ addr: recipientDevice.id }]
48
+ }));
49
+ }
50
+ else {
51
+ body.append('Recipients', JSON.stringify({
52
+ fcm: [{ addr: recipientDevice.id }]
53
+ }));
54
+ }
55
+ body.append('CustomData', JSON.stringify({
56
+ ...customData,
57
+ __segment_internal_external_id_key__: recipientDevice.type,
58
+ __segment_internal_external_id_value__: recipientDevice.id
59
+ }));
60
+ if (webhookUrl) {
61
+ body.append('DeliveryCallbackUrl', webhookUrl);
62
+ }
63
+ this.statsSet('message_body_size', body?.toString().length);
64
+ const res = await this.request(`https://${this.twilioHostname}/v1/Services/${this.payload.from}/Notifications`, {
65
+ method: 'POST',
66
+ headers: {
67
+ authorization: `Basic ${this.twilioToken}`
68
+ },
69
+ body
70
+ });
71
+ return res;
72
+ }
73
+ async getBody() {
74
+ let templateTypes;
75
+ if (this.payload.contentSid) {
76
+ templateTypes = await this.getContentTemplateTypes();
77
+ }
78
+ const profile = { traits: this.payload.traits };
79
+ const parsedTemplateContent = await this.parseContent({
80
+ title: this.payload.customizations?.title,
81
+ body: this.payload.customizations?.body,
82
+ media: this.payload.customizations?.media,
83
+ ...templateTypes
84
+ }, profile);
85
+ const badgeAmount = this.payload.customizations?.badgeAmount ?? 1;
86
+ const badgeStrategy = this.payload.customizations?.badgeStrategy ?? 'inc';
87
+ try {
88
+ const customData = this.removeEmpties({
89
+ ...this.payload.customArgs,
90
+ space_id: this.settings.spaceId,
91
+ badgeAmount,
92
+ badgeStrategy,
93
+ media: parsedTemplateContent.media?.length ? parsedTemplateContent.media : undefined,
94
+ link: this.payload.customizations?.link,
95
+ tapActionButtons: this.payload.customizations?.tapActionButtons
96
+ });
97
+ const body = this.removeEmpties({
98
+ Body: parsedTemplateContent.body,
99
+ Action: this.payload.customizations?.tapAction,
100
+ Title: parsedTemplateContent.title,
101
+ Sound: this.payload.customizations?.sound,
102
+ Priority: this.payload.customizations?.priority,
103
+ TimeToLive: this.payload.customizations?.ttl,
104
+ FcmPayload: this.removeEmpties({
105
+ mutable_content: true,
106
+ notification: {
107
+ badge: badgeAmount
108
+ }
109
+ }),
110
+ ApnPayload: {
111
+ aps: {
112
+ 'mutable-content': 1,
113
+ badge: badgeAmount
114
+ }
115
+ }
116
+ });
117
+ const requestBody = new URLSearchParams({
118
+ ...body,
119
+ FcmPayload: JSON.stringify(body.FcmPayload),
120
+ ApnPayload: JSON.stringify(body.ApnPayload)
121
+ });
122
+ return { requestBody, customData };
123
+ }
124
+ catch (error) {
125
+ this.rethrowIntegrationError(error, () => new actions_core_1.PayloadValidationError('Unable to construct Notify API request body'));
126
+ }
127
+ }
128
+ removeEmpties(obj) {
129
+ return JSON.parse(JSON.stringify(obj, (_, value) => {
130
+ if (value == null || value?.length === 0 || (typeof value === 'object' && Object.keys(value).length === 0)) {
131
+ return undefined;
132
+ }
133
+ return value;
134
+ }));
135
+ }
136
+ }
137
+ PushSender.externalIdTypes = Object.values(MobilePushExtIdTypes);
138
+ __decorate([
139
+ utils_2.track()
140
+ ], PushSender.prototype, "getBody", null);
141
+ exports.PushSender = PushSender;
142
+ //# sourceMappingURL=PushSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PushSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendMobilePush/PushSender.ts"],"names":[],"mappings":";;;;;;;;;AAEA,oCAA8C;AAC9C,uCAA0C;AAG1C,wDAA8D;AAS9D,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,8CAAsB,CAAA;IACtB,sDAA8B,CAAA;AAChC,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B;AAED,MAAa,UAAW,SAAQ,2BAAgC;IAAhE;;QASW,2BAAsB,GAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;QACnE,qBAAgB,GAAG,6BAA6B,CAAA;IAqJ1D,CAAC;IA7JC,cAAc;QACZ,OAAO,YAAY,CAAA;IACrB,CAAC;IACD,qBAAqB,CAAC,UAA8B;QAClD,OAAO,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAW,CAAC,CAAA;IACpE,CAAC;IAKD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,C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IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;gBAC3C,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;aAC5C,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAA;SACnC;QAAC,OAAO,KAAc,EAAE;YACvB,IAAI,CAAC,uBAAuB,CAC1B,KAAK,EACL,GAAG,EAAE,CAAC,IAAI,qCAAsB,CAAC,6CAA6C,CAAC,CAChF,CAAA;SACF;IACH,CAAC;IAMO,aAAa,CAAC,GAA4B;QAChD,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE;gBAC1G,OAAO,SAAS,CAAA;aACjB;YACD,OAAO,KAAK,CAAA;QACd,CAAC,CAAC,CACH,CAAA;IACH,CAAC;;AA7Je,0BAAe,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;AA4ErE;IADC,aAAK,EAAE;yCAmEP;AA/IH,gCA+JC"}
@@ -0,0 +1,4 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ export declare const actionDefinition: ActionDefinition<Settings, Payload>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const push_sender_1 = require("./push-sender");
4
- const action = {
3
+ exports.actionDefinition = void 0;
4
+ const PushSender_1 = require("./PushSender");
5
+ exports.actionDefinition = {
5
6
  title: 'Send Mobile Push Notification',
6
7
  description: 'Send a push notification to a mobile device using Twilio',
7
8
  defaultSubscription: 'type = "track" and event = "Audience Entered"',
@@ -223,8 +224,7 @@ const action = {
223
224
  }
224
225
  },
225
226
  perform: async (request, data) => {
226
- return new push_sender_1.PushSender(request, data).perform();
227
+ return new PushSender_1.PushSender(request, data).perform();
227
228
  }
228
229
  };
229
- exports.default = action;
230
- //# sourceMappingURL=index.js.map
230
+ //# sourceMappingURL=actionDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendMobilePush/actionDefinition.ts"],"names":[],"mappings":";;;AAIA,6CAAyC;AAE5B,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,+BAA+B;IACtC,WAAW,EAAE,0DAA0D;IACvE,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,qCAAqC;YAClD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,oBAAoB;oBAC3B,WAAW,EAAE,iDAAiD;oBAC9D,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,KAAK;iBAChB;gBACD,IAAI,EAAE;oBACJ,KAAK,EAAE,mBAAmB;oBAC1B,WAAW,EAAE,gDAAgD;oBAC7D,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,KAAK;iBAChB;gBACD,KAAK,EAAE;oBACL,KAAK,EAAE,YAAY;oBACnB,WAAW,EAAE,kCAAkC;oBAC/C,IAAI,EAAE,QA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AAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,uBAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;IAChD,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from '../../../engage-messaging-twilio/sendMobilePush.types';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("../../../engage-messaging-twilio/sendMobilePush.types"), exports);
14
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendMobilePush/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wFAAqE"}
@@ -0,0 +1 @@
1
+ export * from './actionDefinition';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./actionDefinition"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendMobilePush/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
@@ -0,0 +1,9 @@
1
+ import type { Payload } from './generated-types';
2
+ import { PhoneMessageSender } from '../utils';
3
+ import { ExtId } from '../../utils';
4
+ export declare class SmsMessageSender extends PhoneMessageSender<Payload> {
5
+ supportedTemplateTypes: string[];
6
+ getBody(phone: string): Promise<URLSearchParams>;
7
+ getChannelType(): string;
8
+ isSupportedExternalId(externalId: ExtId<Payload>): boolean;
9
+ }
@@ -9,7 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.SmsMessageSender = void 0;
10
10
  const actions_core_1 = require("@segment/actions-core");
11
11
  const utils_1 = require("../utils");
12
- class SmsMessageSender extends utils_1.PhoneMessage {
12
+ const utils_2 = require("../../utils");
13
+ class SmsMessageSender extends utils_1.PhoneMessageSender {
13
14
  constructor() {
14
15
  super(...arguments);
15
16
  this.supportedTemplateTypes = ['twilio/text', 'twilio/media'];
@@ -57,43 +58,15 @@ class SmsMessageSender extends utils_1.PhoneMessage {
57
58
  getChannelType() {
58
59
  return 'sms';
59
60
  }
60
- isValidExternalId(externalId) {
61
+ isSupportedExternalId(externalId) {
61
62
  if (externalId.type !== 'phone') {
62
63
  return false;
63
64
  }
64
65
  return !externalId.channelType || externalId.channelType.toLowerCase() === this.getChannelType();
65
66
  }
66
- async getProfileTraits() {
67
- if (!this.payload.userId) {
68
- throw new actions_core_1.PayloadValidationError('Unable to process sms, no userId provided and no traits provided');
69
- }
70
- try {
71
- const { region, profileApiEnvironment, spaceId, profileApiAccessToken } = this.settings;
72
- const domainName = region === 'eu-west-1' ? 'profiles.euw1.segment' : 'profiles.segment';
73
- const topLevelName = profileApiEnvironment === 'production' ? 'com' : 'build';
74
- const response = await this.request(`https://${domainName}.${topLevelName}/v1/spaces/${spaceId}/collections/users/profiles/user_id:${encodeURIComponent(this.payload.userId)}/traits?limit=200`, {
75
- headers: {
76
- authorization: `Basic ${Buffer.from(profileApiAccessToken + ':').toString('base64')}`,
77
- 'content-type': 'application/json'
78
- }
79
- });
80
- const body = await response.json();
81
- return body.traits;
82
- }
83
- catch (e) {
84
- this.rethrowIntegrationError(e, () => [
85
- 'Unable to get profile traits for SMS message',
86
- 'SMS trait fetch failure',
87
- 500
88
- ]);
89
- }
90
- }
91
67
  }
92
68
  __decorate([
93
- utils_1.track()
69
+ utils_2.track()
94
70
  ], SmsMessageSender.prototype, "getBody", null);
95
- __decorate([
96
- utils_1.track()
97
- ], SmsMessageSender.prototype, "getProfileTraits", null);
98
71
  exports.SmsMessageSender = SmsMessageSender;
99
- //# sourceMappingURL=sms-sender.js.map
72
+ //# sourceMappingURL=SmsMessageSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmsMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/SmsMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AAEA,wDAA8D;AAC9D,oCAA6C;AAC7C,uCAA0C;AAE1C,MAAa,gBAAiB,SAAQ,0BAA2B;IAAjE;;QACE,2BAAsB,GAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAgEpE,CAAC;IA7DC,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAClD,MAAM,IAAI,qCAAsB,CAAC,qEAAqE,CAAC,CAAA;SACxG;QAID,IAAI,MAAM,CAAA;QACV,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;YAChC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;SA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AC;IAED,qBAAqB,CAAC,UAA0B;QAC9C,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE;YAC/B,OAAO,KAAK,CAAA;SACb;QACD,OAAO,CAAC,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,cAAc,EAAE,CAAA;IAClG,CAAC;CACF;AA7DC;IADC,aAAK,EAAE;+CAkDP;AArDH,4CAiEC"}
@@ -0,0 +1,4 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ export declare const actionDefinition: ActionDefinition<Settings, Payload>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const sms_sender_1 = require("./sms-sender");
4
- const action = {
3
+ exports.actionDefinition = void 0;
4
+ const SmsMessageSender_1 = require("./SmsMessageSender");
5
+ exports.actionDefinition = {
5
6
  title: 'Send SMS',
6
7
  description: 'Send SMS using Twilio',
7
8
  defaultSubscription: 'type = "track" and event = "Audience Entered"',
@@ -140,8 +141,7 @@ const action = {
140
141
  }
141
142
  },
142
143
  perform: async (request, data) => {
143
- return new sms_sender_1.SmsMessageSender(request, data).perform();
144
+ return new SmsMessageSender_1.SmsMessageSender(request, data).perform();
144
145
  }
145
146
  };
146
- exports.default = action;
147
- //# sourceMappingURL=index.js.map
147
+ //# sourceMappingURL=actionDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/actionDefinition.ts"],"names":[],"mappings":";;;AAIA,yDAAqD;AAExC,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE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EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,mCAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;IACtD,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from '../../../engage-messaging-twilio/sendSms.types';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("../../../engage-messaging-twilio/sendSms.types"), exports);
14
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAA8D"}
@@ -0,0 +1 @@
1
+ export * from './actionDefinition';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./actionDefinition"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
@@ -0,0 +1,8 @@
1
+ import type { Payload } from './generated-types';
2
+ import { PhoneMessageSender } from '../utils';
3
+ export declare class WhatsAppMessageSender extends PhoneMessageSender<Payload> {
4
+ get supportedTemplateTypes(): string[];
5
+ getChannelType(): string;
6
+ getBody(phone: string): Promise<URLSearchParams>;
7
+ private getVariables;
8
+ }
@@ -11,9 +11,13 @@ const liquidjs_1 = require("liquidjs");
11
11
  const actions_core_1 = require("@segment/actions-core");
12
12
  const google_libphonenumber_1 = require("google-libphonenumber");
13
13
  const utils_1 = require("../utils");
14
+ const utils_2 = require("../../utils");
14
15
  const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
15
16
  const Liquid = new liquidjs_1.Liquid();
16
- class WhatsAppMessageSender extends utils_1.PhoneMessage {
17
+ class WhatsAppMessageSender extends utils_1.PhoneMessageSender {
18
+ get supportedTemplateTypes() {
19
+ throw new Error('Method not supported.');
20
+ }
17
21
  getChannelType() {
18
22
  return 'whatsapp';
19
23
  }
@@ -62,10 +66,10 @@ class WhatsAppMessageSender extends utils_1.PhoneMessage {
62
66
  }
63
67
  }
64
68
  __decorate([
65
- utils_1.track()
69
+ utils_2.track()
66
70
  ], WhatsAppMessageSender.prototype, "getBody", null);
67
71
  __decorate([
68
- utils_1.track({
72
+ utils_2.track({
69
73
  wrapIntegrationError: () => [
70
74
  `Unable to parse templating in content variables`,
71
75
  `Content variables templating parse failure`,
@@ -74,4 +78,4 @@ __decorate([
74
78
  })
75
79
  ], WhatsAppMessageSender.prototype, "getVariables", null);
76
80
  exports.WhatsAppMessageSender = WhatsAppMessageSender;
77
- //# sourceMappingURL=whatsapp-sender.js.map
81
+ //# sourceMappingURL=WhatsAppMessageSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhatsAppMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,oCAA6C;AAC7C,uCAAmC;AAEnC,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,0BAA2B;IACpE,IAAI,sBAAsB;QACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC1C,CAAC;IACD,cAAc;QACZ,OAAO,UAAU,CAAA;IACnB,CAAC;IAGD,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,WAAW,CAAA;QAEf,IAAI;YAIF,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAC1C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,yCAAiB,CAAC,IAAI,CAAC,CAAA;YACnE,WAAW,GAAG,YAAY,WAAW,EAAE,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,eAAe,GAAG,CAAU,CAAA;YAClC,MAAM,IAAI,+BAAgB,CACxB,kEAAkE,GAAG,eAAe,CAAC,OAAO,EAC5F,eAAe,EACf,GAAG,CACJ,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAA;SACzG;QAED,MAAM,MA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C;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC;YAC1B,iDAAiD;YACjD,4CAA4C;YAC5C,GAAG;SACJ;KACF,CAAC;yDAwBD;AA1EH,sDA2EC"}
@@ -0,0 +1,4 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ export declare const actionDefinition: ActionDefinition<Settings, Payload>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const whatsapp_sender_1 = require("./whatsapp-sender");
4
- const action = {
3
+ exports.actionDefinition = void 0;
4
+ const WhatsAppMessageSender_1 = require("./WhatsAppMessageSender");
5
+ exports.actionDefinition = {
5
6
  title: 'Send WhatsApp',
6
7
  description: 'Send WhatsApp using Twilio',
7
8
  defaultSubscription: 'type = "track" and event = "Audience Entered"',
@@ -120,8 +121,7 @@ const action = {
120
121
  }
121
122
  },
122
123
  perform: async (request, data) => {
123
- return new whatsapp_sender_1.WhatsAppMessageSender(request, data).perform();
124
+ return new WhatsAppMessageSender_1.WhatsAppMessageSender(request, data).perform();
124
125
  }
125
126
  };
126
- exports.default = action;
127
- //# sourceMappingURL=index.js.map
127
+ //# sourceMappingURL=actionDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/actionDefinition.ts"],"names":[],"mappings":";;;AAIA,mEAA+D;AAElD,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,4BAA4B;IACzC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,2CAA2C;YACxD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,6BAA6B;YACpC,WAA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4D;oBACzE,IAAI,EAAE,QAAQ;iBACf;gBACD,kBAAkB,EAAE;oBAClB,KAAK,EAAE,IAAI;oBACX,WAAW,EAAE,2CAA2C;oBACxD,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,gBAAgB;oBAChB;wBACE,EAAE,EAAE;4BACF,OAAO,EAAE,MAAM;yBAChB;wBACD,IAAI,EAAE;4BACJ,OAAO,EAAE,QAAQ;yBAClB;wBACD,WAAW,EAAE;4BACX,OAAO,EAAE,eAAe;yBACzB;wBACD,kBAAkB,EAAE;4BAClB,OAAO,EAAE,gBAAgB;yBAC1B;qBACF;iBACF;aACF;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,6CAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;IAC3D,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from '../../../engage-messaging-twilio/sendWhatsApp.types';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("../../../engage-messaging-twilio/sendWhatsApp.types"), exports);
14
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAAmE"}
@@ -0,0 +1 @@
1
+ export * from './actionDefinition';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./actionDefinition"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
@@ -0,0 +1,16 @@
1
+ import { TwilioMessageSender, TwilioPayloadBase } from './TwilioMessageSender';
2
+ import { ExtId } from '../../utils';
3
+ export declare abstract class PhoneMessageSender<Payload extends PhoneMessagePayload> extends TwilioMessageSender<Payload> {
4
+ private readonly EXTERNAL_ID_KEY;
5
+ private readonly DEFAULT_HOSTNAME;
6
+ private readonly DEFAULT_CONNECTION_OVERRIDES;
7
+ abstract getBody(phone: string): Promise<URLSearchParams>;
8
+ get twilioHostname(): string;
9
+ get twilioToken(): string;
10
+ sendToRecepient(recepient: ExtId<Payload>): Promise<import("@segment/actions-core/*").ModifiedResponse<unknown>>;
11
+ isSupportedExternalId(externalId: NonNullable<Payload['externalIds']>[number]): boolean;
12
+ getRecepients(): ExtId<Payload>[];
13
+ }
14
+ export interface PhoneMessagePayload extends TwilioPayloadBase {
15
+ toNumber?: string;
16
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhoneMessageSender = void 0;
4
+ const TwilioMessageSender_1 = require("./TwilioMessageSender");
5
+ const utils_1 = require("../../utils");
6
+ class PhoneMessageSender extends TwilioMessageSender_1.TwilioMessageSender {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.EXTERNAL_ID_KEY = 'phone';
10
+ this.DEFAULT_HOSTNAME = 'api.twilio.com';
11
+ this.DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
12
+ }
13
+ get twilioHostname() {
14
+ return this.settings.twilioHostname ?? this.DEFAULT_HOSTNAME;
15
+ }
16
+ get twilioToken() {
17
+ return Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
18
+ }
19
+ async sendToRecepient(recepient) {
20
+ const phone = recepient.id;
21
+ const op = this.currentOperation;
22
+ this.currentOperation?.onFinally.push(() => {
23
+ const error = op.error;
24
+ if (error)
25
+ op.tags.push('not_sent_reason:error_operation_' + utils_1.OperationDecorator.getOperationName(error.trackedContext || op));
26
+ });
27
+ const body = await this.getBody(phone);
28
+ const webhookUrlWithParams = this.getWebhookUrlWithParams(this.EXTERNAL_ID_KEY, phone, this.DEFAULT_CONNECTION_OVERRIDES);
29
+ if (webhookUrlWithParams)
30
+ body.append('StatusCallback', webhookUrlWithParams);
31
+ this.statsSet('message_body_size', body?.toString().length);
32
+ const response = await this.request(`https://${this.twilioHostname}/2010-04-01/Accounts/${this.settings.twilioAccountSID}/Messages.json`, {
33
+ method: 'POST',
34
+ headers: {
35
+ authorization: `Basic ${this.twilioToken}`
36
+ },
37
+ body
38
+ });
39
+ this.logDetails['twilio-request-id'] = response.headers?.get('twilio-request-id');
40
+ return response;
41
+ }
42
+ isSupportedExternalId(externalId) {
43
+ return externalId.type === 'phone' && externalId.channelType?.toLowerCase() === this.getChannelType();
44
+ }
45
+ getRecepients() {
46
+ if (this.payload.toNumber)
47
+ return [
48
+ {
49
+ id: this.payload.toNumber
50
+ }
51
+ ];
52
+ const res = super.getRecepients();
53
+ return res.length > 0 ? [res[0]] : res;
54
+ }
55
+ }
56
+ exports.PhoneMessageSender = PhoneMessageSender;
57
+ //# sourceMappingURL=PhoneMessageSender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/utils/PhoneMessageSender.ts"],"names":[],"mappings":";;;AAEA,+DAA8E;AAC9E,uCAAuF;AAKvF,MAAsB,kBAAwD,SAAQ,yCAA4B;IAAlH;;QACmB,oBAAe,GAAG,OAAO,CAAA;QACzB,qBAAgB,GAAG,gBAAgB,CAAA;QACnC,iCAA4B,GAAG,aAAa,CAAA;IAmE/D,CAAC;IA/DC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,CAAC,gBAAgB,CAAA;IAC9D,CAAC;IACD,IAAI,WAAW;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC/G,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAyB;QAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,EAAG,CAAA;QAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAoC,CAAA;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