@segment/action-destinations 3.141.0 → 3.142.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 (189) hide show
  1. package/dist/destinations/acoustic/Utility/eventprocessing.d.ts +10 -0
  2. package/dist/destinations/acoustic/Utility/eventprocessing.js +106 -0
  3. package/dist/destinations/acoustic/Utility/eventprocessing.js.map +1 -0
  4. package/dist/destinations/acoustic/Utility/tablemaintutilities.d.ts +9 -0
  5. package/dist/destinations/acoustic/Utility/tablemaintutilities.js +153 -0
  6. package/dist/destinations/acoustic/Utility/tablemaintutilities.js.map +1 -0
  7. package/dist/destinations/acoustic/generated-types.d.ts +6 -0
  8. package/dist/destinations/acoustic/generated-types.js +3 -0
  9. package/dist/destinations/acoustic/generated-types.js.map +1 -0
  10. package/dist/destinations/acoustic/index.d.ts +10 -0
  11. package/dist/destinations/acoustic/index.js +119 -0
  12. package/dist/destinations/acoustic/index.js.map +1 -0
  13. package/dist/destinations/acoustic/receiveEvents/generated-types.d.ts +14 -0
  14. package/dist/destinations/acoustic/receiveEvents/generated-types.js +3 -0
  15. package/dist/destinations/acoustic/receiveEvents/generated-types.js.map +1 -0
  16. package/dist/destinations/acoustic/receiveEvents/index.d.ts +5 -0
  17. package/dist/destinations/acoustic/receiveEvents/index.js +72 -0
  18. package/dist/destinations/acoustic/receiveEvents/index.js.map +1 -0
  19. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js +1 -1
  20. package/dist/destinations/blackbaud-raisers-edge-nxt/index.js.map +1 -1
  21. package/dist/destinations/heap/heapUtils.js +1 -1
  22. package/dist/destinations/heap/heapUtils.js.map +1 -1
  23. package/dist/destinations/heap/trackEvent/index.js +1 -1
  24. package/dist/destinations/heap/trackEvent/index.js.map +1 -1
  25. package/dist/destinations/index.js +3 -0
  26. package/dist/destinations/index.js.map +1 -1
  27. package/dist/destinations/june/generated-types.d.ts +3 -0
  28. package/dist/destinations/june/generated-types.js +3 -0
  29. package/dist/destinations/june/generated-types.js.map +1 -0
  30. package/dist/destinations/june/group/generated-types.d.ts +10 -0
  31. package/dist/destinations/june/group/generated-types.js +3 -0
  32. package/dist/destinations/june/group/generated-types.js.map +1 -0
  33. package/dist/destinations/june/group/index.d.ts +5 -0
  34. package/dist/destinations/june/group/index.js +64 -0
  35. package/dist/destinations/june/group/index.js.map +1 -0
  36. package/dist/destinations/june/identify/generated-types.d.ts +9 -0
  37. package/dist/destinations/june/identify/generated-types.js +3 -0
  38. package/dist/destinations/june/identify/generated-types.js.map +1 -0
  39. package/dist/destinations/june/identify/index.d.ts +5 -0
  40. package/dist/destinations/june/identify/index.js +57 -0
  41. package/dist/destinations/june/identify/index.js.map +1 -0
  42. package/dist/destinations/june/index.d.ts +4 -0
  43. package/dist/destinations/june/index.js +64 -0
  44. package/dist/destinations/june/index.js.map +1 -0
  45. package/dist/destinations/june/page/generated-types.d.ts +13 -0
  46. package/dist/destinations/june/page/generated-types.js +3 -0
  47. package/dist/destinations/june/page/generated-types.js.map +1 -0
  48. package/dist/destinations/june/page/index.d.ts +5 -0
  49. package/dist/destinations/june/page/index.js +72 -0
  50. package/dist/destinations/june/page/index.js.map +1 -0
  51. package/dist/destinations/june/track/generated-types.d.ts +13 -0
  52. package/dist/destinations/june/track/generated-types.js +3 -0
  53. package/dist/destinations/june/track/generated-types.js.map +1 -0
  54. package/dist/destinations/june/track/index.d.ts +5 -0
  55. package/dist/destinations/june/track/index.js +75 -0
  56. package/dist/destinations/june/track/index.js.map +1 -0
  57. package/dist/destinations/revend/addPaymentInfo/generated-types.d.ts +37 -0
  58. package/dist/destinations/revend/addPaymentInfo/generated-types.js +3 -0
  59. package/dist/destinations/revend/addPaymentInfo/generated-types.js.map +1 -0
  60. package/dist/destinations/revend/addPaymentInfo/index.d.ts +5 -0
  61. package/dist/destinations/revend/addPaymentInfo/index.js +84 -0
  62. package/dist/destinations/revend/addPaymentInfo/index.js.map +1 -0
  63. package/dist/destinations/revend/addToCart/generated-types.d.ts +35 -0
  64. package/dist/destinations/revend/addToCart/generated-types.js +3 -0
  65. package/dist/destinations/revend/addToCart/generated-types.js.map +1 -0
  66. package/dist/destinations/revend/addToCart/index.d.ts +5 -0
  67. package/dist/destinations/revend/addToCart/index.js +71 -0
  68. package/dist/destinations/revend/addToCart/index.js.map +1 -0
  69. package/dist/destinations/revend/addToWishlist/generated-types.d.ts +35 -0
  70. package/dist/destinations/revend/addToWishlist/generated-types.js +3 -0
  71. package/dist/destinations/revend/addToWishlist/generated-types.js.map +1 -0
  72. package/dist/destinations/revend/addToWishlist/index.d.ts +5 -0
  73. package/dist/destinations/revend/addToWishlist/index.js +77 -0
  74. package/dist/destinations/revend/addToWishlist/index.js.map +1 -0
  75. package/dist/destinations/revend/beginCheckout/generated-types.d.ts +36 -0
  76. package/dist/destinations/revend/beginCheckout/generated-types.js +3 -0
  77. package/dist/destinations/revend/beginCheckout/generated-types.js.map +1 -0
  78. package/dist/destinations/revend/beginCheckout/index.d.ts +5 -0
  79. package/dist/destinations/revend/beginCheckout/index.js +73 -0
  80. package/dist/destinations/revend/beginCheckout/index.js.map +1 -0
  81. package/dist/destinations/revend/constants.d.ts +1 -0
  82. package/dist/destinations/revend/constants.js +185 -0
  83. package/dist/destinations/revend/constants.js.map +1 -0
  84. package/dist/destinations/revend/customEvent/generated-types.d.ts +14 -0
  85. package/dist/destinations/revend/customEvent/generated-types.js +3 -0
  86. package/dist/destinations/revend/customEvent/generated-types.js.map +1 -0
  87. package/dist/destinations/revend/customEvent/index.d.ts +5 -0
  88. package/dist/destinations/revend/customEvent/index.js +70 -0
  89. package/dist/destinations/revend/customEvent/index.js.map +1 -0
  90. package/dist/destinations/revend/ga4-functions.d.ts +4 -0
  91. package/dist/destinations/revend/ga4-functions.js +53 -0
  92. package/dist/destinations/revend/ga4-functions.js.map +1 -0
  93. package/dist/destinations/revend/ga4-properties.d.ts +23 -0
  94. package/dist/destinations/revend/ga4-properties.js +320 -0
  95. package/dist/destinations/revend/ga4-properties.js.map +1 -0
  96. package/dist/destinations/revend/ga4-types.d.ts +27 -0
  97. package/dist/destinations/revend/ga4-types.js +3 -0
  98. package/dist/destinations/revend/ga4-types.js.map +1 -0
  99. package/dist/destinations/revend/generateLead/generated-types.d.ts +14 -0
  100. package/dist/destinations/revend/generateLead/generated-types.js +3 -0
  101. package/dist/destinations/revend/generateLead/generated-types.js.map +1 -0
  102. package/dist/destinations/revend/generateLead/index.d.ts +5 -0
  103. package/dist/destinations/revend/generateLead/index.js +57 -0
  104. package/dist/destinations/revend/generateLead/index.js.map +1 -0
  105. package/dist/destinations/revend/generated-types.d.ts +3 -0
  106. package/dist/destinations/revend/generated-types.js +3 -0
  107. package/dist/destinations/revend/generated-types.js.map +1 -0
  108. package/dist/destinations/revend/index.d.ts +4 -0
  109. package/dist/destinations/revend/index.js +70 -0
  110. package/dist/destinations/revend/index.js.map +1 -0
  111. package/dist/destinations/revend/login/generated-types.d.ts +13 -0
  112. package/dist/destinations/revend/login/generated-types.js +3 -0
  113. package/dist/destinations/revend/login/generated-types.js.map +1 -0
  114. package/dist/destinations/revend/login/index.d.ts +5 -0
  115. package/dist/destinations/revend/login/index.js +52 -0
  116. package/dist/destinations/revend/login/index.js.map +1 -0
  117. package/dist/destinations/revend/pageView/generated-types.d.ts +15 -0
  118. package/dist/destinations/revend/pageView/generated-types.js +3 -0
  119. package/dist/destinations/revend/pageView/generated-types.js.map +1 -0
  120. package/dist/destinations/revend/pageView/index.d.ts +5 -0
  121. package/dist/destinations/revend/pageView/index.js +73 -0
  122. package/dist/destinations/revend/pageView/index.js.map +1 -0
  123. package/dist/destinations/revend/purchase/generated-types.d.ts +40 -0
  124. package/dist/destinations/revend/purchase/generated-types.js +3 -0
  125. package/dist/destinations/revend/purchase/generated-types.js.map +1 -0
  126. package/dist/destinations/revend/purchase/index.d.ts +5 -0
  127. package/dist/destinations/revend/purchase/index.js +79 -0
  128. package/dist/destinations/revend/purchase/index.js.map +1 -0
  129. package/dist/destinations/revend/refund/generated-types.d.ts +40 -0
  130. package/dist/destinations/revend/refund/generated-types.js +3 -0
  131. package/dist/destinations/revend/refund/generated-types.js.map +1 -0
  132. package/dist/destinations/revend/refund/index.d.ts +5 -0
  133. package/dist/destinations/revend/refund/index.js +90 -0
  134. package/dist/destinations/revend/refund/index.js.map +1 -0
  135. package/dist/destinations/revend/removeFromCart/generated-types.d.ts +35 -0
  136. package/dist/destinations/revend/removeFromCart/generated-types.js +3 -0
  137. package/dist/destinations/revend/removeFromCart/generated-types.js.map +1 -0
  138. package/dist/destinations/revend/removeFromCart/index.d.ts +5 -0
  139. package/dist/destinations/revend/removeFromCart/index.js +77 -0
  140. package/dist/destinations/revend/removeFromCart/index.js.map +1 -0
  141. package/dist/destinations/revend/search/generated-types.d.ts +13 -0
  142. package/dist/destinations/revend/search/generated-types.js +3 -0
  143. package/dist/destinations/revend/search/generated-types.js.map +1 -0
  144. package/dist/destinations/revend/search/index.d.ts +5 -0
  145. package/dist/destinations/revend/search/index.js +56 -0
  146. package/dist/destinations/revend/search/index.js.map +1 -0
  147. package/dist/destinations/revend/selectItem/generated-types.d.ts +35 -0
  148. package/dist/destinations/revend/selectItem/generated-types.js +3 -0
  149. package/dist/destinations/revend/selectItem/generated-types.js.map +1 -0
  150. package/dist/destinations/revend/selectItem/index.d.ts +5 -0
  151. package/dist/destinations/revend/selectItem/index.js +76 -0
  152. package/dist/destinations/revend/selectItem/index.js.map +1 -0
  153. package/dist/destinations/revend/selectPromotion/generated-types.d.ts +42 -0
  154. package/dist/destinations/revend/selectPromotion/generated-types.js +3 -0
  155. package/dist/destinations/revend/selectPromotion/generated-types.js.map +1 -0
  156. package/dist/destinations/revend/selectPromotion/index.d.ts +5 -0
  157. package/dist/destinations/revend/selectPromotion/index.js +92 -0
  158. package/dist/destinations/revend/selectPromotion/index.js.map +1 -0
  159. package/dist/destinations/revend/signUp/generated-types.d.ts +13 -0
  160. package/dist/destinations/revend/signUp/generated-types.js +3 -0
  161. package/dist/destinations/revend/signUp/generated-types.js.map +1 -0
  162. package/dist/destinations/revend/signUp/index.d.ts +5 -0
  163. package/dist/destinations/revend/signUp/index.js +55 -0
  164. package/dist/destinations/revend/signUp/index.js.map +1 -0
  165. package/dist/destinations/revend/viewCart/generated-types.d.ts +35 -0
  166. package/dist/destinations/revend/viewCart/generated-types.js +3 -0
  167. package/dist/destinations/revend/viewCart/generated-types.js.map +1 -0
  168. package/dist/destinations/revend/viewCart/index.d.ts +5 -0
  169. package/dist/destinations/revend/viewCart/index.js +77 -0
  170. package/dist/destinations/revend/viewCart/index.js.map +1 -0
  171. package/dist/destinations/revend/viewItem/generated-types.d.ts +35 -0
  172. package/dist/destinations/revend/viewItem/generated-types.js +3 -0
  173. package/dist/destinations/revend/viewItem/generated-types.js.map +1 -0
  174. package/dist/destinations/revend/viewItem/index.d.ts +5 -0
  175. package/dist/destinations/revend/viewItem/index.js +71 -0
  176. package/dist/destinations/revend/viewItem/index.js.map +1 -0
  177. package/dist/destinations/revend/viewItemList/generated-types.d.ts +35 -0
  178. package/dist/destinations/revend/viewItemList/generated-types.js +3 -0
  179. package/dist/destinations/revend/viewItemList/generated-types.js.map +1 -0
  180. package/dist/destinations/revend/viewItemList/index.d.ts +5 -0
  181. package/dist/destinations/revend/viewItemList/index.js +82 -0
  182. package/dist/destinations/revend/viewItemList/index.js.map +1 -0
  183. package/dist/destinations/revend/viewPromotion/generated-types.d.ts +42 -0
  184. package/dist/destinations/revend/viewPromotion/generated-types.js +3 -0
  185. package/dist/destinations/revend/viewPromotion/generated-types.js.map +1 -0
  186. package/dist/destinations/revend/viewPromotion/index.d.ts +5 -0
  187. package/dist/destinations/revend/viewPromotion/index.js +96 -0
  188. package/dist/destinations/revend/viewPromotion/index.js.map +1 -0
  189. package/package.json +4 -4
@@ -0,0 +1,35 @@
1
+ export interface Payload {
2
+ client_id: string;
3
+ user_id?: string;
4
+ timestamp_micros?: string;
5
+ item_list_id?: string;
6
+ item_list_name?: string;
7
+ items: {
8
+ item_id?: string;
9
+ item_name?: string;
10
+ affiliation?: string;
11
+ coupon?: string;
12
+ currency?: string;
13
+ discount?: number;
14
+ index?: number;
15
+ item_brand?: string;
16
+ item_category?: string;
17
+ item_category2?: string;
18
+ item_category3?: string;
19
+ item_category4?: string;
20
+ item_category5?: string;
21
+ item_list_id?: string;
22
+ item_list_name?: string;
23
+ item_variant?: string;
24
+ location_id?: string;
25
+ price?: number;
26
+ quantity?: number;
27
+ }[];
28
+ user_properties?: {
29
+ [k: string]: unknown;
30
+ };
31
+ engagement_time_msec?: number;
32
+ params?: {
33
+ [k: string]: unknown;
34
+ };
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/revend/viewItemList/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const ga4_functions_1 = require("../ga4-functions");
5
+ const ga4_properties_1 = require("../ga4-properties");
6
+ const action = {
7
+ title: 'View Item List',
8
+ description: 'Send event when a user views a list of items or offerings',
9
+ defaultSubscription: 'type = "track" and event = "Product List Viewed"',
10
+ fields: {
11
+ client_id: { ...ga4_properties_1.client_id },
12
+ user_id: { ...ga4_properties_1.user_id },
13
+ timestamp_micros: { ...ga4_properties_1.timestamp_micros },
14
+ item_list_id: {
15
+ label: 'Item List ID',
16
+ type: 'string',
17
+ description: 'The ID of the list in which the item was presented to the user.',
18
+ default: {
19
+ '@path': `$.properties.list_id`
20
+ }
21
+ },
22
+ item_list_name: {
23
+ label: 'Item List Name',
24
+ type: 'string',
25
+ description: 'The name of the list in which the item was presented to the user.',
26
+ default: {
27
+ '@path': '$.properties.category'
28
+ }
29
+ },
30
+ items: {
31
+ ...ga4_properties_1.items_multi_products,
32
+ required: true
33
+ },
34
+ user_properties: ga4_properties_1.user_properties,
35
+ engagement_time_msec: ga4_properties_1.engagement_time_msec,
36
+ params: ga4_properties_1.params
37
+ },
38
+ perform: (request, { payload, features }) => {
39
+ let googleItems = [];
40
+ if (payload.items) {
41
+ googleItems = payload.items.map((product) => {
42
+ if (product.item_name === undefined && product.item_id === undefined) {
43
+ throw new actions_core_1.IntegrationError('One of product name or product id is required for product or impression data.', 'Misconfigured required field', 400);
44
+ }
45
+ if (product.currency) {
46
+ ga4_functions_1.verifyCurrency(product.currency);
47
+ }
48
+ return product;
49
+ });
50
+ }
51
+ if (features && features['actions-google-analytics-4-verify-params-feature']) {
52
+ ga4_functions_1.verifyParams(payload.params);
53
+ ga4_functions_1.verifyUserProps(payload.user_properties);
54
+ }
55
+ const request_object = {
56
+ client_id: payload.client_id,
57
+ user_id: payload.user_id,
58
+ events: [
59
+ {
60
+ name: 'view_item_list',
61
+ params: {
62
+ item_list_id: payload.item_list_id,
63
+ item_list_name: payload.item_list_name,
64
+ items: googleItems,
65
+ engagement_time_msec: payload.engagement_time_msec,
66
+ ...payload.params
67
+ }
68
+ }
69
+ ],
70
+ ...ga4_properties_1.formatUserProperties(payload.user_properties)
71
+ };
72
+ if (features && features['actions-google-analytics-4-add-timestamp']) {
73
+ request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
74
+ }
75
+ return request('https://gtmadapter-node-cbjg5cz5hq-ew.a.run.app/v2/consolidated-data', {
76
+ method: 'POST',
77
+ json: request_object
78
+ });
79
+ }
80
+ };
81
+ exports.default = action;
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/revend/viewItemList/index.ts"],"names":[],"m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AC,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,gBAAgB;oBACtB,MAAM,EAAE;wBACN,YAAY,EAAE,OAAO,CAAC,YAAY;wBAClC,cAAc,EAAE,OAAO,CAAC,cAAc;wBACtC,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,sEAAsE,EAAE;YACrF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,42 @@
1
+ export interface Payload {
2
+ client_id: string;
3
+ user_id?: string;
4
+ timestamp_micros?: string;
5
+ creative_name?: string;
6
+ creative_slot?: string;
7
+ location_id?: string;
8
+ promotion_id?: string;
9
+ promotion_name?: string;
10
+ items: {
11
+ item_id?: string;
12
+ item_name?: string;
13
+ affiliation?: string;
14
+ coupon?: string;
15
+ currency?: string;
16
+ discount?: number;
17
+ index?: number;
18
+ item_brand?: string;
19
+ item_category?: string;
20
+ item_category2?: string;
21
+ item_category3?: string;
22
+ item_category4?: string;
23
+ item_category5?: string;
24
+ item_list_id?: string;
25
+ item_list_name?: string;
26
+ item_variant?: string;
27
+ location_id?: string;
28
+ price?: number;
29
+ quantity?: number;
30
+ creative_name?: string;
31
+ creative_slot?: string;
32
+ promotion_name?: string;
33
+ promotion_id?: string;
34
+ }[];
35
+ user_properties?: {
36
+ [k: string]: unknown;
37
+ };
38
+ engagement_time_msec?: number;
39
+ params?: {
40
+ [k: string]: unknown;
41
+ };
42
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/revend/viewPromotion/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const ga4_functions_1 = require("../ga4-functions");
5
+ const ga4_properties_1 = require("../ga4-properties");
6
+ const action = {
7
+ title: 'View Promotion',
8
+ description: 'Send event when a promotion is shown to a user',
9
+ defaultSubscription: 'type = "track" and event = "Promotion Viewed"',
10
+ fields: {
11
+ client_id: { ...ga4_properties_1.client_id },
12
+ user_id: { ...ga4_properties_1.user_id },
13
+ timestamp_micros: { ...ga4_properties_1.timestamp_micros },
14
+ creative_name: { ...ga4_properties_1.creative_name },
15
+ creative_slot: { ...ga4_properties_1.creative_slot, default: { '@path': '$.properties.creative' } },
16
+ location_id: {
17
+ label: 'Location ID',
18
+ type: 'string',
19
+ description: 'The ID of the location.',
20
+ default: {
21
+ '@path': '$.properties.position'
22
+ }
23
+ },
24
+ promotion_id: { ...ga4_properties_1.promotion_id, default: { '@path': '$.properties.promotion_id' } },
25
+ promotion_name: { ...ga4_properties_1.promotion_name, default: { '@path': '$.properties.name' } },
26
+ items: {
27
+ ...ga4_properties_1.items_single_products,
28
+ required: true,
29
+ properties: {
30
+ ...ga4_properties_1.minimal_items.properties,
31
+ creative_name: {
32
+ ...ga4_properties_1.creative_name
33
+ },
34
+ creative_slot: {
35
+ ...ga4_properties_1.creative_slot
36
+ },
37
+ promotion_name: {
38
+ ...ga4_properties_1.promotion_name
39
+ },
40
+ promotion_id: {
41
+ ...ga4_properties_1.promotion_id
42
+ }
43
+ }
44
+ },
45
+ user_properties: ga4_properties_1.user_properties,
46
+ engagement_time_msec: ga4_properties_1.engagement_time_msec,
47
+ params: ga4_properties_1.params
48
+ },
49
+ perform: (request, { payload, features }) => {
50
+ let googleItems = [];
51
+ if (payload.items) {
52
+ googleItems = payload.items.map((product) => {
53
+ if (product.item_name === undefined && product.item_id === undefined) {
54
+ throw new actions_core_1.IntegrationError('One of item id or item name is required.', 'Misconfigured required field', 400);
55
+ }
56
+ if (product.currency) {
57
+ ga4_functions_1.verifyCurrency(product.currency);
58
+ }
59
+ return product;
60
+ });
61
+ }
62
+ if (features && features['actions-google-analytics-4-verify-params-feature']) {
63
+ ga4_functions_1.verifyParams(payload.params);
64
+ ga4_functions_1.verifyUserProps(payload.user_properties);
65
+ }
66
+ const request_object = {
67
+ client_id: payload.client_id,
68
+ user_id: payload.user_id,
69
+ events: [
70
+ {
71
+ name: 'view_promotion',
72
+ params: {
73
+ creative_name: payload.creative_name,
74
+ creative_slot: payload.creative_slot,
75
+ location_id: payload.location_id,
76
+ promotion_id: payload.promotion_id,
77
+ promotion_name: payload.promotion_name,
78
+ items: googleItems,
79
+ engagement_time_msec: payload.engagement_time_msec,
80
+ ...payload.params
81
+ }
82
+ }
83
+ ],
84
+ ...ga4_properties_1.formatUserProperties(payload.user_properties)
85
+ };
86
+ if (features && features['actions-google-analytics-4-add-timestamp']) {
87
+ request_object.timestamp_micros = ga4_functions_1.convertTimestamp(payload.timestamp_micros);
88
+ }
89
+ return request('https://gtmadapter-node-cbjg5cz5hq-ew.a.run.app/v2/consolidated-data', {
90
+ method: 'POST',
91
+ json: request_object
92
+ });
93
+ }
94
+ };
95
+ exports.default = action;
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/revend/viewPromotion/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,oDAAkG;AAClG,sDAc0B;AAS1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,gDAAgD;IAC7D,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,EAAE;QACzC,aAAa,EAAE,EAAE,GAAG,8BAAa,EAAE;QACnC,aAAa,EAAE,EAAE,GAAG,8BAAa,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE,EAAE;QAClF,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,YAAY,EAAE,EAAE,GAAG,6BAAY,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE;QACpF,cAAc,EAAE,EAAE,GAAG,+BAAc,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,EAAE;QAChF,KAAK,EAAE;YACL,GAAG,sCAAqB;YACxB,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,GAAG,8BAAa,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E,OAAO,CAAC,aAAa;wBACpC,WAAW,EAAE,OAAO,CAAC,WAAW;wBAChC,YAAY,EAAE,OAAO,CAAC,YAAY;wBAClC,cAAc,EAAE,OAAO,CAAC,cAAc;wBACtC,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,sEAAsE,EAAE;YACrF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.141.0",
4
+ "version": "3.142.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "@amplitude/ua-parser-js": "^0.7.25",
41
41
  "@segment/a1-notation": "^2.1.4",
42
- "@segment/actions-core": "^3.56.0",
43
- "@segment/actions-shared": "^1.38.0",
42
+ "@segment/actions-core": "^3.57.0",
43
+ "@segment/actions-shared": "^1.39.0",
44
44
  "@types/node": "^18.11.15",
45
45
  "cheerio": "^1.0.0-rc.10",
46
46
  "dayjs": "^1.10.7",
@@ -68,5 +68,5 @@
68
68
  "lcov"
69
69
  ]
70
70
  },
71
- "gitHead": "0ebaa62b746894b224730ac2e76c9ae1e93b43e8"
71
+ "gitHead": "4a72049613a83ea7e80e288b0fd4080577c8ad44"
72
72
  }