@segment/action-destinations 3.337.4-staging-1 → 3.337.7-staging.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/avo/generated-types.d.ts +5 -0
- package/dist/destinations/avo/generated-types.js +3 -0
- package/dist/destinations/avo/generated-types.js.map +1 -0
- package/dist/destinations/avo/index.d.ts +4 -0
- package/dist/destinations/avo/index.js +54 -0
- package/dist/destinations/avo/index.js.map +1 -0
- package/dist/destinations/avo/sendSchemaToInspector/AvoSchemaParser.d.ts +9 -0
- package/dist/destinations/avo/sendSchemaToInspector/AvoSchemaParser.js +97 -0
- package/dist/destinations/avo/sendSchemaToInspector/AvoSchemaParser.js.map +1 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo-types.d.ts +26 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo-types.js +10 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo-types.js.map +1 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo.d.ts +3 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo.js +44 -0
- package/dist/destinations/avo/sendSchemaToInspector/avo.js.map +1 -0
- package/dist/destinations/avo/sendSchemaToInspector/generated-types.d.ts +11 -0
- package/dist/destinations/avo/sendSchemaToInspector/generated-types.js +3 -0
- package/dist/destinations/avo/sendSchemaToInspector/generated-types.js.map +1 -0
- package/dist/destinations/avo/sendSchemaToInspector/index.d.ts +5 -0
- package/dist/destinations/avo/sendSchemaToInspector/index.js +95 -0
- package/dist/destinations/avo/sendSchemaToInspector/index.js.map +1 -0
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/braze/index.js +0 -12
- package/dist/destinations/braze/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdateDevice/generated-types.d.ts +0 -3
- package/dist/destinations/customerio/createUpdateDevice/index.js +16 -25
- package/dist/destinations/customerio/createUpdateDevice/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdateObject/generated-types.d.ts +0 -3
- package/dist/destinations/customerio/createUpdateObject/index.js +39 -76
- package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
- package/dist/destinations/customerio/createUpdatePerson/generated-types.d.ts +1 -4
- package/dist/destinations/customerio/createUpdatePerson/index.d.ts +1 -1
- package/dist/destinations/customerio/createUpdatePerson/index.js +41 -50
- package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
- package/dist/destinations/customerio/deleteDevice/index.js +4 -14
- package/dist/destinations/customerio/deleteDevice/index.js.map +1 -1
- package/dist/destinations/customerio/index.js +15 -39
- package/dist/destinations/customerio/index.js.map +1 -1
- package/dist/destinations/customerio/trackEvent/index.js +32 -26
- package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
- package/dist/destinations/customerio/trackPageView/generated-types.d.ts +0 -1
- package/dist/destinations/customerio/trackPageView/index.js +29 -23
- package/dist/destinations/customerio/trackPageView/index.js.map +1 -1
- package/dist/destinations/customerio/trackScreenView/generated-types.d.ts +0 -1
- package/dist/destinations/customerio/trackScreenView/index.js +29 -22
- package/dist/destinations/customerio/trackScreenView/index.js.map +1 -1
- package/dist/destinations/customerio/utils.d.ts +2 -44
- package/dist/destinations/customerio/utils.js +13 -89
- package/dist/destinations/customerio/utils.js.map +1 -1
- package/dist/destinations/display-video-360/shared.js +6 -44
- package/dist/destinations/display-video-360/shared.js.map +1 -1
- 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 +18 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +94 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +2 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/constants.d.ts +1 -1
- package/dist/destinations/facebook-conversions-api/constants.js +1 -1
- package/dist/destinations/index.js +6 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/kameleoon/index.js +1 -1
- package/dist/destinations/kameleoon/index.js.map +1 -1
- package/dist/destinations/klaviyo/properties.js +1 -1
- package/dist/destinations/klaviyo/properties.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.d.ts +1 -1
- package/dist/destinations/linkedin-conversions/api/index.js +23 -13
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.d.ts +1 -1
- package/dist/destinations/linkedin-conversions/constants.js +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/responsys/generated-types.d.ts +20 -0
- package/dist/destinations/responsys/generated-types.js +3 -0
- package/dist/destinations/responsys/generated-types.js.map +1 -0
- package/dist/destinations/responsys/index.d.ts +4 -0
- package/dist/destinations/responsys/index.js +197 -0
- package/dist/destinations/responsys/index.js.map +1 -0
- package/dist/destinations/responsys/sendAudience/generated-types.d.ts +14 -0
- package/dist/destinations/responsys/sendAudience/generated-types.js +3 -0
- package/dist/destinations/responsys/sendAudience/generated-types.js.map +1 -0
- package/dist/destinations/responsys/sendAudience/index.d.ts +5 -0
- package/dist/destinations/responsys/sendAudience/index.js +88 -0
- package/dist/destinations/responsys/sendAudience/index.js.map +1 -0
- package/dist/destinations/responsys/sendCustomTraits/generated-types.d.ts +9 -0
- package/dist/destinations/responsys/sendCustomTraits/generated-types.js +3 -0
- package/dist/destinations/responsys/sendCustomTraits/generated-types.js.map +1 -0
- package/dist/destinations/responsys/sendCustomTraits/index.d.ts +5 -0
- package/dist/destinations/responsys/sendCustomTraits/index.js +52 -0
- package/dist/destinations/responsys/sendCustomTraits/index.js.map +1 -0
- package/dist/destinations/responsys/shared_properties.d.ts +3 -0
- package/dist/destinations/responsys/shared_properties.js +19 -0
- package/dist/destinations/responsys/shared_properties.js.map +1 -0
- package/dist/destinations/responsys/types.d.ts +38 -0
- package/dist/destinations/responsys/types.js +3 -0
- package/dist/destinations/responsys/types.js.map +1 -0
- package/dist/destinations/responsys/upsertListMember/generated-types.d.ts +13 -0
- package/dist/destinations/responsys/upsertListMember/generated-types.js +3 -0
- package/dist/destinations/responsys/upsertListMember/generated-types.js.map +1 -0
- package/dist/destinations/responsys/upsertListMember/index.d.ts +5 -0
- package/dist/destinations/responsys/upsertListMember/index.js +80 -0
- package/dist/destinations/responsys/upsertListMember/index.js.map +1 -0
- package/dist/destinations/responsys/utils.d.ts +18 -0
- package/dist/destinations/responsys/utils.js +151 -0
- package/dist/destinations/responsys/utils.js.map +1 -0
- package/dist/destinations/segment/sendGroup/index.js +36 -0
- package/dist/destinations/segment/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment/sendIdentify/index.js +37 -1
- package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment/sendPage/index.js +44 -0
- package/dist/destinations/segment/sendPage/index.js.map +1 -1
- package/dist/destinations/segment/sendScreen/index.js +37 -0
- package/dist/destinations/segment/sendScreen/index.js.map +1 -1
- package/dist/destinations/segment/sendTrack/index.js +41 -0
- package/dist/destinations/segment/sendTrack/index.js.map +1 -1
- package/dist/destinations/stackadapt/forwardEvent/generated-types.d.ts +33 -0
- package/dist/destinations/stackadapt/forwardEvent/generated-types.js +3 -0
- package/dist/destinations/stackadapt/forwardEvent/generated-types.js.map +1 -0
- package/dist/destinations/stackadapt/forwardEvent/index.d.ts +5 -0
- package/dist/destinations/stackadapt/forwardEvent/index.js +273 -0
- package/dist/destinations/stackadapt/forwardEvent/index.js.map +1 -0
- package/dist/destinations/stackadapt/generated-types.d.ts +3 -0
- package/dist/destinations/stackadapt/generated-types.js +3 -0
- package/dist/destinations/stackadapt/generated-types.js.map +1 -0
- package/dist/destinations/stackadapt/index.d.ts +4 -0
- package/dist/destinations/stackadapt/index.js +38 -0
- package/dist/destinations/stackadapt/index.js.map +1 -0
- package/dist/destinations/trackey/group.types.d.ts +11 -0
- package/dist/destinations/trackey/group.types.js +3 -0
- package/dist/destinations/trackey/group.types.js.map +1 -0
- package/dist/destinations/trackey/identify.types.d.ts +11 -0
- package/dist/destinations/trackey/identify.types.js +3 -0
- package/dist/destinations/trackey/identify.types.js.map +1 -0
- package/dist/destinations/trackey/track.types.d.ts +12 -0
- package/dist/destinations/trackey/track.types.js +3 -0
- package/dist/destinations/trackey/track.types.js.map +1 -0
- package/package.json +2 -2
|
@@ -22,14 +22,6 @@ const action = {
|
|
|
22
22
|
'@path': '$.anonymousId'
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
event_id: {
|
|
26
|
-
label: 'Event ID',
|
|
27
|
-
description: 'An optional identifier used to deduplicate events. [Learn more](https://customer.io/docs/api/#operation/track).',
|
|
28
|
-
type: 'string',
|
|
29
|
-
default: {
|
|
30
|
-
'@path': '$.messageId'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
25
|
url: {
|
|
34
26
|
label: 'Page URL',
|
|
35
27
|
description: 'The URL of the page visited.',
|
|
@@ -62,22 +54,36 @@ const action = {
|
|
|
62
54
|
default: true
|
|
63
55
|
}
|
|
64
56
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
perform: (request, { settings, payload }) => {
|
|
58
|
+
let timestamp = payload.timestamp;
|
|
59
|
+
let data = payload.data;
|
|
60
|
+
if (payload.convert_timestamp !== false) {
|
|
61
|
+
if (timestamp) {
|
|
62
|
+
timestamp = utils_1.convertValidTimestamp(timestamp);
|
|
63
|
+
}
|
|
64
|
+
if (data) {
|
|
65
|
+
data = utils_1.convertAttributeTimestamps(data);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const body = {
|
|
69
|
+
name: payload.url,
|
|
70
|
+
type: 'page',
|
|
71
|
+
data,
|
|
72
|
+
timestamp
|
|
73
|
+
};
|
|
74
|
+
let url;
|
|
75
|
+
if (payload.id) {
|
|
76
|
+
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
|
|
80
|
+
body.anonymous_id = payload.anonymous_id;
|
|
81
|
+
}
|
|
82
|
+
return request(url, {
|
|
83
|
+
method: 'post',
|
|
84
|
+
json: body
|
|
85
|
+
});
|
|
70
86
|
}
|
|
71
87
|
};
|
|
72
|
-
function mapPayload(payload) {
|
|
73
|
-
const { id, event_id, url, data, ...rest } = payload;
|
|
74
|
-
return {
|
|
75
|
-
...rest,
|
|
76
|
-
person_id: id,
|
|
77
|
-
id: event_id,
|
|
78
|
-
name: url,
|
|
79
|
-
attributes: data
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
88
|
exports.default = action;
|
|
83
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackPageView/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackPageView/index.ts"],"names":[],"mappings":";;AAEA,oCAA8F;AAY9F,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,oDAAoD;IACjE,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,OA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G,wBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAqB,OAAO,CAAC,EAAE,SAAS,CAAA;SAC1F;aAAM;YACL,GAAG,GAAG,GAAG,wBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAA;YACjE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAA;SACzC;QAED,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -22,14 +22,6 @@ const action = {
|
|
|
22
22
|
'@path': '$.anonymousId'
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
event_id: {
|
|
26
|
-
label: 'Event ID',
|
|
27
|
-
description: 'An optional identifier used to deduplicate events. [Learn more](https://customer.io/docs/api/#operation/track).',
|
|
28
|
-
type: 'string',
|
|
29
|
-
default: {
|
|
30
|
-
'@path': '$.messageId'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
25
|
name: {
|
|
34
26
|
label: 'Screen name',
|
|
35
27
|
description: 'The name of the screen visited.',
|
|
@@ -62,21 +54,36 @@ const action = {
|
|
|
62
54
|
default: true
|
|
63
55
|
}
|
|
64
56
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
perform: (request, { settings, payload }) => {
|
|
58
|
+
let timestamp = payload.timestamp;
|
|
59
|
+
let data = payload.data;
|
|
60
|
+
if (payload.convert_timestamp !== false) {
|
|
61
|
+
if (timestamp) {
|
|
62
|
+
timestamp = utils_1.convertValidTimestamp(timestamp);
|
|
63
|
+
}
|
|
64
|
+
if (data) {
|
|
65
|
+
data = utils_1.convertAttributeTimestamps(data);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const body = {
|
|
69
|
+
name: payload.name,
|
|
70
|
+
type: 'screen',
|
|
71
|
+
data,
|
|
72
|
+
timestamp
|
|
73
|
+
};
|
|
74
|
+
let url;
|
|
75
|
+
if (payload.id) {
|
|
76
|
+
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
|
|
80
|
+
body.anonymous_id = payload.anonymous_id;
|
|
81
|
+
}
|
|
82
|
+
return request(url, {
|
|
83
|
+
method: 'post',
|
|
84
|
+
json: body
|
|
85
|
+
});
|
|
70
86
|
}
|
|
71
87
|
};
|
|
72
|
-
function mapPayload(payload) {
|
|
73
|
-
const { id, event_id, data, ...rest } = payload;
|
|
74
|
-
return {
|
|
75
|
-
...rest,
|
|
76
|
-
person_id: id,
|
|
77
|
-
id: event_id,
|
|
78
|
-
attributes: data
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
88
|
exports.default = action;
|
|
82
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackScreenView/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/trackScreenView/index.ts"],"names":[],"mappings":";;AAEA,oCAA8F;AAY9F,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,sDAAsD;IACnE,mBAAmB,EAAE,iBAAiB;IACtC,MAAM,EAAE;QACN,EAAE,EAAE;YACF,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,yGAAyG;YAC3G,IAAI,EAAE,QAAQ;YACd,OAAO,EAA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B,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAqB,OAAO,CAAC,EAAE,SAAS,CAAA;SAC1F;aAAM;YACL,GAAG,GAAG,GAAG,wBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAA;YACjE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAA;SACzC;QAED,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
export declare const trackApiEndpoint: (
|
|
2
|
-
accountRegion?: string | undefined;
|
|
3
|
-
}) => "https://track-eu.customer.io" | "https://track.customer.io";
|
|
1
|
+
export declare const trackApiEndpoint: (accountRegion?: string | undefined) => "https://track-eu.customer.io" | "https://track.customer.io";
|
|
4
2
|
export declare enum AccountRegion {
|
|
5
3
|
US = "US \uD83C\uDDFA\uD83C\uDDF8",
|
|
6
4
|
EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
|
|
7
5
|
}
|
|
8
6
|
export declare const convertValidTimestamp: <Value = unknown>(value: Value) => number | Value;
|
|
9
|
-
export declare const convertAttributeTimestamps:
|
|
10
|
-
declare type RequestPayload<Payload> = {
|
|
11
|
-
settings: {
|
|
12
|
-
accountRegion?: string;
|
|
13
|
-
trackEndpoint?: string;
|
|
14
|
-
};
|
|
15
|
-
type: string;
|
|
16
|
-
action: string;
|
|
17
|
-
payload: Payload;
|
|
18
|
-
};
|
|
19
|
-
declare type Identifiers = {
|
|
20
|
-
anonymous_id?: string;
|
|
21
|
-
cio_id?: string;
|
|
22
|
-
email?: string;
|
|
23
|
-
id?: string;
|
|
24
|
-
object_id?: string;
|
|
25
|
-
object_type_id?: string;
|
|
26
|
-
primary?: Identifiers;
|
|
27
|
-
secondary?: Identifiers;
|
|
28
|
-
};
|
|
29
|
-
declare type BasePayload = {
|
|
30
|
-
anonymous_id?: string;
|
|
31
|
-
convert_timestamp?: boolean;
|
|
32
|
-
email?: string;
|
|
33
|
-
object_id?: string;
|
|
34
|
-
object_type_id?: string;
|
|
35
|
-
person_id?: string;
|
|
36
|
-
};
|
|
37
|
-
export declare const buildPayload: <Payload extends BasePayload>({ action, type, payload }: RequestPayload<Payload>) => {
|
|
38
|
-
attributes?: Record<string, unknown> | undefined;
|
|
39
|
-
cio_relationships?: Record<string, unknown>[] | undefined;
|
|
40
|
-
identifiers?: Identifiers | undefined;
|
|
41
|
-
type: string;
|
|
42
|
-
action: string;
|
|
43
|
-
object_id?: string | undefined;
|
|
44
|
-
object_type_id?: string | undefined;
|
|
45
|
-
};
|
|
46
|
-
export declare const resolveIdentifiers: ({ anonymous_id, email, object_id, object_type_id, person_id }: Record<string, unknown>) => Identifiers | undefined;
|
|
47
|
-
export declare const sendBatch: <Payload>(request: Function, options: RequestPayload<Payload>[]) => any;
|
|
48
|
-
export declare const sendSingle: <Payload>(request: Function, options: RequestPayload<Payload>) => any;
|
|
49
|
-
export {};
|
|
7
|
+
export declare const convertAttributeTimestamps: (payload: Record<string, unknown>) => Record<string, unknown>;
|
|
@@ -3,14 +3,21 @@ 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
|
-
exports.
|
|
7
|
-
const ajv_1 = __importDefault(require("ajv"));
|
|
6
|
+
exports.convertAttributeTimestamps = exports.convertValidTimestamp = exports.AccountRegion = exports.trackApiEndpoint = void 0;
|
|
8
7
|
const dayjs_1 = __importDefault(require("../../lib/dayjs"));
|
|
9
8
|
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const trackApiEndpoint = (accountRegion) => {
|
|
10
|
+
if (accountRegion === AccountRegion.EU) {
|
|
11
|
+
return 'https://track-eu.customer.io';
|
|
12
|
+
}
|
|
13
|
+
return 'https://track.customer.io';
|
|
13
14
|
};
|
|
15
|
+
exports.trackApiEndpoint = trackApiEndpoint;
|
|
16
|
+
var AccountRegion;
|
|
17
|
+
(function (AccountRegion) {
|
|
18
|
+
AccountRegion["US"] = "US \uD83C\uDDFA\uD83C\uDDF8";
|
|
19
|
+
AccountRegion["EU"] = "EU \uD83C\uDDEA\uD83C\uDDFA";
|
|
20
|
+
})(AccountRegion = exports.AccountRegion || (exports.AccountRegion = {}));
|
|
14
21
|
const isRecord = (value) => {
|
|
15
22
|
return isPlainObject_1.default(value);
|
|
16
23
|
};
|
|
@@ -22,18 +29,6 @@ const isIsoDate = (value) => {
|
|
|
22
29
|
const matcher = new RegExp(isoformat);
|
|
23
30
|
return typeof value === 'string' && matcher.test(value) && !isNaN(Date.parse(value));
|
|
24
31
|
};
|
|
25
|
-
const trackApiEndpoint = ({ accountRegion }) => {
|
|
26
|
-
if (accountRegion === AccountRegion.EU) {
|
|
27
|
-
return 'https://track-eu.customer.io';
|
|
28
|
-
}
|
|
29
|
-
return 'https://track.customer.io';
|
|
30
|
-
};
|
|
31
|
-
exports.trackApiEndpoint = trackApiEndpoint;
|
|
32
|
-
var AccountRegion;
|
|
33
|
-
(function (AccountRegion) {
|
|
34
|
-
AccountRegion["US"] = "US \uD83C\uDDFA\uD83C\uDDF8";
|
|
35
|
-
AccountRegion["EU"] = "EU \uD83C\uDDEA\uD83C\uDDFA";
|
|
36
|
-
})(AccountRegion = exports.AccountRegion || (exports.AccountRegion = {}));
|
|
37
32
|
const convertValidTimestamp = (value) => {
|
|
38
33
|
if (typeof value !== 'string' || /^\d+$/.test(value)) {
|
|
39
34
|
return value;
|
|
@@ -48,13 +43,11 @@ exports.convertValidTimestamp = convertValidTimestamp;
|
|
|
48
43
|
const convertAttributeTimestamps = (payload) => {
|
|
49
44
|
const clone = {};
|
|
50
45
|
const keys = Object.keys(payload);
|
|
51
|
-
keys.forEach((
|
|
52
|
-
const key = k;
|
|
46
|
+
keys.forEach((key) => {
|
|
53
47
|
const value = payload[key];
|
|
54
48
|
if (typeof value === 'string') {
|
|
55
49
|
const maybeDate = dayjs_1.default(value);
|
|
56
50
|
if (isIsoDate(value)) {
|
|
57
|
-
;
|
|
58
51
|
clone[key] = maybeDate.unix();
|
|
59
52
|
return;
|
|
60
53
|
}
|
|
@@ -68,73 +61,4 @@ const convertAttributeTimestamps = (payload) => {
|
|
|
68
61
|
return clone;
|
|
69
62
|
};
|
|
70
63
|
exports.convertAttributeTimestamps = convertAttributeTimestamps;
|
|
71
|
-
const buildPayload = ({ action, type, payload }) => {
|
|
72
|
-
const { convert_timestamp, person_id, anonymous_id, email, object_id, object_type_id, ...data } = payload;
|
|
73
|
-
let rest = data;
|
|
74
|
-
if ('convert_timestamp' in payload && convert_timestamp !== false) {
|
|
75
|
-
rest = exports.convertAttributeTimestamps(rest);
|
|
76
|
-
}
|
|
77
|
-
const body = {
|
|
78
|
-
type,
|
|
79
|
-
action,
|
|
80
|
-
...rest
|
|
81
|
-
};
|
|
82
|
-
if (anonymous_id) {
|
|
83
|
-
body.attributes = { ...body.attributes, anonymous_id: anonymous_id };
|
|
84
|
-
}
|
|
85
|
-
if (action !== 'merge') {
|
|
86
|
-
body.identifiers = exports.resolveIdentifiers(payload);
|
|
87
|
-
}
|
|
88
|
-
if (body.identifiers && 'anonymous_id' in body.identifiers) {
|
|
89
|
-
delete body.attributes?.anonymous_id;
|
|
90
|
-
}
|
|
91
|
-
return body;
|
|
92
|
-
};
|
|
93
|
-
exports.buildPayload = buildPayload;
|
|
94
|
-
const resolveIdentifiers = ({ anonymous_id, email, object_id, object_type_id = '1', person_id }) => {
|
|
95
|
-
if (object_id && object_type_id) {
|
|
96
|
-
return {
|
|
97
|
-
object_id: object_id,
|
|
98
|
-
object_type_id: object_type_id
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
else if (person_id?.startsWith('cio_')) {
|
|
102
|
-
return { cio_id: person_id.slice(4) };
|
|
103
|
-
}
|
|
104
|
-
else if (isEmail(person_id)) {
|
|
105
|
-
return { email: person_id };
|
|
106
|
-
}
|
|
107
|
-
else if (person_id) {
|
|
108
|
-
return { id: person_id };
|
|
109
|
-
}
|
|
110
|
-
else if (email) {
|
|
111
|
-
return { email: email };
|
|
112
|
-
}
|
|
113
|
-
else if (anonymous_id) {
|
|
114
|
-
return { anonymous_id: anonymous_id };
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
exports.resolveIdentifiers = resolveIdentifiers;
|
|
118
|
-
const sendBatch = (request, options) => {
|
|
119
|
-
if (!options?.length) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const [{ settings }] = options;
|
|
123
|
-
const batch = options.map((opts) => exports.buildPayload(opts));
|
|
124
|
-
return request(`${exports.trackApiEndpoint(settings)}/api/v2/batch`, {
|
|
125
|
-
method: 'post',
|
|
126
|
-
json: {
|
|
127
|
-
batch
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
exports.sendBatch = sendBatch;
|
|
132
|
-
const sendSingle = (request, options) => {
|
|
133
|
-
const json = exports.buildPayload(options);
|
|
134
|
-
return request(`${exports.trackApiEndpoint(options.settings)}/api/v2/entity`, {
|
|
135
|
-
method: 'post',
|
|
136
|
-
json
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
exports.sendSingle = sendSingle;
|
|
140
64
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/customerio/utils.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/customerio/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AACnC,yEAAgD;AAEzC,MAAM,gBAAgB,GAAG,CAAC,aAAsB,EAAE,EAAE;IACzD,IAAI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C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEjC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAE7B,MAAM,SAAS,GAAG,eAAK,CAAC,KAAK,CAAC,CAAA;YAE9B,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE;gBACpB,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAA;gBAC7B,OAAM;aACP;SACF;QAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,KAAK,CAAC,GAAG,CAAC,GAAG,kCAA0B,CAAC,KAAK,CAAC,CAAA;YAE9C,OAAM;SACP;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AA3BY,QAAA,0BAA0B,8BA2BtC"}
|
|
@@ -68,39 +68,12 @@ const assembleRawOps = (payload, operation) => {
|
|
|
68
68
|
return rawOperations;
|
|
69
69
|
};
|
|
70
70
|
exports.assembleRawOps = assembleRawOps;
|
|
71
|
-
const handleErrorCode = (errorCodeString, r, statsName, statsContext) => {
|
|
72
|
-
if (errorCodeString === 'PARTIAL_SUCCESS') {
|
|
73
|
-
statsContext?.statsClient.incr(`${statsName}.error.PARTIAL_SUCCESS`, 1, statsContext?.tags);
|
|
74
|
-
r.errors?.forEach((e) => {
|
|
75
|
-
if (e.errorCode) {
|
|
76
|
-
statsContext?.statsClient.incr(`${statsName}.error.${protofile_1.ErrorCode[e.errorCode]}`, 1, statsContext?.tags);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
statsContext?.statsClient.incr(`${statsName}.error.${errorCodeString}`, 1, statsContext?.tags);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
71
|
const bulkUploaderResponseHandler = async (response, statsName, statsContext) => {
|
|
85
72
|
if (!response || !response.body) {
|
|
86
73
|
throw new actions_core_1.IntegrationError(`Something went wrong unpacking the protobuf response`, 'INVALID_REQUEST_DATA', 400);
|
|
87
74
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const protobufResponse = Buffer.from(buffer);
|
|
91
|
-
const r = responseHandler.fromBinary(protobufResponse);
|
|
92
|
-
const errorCode = r.status;
|
|
93
|
-
const errorCodeString = protofile_1.ErrorCode[errorCode] || 'UNKNOWN_ERROR';
|
|
94
|
-
if (errorCodeString === 'NO_ERROR' || response.status === 200) {
|
|
95
|
-
statsContext?.statsClient.incr(`${statsName}.success`, 1, statsContext?.tags);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
handleErrorCode(errorCodeString, r, statsName, statsContext);
|
|
99
|
-
if (errorCode === protofile_1.ErrorCode.INTERNAL_ERROR) {
|
|
100
|
-
statsContext?.statsClient.incr(`${statsName}.error.INTERNAL_ERROR`, 1, statsContext?.tags);
|
|
101
|
-
throw new actions_core_1.IntegrationError('Bulk Uploader Internal Error', 'INTERNAL_SERVER_ERROR', 500);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
75
|
+
console.log(statsName);
|
|
76
|
+
console.log(statsContext);
|
|
104
77
|
};
|
|
105
78
|
exports.bulkUploaderResponseHandler = bulkUploaderResponseHandler;
|
|
106
79
|
const createUpdateRequest = (payload, operation) => {
|
|
@@ -125,21 +98,10 @@ const createUpdateRequest = (payload, operation) => {
|
|
|
125
98
|
};
|
|
126
99
|
exports.createUpdateRequest = createUpdateRequest;
|
|
127
100
|
const sendUpdateRequest = async (request, updateRequest, statsName, statsContext) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
body: binaryOperation,
|
|
133
|
-
method: 'POST'
|
|
134
|
-
});
|
|
135
|
-
await exports.bulkUploaderResponseHandler(response, statsName, statsContext);
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
if (error.response?.status === 500) {
|
|
139
|
-
throw new actions_core_1.IntegrationError(error.response.message, 'INTERNAL_SERVER_ERROR', 500);
|
|
140
|
-
}
|
|
141
|
-
await exports.bulkUploaderResponseHandler(error.response, statsName, statsContext);
|
|
142
|
-
}
|
|
101
|
+
console.log(request);
|
|
102
|
+
console.log(updateRequest);
|
|
103
|
+
console.log(statsName);
|
|
104
|
+
console.log(statsContext);
|
|
143
105
|
};
|
|
144
106
|
exports.sendUpdateRequest = sendUpdateRequest;
|
|
145
107
|
const handleUpdate = async (request, payload, operation, statsContext) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/destinations/display-video-360/shared.ts"],"names":[],"mappings":";;;AAAA,wDAAqF;AACrF,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/destinations/display-video-360/shared.ts"],"names":[],"mappings":";;;AAAA,wDAAqF;AACrF,2CAAuC;AAIvC,iDAI0B;AAOnB,MAAM,eAAe,GAAG,CAAC,QAA2B,EAA2B,EAAE;IACtF,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAA;IAC1B,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,YAAY,EAAE,KAAK,CAAC,YAAY;KACN,CAAA;AAC9B,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B;AAEM,MAAM,YAAY,GAAG,KAAK,EAAE,OAAsB,EAAE,QAAiC,EAAE,EAAE;IAC9F,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAuB,qBAAS,EAAE;QAC9D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,eAAe,CAAC;YACxB,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,uCAAiD;YAC5E,SAAS,EAAE,QAAQ,CAAC,QAAQ;YAC5B,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K,CAAC,EAAE;QAClC,MAAM,yBAAiB,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;KACzE;SAAM;QACL,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS,UAAU,EAAE,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;KAC9E;IAED,OAAO;QACL,MAAM,EAAE,GAAG;KACZ,CAAA;AACH,CAAC,CAAA;AApBY,QAAA,YAAY,gBAoBxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/destinations/engage/sendgrid/Profile.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core';
|
|
2
|
+
import { RequestClient } from '@segment/actions-core';
|
|
3
|
+
import { Logger, StatsClient } 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 performApiLookup: (request: RequestClient, { id, url, method, body, headers }: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined) => Promise<unknown>;
|
|
17
|
+
export declare const apiLookupActionFields: Record<string, InputField>;
|
|
18
|
+
export declare const apiLookupLiquidKey = "lookups";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const liquidjs_1 = require("liquidjs");
|
|
6
|
+
const Liquid = new liquidjs_1.Liquid();
|
|
7
|
+
const performApiLookup = async (request, { id, url, method, body, headers }, profile, statsClient, tags, settings, logger) => {
|
|
8
|
+
let renderedUrl;
|
|
9
|
+
let renderedBody;
|
|
10
|
+
try {
|
|
11
|
+
renderedUrl = await Liquid.parseAndRender(url, { profile });
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
logger?.error(`TE Messaging: Email api lookup url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
15
|
+
tags.push('reason:parse_apilookup_url');
|
|
16
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
17
|
+
throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger?.error(`TE Messaging: Email api lookup body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
24
|
+
tags.push('reason:parse_apilookup_body');
|
|
25
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
26
|
+
throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const res = await request(renderedUrl, {
|
|
30
|
+
headers: headers ?? undefined,
|
|
31
|
+
timeout: 10000,
|
|
32
|
+
method: method,
|
|
33
|
+
body: renderedBody,
|
|
34
|
+
skipResponseCloning: true
|
|
35
|
+
});
|
|
36
|
+
return res.data;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
40
|
+
tags.push('reason:apilookup_failure');
|
|
41
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.performApiLookup = performApiLookup;
|
|
46
|
+
exports.apiLookupActionFields = {
|
|
47
|
+
id: {
|
|
48
|
+
label: 'ID',
|
|
49
|
+
description: 'The id of the API lookup for use in logging & observability',
|
|
50
|
+
type: 'string'
|
|
51
|
+
},
|
|
52
|
+
name: {
|
|
53
|
+
label: 'Name',
|
|
54
|
+
description: 'The name of the API lookup referenced in liquid syntax',
|
|
55
|
+
type: 'string',
|
|
56
|
+
required: true
|
|
57
|
+
},
|
|
58
|
+
url: {
|
|
59
|
+
label: 'URL',
|
|
60
|
+
description: 'The URL endpoint to call',
|
|
61
|
+
type: 'string',
|
|
62
|
+
required: true
|
|
63
|
+
},
|
|
64
|
+
method: {
|
|
65
|
+
label: 'Request Method',
|
|
66
|
+
description: 'The request method, e.g. GET/POST/etc.',
|
|
67
|
+
type: 'string',
|
|
68
|
+
required: true
|
|
69
|
+
},
|
|
70
|
+
cacheTtl: {
|
|
71
|
+
label: 'Cache TTL',
|
|
72
|
+
description: 'The cache TTL in ms',
|
|
73
|
+
type: 'integer',
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
body: {
|
|
77
|
+
label: 'Request Body',
|
|
78
|
+
description: 'The request body for use with POST/PUT/PATCH requests',
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
headers: {
|
|
82
|
+
label: 'Request Headers',
|
|
83
|
+
description: 'Headers in JSON to be sent with the request',
|
|
84
|
+
type: 'object'
|
|
85
|
+
},
|
|
86
|
+
responseType: {
|
|
87
|
+
label: 'Response Type',
|
|
88
|
+
description: 'The response type of the request. Currently only supporting JSON.',
|
|
89
|
+
type: 'string',
|
|
90
|
+
required: true
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.apiLookupLiquidKey = 'lookups';
|
|
94
|
+
//# 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,wDAAwD;AAKxD,uCAA6C;AAG7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AActB,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAsB,EACtB,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAmB,EACnD,OAAgB,EAChB,WAAoC,EACpC,IAAc,EACd,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,MAAM,EAAE,KAAK,CACX,qEAAqE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC7G,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QACvC,WAAW,EAAE,IAAI,CAAC,2CAA2C,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;QACvE,MAAM,IAAI,+BAAgB,CAAC,sCAAsC,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;KACxG;IACD,IAAI;QACF,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;KACjF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,EAAE,KAAK,CACX,sEAAsE,EAAE,MAAM,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAC9G,CAAA;QACD,IAAI,CAAC,IAAI,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AQ;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"}
|
|
@@ -75,7 +75,9 @@ class SendEmailPerformer extends utils_1.MessageSendPerformer {
|
|
|
75
75
|
return res;
|
|
76
76
|
}
|
|
77
77
|
async parseTemplating(content, liquidData, contentType) {
|
|
78
|
+
this.logInfo('Original Traits: ' + JSON.stringify(liquidData));
|
|
78
79
|
const profileCopy = { ...liquidData.profile };
|
|
80
|
+
this.logInfo('Traits Copy: ' + JSON.stringify(profileCopy));
|
|
79
81
|
for (const trait of Object.keys(profileCopy.traits || {})) {
|
|
80
82
|
if (profileCopy.traits && (profileCopy.traits[trait] === '<nil>' || profileCopy.traits[trait].trim() === '')) {
|
|
81
83
|
profileCopy.traits[trait] = '';
|