@segment/action-destinations 3.251.0 → 3.251.1-staging
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/engage/sendgrid/Profile.d.ts +6 -0
- package/dist/destinations/engage/sendgrid/Profile.js +3 -0
- package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +21 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +174 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js +19 -11
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js.map +1 -1
- package/dist/destinations/engage/utils/track.d.ts +17 -17
- package/dist/destinations/klaviyo/index.js +1 -1
- package/dist/destinations/klaviyo/properties.js +1 -1
- package/dist/destinations/linkedin-conversions/api/api.test.js +32 -14
- package/dist/destinations/linkedin-conversions/api/api.test.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.d.ts +8 -6
- package/dist/destinations/linkedin-conversions/api/index.js +66 -17
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.d.ts +7 -0
- package/dist/destinations/linkedin-conversions/constants.js +45 -1
- package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +6 -2
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +74 -43
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/types.d.ts +5 -0
- package/dist/destinations/marketo-static-lists/addToList/generated-types.d.ts +13 -1
- package/dist/destinations/marketo-static-lists/addToList/index.js +69 -2
- package/dist/destinations/marketo-static-lists/addToList/index.js.map +1 -1
- package/dist/destinations/marketo-static-lists/constants.d.ts +10 -3
- package/dist/destinations/marketo-static-lists/constants.js +2 -14
- package/dist/destinations/marketo-static-lists/constants.js.map +1 -1
- package/dist/destinations/marketo-static-lists/functions.d.ts +18 -1
- package/dist/destinations/marketo-static-lists/functions.js +87 -1
- package/dist/destinations/marketo-static-lists/functions.js.map +1 -1
- package/dist/destinations/marketo-static-lists/index.js +4 -42
- package/dist/destinations/marketo-static-lists/index.js.map +1 -1
- package/dist/destinations/marketo-static-lists/properties.js +1 -2
- package/dist/destinations/marketo-static-lists/properties.js.map +1 -1
- package/dist/destinations/marketo-static-lists/removeFromList/generated-types.d.ts +1 -1
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/dist/destinations/moloco-rmp/addToCart/generated-types.d.ts +28 -0
- package/dist/destinations/moloco-rmp/addToCart/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/addToCart/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/addToCart/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/addToCart/index.js +44 -0
- package/dist/destinations/moloco-rmp/addToCart/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/addToWishlist/generated-types.d.ts +32 -0
- package/dist/destinations/moloco-rmp/addToWishlist/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/addToWishlist/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/addToWishlist/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/addToWishlist/index.js +45 -0
- package/dist/destinations/moloco-rmp/addToWishlist/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/convert.d.ts +9 -0
- package/dist/destinations/moloco-rmp/common/convert.js +83 -0
- package/dist/destinations/moloco-rmp/common/convert.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/event.d.ts +10 -0
- package/dist/destinations/moloco-rmp/common/event.js +15 -0
- package/dist/destinations/moloco-rmp/common/event.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/fields.d.ts +14 -0
- package/dist/destinations/moloco-rmp/common/fields.js +348 -0
- package/dist/destinations/moloco-rmp/common/fields.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/payload/moloco.d.ts +35 -0
- package/dist/destinations/moloco-rmp/common/payload/moloco.js +3 -0
- package/dist/destinations/moloco-rmp/common/payload/moloco.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/payload/segment.d.ts +40 -0
- package/dist/destinations/moloco-rmp/common/payload/segment.js +3 -0
- package/dist/destinations/moloco-rmp/common/payload/segment.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/request-client.d.ts +11 -0
- package/dist/destinations/moloco-rmp/common/request-client.js +28 -0
- package/dist/destinations/moloco-rmp/common/request-client.js.map +1 -0
- package/dist/destinations/moloco-rmp/common/settings.d.ts +4 -0
- package/dist/destinations/moloco-rmp/common/settings.js +3 -0
- package/dist/destinations/moloco-rmp/common/settings.js.map +1 -0
- package/dist/destinations/moloco-rmp/generated-types.d.ts +5 -0
- package/dist/destinations/moloco-rmp/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/home/generated-types.d.ts +28 -0
- package/dist/destinations/moloco-rmp/home/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/home/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/home/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/home/index.js +29 -0
- package/dist/destinations/moloco-rmp/home/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/index.d.ts +4 -0
- package/dist/destinations/moloco-rmp/index.js +117 -0
- package/dist/destinations/moloco-rmp/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/itemPageView/generated-types.d.ts +28 -0
- package/dist/destinations/moloco-rmp/itemPageView/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/itemPageView/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/itemPageView/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/itemPageView/index.js +44 -0
- package/dist/destinations/moloco-rmp/itemPageView/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/land/generated-types.d.ts +29 -0
- package/dist/destinations/moloco-rmp/land/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/land/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/land/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/land/index.js +33 -0
- package/dist/destinations/moloco-rmp/land/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/pageView/generated-types.d.ts +29 -0
- package/dist/destinations/moloco-rmp/pageView/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/pageView/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/pageView/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/pageView/index.js +36 -0
- package/dist/destinations/moloco-rmp/pageView/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/purchase/generated-types.d.ts +36 -0
- package/dist/destinations/moloco-rmp/purchase/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/purchase/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/purchase/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/purchase/index.js +37 -0
- package/dist/destinations/moloco-rmp/purchase/index.js.map +1 -0
- package/dist/destinations/moloco-rmp/search/generated-types.d.ts +30 -0
- package/dist/destinations/moloco-rmp/search/generated-types.js +3 -0
- package/dist/destinations/moloco-rmp/search/generated-types.js.map +1 -0
- package/dist/destinations/moloco-rmp/search/index.d.ts +5 -0
- package/dist/destinations/moloco-rmp/search/index.js +34 -0
- package/dist/destinations/moloco-rmp/search/index.js.map +1 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +3 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
- package/dist/destinations/responsys/index.d.ts +1 -1
- package/dist/destinations/responsys/index.js +12 -2
- package/dist/destinations/responsys/index.js.map +1 -1
- package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
- package/dist/destinations/responsys/rsp-operations.js +33 -0
- package/dist/destinations/responsys/rsp-operations.js.map +1 -0
- package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
- package/dist/destinations/responsys/rsp-properties.js +27 -0
- package/dist/destinations/responsys/rsp-properties.js.map +1 -0
- package/dist/destinations/responsys/sendAudience/generated-types.d.ts +2 -0
- package/dist/destinations/responsys/sendAudience/index.js +25 -6
- package/dist/destinations/responsys/sendAudience/index.js.map +1 -1
- package/dist/destinations/responsys/sendCustomTraits/generated-types.d.ts +2 -0
- package/dist/destinations/responsys/sendCustomTraits/index.js +25 -6
- package/dist/destinations/responsys/sendCustomTraits/index.js.map +1 -1
- package/dist/destinations/responsys/upsertListMember/generated-types.d.ts +1 -0
- package/dist/destinations/responsys/upsertListMember/index.js +8 -1
- package/dist/destinations/responsys/upsertListMember/index.js.map +1 -1
- package/dist/destinations/responsys/utils.d.ts +3 -1
- package/dist/destinations/responsys/utils.js +23 -7
- package/dist/destinations/responsys/utils.js.map +1 -1
- package/dist/destinations/segment-profiles/index.js +3 -1
- package/dist/destinations/segment-profiles/index.js.map +1 -1
- package/dist/destinations/segment-profiles/segment-properties.d.ts +2 -0
- package/dist/destinations/segment-profiles/segment-properties.js +14 -1
- package/dist/destinations/segment-profiles/segment-properties.js.map +1 -1
- package/dist/destinations/segment-profiles/sendTrack/generated-types.d.ts +11 -0
- package/dist/destinations/segment-profiles/sendTrack/generated-types.js +3 -0
- package/dist/destinations/segment-profiles/sendTrack/generated-types.js.map +1 -0
- package/dist/destinations/segment-profiles/sendTrack/index.d.ts +5 -0
- package/dist/destinations/segment-profiles/sendTrack/index.js +42 -0
- package/dist/destinations/segment-profiles/sendTrack/index.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/Profile.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core';
|
|
2
|
+
import { RequestClient } from '@segment/actions-core';
|
|
3
|
+
import { Logger, StatsClient, DataFeedCache } from '@segment/actions-core/destination-kit';
|
|
4
|
+
import type { Settings } from '../generated-types';
|
|
5
|
+
import { Profile } from '../Profile';
|
|
6
|
+
export declare type ApiLookupConfig = {
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
method: string;
|
|
11
|
+
cacheTtl: number;
|
|
12
|
+
body?: string | undefined;
|
|
13
|
+
headers?: object | undefined;
|
|
14
|
+
responseType: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const getRequestId: ({ method, url, body, headers }: ApiLookupConfig) => string;
|
|
17
|
+
export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
|
|
18
|
+
export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
|
|
19
|
+
export declare const apiLookupActionFields: Record<string, InputField>;
|
|
20
|
+
export declare const apiLookupLiquidKey = "lookups";
|
|
21
|
+
export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FLAGON_NAME_DATA_FEEDS = exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = exports.getCachedResponse = exports.getRequestId = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
+
const liquidjs_1 = require("liquidjs");
|
|
7
|
+
const Liquid = new liquidjs_1.Liquid();
|
|
8
|
+
const maxResponseSizeBytes = 1000000;
|
|
9
|
+
const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
|
|
10
|
+
let renderedUrl;
|
|
11
|
+
let renderedBody;
|
|
12
|
+
try {
|
|
13
|
+
renderedUrl = await Liquid.parseAndRender(url, { profile });
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
logger?.error(`TE Messaging: Email datafeed url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
17
|
+
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:url');
|
|
18
|
+
throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
logger?.error(`TE Messaging: Email datafeed body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
25
|
+
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:rendering_failure', 'rendering:body');
|
|
26
|
+
throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
renderedUrl,
|
|
30
|
+
renderedBody
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const getRequestId = ({ method, url, body, headers }) => {
|
|
34
|
+
const requestHash = crypto_1.createHash('sha256');
|
|
35
|
+
requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
|
|
36
|
+
const requestId = requestHash.digest('hex');
|
|
37
|
+
return requestId;
|
|
38
|
+
};
|
|
39
|
+
exports.getRequestId = getRequestId;
|
|
40
|
+
const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
|
|
41
|
+
const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
|
|
42
|
+
if (!cachedResponse) {
|
|
43
|
+
datafeedTags.push('cache_hit:false');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
datafeedTags.push('cache_hit:true');
|
|
47
|
+
if (responseType === 'json') {
|
|
48
|
+
return JSON.parse(cachedResponse);
|
|
49
|
+
}
|
|
50
|
+
return cachedResponse;
|
|
51
|
+
};
|
|
52
|
+
exports.getCachedResponse = getCachedResponse;
|
|
53
|
+
const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
|
|
54
|
+
const { id, method, headers, cacheTtl, name } = apiLookupConfig;
|
|
55
|
+
const datafeedTags = [
|
|
56
|
+
...tags,
|
|
57
|
+
`datafeed_id:${id}`,
|
|
58
|
+
`datafeed_name:${name}`,
|
|
59
|
+
`space_id:${settings.spaceId}`,
|
|
60
|
+
`cache_ttl_greater_than_0:${cacheTtl > 0}`
|
|
61
|
+
];
|
|
62
|
+
try {
|
|
63
|
+
const { renderedUrl, renderedBody } = await renderLiquidFields(apiLookupConfig, profile, datafeedTags, settings, logger);
|
|
64
|
+
const requestId = exports.getRequestId({ ...apiLookupConfig, url: renderedUrl, body: renderedBody });
|
|
65
|
+
if (cacheTtl > 0 && dataFeedCache) {
|
|
66
|
+
const cachedResponse = await exports.getCachedResponse(apiLookupConfig, requestId, dataFeedCache, datafeedTags);
|
|
67
|
+
if (cachedResponse) {
|
|
68
|
+
datafeedTags.push('error:false');
|
|
69
|
+
return cachedResponse;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let data;
|
|
73
|
+
try {
|
|
74
|
+
const res = await request(renderedUrl, {
|
|
75
|
+
headers: headers ?? undefined,
|
|
76
|
+
timeout: 3000,
|
|
77
|
+
method: method,
|
|
78
|
+
body: renderedBody,
|
|
79
|
+
skipResponseCloning: true
|
|
80
|
+
});
|
|
81
|
+
data = await res.data;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const respError = error.response;
|
|
85
|
+
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
86
|
+
datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
const dataString = JSON.stringify(data);
|
|
90
|
+
const size = Buffer.byteLength(dataString, 'utf-8');
|
|
91
|
+
datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
|
|
92
|
+
if (cacheTtl > 0) {
|
|
93
|
+
if (size <= maxResponseSizeBytes) {
|
|
94
|
+
try {
|
|
95
|
+
await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
|
|
96
|
+
datafeedTags.push('cache_set:true');
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
|
|
100
|
+
datafeedTags.push('cache_set:false');
|
|
101
|
+
datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
datafeedTags.push('cache_set:false');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return data;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
|
|
113
|
+
if (!isErrorCapturedInTags) {
|
|
114
|
+
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
|
|
115
|
+
}
|
|
116
|
+
tags.push('reason:datafeed_failure');
|
|
117
|
+
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
statsClient?.incr('datafeed-execution', 1, datafeedTags);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.performApiLookup = performApiLookup;
|
|
125
|
+
exports.apiLookupActionFields = {
|
|
126
|
+
id: {
|
|
127
|
+
label: 'ID',
|
|
128
|
+
description: 'The id of the API lookup for use in logging & observability',
|
|
129
|
+
type: 'string'
|
|
130
|
+
},
|
|
131
|
+
name: {
|
|
132
|
+
label: 'Name',
|
|
133
|
+
description: 'The name of the API lookup referenced in liquid syntax',
|
|
134
|
+
type: 'string',
|
|
135
|
+
required: true
|
|
136
|
+
},
|
|
137
|
+
url: {
|
|
138
|
+
label: 'URL',
|
|
139
|
+
description: 'The URL endpoint to call',
|
|
140
|
+
type: 'string',
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
method: {
|
|
144
|
+
label: 'Request Method',
|
|
145
|
+
description: 'The request method, e.g. GET/POST/etc.',
|
|
146
|
+
type: 'string',
|
|
147
|
+
required: true
|
|
148
|
+
},
|
|
149
|
+
cacheTtl: {
|
|
150
|
+
label: 'Cache TTL',
|
|
151
|
+
description: 'The cache TTL in ms',
|
|
152
|
+
type: 'integer',
|
|
153
|
+
required: true
|
|
154
|
+
},
|
|
155
|
+
body: {
|
|
156
|
+
label: 'Request Body',
|
|
157
|
+
description: 'The request body for use with POST/PUT/PATCH requests',
|
|
158
|
+
type: 'string'
|
|
159
|
+
},
|
|
160
|
+
headers: {
|
|
161
|
+
label: 'Request Headers',
|
|
162
|
+
description: 'Headers in JSON to be sent with the request',
|
|
163
|
+
type: 'object'
|
|
164
|
+
},
|
|
165
|
+
responseType: {
|
|
166
|
+
label: 'Response Type',
|
|
167
|
+
description: 'The response type of the request. Currently only supporting JSON.',
|
|
168
|
+
type: 'string',
|
|
169
|
+
required: true
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
exports.apiLookupLiquidKey = 'lookups';
|
|
173
|
+
exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
|
|
174
|
+
//# sourceMappingURL=api-lookups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,wDAAwD;AAKxD,uCAA6C;AAI7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAcpC,MAAM,kBAAkB,GAAG,KAAK,EAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAgD,EAC/D,OAAgB,EAChB,YAAsB,EACtB,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;KAC5D;IAAC,OAAO,KAAK,EAAE;QACd,MAA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AI,EAAE,QAAQ;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,wDAAwD;QACrE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,uDAAuD;QACpE,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,6CAA6C;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,mEAAmE;QAChF,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAE9B,QAAA,sBAAsB,GAAG,sBAAsB,CAAA"}
|
|
@@ -22,29 +22,34 @@ class WhatsAppMessageSender extends utils_1.PhoneMessageSender {
|
|
|
22
22
|
return 'whatsapp';
|
|
23
23
|
}
|
|
24
24
|
async getBody(phone) {
|
|
25
|
-
let parsedPhone;
|
|
26
|
-
try {
|
|
27
|
-
parsedPhone = phoneUtil.parse(phone, 'US');
|
|
28
|
-
parsedPhone = phoneUtil.format(parsedPhone, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
29
|
-
parsedPhone = `whatsapp:${parsedPhone}`;
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
const underlyingError = e;
|
|
33
|
-
throw new actions_core_1.IntegrationError('Phone number must be able to be formatted to e164 for whatsapp. ' + underlyingError.message, `INVALID_PHONE`, 400);
|
|
34
|
-
}
|
|
35
25
|
if (!this.payload.contentSid) {
|
|
36
26
|
throw new actions_core_1.IntegrationError('A valid whatsApp Content SID was not provided.', `INVALID_CONTENT_SID`, 400);
|
|
37
27
|
}
|
|
38
28
|
const params = {
|
|
39
29
|
ContentSid: this.payload.contentSid,
|
|
40
30
|
From: this.payload.from,
|
|
41
|
-
To:
|
|
31
|
+
To: this.parsePhoneNumber(phone)
|
|
42
32
|
};
|
|
43
33
|
const contentVariables = await this.getVariables();
|
|
44
34
|
if (contentVariables)
|
|
45
35
|
params['ContentVariables'] = contentVariables;
|
|
46
36
|
return new URLSearchParams(params);
|
|
47
37
|
}
|
|
38
|
+
parsePhoneNumber(phone) {
|
|
39
|
+
let parsedPhone;
|
|
40
|
+
try {
|
|
41
|
+
parsedPhone = phoneUtil.parse(phone, 'US');
|
|
42
|
+
if (!phoneUtil.isPossibleNumber(parsedPhone) || !phoneUtil.isValidNumber(parsedPhone)) {
|
|
43
|
+
parsedPhone = phoneUtil.parse('+' + phone, 'US');
|
|
44
|
+
}
|
|
45
|
+
parsedPhone = phoneUtil.format(parsedPhone, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
46
|
+
return `whatsapp:${parsedPhone}`;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
const underlyingError = e;
|
|
50
|
+
throw new actions_core_1.IntegrationError('Phone number must be able to be formatted to e164 for whatsapp. ' + underlyingError.message, `INVALID_PHONE`, 400);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
48
53
|
async getVariables() {
|
|
49
54
|
if (!this.payload.traitEnrichment && this.payload.contentVariables)
|
|
50
55
|
return JSON.stringify(this.payload.contentVariables) ?? null;
|
|
@@ -68,6 +73,9 @@ class WhatsAppMessageSender extends utils_1.PhoneMessageSender {
|
|
|
68
73
|
__decorate([
|
|
69
74
|
utils_2.track()
|
|
70
75
|
], WhatsAppMessageSender.prototype, "getBody", null);
|
|
76
|
+
__decorate([
|
|
77
|
+
utils_2.track()
|
|
78
|
+
], WhatsAppMessageSender.prototype, "parsePhoneNumber", null);
|
|
71
79
|
__decorate([
|
|
72
80
|
utils_2.track({
|
|
73
81
|
wrapIntegrationError: () => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsAppMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,oCAA6C;AAC7C,uCAAmC;AAEnC,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,0BAA2B;IACpE,IAAI,sBAAsB;QACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC1C,CAAC;IACD,cAAc;QACZ,OAAO,UAAU,CAAA;IACnB,CAAC;IAGD,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,
|
|
1
|
+
{"version":3,"file":"WhatsAppMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,oCAA6C;AAC7C,uCAAmC;AAEnC,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,0BAA2B;IACpE,IAAI,sBAAsB;QACxB,MAAM,IAAI,KAAK,CAAC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O,EAC5F,eAAe,EACf,GAAG,CACJ,CAAA;SACF;IACH,CAAC;IASO,KAAK,CAAC,YAAY;QAIxB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;YAChE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAA;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QAEvE,MAAM,OAAO,GAAG;YACd,OAAO,EAAE;gBACP,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;aAC5B;SACF,CAAA;QAED,MAAM,OAAO,GAA2B,EAAE,CAAA;QAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;YACtE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAa,EAAE,OAAO,CAAC,CAAA;YAClE,IAAI,MAAM,EAAE,MAAM,EAAE;gBAClB,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;aACtB;SACF;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;CACF;AA3EC;IADC,aAAK,EAAE;oDAgBP;AAGD;IADC,aAAK,EAAE;6DAyBP;AASD;IAPC,aAAK,CAAC;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC;YAC1B,iDAAiD;YACjD,4CAA4C;YAC5C,GAAG;SACJ;KACF,CAAC;yDAwBD;AAnFH,sDAoFC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ContextFromDecorator } from './operationTracking';
|
|
2
2
|
export declare const track: ((decoratorArgs?: ({
|
|
3
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
4
|
+
} & {
|
|
3
5
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
4
|
-
} &
|
|
6
|
+
} & {
|
|
5
7
|
onTry?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
6
8
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
9
|
-
} & {
|
|
9
|
+
} & import("./operationTracking").OperationLoggerDecoratorArgs & {
|
|
10
10
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
11
11
|
}) | undefined) => import("./operationTracking").GenericMethodDecorator<(this: any, ...args: any[]) => any>) & {
|
|
12
12
|
getCurrentOperation(classInstance: any): (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
@@ -15,8 +15,13 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
15
15
|
}) | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
_contextType: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
tags: string[];
|
|
19
|
+
sharedContext: {
|
|
20
|
+
tags: string[];
|
|
21
|
+
};
|
|
22
|
+
decoratorArgs?: {
|
|
23
|
+
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
24
|
+
} | undefined;
|
|
20
25
|
} & {
|
|
21
26
|
decoratorArgs?: {
|
|
22
27
|
onError?: ((ctx: import("./operationTracking").OperationErrorHandlerContext<import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>>) => void) | undefined;
|
|
@@ -25,10 +30,8 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
25
30
|
parent?: (import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any> & any) | undefined;
|
|
26
31
|
sharedContext: {};
|
|
27
32
|
} & {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
31
|
-
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
33
|
+
start?: number | undefined;
|
|
34
|
+
duration?: number | undefined;
|
|
32
35
|
} & {
|
|
33
36
|
onFinally: (() => void)[];
|
|
34
37
|
decoratorArgs?: {
|
|
@@ -36,13 +39,10 @@ export declare const track: ((decoratorArgs?: ({
|
|
|
36
39
|
onFinally?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => void) | undefined;
|
|
37
40
|
} | undefined;
|
|
38
41
|
} & {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
decoratorArgs?: {
|
|
44
|
-
shouldStats?: ((args: import("./operationTracking").OperationStatsEventArgs) => boolean | void) | undefined;
|
|
45
|
-
} | undefined;
|
|
42
|
+
logs: string[];
|
|
43
|
+
logMetadata?: Record<string, unknown> | undefined;
|
|
44
|
+
decoratorArgs?: import("./operationTracking").OperationLoggerDecoratorArgs | undefined;
|
|
45
|
+
sharedContext: import("./operationTracking").OperationLoggerSharedContext;
|
|
46
46
|
} & {
|
|
47
47
|
decoratorArgs?: {
|
|
48
48
|
wrapIntegrationError?: ((ctx: import("./operationTracking").TryCatchFinallyContext<(this: any, ...args: any[]) => any>) => import("@segment/actions-core/*").IntegrationError | [message: string, code: string, status: number]) | undefined;
|
|
@@ -91,7 +91,7 @@ const destination = {
|
|
|
91
91
|
const r = await response.json();
|
|
92
92
|
const externalId = r.data.id;
|
|
93
93
|
if (externalId !== getAudienceInput.externalId) {
|
|
94
|
-
throw new actions_core_1.IntegrationError(
|
|
94
|
+
throw new actions_core_1.IntegrationError(`Unable to verify ownership over audience. Segment Audience ID doesn't match The Klaviyo List Id.`, 'INVALID_REQUEST_DATA', 400);
|
|
95
95
|
}
|
|
96
96
|
return {
|
|
97
97
|
externalId
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.batch_size = exports.enable_batching = exports.external_id = exports.email = exports.list_id = void 0;
|
|
4
4
|
exports.list_id = {
|
|
5
5
|
label: 'List Id',
|
|
6
|
-
description:
|
|
6
|
+
description: "'Insert the ID of the default list that you'd like to subscribe users to when you call .identify().'",
|
|
7
7
|
type: 'string',
|
|
8
8
|
default: {
|
|
9
9
|
'@path': '$.context.personas.external_audience_id'
|
|
@@ -13,15 +13,20 @@ describe('LinkedIn Conversions', () => {
|
|
|
13
13
|
const linkedIn = new api_1.LinkedInConversions(requestClient);
|
|
14
14
|
const adAccountId = 'urn:li:sponsoredAccount:123456';
|
|
15
15
|
const hookInputs = {
|
|
16
|
+
adAccountId,
|
|
16
17
|
name: 'A different name that should trigger an update',
|
|
17
18
|
conversionType: 'PURCHASE',
|
|
18
|
-
attribution_type: 'LAST_TOUCH_BY_CAMPAIGN'
|
|
19
|
+
attribution_type: 'LAST_TOUCH_BY_CAMPAIGN',
|
|
20
|
+
post_click_attribution_window_size: 30,
|
|
21
|
+
view_through_attribution_window_size: 7
|
|
19
22
|
};
|
|
20
23
|
const hookOutputs = {
|
|
21
24
|
id: '56789',
|
|
22
25
|
name: 'The original name',
|
|
23
26
|
conversionType: 'LEAD',
|
|
24
|
-
attribution_type: 'LAST_TOUCH_BY_CONVERSION'
|
|
27
|
+
attribution_type: 'LAST_TOUCH_BY_CONVERSION',
|
|
28
|
+
post_click_attribution_window_size: 30,
|
|
29
|
+
view_through_attribution_window_size: 7
|
|
25
30
|
};
|
|
26
31
|
it('should update a conversion rule', async () => {
|
|
27
32
|
nock_1.default(`${constants_1.BASE_URL}`)
|
|
@@ -38,14 +43,16 @@ describe('LinkedIn Conversions', () => {
|
|
|
38
43
|
account: adAccountId
|
|
39
44
|
})
|
|
40
45
|
.reply(204);
|
|
41
|
-
const updateResult = await linkedIn.updateConversionRule(
|
|
46
|
+
const updateResult = await linkedIn.updateConversionRule(hookInputs, hookOutputs);
|
|
42
47
|
expect(updateResult).toEqual({
|
|
43
48
|
successMessage: `Conversion rule ${hookOutputs.id} updated successfully!`,
|
|
44
49
|
savedData: {
|
|
45
50
|
id: hookOutputs.id,
|
|
46
51
|
name: hookInputs.name,
|
|
47
52
|
conversionType: hookInputs.conversionType,
|
|
48
|
-
attribution_type: hookInputs.attribution_type
|
|
53
|
+
attribution_type: hookInputs.attribution_type,
|
|
54
|
+
post_click_attribution_window_size: hookOutputs.post_click_attribution_window_size,
|
|
55
|
+
view_through_attribution_window_size: hookOutputs.view_through_attribution_window_size
|
|
49
56
|
}
|
|
50
57
|
});
|
|
51
58
|
});
|
|
@@ -56,24 +63,29 @@ describe('LinkedIn Conversions', () => {
|
|
|
56
63
|
name: hookInputs.name,
|
|
57
64
|
account: adAccountId,
|
|
58
65
|
conversionMethod: 'CONVERSIONS_API',
|
|
59
|
-
postClickAttributionWindowSize:
|
|
60
|
-
viewThroughAttributionWindowSize:
|
|
66
|
+
postClickAttributionWindowSize: hookInputs.post_click_attribution_window_size,
|
|
67
|
+
viewThroughAttributionWindowSize: hookInputs.view_through_attribution_window_size,
|
|
61
68
|
attributionType: hookInputs.attribution_type,
|
|
62
69
|
type: hookInputs.conversionType
|
|
63
70
|
})
|
|
64
71
|
.reply(201, {
|
|
65
72
|
id: mockReturnedId,
|
|
66
73
|
name: hookInputs.name,
|
|
67
|
-
type: hookInputs.conversionType
|
|
74
|
+
type: hookInputs.conversionType,
|
|
75
|
+
attributionType: hookInputs.attribution_type,
|
|
76
|
+
postClickAttributionWindowSize: hookInputs.post_click_attribution_window_size,
|
|
77
|
+
viewThroughAttributionWindowSize: hookInputs.view_through_attribution_window_size
|
|
68
78
|
});
|
|
69
|
-
const createResult = await linkedIn.createConversionRule(
|
|
79
|
+
const createResult = await linkedIn.createConversionRule(hookInputs);
|
|
70
80
|
expect(createResult).toEqual({
|
|
71
81
|
successMessage: `Conversion rule ${mockReturnedId} created successfully!`,
|
|
72
82
|
savedData: {
|
|
73
83
|
id: mockReturnedId,
|
|
74
84
|
name: hookInputs.name,
|
|
75
85
|
conversionType: hookInputs.conversionType,
|
|
76
|
-
attribution_type: hookInputs.attribution_type
|
|
86
|
+
attribution_type: hookInputs.attribution_type,
|
|
87
|
+
post_click_attribution_window_size: hookInputs.post_click_attribution_window_size,
|
|
88
|
+
view_through_attribution_window_size: hookInputs.view_through_attribution_window_size
|
|
77
89
|
}
|
|
78
90
|
});
|
|
79
91
|
});
|
|
@@ -82,20 +94,24 @@ describe('LinkedIn Conversions', () => {
|
|
|
82
94
|
id: '5678',
|
|
83
95
|
name: 'Exists already',
|
|
84
96
|
type: 'PURCHASE',
|
|
85
|
-
attributionType: 'LAST_TOUCH_BY_CAMPAIGN'
|
|
97
|
+
attributionType: 'LAST_TOUCH_BY_CAMPAIGN',
|
|
98
|
+
postClickAttributionWindowSize: 1,
|
|
99
|
+
viewThroughAttributionWindowSize: 1
|
|
86
100
|
};
|
|
87
101
|
nock_1.default(`${constants_1.BASE_URL}`)
|
|
88
102
|
.get(`/conversions/${existingRule.id}`)
|
|
89
103
|
.query({ account: adAccountId })
|
|
90
104
|
.reply(200, existingRule);
|
|
91
|
-
const updateResult = await linkedIn.updateConversionRule(
|
|
105
|
+
const updateResult = await linkedIn.updateConversionRule({ ...hookInputs, conversionRuleId: existingRule.id }, hookOutputs);
|
|
92
106
|
expect(updateResult).toEqual({
|
|
93
107
|
successMessage: `Using existing Conversion Rule: ${existingRule.id} `,
|
|
94
108
|
savedData: {
|
|
95
109
|
id: existingRule.id,
|
|
96
110
|
name: existingRule.name,
|
|
97
111
|
conversionType: existingRule.type,
|
|
98
|
-
attribution_type: existingRule.attributionType
|
|
112
|
+
attribution_type: existingRule.attributionType,
|
|
113
|
+
post_click_attribution_window_size: existingRule.postClickAttributionWindowSize,
|
|
114
|
+
view_through_attribution_window_size: existingRule.viewThroughAttributionWindowSize
|
|
99
115
|
}
|
|
100
116
|
});
|
|
101
117
|
});
|
|
@@ -114,7 +130,7 @@ describe('LinkedIn Conversions', () => {
|
|
|
114
130
|
account: adAccountId
|
|
115
131
|
})
|
|
116
132
|
.reply(500);
|
|
117
|
-
const updateResult = await linkedIn.updateConversionRule(
|
|
133
|
+
const updateResult = await linkedIn.updateConversionRule(hookInputs, hookOutputs);
|
|
118
134
|
expect(updateResult).toEqual({
|
|
119
135
|
error: {
|
|
120
136
|
message: `Failed to update conversion rule: Internal Server Error`,
|
|
@@ -124,7 +140,9 @@ describe('LinkedIn Conversions', () => {
|
|
|
124
140
|
id: hookOutputs.id,
|
|
125
141
|
name: hookOutputs.name,
|
|
126
142
|
conversionType: hookOutputs.conversionType,
|
|
127
|
-
attribution_type: hookOutputs.attribution_type
|
|
143
|
+
attribution_type: hookOutputs.attribution_type,
|
|
144
|
+
post_click_attribution_window_size: hookOutputs.post_click_attribution_window_size,
|
|
145
|
+
view_through_attribution_window_size: hookOutputs.view_through_attribution_window_size
|
|
128
146
|
}
|
|
129
147
|
});
|
|
130
148
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.test.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/api.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,0GAA+E;AAC/E,gCAA4C;AAC5C,4CAAuC;AAGvC,MAAM,aAAa,GAAG,+BAAmB,EAAE,CAAA;AAE3C,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,QAAQ,GAAwB,IAAI,yBAAmB,CAAC,aAAa,CAAC,CAAA;QAC5E,MAAM,WAAW,GAAG,gCAAgC,CAAA;QACpD,MAAM,UAAU,GAA0C;YACxD,IAAI,EAAE,gDAAgD;YACtD,cAAc,EAAE,UAAU;YAC1B,gBAAgB,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"api.test.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/api.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,0GAA+E;AAC/E,gCAA4C;AAC5C,4CAAuC;AAGvC,MAAM,aAAa,GAAG,+BAAmB,EAAE,CAAA;AAE3C,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,QAAQ,GAAwB,IAAI,yBAAmB,CAAC,aAAa,CAAC,CAAA;QAC5E,MAAM,WAAW,GAAG,gCAAgC,CAAA;QACpD,MAAM,UAAU,GAA0C;YACxD,WAAW;YACX,IAAI,EAAE,gDAAgD;YACtD,cAAc,EAAE,UAAU;YAC1B,gBAAgB,EAAE,wBAAwB;YAC1C,kCAAkC,EAAE,EAAE;YACtC,oCAAoC,EAAE,CAAC;SACxC,CAAA;QAED,MAAM,WAAW,GAA2C;YAC1D,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,mBAAmB;YACzB,cAAc,EAAE,MAAM;YACtB,gBAAgB,EAAE,0BAA0B;YAC5C,kCAAkC,EAAE,EAAE;YACtC,oCAAoC,EAAE,CAAC;SACxC,CAAA;QAED,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;YAC/C,cAAI,CAAC,GAAG,oBAAQ,EAAE,CAAC;iBAChB,IAAI,CAAC,gBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE;gBACtC,KAAK,EAAE;oBACL,IAAI,EAAE;wBACJ,IAAI,EAAE,UAAU,CAAC,IAAI;wBACrB,IAAI,EAAE,UAAU,CAAC,cAAc;wBAC/B,eAAe,EAAE,UAAU,CAAC,g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BAC5C,MAAM,EAAE,QAAQ;qBACjB;iBACF;aACF,CAAC,CAAA;YAEJ,MAAM,mBAAmB,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;YAChF,MAAM,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC;gBAClC,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,MAAM;wBACb,KAAK,EAAE,SAAS;qBACjB;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -4,16 +4,18 @@ import type { Payload, HookBundle } from '../streamConversion/generated-types';
|
|
|
4
4
|
export declare class LinkedInConversions {
|
|
5
5
|
request: RequestClient;
|
|
6
6
|
conversionRuleId?: string;
|
|
7
|
-
constructor(request: RequestClient
|
|
7
|
+
constructor(request: RequestClient);
|
|
8
|
+
setConversionRuleId(conversionRuleId: string): void;
|
|
8
9
|
getProfile(): Promise<ModifiedResponse<ProfileAPIResponse>>;
|
|
9
10
|
getConversionRule: (adAccount: string, conversionRuleId: string) => Promise<ActionHookResponse<HookBundle['onMappingSave']['outputs']>>;
|
|
10
|
-
createConversionRule: (
|
|
11
|
-
updateConversionRule: (
|
|
11
|
+
createConversionRule: (hookInputs: HookBundle['onMappingSave']['inputs']) => Promise<ActionHookResponse<HookBundle['onMappingSave']['outputs']>>;
|
|
12
|
+
updateConversionRule: (hookInputs: HookBundle['onMappingSave']['inputs'], hookOutputs: HookBundle['onMappingSave']['outputs']) => Promise<ActionHookResponse<HookBundle['onMappingSave']['outputs']>>;
|
|
12
13
|
getAdAccounts: () => Promise<DynamicFieldResponse>;
|
|
13
|
-
getConversionRulesList: (adAccountId
|
|
14
|
-
|
|
14
|
+
getConversionRulesList: (adAccountId?: string | undefined) => Promise<DynamicFieldResponse>;
|
|
15
|
+
private parseIdFromUrn;
|
|
16
|
+
getCampaignsList: (adAccountUrn?: string | undefined) => Promise<DynamicFieldResponse>;
|
|
15
17
|
streamConversionEvent(payload: Payload, conversionTime: number): Promise<ModifiedResponse>;
|
|
16
|
-
bulkAssociateCampaignToConversion(campaignIds
|
|
18
|
+
bulkAssociateCampaignToConversion(campaignIds?: string[]): Promise<ModifiedResponse | void>;
|
|
17
19
|
associateCampignToConversion(campaignId: string): Promise<ModifiedResponse>;
|
|
18
20
|
private conversionRuleValuesUpdated;
|
|
19
21
|
}
|