@segment/action-destinations 3.134.1-staging.1 → 3.136.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 (358) hide show
  1. package/dist/destinations/actable-predictive/index.js +1 -1
  2. package/dist/destinations/actable-predictive/index.js.map +1 -1
  3. package/dist/destinations/actable-predictive/sendCustomEvent/index.js +13 -13
  4. package/dist/destinations/actable-predictive/sendCustomEvent/index.js.map +1 -1
  5. package/dist/destinations/actable-predictive/sendEmailEvent/index.js +20 -20
  6. package/dist/destinations/actable-predictive/sendEmailEvent/index.js.map +1 -1
  7. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js +28 -28
  8. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js.map +1 -1
  9. package/dist/destinations/actable-predictive/sendWebEvent/index.js +25 -25
  10. package/dist/destinations/actable-predictive/sendWebEvent/index.js.map +1 -1
  11. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.d.ts +18 -12
  12. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.js +305 -32
  13. package/dist/destinations/blackbaud-raisers-edge-nxt/api/index.js.map +1 -1
  14. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.d.ts +3 -1
  15. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.js +4 -2
  16. package/dist/destinations/blackbaud-raisers-edge-nxt/constants/index.js.map +1 -1
  17. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/fixtures.d.ts +4 -0
  18. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/fixtures.js +30 -0
  19. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/fixtures.js.map +1 -0
  20. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/generated-types.d.ts +53 -0
  21. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/generated-types.js.map +1 -0
  22. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/index.d.ts +5 -0
  23. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/index.js +146 -0
  24. package/dist/destinations/blackbaud-raisers-edge-nxt/createConstituentAction/index.js.map +1 -0
  25. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/fixtures.d.ts +27 -0
  26. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/fixtures.js +60 -0
  27. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/fixtures.js.map +1 -0
  28. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/generated-types.d.ts +63 -0
  29. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/generated-types.js.map +1 -0
  30. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/index.js +230 -0
  31. package/dist/destinations/blackbaud-raisers-edge-nxt/createGift/index.js.map +1 -0
  32. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/fixtures.js +1 -1
  33. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/fixtures.js.map +1 -1
  34. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/generated-types.d.ts +1 -0
  35. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.d.ts +3 -1
  36. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.js +277 -550
  37. package/dist/destinations/blackbaud-raisers-edge-nxt/createOrUpdateIndividualConstituent/index.js.map +1 -1
  38. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js +4 -0
  39. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js.map +1 -1
  40. package/dist/destinations/blackbaud-raisers-edge-nxt/types/index.d.ts +81 -8
  41. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +10 -1
  42. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.js +195 -5
  43. package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.js.map +1 -1
  44. package/dist/destinations/braze/trackEvent/generated-types.d.ts +1 -0
  45. package/dist/destinations/braze/trackEvent/index.js +11 -35
  46. package/dist/destinations/braze/trackEvent/index.js.map +1 -1
  47. package/dist/destinations/braze/trackPurchase/index.js +2 -43
  48. package/dist/destinations/braze/trackPurchase/index.js.map +1 -1
  49. package/dist/destinations/braze/utils.d.ts +7 -0
  50. package/dist/destinations/braze/utils.js +103 -0
  51. package/dist/destinations/braze/utils.js.map +1 -0
  52. package/dist/destinations/braze-cohorts/syncAudiences/index.js +1 -1
  53. package/dist/destinations/braze-cohorts/syncAudiences/index.js.map +1 -1
  54. package/dist/destinations/clevertap/userDelete/index.js +4 -4
  55. package/dist/destinations/clevertap/userDelete/index.js.map +1 -1
  56. package/dist/destinations/cordial/addContactToList/index.js.map +1 -1
  57. package/dist/destinations/cordial/addProductToCart/index.js +1 -1
  58. package/dist/destinations/cordial/addProductToCart/index.js.map +1 -1
  59. package/dist/destinations/cordial/cordial-client.js +2 -2
  60. package/dist/destinations/cordial/createContactactivity/index.js.map +1 -1
  61. package/dist/destinations/cordial/identities-fields.d.ts +1 -1
  62. package/dist/destinations/cordial/identities-fields.js +1 -1
  63. package/dist/destinations/cordial/identities-fields.js.map +1 -1
  64. package/dist/destinations/cordial/index.js +1 -1
  65. package/dist/destinations/cordial/index.js.map +1 -1
  66. package/dist/destinations/cordial/mergeContacts/index.js.map +1 -1
  67. package/dist/destinations/cordial/removeContactFromList/index.js.map +1 -1
  68. package/dist/destinations/cordial/removeProductFromCart/index.js.map +1 -1
  69. package/dist/destinations/cordial/upsertOrder/index.js +8 -8
  70. package/dist/destinations/cordial/upsertOrder/index.js.map +1 -1
  71. package/dist/destinations/criteo-audiences/addUserToAudience/generated-types.d.ts +1 -0
  72. package/dist/destinations/criteo-audiences/addUserToAudience/index.js +11 -2
  73. package/dist/destinations/criteo-audiences/addUserToAudience/index.js.map +1 -1
  74. package/dist/destinations/criteo-audiences/criteo-audiences.d.ts +1 -0
  75. package/dist/destinations/criteo-audiences/criteo-audiences.js +11 -2
  76. package/dist/destinations/criteo-audiences/criteo-audiences.js.map +1 -1
  77. package/dist/destinations/criteo-audiences/removeUserFromAudience/generated-types.d.ts +1 -0
  78. package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js +11 -2
  79. package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js.map +1 -1
  80. package/dist/destinations/emarsys/triggerEvent/index.js +1 -0
  81. package/dist/destinations/emarsys/triggerEvent/index.js.map +1 -1
  82. package/dist/destinations/emarsys/upsertContact/generated-types.d.ts +1 -0
  83. package/dist/destinations/emarsys/upsertContact/index.js +1 -0
  84. package/dist/destinations/emarsys/upsertContact/index.js.map +1 -1
  85. package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +1 -1
  86. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +5 -2
  87. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
  88. package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.d.ts +1 -1
  89. package/dist/destinations/engage-messaging-twilio/sendSms/index.js +0 -1
  90. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  91. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +4 -1
  92. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +1 -1
  93. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +1 -1
  94. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +1 -1
  95. package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +2 -0
  96. package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +2 -0
  97. package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +2 -2
  98. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +2 -2
  99. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
  100. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +13 -1
  101. package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +1 -1
  102. package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +2 -0
  103. package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
  104. package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +2 -0
  105. package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +2 -0
  106. package/dist/destinations/facebook-conversions-api/purchase/index.js +3 -3
  107. package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
  108. package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +2 -0
  109. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +2 -0
  110. package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +3 -1
  111. package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +14 -10
  112. package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
  113. package/dist/destinations/google-analytics-4/addToCart/generated-types.d.ts +3 -1
  114. package/dist/destinations/google-analytics-4/addToCart/index.js +11 -7
  115. package/dist/destinations/google-analytics-4/addToCart/index.js.map +1 -1
  116. package/dist/destinations/google-analytics-4/addToWishlist/generated-types.d.ts +3 -1
  117. package/dist/destinations/google-analytics-4/addToWishlist/index.js +13 -9
  118. package/dist/destinations/google-analytics-4/addToWishlist/index.js.map +1 -1
  119. package/dist/destinations/google-analytics-4/beginCheckout/generated-types.d.ts +3 -1
  120. package/dist/destinations/google-analytics-4/beginCheckout/index.js +11 -7
  121. package/dist/destinations/google-analytics-4/beginCheckout/index.js.map +1 -1
  122. package/dist/destinations/google-analytics-4/customEvent/generated-types.d.ts +3 -1
  123. package/dist/destinations/google-analytics-4/customEvent/index.js +10 -6
  124. package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
  125. package/dist/destinations/google-analytics-4/ga4-functions.d.ts +7 -0
  126. package/dist/destinations/google-analytics-4/ga4-functions.js +44 -7
  127. package/dist/destinations/google-analytics-4/ga4-functions.js.map +1 -1
  128. package/dist/destinations/google-analytics-4/ga4-properties.d.ts +2 -0
  129. package/dist/destinations/google-analytics-4/ga4-properties.js +17 -3
  130. package/dist/destinations/google-analytics-4/ga4-properties.js.map +1 -1
  131. package/dist/destinations/google-analytics-4/ga4-types.d.ts +14 -0
  132. package/dist/destinations/google-analytics-4/ga4-types.js +6 -0
  133. package/dist/destinations/google-analytics-4/ga4-types.js.map +1 -1
  134. package/dist/destinations/google-analytics-4/generateLead/generated-types.d.ts +3 -1
  135. package/dist/destinations/google-analytics-4/generateLead/index.js +11 -7
  136. package/dist/destinations/google-analytics-4/generateLead/index.js.map +1 -1
  137. package/dist/destinations/google-analytics-4/generated-types.d.ts +2 -1
  138. package/dist/destinations/google-analytics-4/index.js +16 -11
  139. package/dist/destinations/google-analytics-4/index.js.map +1 -1
  140. package/dist/destinations/google-analytics-4/login/generated-types.d.ts +3 -1
  141. package/dist/destinations/google-analytics-4/login/index.js +10 -6
  142. package/dist/destinations/google-analytics-4/login/index.js.map +1 -1
  143. package/dist/destinations/google-analytics-4/pageView/generated-types.d.ts +3 -1
  144. package/dist/destinations/google-analytics-4/pageView/index.js +10 -6
  145. package/dist/destinations/google-analytics-4/pageView/index.js.map +1 -1
  146. package/dist/destinations/google-analytics-4/purchase/generated-types.d.ts +3 -1
  147. package/dist/destinations/google-analytics-4/purchase/index.js +11 -7
  148. package/dist/destinations/google-analytics-4/purchase/index.js.map +1 -1
  149. package/dist/destinations/google-analytics-4/refund/generated-types.d.ts +3 -1
  150. package/dist/destinations/google-analytics-4/refund/index.js +13 -9
  151. package/dist/destinations/google-analytics-4/refund/index.js.map +1 -1
  152. package/dist/destinations/google-analytics-4/removeFromCart/generated-types.d.ts +3 -1
  153. package/dist/destinations/google-analytics-4/removeFromCart/index.js +13 -9
  154. package/dist/destinations/google-analytics-4/removeFromCart/index.js.map +1 -1
  155. package/dist/destinations/google-analytics-4/search/generated-types.d.ts +3 -1
  156. package/dist/destinations/google-analytics-4/search/index.js +10 -6
  157. package/dist/destinations/google-analytics-4/search/index.js.map +1 -1
  158. package/dist/destinations/google-analytics-4/selectItem/generated-types.d.ts +3 -1
  159. package/dist/destinations/google-analytics-4/selectItem/index.js +11 -7
  160. package/dist/destinations/google-analytics-4/selectItem/index.js.map +1 -1
  161. package/dist/destinations/google-analytics-4/selectPromotion/generated-types.d.ts +3 -1
  162. package/dist/destinations/google-analytics-4/selectPromotion/index.js +11 -7
  163. package/dist/destinations/google-analytics-4/selectPromotion/index.js.map +1 -1
  164. package/dist/destinations/google-analytics-4/signUp/generated-types.d.ts +3 -1
  165. package/dist/destinations/google-analytics-4/signUp/index.js +10 -6
  166. package/dist/destinations/google-analytics-4/signUp/index.js.map +1 -1
  167. package/dist/destinations/google-analytics-4/viewCart/generated-types.d.ts +3 -1
  168. package/dist/destinations/google-analytics-4/viewCart/index.js +13 -9
  169. package/dist/destinations/google-analytics-4/viewCart/index.js.map +1 -1
  170. package/dist/destinations/google-analytics-4/viewItem/generated-types.d.ts +3 -1
  171. package/dist/destinations/google-analytics-4/viewItem/index.js +11 -7
  172. package/dist/destinations/google-analytics-4/viewItem/index.js.map +1 -1
  173. package/dist/destinations/google-analytics-4/viewItemList/generated-types.d.ts +3 -1
  174. package/dist/destinations/google-analytics-4/viewItemList/index.js +11 -7
  175. package/dist/destinations/google-analytics-4/viewItemList/index.js.map +1 -1
  176. package/dist/destinations/google-analytics-4/viewPromotion/generated-types.d.ts +3 -1
  177. package/dist/destinations/google-analytics-4/viewPromotion/index.js +11 -7
  178. package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
  179. package/dist/destinations/google-enhanced-conversions/postConversion/index.js +2 -2
  180. package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
  181. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +1 -1
  182. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -1
  183. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +1 -1
  184. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
  185. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +1 -1
  186. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
  187. package/dist/destinations/google-sheets-dev/index.js +3 -10
  188. package/dist/destinations/google-sheets-dev/index.js.map +1 -1
  189. package/dist/destinations/hubspot/errors.d.ts +2 -1
  190. package/dist/destinations/hubspot/errors.js +2 -1
  191. package/dist/destinations/hubspot/errors.js.map +1 -1
  192. package/dist/destinations/index.js +2 -2
  193. package/dist/destinations/index.js.map +1 -1
  194. package/dist/destinations/intercom/groupIdentifyContact/index.js +1 -0
  195. package/dist/destinations/intercom/groupIdentifyContact/index.js.map +1 -1
  196. package/dist/destinations/ironclad/recordAction.types.d.ts +12 -0
  197. package/dist/destinations/{braze-cohorts/cohortChanges.js → ironclad/recordAction.types.js} +1 -1
  198. package/dist/destinations/ironclad/recordAction.types.js.map +1 -0
  199. package/dist/destinations/linkedin-audiences/index.js +2 -2
  200. package/dist/destinations/linkedin-audiences/index.js.map +1 -1
  201. package/dist/destinations/mixpanel/index.js +1 -1
  202. package/dist/destinations/mixpanel/mixpanel-properties.js +0 -8
  203. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  204. package/dist/destinations/mixpanel/trackEvent/functions.js +1 -1
  205. package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
  206. package/dist/destinations/mixpanel/trackEvent/generated-types.d.ts +0 -3
  207. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  208. package/dist/destinations/mixpanel/trackPurchase/generated-types.d.ts +0 -3
  209. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  210. package/dist/destinations/outfunnel/forwardGroupEvent/generated-types.d.ts +14 -0
  211. package/dist/destinations/outfunnel/forwardGroupEvent/generated-types.js.map +1 -0
  212. package/dist/destinations/outfunnel/forwardGroupEvent/index.d.ts +5 -0
  213. package/dist/destinations/outfunnel/forwardGroupEvent/index.js +83 -0
  214. package/dist/destinations/outfunnel/forwardGroupEvent/index.js.map +1 -0
  215. package/dist/destinations/outfunnel/forwardIdentifyEvent/generated-types.d.ts +13 -0
  216. package/dist/destinations/outfunnel/forwardIdentifyEvent/generated-types.js.map +1 -0
  217. package/dist/destinations/outfunnel/forwardIdentifyEvent/index.d.ts +5 -0
  218. package/dist/destinations/outfunnel/forwardIdentifyEvent/index.js +76 -0
  219. package/dist/destinations/outfunnel/forwardIdentifyEvent/index.js.map +1 -0
  220. package/dist/destinations/outfunnel/forwardTrackEvent/generated-types.d.ts +15 -0
  221. package/dist/destinations/outfunnel/forwardTrackEvent/generated-types.js.map +1 -0
  222. package/dist/destinations/outfunnel/forwardTrackEvent/index.d.ts +5 -0
  223. package/dist/destinations/outfunnel/forwardTrackEvent/index.js +96 -0
  224. package/dist/destinations/outfunnel/forwardTrackEvent/index.js.map +1 -0
  225. package/dist/destinations/outfunnel/generated-types.d.ts +4 -0
  226. package/dist/destinations/outfunnel/generated-types.js.map +1 -0
  227. package/dist/destinations/outfunnel/index.js +54 -0
  228. package/dist/destinations/outfunnel/index.js.map +1 -0
  229. package/dist/destinations/outfunnel/presets.d.ts +2 -0
  230. package/dist/destinations/outfunnel/presets.js +31 -0
  231. package/dist/destinations/outfunnel/presets.js.map +1 -0
  232. package/dist/destinations/outfunnel/utils.d.ts +1 -0
  233. package/dist/destinations/outfunnel/utils.js +7 -0
  234. package/dist/destinations/outfunnel/utils.js.map +1 -0
  235. package/dist/destinations/qualtrics/qualtricsApiClient.js +3 -1
  236. package/dist/destinations/qualtrics/qualtricsApiClient.js.map +1 -1
  237. package/dist/destinations/ripe/group/index.js +0 -1
  238. package/dist/destinations/ripe/group/index.js.map +1 -1
  239. package/dist/destinations/ripe/identify/index.js +0 -1
  240. package/dist/destinations/ripe/identify/index.js.map +1 -1
  241. package/dist/destinations/ripe/page/index.js +0 -1
  242. package/dist/destinations/ripe/page/index.js.map +1 -1
  243. package/dist/destinations/ripe/track/index.js +0 -1
  244. package/dist/destinations/ripe/track/index.js.map +1 -1
  245. package/dist/destinations/salesforce/sf-properties.d.ts +0 -1
  246. package/dist/destinations/salesforce/sf-properties.js.map +1 -1
  247. package/dist/destinations/segment/errors.d.ts +3 -3
  248. package/dist/destinations/segment/errors.js +2 -2
  249. package/dist/destinations/segment/errors.js.map +1 -1
  250. package/dist/destinations/segment/segment-properties.js +2 -1
  251. package/dist/destinations/segment/segment-properties.js.map +1 -1
  252. package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -1
  253. package/dist/destinations/segment-profiles/errors.d.ts +3 -3
  254. package/dist/destinations/segment-profiles/errors.js +2 -2
  255. package/dist/destinations/segment-profiles/errors.js.map +1 -1
  256. package/dist/destinations/segment-profiles/segment-properties.js +1 -1
  257. package/dist/destinations/toplyne/constants.d.ts +1 -0
  258. package/dist/destinations/toplyne/constants.js +5 -0
  259. package/dist/destinations/toplyne/constants.js.map +1 -0
  260. package/dist/destinations/{google-sheets-partner → toplyne}/generated-types.d.ts +1 -0
  261. package/dist/destinations/toplyne/generated-types.js.map +1 -0
  262. package/dist/destinations/{tiktok-audiences → toplyne}/index.d.ts +1 -1
  263. package/dist/destinations/toplyne/index.js +69 -0
  264. package/dist/destinations/toplyne/index.js.map +1 -0
  265. package/dist/destinations/toplyne/sendAccountProfiles/generated-types.d.ts +7 -0
  266. package/dist/destinations/toplyne/sendAccountProfiles/generated-types.js +3 -0
  267. package/dist/destinations/toplyne/sendAccountProfiles/generated-types.js.map +1 -0
  268. package/dist/destinations/toplyne/sendAccountProfiles/index.js +49 -0
  269. package/dist/destinations/toplyne/sendAccountProfiles/index.js.map +1 -0
  270. package/dist/destinations/toplyne/sendEvents/generated-types.d.ts +10 -0
  271. package/dist/destinations/toplyne/sendEvents/generated-types.js +3 -0
  272. package/dist/destinations/toplyne/sendEvents/generated-types.js.map +1 -0
  273. package/dist/destinations/toplyne/sendEvents/index.js +70 -0
  274. package/dist/destinations/toplyne/sendEvents/index.js.map +1 -0
  275. package/dist/destinations/toplyne/sendUserProfiles/generated-types.d.ts +8 -0
  276. package/dist/destinations/toplyne/sendUserProfiles/generated-types.js +3 -0
  277. package/dist/destinations/toplyne/sendUserProfiles/generated-types.js.map +1 -0
  278. package/dist/destinations/toplyne/sendUserProfiles/index.js +56 -0
  279. package/dist/destinations/toplyne/sendUserProfiles/index.js.map +1 -0
  280. package/dist/destinations/twilio/sendSMS.types.d.ts +1 -0
  281. package/dist/destinations/voucherify/index.js +1 -1
  282. package/dist/destinations/voucherify/index.js.map +1 -1
  283. package/package.json +5 -4
  284. package/dist/destinations/actions-bingads/functions.d.ts +0 -0
  285. package/dist/destinations/actions-bingads/functions.js +0 -2
  286. package/dist/destinations/actions-bingads/functions.js.map +0 -1
  287. package/dist/destinations/actions-bingads/generated-types.d.ts +0 -10
  288. package/dist/destinations/actions-bingads/generated-types.js.map +0 -1
  289. package/dist/destinations/actions-bingads/index.js +0 -77
  290. package/dist/destinations/actions-bingads/index.js.map +0 -1
  291. package/dist/destinations/actions-bingads/offlineConversions/formatter.d.ts +0 -8
  292. package/dist/destinations/actions-bingads/offlineConversions/formatter.js +0 -33
  293. package/dist/destinations/actions-bingads/offlineConversions/formatter.js.map +0 -1
  294. package/dist/destinations/actions-bingads/offlineConversions/generated-types.d.ts +0 -7
  295. package/dist/destinations/actions-bingads/offlineConversions/generated-types.js.map +0 -1
  296. package/dist/destinations/actions-bingads/offlineConversions/index.js +0 -131
  297. package/dist/destinations/actions-bingads/offlineConversions/index.js.map +0 -1
  298. package/dist/destinations/braze-cohorts/cohortChanges.d.ts +0 -10
  299. package/dist/destinations/braze-cohorts/cohortChanges.js.map +0 -1
  300. package/dist/destinations/google-sheets-partner/constants.d.ts +0 -3
  301. package/dist/destinations/google-sheets-partner/constants.js +0 -7
  302. package/dist/destinations/google-sheets-partner/constants.js.map +0 -1
  303. package/dist/destinations/google-sheets-partner/generated-types.js.map +0 -1
  304. package/dist/destinations/google-sheets-partner/googleapis/index.d.ts +0 -17
  305. package/dist/destinations/google-sheets-partner/googleapis/index.js +0 -34
  306. package/dist/destinations/google-sheets-partner/googleapis/index.js.map +0 -1
  307. package/dist/destinations/google-sheets-partner/index.d.ts +0 -4
  308. package/dist/destinations/google-sheets-partner/index.js +0 -43
  309. package/dist/destinations/google-sheets-partner/index.js.map +0 -1
  310. package/dist/destinations/google-sheets-partner/postSheet/generated-types.d.ts +0 -11
  311. package/dist/destinations/google-sheets-partner/postSheet/generated-types.js.map +0 -1
  312. package/dist/destinations/google-sheets-partner/postSheet/index.js +0 -79
  313. package/dist/destinations/google-sheets-partner/postSheet/index.js.map +0 -1
  314. package/dist/destinations/google-sheets-partner/postSheet/operations.d.ts +0 -10
  315. package/dist/destinations/google-sheets-partner/postSheet/operations.js +0 -96
  316. package/dist/destinations/google-sheets-partner/postSheet/operations.js.map +0 -1
  317. package/dist/destinations/tiktok-audiences/addUser/generated-types.d.ts +0 -12
  318. package/dist/destinations/tiktok-audiences/addUser/generated-types.js.map +0 -1
  319. package/dist/destinations/tiktok-audiences/addUser/index.js +0 -47
  320. package/dist/destinations/tiktok-audiences/addUser/index.js.map +0 -1
  321. package/dist/destinations/tiktok-audiences/api/api.test.d.ts +0 -1
  322. package/dist/destinations/tiktok-audiences/api/api.test.js +0 -118
  323. package/dist/destinations/tiktok-audiences/api/api.test.js.map +0 -1
  324. package/dist/destinations/tiktok-audiences/api/index.d.ts +0 -13
  325. package/dist/destinations/tiktok-audiences/api/index.js +0 -93
  326. package/dist/destinations/tiktok-audiences/api/index.js.map +0 -1
  327. package/dist/destinations/tiktok-audiences/constants.d.ts +0 -2
  328. package/dist/destinations/tiktok-audiences/constants.js +0 -6
  329. package/dist/destinations/tiktok-audiences/constants.js.map +0 -1
  330. package/dist/destinations/tiktok-audiences/functions.d.ts +0 -14
  331. package/dist/destinations/tiktok-audiences/functions.js +0 -116
  332. package/dist/destinations/tiktok-audiences/functions.js.map +0 -1
  333. package/dist/destinations/tiktok-audiences/generated-types.d.ts +0 -3
  334. package/dist/destinations/tiktok-audiences/generated-types.js.map +0 -1
  335. package/dist/destinations/tiktok-audiences/index.js +0 -38
  336. package/dist/destinations/tiktok-audiences/index.js.map +0 -1
  337. package/dist/destinations/tiktok-audiences/properties.d.ts +0 -11
  338. package/dist/destinations/tiktok-audiences/properties.js +0 -80
  339. package/dist/destinations/tiktok-audiences/properties.js.map +0 -1
  340. package/dist/destinations/tiktok-audiences/removeUser/generated-types.d.ts +0 -12
  341. package/dist/destinations/tiktok-audiences/removeUser/generated-types.js.map +0 -1
  342. package/dist/destinations/tiktok-audiences/removeUser/index.js +0 -47
  343. package/dist/destinations/tiktok-audiences/removeUser/index.js.map +0 -1
  344. package/dist/destinations/tiktok-audiences/types.d.ts +0 -33
  345. package/dist/destinations/tiktok-audiences/types.js +0 -3
  346. package/dist/destinations/tiktok-audiences/types.js.map +0 -1
  347. /package/dist/destinations/{actions-bingads → blackbaud-raisers-edge-nxt/createConstituentAction}/generated-types.js +0 -0
  348. /package/dist/destinations/{actions-bingads/offlineConversions → blackbaud-raisers-edge-nxt/createGift}/generated-types.js +0 -0
  349. /package/dist/destinations/{google-sheets-partner/postSheet → blackbaud-raisers-edge-nxt/createGift}/index.d.ts +0 -0
  350. /package/dist/destinations/{google-sheets-partner → outfunnel/forwardGroupEvent}/generated-types.js +0 -0
  351. /package/dist/destinations/{google-sheets-partner/postSheet → outfunnel/forwardIdentifyEvent}/generated-types.js +0 -0
  352. /package/dist/destinations/{tiktok-audiences/addUser → outfunnel/forwardTrackEvent}/generated-types.js +0 -0
  353. /package/dist/destinations/{tiktok-audiences → outfunnel}/generated-types.js +0 -0
  354. /package/dist/destinations/{actions-bingads → outfunnel}/index.d.ts +0 -0
  355. /package/dist/destinations/{tiktok-audiences/removeUser → toplyne}/generated-types.js +0 -0
  356. /package/dist/destinations/{actions-bingads/offlineConversions → toplyne/sendAccountProfiles}/index.d.ts +0 -0
  357. /package/dist/destinations/{tiktok-audiences/addUser → toplyne/sendEvents}/index.d.ts +0 -0
  358. /package/dist/destinations/{tiktok-audiences/removeUser → toplyne/sendUserProfiles}/index.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const actions_core_1 = require("@segment/actions-core");
4
+ const ga4_types_1 = require("../ga4-types");
4
5
  const ga4_functions_1 = require("../ga4-functions");
5
6
  const ga4_properties_1 = require("../ga4-properties");
6
7
  const action = {
@@ -8,6 +9,8 @@ const action = {
8
9
  description: 'Send event when a user adds items to a wishlist',
9
10
  defaultSubscription: 'type = "track" and event = "Product Added to Wishlist"',
10
11
  fields: {
12
+ data_stream_type: { ...ga4_properties_1.data_stream_type },
13
+ app_instance_id: { ...ga4_properties_1.app_instance_id },
11
14
  client_id: { ...ga4_properties_1.client_id },
12
15
  user_id: { ...ga4_properties_1.user_id },
13
16
  timestamp_micros: { ...ga4_properties_1.timestamp_micros },
@@ -21,21 +24,25 @@ const action = {
21
24
  engagement_time_msec: ga4_properties_1.engagement_time_msec,
22
25
  params: ga4_properties_1.params
23
26
  },
24
- perform: (request, { payload, features }) => {
27
+ perform: (request, { payload, features, settings }) => {
28
+ const data_stream_type = payload.data_stream_type ?? ga4_types_1.DataStreamType.Web;
29
+ const stream_params = data_stream_type === ga4_types_1.DataStreamType.MobileApp
30
+ ? ga4_functions_1.getMobileStreamParams(settings.apiSecret, settings.firebaseAppId, payload.app_instance_id)
31
+ : ga4_functions_1.getWebStreamParams(settings.apiSecret, settings.measurementId, payload.client_id);
25
32
  if (payload.currency) {
26
33
  ga4_functions_1.verifyCurrency(payload.currency);
27
34
  }
28
35
  if (payload.value && payload.currency === undefined) {
29
- throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
36
+ throw new actions_core_1.IntegrationError('Currency is required if value is set.', actions_core_1.ErrorCodes.INVALID_CURRENCY_CODE, 400);
30
37
  }
31
38
  if (payload.currency === undefined && (!payload.items || !payload.items[0] || !payload.items[0].currency)) {
32
- throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
39
+ throw new actions_core_1.PayloadValidationError('One of item-level currency or top-level currency is required.');
33
40
  }
34
41
  let googleItems = [];
35
42
  if (payload.items) {
36
43
  googleItems = payload.items.map((product) => {
37
44
  if (product.item_name === undefined && product.item_id === undefined) {
38
- throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
45
+ throw new actions_core_1.PayloadValidationError('One of product name or product id is required for product or impression data.');
39
46
  }
40
47
  if (product.currency) {
41
48
  ga4_functions_1.verifyCurrency(product.currency);
@@ -48,7 +55,7 @@ const action = {
48
55
  ga4_functions_1.verifyUserProps(payload.user_properties);
49
56
  }
50
57
  const request_object = {
51
- client_id: payload.client_id,
58
+ ...stream_params.identifier,
52
59
  user_id: payload.user_id,
53
60
  events: [
54
61
  {
@@ -67,10 +74,7 @@ const action = {
67
74
  if (features && features['actions-google-analytics-4-add-timestamp']) {
68
75
  request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
69
76
  }
70
- return request('https://www.google-analytics.com/mp/collect', {
71
- method: 'POST',
72
- json: request_object
73
- });
77
+ return ga4_functions_1.sendData(request, stream_params.search_params, request_object);
74
78
  }
75
79
  };
76
80
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAI1E,oDAAkG;AAClG,sDAW0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,iDAAiD;IAC9D,mBAAmB,EAAE,wDAAwD;IAC7E,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;Q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BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;iBACjC;gBAED,OAAO,OAAsB,CAAA;YAC/B,CAAC,CAAC,CAAA;SACH;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QACD,MAAM,cAAc,GAA2B;YAC7C,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,iBAAiB;oBACvB,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,KAAK,EAAE,WAAW;wBAClB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addToWishlist/index.ts"],"names":[],"mappings":";;AAAA,wDAA8G;AAC9G,4CAA4E;AAG5E,oDAQyB;AACzB,sDAa0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,iDAAiD;IAC9D,mBAA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AAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,wBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,5 +1,7 @@
1
1
  export interface Payload {
2
- client_id: string;
2
+ data_stream_type?: string;
3
+ app_instance_id?: string;
4
+ client_id?: string;
3
5
  user_id?: string;
4
6
  timestamp_micros?: string;
5
7
  coupon?: string;
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const actions_core_1 = require("@segment/actions-core");
4
4
  const ga4_functions_1 = require("../ga4-functions");
5
5
  const ga4_properties_1 = require("../ga4-properties");
6
+ const ga4_types_1 = require("../ga4-types");
6
7
  const action = {
7
8
  title: 'Begin Checkout',
8
9
  description: 'Send event when a user begins checkout',
9
10
  defaultSubscription: 'type = "track" and event = "Checkout Started"',
10
11
  fields: {
12
+ data_stream_type: { ...ga4_properties_1.data_stream_type },
13
+ app_instance_id: { ...ga4_properties_1.app_instance_id },
11
14
  client_id: { ...ga4_properties_1.client_id },
12
15
  user_id: { ...ga4_properties_1.user_id },
13
16
  timestamp_micros: { ...ga4_properties_1.timestamp_micros },
@@ -22,7 +25,11 @@ const action = {
22
25
  engagement_time_msec: ga4_properties_1.engagement_time_msec,
23
26
  params: ga4_properties_1.params
24
27
  },
25
- perform: (request, { payload, features }) => {
28
+ perform: (request, { payload, features, settings }) => {
29
+ const data_stream_type = payload.data_stream_type ?? ga4_types_1.DataStreamType.Web;
30
+ const stream_params = data_stream_type === ga4_types_1.DataStreamType.MobileApp
31
+ ? ga4_functions_1.getMobileStreamParams(settings.apiSecret, settings.firebaseAppId, payload.app_instance_id)
32
+ : ga4_functions_1.getWebStreamParams(settings.apiSecret, settings.measurementId, payload.client_id);
26
33
  if (payload.currency) {
27
34
  ga4_functions_1.verifyCurrency(payload.currency);
28
35
  }
@@ -30,7 +37,7 @@ const action = {
30
37
  if (payload.items) {
31
38
  googleItems = payload.items.map((product) => {
32
39
  if (product.item_name === undefined && product.item_id === undefined) {
33
- throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
40
+ throw new actions_core_1.PayloadValidationError('One of product name or product id is required for product or impression data.');
34
41
  }
35
42
  if (product.currency) {
36
43
  ga4_functions_1.verifyCurrency(product.currency);
@@ -43,7 +50,7 @@ const action = {
43
50
  ga4_functions_1.verifyUserProps(payload.user_properties);
44
51
  }
45
52
  const request_object = {
46
- client_id: payload.client_id,
53
+ ...stream_params.identifier,
47
54
  user_id: payload.user_id,
48
55
  events: [
49
56
  {
@@ -63,10 +70,7 @@ const action = {
63
70
  if (features && features['actions-google-analytics-4-add-timestamp']) {
64
71
  request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
65
72
  }
66
- return request('https://www.google-analytics.com/mp/collect', {
67
- method: 'POST',
68
- json: request_object
69
- });
73
+ return ga4_functions_1.sendData(request, stream_params.search_params, request_object);
70
74
  }
71
75
  };
72
76
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAkG;AAClG,sDAY0B;AAK1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,E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EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,gBAAgB;oBACtB,MAAM,EAAE;wBACN,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,WAAW;wBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/beginCheckout/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAChF,oDAQyB;AACzB,sDAc0B;AAC1B,4CAA4E;AAI5E,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,eAAe,EAAE,EAAE,GAAG,gCAAe,EAAE;QACvC,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE,OAAO,E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OAAO,OAAsB,CAAA;YAC/B,CAAC,CAAC,CAAA;SACH;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QAED,MAAM,cAAc,GAA+B;YACjD,GAAG,aAAa,CAAC,UAAU;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,gBAAgB;oBACtB,MAAM,EAAE;wBACN,MAAM,EAAE,OAAO,CAAC,MAAM;wBACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,WAAW;wBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,wBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,5 +1,7 @@
1
1
  export interface Payload {
2
- clientId: string;
2
+ data_stream_type?: string;
3
+ app_instance_id?: string;
4
+ clientId?: string;
3
5
  user_id?: string;
4
6
  timestamp_micros?: string;
5
7
  name: string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ga4_functions_1 = require("../ga4-functions");
4
4
  const ga4_properties_1 = require("../ga4-properties");
5
+ const ga4_types_1 = require("../ga4-types");
5
6
  const normalizeEventName = (name, lowercase) => {
6
7
  name = name.trim();
7
8
  name = name.replace(/\s/g, '_');
@@ -15,6 +16,8 @@ const action = {
15
16
  description: 'Send any custom event',
16
17
  defaultSubscription: 'type = "track"',
17
18
  fields: {
19
+ data_stream_type: { ...ga4_properties_1.data_stream_type },
20
+ app_instance_id: { ...ga4_properties_1.app_instance_id },
18
21
  clientId: { ...ga4_properties_1.client_id },
19
22
  user_id: { ...ga4_properties_1.user_id },
20
23
  timestamp_micros: { ...ga4_properties_1.timestamp_micros },
@@ -37,14 +40,18 @@ const action = {
37
40
  engagement_time_msec: ga4_properties_1.engagement_time_msec,
38
41
  params: { ...ga4_properties_1.params }
39
42
  },
40
- perform: (request, { payload, features }) => {
43
+ perform: (request, { payload, features, settings }) => {
44
+ const data_stream_type = payload.data_stream_type ?? ga4_types_1.DataStreamType.Web;
45
+ const stream_params = data_stream_type === ga4_types_1.DataStreamType.MobileApp
46
+ ? ga4_functions_1.getMobileStreamParams(settings.apiSecret, settings.firebaseAppId, payload.app_instance_id)
47
+ : ga4_functions_1.getWebStreamParams(settings.apiSecret, settings.measurementId, payload.clientId);
41
48
  const event_name = normalizeEventName(payload.name, payload.lowercase);
42
49
  if (features && features['actions-google-analytics-4-verify-params-feature']) {
43
50
  ga4_functions_1.verifyParams(payload.params);
44
51
  ga4_functions_1.verifyUserProps(payload.user_properties);
45
52
  }
46
53
  const request_object = {
47
- client_id: payload.clientId,
54
+ ...stream_params.identifier,
48
55
  user_id: payload.user_id,
49
56
  events: [
50
57
  {
@@ -60,10 +67,7 @@ const action = {
60
67
  if (features && features['actions-google-analytics-4-add-timestamp']) {
61
68
  request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
62
69
  }
63
- return request('https://www.google-analytics.com/mp/collect', {
64
- method: 'POST',
65
- json: request_object
66
- });
70
+ return ga4_functions_1.sendData(request, stream_params.search_params, request_object);
67
71
  }
68
72
  };
69
73
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/customEvent/index.ts"],"names":[],"mappings":";;AAGA,oDAAkF;AAElF,sDAQ0B;AAE1B,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,SAA8B,EAAU,EAAE;IAClF,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAE/B,IAAI,SAAS,EAAE;QACb,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;KAC1B;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,QAAQ,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC1B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,IAAI,EAAE;YACJ,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,yWAAyW;YAC3W,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,qZAAqZ;YACvZ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE;KACtB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAEtE,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QAED,MAAM,cAAc,GAA2B;YAC7C,SAAS,EAAE,OAAO,CAAC,QAAQ;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,UAAU;oBAChB,MAAM,EAAE;wBACN,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AACD,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/customEvent/index.ts"],"names":[],"mappings":";;AAGA,oDAOyB;AAEzB,sDAU0B;AAC1B,4CAA+D;AAE/D,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,SAA8B,EAAU,EAAE;IAClF,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAE/B,IAAI,SAAS,EAAE;QACb,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;KAC1B;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA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C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAEtE,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QAED,MAAM,cAAc,GAA+B;YACjD,GAAG,aAAa,CAAC,UAAU;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,UAAU;oBAChB,MAAM,EAAE;wBACN,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,wBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AACD,kBAAe,MAAM,CAAA"}
@@ -1,4 +1,11 @@
1
+ import { RequestClient } from '@segment/actions-core';
2
+ import { DataStreamParams } from './ga4-types';
1
3
  export declare function verifyCurrency(currency: string): void;
2
4
  export declare function verifyParams(params: object | undefined): void;
3
5
  export declare function verifyUserProps(userProperties: object | undefined): void;
4
6
  export declare function convertTimestamp(timestamp: string | undefined): number | undefined;
7
+ export declare function getMobileStreamParams(api_secret: string, firebase_app_id?: string, app_instance_id?: string): DataStreamParams;
8
+ export declare function getWebStreamParams(api_secret: string, measurement_id?: string, client_id?: string): DataStreamParams;
9
+ export declare function sendData(request: RequestClient, search_params: string, payload: {
10
+ [k: string]: unknown;
11
+ }): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertTimestamp = exports.verifyUserProps = exports.verifyParams = exports.verifyCurrency = void 0;
3
+ exports.sendData = exports.getWebStreamParams = exports.getMobileStreamParams = exports.convertTimestamp = exports.verifyUserProps = exports.verifyParams = exports.verifyCurrency = void 0;
4
4
  const actions_core_1 = require("@segment/actions-core");
5
5
  const constants_1 = require("./constants");
6
6
  function verifyCurrency(currency) {
7
7
  if (!constants_1.CURRENCY_ISO_CODES.includes(currency.toUpperCase())) {
8
- throw new actions_core_1.IntegrationError(`${currency} is not a valid currency code.`, 'Incorrect value format', 400);
8
+ throw new actions_core_1.IntegrationError(`${currency} is not a valid currency code.`, actions_core_1.ErrorCodes.INVALID_CURRENCY_CODE, 400);
9
9
  }
10
10
  }
11
11
  exports.verifyCurrency = verifyCurrency;
@@ -15,13 +15,13 @@ function verifyParams(params) {
15
15
  }
16
16
  Object.entries(params).forEach(([key, value]) => {
17
17
  if (value instanceof Array) {
18
- throw new actions_core_1.IntegrationError(`Param [${key}] has unsupported value of type [Array]. GA4 does not accept null, array, or object values for event parameters and item parameters.`, 'Invalid value', 400);
18
+ throw new actions_core_1.PayloadValidationError(`Param [${key}] has unsupported value of type [Array]. GA4 does not accept null, array, or object values for event parameters and item parameters.`);
19
19
  }
20
20
  else if (value == null) {
21
- throw new actions_core_1.IntegrationError(`Param [${key}] has unsupported value of type [NULL]. GA4 does not accept null, array, or object values for event parameters and item parameters.`, 'Invalid value', 400);
21
+ throw new actions_core_1.PayloadValidationError(`Param [${key}] has unsupported value of type [NULL]. GA4 does not accept null, array, or object values for event parameters and item parameters.`);
22
22
  }
23
23
  else if (typeof value == 'object') {
24
- throw new actions_core_1.IntegrationError(`Param [${key}] has unsupported value of type [${typeof value}]. GA4 does not accept null, array, or object values for event parameters and item parameters.`, 'Invalid value', 400);
24
+ throw new actions_core_1.PayloadValidationError(`Param [${key}] has unsupported value of type [${typeof value}]. GA4 does not accept null, array, or object values for event parameters and item parameters.`);
25
25
  }
26
26
  });
27
27
  }
@@ -32,10 +32,10 @@ function verifyUserProps(userProperties) {
32
32
  }
33
33
  Object.entries(userProperties).forEach(([key, value]) => {
34
34
  if (value instanceof Array) {
35
- throw new actions_core_1.IntegrationError(`Param [${key}] has unsupported value of type [Array]. GA4 does not accept array or object values for user properties.`, 'Invalid value', 400);
35
+ throw new actions_core_1.PayloadValidationError(`Param [${key}] has unsupported value of type [Array]. GA4 does not accept array or object values for user properties.`);
36
36
  }
37
37
  else if (value != null && typeof value == 'object') {
38
- throw new actions_core_1.IntegrationError(`Param [${key}] has unsupported value of type [${typeof value}]. GA4 does not accept array or object values for user properties.`, 'Invalid value', 400);
38
+ throw new actions_core_1.PayloadValidationError(`Param [${key}] has unsupported value of type [${typeof value}]. GA4 does not accept array or object values for user properties.`);
39
39
  }
40
40
  });
41
41
  }
@@ -50,4 +50,41 @@ function convertTimestamp(timestamp) {
50
50
  return Date.parse(timestamp) * 1000;
51
51
  }
52
52
  exports.convertTimestamp = convertTimestamp;
53
+ function getMobileStreamParams(api_secret, firebase_app_id, app_instance_id) {
54
+ if (!firebase_app_id) {
55
+ throw new actions_core_1.PayloadValidationError(`Firebase App ID is required for mobile app streams`);
56
+ }
57
+ if (!app_instance_id) {
58
+ throw new actions_core_1.PayloadValidationError(`Firebase App Instance ID is required for mobile app streams`);
59
+ }
60
+ return {
61
+ search_params: `api_secret=${api_secret}&firebase_app_id=${firebase_app_id}`,
62
+ identifier: {
63
+ app_instance_id
64
+ }
65
+ };
66
+ }
67
+ exports.getMobileStreamParams = getMobileStreamParams;
68
+ function getWebStreamParams(api_secret, measurement_id, client_id) {
69
+ if (!measurement_id) {
70
+ throw new actions_core_1.PayloadValidationError(`Measurement ID is required for web streams`);
71
+ }
72
+ if (!client_id) {
73
+ throw new actions_core_1.PayloadValidationError(`Client ID is required for web streams`);
74
+ }
75
+ return {
76
+ search_params: `api_secret=${api_secret}&measurement_id=${measurement_id}`,
77
+ identifier: {
78
+ client_id
79
+ }
80
+ };
81
+ }
82
+ exports.getWebStreamParams = getWebStreamParams;
83
+ async function sendData(request, search_params, payload) {
84
+ return request(`https://www.google-analytics.com/mp/collect?${search_params}`, {
85
+ method: 'POST',
86
+ json: payload
87
+ });
88
+ }
89
+ exports.sendData = sendData;
53
90
  //# sourceMappingURL=ga4-functions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-functions.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAgD;AAGhD,SAAgB,cAAc,CAAC,QAAgB;IAC7C,IAAI,CAAC,8BAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE;QACxD,MAAM,IAAI,+BAAgB,CAAC,GAAG,QAAQ,gCAAgC,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;KACvG;AACH,CAAC;AAJD,wCAIC;AAGD,SAAgB,YAAY,CAAC,MAA0B;IACrD,IAAI,CAAC,MAAM,EAAE;QACX,OAAM;KACP;IAED,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9C,IAAI,KAAK,YAAY,KAAK,EAAE;YAC1B,MAAM,IAAI,+BAAgB,CACxB,UAAU,GAAG,sIAAsI,EACnJ,eAAe,EACf,GAAG,CACJ,CAAA;SACF;aAAM,IAAI,KAAK,IAAI,IAAI,EAAE;YACxB,MAAM,IAAI,+BAAgB,CACxB,UAAU,GAAG,qIAAqI,EAClJ,eAAe,EACf,GAAG,CACJ,CAAA;SACF;aAAM,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;YACnC,MAAM,IAAI,+BAAgB,CACxB,UAAU,GAAG,oCAAoC,OAAO,KAAK,gGAAgG,EAC7J,eAAe,EACf,GAAG,CACJ,CAAA;SACF;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AA1BD,oCA0BC;AAED,SAAgB,eAAe,CAAC,cAAkC;IAChE,IAAI,CAAC,cAAc,EAAE;QACnB,OAAM;KACP;IAED,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,IAAI,KAAK,YAAY,KAAK,EAAE;YAC1B,MAAM,IAAI,+BAAgB,CACxB,UAAU,GAAG,0GAA0G,EACvH,eAAe,EACf,GAAG,CACJ,CAAA;SACF;aAAM,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;YACpD,MAAM,IAAI,+BAAgB,CACxB,UAAU,GAAG,oCAAoC,OAAO,KAAK,oEAAoE,EACjI,eAAe,EACf,GAAG,CACJ,CAAA;SACF;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AApBD,0CAoBC;AAGD,SAAgB,gBAAgB,CAAC,SAA6B;IAC5D,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,SAAS,CAAA;KACjB;IAGD,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,EAAE;QACtB,OAAO,CAAC,SAAS,CAAA;KAClB;IAGD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;AACrC,CAAC;AAZD,4CAYC"}
1
+ {"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-functions.ts"],"names":[],"mappings":";;;AAAA,wDAA2G;AAC3G,2CAAgD;AAIhD,SAAgB,cAAc,CAAC,QAAgB;IAC7C,IAAI,CAAC,8BAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE;QACxD,MAAM,IAAI,+BAAgB,CAAC,GAAG,QAAQ,gCAAgC,EAAE,yBAAU,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAA;KAC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,KAAK,CAAC,CAAC,SAAS,CAAC,EAAE;QACtB,OAAO,CAAC,SAAS,CAAA;KAClB;IAGD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;AACrC,CAAC;AAZD,4CAYC;AAED,SAAgB,qBAAqB,CACnC,UAAkB,EAClB,eAAwB,EACxB,eAAwB;IAExB,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,qCAAsB,CAAC,oDAAoD,CAAC,CAAA;KACvF;IACD,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,qCAAsB,CAAC,6DAA6D,CAAC,CAAA;KAChG;IACD,OAAO;QACL,aAAa,EAAE,cAAc,UAAU,oBAAoB,eAAe,EAAE;QAC5E,UAAU,EAAE;YACV,eAAe;SAChB;KACF,CAAA;AACH,CAAC;AAjBD,sDAiBC;AAED,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,cAAuB,EAAE,SAAkB;IAChG,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,IAAI,qCAAsB,CAAC,4CAA4C,CAAC,CAAA;KAC/E;IACD,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,qCAAsB,CAAC,uCAAuC,CAAC,CAAA;KAC1E;IACD,OAAO;QACL,aAAa,EAAE,cAAc,UAAU,mBAAmB,cAAc,EAAE;QAC1E,UAAU,EAAE;YACV,SAAS;SACV;KACF,CAAA;AACH,CAAC;AAbD,gDAaC;AAEM,KAAK,UAAU,QAAQ,CAAC,OAAsB,EAAE,aAAqB,EAAE,OAAiC;IAE7G,OAAO,OAAO,CAAC,+CAA+C,aAAa,EAAE,EAAE;QAC7E,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,OAAO;KACd,CAAC,CAAA;AACJ,CAAC;AAND,4BAMC"}
@@ -12,6 +12,7 @@ export declare const shipping: InputField;
12
12
  export declare const transaction_id: InputField;
13
13
  export declare const affiliation: InputField;
14
14
  export declare const client_id: InputField;
15
+ export declare const app_instance_id: InputField;
15
16
  export declare const currency: InputField;
16
17
  export declare const value: InputField;
17
18
  export declare const coupon: InputField;
@@ -21,3 +22,4 @@ export declare const items_single_products: InputField;
21
22
  export declare const items_multi_products: InputField;
22
23
  export declare const engagement_time_msec: InputField;
23
24
  export declare const timestamp_micros: InputField;
25
+ export declare const data_stream_type: InputField;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timestamp_micros = exports.engagement_time_msec = exports.items_multi_products = exports.items_single_products = exports.minimal_items = exports.payment_type = exports.coupon = exports.value = exports.currency = exports.client_id = exports.affiliation = exports.transaction_id = exports.shipping = exports.tax = exports.creative_name = exports.creative_slot = exports.promotion_name = exports.promotion_id = exports.user_id = exports.params = exports.user_properties = exports.formatUserProperties = void 0;
3
+ exports.data_stream_type = exports.timestamp_micros = exports.engagement_time_msec = exports.items_multi_products = exports.items_single_products = exports.minimal_items = exports.payment_type = exports.coupon = exports.value = exports.currency = exports.app_instance_id = exports.client_id = exports.affiliation = exports.transaction_id = exports.shipping = exports.tax = exports.creative_name = exports.creative_slot = exports.promotion_name = exports.promotion_id = exports.user_id = exports.params = exports.user_properties = exports.formatUserProperties = void 0;
4
+ const ga4_types_1 = require("./ga4-types");
4
5
  const formatUserProperties = (userProperties) => {
5
6
  if (!userProperties) {
6
7
  return undefined;
@@ -85,9 +86,9 @@ exports.affiliation = {
85
86
  };
86
87
  exports.client_id = {
87
88
  label: 'Client ID',
88
- description: 'Uniquely identifies a user instance of a web client.',
89
+ description: 'Uniquely identifies a user instance of a web client. **Required for web streams.**',
89
90
  type: 'string',
90
- required: true,
91
+ required: false,
91
92
  default: {
92
93
  '@if': {
93
94
  exists: { '@path': '$.userId' },
@@ -96,6 +97,12 @@ exports.client_id = {
96
97
  }
97
98
  }
98
99
  };
100
+ exports.app_instance_id = {
101
+ label: 'Firebase App Instance ID',
102
+ description: 'Uniquely identifies a specific installation of a Firebase app. This value needs to be retrieved through the Firebase SDK. **Required for mobile app streams.**',
103
+ type: 'string',
104
+ required: false
105
+ };
99
106
  exports.currency = {
100
107
  label: 'Currency',
101
108
  type: 'string',
@@ -317,4 +324,11 @@ exports.timestamp_micros = {
317
324
  '@path': '$.timestamp'
318
325
  }
319
326
  };
327
+ exports.data_stream_type = {
328
+ label: 'Data Stream Type',
329
+ type: 'string',
330
+ choices: [ga4_types_1.DataStreamType.Web, ga4_types_1.DataStreamType.MobileApp],
331
+ description: 'The type of data stream this data belongs in. This can either be a web stream or a mobile app stream (iOS or Android).',
332
+ default: ga4_types_1.DataStreamType.Web
333
+ };
320
334
  //# sourceMappingURL=ga4-properties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ga4-properties.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-properties.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,CAAC,cAAkC,EAAsB,EAAE;IAC7F,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI,UAAU,GAAG,EAAE,CAAA;IAEnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,CAAA;AACxC,CAAC,CAAA;AAZY,QAAA,oBAAoB,wBAYhC;AAEY,QAAA,eAAe,GAAe;IACzC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,8RAA8R;IAChS,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,IAAI;IAC1B,eAAe,EAAE,UAAU;CAC5B,CAAA;AAEY,QAAA,MAAM,GAAe;IAChC,KAAK,EAAE,kBAAkB;IAC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AE,cAAc;iBACxB;gBACD,SAAS,EAAE;oBACT,OAAO,EAAE,QAAQ;iBAClB;gBACD,WAAW,EAAE;oBACX,OAAO,EAAE,eAAe;iBACzB;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,UAAU;iBACpB;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,YAAY;iBACtB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,SAAS;iBACnB;gBACD,aAAa,EAAE;oBACb,OAAO,EAAE,YAAY;iBACtB;gBACD,YAAY,EAAE;oBACZ,OAAO,EAAE,WAAW;iBACrB;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,SAAS;iBACnB;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,YAAY;iBACtB;aACF;SACF;KACF;CACF,CAAA;AAEY,QAAA,oBAAoB,GAAe;IAC9C,KAAK,EAAE,iCAAiC;IACxC,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,+NAA+N;IACjO,OAAO,EAAE,CAAC;CACX,CAAA;AAEY,QAAA,gBAAgB,GAAe;IAC1C,KAAK,EAAE,iBAAiB;IACxB,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,qNAAqN;IACvN,OAAO,EAAE;QACP,OAAO,EAAE,aAAa;KACvB;CACF,CAAA"}
1
+ {"version":3,"file":"ga4-properties.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-properties.ts"],"names":[],"mappings":";;;AACA,2CAA4C;AAErC,MAAM,oBAAoB,GAAG,CAAC,cAAkC,EAAsB,EAAE;IAC7F,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI,UAAU,GAAG,EAAE,CAAA;IAEnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAA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IACd,WAAW,EACT,qNAAqN;IACvN,OAAO,EAAE;QACP,OAAO,EAAE,aAAa;KACvB;CACF,CAAA;AAEY,QAAA,gBAAgB,GAAe;IAC1C,KAAK,EAAE,kBAAkB;IACzB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC,0BAAc,CAAC,GAAG,EAAE,0BAAc,CAAC,SAAS,CAAC;IACvD,WAAW,EACT,wHAAwH;IAC1H,OAAO,EAAE,0BAAc,CAAC,GAAG;CAC5B,CAAA"}
@@ -25,3 +25,17 @@ export interface PromotionProductItem extends ProductItem {
25
25
  promotion_id?: string;
26
26
  promotion_name?: string;
27
27
  }
28
+ export declare enum DataStreamType {
29
+ 'Web' = "Web",
30
+ 'MobileApp' = "Mobile App"
31
+ }
32
+ export interface DataStreamParams {
33
+ search_params: string;
34
+ identifier: {
35
+ app_instance_id: string;
36
+ client_id?: never;
37
+ } | {
38
+ client_id: string;
39
+ app_instance_id?: never;
40
+ };
41
+ }
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataStreamType = void 0;
4
+ var DataStreamType;
5
+ (function (DataStreamType) {
6
+ DataStreamType["Web"] = "Web";
7
+ DataStreamType["MobileApp"] = "Mobile App";
8
+ })(DataStreamType = exports.DataStreamType || (exports.DataStreamType = {}));
3
9
  //# sourceMappingURL=ga4-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ga4-types.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"ga4-types.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/ga4-types.ts"],"names":[],"mappings":";;;AA6BA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAa,CAAA;IACb,0CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}
@@ -1,5 +1,7 @@
1
1
  export interface Payload {
2
- client_id: string;
2
+ data_stream_type?: string;
3
+ app_instance_id?: string;
4
+ client_id?: string;
3
5
  user_id?: string;
4
6
  timestamp_micros?: string;
5
7
  currency?: string;
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const actions_core_1 = require("@segment/actions-core");
4
4
  const ga4_functions_1 = require("../ga4-functions");
5
5
  const ga4_properties_1 = require("../ga4-properties");
6
+ const ga4_types_1 = require("../ga4-types");
6
7
  const action = {
7
8
  title: 'Generate Lead',
8
9
  description: 'Send event when a user submits a form or request for information',
9
10
  defaultSubscription: 'type = "track"',
10
11
  fields: {
12
+ data_stream_type: { ...ga4_properties_1.data_stream_type },
13
+ app_instance_id: { ...ga4_properties_1.app_instance_id },
11
14
  client_id: { ...ga4_properties_1.client_id },
12
15
  user_id: { ...ga4_properties_1.user_id },
13
16
  timestamp_micros: { ...ga4_properties_1.timestamp_micros },
@@ -17,19 +20,23 @@ const action = {
17
20
  engagement_time_msec: ga4_properties_1.engagement_time_msec,
18
21
  params: ga4_properties_1.params
19
22
  },
20
- perform: (request, { payload, features }) => {
23
+ perform: (request, { payload, features, settings }) => {
24
+ const data_stream_type = payload.data_stream_type ?? ga4_types_1.DataStreamType.Web;
25
+ const stream_params = data_stream_type === ga4_types_1.DataStreamType.MobileApp
26
+ ? ga4_functions_1.getMobileStreamParams(settings.apiSecret, settings.firebaseAppId, payload.app_instance_id)
27
+ : ga4_functions_1.getWebStreamParams(settings.apiSecret, settings.measurementId, payload.client_id);
21
28
  if (payload.currency) {
22
29
  ga4_functions_1.verifyCurrency(payload.currency);
23
30
  }
24
31
  if (payload.value && payload.currency === undefined) {
25
- throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
32
+ throw new actions_core_1.IntegrationError('Currency is required if value is set.', actions_core_1.ErrorCodes.INVALID_CURRENCY_CODE, 400);
26
33
  }
27
34
  if (features && features['actions-google-analytics-4-verify-params-feature']) {
28
35
  ga4_functions_1.verifyParams(payload.params);
29
36
  ga4_functions_1.verifyUserProps(payload.user_properties);
30
37
  }
31
38
  const request_object = {
32
- client_id: payload.client_id,
39
+ ...stream_params.identifier,
33
40
  user_id: payload.user_id,
34
41
  events: [
35
42
  {
@@ -47,10 +54,7 @@ const action = {
47
54
  if (features && features['actions-google-analytics-4-add-timestamp']) {
48
55
  request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
49
56
  }
50
- return request('https://www.google-analytics.com/mp/collect', {
51
- method: 'POST',
52
- json: request_object
53
- });
57
+ return ga4_functions_1.sendData(request, stream_params.search_params, request_object);
54
58
  }
55
59
  };
56
60
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/generateLead/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAkG;AAGlG,sDAU0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,kEAAkE;IAC/E,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,gBAAgB,EAAE,EAAE,GAAG,iCAAgB,EAAE;QACzC,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QACzB,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE;QACnB,eAAe,EAAE,gCAAe;QAChC,oBAAoB,EAAE,qCAAoB;QAC1C,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,8BAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;SACjC;QAGD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;YACnD,MAAM,IAAI,+BAAgB,CAAC,uCAAuC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;SACzG;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,kDAAkD,CAAC,EAAE;YAC5E,4BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAC5B,+BAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;SACzC;QAED,MAAM,cAAc,GAA2B;YAC7C,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,eAAe;oBACrB,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,OAAO,CAAC,6CAA6C,EAAE;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/generateLead/index.ts"],"names":[],"mappings":";;AAAA,wDAAsF;AACtF,oDAQyB;AAGzB,sDAY0B;AAC1B,4CAA+D;AAE/D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,kEAAkE;IAC/E,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,gBAAgB,EAAE,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CAAC,eAAe,CAAC,CAAA;SACzC;QAED,MAAM,cAAc,GAA+B;YACjD,GAAG,aAAa,CAAC,UAAU;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,eAAe;oBACrB,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;wBAClD,GAAG,OAAO,CAAC,MAAM;qBAClB;iBACF;aACF;YACD,GAAG,qCAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;SACjD,CAAA;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,0CAA0C,CAAC,EAAE;YACpE,cAAc,CAAC,gBAAgB,GAAG,gCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAC7E;QAED,OAAO,wBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export interface Settings {
2
- measurementId: string;
2
+ measurementId?: string;
3
+ firebaseAppId?: string;
3
4
  apiSecret: string;
4
5
  }
@@ -22,8 +22,9 @@ const addToWishlist_1 = __importDefault(require("./addToWishlist"));
22
22
  const addPaymentInfo_1 = __importDefault(require("./addPaymentInfo"));
23
23
  const refund_1 = __importDefault(require("./refund"));
24
24
  const removeFromCart_1 = __importDefault(require("./removeFromCart"));
25
+ const actions_core_1 = require("@segment/actions-core");
25
26
  const destination = {
26
- name: 'Actions Google Analytic 4',
27
+ name: 'Google Analytics 4 Cloud',
27
28
  slug: 'actions-google-analytics-4',
28
29
  mode: 'cloud',
29
30
  authentication: {
@@ -31,9 +32,15 @@ const destination = {
31
32
  fields: {
32
33
  measurementId: {
33
34
  label: 'Measurement ID',
34
- description: 'The measurement ID associated with a stream. Found in the Google Analytics UI under: Admin > Data Streams > choose your stream > Measurement ID',
35
+ description: 'The Measurement ID associated with a stream. Found in the Google Analytics UI under: Admin > Data Streams > choose your stream > Measurement ID. **Required for web streams.**',
35
36
  type: 'string',
36
- required: true
37
+ required: false
38
+ },
39
+ firebaseAppId: {
40
+ label: 'Firebase App ID',
41
+ description: 'The Firebase App ID associated with the Firebase app. Found in the Firebase console under: Project Settings > General > Your Apps > App ID. **Required for mobile app streams.**',
42
+ type: 'string',
43
+ required: false
37
44
  },
38
45
  apiSecret: {
39
46
  label: 'API Secret',
@@ -41,15 +48,13 @@ const destination = {
41
48
  type: 'string',
42
49
  required: true
43
50
  }
44
- }
45
- },
46
- extendRequest({ settings }) {
47
- return {
48
- searchParams: {
49
- measurement_id: settings.measurementId,
50
- api_secret: settings.apiSecret
51
+ },
52
+ testAuthentication(_, { settings }) {
53
+ if (!settings.firebaseAppId && !settings.measurementId) {
54
+ throw new actions_core_1.IntegrationError('One of Firebase App ID (Mobile app Stream) or Measurement ID (Web Stream) is required', 'Misconfigured field', 400);
51
55
  }
52
- };
56
+ return {};
57
+ }
53
58
  },
54
59
  actions: {
55
60
  purchase: purchase_1.default,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/index.ts"],"names":[],"mappings":";;;;;AAEA,0DAAiC;AACjC,4DAAmC;AACnC,0DAAiC;AACjC,gEAAuC;AACvC,8DAAqC;AACrC,oEAA2C;AAC3C,wEAA+C;AAC/C,0DAAiC;AACjC,sDAA6B;AAC7B,kEAAyC;AACzC,sDAA6B;AAC7B,oEAA2C;AAC3C,0DAAiC;AACjC,oDAA2B;AAC3B,kEAAyC;AACzC,oEAA2C;AAC3C,sEAA6C;AAC7C,sDAA6B;AAC7B,sEAA6C;AAE7C,MAAM,WAAW,GAAoC;IAGnD,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,aAAa,EAAE;gBACb,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EACT,iJAAiJ;gBACnJ,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,4IAA4I;gBAC9I,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,YAAY,EAAE;gBACZ,cAAc,EAAE,QAAQ,CAAC,aAAa;gBACtC,UAAU,EAAE,QAAQ,CAAC,SAAS;aAC/B;SACF,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,QAAQ,EAAR,kBAAQ;QACR,SAAS,EAAT,mBAAS;QACT,QAAQ,EAAR,kBAAQ;QACR,WAAW,EAAX,qBAAW;QACX,UAAU,EAAV,oBAAU;QACV,aAAa,EAAb,uBAAa;QACb,eAAe,EAAf,yBAAe;QACf,QAAQ,EAAR,kBAAQ;QACR,cAAc,EAAd,wBAAc;QACd,QAAQ,EAAR,kBAAQ;QACR,MAAM,EAAN,gBAAM;QACN,YAAY,EAAZ,sBAAY;QACZ,MAAM,EAAN,gBAAM;QACN,aAAa,EAAb,uBAAa;QACb,cAAc,EAAd,wBAAc;QACd,MAAM,EAAN,gBAAM;QACN,KAAK,EAAL,eAAK;QACL,YAAY,EAAZ,sBAAY;QACZ,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-analytics-4/index.ts"],"names":[],"mappings":";;;;;AAEA,0DAAiC;AACjC,4DAAmC;AACnC,0DAAiC;AACjC,gEAAuC;AACvC,8DAAqC;AACrC,oEAA2C;AAC3C,wEAA+C;AAC/C,0DAAiC;AACjC,sDAA6B;AAC7B,kEAAyC;A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