@segment/action-destinations 3.110.1-apha.5 → 3.111.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.
- package/dist/destinations/actions-pardot/prospects/index.js.map +1 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.d.ts +1 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.js +21 -15
- package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
- package/dist/destinations/adobe-target/generated-types.d.ts +1 -0
- package/dist/destinations/adobe-target/index.js +15 -0
- package/dist/destinations/adobe-target/index.js.map +1 -1
- package/dist/destinations/amplitude/compact.d.ts +2 -0
- package/dist/destinations/amplitude/compact.js +7 -0
- package/dist/destinations/amplitude/compact.js.map +1 -0
- package/dist/destinations/amplitude/index.js +6 -6
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +0 -21
- package/dist/destinations/amplitude/logEvent/index.js +10 -96
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/amplitude/logEventV2/index.js +16 -15
- package/dist/destinations/amplitude/logEventV2/index.js.map +1 -1
- package/dist/destinations/cordial/addProductToCart/index.js +1 -1
- package/dist/destinations/cordial/addProductToCart/index.js.map +1 -1
- package/dist/destinations/cordial/index.js +1 -1
- package/dist/destinations/cordial/index.js.map +1 -1
- package/dist/destinations/cordial/removeProductFromCart/index.js.map +1 -1
- package/dist/destinations/cordial/upsertOrder/index.js +8 -8
- package/dist/destinations/cordial/upsertOrder/index.js.map +1 -1
- package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/generated-types.d.ts +0 -1
- package/dist/destinations/engage-messaging-sendgrid/index.js +0 -5
- package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +1 -0
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +8 -6
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +2 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +8 -6
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search/index.js +1 -5
- package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +3 -6
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +5 -2
- package/dist/destinations/google-enhanced-conversions/functions.js +27 -7
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +8 -0
- package/dist/destinations/google-enhanced-conversions/types.js +2 -0
- package/dist/destinations/google-enhanced-conversions/types.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/generated-types.d.ts +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +20 -33
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.d.ts +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +31 -50
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.d.ts +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +62 -45
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/{salesforce-marketing-cloud → hubspot}/generated-types.d.ts +0 -0
- package/dist/destinations/{salesforce-marketing-cloud/contact → hubspot}/generated-types.js +0 -0
- package/dist/destinations/hubspot/generated-types.js.map +1 -0
- package/dist/destinations/{salesforce-marketing-cloud → hubspot}/index.d.ts +0 -0
- package/dist/destinations/hubspot/index.js +47 -0
- package/dist/destinations/hubspot/index.js.map +1 -0
- package/dist/destinations/hubspot/properties.d.ts +1 -0
- package/dist/destinations/hubspot/properties.js +5 -0
- package/dist/destinations/hubspot/properties.js.map +1 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.d.ts +10 -0
- package/dist/destinations/{salesforce-marketing-cloud → hubspot/sendCustomBehavioralEvent}/generated-types.js +0 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.js.map +1 -0
- package/dist/destinations/{salesforce-marketing-cloud/contact → hubspot/sendCustomBehavioralEvent}/index.d.ts +0 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +69 -0
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -0
- package/dist/destinations/hubspot/testHelper.d.ts +7 -0
- package/dist/destinations/hubspot/testHelper.js +24 -0
- package/dist/destinations/hubspot/testHelper.js.map +1 -0
- package/dist/destinations/hubspot/upsertContact/generated-types.d.ts +17 -0
- package/dist/destinations/{mixpanel/trackEvent/types.js → hubspot/upsertContact/generated-types.js} +1 -1
- package/dist/destinations/hubspot/upsertContact/generated-types.js.map +1 -0
- package/dist/destinations/hubspot/upsertContact/index.d.ts +5 -0
- package/dist/destinations/hubspot/upsertContact/index.js +183 -0
- package/dist/destinations/hubspot/upsertContact/index.js.map +1 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.d.ts +6 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.js +3 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.js.map +1 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.d.ts +5 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +38 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -0
- package/dist/destinations/index.js +1 -2
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/index.js +38 -11
- package/dist/destinations/linkedin-audiences/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +19 -10
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/{salesforce-marketing-cloud/contact → loops/createContact}/generated-types.d.ts +1 -0
- package/dist/destinations/loops/createContact/generated-types.js +3 -0
- package/dist/destinations/loops/createContact/generated-types.js.map +1 -0
- package/dist/destinations/loops/createContact/index.d.ts +5 -0
- package/dist/destinations/loops/createContact/index.js +33 -0
- package/dist/destinations/loops/createContact/index.js.map +1 -0
- package/dist/destinations/loops/generated-types.d.ts +3 -0
- package/dist/destinations/loops/generated-types.js +3 -0
- package/dist/destinations/loops/generated-types.js.map +1 -0
- package/dist/destinations/loops/index.d.ts +4 -0
- package/dist/destinations/loops/index.js +35 -0
- package/dist/destinations/loops/index.js.map +1 -0
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js +5 -2
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/identifyUser/index.js +11 -2
- package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/index.js +11 -3
- package/dist/destinations/mixpanel/index.js.map +1 -1
- package/dist/destinations/mixpanel/mixpanel-properties.d.ts +3 -0
- package/dist/destinations/mixpanel/mixpanel-properties.js +440 -0
- package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -0
- package/dist/destinations/mixpanel/mixpanel-types.d.ts +55 -0
- package/dist/destinations/{google-enhanced-conversions/uploadClickConversion/types.js → mixpanel/mixpanel-types.js} +1 -1
- package/dist/destinations/mixpanel/mixpanel-types.js.map +1 -0
- package/dist/destinations/mixpanel/trackEvent/functions.d.ts +4 -0
- package/dist/destinations/mixpanel/trackEvent/functions.js +64 -0
- package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -0
- package/dist/destinations/mixpanel/trackEvent/generated-types.d.ts +3 -0
- package/dist/destinations/mixpanel/trackEvent/index.js +25 -1
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/generated-types.d.ts +65 -0
- package/dist/destinations/mixpanel/trackPurchase/generated-types.js +3 -0
- package/dist/destinations/mixpanel/trackPurchase/generated-types.js.map +1 -0
- package/dist/destinations/mixpanel/trackPurchase/index.d.ts +5 -0
- package/dist/destinations/mixpanel/trackPurchase/index.js +80 -0
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -0
- package/dist/destinations/salesforce/customObject/index.js +8 -1
- package/dist/destinations/salesforce/customObject/index.js.map +1 -1
- package/dist/destinations/salesforce/lead/index.js +1 -2
- package/dist/destinations/salesforce/lead/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-operations.d.ts +2 -0
- package/dist/destinations/salesforce/sf-operations.js +28 -0
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/sendgrid/index.js +8 -0
- package/dist/destinations/sendgrid/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendgrid-properties.d.ts +8 -5
- package/dist/destinations/sendgrid/sendgrid-properties.js +37 -3
- package/dist/destinations/sendgrid/sendgrid-properties.js.map +1 -1
- package/dist/destinations/sendgrid/updateUserProfile/index.js +6 -10
- package/dist/destinations/sendgrid/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/generated-types.d.ts +1 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +15 -2
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
- package/dist/destinations/twilio/sendSms/generated-types.d.ts +1 -0
- package/dist/destinations/twilio/sendSms/index.js +6 -0
- package/dist/destinations/twilio/sendSms/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amplitude/emptyObject.d.ts +0 -2
- package/dist/destinations/amplitude/emptyObject.js +0 -7
- package/dist/destinations/amplitude/emptyObject.js.map +0 -1
- package/dist/destinations/google-enhanced-conversions/constants.d.ts +0 -1
- package/dist/destinations/google-enhanced-conversions/constants.js +0 -185
- package/dist/destinations/google-enhanced-conversions/constants.js.map +0 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.d.ts +0 -5
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.js.map +0 -1
- package/dist/destinations/mixpanel/trackEvent/types.d.ts +0 -51
- package/dist/destinations/mixpanel/trackEvent/types.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js +0 -11
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/generated-types.js.map +0 -1
- package/dist/destinations/salesforce-marketing-cloud/index.js +0 -27
- package/dist/destinations/salesforce-marketing-cloud/index.js.map +0 -1
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
4
|
const functions_1 = require("../functions");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const action = {
|
|
6
7
|
title: 'Upload Conversion Adjustment',
|
|
7
8
|
description: 'Upload a conversion adjustment to the Google Ads API.',
|
|
8
9
|
fields: {
|
|
9
10
|
conversion_action: {
|
|
10
11
|
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=
|
|
12
|
-
type: '
|
|
13
|
-
required: true
|
|
14
|
-
default: ''
|
|
12
|
+
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`.',
|
|
13
|
+
type: 'number',
|
|
14
|
+
required: true
|
|
15
15
|
},
|
|
16
16
|
adjustment_type: {
|
|
17
17
|
label: 'Adjustment Type',
|
|
18
|
-
description: 'The adjustment type. See Google’s documentation for details on each type.',
|
|
18
|
+
description: 'The adjustment type. See [Google’s documentation](https://developers.google.com/google-ads/api/reference/rpc/v11/ConversionAdjustmentTypeEnum.ConversionAdjustmentType) for details on each type.',
|
|
19
19
|
type: 'string',
|
|
20
20
|
choices: [
|
|
21
21
|
{ label: 'UNSPECIFIED', value: 'UNSPECIFIED' },
|
|
@@ -28,7 +28,7 @@ const action = {
|
|
|
28
28
|
},
|
|
29
29
|
adjustment_timestamp: {
|
|
30
30
|
label: 'Adjustment Timestamp',
|
|
31
|
-
description: 'The date time at which the adjustment occurred. Must be after the
|
|
31
|
+
description: 'The date time at which the adjustment occurred. Must be after the conversion timestamp. 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".',
|
|
32
32
|
type: 'string',
|
|
33
33
|
required: true,
|
|
34
34
|
default: {
|
|
@@ -40,32 +40,32 @@ const action = {
|
|
|
40
40
|
description: 'The order ID of the conversion to be adjusted. If the conversion was reported with an order ID specified, that order ID must be used as the identifier here. Required for ENHANCEMENT adjustments.',
|
|
41
41
|
type: 'string',
|
|
42
42
|
default: {
|
|
43
|
-
'@
|
|
43
|
+
'@if': {
|
|
44
|
+
exists: { '@path': '$.properties.orderId' },
|
|
45
|
+
then: { '@path': '$.properties.orderId' },
|
|
46
|
+
else: { '@path': '$.properties.order_id' }
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
},
|
|
46
50
|
gclid: {
|
|
47
51
|
label: 'GCLID',
|
|
48
52
|
description: 'Google click ID associated with the original conversion for this adjustment. This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
49
|
-
type: 'string'
|
|
50
|
-
default: ''
|
|
53
|
+
type: 'string'
|
|
51
54
|
},
|
|
52
55
|
conversion_timestamp: {
|
|
53
56
|
label: 'Conversion Timestamp',
|
|
54
57
|
description: 'The date time at which the original conversion for this adjustment 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". This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
55
|
-
type: 'string'
|
|
56
|
-
default: ''
|
|
58
|
+
type: 'string'
|
|
57
59
|
},
|
|
58
60
|
restatement_value: {
|
|
59
61
|
label: 'Restatement Value',
|
|
60
62
|
description: 'The restated conversion value. This is the value of the conversion after restatement. For example, to change the value of a conversion from 100 to 70, an adjusted value of 70 should be reported. Required for RESTATEMENT adjustments.',
|
|
61
|
-
type: 'number'
|
|
62
|
-
default: ''
|
|
63
|
+
type: 'number'
|
|
63
64
|
},
|
|
64
65
|
restatement_currency_code: {
|
|
65
66
|
label: 'Restatement Currency Code',
|
|
66
|
-
description: 'The currency of the restated value. If not provided, then the default currency from the conversion action is used, and if that is not set then the account currency is used. This is the ISO 4217 3-character currency code e.g. USD or EUR.',
|
|
67
|
-
type: 'string'
|
|
68
|
-
default: ''
|
|
67
|
+
description: 'The currency of the restated value. If not provided, then the default currency from the conversion action is used, and if that is not set then the account currency is used. This is the ISO 4217 3-character currency code, e.g. USD or EUR.',
|
|
68
|
+
type: 'string'
|
|
69
69
|
},
|
|
70
70
|
email_address: {
|
|
71
71
|
label: 'Email Address',
|
|
@@ -76,7 +76,7 @@ const action = {
|
|
|
76
76
|
'@if': {
|
|
77
77
|
exists: { '@path': '$.properties.email' },
|
|
78
78
|
then: { '@path': '$.properties.email' },
|
|
79
|
-
else: { '@path': '
|
|
79
|
+
else: { '@path': '$.context.traits.email' }
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
},
|
|
@@ -88,7 +88,7 @@ const action = {
|
|
|
88
88
|
'@if': {
|
|
89
89
|
exists: { '@path': '$.properties.phone' },
|
|
90
90
|
then: { '@path': '$.properties.phone' },
|
|
91
|
-
else: { '@path': '
|
|
91
|
+
else: { '@path': '$.context.traits.phone' }
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -100,7 +100,7 @@ const action = {
|
|
|
100
100
|
'@if': {
|
|
101
101
|
exists: { '@path': '$.properties.firstName' },
|
|
102
102
|
then: { '@path': '$.properties.firstName' },
|
|
103
|
-
else: { '@path': '
|
|
103
|
+
else: { '@path': '$.context.traits.firstName' }
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
},
|
|
@@ -112,7 +112,7 @@ const action = {
|
|
|
112
112
|
'@if': {
|
|
113
113
|
exists: { '@path': '$.properties.lastName' },
|
|
114
114
|
then: { '@path': '$.properties.lastName' },
|
|
115
|
-
else: { '@path': '
|
|
115
|
+
else: { '@path': '$.context.traits.lastName' }
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
},
|
|
@@ -187,22 +187,44 @@ const action = {
|
|
|
187
187
|
},
|
|
188
188
|
perform: async (request, { settings, payload }) => {
|
|
189
189
|
if (!settings.customerId) {
|
|
190
|
-
throw new actions_core_1.IntegrationError('Customer
|
|
190
|
+
throw new actions_core_1.IntegrationError('Customer ID is required for this action. Please set it in destination settings.', 'Missing required fields.', 400);
|
|
191
191
|
}
|
|
192
|
-
settings.customerId = settings.customerId.replace(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
192
|
+
settings.customerId = settings.customerId.replace(/-/g, '');
|
|
193
|
+
const validations = {
|
|
194
|
+
ENHANCEMENT: {
|
|
195
|
+
validation: (payload) => !payload.order_id,
|
|
196
|
+
error: {
|
|
197
|
+
message: 'Order ID required for enhancements'
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
RESTATEMENT: {
|
|
201
|
+
validation: (payload) => !payload.restatement_value,
|
|
202
|
+
error: {
|
|
203
|
+
message: 'Restatement value required for restatements'
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
RETRACTION: {
|
|
207
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
208
|
+
error: {
|
|
209
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
UNKNOWN: {
|
|
213
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
214
|
+
error: {
|
|
215
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
UNSPECIFIED: {
|
|
219
|
+
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
220
|
+
error: {
|
|
221
|
+
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
222
|
+
}
|
|
205
223
|
}
|
|
224
|
+
};
|
|
225
|
+
const key = payload.adjustment_type;
|
|
226
|
+
if (validations[key].validation(payload)) {
|
|
227
|
+
throw new actions_core_1.IntegrationError(validations[key].error.message, 'INVALID_ARGUMENT', 400);
|
|
206
228
|
}
|
|
207
229
|
const request_object = {
|
|
208
230
|
conversionAction: `customers/${settings.customerId}/conversionActions/${payload.conversion_action}`,
|
|
@@ -211,7 +233,7 @@ const action = {
|
|
|
211
233
|
orderId: payload.order_id,
|
|
212
234
|
gclidDateTimePair: {
|
|
213
235
|
gclid: payload.gclid,
|
|
214
|
-
conversionDateTime: payload.conversion_timestamp
|
|
236
|
+
conversionDateTime: payload.conversion_timestamp?.replace(/T/, ' ').replace(/\..+/, '+00:00')
|
|
215
237
|
},
|
|
216
238
|
restatementValue: {
|
|
217
239
|
adjustedValue: payload.restatement_value,
|
|
@@ -226,13 +248,14 @@ const action = {
|
|
|
226
248
|
if (payload.phone_number) {
|
|
227
249
|
request_object.userIdentifiers.push({ hashedPhoneNumber: functions_1.hash(payload.phone_number) });
|
|
228
250
|
}
|
|
229
|
-
|
|
251
|
+
const containsAddressInfo = payload.first_name ||
|
|
230
252
|
payload.last_name ||
|
|
231
253
|
payload.city ||
|
|
232
254
|
payload.state ||
|
|
233
255
|
payload.country ||
|
|
234
256
|
payload.postal_code ||
|
|
235
|
-
payload.street_address
|
|
257
|
+
payload.street_address;
|
|
258
|
+
if (containsAddressInfo) {
|
|
236
259
|
request_object.userIdentifiers.push({
|
|
237
260
|
addressInfo: {
|
|
238
261
|
hashedFirstName: functions_1.hash(payload.first_name),
|
|
@@ -245,7 +268,7 @@ const action = {
|
|
|
245
268
|
}
|
|
246
269
|
});
|
|
247
270
|
}
|
|
248
|
-
const response = await request(
|
|
271
|
+
const response = await request(`${types_1.GoogleAdsAPI}/${settings.customerId}:uploadConversionAdjustments`, {
|
|
249
272
|
method: 'post',
|
|
250
273
|
headers: {
|
|
251
274
|
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
|
|
@@ -255,13 +278,7 @@ const action = {
|
|
|
255
278
|
partialFailure: true
|
|
256
279
|
}
|
|
257
280
|
});
|
|
258
|
-
|
|
259
|
-
Object.entries(response.data).forEach(([key, value]) => {
|
|
260
|
-
if (key === 'partialFailureError' && value.code !== 0) {
|
|
261
|
-
throw new actions_core_1.IntegrationError(value.message, 'INVALID_ARGUMENT', 400);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
281
|
+
functions_1.handleGoogleErrors(response);
|
|
265
282
|
return response;
|
|
266
283
|
}
|
|
267
284
|
};
|
package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,4CAAuD;AAGvD,oCAA6D;AAG7D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,uDAAuD;IACpE,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,sUAAsU;YACxU,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mMAAmM;YACrM,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;gBAC9C,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACtC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;gBAC5C,EAAE,KAAK,EAAE,a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0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/generated-types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
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 sendCustomBehavioralEvent_1 = __importDefault(require("./sendCustomBehavioralEvent"));
|
|
7
|
+
const upsertContact_1 = __importDefault(require("./upsertContact"));
|
|
8
|
+
const upsertCustomObjectRecord_1 = __importDefault(require("./upsertCustomObjectRecord"));
|
|
9
|
+
const properties_1 = require("./properties");
|
|
10
|
+
const destination = {
|
|
11
|
+
name: 'Hubspot Cloud Mode (Actions)',
|
|
12
|
+
slug: 'actions-hubspot-cloud',
|
|
13
|
+
mode: 'cloud',
|
|
14
|
+
authentication: {
|
|
15
|
+
scheme: 'oauth2',
|
|
16
|
+
fields: {},
|
|
17
|
+
testAuthentication: (request) => {
|
|
18
|
+
return request(`${properties_1.hubSpotBaseURL}/crm/v3/objects/contacts?limit=1`);
|
|
19
|
+
},
|
|
20
|
+
refreshAccessToken: async (request, { auth }) => {
|
|
21
|
+
const res = await request(`${properties_1.hubSpotBaseURL}/oauth/v1/token`, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: new URLSearchParams({
|
|
24
|
+
refresh_token: auth.refreshToken,
|
|
25
|
+
client_id: auth.clientId,
|
|
26
|
+
client_secret: auth.clientSecret,
|
|
27
|
+
grant_type: 'refresh_token'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
return { accessToken: res.data?.access_token };
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
extendRequest({ auth }) {
|
|
34
|
+
return {
|
|
35
|
+
headers: {
|
|
36
|
+
authorization: `Bearer ${auth?.accessToken}`
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
actions: {
|
|
41
|
+
sendCustomBehavioralEvent: sendCustomBehavioralEvent_1.default,
|
|
42
|
+
upsertContact: upsertContact_1.default,
|
|
43
|
+
upsertCustomObjectRecord: upsertCustomObjectRecord_1.default
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.default = destination;
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/index.ts"],"names":[],"mappings":";;;;;AAGA,4FAAmE;AACnE,oEAA2C;AAC3C,0FAAiE;AACjE,6CAA6C;AAK7C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAE9B,OAAO,OAAO,CAAC,GAAG,2BAAc,kCAAkC,CAAC,CAAA;QACrE,CAAC;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAE9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,GAAG,2BAAc,iBAAiB,EAAE;gBAClF,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,CAAA;QAChD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,yBAAyB,EAAzB,mCAAyB;QACzB,aAAa,EAAb,uBAAa;QACb,wBAAwB,EAAxB,kCAAwB;KACzB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hubSpotBaseURL = "https://api.hubapi.com";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/properties.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,wBAAwB,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/sendCustomBehavioralEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const properties_1 = require("../properties");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Send Custom Behavioral Event',
|
|
6
|
+
description: 'Send a custom behavioral event to HubSpot.',
|
|
7
|
+
defaultSubscription: 'type = "track"',
|
|
8
|
+
fields: {
|
|
9
|
+
eventName: {
|
|
10
|
+
label: 'Event Name',
|
|
11
|
+
description: 'The internal event name assigned by HubSpot. This can be found in your HubSpot account. Events must be predefined in HubSpot. Learn how to find the internal name in [HubSpot’s documentation](https://knowledge.hubspot.com/analytics-tools/create-custom-behavioral-events).',
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
occurredAt: {
|
|
16
|
+
label: 'Event Timestamp',
|
|
17
|
+
description: "The time when this event occurred. If this isn't set, the current time will be used.",
|
|
18
|
+
type: 'datetime',
|
|
19
|
+
default: {
|
|
20
|
+
'@path': '$.timestamp'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
email: {
|
|
24
|
+
label: 'Email Address',
|
|
25
|
+
description: 'The email of the contact associated with this event. This is required if no user token or object ID is provided.',
|
|
26
|
+
type: 'string',
|
|
27
|
+
format: 'email',
|
|
28
|
+
default: {
|
|
29
|
+
'@if': {
|
|
30
|
+
exists: { '@path': '$.properties.email' },
|
|
31
|
+
then: { '@path': '$.properties.email' },
|
|
32
|
+
else: { '@path': '$.context.traits.email' }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
utk: {
|
|
37
|
+
label: 'User Token',
|
|
38
|
+
description: 'The user token (utk) of the contact associated with this event. This is required if no email or object ID is provided.',
|
|
39
|
+
type: 'string'
|
|
40
|
+
},
|
|
41
|
+
objectId: {
|
|
42
|
+
label: 'Object ID',
|
|
43
|
+
description: 'The ID of the object associated with this event. This can be the HubSpot contact ID, company ID, or ID of any other object. This is required if no email or user token is provided.',
|
|
44
|
+
type: 'string'
|
|
45
|
+
},
|
|
46
|
+
properties: {
|
|
47
|
+
label: 'Event Properties',
|
|
48
|
+
description: 'Default or custom properties that describe the event. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/analytics-tools/create-custom-behavioral-events#add-and-manage-event-properties).',
|
|
49
|
+
type: 'object',
|
|
50
|
+
defaultObjectUI: 'keyvalue:only'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
perform: (request, { payload }) => {
|
|
54
|
+
const event = {
|
|
55
|
+
eventName: payload.eventName,
|
|
56
|
+
occurredAt: payload.occurredAt,
|
|
57
|
+
utk: payload.utk,
|
|
58
|
+
email: payload.email,
|
|
59
|
+
objectId: payload.objectId,
|
|
60
|
+
properties: payload.properties
|
|
61
|
+
};
|
|
62
|
+
return request(`${properties_1.hubSpotBaseURL}/events/v3/send`, {
|
|
63
|
+
method: 'post',
|
|
64
|
+
json: event
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.default = action;
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/sendCustomBehavioralEvent/index.ts"],"names":[],"mappings":";;AAEA,8CAA8C;AAY9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,gRAAgR;YAClR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,sFAAsF;YACnG,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,kHAAkH;YACpH,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,GAAG,EAAE;YACH,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,qLAAqL;YACvL,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,yNAAyN;YAC3N,IAAI,EAAE,QAAQ;YACd,eAAe,EAAE,eAAe;SACjC;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,KAAK,GAA0B;YACnC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAA;QACD,OAAO,OAAO,CAAC,GAAG,2BAAc,iBAAiB,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateValidHubSpotCustomObjectName = void 0;
|
|
4
|
+
const generateHash = (seed) => {
|
|
5
|
+
let i, chr, hash;
|
|
6
|
+
hash = 0;
|
|
7
|
+
if (seed.length === 0)
|
|
8
|
+
return hash;
|
|
9
|
+
for (i = 0; i < seed.length; i++) {
|
|
10
|
+
chr = seed.charCodeAt(i);
|
|
11
|
+
hash = (hash << 5) - hash + chr;
|
|
12
|
+
hash |= 0;
|
|
13
|
+
}
|
|
14
|
+
return Math.abs(hash);
|
|
15
|
+
};
|
|
16
|
+
const generateValidHubSpotCustomObjectName = (seed) => {
|
|
17
|
+
const hash = generateHash(seed);
|
|
18
|
+
return {
|
|
19
|
+
objectType: `p${hash}_Obj${hash}`,
|
|
20
|
+
properties: { testProperty: `testValue-${hash}` }
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
exports.generateValidHubSpotCustomObjectName = generateValidHubSpotCustomObjectName;
|
|
24
|
+
//# sourceMappingURL=testHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testHelper.js","sourceRoot":"","sources":["../../../src/destinations/hubspot/testHelper.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAA;IAChB,IAAI,GAAG,CAAC,CAAA;IAER,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChC,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;QAC/B,IAAI,IAAI,CAAC,CAAA;KACV;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO;QACL,UAAU,EAAE,IAAI,IAAI,OAAO,IAAI,EAAE;QACjC,UAAU,EAAE,EAAE,YAAY,EAAE,aAAa,IAAI,EAAE,EAAE;KAClD,CAAA;AACH,CAAC,CAAA;AACQ,oFAAoC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
email: string;
|
|
3
|
+
company?: string;
|
|
4
|
+
firstname?: string;
|
|
5
|
+
lastname?: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
address?: string;
|
|
8
|
+
city?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
country?: string;
|
|
11
|
+
zip?: string;
|
|
12
|
+
website?: string;
|
|
13
|
+
lifecyclestage?: string;
|
|
14
|
+
properties?: {
|
|
15
|
+
[k: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertContact/generated-types.ts"],"names":[],"mappings":""}
|