@segment/action-destinations 3.105.1-alpha.11 → 3.105.1-alpha.13

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 (122) hide show
  1. package/dist/destinations/actions-pardot/prospects/index.js.map +1 -1
  2. package/dist/destinations/adobe-target/adobeTarget_operations.d.ts +1 -1
  3. package/dist/destinations/adobe-target/adobeTarget_operations.js +18 -14
  4. package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
  5. package/dist/destinations/amplitude/index.js +1 -3
  6. package/dist/destinations/amplitude/index.js.map +1 -1
  7. package/dist/destinations/amplitude/logEvent/generated-types.d.ts +0 -21
  8. package/dist/destinations/amplitude/logEvent/index.js +10 -96
  9. package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
  10. package/dist/destinations/cordial/addProductToCart/index.js +1 -1
  11. package/dist/destinations/cordial/addProductToCart/index.js.map +1 -1
  12. package/dist/destinations/cordial/index.js +1 -1
  13. package/dist/destinations/cordial/index.js.map +1 -1
  14. package/dist/destinations/cordial/removeProductFromCart/index.js.map +1 -1
  15. package/dist/destinations/cordial/upsertOrder/index.js +8 -8
  16. package/dist/destinations/cordial/upsertOrder/index.js.map +1 -1
  17. package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
  18. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +1 -4
  19. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
  20. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  21. package/dist/destinations/facebook-conversions-api/addToCart/generated-types.d.ts +0 -3
  22. package/dist/destinations/facebook-conversions-api/addToCart/index.js +2 -14
  23. package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
  24. package/dist/destinations/facebook-conversions-api/custom/generated-types.d.ts +0 -3
  25. package/dist/destinations/facebook-conversions-api/custom/index.js +2 -14
  26. package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
  27. package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +0 -3
  28. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +1 -24
  29. package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
  30. package/dist/destinations/facebook-conversions-api/initiateCheckout/generated-types.d.ts +0 -3
  31. package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +2 -14
  32. package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
  33. package/dist/destinations/facebook-conversions-api/pageView/generated-types.d.ts +0 -3
  34. package/dist/destinations/facebook-conversions-api/pageView/index.js +2 -14
  35. package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
  36. package/dist/destinations/facebook-conversions-api/purchase/generated-types.d.ts +0 -3
  37. package/dist/destinations/facebook-conversions-api/purchase/index.js +2 -14
  38. package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
  39. package/dist/destinations/facebook-conversions-api/search/generated-types.d.ts +0 -3
  40. package/dist/destinations/facebook-conversions-api/search/index.js +2 -14
  41. package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
  42. package/dist/destinations/facebook-conversions-api/viewContent/generated-types.d.ts +0 -3
  43. package/dist/destinations/facebook-conversions-api/viewContent/index.js +2 -14
  44. package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
  45. package/dist/destinations/google-enhanced-conversions/generated-types.d.ts +1 -2
  46. package/dist/destinations/google-enhanced-conversions/index.js +8 -15
  47. package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
  48. package/dist/destinations/google-enhanced-conversions/postConversion/index.js +1 -7
  49. package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
  50. package/dist/destinations/hubspot/company/generated-types.d.ts +11 -0
  51. package/dist/destinations/{amplitude/logEventV2 → hubspot/company}/generated-types.js +0 -0
  52. package/dist/destinations/hubspot/company/generated-types.js.map +1 -0
  53. package/dist/destinations/{salesforce-marketing-cloud/contact → hubspot/company}/index.d.ts +0 -0
  54. package/dist/destinations/hubspot/company/index.js +53 -0
  55. package/dist/destinations/hubspot/company/index.js.map +1 -0
  56. package/dist/destinations/hubspot/contact/generated-types.d.ts +11 -0
  57. package/dist/destinations/{google-enhanced-conversions/uploadCallConversion → hubspot/contact}/generated-types.js +0 -0
  58. package/dist/destinations/hubspot/contact/generated-types.js.map +1 -0
  59. package/dist/destinations/{google-enhanced-conversions/uploadCallConversion → hubspot/contact}/index.d.ts +1 -1
  60. package/dist/destinations/hubspot/contact/index.js +68 -0
  61. package/dist/destinations/hubspot/contact/index.js.map +1 -0
  62. package/dist/destinations/{salesforce-marketing-cloud → hubspot}/generated-types.d.ts +0 -0
  63. package/dist/destinations/{google-enhanced-conversions/uploadClickConversion → hubspot}/generated-types.js +0 -0
  64. package/dist/destinations/hubspot/generated-types.js.map +1 -0
  65. package/dist/destinations/{salesforce-marketing-cloud → hubspot}/index.d.ts +0 -0
  66. package/dist/destinations/hubspot/index.js +50 -0
  67. package/dist/destinations/hubspot/index.js.map +1 -0
  68. package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.d.ts +10 -0
  69. package/dist/destinations/{google-enhanced-conversions/uploadConversionAdjustment → hubspot/sendCustomBehavioralEvent}/generated-types.js +0 -0
  70. package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.js.map +1 -0
  71. package/dist/destinations/{google-enhanced-conversions/uploadClickConversion → hubspot/sendCustomBehavioralEvent}/index.d.ts +1 -1
  72. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +57 -0
  73. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -0
  74. package/dist/destinations/index.js +1 -1
  75. package/dist/destinations/index.js.map +1 -1
  76. package/dist/destinations/mixpanel/index.js +1 -1
  77. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  78. package/dist/destinations/salesforce/lead/index.js +1 -2
  79. package/dist/destinations/salesforce/lead/index.js.map +1 -1
  80. package/package.json +4 -5
  81. package/dist/destinations/amplitude/emptyObject.d.ts +0 -2
  82. package/dist/destinations/amplitude/emptyObject.js +0 -7
  83. package/dist/destinations/amplitude/emptyObject.js.map +0 -1
  84. package/dist/destinations/amplitude/logEventV2/generated-types.d.ts +0 -77
  85. package/dist/destinations/amplitude/logEventV2/generated-types.js.map +0 -1
  86. package/dist/destinations/amplitude/logEventV2/index.d.ts +0 -13
  87. package/dist/destinations/amplitude/logEventV2/index.js +0 -237
  88. package/dist/destinations/amplitude/logEventV2/index.js.map +0 -1
  89. package/dist/destinations/google-enhanced-conversions/constants.d.ts +0 -1
  90. package/dist/destinations/google-enhanced-conversions/constants.js +0 -185
  91. package/dist/destinations/google-enhanced-conversions/constants.js.map +0 -1
  92. package/dist/destinations/google-enhanced-conversions/functions.d.ts +0 -3
  93. package/dist/destinations/google-enhanced-conversions/functions.js +0 -34
  94. package/dist/destinations/google-enhanced-conversions/functions.js.map +0 -1
  95. package/dist/destinations/google-enhanced-conversions/types.d.ts +0 -15
  96. package/dist/destinations/google-enhanced-conversions/types.js +0 -3
  97. package/dist/destinations/google-enhanced-conversions/types.js.map +0 -1
  98. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.d.ts +0 -11
  99. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.js.map +0 -1
  100. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +0 -106
  101. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +0 -1
  102. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.d.ts +0 -25
  103. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.js.map +0 -1
  104. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +0 -248
  105. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +0 -1
  106. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.d.ts +0 -5
  107. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.js +0 -3
  108. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.js.map +0 -1
  109. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.d.ts +0 -20
  110. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.js.map +0 -1
  111. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.d.ts +0 -5
  112. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +0 -269
  113. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +0 -1
  114. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.d.ts +0 -2
  115. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js +0 -3
  116. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js.map +0 -1
  117. package/dist/destinations/salesforce-marketing-cloud/contact/index.js +0 -11
  118. package/dist/destinations/salesforce-marketing-cloud/contact/index.js.map +0 -1
  119. package/dist/destinations/salesforce-marketing-cloud/generated-types.js +0 -3
  120. package/dist/destinations/salesforce-marketing-cloud/generated-types.js.map +0 -1
  121. package/dist/destinations/salesforce-marketing-cloud/index.js +0 -27
  122. package/dist/destinations/salesforce-marketing-cloud/index.js.map +0 -1
@@ -1,237 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const actions_core_1 = require("@segment/actions-core");
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- const emptyObject_1 = __importDefault(require("../emptyObject"));
9
- const event_schema_1 = require("../event-schema");
10
- const regional_endpoints_1 = require("../regional-endpoints");
11
- const user_agent_1 = require("../user-agent");
12
- const revenueKeys = ['revenue', 'price', 'productId', 'quantity', 'revenueType'];
13
- const action = {
14
- title: 'Log Event V2',
15
- description: 'Send an event to Amplitude',
16
- fields: {
17
- ...event_schema_1.eventSchema,
18
- products: {
19
- label: 'Products',
20
- description: 'The list of products purchased.',
21
- type: 'object',
22
- multiple: true,
23
- additionalProperties: true,
24
- properties: {
25
- price: {
26
- label: 'Price',
27
- type: 'number',
28
- description: 'The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds.'
29
- },
30
- quantity: {
31
- label: 'Quantity',
32
- type: 'integer',
33
- description: 'The quantity of the item purchased. Defaults to 1 if not specified.'
34
- },
35
- revenue: {
36
- label: 'Revenue',
37
- type: 'number',
38
- description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
39
- },
40
- productId: {
41
- label: 'Product ID',
42
- type: 'string',
43
- description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
44
- },
45
- revenueType: {
46
- label: 'Revenue Type',
47
- type: 'string',
48
- description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
49
- }
50
- },
51
- default: {
52
- '@arrayPath': [
53
- '$.properties.products',
54
- {
55
- price: {
56
- '@path': 'price'
57
- },
58
- revenue: {
59
- '@path': 'revenue'
60
- },
61
- quantity: {
62
- '@path': 'quantity'
63
- },
64
- productId: {
65
- '@path': 'productId'
66
- },
67
- revenueType: {
68
- '@path': 'revenueType'
69
- }
70
- }
71
- ]
72
- }
73
- },
74
- setOnce: {
75
- label: 'Set Once',
76
- description: 'The following fields will be set only once per session when using AJS2 as the source',
77
- type: 'object',
78
- additionalProperties: true,
79
- properties: {
80
- initial_referrer: {
81
- label: 'Initial Referrer',
82
- type: 'string',
83
- description: 'The referrer of the web request'
84
- },
85
- initial_utm_source: {
86
- label: 'Initial UTM Source',
87
- type: 'string'
88
- },
89
- initial_utm_medium: {
90
- label: 'Initial UTM Medium',
91
- type: 'string'
92
- },
93
- initial_utm_campaign: {
94
- label: 'Initial UTM Campaign',
95
- type: 'string'
96
- },
97
- initial_utm_term: {
98
- label: 'Initial UTM Term',
99
- type: 'string'
100
- },
101
- initial_utm_content: {
102
- label: 'Initial UTM Content',
103
- type: 'string'
104
- }
105
- },
106
- default: {
107
- initial_referrer: { '@path': '$.context.page.referrer' },
108
- initial_utm_source: { '@path': '$.context.campaign.source' },
109
- initial_utm_medium: { '@path': '$.context.campaign.medium' },
110
- initial_utm_campaign: { '@path': '$.context.campaign.name' },
111
- initial_utm_term: { '@path': '$.context.campaign.term' },
112
- initial_utm_content: { '@path': '$.context.campaign.content' }
113
- }
114
- },
115
- setAlways: {
116
- label: 'Set Always',
117
- description: 'The following fields will be set every session when using AJS2 as the source',
118
- type: 'object',
119
- additionalProperties: true,
120
- properties: {
121
- referrer: {
122
- label: 'Referrer',
123
- type: 'string'
124
- },
125
- utm_source: {
126
- label: 'UTM Source',
127
- type: 'string'
128
- },
129
- utm_medium: {
130
- label: 'UTM Medium',
131
- type: 'string'
132
- },
133
- utm_campaign: {
134
- label: 'UTM Campaign',
135
- type: 'string'
136
- },
137
- utm_term: {
138
- label: 'UTM Term',
139
- type: 'string'
140
- },
141
- utm_content: {
142
- label: 'UTM Content',
143
- type: 'string'
144
- }
145
- },
146
- default: {
147
- referrer: { '@path': '$.context.page.referrer' },
148
- utm_source: { '@path': '$.context.campaign.source' },
149
- utm_medium: { '@path': '$.context.campaign.medium' },
150
- utm_campaign: { '@path': '$.context.campaign.name' },
151
- utm_term: { '@path': '$.context.campaign.term' },
152
- utm_content: { '@path': '$.context.campaign.content' }
153
- }
154
- },
155
- add: {
156
- label: 'Add',
157
- description: "Increment a user property by a number with add. If the user property doesn't have a value set yet, it's initialized to 0.",
158
- type: 'object',
159
- additionalProperties: true,
160
- defaultObjectUI: 'keyvalue'
161
- },
162
- use_batch_endpoint: {
163
- label: 'Use Batch Endpoint',
164
- description: "If true, events are sent to Amplitude's `batch` endpoint rather than their `httpapi` events endpoint. Enabling this setting may help reduce 429s – or throttling errors – from Amplitude. More information about Amplitude's throttling is available in [their docs](https://developers.amplitude.com/docs/batch-event-upload-api#429s-in-depth).",
165
- type: 'boolean',
166
- default: false
167
- },
168
- userAgent: {
169
- label: 'User Agent',
170
- type: 'string',
171
- description: 'The user agent of the device sending the event.',
172
- default: {
173
- '@path': '$.context.userAgent'
174
- }
175
- },
176
- userAgentParsing: {
177
- label: 'User Agent Parsing',
178
- type: 'boolean',
179
- description: 'Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field',
180
- default: true
181
- },
182
- min_id_length: {
183
- label: 'Minimum ID Length',
184
- description: 'Amplitude has a default minimum id length of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths.',
185
- allowNull: true,
186
- type: 'integer'
187
- }
188
- },
189
- perform: (request, { payload, settings }) => {
190
- const { time, session_id, userAgent, userAgentParsing, min_id_length, library, setOnce, setAlways, add, ...rest } = actions_core_1.omit(payload, revenueKeys);
191
- const properties = rest;
192
- let options;
193
- if (properties.platform) {
194
- properties.platform = properties.platform.replace(/ios/i, 'iOS').replace(/android/i, 'Android');
195
- }
196
- if (library) {
197
- if (library === 'analytics.js')
198
- properties.platform = 'Web';
199
- }
200
- if (time && dayjs_1.default.utc(time).isValid()) {
201
- properties.time = dayjs_1.default.utc(time).valueOf();
202
- }
203
- if (session_id && dayjs_1.default.utc(session_id).isValid()) {
204
- properties.session_id = dayjs_1.default.utc(session_id).valueOf();
205
- }
206
- if (min_id_length && min_id_length > 0) {
207
- options = { min_id_length };
208
- }
209
- if (emptyObject_1.default(setOnce)) {
210
- properties.user_properties = { ...properties.user_properties, $setOnce: setOnce };
211
- }
212
- if (emptyObject_1.default(setAlways)) {
213
- properties.user_properties = { ...properties.user_properties, $set: setAlways };
214
- }
215
- if (emptyObject_1.default(add)) {
216
- properties.user_properties = { ...properties.user_properties, $add: add };
217
- }
218
- const events = [
219
- {
220
- ...(userAgentParsing && user_agent_1.parseUserAgentProperties(userAgent)),
221
- ...actions_core_1.removeUndefined(properties),
222
- library: 'segment'
223
- }
224
- ];
225
- const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
226
- return request(endpoint, {
227
- method: 'post',
228
- json: {
229
- api_key: settings.apiKey,
230
- events,
231
- options
232
- }
233
- });
234
- }
235
- };
236
- exports.default = action;
237
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEventV2/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+E;AAC/E,kDAAyB;AACzB,iEAA2D;AAC3D,kDAA6C;AAE7C,8DAA2D;AAC3D,8CAAwD;AAYxD,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAEhF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,4BAA4B;IACzC,MAAM,EAAE;QACN,GAAG,0BAAW;QACd,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,oBAAoB,EAAE,IAAI;YAC1B,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,+IAA+I;iBAClJ;gBACD,QAAQ,EAAE;oBACR,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qEAAqE;iBACnF;gBACD,OAAO,EAAE;oBACP,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,mMAAmM;iBACtM;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,sGAAsG;iBACzG;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,4GAA4G;iBAC/G;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAA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A;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1 +0,0 @@
1
- export declare const CURRENCY_ISO_CODES: string[];
@@ -1,185 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CURRENCY_ISO_CODES = void 0;
4
- exports.CURRENCY_ISO_CODES = [
5
- 'AED',
6
- 'AFN',
7
- 'ALL',
8
- 'AMD',
9
- 'ANG',
10
- 'AOA',
11
- 'ARS',
12
- 'AUD',
13
- 'AWG',
14
- 'AZN',
15
- 'BAM',
16
- 'BBD',
17
- 'BDT',
18
- 'BGN',
19
- 'BHD',
20
- 'BIF',
21
- 'BMD',
22
- 'BND',
23
- 'BOB',
24
- 'BOV',
25
- 'BRL',
26
- 'BSD',
27
- 'BTN',
28
- 'BWP',
29
- 'BYN',
30
- 'BZD',
31
- 'CAD',
32
- 'CDF',
33
- 'CHE',
34
- 'CHF',
35
- 'CHW',
36
- 'CLF',
37
- 'CLP',
38
- 'CNY',
39
- 'COP',
40
- 'COU',
41
- 'CRC',
42
- 'CUC',
43
- 'CUP',
44
- 'CVE',
45
- 'CZK',
46
- 'DJF',
47
- 'DKK',
48
- 'DOP',
49
- 'DZD',
50
- 'EGP',
51
- 'ERN',
52
- 'ETB',
53
- 'EUR',
54
- 'FJD',
55
- 'FKP',
56
- 'GBP',
57
- 'GEL',
58
- 'GHS',
59
- 'GIP',
60
- 'GMD',
61
- 'GNF',
62
- 'GTQ',
63
- 'GYD',
64
- 'HKD',
65
- 'HNL',
66
- 'HRK',
67
- 'HTG',
68
- 'HUF',
69
- 'IDR',
70
- 'ILS',
71
- 'INR',
72
- 'IQD',
73
- 'IRR',
74
- 'ISK',
75
- 'JMD',
76
- 'JOD',
77
- 'JPY',
78
- 'KES',
79
- 'KGS',
80
- 'KHR',
81
- 'KMF',
82
- 'KPW',
83
- 'KRW',
84
- 'KWD',
85
- 'KYD',
86
- 'KZT',
87
- 'LAK',
88
- 'LBP',
89
- 'LKR',
90
- 'LRD',
91
- 'LSL',
92
- 'LYD',
93
- 'MAD',
94
- 'MDL',
95
- 'MGA',
96
- 'MKD',
97
- 'MMK',
98
- 'MNT',
99
- 'MOP',
100
- 'MRU',
101
- 'MUR',
102
- 'MVR',
103
- 'MWK',
104
- 'MXN',
105
- 'MXV',
106
- 'MYR',
107
- 'MZN',
108
- 'NAD',
109
- 'NGN',
110
- 'NIO',
111
- 'NOK',
112
- 'NPR',
113
- 'NZD',
114
- 'OMR',
115
- 'PAB',
116
- 'PEN',
117
- 'PGK',
118
- 'PHP',
119
- 'PKR',
120
- 'PLN',
121
- 'PYG',
122
- 'QAR',
123
- 'RON',
124
- 'RSD',
125
- 'RUB',
126
- 'RWF',
127
- 'SAR',
128
- 'SBD',
129
- 'SCR',
130
- 'SDG',
131
- 'SEK',
132
- 'SGD',
133
- 'SHP',
134
- 'SLL',
135
- 'SOS',
136
- 'SRD',
137
- 'SSP',
138
- 'STN',
139
- 'SVC',
140
- 'SYP',
141
- 'SZL',
142
- 'THB',
143
- 'TJS',
144
- 'TMT',
145
- 'TND',
146
- 'TOP',
147
- 'TRY',
148
- 'TTD',
149
- 'TWD',
150
- 'TZS',
151
- 'UAH',
152
- 'UGX',
153
- 'USD',
154
- 'USN',
155
- 'UYI',
156
- 'UYU',
157
- 'UYW',
158
- 'UZS',
159
- 'VES',
160
- 'VND',
161
- 'VUV',
162
- 'WST',
163
- 'XAF',
164
- 'XAG',
165
- 'XAU',
166
- 'XBA',
167
- 'XBB',
168
- 'XBC',
169
- 'XBD',
170
- 'XCD',
171
- 'XDR',
172
- 'XOF',
173
- 'XPD',
174
- 'XPF',
175
- 'XPT',
176
- 'XSU',
177
- 'XTS',
178
- 'XUA',
179
- 'XXX',
180
- 'YER',
181
- 'ZAR',
182
- 'ZMW',
183
- 'ZWC'
184
- ];
185
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;IAChC,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAA"}
@@ -1,3 +0,0 @@
1
- import { ConversionCustomVariable } from './types';
2
- export declare function formatCustomVariables(customVariables: object | undefined, customVariableIdsResults: Array<ConversionCustomVariable>): object | undefined;
3
- export declare const hash: (value: string | undefined) => string | undefined;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hash = exports.formatCustomVariables = void 0;
4
- const crypto_1 = require("crypto");
5
- function formatCustomVariables(customVariables, customVariableIdsResults) {
6
- if (!customVariables) {
7
- return undefined;
8
- }
9
- const resourceNames = {};
10
- Object.entries(customVariableIdsResults).forEach(([_, customVariables]) => {
11
- resourceNames[customVariables.conversionCustomVariable.name] = customVariables.conversionCustomVariable.resourceName;
12
- });
13
- const variables = [];
14
- Object.entries(customVariables).forEach(([key, value]) => {
15
- if (resourceNames[key] != undefined) {
16
- const variable = {
17
- conversionCustomVariable: resourceNames[key],
18
- value: value
19
- };
20
- variables.push(variable);
21
- }
22
- });
23
- return variables;
24
- }
25
- exports.formatCustomVariables = formatCustomVariables;
26
- const hash = (value) => {
27
- if (value === undefined)
28
- return;
29
- const hash = crypto_1.createHash('sha256');
30
- hash.update(value);
31
- return hash.digest('hex');
32
- };
33
- exports.hash = hash;
34
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/functions.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAGnC,SAAgB,qBAAqB,CACnC,eAAmC,EACnC,wBAAyD;IAEzD,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,SAAS,CAAA;KACjB;IAGD,MAAM,aAAa,GAA2B,EAAE,CAAA;IAChD,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE;QACxE,aAAa,CAAC,eAAe,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,wBAAwB,CAAC,YAAY,CAAA;IACtH,CAAC,CAAC,CAAA;IAEF,MAAM,SAAS,GAA0D,EAAE,CAAA;IAC3E,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACvD,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE;YACnC,MAAM,QAAQ,GAAG;gBACf,wBAAwB,EAAE,aAAa,CAAC,GAAG,CAAC;gBAC5C,KAAK,EAAE,KAAK;aACb,CAAA;YACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACzB;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC;AA1BD,sDA0BC;AAEM,MAAM,IAAI,GAAG,CAAC,KAAyB,EAAsB,EAAE;IACpE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAM;IAE/B,MAAM,IAAI,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC,CAAA;AANY,QAAA,IAAI,QAMhB"}
@@ -1,15 +0,0 @@
1
- export interface CartItem {
2
- productId?: string;
3
- quantity?: number;
4
- unitPrice?: number;
5
- }
6
- export interface ConversionCustomVariable {
7
- conversionCustomVariable: {
8
- resourceName: string;
9
- id: string;
10
- name: string;
11
- };
12
- }
13
- export interface QueryResponse {
14
- results: Array<ConversionCustomVariable>;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/google-enhanced-conversions/types.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- export interface Payload {
2
- conversion_action: string;
3
- caller_id: string;
4
- call_timestamp?: string;
5
- conversion_timestamp: string;
6
- value?: number;
7
- currency?: string;
8
- custom_variables?: {
9
- [k: string]: unknown;
10
- };
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.ts"],"names":[],"mappings":""}
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const functions_1 = require("../functions");
5
- const action = {
6
- title: 'Upload Call Conversion',
7
- description: 'Upload an offline call conversion to the Google Ads API.',
8
- fields: {
9
- conversion_action: {
10
- label: 'Conversion Action ID',
11
- description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for ctId in the URL. For example, if the URL is https://ads.google.com/aw/conversions/detail?ocid=00000000&ctId=570000000, your Conversion Action ID is 570000000.',
12
- type: 'string',
13
- required: true,
14
- default: ''
15
- },
16
- caller_id: {
17
- label: 'Caller ID',
18
- description: 'The caller id from which this call was placed. Caller id is expected to be in E.164 format with preceding + sign. e.g. "+16502531234".',
19
- type: 'string',
20
- required: true,
21
- default: ''
22
- },
23
- call_timestamp: {
24
- label: 'Call Timestamp',
25
- description: 'The date time at which the call occurred. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".',
26
- type: 'string'
27
- },
28
- conversion_timestamp: {
29
- label: 'Conversion Timestamp',
30
- description: 'The date time at which the conversion occurred. Must be after the click time. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".',
31
- type: 'string',
32
- required: true,
33
- default: {
34
- '@path': '$.timestamp'
35
- }
36
- },
37
- value: {
38
- label: 'Value',
39
- description: 'The value of the conversion for the advertiser.',
40
- type: 'number',
41
- default: {
42
- '@path': '$.properties.total'
43
- }
44
- },
45
- currency: {
46
- label: 'Currency',
47
- description: 'Currency associated with the conversion value. This is the ISO 4217 3-character currency code.',
48
- type: 'string',
49
- default: {
50
- '@path': '$.properties.currency'
51
- }
52
- },
53
- custom_variables: {
54
- label: 'Custom Variables',
55
- description: 'The custom variables associated with this conversion. On the left-hand side, input the name of the custom variable as it appears in your Google Ads account. On the right-hand side, map the Segment field that contains the corresponding value See [Google’s documentation on how to create custom conversion variables.](https://developers.google.com/google-ads/api/docs/conversions/conversion-custom-variables)',
56
- type: 'object',
57
- additionalProperties: true,
58
- defaultObjectUI: 'keyvalue'
59
- }
60
- },
61
- perform: async (request, { auth, settings, payload }) => {
62
- if (!settings.customerId) {
63
- throw new actions_core_1.IntegrationError('Customer id is required for this action. Please set it in destination settings.', 'Missing required fields.', 400);
64
- }
65
- settings.customerId = settings.customerId.replace(/[^0-9.]+/g, '');
66
- const customVariableIds = await request(`https://googleads.googleapis.com/v11/customers/${settings.customerId}/googleAds:searchStream`, {
67
- method: 'post',
68
- headers: {
69
- authorization: `Bearer ${auth?.accessToken}`,
70
- 'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
71
- },
72
- json: {
73
- query: `SELECT conversion_custom_variable.id, conversion_custom_variable.name FROM conversion_custom_variable`
74
- }
75
- });
76
- const request_object = {
77
- conversionAction: `customers/${settings.customerId}/conversionActions/${payload.conversion_action}`,
78
- callerId: payload.caller_id,
79
- callStartDateTime: payload.call_timestamp,
80
- conversionDateTime: payload.conversion_timestamp.replace(/T/, ' ').replace(/\..+/, '+00:00'),
81
- conversionValue: payload.value,
82
- currencyCode: payload.currency,
83
- customVariables: functions_1.formatCustomVariables(payload.custom_variables, customVariableIds.data[0].results)
84
- };
85
- const response = await request(`https://googleads.googleapis.com/v11/customers/${settings.customerId}:uploadCallConversions`, {
86
- method: 'post',
87
- headers: {
88
- 'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
89
- },
90
- json: {
91
- conversions: [request_object],
92
- partialFailure: true
93
- }
94
- });
95
- if (typeof response.data === 'object' && response.data != null) {
96
- Object.entries(response.data).forEach(([key, value]) => {
97
- if (key === 'partialFailureError' && value.code !== 0) {
98
- throw new actions_core_1.IntegrationError(value.message, 'INVALID_ARGUMENT', 400);
99
- }
100
- });
101
- }
102
- return response;
103
- }
104
- };
105
- exports.default = action;
106
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadCallConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAA4F;AAG5F,4CAAoD;AAGpD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EAAE,0DAA0D;I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,EAAE,IAAI;aACrB;SACF,CACF,CAAA;QAGD,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE;YAC9D,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACrD,IAAI,GAAG,KAAK,qBAAqB,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE;oBACrD,MAAM,IAAI,+BAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;iBACnE;YACH,CAAC,CAAC,CAAA;SACH;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,25 +0,0 @@
1
- export interface Payload {
2
- conversion_action: string;
3
- gclid?: string;
4
- gbraid?: string;
5
- wbraid?: string;
6
- conversion_timestamp: string;
7
- email_address?: string;
8
- phone_number?: string;
9
- order_id?: string;
10
- value?: number;
11
- currency?: string;
12
- conversion_environment?: string;
13
- merchant_id?: string;
14
- merchant_country_code?: string;
15
- merchant_language_code?: string;
16
- local_cost?: number & string;
17
- items?: {
18
- product_id?: string;
19
- quantity?: number;
20
- price?: number;
21
- }[];
22
- custom_variables?: {
23
- [k: string]: unknown;
24
- };
25
- }