@segment/action-destinations 3.220.0 → 3.221.0-staging.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/airship/utilities.js +2 -2
- package/dist/destinations/airship/utilities.js.map +1 -1
- package/dist/destinations/braze/updateUserProfile/index.js +1 -6
- package/dist/destinations/braze/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +1 -0
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
- package/dist/destinations/index.js +2 -1
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/{liveramp-audiences/audienceEnteredSFTP.types.js → klaviyo/addProfileToList/generated-types.js} +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +53 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/config.d.ts +1 -0
- package/dist/destinations/klaviyo/config.js +5 -0
- package/dist/destinations/klaviyo/config.js.map +1 -0
- package/dist/destinations/klaviyo/functions.d.ts +2 -0
- package/dist/destinations/klaviyo/functions.js +35 -0
- package/dist/destinations/klaviyo/functions.js.map +1 -0
- package/dist/destinations/klaviyo/index.js +9 -5
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +22 -0
- package/dist/destinations/klaviyo/orderCompleted/generated-types.js +3 -0
- package/dist/destinations/klaviyo/orderCompleted/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/orderCompleted/index.d.ts +5 -0
- package/dist/destinations/klaviyo/orderCompleted/index.js +152 -0
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js +53 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.d.ts +16 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.js +3 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/trackEvent/index.d.ts +5 -0
- package/dist/destinations/klaviyo/trackEvent/index.js +118 -0
- package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -0
- package/dist/destinations/klaviyo/types.d.ts +69 -0
- package/dist/destinations/klaviyo/types.js +8 -0
- package/dist/destinations/klaviyo/types.js.map +1 -0
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +21 -1
- package/dist/destinations/klaviyo/upsertProfile/index.js +150 -5
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/functions.js +1 -7
- package/dist/destinations/the-trade-desk-crm/functions.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/index.js +1 -1
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +1 -1
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/generated-types.d.ts +2 -2
- package/dist/destinations/yahoo-audiences/index.js +22 -32
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +5 -4
- package/dist/destinations/yahoo-audiences/updateSegment/index.d.ts +2 -2
- package/dist/destinations/yahoo-audiences/updateSegment/index.js +59 -54
- package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.d.ts +3 -3
- package/dist/destinations/yahoo-audiences/utils-rt.js +20 -28
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-tax.js +11 -22
- package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/utils.js +30 -0
- package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.d.ts +0 -16
- package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js.map +0 -1
|
@@ -8,7 +8,7 @@ const syncAudience_1 = __importDefault(require("./syncAudience"));
|
|
|
8
8
|
const API_VERSION = 'v3';
|
|
9
9
|
const BASE_URL = `https://api.thetradedesk.com/${API_VERSION}`;
|
|
10
10
|
const destination = {
|
|
11
|
-
name: 'The Trade Desk
|
|
11
|
+
name: 'The Trade Desk Crm',
|
|
12
12
|
slug: 'actions-the-trade-desk-crm',
|
|
13
13
|
mode: 'cloud',
|
|
14
14
|
authentication: {
|
|
@@ -5,7 +5,7 @@ const utils_tax_2 = require("../utils-tax");
|
|
|
5
5
|
const action = {
|
|
6
6
|
title: 'Create top-level CUSTOMER node in Yahoo taxonomy',
|
|
7
7
|
defaultSubscription: 'event = "Audience Entered" and event = "Audience Exited"',
|
|
8
|
-
description: '
|
|
8
|
+
description: '',
|
|
9
9
|
fields: {
|
|
10
10
|
engage_space_id: {
|
|
11
11
|
label: 'Engage Space Id',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/index.ts"],"names":[],"mappings":";;AAGA,4CAA4D;AAC5D,4CAA8C;AAE9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kDAAkD;IACzD,mBAAmB,EAAE,0DAA0D;IAC/E,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/createCustomerNode/index.ts"],"names":[],"mappings":";;AAGA,4CAA4D;AAC5D,4CAA8C;AAE9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kDAAkD;IACzD,mBAAmB,EAAE,0DAA0D;IAC/E,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,mJAAmJ;YACrJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,uGAAuG;YACzG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,QAAQ,CAAC,mBAAmB;YAC3C,gBAAgB,EAAE,QAAQ,CAAC,sBAAsB;SAClD,CAAA;QACD,MAAM,gBAAgB,GAAG,yCAA6B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACzE,OAAO,MAAM,2BAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -13,7 +13,6 @@ const destination = {
|
|
|
13
13
|
name: 'Yahoo Audiences',
|
|
14
14
|
slug: 'actions-yahoo-audiences',
|
|
15
15
|
mode: 'cloud',
|
|
16
|
-
description: 'Sync Segment Engage Audiences to Yahoo Ads',
|
|
17
16
|
authentication: {
|
|
18
17
|
scheme: 'oauth2',
|
|
19
18
|
fields: {
|
|
@@ -32,32 +31,32 @@ const destination = {
|
|
|
32
31
|
taxonomy_client_secret: {
|
|
33
32
|
label: 'Yahoo Taxonomy API client secret',
|
|
34
33
|
description: 'Taxonomy API client secret. Required to update Yahoo taxonomy',
|
|
35
|
-
type: '
|
|
34
|
+
type: 'string',
|
|
36
35
|
required: true
|
|
37
36
|
},
|
|
38
37
|
engage_space_id: {
|
|
39
38
|
label: 'Engage Space Id',
|
|
40
|
-
description: 'Engage Space Id found in Unify > Settings > API Access',
|
|
39
|
+
description: 'Required to create customer and segment nodes in Taxonomy. Provide Engage Space Id found in Unify > Settings > API Access. This maps to the "Id" and "Name" of the top-level Customer node in Yahoo taxonomy',
|
|
41
40
|
type: 'string',
|
|
42
41
|
required: true
|
|
43
42
|
},
|
|
44
43
|
customer_desc: {
|
|
45
44
|
label: 'Customer Description',
|
|
46
|
-
description: '
|
|
45
|
+
description: 'Required to create customer node in Taxonomy. Provide a description for the Customer node in Yahoo taxonomy. This must be less then 1000 characters',
|
|
47
46
|
type: 'string',
|
|
48
47
|
required: false
|
|
49
48
|
}
|
|
50
49
|
},
|
|
51
|
-
testAuthentication: async (request,
|
|
50
|
+
testAuthentication: async (request, input) => {
|
|
52
51
|
const tx_creds = {
|
|
53
|
-
tx_client_key: settings.taxonomy_client_key,
|
|
54
|
-
tx_client_secret: settings.taxonomy_client_secret
|
|
52
|
+
tx_client_key: input.settings.taxonomy_client_key,
|
|
53
|
+
tx_client_secret: input.settings.taxonomy_client_secret
|
|
55
54
|
};
|
|
56
55
|
const data = {
|
|
57
|
-
engage_space_id: settings.engage_space_id,
|
|
58
|
-
customer_desc: settings.customer_desc
|
|
56
|
+
engage_space_id: input.settings.engage_space_id,
|
|
57
|
+
customer_desc: input.settings.customer_desc
|
|
59
58
|
};
|
|
60
|
-
const body_form_data = utils_tax_1.gen_customer_taxonomy_payload(settings, data);
|
|
59
|
+
const body_form_data = utils_tax_1.gen_customer_taxonomy_payload(input.settings, data);
|
|
61
60
|
await utils_tax_1.update_taxonomy('', tx_creds, request, body_form_data);
|
|
62
61
|
},
|
|
63
62
|
refreshAccessToken: async (request, { auth }) => {
|
|
@@ -81,27 +80,20 @@ const destination = {
|
|
|
81
80
|
audienceFields: {
|
|
82
81
|
audience_id: {
|
|
83
82
|
type: 'string',
|
|
84
|
-
label: '
|
|
85
|
-
description: '
|
|
86
|
-
required: true
|
|
83
|
+
label: 'Advertiser ID',
|
|
84
|
+
description: 'The advertiser ID to use when syncing audiences. Required if you wish to create or update an audience.'
|
|
87
85
|
},
|
|
88
86
|
audience_key: {
|
|
89
|
-
label: '
|
|
90
|
-
description: '
|
|
87
|
+
label: 'An audience id required by the destination',
|
|
88
|
+
description: 'An audience id required by the destination',
|
|
91
89
|
type: 'string',
|
|
92
90
|
required: true
|
|
93
91
|
},
|
|
94
|
-
|
|
95
|
-
label: '
|
|
96
|
-
description: '
|
|
92
|
+
engage_space_id: {
|
|
93
|
+
label: 'Engage Space Id',
|
|
94
|
+
description: 'Engage Space Id',
|
|
97
95
|
type: 'string',
|
|
98
|
-
required: true
|
|
99
|
-
default: 'email',
|
|
100
|
-
choices: [
|
|
101
|
-
{ value: 'email', label: 'Send email' },
|
|
102
|
-
{ value: 'maid', label: 'Send MAID' },
|
|
103
|
-
{ value: 'email_maid', label: 'Send email and/or MAID' }
|
|
104
|
-
]
|
|
96
|
+
required: true
|
|
105
97
|
}
|
|
106
98
|
},
|
|
107
99
|
audienceConfig: {
|
|
@@ -112,22 +104,20 @@ const destination = {
|
|
|
112
104
|
async createAudience(request, createAudienceInput) {
|
|
113
105
|
const audience_id = createAudienceInput.audienceSettings?.audience_id;
|
|
114
106
|
const audience_key = createAudienceInput.audienceSettings?.audience_key;
|
|
115
|
-
const engage_space_id = createAudienceInput.
|
|
116
|
-
const identifier = createAudienceInput.audienceSettings?.identifier;
|
|
107
|
+
const engage_space_id = createAudienceInput.audienceSettings?.engage_space_id;
|
|
117
108
|
if (!audience_id) {
|
|
118
|
-
throw new actions_core_1.IntegrationError('
|
|
109
|
+
throw new actions_core_1.IntegrationError('Missing audience Id value', 'MISSING_REQUIRED_FIELD', 400);
|
|
119
110
|
}
|
|
120
111
|
if (!audience_key) {
|
|
121
|
-
throw new actions_core_1.IntegrationError('
|
|
112
|
+
throw new actions_core_1.IntegrationError('Missing audience key value', 'MISSING_REQUIRED_FIELD', 400);
|
|
122
113
|
}
|
|
123
114
|
if (!engage_space_id) {
|
|
124
|
-
throw new actions_core_1.IntegrationError('
|
|
115
|
+
throw new actions_core_1.IntegrationError('Missing Engage space Id type value', 'MISSING_REQUIRED_FIELD', 400);
|
|
125
116
|
}
|
|
126
117
|
const input = {
|
|
127
118
|
segment_audience_id: audience_id,
|
|
128
119
|
segment_audience_key: audience_key,
|
|
129
|
-
engage_space_id: engage_space_id
|
|
130
|
-
identifier: identifier
|
|
120
|
+
engage_space_id: engage_space_id
|
|
131
121
|
};
|
|
132
122
|
const body_form_data = utils_tax_1.gen_segment_subtaxonomy_payload(input);
|
|
133
123
|
const tx_creds = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAExD,yCAAyC;AACzC,oEAA2C;AAC3C,oEAA2C;AAC3C,8EAAqD;AACrD,2CAA6G;AAM7G,MAAM,WAAW,GAA8D;IAC7E,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,OAAO;IACb,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAwD;AAExD,yCAAyC;AACzC,oEAA2C;AAC3C,oEAA2C;AAC3C,8EAAqD;AACrD,2CAA6G;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AAgB,EAAE,WAAW,CAAA;YAClE,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,IAAI,+BAAgB,CAAC,2BAA2B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;aACvF;YACD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;QACpC,CAAC;KACF;IAED,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,aAAa,EAAb,uBAAa;QACb,kBAAkB,EAAlB,4BAAkB;KACnB;CACF,CAAA;AACD,kBAAe,WAAW,CAAA"}
|
|
@@ -5,12 +5,13 @@ export interface Payload {
|
|
|
5
5
|
[k: string]: unknown;
|
|
6
6
|
};
|
|
7
7
|
segment_computation_action: string;
|
|
8
|
-
enable_batching?: boolean;
|
|
8
|
+
enable_batching?: boolean & string;
|
|
9
9
|
batch_size?: number;
|
|
10
10
|
email?: string;
|
|
11
|
-
advertising_id
|
|
12
|
-
device_type
|
|
13
|
-
|
|
11
|
+
advertising_id: string;
|
|
12
|
+
device_type: string;
|
|
13
|
+
send_advertising_id: boolean;
|
|
14
|
+
send_email: boolean;
|
|
14
15
|
gdpr_flag: boolean;
|
|
15
16
|
gdpr_euconsent?: string;
|
|
16
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
|
-
import type { Settings
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
|
-
declare const action: ActionDefinition<Settings, Payload
|
|
4
|
+
declare const action: ActionDefinition<Settings, Payload>;
|
|
5
5
|
export default action;
|
|
@@ -5,7 +5,7 @@ const utils_rt_1 = require("../utils-rt");
|
|
|
5
5
|
const action = {
|
|
6
6
|
title: 'Sync To Yahoo Ads Segment',
|
|
7
7
|
description: 'Sync Segment Audience to Yahoo Ads Segment',
|
|
8
|
-
defaultSubscription: 'type = "identify"',
|
|
8
|
+
defaultSubscription: 'type = "identify" or type = "track"',
|
|
9
9
|
fields: {
|
|
10
10
|
segment_audience_id: {
|
|
11
11
|
label: 'Segment Audience Id',
|
|
@@ -52,59 +52,60 @@ const action = {
|
|
|
52
52
|
enable_batching: {
|
|
53
53
|
label: 'Enable Batching',
|
|
54
54
|
description: 'Enable batching of requests',
|
|
55
|
-
type: '
|
|
56
|
-
default: true
|
|
57
|
-
unsafe_hidden: true
|
|
55
|
+
type: 'hidden',
|
|
56
|
+
default: true
|
|
58
57
|
},
|
|
59
58
|
batch_size: {
|
|
60
59
|
label: 'Batch Size',
|
|
61
60
|
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
62
61
|
type: 'number',
|
|
63
62
|
unsafe_hidden: true,
|
|
63
|
+
required: false,
|
|
64
64
|
default: 1000
|
|
65
65
|
},
|
|
66
66
|
email: {
|
|
67
67
|
label: 'User Email',
|
|
68
68
|
description: 'Email address of a user',
|
|
69
69
|
type: 'hidden',
|
|
70
|
-
required: false,
|
|
71
70
|
default: {
|
|
72
71
|
'@if': {
|
|
73
|
-
exists: { '@path': '$.traits.email' },
|
|
74
|
-
then: { '@path': '$.traits.email' },
|
|
75
|
-
else: { '@path': '$.
|
|
72
|
+
exists: { '@path': '$.context.traits.email' },
|
|
73
|
+
then: { '@path': '$.context.traits.email' },
|
|
74
|
+
else: { '@path': '$.traits.email' }
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
78
|
advertising_id: {
|
|
80
79
|
label: 'User Mobile Advertising ID',
|
|
81
|
-
description: "User's
|
|
80
|
+
description: "User's Mobile Advertising Id",
|
|
82
81
|
type: 'hidden',
|
|
83
82
|
default: {
|
|
84
83
|
'@path': '$.context.device.advertisingId'
|
|
85
84
|
},
|
|
86
|
-
required:
|
|
85
|
+
required: true
|
|
87
86
|
},
|
|
88
87
|
device_type: {
|
|
89
88
|
label: 'User Mobile Device Type',
|
|
90
|
-
description: "
|
|
89
|
+
description: "The user's mobile device type",
|
|
91
90
|
type: 'hidden',
|
|
92
91
|
default: {
|
|
93
92
|
'@path': '$.context.device.type'
|
|
94
93
|
},
|
|
95
|
-
required:
|
|
94
|
+
required: true
|
|
96
95
|
},
|
|
97
|
-
|
|
98
|
-
label: '
|
|
99
|
-
description: '
|
|
100
|
-
type: '
|
|
96
|
+
send_advertising_id: {
|
|
97
|
+
label: 'Send Mobile Advertising ID',
|
|
98
|
+
description: 'Send mobile advertising ID (IDFA or Google Ad Id) to Yahoo. Segment will hash MAIDs',
|
|
99
|
+
type: 'boolean',
|
|
101
100
|
required: true,
|
|
102
|
-
default:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
send_email: {
|
|
104
|
+
label: 'Send User Email',
|
|
105
|
+
description: 'Send user email to Yahoo. Segment will hash emails',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
required: true,
|
|
108
|
+
default: true
|
|
108
109
|
},
|
|
109
110
|
gdpr_flag: {
|
|
110
111
|
label: 'GDPR Flag',
|
|
@@ -120,43 +121,47 @@ const action = {
|
|
|
120
121
|
required: false
|
|
121
122
|
}
|
|
122
123
|
},
|
|
123
|
-
perform: (request, { payload, auth
|
|
124
|
+
perform: (request, { payload, auth }) => {
|
|
124
125
|
const rt_access_token = auth?.accessToken;
|
|
125
|
-
if (
|
|
126
|
-
throw new actions_core_1.IntegrationError('
|
|
127
|
-
}
|
|
128
|
-
const body = utils_rt_1.gen_update_segment_payload([payload], audienceSettings);
|
|
129
|
-
if (body.data.length > 0) {
|
|
130
|
-
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
131
|
-
method: 'POST',
|
|
132
|
-
json: body,
|
|
133
|
-
headers: {
|
|
134
|
-
Authorization: `Bearer ${rt_access_token}`
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
throw new actions_core_1.PayloadValidationError('Email and / or Advertising Id not available in the profile(s)');
|
|
126
|
+
if (rt_access_token) {
|
|
127
|
+
throw new actions_core_1.IntegrationError('Missing authentication token', 'MISSING_REQUIRED_FIELD', 400);
|
|
140
128
|
}
|
|
129
|
+
const body = utils_rt_1.gen_update_segment_payload([payload]);
|
|
130
|
+
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
json: body,
|
|
133
|
+
headers: {
|
|
134
|
+
Authorization: `Bearer ${auth?.accessToken}`
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
.then((response) => response.json())
|
|
138
|
+
.then((response) => {
|
|
139
|
+
return response;
|
|
140
|
+
})
|
|
141
|
+
.catch((err) => {
|
|
142
|
+
console.log('perform: error updating segment >', err);
|
|
143
|
+
});
|
|
141
144
|
},
|
|
142
|
-
performBatch: (request, { payload,
|
|
145
|
+
performBatch: (request, { payload, auth }) => {
|
|
143
146
|
const rt_access_token = auth?.accessToken;
|
|
144
|
-
if (!
|
|
145
|
-
throw new actions_core_1.IntegrationError('
|
|
146
|
-
}
|
|
147
|
-
const body = utils_rt_1.gen_update_segment_payload(payload, audienceSettings);
|
|
148
|
-
if (body.data.length > 0) {
|
|
149
|
-
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
150
|
-
method: 'POST',
|
|
151
|
-
json: body,
|
|
152
|
-
headers: {
|
|
153
|
-
Authorization: `Bearer ${rt_access_token}`
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
throw new actions_core_1.PayloadValidationError('Email and / or Advertising Id not available in the profile(s)');
|
|
147
|
+
if (!rt_access_token) {
|
|
148
|
+
throw new actions_core_1.IntegrationError('Missing authentication token', 'MISSING_REQUIRED_FIELD', 400);
|
|
159
149
|
}
|
|
150
|
+
const body = utils_rt_1.gen_update_segment_payload(payload);
|
|
151
|
+
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
json: body,
|
|
154
|
+
headers: {
|
|
155
|
+
Authorization: `Bearer ${rt_access_token}`
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
.then((response) => response.json())
|
|
159
|
+
.then((response) => {
|
|
160
|
+
return response;
|
|
161
|
+
})
|
|
162
|
+
.catch((err) => {
|
|
163
|
+
console.log('perform: error updating segment >', err);
|
|
164
|
+
});
|
|
160
165
|
}
|
|
161
166
|
};
|
|
162
167
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/updateSegment/index.ts"],"names":[],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/updateSegment/index.ts"],"names":[],"mappings":";;AACA,wDAAwD;AAGxD,0CAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,2BAA2B;IAClC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,qCAAqC;IAC1D,MAAM,EAAE;QACN,mBAAmB,EAAE;YACnB,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mCAAmC;aAC7C;SACF;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oCAAoC;aAC9C;SACF;QAED,gBAAgB,EAAE;YAChB,KAAK,EAAE,wDAAwD;YAC/D,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;oBACnC,IAAI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,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACN,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3C,MAAM,eAAe,GAAG,IAAI,EAAE,WAAW,CAAA;QACzC,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,+BAAgB,CAAC,8BAA8B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;SAC1F;QACD,MAAM,IAAI,GAAG,qCAA0B,CAAC,OAAO,CAAC,CAAA;QAEhD,OAAO,OAAO,CAAC,gDAAgD,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,eAAe,EAAE;aAC3C;SACF,CAAC;aACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;aACnC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACN,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Payload } from './updateSegment/generated-types';
|
|
2
2
|
import { YahooPayload } from './types';
|
|
3
|
-
import { AudienceSettings } from './generated-types';
|
|
4
3
|
export declare function create_hash(input: string | undefined): string | undefined;
|
|
5
4
|
export declare function generate_jwt(client_id: string, client_secret: string): string;
|
|
6
|
-
export declare function get_id_schema(payload: Payload
|
|
5
|
+
export declare function get_id_schema(payload: Payload): {
|
|
7
6
|
maid: boolean;
|
|
8
7
|
email: boolean;
|
|
9
8
|
};
|
|
10
|
-
export declare function
|
|
9
|
+
export declare function check_schema(payload: Payload): void;
|
|
10
|
+
export declare function gen_update_segment_payload(payloads: Payload[]): YahooPayload;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gen_update_segment_payload = exports.get_id_schema = exports.generate_jwt = exports.create_hash = void 0;
|
|
3
|
+
exports.gen_update_segment_payload = exports.check_schema = exports.get_id_schema = exports.generate_jwt = exports.create_hash = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
6
|
const utils_tax_1 = require("./utils-tax");
|
|
6
7
|
function create_hash(input) {
|
|
7
8
|
if (input === undefined)
|
|
@@ -34,37 +35,32 @@ function generate_jwt(client_id, client_secret) {
|
|
|
34
35
|
return jwt;
|
|
35
36
|
}
|
|
36
37
|
exports.generate_jwt = generate_jwt;
|
|
37
|
-
function get_id_schema(payload
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
function get_id_schema(payload) {
|
|
39
|
+
return {
|
|
40
|
+
maid: payload.send_advertising_id === true,
|
|
41
|
+
email: payload.send_email === true
|
|
41
42
|
};
|
|
42
|
-
let id_type;
|
|
43
|
-
audienceSettings.identifier ? (id_type = audienceSettings.identifier) : (id_type = payload.identifier);
|
|
44
|
-
if (id_type == 'email') {
|
|
45
|
-
schema.email = true;
|
|
46
|
-
}
|
|
47
|
-
if (id_type == 'maid') {
|
|
48
|
-
schema.maid = true;
|
|
49
|
-
}
|
|
50
|
-
if (id_type == 'email_maid') {
|
|
51
|
-
schema.maid = true;
|
|
52
|
-
schema.email = true;
|
|
53
|
-
}
|
|
54
|
-
return schema;
|
|
55
43
|
}
|
|
56
44
|
exports.get_id_schema = get_id_schema;
|
|
57
|
-
function
|
|
58
|
-
|
|
45
|
+
function check_schema(payload) {
|
|
46
|
+
if (payload.send_email === false && payload.send_advertising_id === false) {
|
|
47
|
+
throw new actions_core_1.IntegrationError('Either `Send Email`, or `Send Advertising ID` setting must be set to `true`.', 'INVALID_SETTINGS', 400);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.check_schema = check_schema;
|
|
51
|
+
function gen_update_segment_payload(payloads) {
|
|
52
|
+
check_schema(payloads[0]);
|
|
53
|
+
const schema = get_id_schema(payloads[0]);
|
|
59
54
|
const data = [];
|
|
55
|
+
let exp;
|
|
60
56
|
for (const event of payloads) {
|
|
61
57
|
let hashed_email = '';
|
|
62
|
-
if (schema.email === true
|
|
58
|
+
if (schema.email === true) {
|
|
63
59
|
hashed_email = create_hash(event.email);
|
|
64
60
|
}
|
|
65
61
|
let idfa = '';
|
|
66
62
|
let gpsaid = '';
|
|
67
|
-
if (schema.maid === true
|
|
63
|
+
if (schema.maid === true) {
|
|
68
64
|
switch (event.device_type) {
|
|
69
65
|
case 'ios':
|
|
70
66
|
idfa = event.advertising_id;
|
|
@@ -74,16 +70,12 @@ function gen_update_segment_payload(payloads, audienceSettings) {
|
|
|
74
70
|
break;
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
|
-
if (hashed_email == '' && idfa == '' && gpsaid == '') {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
73
|
const ts = Math.floor(new Date().getTime() / 1000);
|
|
81
74
|
const seg_key = event.segment_audience_key;
|
|
82
|
-
|
|
83
|
-
if (event.event_attributes[seg_key] === true) {
|
|
75
|
+
if (event.event_attributes[seg_key] == true) {
|
|
84
76
|
exp = ts + 90 * 24 * 60 * 60;
|
|
85
77
|
}
|
|
86
|
-
if (event.event_attributes[seg_key]
|
|
78
|
+
if (event.event_attributes[seg_key] == false) {
|
|
87
79
|
exp = 0;
|
|
88
80
|
}
|
|
89
81
|
const seg_id = event.segment_audience_id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-rt.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-rt.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;
|
|
1
|
+
{"version":3,"file":"utils-rt.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-rt.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,wDAAwD;AAGxD,2CAA2C;AAO3C,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAM;IAC/B,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACzD,CAAC;AAHD,kCAGC;AAQD,SAAgB,YAAY,CAAC,SAAiB,EAAE,aAAqB;IACnE,MAAM,SAAS,GAAG,yBAAa,CAAC,EAAE,CAAC,CAAA;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;IAC5D,MAAM,GAAG,GAAG,0DAA0D,CAAA;IACtE,MAAM,WAAW,GAAG;QAClB,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,GAAG,GAAG,oBAAoB;QAC/B,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,YAAY,GAAG,IAAI;QACxB,GAAG,EAAE,YAAY;KAClB,CAAA;IACD,MAAM,UAAU,GAAG;QACjB,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,KAAK;KACX,CAAA;IAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACrF,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ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,CAAA;KAC1D;IAED,OAAO,aAAa,CAAA;AACtB,CAAC;AAjDD,gEAiDC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.update_taxonomy = exports.gen_oauth1_signature = exports.gen_random_id = exports.gen_segment_subtaxonomy_payload = exports.gen_customer_taxonomy_payload = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
6
5
|
function gen_customer_taxonomy_payload(settings, payload) {
|
|
7
6
|
const data = {
|
|
8
7
|
id: payload.engage_space_id,
|
|
@@ -49,30 +48,20 @@ function gen_oauth1_signature(client_key, client_secret, method, url) {
|
|
|
49
48
|
}
|
|
50
49
|
exports.gen_oauth1_signature = gen_oauth1_signature;
|
|
51
50
|
async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
|
|
52
|
-
const tx_client_secret = tx_creds.
|
|
53
|
-
const tx_client_key = tx_creds.
|
|
51
|
+
const tx_client_secret = tx_creds.tx_client_key;
|
|
52
|
+
const tx_client_key = tx_creds.tx_client_secret;
|
|
54
53
|
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
|
|
55
54
|
const oauth1_auth_string = gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return await add_segment_node.json();
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
const _error = error;
|
|
69
|
-
if (parseInt(_error.response.status) == 401) {
|
|
70
|
-
throw new actions_core_1.IntegrationError(`Error while updating taxonomy: ${JSON.stringify(_error.response.data)} ${_error.response.status}. Validate Yahoo credentials`, 'YAHOO_TAXONOMY_API_AUTH_ERR', 400);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
throw error;
|
|
55
|
+
const add_segment_node = await request(url, {
|
|
56
|
+
method: 'PUT',
|
|
57
|
+
body: body_form_data,
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: oauth1_auth_string,
|
|
60
|
+
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
74
61
|
}
|
|
75
|
-
}
|
|
62
|
+
});
|
|
63
|
+
console.log('upd tax status:', add_segment_node.status);
|
|
64
|
+
return await add_segment_node.json();
|
|
76
65
|
}
|
|
77
66
|
exports.update_taxonomy = update_taxonomy;
|
|
78
67
|
//# sourceMappingURL=utils-tax.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-tax.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-tax.ts"],"names":[],"mappings":";;;AAGA,mCAAmC;
|
|
1
|
+
{"version":3,"file":"utils-tax.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-tax.ts"],"names":[],"mappings":";;;AAGA,mCAAmC;AAInC,SAAgB,6BAA6B,CAAC,QAAkB,EAAE,OAA4B;IAC5F,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,eAAe;QAC3B,IAAI,EAAE,OAAO,CAAC,eAAe;QAC7B,WAAW,EAAE,OAAO,CAAC,aAAa;QAClC,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC3B;KACF,CAAA;IAED,MAAM,aAAa,GAAG,+IACpB,OAAO,CAAC,aACV,+HAA+H,IAAI,CAAC,SAAS,CAC3I,IAAI,CACL,sBAAsB,CAAA;IACvB,OAAO,aAAa,CAAA;AACtB,CAAC;AAhBD,sEAgBC;AAED,SAAgB,+BAA+B,CAAC,OAA2B;IACzE,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,mBAAmB;QAC/B,IAAI,EAA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gen_random_id(length: number): string;
|
|
4
|
+
export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_taxonomy = exports.gen_random_id = void 0;
|
|
4
|
+
const utils_tax_1 = require("./utils-tax");
|
|
5
|
+
function gen_random_id(length) {
|
|
6
|
+
const pattern = 'abcdefghijklmnopqrstuvwxyz123456789';
|
|
7
|
+
const result = [];
|
|
8
|
+
for (let i = 0; i < length; i++) {
|
|
9
|
+
result.push(pattern[Math.floor(Math.random() * pattern.length)]);
|
|
10
|
+
}
|
|
11
|
+
return result.join('');
|
|
12
|
+
}
|
|
13
|
+
exports.gen_random_id = gen_random_id;
|
|
14
|
+
async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
|
|
15
|
+
const tx_client_secret = tx_creds.tx_client_key;
|
|
16
|
+
const tx_client_key = tx_creds.tx_client_secret;
|
|
17
|
+
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
|
|
18
|
+
const oauth1_auth_string = utils_tax_1.gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
|
|
19
|
+
const add_segment_node = await request(url, {
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
body: body_form_data,
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: oauth1_auth_string,
|
|
24
|
+
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return await add_segment_node.json();
|
|
28
|
+
}
|
|
29
|
+
exports.update_taxonomy = update_taxonomy;
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils.ts"],"names":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