@segment/action-destinations 3.421.1-staging-99d4c03ad.0 → 3.421.1-staging-6aa9713b5.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/google-data-manager/constants.d.ts +6 -0
- package/dist/destinations/google-data-manager/constants.js +10 -0
- package/dist/destinations/google-data-manager/constants.js.map +1 -0
- package/dist/destinations/google-data-manager/errors.d.ts +3 -0
- package/dist/destinations/google-data-manager/errors.js +54 -0
- package/dist/destinations/google-data-manager/errors.js.map +1 -0
- package/dist/destinations/google-data-manager/functions.d.ts +6 -0
- package/dist/destinations/google-data-manager/functions.js +85 -0
- package/dist/destinations/google-data-manager/functions.js.map +1 -0
- package/dist/destinations/google-data-manager/generated-types.d.ts +9 -0
- package/dist/destinations/google-data-manager/index.d.ts +3 -3
- package/dist/destinations/google-data-manager/index.js +180 -32
- package/dist/destinations/google-data-manager/index.js.map +1 -1
- package/dist/destinations/google-data-manager/properties.d.ts +12 -0
- package/dist/destinations/google-data-manager/properties.js +104 -0
- package/dist/destinations/google-data-manager/properties.js.map +1 -0
- package/dist/destinations/google-data-manager/shared.d.ts +17 -0
- package/dist/destinations/google-data-manager/shared.js +42 -0
- package/dist/destinations/google-data-manager/shared.js.map +1 -0
- package/dist/destinations/google-data-manager/syncUserData/generated-types.d.ts +11 -0
- package/dist/destinations/google-data-manager/syncUserData/generated-types.js.map +1 -0
- package/dist/destinations/google-data-manager/{remove → syncUserData}/index.d.ts +1 -1
- package/dist/destinations/google-data-manager/syncUserData/index.js +28 -0
- package/dist/destinations/google-data-manager/syncUserData/index.js.map +1 -0
- package/dist/destinations/google-data-manager/types.d.ts +16 -0
- package/dist/destinations/google-data-manager/{remove/generated-types.js → types.js} +1 -1
- package/dist/destinations/google-data-manager/types.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/google-data-manager/ingest/generated-types.d.ts +0 -2
- package/dist/destinations/google-data-manager/ingest/generated-types.js.map +0 -1
- package/dist/destinations/google-data-manager/ingest/index.d.ts +0 -5
- package/dist/destinations/google-data-manager/ingest/index.js +0 -12
- package/dist/destinations/google-data-manager/ingest/index.js.map +0 -1
- package/dist/destinations/google-data-manager/remove/generated-types.d.ts +0 -2
- package/dist/destinations/google-data-manager/remove/generated-types.js.map +0 -1
- package/dist/destinations/google-data-manager/remove/index.js +0 -12
- package/dist/destinations/google-data-manager/remove/index.js.map +0 -1
- /package/dist/destinations/google-data-manager/{ingest → syncUserData}/generated-types.js +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const GOOGLE_API_VERSION = "v2";
|
|
2
|
+
export declare const BASE_URL = "https://audiencepartner.googleapis.com/v2/products/GOOGLE_ADS/customers/advertiserID/";
|
|
3
|
+
export declare const CREATE_AUDIENCE_URL = "https://audiencepartner.googleapis.com/v2/products/GOOGLE_ADS/customers/advertiserID/userLists:mutate";
|
|
4
|
+
export declare const GET_AUDIENCE_URL = "https://audiencepartner.googleapis.com/v2/products/GOOGLE_ADS/customers/advertiserID/audiencePartner:searchStream";
|
|
5
|
+
export declare const OAUTH_URL = "https://accounts.google.com/o/oauth2/token";
|
|
6
|
+
export declare const SEGMENT_DATA_PARTNER_ID = "8152223833";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEGMENT_DATA_PARTNER_ID = exports.OAUTH_URL = exports.GET_AUDIENCE_URL = exports.CREATE_AUDIENCE_URL = exports.BASE_URL = exports.GOOGLE_API_VERSION = void 0;
|
|
4
|
+
exports.GOOGLE_API_VERSION = 'v2';
|
|
5
|
+
exports.BASE_URL = `https://audiencepartner.googleapis.com/${exports.GOOGLE_API_VERSION}/products/GOOGLE_ADS/customers/advertiserID/`;
|
|
6
|
+
exports.CREATE_AUDIENCE_URL = `${exports.BASE_URL}userLists:mutate`;
|
|
7
|
+
exports.GET_AUDIENCE_URL = `${exports.BASE_URL}audiencePartner:searchStream`;
|
|
8
|
+
exports.OAUTH_URL = 'https://accounts.google.com/o/oauth2/token';
|
|
9
|
+
exports.SEGMENT_DATA_PARTNER_ID = '8152223833';
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,IAAI,CAAA;AAGzB,QAAA,QAAQ,GAAG,0CAA0C,0BAAkB,8CAA8C,CAAA;AACrH,QAAA,mBAAmB,GAAG,GAAG,gBAAQ,kBAAkB,CAAA;AACnD,QAAA,gBAAgB,GAAG,GAAG,gBAAQ,8BAA8B,CAAA;AAC5D,QAAA,SAAS,GAAG,4CAA4C,CAAA;AACxD,QAAA,uBAAuB,GAAG,YAAY,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IntegrationError, InvalidAuthenticationError } from '@segment/actions-core';
|
|
2
|
+
import { StatsContext } from '@segment/actions-core/destination-kit';
|
|
3
|
+
export declare const handleRequestError: (error: unknown, statsName: string, statsContext: StatsContext | undefined) => IntegrationError | InvalidAuthenticationError;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRequestError = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const isGoogleAPIError = (error) => {
|
|
6
|
+
if (typeof error === 'object' && error !== null) {
|
|
7
|
+
const e = error;
|
|
8
|
+
return (typeof e.response === 'object' &&
|
|
9
|
+
e.response !== null &&
|
|
10
|
+
typeof e.response.data === 'object' &&
|
|
11
|
+
e.response.data !== null &&
|
|
12
|
+
typeof e.response.data.error === 'object' &&
|
|
13
|
+
e.response.data.error !== null);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
const handleRequestError = (error, statsName, statsContext) => {
|
|
18
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
19
|
+
if (!isGoogleAPIError(error)) {
|
|
20
|
+
if (!error) {
|
|
21
|
+
statsTags?.push('error:unknown');
|
|
22
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
23
|
+
return new actions_core_1.IntegrationError('Unknown error', 'UNKNOWN_ERROR', 500);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const gError = error;
|
|
27
|
+
const code = gError.response?.status;
|
|
28
|
+
const message = gError.response?.data?.error?.message || gError.response?.data?.[0]?.error?.message;
|
|
29
|
+
if (code === 401) {
|
|
30
|
+
statsTags?.push('error:invalid-authentication');
|
|
31
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
32
|
+
return new actions_core_1.InvalidAuthenticationError(message, actions_core_1.ErrorCodes.INVALID_AUTHENTICATION);
|
|
33
|
+
}
|
|
34
|
+
if (code === 403) {
|
|
35
|
+
statsTags?.push('error:forbidden');
|
|
36
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
37
|
+
return new actions_core_1.IntegrationError(message, 'FORBIDDEN', 403);
|
|
38
|
+
}
|
|
39
|
+
if (code === 501) {
|
|
40
|
+
statsTags?.push('error:integration-error');
|
|
41
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
42
|
+
return new actions_core_1.IntegrationError(message, 'INTEGRATION_ERROR', 501);
|
|
43
|
+
}
|
|
44
|
+
if (code === 408 || code === 423 || code === 429 || code >= 500) {
|
|
45
|
+
statsTags?.push('error:retryable-error');
|
|
46
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
47
|
+
return new actions_core_1.IntegrationError(message, 'RETRYABLE_ERROR', code);
|
|
48
|
+
}
|
|
49
|
+
statsTags?.push('error:generic-error');
|
|
50
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
51
|
+
return new actions_core_1.IntegrationError(message, 'INTEGRATION_ERROR', code);
|
|
52
|
+
};
|
|
53
|
+
exports.handleRequestError = handleRequestError;
|
|
54
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/errors.ts"],"names":[],"mappings":";;;AAAA,wDAAgG;AAIhG,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAA2B,EAAE;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,KAAuB,CAAA;QAEjC,OAAO,CACL,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;YAC9B,CAAC,CAAC,QAAQ,KAAK,IAAI;YACnB,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ;YACnC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI;YACxB,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ;YACzC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAC/B,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAGM,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAE,SAAiB,EAAE,YAAsC,EAAE,EAAE;IAC9G,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,YAAY,IAAI,EAAE,CAAA;IAE3D,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;YAChC,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;YACrD,OAAO,IAAI,+BAAgB,CAAC,eAAe,EAAE,eAAe,EAAE,GAAG,CA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E,IAAI,CAAC,uBAAuB,CAAC,CAAA;QACxC,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;QACrD,OAAO,IAAI,+BAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,SAAS,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;IACtC,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;IACrD,OAAO,IAAI,+BAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAA;AACjE,CAAC,CAAA;AA5CY,QAAA,kBAAkB,sBA4C9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import type { Payload } from './syncUserData/generated-types';
|
|
3
|
+
import type { AudienceSettings, Settings } from './generated-types';
|
|
4
|
+
import { AuthTokens } from '@segment/actions-core/destination-kit/parse-settings';
|
|
5
|
+
export declare const verifyCustomerId: (customerId: string | undefined) => string;
|
|
6
|
+
export declare function ingestAudienceMembers(request: RequestClient, settings: Settings, payloads: Payload[], audienceSettings: AudienceSettings, auth?: AuthTokens): Promise<import("@segment/actions-core/src").ModifiedResponse<unknown>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyCustomerId = void 0;
|
|
4
|
+
exports.ingestAudienceMembers = ingestAudienceMembers;
|
|
5
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
+
const hashing_utils_1 = require("../../lib/hashing-utils");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const verifyCustomerId = (customerId) => {
|
|
9
|
+
if (!customerId) {
|
|
10
|
+
throw new actions_core_1.PayloadValidationError('Customer ID is required.');
|
|
11
|
+
}
|
|
12
|
+
return customerId.replace(/-/g, '');
|
|
13
|
+
};
|
|
14
|
+
exports.verifyCustomerId = verifyCustomerId;
|
|
15
|
+
function buildUserIdentifiers(payload) {
|
|
16
|
+
const identifiers = [];
|
|
17
|
+
if (payload.emailAddress) {
|
|
18
|
+
identifiers.push({
|
|
19
|
+
emailAddress: (0, hashing_utils_1.processHashing)(payload.emailAddress, 'sha256', 'hex')
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (payload.phoneNumber) {
|
|
23
|
+
identifiers.push({
|
|
24
|
+
phoneNumber: (0, hashing_utils_1.processHashing)(payload.phoneNumber, 'sha256', 'hex')
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (payload.givenName || payload.familyName || payload.regionCode || payload.postalCode) {
|
|
28
|
+
identifiers.push({
|
|
29
|
+
address: {
|
|
30
|
+
givenName: payload.givenName ? (0, hashing_utils_1.processHashing)(payload.givenName, 'sha256', 'hex') : undefined,
|
|
31
|
+
familyName: payload.familyName ? (0, hashing_utils_1.processHashing)(payload.familyName, 'sha256', 'hex') : undefined,
|
|
32
|
+
regionCode: payload.regionCode,
|
|
33
|
+
postalCode: payload.postalCode
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return identifiers;
|
|
38
|
+
}
|
|
39
|
+
function buildAudienceMember(payload) {
|
|
40
|
+
return {
|
|
41
|
+
consent: {
|
|
42
|
+
adUserData: 'CONSENT_GRANTED',
|
|
43
|
+
adPersonalization: 'CONSENT_GRANTED'
|
|
44
|
+
},
|
|
45
|
+
userData: {
|
|
46
|
+
userIdentifiers: buildUserIdentifiers(payload)
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function ingestAudienceMembers(request, settings, payloads, audienceSettings, auth) {
|
|
51
|
+
const accessToken = auth?.accessToken || '';
|
|
52
|
+
if (!accessToken)
|
|
53
|
+
throw new actions_core_1.IntegrationError('Missing access token.', 'ACCESS_TOKEN_MISSING', 401);
|
|
54
|
+
const body = buildRequestBody(payloads, settings, audienceSettings);
|
|
55
|
+
return request('https://datamanager.googleapis.com/v1/audienceMembers:ingest', {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: {
|
|
58
|
+
Authorization: `Bearer ${accessToken}`,
|
|
59
|
+
Accept: 'application/json',
|
|
60
|
+
'Content-Type': 'application/json'
|
|
61
|
+
},
|
|
62
|
+
json: body
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const buildRequestBody = (payloads, settings, audienceSettings) => ({
|
|
66
|
+
audienceMembers: payloads.map(buildAudienceMember),
|
|
67
|
+
destinations: [
|
|
68
|
+
{
|
|
69
|
+
operatingAccount: {
|
|
70
|
+
accountId: settings.advertiserAccountId,
|
|
71
|
+
product: audienceSettings.product
|
|
72
|
+
},
|
|
73
|
+
loginAccount: {
|
|
74
|
+
accountId: `${constants_1.SEGMENT_DATA_PARTNER_ID}`,
|
|
75
|
+
product: 'DATA_PARTNER'
|
|
76
|
+
},
|
|
77
|
+
productDestinationId: audienceSettings.productDestinationId
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
encoding: 'HEX',
|
|
81
|
+
termsOfService: {
|
|
82
|
+
customerMatchTermsOfServiceStatus: 'ACCEPTED'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/functions.ts"],"names":[],"mappings":";;;AAuDA,sDAmBC;AA1ED,wDAA+F;AAE/F,2DAAwD;AAGxD,2CAAqD;AAE9C,MAAM,gBAAgB,GAAG,CAAC,UAA8B,EAAE,EAAE;IACjE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,qCAAsB,CAAC,0BAA0B,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAA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|
+
advertiserAccountId: string;
|
|
3
|
+
}
|
|
4
|
+
export interface AudienceSettings {
|
|
5
|
+
product: string;
|
|
6
|
+
productDestinationId: string;
|
|
7
|
+
externalIdType?: string;
|
|
8
|
+
app_id?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
membershipDurationDays: string;
|
|
2
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Settings } from './generated-types';
|
|
1
|
+
import { AudienceDestinationDefinition } from '@segment/actions-core';
|
|
2
|
+
import type { AudienceSettings, Settings } from './generated-types';
|
|
3
3
|
export interface RefreshTokenResponse {
|
|
4
4
|
access_token: string;
|
|
5
5
|
scope: string;
|
|
6
6
|
expires_in: number;
|
|
7
7
|
token_type: string;
|
|
8
8
|
}
|
|
9
|
-
declare const destination: AudienceDestinationDefinition<Settings>;
|
|
9
|
+
declare const destination: AudienceDestinationDefinition<Settings, AudienceSettings>;
|
|
10
10
|
export default destination;
|
|
@@ -3,56 +3,204 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const syncUserData_1 = __importDefault(require("./syncUserData"));
|
|
8
|
+
const shared_1 = require("./shared");
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
11
|
+
const functions_1 = require("./functions");
|
|
12
|
+
const testAuthUrl = `https://audiencepartner.googleapis.com/v2/products/DATA_PARTNER/customers/${constants_1.SEGMENT_DATA_PARTNER_ID}/audiencePartner:searchStream`;
|
|
13
|
+
const audienceFields = {
|
|
14
|
+
product: {
|
|
15
|
+
label: 'Product',
|
|
16
|
+
description: 'The product for which you want to create or manage audiences.',
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true,
|
|
19
|
+
choices: [
|
|
20
|
+
{ label: 'Google Ads', value: 'GOOGLE_ADS' },
|
|
21
|
+
{ label: 'Display & Video 360', value: 'DISPLAY_VIDEO_ADVERTISER' }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
productDestinationId: {
|
|
25
|
+
label: 'Product Destination ID',
|
|
26
|
+
description: 'The ID of the product destination, used to identify the specific destination for audience management.',
|
|
27
|
+
type: 'string',
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
externalIdType: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
label: 'External ID Type',
|
|
33
|
+
description: 'Customer match upload key types. Required if you are using UserLists. Not used by the other actions.',
|
|
34
|
+
choices: [
|
|
35
|
+
{ label: 'CONTACT INFO', value: 'CONTACT_INFO' },
|
|
36
|
+
{ label: 'CRM ID', value: 'CRM_ID' },
|
|
37
|
+
{ label: 'MOBILE ADVERTISING ID', value: 'MOBILE_ADVERTISING_ID' }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
app_id: {
|
|
41
|
+
label: 'App ID',
|
|
42
|
+
description: 'A string that uniquely identifies a mobile application from which the data was collected. Required if external ID type is mobile advertising ID',
|
|
43
|
+
type: 'string',
|
|
44
|
+
depends_on: {
|
|
45
|
+
match: 'all',
|
|
46
|
+
conditions: [
|
|
47
|
+
{
|
|
48
|
+
fieldKey: 'external_id_type',
|
|
49
|
+
operator: 'is',
|
|
50
|
+
value: 'MOBILE_ADVERTISING_ID'
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
description: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
label: 'Description',
|
|
58
|
+
required: false,
|
|
59
|
+
description: 'The description of the audience.'
|
|
60
|
+
},
|
|
61
|
+
membershipDurationDays: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
label: 'Membership Duration Days',
|
|
64
|
+
required: true,
|
|
65
|
+
description: 'The duration in days that an entry remains in the audience after the qualifying event. If the audience has no expiration, set the value of this field to 10000. Otherwise, the set value must be greater than 0 and less than or equal to 540.'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
8
68
|
const destination = {
|
|
9
69
|
name: 'Google Data Manager',
|
|
10
70
|
slug: 'actions-google-data-manager',
|
|
11
71
|
mode: 'cloud',
|
|
12
72
|
authentication: {
|
|
13
73
|
scheme: 'oauth2',
|
|
14
|
-
fields: {
|
|
15
|
-
|
|
74
|
+
fields: {
|
|
75
|
+
advertiserAccountId: {
|
|
76
|
+
label: 'Advertiser Account ID',
|
|
77
|
+
description: 'The ID of the advertiser in Google Product.',
|
|
78
|
+
type: 'string',
|
|
79
|
+
required: true
|
|
80
|
+
}
|
|
16
81
|
},
|
|
17
|
-
|
|
18
|
-
const
|
|
82
|
+
testAuthentication: async (request, { auth, settings }) => {
|
|
83
|
+
const accessToken = auth.accessToken;
|
|
84
|
+
if (!accessToken)
|
|
85
|
+
throw new Error('Missing access token for authentication test.');
|
|
86
|
+
const response = await request(testAuthUrl, {
|
|
19
87
|
method: 'POST',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
88
|
+
headers: {
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
Authorization: `Bearer ${accessToken}`,
|
|
91
|
+
'login-customer-id': settings.advertiserAccountId
|
|
92
|
+
},
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
query: `SELECT product_link.google_ads.google_ads_customer FROM product_link WHERE product_link.google_ads.google_ads_customer = 'products/GOOGLE_ADS/customers/${settings.advertiserAccountId}'`
|
|
25
95
|
})
|
|
26
96
|
});
|
|
27
|
-
|
|
97
|
+
if (response.status < 200 || response.status >= 300)
|
|
98
|
+
throw new Error('Authentication failed: ' + response.statusText);
|
|
99
|
+
return response;
|
|
100
|
+
},
|
|
101
|
+
refreshAccessToken: async (request, { auth }) => {
|
|
102
|
+
const res = await refreshAccessTokenRequest(request, auth);
|
|
103
|
+
const data = await res.json();
|
|
104
|
+
return { accessToken: data.access_token };
|
|
28
105
|
}
|
|
29
106
|
},
|
|
30
107
|
extendRequest({ auth }) {
|
|
31
|
-
return {
|
|
32
|
-
headers: {
|
|
33
|
-
authorization: `Bearer ${auth?.accessToken}`
|
|
34
|
-
}
|
|
35
|
-
};
|
|
108
|
+
return { headers: { authorization: `Bearer ${auth?.accessToken}` } };
|
|
36
109
|
},
|
|
37
|
-
|
|
110
|
+
actions: { syncUserData: syncUserData_1.default },
|
|
38
111
|
audienceConfig: {
|
|
39
|
-
mode: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
112
|
+
mode: { type: 'synced', full_audience_sync: false },
|
|
113
|
+
async createAudience(request, { audienceName, settings, statsContext, audienceSettings }) {
|
|
114
|
+
const advertiserId = settings?.advertiserAccountId.trim();
|
|
115
|
+
const { statsClient, tags: statsTags = [] } = statsContext || {};
|
|
116
|
+
const statsName = 'createAudience';
|
|
117
|
+
statsTags.push(`slug:${destination.slug}`);
|
|
118
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
119
|
+
if (!audienceName) {
|
|
120
|
+
statsTags.push('error:missing-settings');
|
|
121
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
122
|
+
throw new actions_core_1.IntegrationError('Missing audience name value', 'MISSING_REQUIRED_FIELD', 400);
|
|
123
|
+
}
|
|
124
|
+
(0, functions_1.verifyCustomerId)(advertiserId);
|
|
125
|
+
const partnerCreateAudienceUrl = constants_1.CREATE_AUDIENCE_URL.replace('advertiserID', advertiserId);
|
|
126
|
+
const listTypeMap = { basicUserList: {}, type: 'REMARKETING', membershipStatus: 'OPEN' };
|
|
127
|
+
try {
|
|
128
|
+
const authToken = await (0, shared_1.getAuthToken)(request, (0, shared_1.getAuthSettings)());
|
|
129
|
+
const response = await request(partnerCreateAudienceUrl, {
|
|
130
|
+
headers: (0, shared_1.buildHeaders)(audienceSettings, settings, authToken),
|
|
131
|
+
method: 'POST',
|
|
132
|
+
json: {
|
|
133
|
+
operations: [
|
|
134
|
+
{
|
|
135
|
+
create: {
|
|
136
|
+
...listTypeMap,
|
|
137
|
+
name: audienceName,
|
|
138
|
+
description: audienceSettings?.description || 'Created by Segment',
|
|
139
|
+
membershipLifeSpan: audienceSettings?.membershipDurationDays
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const r = await response?.json();
|
|
146
|
+
statsClient?.incr(`${statsName}.success`, 1, statsTags);
|
|
147
|
+
return { externalId: r['results'][0]['resourceName'] };
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
throw (0, errors_1.handleRequestError)(error, statsName, statsContext);
|
|
151
|
+
}
|
|
45
152
|
},
|
|
46
|
-
|
|
47
|
-
|
|
153
|
+
async getAudience(request, { statsContext, settings, audienceSettings, externalId }) {
|
|
154
|
+
const { statsClient, tags: statsTags = [] } = statsContext || {};
|
|
155
|
+
const advertiserId = settings?.advertiserAccountId?.trim();
|
|
156
|
+
const statsName = 'getAudience';
|
|
157
|
+
statsTags.push(`slug:${destination.slug}`);
|
|
158
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
159
|
+
if (!advertiserId) {
|
|
160
|
+
statsTags.push('error:missing-settings');
|
|
161
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
162
|
+
throw new actions_core_1.IntegrationError('Missing required advertiser ID value', 'MISSING_REQUIRED_FIELD', 400);
|
|
163
|
+
}
|
|
164
|
+
const advertiserGetAudienceUrl = constants_1.GET_AUDIENCE_URL.replace('advertiserID', advertiserId);
|
|
165
|
+
try {
|
|
166
|
+
const authToken = await (0, shared_1.getAuthToken)(request, (0, shared_1.getAuthSettings)());
|
|
167
|
+
const response = await request(advertiserGetAudienceUrl, {
|
|
168
|
+
headers: (0, shared_1.buildHeaders)(audienceSettings, settings, authToken),
|
|
169
|
+
method: 'POST',
|
|
170
|
+
json: {
|
|
171
|
+
query: `SELECT user_list.name, user_list.description, user_list.membership_status, user_list.match_rate_percentage FROM user_list WHERE user_list.resource_name = "${externalId}"`
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const r = await response.json();
|
|
175
|
+
const foundId = r[0]?.results[0]?.userList?.resourceName;
|
|
176
|
+
if (foundId !== externalId) {
|
|
177
|
+
statsTags.push('error:id-mismatch');
|
|
178
|
+
statsClient?.incr(`${statsName}.error`, 1, statsTags);
|
|
179
|
+
throw new actions_core_1.IntegrationError("Unable to verify ownership over audience. Segment Audience ID doesn't match Google's Audience ID.", 'INVALID_REQUEST_DATA', 400);
|
|
180
|
+
}
|
|
181
|
+
statsClient?.incr(`${statsName}.success`, 1, statsTags);
|
|
182
|
+
return { externalId: foundId };
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (error instanceof actions_core_1.IntegrationError) {
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
throw (0, errors_1.handleRequestError)(error, statsName, statsContext);
|
|
189
|
+
}
|
|
48
190
|
}
|
|
49
191
|
},
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
actions: {
|
|
53
|
-
ingest: ingest_1.default,
|
|
54
|
-
remove: remove_1.default
|
|
55
|
-
}
|
|
192
|
+
audienceFields
|
|
56
193
|
};
|
|
194
|
+
function refreshAccessTokenRequest(request, auth) {
|
|
195
|
+
return request('https://www.googleapis.com/oauth2/v4/token', {
|
|
196
|
+
method: 'POST',
|
|
197
|
+
body: new URLSearchParams({
|
|
198
|
+
refresh_token: auth.refreshToken,
|
|
199
|
+
client_id: auth.clientId,
|
|
200
|
+
client_secret: auth.clientSecret,
|
|
201
|
+
grant_type: 'refresh_token'
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
}
|
|
57
205
|
exports.default = destination;
|
|
58
206
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAAqH;AAErH,kEAAyC;AACzC,qCAAsE;AACtE,2CAA4F;AAC5F,qCAA6C;AAC7C,2CAA8C;AAS9C,MAAM,WAAW,GAAG,6EAA6E,mCAAuB,+BAA+B,CAAA;AAEvJ,MAAM,cAAc,GAAkC;IACpD,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,+DAA+D;QAC5E,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;YAC5C,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,0BAA0B,EAAE;SACpE;KACF;IACD,oBAAoB,EAAE;QACpB,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,uGAAuG;QACzG,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE;QACd,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,sGAAsG;QACnH,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;YAChD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;YACpC,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,uBAAuB,EAAE;SACnE;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,iJAAiJ;QACnJ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,kBAAkB;oBAC5B,QAAQ,E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AW,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core';
|
|
2
|
+
export declare const external_id: InputField;
|
|
3
|
+
export declare const advertiser_id: InputField;
|
|
4
|
+
export declare const emailAddress: InputField;
|
|
5
|
+
export declare const phoneNumber: InputField;
|
|
6
|
+
export declare const postalCode: InputField;
|
|
7
|
+
export declare const givenName: InputField;
|
|
8
|
+
export declare const familyName: InputField;
|
|
9
|
+
export declare const countryCode: InputField;
|
|
10
|
+
export declare const mobileDeviceIds: InputField;
|
|
11
|
+
export declare const enable_batching: InputField;
|
|
12
|
+
export declare const batch_size: InputField;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.batch_size = exports.enable_batching = exports.mobileDeviceIds = exports.countryCode = exports.familyName = exports.givenName = exports.postalCode = exports.phoneNumber = exports.emailAddress = exports.advertiser_id = exports.external_id = void 0;
|
|
4
|
+
exports.external_id = {
|
|
5
|
+
label: 'External ID',
|
|
6
|
+
description: 'The ID of the Audience.',
|
|
7
|
+
type: 'string',
|
|
8
|
+
default: {
|
|
9
|
+
'@path': '$.context.personas.external_audience_id'
|
|
10
|
+
},
|
|
11
|
+
unsafe_hidden: true
|
|
12
|
+
};
|
|
13
|
+
exports.advertiser_id = {
|
|
14
|
+
label: 'Advertiser ID',
|
|
15
|
+
description: 'The Advertiser ID associated with the DV360 Audience.',
|
|
16
|
+
type: 'string',
|
|
17
|
+
default: {
|
|
18
|
+
'@path': '$.context.personas.audience_settings.advertiserId'
|
|
19
|
+
},
|
|
20
|
+
unsafe_hidden: true
|
|
21
|
+
};
|
|
22
|
+
const atLeastOneIdentifierRequired = {
|
|
23
|
+
match: 'any',
|
|
24
|
+
conditions: [
|
|
25
|
+
{ operator: 'is_not', fieldKey: 'emailAddress', value: undefined },
|
|
26
|
+
{ operator: 'is_not', fieldKey: 'phoneNumber', value: undefined },
|
|
27
|
+
{ operator: 'is_not', fieldKey: 'givenName', value: undefined },
|
|
28
|
+
{ operator: 'is_not', fieldKey: 'familyName', value: undefined },
|
|
29
|
+
{ operator: 'is_not', fieldKey: 'regionCode', value: undefined },
|
|
30
|
+
{ operator: 'is_not', fieldKey: 'postalCode', value: undefined }
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
exports.emailAddress = {
|
|
34
|
+
label: 'Email Address',
|
|
35
|
+
description: 'The email address of the audience member.',
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: atLeastOneIdentifierRequired,
|
|
38
|
+
default: { '@path': '$.traits.email' },
|
|
39
|
+
category: 'hashedPII'
|
|
40
|
+
};
|
|
41
|
+
exports.phoneNumber = {
|
|
42
|
+
label: 'Phone Number',
|
|
43
|
+
description: 'The phone number of the audience member.',
|
|
44
|
+
type: 'string',
|
|
45
|
+
required: atLeastOneIdentifierRequired,
|
|
46
|
+
default: { '@path': '$.traits.phone' },
|
|
47
|
+
category: 'hashedPII'
|
|
48
|
+
};
|
|
49
|
+
exports.postalCode = {
|
|
50
|
+
label: 'Postal Code',
|
|
51
|
+
description: 'The postal code of the audience member.',
|
|
52
|
+
type: 'string',
|
|
53
|
+
required: atLeastOneIdentifierRequired,
|
|
54
|
+
default: { '@path': '$.traits.postalCode' }
|
|
55
|
+
};
|
|
56
|
+
exports.givenName = {
|
|
57
|
+
label: 'Given Name',
|
|
58
|
+
description: 'The given name (first name) of the audience member.',
|
|
59
|
+
type: 'string',
|
|
60
|
+
required: atLeastOneIdentifierRequired,
|
|
61
|
+
default: { '@path': '$.traits.firstName' },
|
|
62
|
+
category: 'hashedPII'
|
|
63
|
+
};
|
|
64
|
+
exports.familyName = {
|
|
65
|
+
label: 'Family Name',
|
|
66
|
+
description: 'The family name (last name) of the audience member.',
|
|
67
|
+
type: 'string',
|
|
68
|
+
required: atLeastOneIdentifierRequired,
|
|
69
|
+
default: { '@path': '$.traits.lastName' },
|
|
70
|
+
category: 'hashedPII'
|
|
71
|
+
};
|
|
72
|
+
exports.countryCode = {
|
|
73
|
+
label: 'Country Code',
|
|
74
|
+
description: `The country code of the user.`,
|
|
75
|
+
type: 'string',
|
|
76
|
+
default: {
|
|
77
|
+
'@path': '$.context.traits.countryCode'
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.mobileDeviceIds = {
|
|
81
|
+
label: 'Mobile Device IDs',
|
|
82
|
+
description: `A list of mobile device IDs defining Customer Match audience members. The size of mobileDeviceIds mustn't be greater than 500,000.`,
|
|
83
|
+
type: 'string',
|
|
84
|
+
default: {
|
|
85
|
+
'@path': '$.context.traits.mobileDeviceIds'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.enable_batching = {
|
|
89
|
+
label: 'Enable Batching',
|
|
90
|
+
description: 'Enable batching of requests.',
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
default: true,
|
|
93
|
+
unsafe_hidden: true,
|
|
94
|
+
required: true
|
|
95
|
+
};
|
|
96
|
+
exports.batch_size = {
|
|
97
|
+
label: 'Batch Size',
|
|
98
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
99
|
+
type: 'number',
|
|
100
|
+
default: 10000,
|
|
101
|
+
unsafe_hidden: true,
|
|
102
|
+
required: true
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/properties.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAe;IACrC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,yBAAyB;IACtC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,OAAO,EAAE,yCAAyC;KACnD;IACD,aAAa,EAAE,IAAI;CACpB,CAAA;AAEY,QAAA,aAAa,GAAe;IACvC,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,uDAAuD;IACpE,IAAI,EAAE,Q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@@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import type { AudienceSettings, Settings } from './generated-types';
|
|
3
|
+
type AuthCredentials = {
|
|
4
|
+
refresh_token: string;
|
|
5
|
+
access_token: string;
|
|
6
|
+
client_id: string;
|
|
7
|
+
client_secret: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const getAuthSettings: () => AuthCredentials;
|
|
10
|
+
export declare const getAuthToken: (request: RequestClient, settings: AuthCredentials) => Promise<string>;
|
|
11
|
+
export declare const buildHeaders: (audienceSettings: AudienceSettings | undefined, settings: Settings | undefined, accessToken: string) => {
|
|
12
|
+
Authorization: string;
|
|
13
|
+
'Content-Type': string;
|
|
14
|
+
'login-customer-Id': string;
|
|
15
|
+
'linked-customer-id': string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildHeaders = exports.getAuthToken = exports.getAuthSettings = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const getAuthSettings = () => {
|
|
7
|
+
return {
|
|
8
|
+
refresh_token: process.env.ACTIONS_GOOGLE_DATA_MANAGER_REFRESH_TOKEN,
|
|
9
|
+
client_id: process.env.ACTIONS_GOOGLE_DATA_MANAGER_CLIENT_ID,
|
|
10
|
+
client_secret: process.env.ACTIONS_GOOGLE_DATA_MANAGER_CLIENT_SECRET
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.getAuthSettings = getAuthSettings;
|
|
14
|
+
const getAuthToken = async (request, settings) => {
|
|
15
|
+
if (!settings.refresh_token) {
|
|
16
|
+
throw new actions_core_1.IntegrationError('Refresh token is missing', 'INVALID_REQUEST_DATA', 400);
|
|
17
|
+
}
|
|
18
|
+
const { data } = await request(constants_1.OAUTH_URL, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: new URLSearchParams({
|
|
21
|
+
refresh_token: settings.refresh_token,
|
|
22
|
+
client_id: settings.client_id,
|
|
23
|
+
client_secret: settings.client_secret,
|
|
24
|
+
grant_type: 'refresh_token'
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
return data.access_token;
|
|
28
|
+
};
|
|
29
|
+
exports.getAuthToken = getAuthToken;
|
|
30
|
+
const buildHeaders = (audienceSettings, settings, accessToken) => {
|
|
31
|
+
if (!audienceSettings || !accessToken || !settings) {
|
|
32
|
+
throw new actions_core_1.IntegrationError('Bad Request', 'INVALID_REQUEST_DATA', 400);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
Authorization: `Bearer ${accessToken}`,
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
'login-customer-Id': `products/DATA_PARTNER/customers/${constants_1.SEGMENT_DATA_PARTNER_ID}`,
|
|
38
|
+
'linked-customer-id': settings?.advertiserAccountId
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.buildHeaders = buildHeaders;
|
|
42
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/shared.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AACvE,2CAAgE;AAOzD,MAAM,eAAe,GAAG,GAAoB,EAAE;IACnD,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,yCAAyC;QACpE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qCAAqC;QAC5D,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,yCAAyC;KAClD,CAAA;AACtB,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B;AAKM,MAAM,YAAY,GAAG,KAAK,EAAE,OAAsB,EAAE,QAAyB,EAAE,EAAE;IACtF,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,IAAI,+BAAgB,CAAC,0BAA0B,EAAE,sBAAsB,EAAE,GAAG,CAAC,CAAA;IACrF,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAuB,qBAAS,EAAE;QAC9D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,eAAe,CAAC;YACxB,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,UAAU,EAAE,eAAe;SAC5B,CAAC;KACH,CAAC,CAAA;IAEF,OAAO,IAAI,CAAC,YAAY,CAAA;AAC1B,CAAC,CAAA;AAhBY,QAAA,YAAY,gBAgBxB;AAEM,MAAM,YAAY,GAAG,CAC1B,gBAA8C,EAC9C,QAA8B,EAC9B,WAAmB,EACnB,EAAE;IACF,IAAI,CAAC,gBAAgB,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,+BAAgB,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG,CAAC,CAAA;IACxE,CAAC;IAED,OAAO;QACL,aAAa,EAAE,UAAU,WAAW,EAAE;QACtC,cAAc,EAAE,kBAAkB;QAClC,mBAAmB,EAAE,mCAAmC,mCAAuB,EAAE;QACjF,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB;KACpD,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/syncUserData/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
4
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const functions_1 = require("../functions");
|
|
4
|
+
const properties_1 = require("../properties");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Sync User Data',
|
|
7
|
+
description: 'Uploads a list of AudienceMember User Data resources to the provided Destination.',
|
|
8
|
+
defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
|
|
9
|
+
fields: {
|
|
10
|
+
emailAddress: { ...properties_1.emailAddress },
|
|
11
|
+
phoneNumber: { ...properties_1.phoneNumber },
|
|
12
|
+
givenName: { ...properties_1.givenName },
|
|
13
|
+
familyName: { ...properties_1.familyName },
|
|
14
|
+
regionCode: { ...properties_1.countryCode },
|
|
15
|
+
postalCode: { ...properties_1.postalCode },
|
|
16
|
+
audienceId: { ...properties_1.external_id },
|
|
17
|
+
enable_batching: { ...properties_1.enable_batching },
|
|
18
|
+
batch_size: { ...properties_1.batch_size }
|
|
19
|
+
},
|
|
20
|
+
perform: async (request, { settings, payload, audienceSettings, auth }) => {
|
|
21
|
+
return await (0, functions_1.ingestAudienceMembers)(request, settings, [payload], audienceSettings, auth);
|
|
22
|
+
},
|
|
23
|
+
performBatch: async (request, { settings, payload, audienceSettings, auth }) => {
|
|
24
|
+
return await (0, functions_1.ingestAudienceMembers)(request, settings, payload, audienceSettings, auth);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.default = action;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/syncUserData/index.ts"],"names":[],"mappings":";;AAGA,4CAAoD;AACpD,8CAUsB;AAEtB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,mFAAmF;IAChG,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,YAAY,EAAE,EAAE,GAAG,yBAAY,EAAE;QACjC,WAAW,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC/B,SAAS,EAAE,EAAE,GAAG,sBAAS,EAAE;QAC3B,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,UAAU,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC9B,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;QAC7B,UAAU,EAAE,EAAE,GAAG,wBAAW,EAAE;QAC9B,eAAe,EAAE,EAAE,GAAG,4BAAe,EAAE;QACvC,UAAU,EAAE,EAAE,GAAG,uBAAU,EAAE;KAC9B;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE;QACxE,OAAO,MAAM,IAAA,iCAAqB,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAA;IAC1F,CAAC;IAED,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,EAAE;QAC7E,OAAO,MAAM,IAAA,iCAAqB,EAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAA;IACxF,CAAC;CACF,CAAA;AACD,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface RefreshTokenResponse {
|
|
2
|
+
access_token: string;
|
|
3
|
+
scope: string;
|
|
4
|
+
expires_in: number;
|
|
5
|
+
token_type: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GoogleAPIError {
|
|
8
|
+
response: {
|
|
9
|
+
status: number;
|
|
10
|
+
data: {
|
|
11
|
+
error: {
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/google-data-manager/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.421.1-staging-
|
|
4
|
+
"version": "3.421.1-staging-6aa9713b5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"__tests__/__helpers__/"
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "dd47f1e671a210af38e7fbc9b03a33d94b1e165f"
|
|
95
95
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/ingest/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const action = {
|
|
4
|
-
title: 'Ingest',
|
|
5
|
-
description: 'Ingest data into Google Data Manager.',
|
|
6
|
-
fields: {},
|
|
7
|
-
perform: async (_request, _data) => {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
exports.default = action;
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/ingest/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QAMjC,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/remove/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const action = {
|
|
4
|
-
title: 'Remove',
|
|
5
|
-
description: 'Remove data from Google Data Manager.',
|
|
6
|
-
fields: {},
|
|
7
|
-
perform: async (_request, _data) => {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
exports.default = action;
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-data-manager/remove/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QAMjC,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
File without changes
|