@segment/action-destinations 3.438.0 → 3.440.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/aws-kinesis/generated-types.d.ts +2 -0
- package/dist/destinations/aws-kinesis/generated-types.js.map +1 -0
- package/dist/destinations/aws-kinesis/index.d.ts +4 -0
- package/dist/destinations/aws-kinesis/index.js +24 -0
- package/dist/destinations/aws-kinesis/index.js.map +1 -0
- package/dist/destinations/aws-kinesis/send/generated-types.d.ts +8 -0
- package/dist/destinations/aws-kinesis/send/generated-types.js.map +1 -0
- package/dist/destinations/{yonoma/sendEvent → aws-kinesis/send}/index.d.ts +1 -1
- package/dist/destinations/aws-kinesis/send/index.js +41 -0
- package/dist/destinations/aws-kinesis/send/index.js.map +1 -0
- package/dist/destinations/criteo-audiences/addUserToAudience/generated-types.d.ts +1 -0
- package/dist/destinations/criteo-audiences/addUserToAudience/index.js +7 -0
- package/dist/destinations/criteo-audiences/addUserToAudience/index.js.map +1 -1
- package/dist/destinations/criteo-audiences/removeUserFromAudience/generated-types.d.ts +1 -0
- package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js +7 -0
- package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/index.js +1 -1
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion2/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/userList/index.js +3 -3
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/{api/index.d.ts → api.d.ts} +3 -3
- package/dist/destinations/linkedin-audiences/{api/index.js → api.js} +2 -2
- package/dist/destinations/linkedin-audiences/api.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.d.ts +2 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.js +126 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.d.ts +5 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js +112 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +5 -232
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/ms-bing-ads-audiences/index.js +1 -1
- package/dist/destinations/ms-bing-ads-audiences/index.js.map +1 -1
- package/dist/destinations/ms-bing-ads-audiences/syncAudiences/fields.js +13 -17
- package/dist/destinations/ms-bing-ads-audiences/syncAudiences/fields.js.map +1 -1
- package/dist/destinations/snap-audiences/constants.d.ts +2 -0
- package/dist/destinations/snap-audiences/constants.js +6 -0
- package/dist/destinations/snap-audiences/constants.js.map +1 -0
- package/dist/destinations/snap-audiences/index.js +24 -40
- package/dist/destinations/snap-audiences/index.js.map +1 -1
- package/dist/destinations/snap-audiences/syncAudience/constants.d.ts +5 -0
- package/dist/destinations/snap-audiences/syncAudience/constants.js +9 -0
- package/dist/destinations/snap-audiences/syncAudience/constants.js.map +1 -0
- package/dist/destinations/snap-audiences/syncAudience/fields.d.ts +2 -0
- package/dist/destinations/snap-audiences/syncAudience/fields.js +90 -0
- package/dist/destinations/snap-audiences/syncAudience/fields.js.map +1 -0
- package/dist/destinations/snap-audiences/syncAudience/functions.d.ts +5 -0
- package/dist/destinations/snap-audiences/syncAudience/functions.js +119 -0
- package/dist/destinations/snap-audiences/syncAudience/functions.js.map +1 -0
- package/dist/destinations/snap-audiences/syncAudience/generated-types.d.ts +2 -1
- package/dist/destinations/snap-audiences/syncAudience/index.js +6 -146
- package/dist/destinations/snap-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/snap-audiences/syncAudience/types.d.ts +18 -0
- package/dist/destinations/snap-audiences/syncAudience/types.js.map +1 -0
- package/dist/destinations/snap-audiences/types.d.ts +19 -0
- package/dist/destinations/snap-audiences/types.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/common-constants.d.ts +2 -0
- package/dist/destinations/stackadapt-audiences/common-constants.js +6 -0
- package/dist/destinations/stackadapt-audiences/common-constants.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/common-functions.d.ts +0 -7
- package/dist/destinations/stackadapt-audiences/common-functions.js +0 -193
- package/dist/destinations/stackadapt-audiences/common-functions.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/common-types.d.ts +15 -0
- package/dist/destinations/stackadapt-audiences/common-types.js +3 -0
- package/dist/destinations/stackadapt-audiences/common-types.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/{constants.js → forwardAudienceEvent/constants.js} +1 -22
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/constants.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.d.ts +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js +184 -1
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.d.ts +6 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +184 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/generated-types.d.ts +0 -3
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js +4 -5
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/{types.d.ts → forwardAudienceEvent/types.d.ts} +0 -15
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/types.js +3 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/types.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/index.d.ts +1 -1
- package/dist/destinations/stackadapt-audiences/index.js +5 -7
- package/dist/destinations/stackadapt-audiences/index.js.map +1 -1
- package/dist/destinations/yonoma/index.js +0 -2
- package/dist/destinations/yonoma/index.js.map +1 -1
- package/dist/destinations/yonoma/trackEvent/generated-types.d.ts +24 -3
- package/dist/destinations/yonoma/trackEvent/index.js +140 -16
- package/dist/destinations/yonoma/trackEvent/index.js.map +1 -1
- package/dist/destinations/yonoma/trackEvent/types.d.ts +24 -3
- package/dist/destinations/yonoma/trackPageView/generated-types.d.ts +23 -7
- package/dist/destinations/yonoma/trackPageView/index.js +133 -50
- package/dist/destinations/yonoma/trackPageView/index.js.map +1 -1
- package/dist/destinations/yonoma/trackPageView/types.d.ts +22 -4
- package/dist/destinations/yonoma/upsertContact/generated-types.d.ts +25 -3
- package/dist/destinations/yonoma/upsertContact/index.js +153 -21
- package/dist/destinations/yonoma/upsertContact/index.js.map +1 -1
- package/dist/destinations/yonoma/upsertContact/types.d.ts +26 -4
- package/package.json +2 -2
- package/dist/destinations/linkedin-audiences/api/index.js.map +0 -1
- package/dist/destinations/snap-audiences/syncAudience/utils.d.ts +0 -8
- package/dist/destinations/snap-audiences/syncAudience/utils.js +0 -61
- package/dist/destinations/snap-audiences/syncAudience/utils.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/common-fields.d.ts +0 -2
- package/dist/destinations/stackadapt-audiences/common-fields.js +0 -227
- package/dist/destinations/stackadapt-audiences/common-fields.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/constants.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/generated-types.d.ts +0 -26
- package/dist/destinations/stackadapt-audiences/forwardProfile/generated-types.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/index.d.ts +0 -5
- package/dist/destinations/stackadapt-audiences/forwardProfile/index.js +0 -140
- package/dist/destinations/stackadapt-audiences/forwardProfile/index.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/types.js.map +0 -1
- package/dist/destinations/yonoma/sendEvent/constants.d.ts +0 -1
- package/dist/destinations/yonoma/sendEvent/constants.js +0 -5
- package/dist/destinations/yonoma/sendEvent/constants.js.map +0 -1
- package/dist/destinations/yonoma/sendEvent/functions.d.ts +0 -1
- package/dist/destinations/yonoma/sendEvent/functions.js +0 -19
- package/dist/destinations/yonoma/sendEvent/functions.js.map +0 -1
- package/dist/destinations/yonoma/sendEvent/generated-types.d.ts +0 -13
- package/dist/destinations/yonoma/sendEvent/generated-types.js.map +0 -1
- package/dist/destinations/yonoma/sendEvent/index.js +0 -103
- package/dist/destinations/yonoma/sendEvent/index.js.map +0 -1
- package/dist/destinations/yonoma/sendEvent/types.d.ts +0 -10
- package/dist/destinations/yonoma/sendEvent/types.js.map +0 -1
- /package/dist/destinations/{stackadapt-audiences/forwardProfile → aws-kinesis}/generated-types.js +0 -0
- /package/dist/destinations/{yonoma/sendEvent → aws-kinesis/send}/generated-types.js +0 -0
- /package/dist/destinations/{stackadapt-audiences → snap-audiences/syncAudience}/types.js +0 -0
- /package/dist/destinations/{yonoma/sendEvent → snap-audiences}/types.js +0 -0
- /package/dist/destinations/stackadapt-audiences/{constants.d.ts → forwardAudienceEvent/constants.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,qBAAqB;CACnB,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fields = void 0;
|
|
4
|
+
exports.fields = {
|
|
5
|
+
external_audience_id: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
label: 'External Audience ID',
|
|
8
|
+
description: 'Unique Audience Identifier returned by the createAudience() function call.',
|
|
9
|
+
required: true,
|
|
10
|
+
unsafe_hidden: true,
|
|
11
|
+
default: {
|
|
12
|
+
'@path': '$.context.personas.external_audience_id'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
audienceKey: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
label: 'Audience Key',
|
|
18
|
+
description: 'Audience key.',
|
|
19
|
+
required: true,
|
|
20
|
+
unsafe_hidden: true,
|
|
21
|
+
default: {
|
|
22
|
+
'@path': '$.context.personas.computation_key'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
label: 'Properties object',
|
|
27
|
+
description: 'Object that contains audience name and value.',
|
|
28
|
+
type: 'object',
|
|
29
|
+
required: true,
|
|
30
|
+
unsafe_hidden: true,
|
|
31
|
+
default: { '@path': '$.properties' }
|
|
32
|
+
},
|
|
33
|
+
phone: {
|
|
34
|
+
label: 'Phone',
|
|
35
|
+
description: "If using phone as the identifier an additional setup step is required when connecting the Destination to the Audience. Please ensure that 'phone' is configured as an additional identifier in the Audience settings tab.",
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: false,
|
|
38
|
+
default: { '@path': '$.properties.phone' },
|
|
39
|
+
},
|
|
40
|
+
email: {
|
|
41
|
+
label: 'Email',
|
|
42
|
+
description: "The user's email address.",
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: false,
|
|
45
|
+
default: { '@path': '$.properties.email' },
|
|
46
|
+
},
|
|
47
|
+
advertising_id: {
|
|
48
|
+
label: 'Mobile Advertising ID',
|
|
49
|
+
description: "If using Mobile Ad ID as the identifier an additional setup step is required when connecting the Destination to the Audience. Please ensure that 'ios.idfa' is configured to 'ios_idfa' and 'android.idfa' is configured to 'android_idfa' in the Audience settings tab.",
|
|
50
|
+
type: 'string',
|
|
51
|
+
required: false,
|
|
52
|
+
default: {
|
|
53
|
+
'@if': {
|
|
54
|
+
exists: { '@path': '$.properties.android_idfa' },
|
|
55
|
+
then: { '@path': '$.properties.android_idfa' },
|
|
56
|
+
else: { '@path': '$.properties.ios_idfa' }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
enable_batching: {
|
|
61
|
+
label: 'Enable Batching',
|
|
62
|
+
description: 'When enabled, events will be batched before being sent to Snap.',
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
readOnly: true,
|
|
65
|
+
unsafe_hidden: true,
|
|
66
|
+
required: true,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
max_batch_size: {
|
|
70
|
+
label: 'Max Batch Size',
|
|
71
|
+
description: 'Maximum number of API calls to include in a batch. Defaults to 100,000 which is the maximum allowed by Snap.',
|
|
72
|
+
type: 'number',
|
|
73
|
+
required: true,
|
|
74
|
+
readOnly: true,
|
|
75
|
+
unsafe_hidden: true,
|
|
76
|
+
minimum: 1,
|
|
77
|
+
maximum: 100000,
|
|
78
|
+
default: 100000
|
|
79
|
+
},
|
|
80
|
+
batch_keys: {
|
|
81
|
+
label: 'Batch Keys',
|
|
82
|
+
description: 'The keys to use for batching the events. Ensures events from different audiences are sent in separate batches. This is Segment default behavior with Engage Audiences anyway.',
|
|
83
|
+
type: 'string',
|
|
84
|
+
unsafe_hidden: true,
|
|
85
|
+
required: false,
|
|
86
|
+
multiple: true,
|
|
87
|
+
default: ['external_audience_id']
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,MAAM,GAA+B;IAChD,oBAAoB,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,4EAA4E;Q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9E,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACd;IACD,cAAc,EAAE;QACd,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,8GAA8G;QAC3H,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,MAAO;QAChB,OAAO,EAAE,MAAO;KACjB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,+KAA+K;QAC5L,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,sBAAsB,CAAC;KAClC;CACF,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Payload } from './generated-types';
|
|
2
|
+
import { RequestClient, MultiStatusResponse } from '@segment/actions-core';
|
|
3
|
+
export declare function send(request: RequestClient, payload: Payload[]): Promise<MultiStatusResponse>;
|
|
4
|
+
export declare const normalize: (identifier: string) => string;
|
|
5
|
+
export declare const normalizePhone: (phone: string) => string;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePhone = exports.normalize = void 0;
|
|
4
|
+
exports.send = send;
|
|
5
|
+
const hashing_utils_1 = require("../../../lib/hashing-utils");
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
async function send(request, payload) {
|
|
9
|
+
const payloads = payload.map((p, index) => ({ ...p, index }));
|
|
10
|
+
const { external_audience_id } = payload[0];
|
|
11
|
+
const multiStatusResponse = new actions_core_1.MultiStatusResponse();
|
|
12
|
+
const batches = payloads.reduce((acc, p) => {
|
|
13
|
+
const hasValue = Boolean(p.email || p.phone || p.advertising_id);
|
|
14
|
+
if (!hasValue) {
|
|
15
|
+
multiStatusResponse.setErrorResponseAtIndex(p.index, {
|
|
16
|
+
status: 400,
|
|
17
|
+
errortype: 'PAYLOAD_VALIDATION_FAILED',
|
|
18
|
+
errormessage: 'One of "email" or "phone" or "Mobile Advertising ID" is required.'
|
|
19
|
+
});
|
|
20
|
+
return acc;
|
|
21
|
+
}
|
|
22
|
+
const isAdd = Boolean(p.props[p.audienceKey]);
|
|
23
|
+
if (p.email) {
|
|
24
|
+
(isAdd ? acc.addEmail.opPayloads : acc.removeEmail.opPayloads).push(p);
|
|
25
|
+
}
|
|
26
|
+
if (p.phone) {
|
|
27
|
+
(isAdd ? acc.addPhone.opPayloads : acc.removePhone.opPayloads).push(p);
|
|
28
|
+
}
|
|
29
|
+
if (p.advertising_id) {
|
|
30
|
+
(isAdd ? acc.addMAID.opPayloads : acc.removeMAID.opPayloads).push(p);
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, {
|
|
34
|
+
addEmail: { opPayloads: [], operationType: { method: 'POST', type: constants_1.SCHEMA_TYPES.EMAIL } },
|
|
35
|
+
addPhone: { opPayloads: [], operationType: { method: 'POST', type: constants_1.SCHEMA_TYPES.PHONE } },
|
|
36
|
+
addMAID: { opPayloads: [], operationType: { method: 'POST', type: constants_1.SCHEMA_TYPES.MAID } },
|
|
37
|
+
removeEmail: { opPayloads: [], operationType: { method: 'DELETE', type: constants_1.SCHEMA_TYPES.EMAIL } },
|
|
38
|
+
removePhone: { opPayloads: [], operationType: { method: 'DELETE', type: constants_1.SCHEMA_TYPES.PHONE } },
|
|
39
|
+
removeMAID: { opPayloads: [], operationType: { method: 'DELETE', type: constants_1.SCHEMA_TYPES.MAID } },
|
|
40
|
+
});
|
|
41
|
+
const url = `https://adsapi.snapchat.com/v1/segments/${external_audience_id}/users`;
|
|
42
|
+
await Promise.all(Object.entries(batches)
|
|
43
|
+
.filter(([, batch]) => batch.opPayloads.length > 0)
|
|
44
|
+
.map(async ([, batch]) => {
|
|
45
|
+
const { opPayloads, operationType: { type, method } } = batch;
|
|
46
|
+
const json = buildJSON(opPayloads, type);
|
|
47
|
+
try {
|
|
48
|
+
await request(url, { method, json });
|
|
49
|
+
opPayloads.forEach((p) => {
|
|
50
|
+
const existingResponse = multiStatusResponse.getResponseAtIndex(p.index)?.value();
|
|
51
|
+
const status = existingResponse?.status;
|
|
52
|
+
if (typeof status === 'number' && (status < 200 || status >= 300)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
multiStatusResponse.setSuccessResponseAtIndex(p.index, {
|
|
56
|
+
status: 200,
|
|
57
|
+
sent: json.users[p.index],
|
|
58
|
+
body: JSON.stringify(p)
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
for (const p of opPayloads) {
|
|
64
|
+
multiStatusResponse.setErrorResponseAtIndex(p.index, {
|
|
65
|
+
status: error?.response?.status || 400,
|
|
66
|
+
errortype: 'BAD_REQUEST',
|
|
67
|
+
errormessage: error.message || 'Unknown error',
|
|
68
|
+
sent: json.users[p.index],
|
|
69
|
+
body: JSON.stringify(p)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
return multiStatusResponse;
|
|
75
|
+
}
|
|
76
|
+
function buildJSON(payloads, type) {
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
const data = payloads.reduce((acc, p) => {
|
|
79
|
+
let value;
|
|
80
|
+
if (type === constants_1.SCHEMA_TYPES.EMAIL && p.email) {
|
|
81
|
+
value = (0, hashing_utils_1.processHashing)(p.email, 'sha256', 'hex', exports.normalize);
|
|
82
|
+
}
|
|
83
|
+
else if (type === constants_1.SCHEMA_TYPES.PHONE && p.phone) {
|
|
84
|
+
value = (0, hashing_utils_1.processHashing)(p.phone, 'sha256', 'hex', exports.normalizePhone);
|
|
85
|
+
}
|
|
86
|
+
else if (type === constants_1.SCHEMA_TYPES.MAID && p.advertising_id) {
|
|
87
|
+
value = (0, hashing_utils_1.processHashing)(p.advertising_id, 'sha256', 'hex', exports.normalize);
|
|
88
|
+
}
|
|
89
|
+
if (value && !seen.has(value)) {
|
|
90
|
+
seen.add(value);
|
|
91
|
+
acc.push([value]);
|
|
92
|
+
}
|
|
93
|
+
return acc;
|
|
94
|
+
}, []);
|
|
95
|
+
return {
|
|
96
|
+
users: [
|
|
97
|
+
{
|
|
98
|
+
schema: [type],
|
|
99
|
+
data
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const normalize = (identifier) => {
|
|
105
|
+
return identifier.trim().toLowerCase();
|
|
106
|
+
};
|
|
107
|
+
exports.normalize = normalize;
|
|
108
|
+
const normalizePhone = (phone) => {
|
|
109
|
+
let normalizedPhone = phone.replace(/[\s()+-]/g, '');
|
|
110
|
+
if (normalizedPhone.startsWith('00')) {
|
|
111
|
+
normalizedPhone = normalizedPhone.substring(2);
|
|
112
|
+
}
|
|
113
|
+
if (normalizedPhone.startsWith('0')) {
|
|
114
|
+
normalizedPhone = normalizedPhone.substring(1);
|
|
115
|
+
}
|
|
116
|
+
return normalizedPhone;
|
|
117
|
+
};
|
|
118
|
+
exports.normalizePhone = normalizePhone;
|
|
119
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/functions.ts"],"names":[],"mappings":";;;AAMA,oBA6EC;AAlFD,8DAA2D;AAC3D,wDAA0E;AAE1E,2CAA0C;AAEnC,KAAK,UAAU,IAAI,CAAC,OAAsB,EAAE,OAAkB;IACnE,MAAM,QAAQ,GAAuB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EA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E,EAAE,CAAC,CAAA;IAEN,OAAO;QACL,KAAK,EAAE;YACL;gBACE,MAAM,EAAE,CAAC,IAAI,CAAC;gBACd,IAAI;aACL;SACF;KACF,CAAA;AACH,CAAC;AAEM,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAU,EAAE;IACtD,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AACxC,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB;AAQM,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE;IAEtD,IAAI,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAGpD,IAAI,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAChD,CAAC;IAGD,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,OAAO,eAAe,CAAA;AACxB,CAAC,CAAA;AAfY,QAAA,cAAc,kBAe1B"}
|
|
@@ -1,158 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const fields_1 = require("./fields");
|
|
4
|
+
const functions_1 = require("./functions");
|
|
5
5
|
const action = {
|
|
6
6
|
title: 'Sync Audience',
|
|
7
|
-
description: 'Sync
|
|
7
|
+
description: 'Sync Engage Audiences to Snap',
|
|
8
8
|
defaultSubscription: 'type = "track"',
|
|
9
|
-
fields:
|
|
10
|
-
external_audience_id: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'External Audience ID',
|
|
13
|
-
description: 'Unique Audience Identifier returned by the createAudience() function call.',
|
|
14
|
-
required: true,
|
|
15
|
-
unsafe_hidden: true,
|
|
16
|
-
default: {
|
|
17
|
-
'@path': '$.context.personas.external_audience_id'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
audienceKey: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
label: 'Audience Key',
|
|
23
|
-
description: 'Audience key.',
|
|
24
|
-
required: true,
|
|
25
|
-
unsafe_hidden: true,
|
|
26
|
-
default: {
|
|
27
|
-
'@path': '$.context.personas.computation_key'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
props: {
|
|
31
|
-
label: 'Properties object',
|
|
32
|
-
description: 'A computed object for track events.',
|
|
33
|
-
type: 'object',
|
|
34
|
-
required: true,
|
|
35
|
-
unsafe_hidden: true,
|
|
36
|
-
default: { '@path': '$.properties' }
|
|
37
|
-
},
|
|
38
|
-
schema_type: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
choices: [
|
|
41
|
-
{ value: 'MOBILE_AD_ID_SHA256', label: 'Mobile ID' },
|
|
42
|
-
{ value: 'PHONE_SHA256', label: 'Phone' },
|
|
43
|
-
{ value: 'EMAIL_SHA256', label: 'Email' }
|
|
44
|
-
],
|
|
45
|
-
label: 'External ID Type',
|
|
46
|
-
required: true,
|
|
47
|
-
description: 'Choose the type of identifier to use when adding users to Snap.',
|
|
48
|
-
default: 'EMAIL_SHA256',
|
|
49
|
-
disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment']
|
|
50
|
-
},
|
|
51
|
-
phone: {
|
|
52
|
-
label: 'Phone',
|
|
53
|
-
description: "If using phone as the identifier, an additional setup step is required when connecting the Destination to the Audience. Please ensure that 'phone' is configured as an additional identifier in the Audience settings tab.",
|
|
54
|
-
type: 'string',
|
|
55
|
-
required: false,
|
|
56
|
-
default: { '@path': '$.properties.phone' },
|
|
57
|
-
depends_on: {
|
|
58
|
-
match: 'all',
|
|
59
|
-
conditions: [
|
|
60
|
-
{
|
|
61
|
-
fieldKey: 'schema_type',
|
|
62
|
-
operator: 'is',
|
|
63
|
-
value: 'PHONE_SHA256'
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
category: 'hashedPII'
|
|
68
|
-
},
|
|
69
|
-
email: {
|
|
70
|
-
label: 'Email',
|
|
71
|
-
description: "The user's email address.",
|
|
72
|
-
type: 'string',
|
|
73
|
-
required: false,
|
|
74
|
-
default: { '@path': '$.context.traits.email' },
|
|
75
|
-
depends_on: {
|
|
76
|
-
match: 'all',
|
|
77
|
-
conditions: [
|
|
78
|
-
{
|
|
79
|
-
fieldKey: 'schema_type',
|
|
80
|
-
operator: 'is',
|
|
81
|
-
value: 'EMAIL_SHA256'
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
category: 'hashedPII'
|
|
86
|
-
},
|
|
87
|
-
advertising_id: {
|
|
88
|
-
label: 'Mobile Advertising ID',
|
|
89
|
-
description: "If using Mobile Ad ID as the identifier, an additional setup step is required when connecting the Destination to the Audience. Please ensure that 'ios.idfa' and 'android.idfa' are configured as an additional identifier in the Audience settings tab.",
|
|
90
|
-
type: 'string',
|
|
91
|
-
required: false,
|
|
92
|
-
default: {
|
|
93
|
-
'@path': '$.context.device.advertisingId'
|
|
94
|
-
},
|
|
95
|
-
depends_on: {
|
|
96
|
-
match: 'all',
|
|
97
|
-
conditions: [
|
|
98
|
-
{
|
|
99
|
-
fieldKey: 'schema_type',
|
|
100
|
-
operator: 'is',
|
|
101
|
-
value: 'MOBILE_AD_ID_SHA256'
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
category: 'hashedPII'
|
|
106
|
-
},
|
|
107
|
-
enable_batching: {
|
|
108
|
-
label: 'Enable Batching',
|
|
109
|
-
description: 'When enabled, events will be batched before being sent to Snap.',
|
|
110
|
-
type: 'boolean',
|
|
111
|
-
required: true,
|
|
112
|
-
default: true
|
|
113
|
-
}
|
|
114
|
-
},
|
|
9
|
+
fields: fields_1.fields,
|
|
115
10
|
perform: async (request, { payload }) => {
|
|
116
|
-
return
|
|
11
|
+
return (0, functions_1.send)(request, [payload]);
|
|
117
12
|
},
|
|
118
13
|
performBatch: async (request, { payload }) => {
|
|
119
|
-
return
|
|
14
|
+
return (0, functions_1.send)(request, payload);
|
|
120
15
|
}
|
|
121
16
|
};
|
|
122
17
|
exports.default = action;
|
|
123
|
-
const processPayload = async (request, payload) => {
|
|
124
|
-
const { external_audience_id, schema_type } = payload[0];
|
|
125
|
-
const { enteredAudience, exitedAudience } = (0, utils_1.sortPayload)(payload);
|
|
126
|
-
if (enteredAudience.length === 0 && exitedAudience.length === 0) {
|
|
127
|
-
throw new actions_core_1.PayloadValidationError(`No ${(0, utils_1.validationError)(schema_type)} identifier present in payload(s)`);
|
|
128
|
-
}
|
|
129
|
-
const requests = [];
|
|
130
|
-
if (enteredAudience.length > 0) {
|
|
131
|
-
requests.push(request(`https://adsapi.snapchat.com/v1/segments/${external_audience_id}/users`, {
|
|
132
|
-
method: 'post',
|
|
133
|
-
json: {
|
|
134
|
-
users: [
|
|
135
|
-
{
|
|
136
|
-
schema: [`${schema_type}`],
|
|
137
|
-
data: enteredAudience
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
if (exitedAudience.length > 0) {
|
|
144
|
-
requests.push(request(`https://adsapi.snapchat.com/v1/segments/${external_audience_id}/users`, {
|
|
145
|
-
method: 'delete',
|
|
146
|
-
json: {
|
|
147
|
-
users: [
|
|
148
|
-
{
|
|
149
|
-
schema: [`${schema_type}`],
|
|
150
|
-
data: exitedAudience
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
return await Promise.all(requests);
|
|
157
|
-
};
|
|
158
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/index.ts"],"names":[],"mappings":";;AAGA,qCAAiC;AACjC,2CAAkC;AAElC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,+BAA+B;IAC5C,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAN,eAAM;IACN,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACjC,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3C,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/B,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Payload } from './generated-types';
|
|
2
|
+
import { SCHEMA_TYPES } from './constants';
|
|
3
|
+
export interface PayloadWithIndex extends Payload {
|
|
4
|
+
index: number;
|
|
5
|
+
}
|
|
6
|
+
export interface OperationType {
|
|
7
|
+
method: 'POST' | 'DELETE';
|
|
8
|
+
type: SchemaType;
|
|
9
|
+
}
|
|
10
|
+
export interface AddRemoveUsersJSON {
|
|
11
|
+
users: [
|
|
12
|
+
{
|
|
13
|
+
schema: ["EMAIL_SHA256"] | ["PHONE_SHA256"] | ["MOBILE_AD_ID_SHA256"];
|
|
14
|
+
data: [string][];
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
export type SchemaType = typeof SCHEMA_TYPES[keyof typeof SCHEMA_TYPES];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/snap-audiences/syncAudience/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RefreshTokenResponse {
|
|
2
|
+
access_token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface SnapAudienceResponse {
|
|
5
|
+
segments: {
|
|
6
|
+
segment: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export interface CreateAudienceReq {
|
|
12
|
+
segments: {
|
|
13
|
+
name: string;
|
|
14
|
+
source_type: string;
|
|
15
|
+
ad_account_id: string;
|
|
16
|
+
description: string;
|
|
17
|
+
retention_in_days: number;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/snap-audiences/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GQL_ENDPOINT = exports.EXTERNAL_PROVIDER = void 0;
|
|
4
|
+
exports.EXTERNAL_PROVIDER = 'segment_io';
|
|
5
|
+
exports.GQL_ENDPOINT = 'https://api.stackadapt.com/graphql';
|
|
6
|
+
//# sourceMappingURL=common-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-constants.js","sourceRoot":"","sources":["../../../src/destinations/stackadapt-audiences/common-constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,YAAY,CAAA;AAEhC,QAAA,YAAY,GAAG,oCAAoC,CAAA"}
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import { RequestClient } from '@segment/actions-core';
|
|
2
|
-
import { Settings } from './generated-types';
|
|
3
|
-
import type { Payload as AudiencePayload } from './forwardAudienceEvent/generated-types';
|
|
4
|
-
import type { Payload as RegularPayload } from './forwardProfile/generated-types';
|
|
5
|
-
export declare function send(request: RequestClient, payloads: RegularPayload[] | AudiencePayload[], settings: Settings, isAudience: boolean): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
6
1
|
export declare function sha256hash(data: string): string;
|
|
7
|
-
export declare function stringifyJsonWithEscapedQuotes(value: unknown): string;
|
|
8
|
-
export declare function stringifyMappingSchemaForGraphQL(value: unknown): string;
|