@segment/action-destinations 3.188.0 → 3.190.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 (343) 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/index.js +1 -1
  6. package/dist/destinations/attio/index.js.map +1 -1
  7. package/dist/destinations/{engage-messaging-twilio/utils/types.js → engage/sendgrid/Profile.js} +1 -1
  8. package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
  9. package/dist/destinations/engage/sendgrid/destinationDefinition.d.ts +3 -0
  10. package/dist/destinations/engage/sendgrid/destinationDefinition.js +70 -0
  11. package/dist/destinations/engage/sendgrid/destinationDefinition.js.map +1 -0
  12. package/dist/destinations/engage/sendgrid/generated-types.d.ts +1 -0
  13. package/dist/destinations/engage/sendgrid/generated-types.js +14 -0
  14. package/dist/destinations/engage/sendgrid/generated-types.js.map +1 -0
  15. package/dist/destinations/engage/sendgrid/index.d.ts +2 -0
  16. package/dist/destinations/engage/sendgrid/index.js +5 -0
  17. package/dist/destinations/engage/sendgrid/index.js.map +1 -0
  18. package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.d.ts → engage/sendgrid/previewApiLookup/actionDefinition.d.ts} +1 -2
  19. package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.js → engage/sendgrid/previewApiLookup/actionDefinition.js} +4 -4
  20. package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js.map +1 -0
  21. package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.d.ts +2 -4
  22. package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.js +1 -15
  23. package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
  24. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.d.ts +1 -0
  25. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js +14 -0
  26. package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js.map +1 -0
  27. package/dist/destinations/engage/sendgrid/previewApiLookup/index.d.ts +2 -0
  28. package/dist/destinations/{engage-messaging-twilio/utils → engage/sendgrid/previewApiLookup}/index.js +2 -6
  29. package/dist/destinations/engage/sendgrid/previewApiLookup/index.js.map +1 -0
  30. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +42 -0
  31. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +318 -0
  32. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -0
  33. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.d.ts +12 -0
  34. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js +3 -0
  35. package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js.map +1 -0
  36. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.d.ts +4 -0
  37. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js +236 -0
  38. package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js.map +1 -0
  39. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.d.ts +1 -0
  40. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js +14 -0
  41. package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js.map +1 -0
  42. package/dist/destinations/engage/sendgrid/sendEmail/index.d.ts +1 -0
  43. package/dist/destinations/engage/sendgrid/sendEmail/index.js +14 -0
  44. package/dist/destinations/engage/sendgrid/sendEmail/index.js.map +1 -0
  45. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.d.ts +1 -0
  46. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js +23 -0
  47. package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js.map +1 -0
  48. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.d.ts +1 -0
  49. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js +14 -0
  50. package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js.map +1 -0
  51. package/dist/destinations/engage/twilio/destinationDefinition.d.ts +3 -0
  52. package/dist/destinations/engage/twilio/destinationDefinition.js +172 -0
  53. package/dist/destinations/engage/twilio/destinationDefinition.js.map +1 -0
  54. package/dist/destinations/engage/twilio/generated-types.d.ts +1 -0
  55. package/dist/destinations/engage/twilio/generated-types.js +14 -0
  56. package/dist/destinations/engage/twilio/generated-types.js.map +1 -0
  57. package/dist/destinations/engage/twilio/index.d.ts +2 -0
  58. package/dist/destinations/engage/twilio/index.js +5 -0
  59. package/dist/destinations/engage/twilio/index.js.map +1 -0
  60. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.d.ts +27 -0
  61. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +142 -0
  62. package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -0
  63. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.d.ts +4 -0
  64. package/dist/destinations/{engage-messaging-twilio/sendMobilePush/index.js → engage/twilio/sendMobilePush/actionDefinition.js} +5 -5
  65. package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js.map +1 -0
  66. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.d.ts +1 -0
  67. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js +14 -0
  68. package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js.map +1 -0
  69. package/dist/destinations/engage/twilio/sendMobilePush/index.d.ts +1 -0
  70. package/dist/destinations/engage/twilio/sendMobilePush/index.js +14 -0
  71. package/dist/destinations/engage/twilio/sendMobilePush/index.js.map +1 -0
  72. package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.d.ts +9 -0
  73. package/dist/destinations/{engage-messaging-twilio/sendSms/sms-sender.js → engage/twilio/sendSms/SmsMessageSender.js} +5 -32
  74. package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.js.map +1 -0
  75. package/dist/destinations/engage/twilio/sendSms/actionDefinition.d.ts +4 -0
  76. package/dist/destinations/{engage-messaging-twilio/sendSms/index.js → engage/twilio/sendSms/actionDefinition.js} +5 -5
  77. package/dist/destinations/engage/twilio/sendSms/actionDefinition.js.map +1 -0
  78. package/dist/destinations/engage/twilio/sendSms/generated-types.d.ts +1 -0
  79. package/dist/destinations/engage/twilio/sendSms/generated-types.js +14 -0
  80. package/dist/destinations/engage/twilio/sendSms/generated-types.js.map +1 -0
  81. package/dist/destinations/engage/twilio/sendSms/index.d.ts +1 -0
  82. package/dist/destinations/engage/twilio/sendSms/index.js +14 -0
  83. package/dist/destinations/engage/twilio/sendSms/index.js.map +1 -0
  84. package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +8 -0
  85. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js → engage/twilio/sendWhatsApp/WhatsAppMessageSender.js} +8 -4
  86. package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js.map +1 -0
  87. package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.d.ts +4 -0
  88. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/index.js → engage/twilio/sendWhatsApp/actionDefinition.js} +5 -5
  89. package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.js.map +1 -0
  90. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.d.ts +1 -0
  91. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js +14 -0
  92. package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js.map +1 -0
  93. package/dist/destinations/engage/twilio/sendWhatsApp/index.d.ts +1 -0
  94. package/dist/destinations/engage/twilio/sendWhatsApp/index.js +14 -0
  95. package/dist/destinations/engage/twilio/sendWhatsApp/index.js.map +1 -0
  96. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +16 -0
  97. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +57 -0
  98. package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -0
  99. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.d.ts +16 -0
  100. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js +109 -0
  101. package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js.map +1 -0
  102. package/dist/destinations/engage/twilio/utils/index.d.ts +2 -0
  103. package/dist/destinations/engage/twilio/utils/index.js +15 -0
  104. package/dist/destinations/engage/twilio/utils/index.js.map +1 -0
  105. package/dist/destinations/{engage-messaging-twilio → engage/twilio}/utils/types.d.ts +0 -16
  106. package/dist/destinations/engage/twilio/utils/types.js.map +1 -0
  107. package/dist/destinations/engage/utils/AggregateError.d.ts +14 -0
  108. package/dist/destinations/engage/utils/AggregateError.js +26 -0
  109. package/dist/destinations/engage/utils/AggregateError.js.map +1 -0
  110. package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +41 -0
  111. package/dist/destinations/engage/utils/EngageActionPerformer.js +135 -0
  112. package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -0
  113. package/dist/destinations/{engage-messaging-twilio/utils/MessageLogger.d.ts → engage/utils/EngageLogger.d.ts} +8 -5
  114. package/dist/destinations/engage/utils/EngageLogger.js +52 -0
  115. package/dist/destinations/engage/utils/EngageLogger.js.map +1 -0
  116. package/dist/destinations/engage/utils/EngageStats.d.ts +18 -0
  117. package/dist/destinations/{engage-messaging-twilio/utils/MessageStats.js → engage/utils/EngageStats.js} +28 -14
  118. package/dist/destinations/engage/utils/EngageStats.js.map +1 -0
  119. package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.d.ts +2 -2
  120. package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.js +1 -1
  121. package/dist/destinations/engage/utils/IntegrationErrorWrapper.js.map +1 -0
  122. package/dist/destinations/engage/utils/MessageSendPerformer.d.ts +63 -0
  123. package/dist/destinations/engage/utils/MessageSendPerformer.js +191 -0
  124. package/dist/destinations/engage/utils/MessageSendPerformer.js.map +1 -0
  125. package/dist/destinations/engage/utils/ResponseError.d.ts +20 -0
  126. package/dist/destinations/engage/utils/ResponseError.js +17 -0
  127. package/dist/destinations/engage/utils/ResponseError.js.map +1 -0
  128. package/dist/destinations/engage/utils/getProfileApiEndpoint.d.ts +2 -0
  129. package/dist/destinations/engage/utils/getProfileApiEndpoint.js +10 -0
  130. package/dist/destinations/engage/utils/getProfileApiEndpoint.js.map +1 -0
  131. package/dist/destinations/engage/utils/index.d.ts +9 -0
  132. package/dist/destinations/engage/utils/index.js +22 -0
  133. package/dist/destinations/engage/utils/index.js.map +1 -0
  134. package/dist/destinations/engage/utils/isDestinationActionService.js.map +1 -0
  135. package/dist/destinations/engage/utils/isRetryableError.d.ts +2 -0
  136. package/dist/destinations/engage/utils/isRetryableError.js +33 -0
  137. package/dist/destinations/engage/utils/isRetryableError.js.map +1 -0
  138. package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js.map +1 -0
  139. package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js.map +1 -0
  140. package/dist/destinations/engage/utils/operationTracking/OperationDuration.js.map +1 -0
  141. package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js.map +1 -0
  142. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.d.ts +4 -0
  143. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.js +2 -0
  144. package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -0
  145. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.d.ts +2 -1
  146. package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.js +22 -25
  147. package/dist/destinations/engage/utils/operationTracking/OperationLogger.js.map +1 -0
  148. package/dist/destinations/engage/utils/operationTracking/OperationStats.js.map +1 -0
  149. package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js.map +1 -0
  150. package/dist/destinations/engage/utils/operationTracking/OperationTree.js.map +1 -0
  151. package/dist/destinations/engage/utils/operationTracking/TrackedError.js.map +1 -0
  152. package/dist/destinations/engage/utils/operationTracking/index.js.map +1 -0
  153. package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js.map +1 -0
  154. package/dist/destinations/engage/utils/testUtils.d.ts +6 -0
  155. package/dist/destinations/engage/utils/testUtils.js +26 -0
  156. package/dist/destinations/engage/utils/testUtils.js.map +1 -0
  157. package/dist/destinations/engage/utils/track.d.ts +52 -0
  158. package/dist/destinations/engage/utils/track.js +9 -0
  159. package/dist/destinations/engage/utils/track.js.map +1 -0
  160. package/dist/destinations/engage-messaging-sendgrid/index.d.ts +2 -3
  161. package/dist/destinations/engage-messaging-sendgrid/index.js +13 -67
  162. package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
  163. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js +3 -0
  164. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js.map +1 -0
  165. package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js +3 -0
  166. package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js.map +1 -0
  167. package/dist/destinations/engage-messaging-twilio/index.d.ts +2 -3
  168. package/dist/destinations/engage-messaging-twilio/index.js +13 -169
  169. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  170. package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js +3 -0
  171. package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js.map +1 -0
  172. package/dist/destinations/engage-messaging-twilio/sendSms.types.js +3 -0
  173. package/dist/destinations/engage-messaging-twilio/sendSms.types.js.map +1 -0
  174. package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js +3 -0
  175. package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js.map +1 -0
  176. package/dist/destinations/hilo/generated-types.d.ts +3 -0
  177. package/dist/destinations/hilo/generated-types.js.map +1 -0
  178. package/dist/destinations/hilo/group/generated-types.d.ts +9 -0
  179. package/dist/destinations/hilo/group/generated-types.js.map +1 -0
  180. package/dist/destinations/hilo/group/index.js +59 -0
  181. package/dist/destinations/hilo/group/index.js.map +1 -0
  182. package/dist/destinations/hilo/identify/generated-types.d.ts +8 -0
  183. package/dist/destinations/hilo/identify/generated-types.js.map +1 -0
  184. package/dist/destinations/hilo/identify/index.js +51 -0
  185. package/dist/destinations/hilo/identify/index.js.map +1 -0
  186. package/dist/destinations/hilo/index.d.ts +4 -0
  187. package/dist/destinations/hilo/index.js +103 -0
  188. package/dist/destinations/hilo/index.js.map +1 -0
  189. package/dist/destinations/hilo/page/generated-types.d.ts +9 -0
  190. package/dist/destinations/hilo/page/generated-types.js.map +1 -0
  191. package/dist/destinations/{engage-messaging-sendgrid/sendEmail → hilo/page}/index.d.ts +1 -1
  192. package/dist/destinations/hilo/page/index.js +59 -0
  193. package/dist/destinations/hilo/page/index.js.map +1 -0
  194. package/dist/destinations/hilo/screen/generated-types.d.ts +9 -0
  195. package/dist/destinations/hilo/screen/generated-types.js.map +1 -0
  196. package/dist/destinations/{engage-messaging-twilio/sendMobilePush → hilo/screen}/index.d.ts +1 -1
  197. package/dist/destinations/hilo/screen/index.js +59 -0
  198. package/dist/destinations/hilo/screen/index.js.map +1 -0
  199. package/dist/destinations/hilo/track/generated-types.d.ts +9 -0
  200. package/dist/destinations/hilo/track/generated-types.js +3 -0
  201. package/dist/destinations/hilo/track/generated-types.js.map +1 -0
  202. package/dist/destinations/hilo/track/index.d.ts +5 -0
  203. package/dist/destinations/hilo/track/index.js +59 -0
  204. package/dist/destinations/hilo/track/index.js.map +1 -0
  205. package/dist/destinations/hubspot/api/index.d.ts +11 -5
  206. package/dist/destinations/hubspot/api/index.js +59 -24
  207. package/dist/destinations/hubspot/api/index.js.map +1 -1
  208. package/dist/destinations/hubspot/errors.d.ts +2 -0
  209. package/dist/destinations/hubspot/errors.js +3 -1
  210. package/dist/destinations/hubspot/errors.js.map +1 -1
  211. package/dist/destinations/hubspot/upsertCompany/index.js +1 -1
  212. package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -1
  213. package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.d.ts +5 -0
  214. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +113 -22
  215. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
  216. package/dist/destinations/hubspot/utils.d.ts +23 -0
  217. package/dist/destinations/hubspot/utils.js +7 -1
  218. package/dist/destinations/hubspot/utils.js.map +1 -1
  219. package/dist/destinations/index.js +3 -0
  220. package/dist/destinations/index.js.map +1 -1
  221. package/dist/destinations/iterable/generated-types.d.ts +1 -0
  222. package/dist/destinations/iterable/index.js +20 -1
  223. package/dist/destinations/iterable/index.js.map +1 -1
  224. package/dist/destinations/iterable/index.test.d.ts +1 -0
  225. package/dist/destinations/iterable/index.test.js +46 -0
  226. package/dist/destinations/iterable/index.test.js.map +1 -0
  227. package/dist/destinations/iterable/shared-fields.d.ts +1 -0
  228. package/dist/destinations/iterable/trackEvent/index.js +3 -2
  229. package/dist/destinations/iterable/trackEvent/index.js.map +1 -1
  230. package/dist/destinations/iterable/trackPurchase/index.js +3 -2
  231. package/dist/destinations/iterable/trackPurchase/index.js.map +1 -1
  232. package/dist/destinations/iterable/updateCart/index.js +3 -2
  233. package/dist/destinations/iterable/updateCart/index.js.map +1 -1
  234. package/dist/destinations/iterable/updateUser/index.js +3 -2
  235. package/dist/destinations/iterable/updateUser/index.js.map +1 -1
  236. package/dist/destinations/iterable/utils.d.ts +9 -1
  237. package/dist/destinations/iterable/utils.js +18 -1
  238. package/dist/destinations/iterable/utils.js.map +1 -1
  239. package/dist/destinations/rehook/generated-types.d.ts +4 -0
  240. package/dist/destinations/rehook/generated-types.js +3 -0
  241. package/dist/destinations/rehook/generated-types.js.map +1 -0
  242. package/dist/destinations/rehook/identifyUser/generated-types.d.ts +7 -0
  243. package/dist/destinations/rehook/identifyUser/generated-types.js +3 -0
  244. package/dist/destinations/rehook/identifyUser/generated-types.js.map +1 -0
  245. package/dist/destinations/rehook/identifyUser/index.d.ts +5 -0
  246. package/dist/destinations/rehook/identifyUser/index.js +44 -0
  247. package/dist/destinations/rehook/identifyUser/index.js.map +1 -0
  248. package/dist/destinations/rehook/index.d.ts +4 -0
  249. package/dist/destinations/rehook/index.js +47 -0
  250. package/dist/destinations/rehook/index.js.map +1 -0
  251. package/dist/destinations/rehook/trackEvent/generated-types.d.ts +7 -0
  252. package/dist/destinations/rehook/trackEvent/generated-types.js +3 -0
  253. package/dist/destinations/rehook/trackEvent/generated-types.js.map +1 -0
  254. package/dist/destinations/rehook/trackEvent/index.d.ts +5 -0
  255. package/dist/destinations/rehook/trackEvent/index.js +48 -0
  256. package/dist/destinations/rehook/trackEvent/index.js.map +1 -0
  257. package/package.json +2 -2
  258. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js.map +0 -1
  259. package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js.map +0 -1
  260. package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
  261. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +0 -578
  262. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +0 -1
  263. package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.js.map +0 -1
  264. package/dist/destinations/engage-messaging-sendgrid/utils/types.js.map +0 -1
  265. package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.js.map +0 -1
  266. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.js.map +0 -1
  267. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.js.map +0 -1
  268. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.js.map +0 -1
  269. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.js.map +0 -1
  270. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.js.map +0 -1
  271. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.js.map +0 -1
  272. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.js.map +0 -1
  273. package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.js.map +0 -1
  274. package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.js.map +0 -1
  275. package/dist/destinations/engage-messaging-twilio/operationTracking/index.js.map +0 -1
  276. package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.js.map +0 -1
  277. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +0 -1
  278. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +0 -1
  279. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +0 -17
  280. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +0 -182
  281. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +0 -1
  282. package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.js.map +0 -1
  283. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +0 -1
  284. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -9
  285. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
  286. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
  287. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
  288. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -7
  289. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
  290. package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.js.map +0 -1
  291. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js +0 -36
  292. package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js.map +0 -1
  293. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.d.ts +0 -14
  294. package/dist/destinations/engage-messaging-twilio/utils/MessageStats.js.map +0 -1
  295. package/dist/destinations/engage-messaging-twilio/utils/index.d.ts +0 -6
  296. package/dist/destinations/engage-messaging-twilio/utils/index.js.map +0 -1
  297. package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.js.map +0 -1
  298. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -43
  299. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -203
  300. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
  301. package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +0 -19
  302. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +0 -97
  303. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +0 -1
  304. package/dist/destinations/engage-messaging-twilio/utils/track.d.ts +0 -45
  305. package/dist/destinations/engage-messaging-twilio/utils/track.js +0 -9
  306. package/dist/destinations/engage-messaging-twilio/utils/track.js.map +0 -1
  307. package/dist/destinations/engage-messaging-twilio/utils/types.js.map +0 -1
  308. /package/dist/destinations/{engage-messaging-sendgrid/utils/types.d.ts → engage/sendgrid/Profile.d.ts} +0 -0
  309. /package/dist/destinations/{engage-messaging-sendgrid → engage/twilio}/utils/types.js +0 -0
  310. /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.d.ts +0 -0
  311. /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.js +0 -0
  312. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.d.ts +0 -0
  313. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.js +0 -0
  314. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.d.ts +0 -0
  315. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.js +0 -0
  316. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.d.ts +0 -0
  317. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.js +0 -0
  318. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.d.ts +0 -0
  319. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.js +0 -0
  320. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.d.ts +0 -0
  321. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.js +0 -0
  322. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.d.ts +0 -0
  323. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.js +0 -0
  324. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.d.ts +0 -0
  325. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.js +0 -0
  326. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.d.ts +0 -0
  327. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.js +0 -0
  328. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.d.ts +0 -0
  329. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.js +0 -0
  330. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.d.ts +0 -0
  331. /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.js +0 -0
  332. /package/dist/destinations/engage-messaging-sendgrid/{previewApiLookup/generated-types.d.ts → previewApiLookup.types.d.ts} +0 -0
  333. /package/dist/destinations/engage-messaging-sendgrid/{sendEmail/generated-types.d.ts → sendEmail.types.d.ts} +0 -0
  334. /package/dist/destinations/engage-messaging-twilio/{sendMobilePush/generated-types.d.ts → sendMobilePush.types.d.ts} +0 -0
  335. /package/dist/destinations/engage-messaging-twilio/{sendSms/generated-types.d.ts → sendSms.types.d.ts} +0 -0
  336. /package/dist/destinations/engage-messaging-twilio/{sendWhatsApp/generated-types.d.ts → sendWhatsApp.types.d.ts} +0 -0
  337. /package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup → hilo}/generated-types.js +0 -0
  338. /package/dist/destinations/{engage-messaging-sendgrid/sendEmail → hilo/group}/generated-types.js +0 -0
  339. /package/dist/destinations/{engage-messaging-twilio/sendSms → hilo/group}/index.d.ts +0 -0
  340. /package/dist/destinations/{engage-messaging-twilio/sendMobilePush → hilo/identify}/generated-types.js +0 -0
  341. /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → hilo/identify}/index.d.ts +0 -0
  342. /package/dist/destinations/{engage-messaging-twilio/sendSms → hilo/page}/generated-types.js +0 -0
  343. /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → hilo/screen}/generated-types.js +0 -0
@@ -0,0 +1,135 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EngageActionPerformer = void 0;
13
+ const EngageLogger_1 = require("./EngageLogger");
14
+ const EngageStats_1 = require("./EngageStats");
15
+ const track_1 = require("./track");
16
+ const isDestinationActionService_1 = require("./isDestinationActionService");
17
+ const ResponseError_1 = require("./ResponseError");
18
+ const IntegrationErrorWrapper_1 = require("./IntegrationErrorWrapper");
19
+ const truncate_1 = __importDefault(require("lodash/truncate"));
20
+ class EngageActionPerformer {
21
+ constructor(requestClient, executeInput) {
22
+ this.requestClient = requestClient;
23
+ this.executeInput = executeInput;
24
+ this.logger = new EngageLogger_1.EngageLogger(this);
25
+ this.statsClient = new EngageStats_1.EngageStats(this);
26
+ this.payload = executeInput.payload;
27
+ this.settings = executeInput.settings;
28
+ }
29
+ async perform() {
30
+ await this.beforePerform?.();
31
+ return this.doPerform();
32
+ }
33
+ async request(url, options) {
34
+ const op = this.currentOperation;
35
+ op?.onFinally.push(() => {
36
+ const respError = op?.error;
37
+ if (respError) {
38
+ const errorDetails = ResponseError_1.getErrorDetails(respError);
39
+ if (errorDetails.message?.toLowerCase().includes('timeout') && !respError.status)
40
+ respError.status = 408;
41
+ if (errorDetails.code)
42
+ op.tags.push(`response_code:${errorDetails.code}`);
43
+ if (errorDetails.status)
44
+ op.tags.push(`response_status:${errorDetails.status}`);
45
+ if (this.onResponse)
46
+ try {
47
+ this.onResponse({ error: respError, operation: op });
48
+ }
49
+ catch (e) {
50
+ op.logs.push(`Error in onResponse: ${e}`);
51
+ }
52
+ }
53
+ else {
54
+ const resp = op?.result;
55
+ if (resp && resp.status)
56
+ op.tags.push(`response_status:${resp.status}`);
57
+ if (this.onResponse)
58
+ try {
59
+ this.onResponse({ response: resp, operation: op });
60
+ }
61
+ catch (e) {
62
+ op.logs.push(`Error in onResponse: ${e}`);
63
+ }
64
+ }
65
+ });
66
+ return await this.requestClient(url, options);
67
+ }
68
+ redactPii(pii) {
69
+ if (!pii) {
70
+ return pii;
71
+ }
72
+ if (pii.length <= 8) {
73
+ return '***';
74
+ }
75
+ return pii.substring(0, 3) + '***' + pii.substring(pii.length - 3);
76
+ }
77
+ isFeatureActive(featureName, getDefault) {
78
+ if (isDestinationActionService_1.isDestinationActionService())
79
+ return true;
80
+ if (!this.executeInput.features || !(featureName in this.executeInput.features))
81
+ return getDefault?.();
82
+ return this.executeInput.features[featureName];
83
+ }
84
+ logInfo(msg, metadata) {
85
+ this.logger.logInfo(msg, metadata);
86
+ }
87
+ logError(msg, metadata) {
88
+ this.logger.logError(msg, metadata);
89
+ }
90
+ logOnError(logMessage) {
91
+ const op = this.currentOperation;
92
+ op?.onFinally.push(() => {
93
+ if (op.error) {
94
+ const msg = typeof logMessage === 'function' ? logMessage(op) : logMessage;
95
+ op.logs.push(msg);
96
+ }
97
+ });
98
+ }
99
+ statsIncr(metric, value, tags) {
100
+ this.statsClient.stats({ method: 'incr', metric, value, tags });
101
+ }
102
+ statsHistogram(metric, value, tags) {
103
+ this.statsClient.stats({ method: 'histogram', metric, value, tags });
104
+ }
105
+ statsSet(metric, value, tags) {
106
+ this.statsClient.stats({ method: 'set', metric, value, tags });
107
+ }
108
+ get logDetails() {
109
+ return this.logger.logDetails;
110
+ }
111
+ get tags() {
112
+ return this.statsClient.tags;
113
+ }
114
+ rethrowIntegrationError(error, getWrapper) {
115
+ throw IntegrationErrorWrapper_1.IntegrationErrorWrapper.wrap(error, getWrapper, this.currentOperation);
116
+ }
117
+ }
118
+ __decorate([
119
+ track_1.track()
120
+ ], EngageActionPerformer.prototype, "perform", null);
121
+ __decorate([
122
+ track_1.track({
123
+ onTry: addUrlToLog,
124
+ onFinally: addUrlToLog
125
+ })
126
+ ], EngageActionPerformer.prototype, "request", null);
127
+ exports.EngageActionPerformer = EngageActionPerformer;
128
+ function addUrlToLog(ctx) {
129
+ const ctxFull = ctx;
130
+ const argUrl = ctx.funcArgs?.[0];
131
+ if (ctxFull.logs && argUrl) {
132
+ ctxFull.logs.push(truncate_1.default(argUrl, { length: 70 }));
133
+ }
134
+ }
135
+ //# sourceMappingURL=EngageActionPerformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngageActionPerformer.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageAction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E,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,QAAQ,CAAC,MAAc,EAAE,KAAa,EAAE,IAAe;QACrD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAChE,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;IAC/B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IAC9B,CAAC;IAED,uBAAuB,CACrB,KAAc,EACd,UAAmF;QAEnF,MAAM,iDAAuB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC9E,CAAC;CACF;AAvHC;IADC,aAAK,EAAE;oDAIP;AAiBD;IAJC,aAAK,CAAC;QACL,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,WAAW;KACvB,CAAC;oDAiCD;AApEH,sDAuIC;AAED,SAAS,WAAW,CAAC,GAAQ;IAE3B,MAAM,OAAO,GAAG,GAAuB,CAAA;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAChC,IAAI,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE;QAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;KACpD;AACH,CAAC"}
@@ -1,15 +1,18 @@
1
1
  import { Logger } from '@segment/actions-core/destination-kit';
2
- import { OperationLogger, OperationLoggerContext, TryCatchFinallyHook } from '../operationTracking';
3
- import { MessageSender } from './message-sender';
2
+ import { OperationLogger, OperationLoggerContext, TryCatchFinallyHook } from './operationTracking';
3
+ import { EngageActionPerformer } from './EngageActionPerformer';
4
4
  export declare const FLAGON_NAME_LOG_INFO = "engage-messaging-log-info";
5
5
  export declare const FLAGON_NAME_LOG_ERROR = "engage-messaging-log-error";
6
- export declare class MessageLogger extends OperationLogger {
7
- messageSender: MessageSender<any>;
6
+ export declare class EngageLogger extends OperationLogger {
7
+ actionPerformer: EngageActionPerformer;
8
8
  static getTryCatchFinallyHook(_ctx: OperationLoggerContext): TryCatchFinallyHook<OperationLoggerContext>;
9
- constructor(messageSender: MessageSender<any>);
9
+ constructor(actionPerformer: EngageActionPerformer);
10
10
  readonly channelType: string;
11
11
  get loggerClient(): Logger | undefined;
12
12
  readonly logDetails: Record<string, unknown>;
13
13
  logInfo(msg: string, metadata?: object): void;
14
14
  logError(msg: string, metadata?: object): void;
15
+ error(msg: string, metadata?: object): void;
16
+ info(msg: string, metadata?: object): void;
17
+ getErrorMessage(error: unknown): string;
15
18
  }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EngageLogger = exports.FLAGON_NAME_LOG_ERROR = exports.FLAGON_NAME_LOG_INFO = void 0;
4
+ const operationTracking_1 = require("./operationTracking");
5
+ const ResponseError_1 = require("./ResponseError");
6
+ exports.FLAGON_NAME_LOG_INFO = 'engage-messaging-log-info';
7
+ exports.FLAGON_NAME_LOG_ERROR = 'engage-messaging-log-error';
8
+ class EngageLogger extends operationTracking_1.OperationLogger {
9
+ constructor(actionPerformer) {
10
+ super();
11
+ this.actionPerformer = actionPerformer;
12
+ this.logDetails = {};
13
+ this.channelType = this.actionPerformer.getChannelType().toUpperCase();
14
+ }
15
+ static getTryCatchFinallyHook(_ctx) {
16
+ const msgSender = _ctx.funcThis;
17
+ return msgSender?.logger;
18
+ }
19
+ get loggerClient() {
20
+ return this.actionPerformer.executeInput.logger;
21
+ }
22
+ logInfo(msg, metadata) {
23
+ const msgs = [msg, ...(metadata ? [JSON.stringify(metadata)] : [])];
24
+ if (!this.actionPerformer.isFeatureActive(exports.FLAGON_NAME_LOG_INFO, () => false))
25
+ return;
26
+ const [firstMsg, ...rest] = msgs;
27
+ this.loggerClient?.info(`TE Messaging: ${this.channelType} ${firstMsg}`, ...rest, JSON.stringify({ ...this.logDetails, ...metadata }));
28
+ }
29
+ logError(msg, metadata) {
30
+ if (!this.actionPerformer.isFeatureActive(exports.FLAGON_NAME_LOG_ERROR, () => false))
31
+ return;
32
+ const msgPrefix = `⛔ TE Messaging: ${this.channelType}`;
33
+ this.loggerClient?.error(`${msgPrefix} ${msg}`, JSON.stringify({ ...this.logDetails, ...metadata }));
34
+ }
35
+ error(msg, metadata) {
36
+ return this.logError(msg, metadata);
37
+ }
38
+ info(msg, metadata) {
39
+ return this.logInfo(msg, metadata);
40
+ }
41
+ getErrorMessage(error) {
42
+ const errorDetails = ResponseError_1.getErrorDetails(error);
43
+ let res = `${errorDetails.message}`;
44
+ if (errorDetails.code)
45
+ res += `. Code: ${errorDetails.code}`;
46
+ if (errorDetails.status)
47
+ res += `. Status: ${errorDetails.status}`;
48
+ return res;
49
+ }
50
+ }
51
+ exports.EngageLogger = EngageLogger;
52
+ //# sourceMappingURL=EngageLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngageLogger.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageLogger.ts"],"names":[],"mappings":";;;AAGA,2DAAkG;AAElG,mDAAiD;AAEpC,QAAA,oBAAoB,GAAG,2BAA2B,CAAA;AAClD,QAAA,qBAAqB,GAAG,4BAA4B,CAAA;AAEjE,MAAa,YAAa,SAAQ,mCAAe;IAM/C,YAAmB,eAAsC;QACvD,KAAK,EAAE,CAAA;QADU,oBAAe,GAAf,eAAe,CAAuB;QAQhD,eAAU,GAA4B,EAAE,CAAA;QAN/C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,EAAE,CAAC,WAAW,EAAE,CAAA;IACxE,CAAC;IARD,MAAM,CAAC,sBAAsB,CAAC,IAA4B;QACxD,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O,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,CAAC,GAAW,EAAE,QAAiB;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;IAED,eAAe,CAAC,KAAc;QAC5B,MAAM,YAAY,GAAG,+BAAe,CAAC,KAAK,CAAC,CAAA;QAC3C,IAAI,GAAG,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,CAAA;QACnC,IAAI,YAAY,CAAC,IAAI;YAAE,GAAG,IAAI,WAAW,YAAY,CAAC,IAAI,EAAE,CAAA;QAC5D,IAAI,YAAY,CAAC,MAAM;YAAE,GAAG,IAAI,aAAa,YAAY,CAAC,MAAM,EAAE,CAAA;QAClE,OAAO,GAAG,CAAA;IACZ,CAAC;CACF;AA9CD,oCA8CC"}
@@ -0,0 +1,18 @@
1
+ import { StatsClient } from '@segment/actions-core/destination-kit';
2
+ import { StatsArgs, OperationStats, OperationStatsContext, TryCatchFinallyHook, TrackedError } from './operationTracking';
3
+ import { EngageActionPerformer } from './EngageActionPerformer';
4
+ export declare class EngageStats extends OperationStats {
5
+ actionPerformer: EngageActionPerformer;
6
+ static getTryCatchFinallyHook(_ctx: OperationStatsContext): TryCatchFinallyHook<OperationStatsContext>;
7
+ constructor(actionPerformer: EngageActionPerformer);
8
+ onTry(ctx: OperationStatsContext): () => void;
9
+ get statsClient(): StatsClient | undefined;
10
+ get tags(): string[];
11
+ _tags: string[];
12
+ stats(statsArgs: StatsArgs): void;
13
+ incr(metric: string, value?: number, tags?: string[]): void;
14
+ histogram(metric: string, value?: number, tags?: string[]): void;
15
+ set(metric: string, value?: number, tags?: string[]): void;
16
+ extractTagsFromError(error: TrackedError, ctx: OperationStatsContext): string[];
17
+ getOperationNameTag(ctx: OperationStatsContext): string | undefined;
18
+ }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageStats = void 0;
4
- const operationTracking_1 = require("../operationTracking");
5
- class MessageStats extends operationTracking_1.OperationStats {
6
- constructor(messageSender) {
3
+ exports.EngageStats = void 0;
4
+ const operationTracking_1 = require("./operationTracking");
5
+ class EngageStats extends operationTracking_1.OperationStats {
6
+ constructor(actionPerformer) {
7
7
  super();
8
- this.messageSender = messageSender;
8
+ this.actionPerformer = actionPerformer;
9
+ this._tags = [];
9
10
  }
10
11
  static getTryCatchFinallyHook(_ctx) {
11
12
  const msgSender = _ctx.funcThis;
@@ -13,7 +14,7 @@ class MessageStats extends operationTracking_1.OperationStats {
13
14
  }
14
15
  onTry(ctx) {
15
16
  const res = super.onTry(ctx);
16
- ctx.sharedContext.tags.push(`space_id:${this.messageSender.settings.spaceId}`, `projectid:${this.messageSender.settings.sourceId}`, `region:${this.messageSender.settings.region}`, `channel:${this.messageSender.getChannelType()}`);
17
+ ctx.sharedContext.tags.push(`space_id:${this.actionPerformer.settings.spaceId}`, `projectid:${this.actionPerformer.settings.sourceId}`, `region:${this.actionPerformer.settings.region}`, `channel:${this.actionPerformer.getChannelType()}`);
17
18
  const parentOperation = ctx.parent;
18
19
  if (parentOperation) {
19
20
  const operation_path = this.getOperationNameTag(parentOperation);
@@ -23,7 +24,14 @@ class MessageStats extends operationTracking_1.OperationStats {
23
24
  return res;
24
25
  }
25
26
  get statsClient() {
26
- return this.messageSender.executeInput.statsContext?.statsClient;
27
+ return this.actionPerformer.executeInput.statsContext?.statsClient;
28
+ }
29
+ get tags() {
30
+ if (this.actionPerformer.currentOperation?.tags)
31
+ return this.actionPerformer.currentOperation.tags;
32
+ if (this.actionPerformer.executeInput.statsContext?.tags)
33
+ return this.actionPerformer.executeInput.statsContext?.tags;
34
+ return this._tags;
27
35
  }
28
36
  stats(statsArgs) {
29
37
  if (!this.statsClient)
@@ -48,10 +56,16 @@ class MessageStats extends operationTracking_1.OperationStats {
48
56
  default:
49
57
  break;
50
58
  }
51
- statsFunc?.(`actions_personas_messaging_twilio.${metric}`, typeof value === 'undefined' ? 1 : value, [
52
- ...(this.messageSender.executeInput.statsContext?.tags || []),
53
- ...(tags ?? [])
54
- ]);
59
+ statsFunc?.(`${this.actionPerformer.getIntegrationStatsName()}.${metric}`, typeof value === 'undefined' ? 1 : value, [...(this.actionPerformer.executeInput.statsContext?.tags || []), ...(tags ?? [])]);
60
+ }
61
+ incr(metric, value, tags) {
62
+ this.stats({ metric, value, tags, method: 'incr' });
63
+ }
64
+ histogram(metric, value, tags) {
65
+ this.stats({ metric, value, tags, method: 'histogram' });
66
+ }
67
+ set(metric, value, tags) {
68
+ this.stats({ metric, value, tags, method: 'set' });
55
69
  }
56
70
  extractTagsFromError(error, ctx) {
57
71
  const res = super.extractTagsFromError(error, ctx);
@@ -71,8 +85,8 @@ class MessageStats extends operationTracking_1.OperationStats {
71
85
  getOperationNameTag(ctx) {
72
86
  if (!ctx)
73
87
  return undefined;
74
- return this.messageSender.logger.getOperationName(ctx, true, '::');
88
+ return this.actionPerformer.logger.getOperationName(ctx, true, '::');
75
89
  }
76
90
  }
77
- exports.MessageStats = MessageStats;
78
- //# sourceMappingURL=MessageStats.js.map
91
+ exports.EngageStats = EngageStats;
92
+ //# sourceMappingURL=EngageStats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngageStats.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageStats.ts"],"names":[],"mappings":";;;AAEA,2DAM4B;AAK5B,MAAa,WAAY,SAAQ,kCAAc;IAM7C,YAAmB,eAAsC;QACvD,KAAK,EAAE,CAAA;QADU,oBAAe,GAAf,eAAe,CAAuB;QA+BzD,UAAK,GAAa,EAAE,CAAA;IA7BpB,CAAC;IAPD,MAAM,CAAC,sBAAsB,CAAC,IAA2B;QACvD,MAAM,SAAS,GAAG,IAAI,CAAC,QAAiC,CAAA;QACxD,OAAO,SAAS,EAAE,WAAW,CAAA;IAC/B,CAAC;IAMD,KAAK,CAAC,GAA0B;QAC9B,MAAM,GA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AC;CACF;AA7GD,kCA6GC"}
@@ -1,5 +1,5 @@
1
1
  import { IntegrationError } from '@segment/actions-core';
2
- import { TryCatchFinallyContext, TryCatchFinallyHook } from '../operationTracking';
2
+ import { TryCatchFinallyContext, TryCatchFinallyHook } from './operationTracking';
3
3
  export declare type IntegrationErrorWrapperContext<TContext extends TryCatchFinallyContext = TryCatchFinallyContext> = TContext & {
4
4
  decoratorArgs?: {
5
5
  wrapIntegrationError?: (ctx: TContext) => IntegrationError | ConstructorParameters<typeof IntegrationError>;
@@ -8,5 +8,5 @@ export declare type IntegrationErrorWrapperContext<TContext extends TryCatchFina
8
8
  export declare class IntegrationErrorWrapper {
9
9
  static getTryCatchFinallyHook(_ctx: IntegrationErrorWrapperContext): TryCatchFinallyHook<IntegrationErrorWrapperContext>;
10
10
  static onCatch(ctx: IntegrationErrorWrapperContext): void;
11
- static wrap<TContext extends TryCatchFinallyContext>(error: unknown, getWrapper: () => IntegrationError | ConstructorParameters<typeof IntegrationError>, ctx?: TContext): import("../operationTracking").TrackedError<TryCatchFinallyContext<(this: any, ...args: any[]) => any>> | undefined;
11
+ static wrap<TContext extends TryCatchFinallyContext>(error: unknown, getWrapper: () => IntegrationError | ConstructorParameters<typeof IntegrationError>, ctx?: TContext): import("./operationTracking").TrackedError<TryCatchFinallyContext<(this: any, ...args: any[]) => any>> | undefined;
12
12
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IntegrationErrorWrapper = void 0;
4
4
  const actions_core_1 = require("@segment/actions-core");
5
- const operationTracking_1 = require("../operationTracking");
5
+ const operationTracking_1 = require("./operationTracking");
6
6
  class IntegrationErrorWrapper {
7
7
  static getTryCatchFinallyHook(_ctx) {
8
8
  return this;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntegrationErrorWrapper.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/IntegrationErrorWrapper.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2DAAwG;AAcxG,MAAa,uBAAuB;IAClC,MAAM,CAAC,sBAAsB,CAC3B,IAAoC;QAEpC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,GAAmC;QAChD,MAAM,UAAU,GAAG,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAA;QAC1D,IAAI,CAAC,UAAU;YAAE,OAAM;QACvB,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,CAAC,IAAI,CACT,KAAc,EACd,UAAmF,EACnF,GAAc;QAEd,OAAO,yCAAqB,CAAC,IAAI,CAC/B,KAAK,EACL,GAAG,EAAE;YACH,IAAI,KAAK,YAAY,+BAAgB;gBAAE,OAAO,KAAK,CAAA;YACnD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;YAC5B,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,+BAAgB,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAkB,CAAA;YAG1G,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAA;YAC9D,IAAI,mBAAmB,EAAE;gBACvB,WAAW,CAAC,MAAM,GAAG,mBAAmB,CAAA;aACzC;YACD,OAAO,WAAW,CAAA;QACpB,CAAC,EACD,GAAG,CACJ,CAAA;IACH,CAAC;CACF;AAlCD,0DAkCC"}
@@ -0,0 +1,63 @@
1
+ import { EngageActionPerformer } from './EngageActionPerformer';
2
+ import { MaybePromise } from '@segment/actions-core/destination-kit/types';
3
+ export declare enum SendabilityStatus {
4
+ ShouldSend = "should_send",
5
+ NoSupportedExternalIds = "no_supported_ids",
6
+ NotSubscribed = "not_subscribed",
7
+ SendDisabled = "send_disabled",
8
+ InvalidSubscriptionStatus = "invalid_subscription_status"
9
+ }
10
+ export interface MessagePayloadBase {
11
+ send?: boolean;
12
+ userId?: string;
13
+ customArgs?: {
14
+ [k: string]: unknown;
15
+ };
16
+ externalIds?: {
17
+ id?: string;
18
+ type?: string;
19
+ channelType?: string;
20
+ subscriptionStatus?: string;
21
+ }[];
22
+ traitEnrichment?: boolean;
23
+ traits?: {
24
+ [k: string]: unknown;
25
+ };
26
+ }
27
+ export interface MessageSettingsBase {
28
+ region?: string;
29
+ sourceId?: string;
30
+ spaceId?: string;
31
+ profileApiEnvironment: string;
32
+ profileApiAccessToken: string;
33
+ }
34
+ export declare type ExtId<TPayload extends MessagePayloadBase> = NonNullable<TPayload['externalIds']>[number];
35
+ export interface SendabilityPayload<TPayload extends MessagePayloadBase> {
36
+ sendabilityStatus: SendabilityStatus | string;
37
+ recepients?: ExtId<TPayload>[];
38
+ invalid?: ExtId<TPayload>[];
39
+ }
40
+ export declare type RecepientSendResult<TPayload extends MessagePayloadBase, TResult = any> = {
41
+ recepient: ExtId<TPayload>;
42
+ status: 'fulfilled' | 'rejected';
43
+ result?: TResult;
44
+ error?: any;
45
+ };
46
+ export declare abstract class MessageSendPerformer<TSettings extends MessageSettingsBase, TPayload extends MessagePayloadBase> extends EngageActionPerformer<TSettings, TPayload> {
47
+ doPerform(): Promise<RecepientSendResult<TPayload, any>[]>;
48
+ abstract isSupportedExternalId(externalId: NonNullable<TPayload['externalIds']>[number]): boolean;
49
+ static readonly nonSendableStatuses: string[];
50
+ static readonly sendableStatuses: string[];
51
+ getStaticMembersOfThisClass<ThisStaticClass extends typeof MessageSendPerformer = typeof MessageSendPerformer>(): ThisStaticClass;
52
+ isExternalIdSubscribed(extId: ExtId<TPayload>): boolean | undefined;
53
+ getSendabilityPayload(): SendabilityPayload<TPayload>;
54
+ getRecepients(): ExtId<TPayload>[];
55
+ abstract sendToRecepient(recepient: ExtId<TPayload>): any;
56
+ beforePerform(): void;
57
+ getDefaultSettingsRegion?(): string;
58
+ statsEventDeliveryTs(): void;
59
+ beforeSend?(recepients: ExtId<TPayload>[]): MaybePromise<void>;
60
+ forAllRecepients<TResult = any>(sendToRecepient: (recepient: ExtId<TPayload>) => TResult): Promise<RecepientSendResult<TPayload, TResult>[]>;
61
+ aggregateSendResults(sendResults: RecepientSendResult<TPayload>[]): any;
62
+ getProfileTraits(): Promise<Record<string, string>>;
63
+ }
@@ -0,0 +1,191 @@
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.MessageSendPerformer = exports.SendabilityStatus = void 0;
10
+ const EngageActionPerformer_1 = require("./EngageActionPerformer");
11
+ const isRetryableError_1 = require("./isRetryableError");
12
+ const AggregateError_1 = require("./AggregateError");
13
+ const getProfileApiEndpoint_1 = require("./getProfileApiEndpoint");
14
+ const track_1 = require("./track");
15
+ const actions_core_1 = require("@segment/actions-core");
16
+ var SendabilityStatus;
17
+ (function (SendabilityStatus) {
18
+ SendabilityStatus["ShouldSend"] = "should_send";
19
+ SendabilityStatus["NoSupportedExternalIds"] = "no_supported_ids";
20
+ SendabilityStatus["NotSubscribed"] = "not_subscribed";
21
+ SendabilityStatus["SendDisabled"] = "send_disabled";
22
+ SendabilityStatus["InvalidSubscriptionStatus"] = "invalid_subscription_status";
23
+ })(SendabilityStatus = exports.SendabilityStatus || (exports.SendabilityStatus = {}));
24
+ class MessageSendPerformer extends EngageActionPerformer_1.EngageActionPerformer {
25
+ async doPerform() {
26
+ const res = this.forAllRecepients((recepient) => this.sendToRecepient(recepient));
27
+ this.statsEventDeliveryTs();
28
+ return res;
29
+ }
30
+ getStaticMembersOfThisClass() {
31
+ return this.constructor;
32
+ }
33
+ isExternalIdSubscribed(extId) {
34
+ const staticMems = this.getStaticMembersOfThisClass();
35
+ const subStatus = extId.subscriptionStatus?.toString()?.toLowerCase();
36
+ if (!subStatus)
37
+ return false;
38
+ if (staticMems.sendableStatuses.includes(subStatus))
39
+ return true;
40
+ if (staticMems.nonSendableStatuses.includes(subStatus))
41
+ return false;
42
+ return undefined;
43
+ }
44
+ getSendabilityPayload() {
45
+ if (!this.payload.send) {
46
+ return { sendabilityStatus: SendabilityStatus.SendDisabled };
47
+ }
48
+ const supportedExtIdsWithSub = this.payload.externalIds
49
+ ?.filter((extId) => this.isSupportedExternalId(extId))
50
+ .map((extId) => ({ extId, isSubscribed: this.isExternalIdSubscribed(extId) }));
51
+ if (!supportedExtIdsWithSub || !supportedExtIdsWithSub.length)
52
+ return {
53
+ sendabilityStatus: SendabilityStatus.NoSupportedExternalIds
54
+ };
55
+ const invalidSubStatuses = supportedExtIdsWithSub.filter((e) => e.isSubscribed === undefined).map((e) => e.extId);
56
+ const subscribedExtIds = supportedExtIdsWithSub.filter((e) => e.isSubscribed === true).map((e) => e.extId);
57
+ if (!subscribedExtIds.length) {
58
+ return invalidSubStatuses.length == 0
59
+ ? {
60
+ sendabilityStatus: SendabilityStatus.NotSubscribed
61
+ }
62
+ : {
63
+ sendabilityStatus: SendabilityStatus.InvalidSubscriptionStatus,
64
+ invalid: invalidSubStatuses
65
+ };
66
+ }
67
+ if (subscribedExtIds.length) {
68
+ const subWithIds = subscribedExtIds.filter((extId) => extId.id);
69
+ return {
70
+ sendabilityStatus: subWithIds.length > 0 ? SendabilityStatus.ShouldSend : SendabilityStatus.NoSupportedExternalIds,
71
+ recepients: subWithIds.length > 0 ? subWithIds : subscribedExtIds,
72
+ invalid: invalidSubStatuses
73
+ };
74
+ }
75
+ if (invalidSubStatuses.length)
76
+ return {
77
+ sendabilityStatus: SendabilityStatus.InvalidSubscriptionStatus,
78
+ invalid: invalidSubStatuses
79
+ };
80
+ return {
81
+ sendabilityStatus: SendabilityStatus.NoSupportedExternalIds,
82
+ recepients: supportedExtIdsWithSub.map((e) => e.extId)
83
+ };
84
+ }
85
+ getRecepients() {
86
+ const sendabilityPayload = this.getSendabilityPayload();
87
+ const shouldSend = sendabilityPayload.sendabilityStatus === SendabilityStatus.ShouldSend;
88
+ this.currentOperation?.tags.push('sendability_status:' + sendabilityPayload.sendabilityStatus);
89
+ this.currentOperation?.logs.push(shouldSend
90
+ ? `Sending message to recepients (${sendabilityPayload.recepients?.length}): ${sendabilityPayload.recepients
91
+ ?.map((r) => this.redactPii(r.id))
92
+ .join(', ')}})`
93
+ : `Not sending message because ${sendabilityPayload.sendabilityStatus?.toUpperCase()}. Recepients (${sendabilityPayload.recepients?.length})`);
94
+ return sendabilityPayload.sendabilityStatus == SendabilityStatus.ShouldSend
95
+ ? sendabilityPayload.recepients || []
96
+ : [];
97
+ }
98
+ beforePerform() {
99
+ if (!this.settings.region && this.getDefaultSettingsRegion) {
100
+ this.settings.region = this.getDefaultSettingsRegion();
101
+ }
102
+ Object.assign(this.logDetails, {
103
+ externalIds: this.payload.externalIds?.map((eid) => ({ ...eid, id: this.redactPii(eid.id) })),
104
+ shouldSend: this.payload.send,
105
+ region: this.settings.region,
106
+ sourceId: this.settings.sourceId,
107
+ spaceId: this.settings.spaceId,
108
+ messageId: this.executeInput['rawData']?.messageId,
109
+ channelType: this.getChannelType()
110
+ });
111
+ if ('userId' in this.payload)
112
+ this.logDetails.userId = this.payload.userId;
113
+ if ('deliveryAttempt' in this.executeInput['rawData']) {
114
+ const delivery_attempt = this.executeInput['rawData'].deliveryAttempt;
115
+ this.currentOperation?.tags.push(`delivery_attempt:${delivery_attempt}`);
116
+ this.logDetails['delivery_attempt'] = delivery_attempt;
117
+ }
118
+ }
119
+ statsEventDeliveryTs() {
120
+ const eventOccurredTS = this.payload?.eventOccurredTS;
121
+ if (typeof eventOccurredTS === 'number') {
122
+ this.statsHistogram('eventDeliveryTS', Date.now() - new Date(eventOccurredTS).getTime());
123
+ }
124
+ }
125
+ async forAllRecepients(sendToRecepient) {
126
+ const recepients = this.getRecepients();
127
+ await this.beforeSend?.(recepients);
128
+ const results = (await Promise.allSettled(recepients.map((recepient) => sendToRecepient(recepient)))).map((r, i) => ({
129
+ recepient: recepients[i],
130
+ status: r.status,
131
+ ...(r.status === 'rejected' ? { error: r.reason } : { result: r.value })
132
+ }));
133
+ return this.aggregateSendResults(results);
134
+ }
135
+ aggregateSendResults(sendResults) {
136
+ if (!sendResults.length) {
137
+ return;
138
+ }
139
+ if (sendResults.length === 1) {
140
+ if (sendResults[0].status === 'rejected') {
141
+ throw sendResults[0].error;
142
+ }
143
+ else {
144
+ return sendResults[0].result;
145
+ }
146
+ }
147
+ const fulfilled = sendResults.filter((sr) => sr.status === 'fulfilled');
148
+ if (fulfilled.length) {
149
+ return fulfilled.map((sr) => sr.result);
150
+ }
151
+ const rejected = sendResults.filter((sr) => sr.status === 'rejected');
152
+ if (rejected.every((r) => isRetryableError_1.isRetryableError(r.error))) {
153
+ throw AggregateError_1.AggregateError.create({
154
+ errors: rejected.map((r) => r.error),
155
+ message: (msg) => 'Failed to send to all subscribed recepients (retryable):' + msg
156
+ });
157
+ }
158
+ const firstNonRetryable = rejected.find((r) => !isRetryableError_1.isRetryableError(r.error))?.error;
159
+ throw AggregateError_1.AggregateError.create({
160
+ errors: rejected.map((r) => r.error),
161
+ takeCodeAndStatusFromError: firstNonRetryable,
162
+ message: (msg) => 'Failed to send to all subscribed recepients (non-retryable):' + msg
163
+ });
164
+ }
165
+ async getProfileTraits() {
166
+ if (this.payload.traitEnrichment)
167
+ return this.payload?.traits || {};
168
+ if (!this.payload.userId) {
169
+ throw new actions_core_1.PayloadValidationError('No userId provided and no traits provided');
170
+ }
171
+ const endpoint = getProfileApiEndpoint_1.getProfileApiEndpoint(this.settings.profileApiEnvironment, this.settings.region);
172
+ const encodedProfileId = encodeURIComponent(this.payload.userId);
173
+ const response = await this.request(`${endpoint}/v1/spaces/${this.settings.spaceId}/collections/users/profiles/user_id:${encodedProfileId}/traits?limit=200`, {
174
+ headers: {
175
+ authorization: `Basic ${Buffer.from(this.settings.profileApiAccessToken + ':').toString('base64')}`,
176
+ 'content-type': 'application/json'
177
+ }
178
+ });
179
+ const body = await response.json();
180
+ return body.traits;
181
+ }
182
+ }
183
+ MessageSendPerformer.nonSendableStatuses = ['unsubscribed', 'did not subscribed', 'false'];
184
+ MessageSendPerformer.sendableStatuses = ['subscribed', 'true'];
185
+ __decorate([
186
+ track_1.track({
187
+ wrapIntegrationError: () => ['Unable to get profile traits', 'SMS trait fetch failure', 500]
188
+ })
189
+ ], MessageSendPerformer.prototype, "getProfileTraits", null);
190
+ exports.MessageSendPerformer = MessageSendPerformer;
191
+ //# sourceMappingURL=MessageSendPerformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageSendPerformer.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/MessageSendPerformer.ts"],"names":[],"mappings":";;;;;;;;;AAGA,mEAA+D;AAC/D,yDAAqD;AACrD,qDAAiD;AAEjD,mEAAuE;AACvE,mCAA+B;AAC/B,wDAA8D;AAE9D,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,+CAA0B,CAAA;IAI1B,gEAA2C,CAAA;IAC3C,qDAAgC,CAAA;IAChC,mDAA8B,CAAA;IAC9B,8EAAyD,CAAA;AAC3D,CAAC,EATW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAS5B;AAwDD,MAAsB,oBAGpB,SAAQ,6CAA0C;IAClD,KAAK,CAAC,SAAS;QAEb,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAA;QA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