@segment/action-destinations 3.293.0 → 3.295.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/adjust/functions.d.ts +6 -0
- package/dist/destinations/adjust/functions.js +32 -0
- package/dist/destinations/adjust/functions.js.map +1 -0
- package/dist/destinations/adjust/generated-types.d.ts +5 -0
- package/dist/destinations/adjust/generated-types.js +3 -0
- package/dist/destinations/adjust/generated-types.js.map +1 -0
- package/dist/destinations/adjust/index.d.ts +4 -0
- package/dist/destinations/adjust/index.js +45 -0
- package/dist/destinations/adjust/index.js.map +1 -0
- package/dist/destinations/adjust/sendEvent/generated-types.d.ts +11 -0
- package/dist/destinations/adjust/sendEvent/generated-types.js +3 -0
- package/dist/destinations/adjust/sendEvent/generated-types.js.map +1 -0
- package/dist/destinations/adjust/sendEvent/index.d.ts +5 -0
- package/dist/destinations/adjust/sendEvent/index.js +87 -0
- package/dist/destinations/adjust/sendEvent/index.js.map +1 -0
- package/dist/destinations/adjust/types.d.ts +8 -0
- package/dist/destinations/adjust/types.js +3 -0
- package/dist/destinations/adjust/types.js.map +1 -0
- package/dist/destinations/angler-ai/index.js +1 -0
- package/dist/destinations/angler-ai/index.js.map +1 -1
- package/dist/destinations/angler-ai/saveBaseEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveCartEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveCheckoutEvent/index.js +2 -1
- package/dist/destinations/angler-ai/saveCheckoutEvent/index.js.map +1 -1
- package/dist/destinations/angler-ai/saveCheckoutEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveCollectionEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveCustomEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveFormEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveOrder/index.js +4 -4
- package/dist/destinations/angler-ai/saveOrder/index.js.map +1 -1
- package/dist/destinations/angler-ai/saveProductEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveSearchEvent/transform-payload.d.ts +1 -1
- package/dist/destinations/angler-ai/saveUser/index.js +2 -1
- package/dist/destinations/angler-ai/saveUser/index.js.map +1 -1
- package/dist/destinations/angler-ai/transformFields/transformCommonFields.d.ts +1 -1
- package/dist/destinations/angler-ai/transformFields/transformCommonFields.js +1 -1
- package/dist/destinations/app-fit/track/index.js +1 -1
- package/dist/destinations/app-fit/track/index.js.map +1 -1
- package/dist/destinations/aws-s3/operations.d.ts +2 -2
- package/dist/destinations/aws-s3/operations.js +45 -28
- package/dist/destinations/aws-s3/operations.js.map +1 -1
- package/dist/destinations/aws-s3/syncAudienceToCSV/generated-types.d.ts +1 -1
- package/dist/destinations/aws-s3/syncAudienceToCSV/index.js +2 -1
- package/dist/destinations/aws-s3/syncAudienceToCSV/index.js.map +1 -1
- package/dist/destinations/contentstack/customAttributesSync/generated-types.d.ts +1 -0
- package/dist/destinations/contentstack/customAttributesSync/index.js +25 -15
- package/dist/destinations/contentstack/customAttributesSync/index.js.map +1 -1
- package/dist/destinations/contentstack/index.js +9 -0
- package/dist/destinations/contentstack/index.js.map +1 -1
- package/dist/destinations/devrev/createRevUser/index.js +43 -27
- package/dist/destinations/devrev/createRevUser/index.js.map +1 -1
- package/dist/destinations/devrev/mocks/index.d.ts +16 -9
- package/dist/destinations/devrev/mocks/index.js +30 -7
- package/dist/destinations/devrev/mocks/index.js.map +1 -1
- package/dist/destinations/devrev/utils/constants.d.ts +1 -0
- package/dist/destinations/devrev/utils/constants.js +1 -0
- package/dist/destinations/devrev/utils/constants.js.map +1 -1
- package/dist/destinations/devrev/utils/types.d.ts +6 -1
- package/dist/destinations/dynamic-yield-audiences/index.js +1 -1
- package/dist/destinations/dynamic-yield-audiences/index.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +12 -7
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.js +8 -0
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/index.js +1 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/insider/insider-helpers.js +57 -76
- package/dist/destinations/insider/insider-helpers.js.map +1 -1
- package/dist/destinations/segment/segment-properties.d.ts +1 -1
- package/dist/destinations/segment/segment-properties.js +34 -8
- package/dist/destinations/segment/segment-properties.js.map +1 -1
- package/dist/destinations/segment/sendGroup/generated-types.d.ts +0 -1
- package/dist/destinations/segment/sendGroup/index.js +27 -41
- package/dist/destinations/segment/sendGroup/index.js.map +1 -1
- package/dist/destinations/segment/sendIdentify/generated-types.d.ts +7 -1
- package/dist/destinations/segment/sendIdentify/index.js +30 -42
- package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
- package/dist/destinations/segment/sendPage/generated-types.d.ts +0 -1
- package/dist/destinations/segment/sendPage/index.js +35 -49
- package/dist/destinations/segment/sendPage/index.js.map +1 -1
- package/dist/destinations/segment/sendScreen/generated-types.d.ts +0 -1
- package/dist/destinations/segment/sendScreen/index.js +28 -42
- package/dist/destinations/segment/sendScreen/index.js.map +1 -1
- package/dist/destinations/segment/sendTrack/generated-types.d.ts +0 -1
- package/dist/destinations/segment/sendTrack/index.js +31 -45
- package/dist/destinations/segment/sendTrack/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendgrid-properties.d.ts +0 -1
- package/dist/destinations/sendgrid/updateUserProfile/generated-types.d.ts +0 -1
- package/dist/destinations/sendgrid/updateUserProfile/index.js +6 -19
- package/dist/destinations/sendgrid/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/taboola-actions/index.js +2 -2
- package/dist/destinations/taboola-actions/index.js.map +1 -1
- package/dist/destinations/taboola-actions/syncAudience/index.js +5 -4
- package/dist/destinations/taboola-actions/syncAudience/index.js.map +1 -1
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -25,56 +25,42 @@ const action = {
|
|
|
25
25
|
timezone: segment_properties_1.timezone,
|
|
26
26
|
traits: segment_properties_1.traits,
|
|
27
27
|
message_id: segment_properties_1.message_id,
|
|
28
|
-
enable_batching: segment_properties_1.enable_batching,
|
|
29
28
|
consent: segment_properties_1.consent
|
|
30
29
|
},
|
|
31
30
|
perform: (_request, { payload, statsContext }) => {
|
|
32
31
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
33
32
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
34
33
|
}
|
|
35
|
-
const
|
|
34
|
+
const isValidConsentObject = segment_properties_1.validateConsentObject(payload?.consent);
|
|
35
|
+
const groupPayload = {
|
|
36
|
+
userId: payload?.user_id,
|
|
37
|
+
anonymousId: payload?.anonymous_id,
|
|
38
|
+
groupId: payload?.group_id,
|
|
39
|
+
timestamp: payload?.timestamp,
|
|
40
|
+
messageId: payload?.message_id,
|
|
41
|
+
context: {
|
|
42
|
+
app: payload?.application,
|
|
43
|
+
campaign: payload?.campaign_parameters,
|
|
44
|
+
consent: isValidConsentObject ? { ...payload?.consent } : {},
|
|
45
|
+
device: payload?.device,
|
|
46
|
+
ip: payload?.ip_address,
|
|
47
|
+
locale: payload?.locale,
|
|
48
|
+
location: payload?.location,
|
|
49
|
+
network: payload?.network,
|
|
50
|
+
os: payload?.operating_system,
|
|
51
|
+
page: payload?.page,
|
|
52
|
+
screen: payload?.screen,
|
|
53
|
+
userAgent: payload?.user_agent,
|
|
54
|
+
timezone: payload?.timezone
|
|
55
|
+
},
|
|
56
|
+
traits: {
|
|
57
|
+
...payload?.traits
|
|
58
|
+
},
|
|
59
|
+
type: 'group'
|
|
60
|
+
};
|
|
36
61
|
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendGroup']);
|
|
37
62
|
return { batch: [groupPayload] };
|
|
38
|
-
},
|
|
39
|
-
performBatch: (_request, { payload, statsContext }) => {
|
|
40
|
-
const groupPayload = payload.map((data) => {
|
|
41
|
-
if (!data.anonymous_id && !data.user_id) {
|
|
42
|
-
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
43
|
-
}
|
|
44
|
-
return convertPayload(data);
|
|
45
|
-
});
|
|
46
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendBatchGroup']);
|
|
47
|
-
return { batch: groupPayload };
|
|
48
63
|
}
|
|
49
64
|
};
|
|
50
|
-
function convertPayload(data) {
|
|
51
|
-
const isValidateConsentObject = segment_properties_1.validateConsentObject(data.consent);
|
|
52
|
-
return {
|
|
53
|
-
userId: data?.user_id,
|
|
54
|
-
anonymousId: data?.anonymous_id,
|
|
55
|
-
groupId: data?.group_id,
|
|
56
|
-
timestamp: data?.timestamp,
|
|
57
|
-
messageId: data?.message_id,
|
|
58
|
-
context: {
|
|
59
|
-
app: data?.application,
|
|
60
|
-
campaign: data?.campaign_parameters,
|
|
61
|
-
consent: isValidateConsentObject ? { ...data?.consent } : {},
|
|
62
|
-
device: data?.device,
|
|
63
|
-
ip: data?.ip_address,
|
|
64
|
-
locale: data?.locale,
|
|
65
|
-
location: data?.location,
|
|
66
|
-
network: data?.network,
|
|
67
|
-
os: data?.operating_system,
|
|
68
|
-
page: data?.page,
|
|
69
|
-
screen: data?.screen,
|
|
70
|
-
userAgent: data?.user_agent,
|
|
71
|
-
timezone: data?.timezone
|
|
72
|
-
},
|
|
73
|
-
traits: {
|
|
74
|
-
...data?.traits
|
|
75
|
-
},
|
|
76
|
-
type: 'group'
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
65
|
exports.default = action;
|
|
80
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendGroup/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendGroup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ACzB,QAAQ,EAAE,OAAO,EAAE,mBAAmB;gBACtC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC5D,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,EAAE,EAAE,OAAO,EAAE,UAAU;gBACvB,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,OAAO,EAAE,OAAO,EAAE,OAAO;gBACzB,EAAE,EAAE,OAAO,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,OAAO,EAAE,IAAI;gBACnB,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,SAAS,EAAE,OAAO,EAAE,UAAU;gBAC9B,QAAQ,EAAE,OAAO,EAAE,QAAQ;aAC5B;YACD,MAAM,EAAE;gBACN,GAAG,OAAO,EAAE,MAAM;aACnB;YACD,IAAI,EAAE,OAAO;SACd,CAAA;QAID,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAA;QAC/F,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,CAAA;IAClC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -63,8 +63,14 @@ export interface Payload {
|
|
|
63
63
|
[k: string]: unknown;
|
|
64
64
|
};
|
|
65
65
|
message_id?: string;
|
|
66
|
-
enable_batching?: boolean;
|
|
67
66
|
consent?: {
|
|
68
67
|
[k: string]: unknown;
|
|
69
68
|
};
|
|
69
|
+
address?: {
|
|
70
|
+
street?: string;
|
|
71
|
+
city?: string;
|
|
72
|
+
state?: string;
|
|
73
|
+
country?: string;
|
|
74
|
+
postalCode?: string;
|
|
75
|
+
};
|
|
70
76
|
}
|
|
@@ -25,56 +25,44 @@ const action = {
|
|
|
25
25
|
group_id: segment_properties_1.group_id,
|
|
26
26
|
traits: segment_properties_1.traits,
|
|
27
27
|
message_id: segment_properties_1.message_id,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
consent: segment_properties_1.consent,
|
|
29
|
+
address: segment_properties_1.address
|
|
30
30
|
},
|
|
31
31
|
perform: (_request, { payload, statsContext }) => {
|
|
32
32
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
33
33
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const isValidConsentObject = segment_properties_1.validateConsentObject(payload?.consent);
|
|
36
|
+
const identifyPayload = {
|
|
37
|
+
userId: payload?.user_id,
|
|
38
|
+
anonymousId: payload?.anonymous_id,
|
|
39
|
+
timestamp: payload?.timestamp,
|
|
40
|
+
messageId: payload?.message_id,
|
|
41
|
+
context: {
|
|
42
|
+
app: payload?.application,
|
|
43
|
+
campaign: payload?.campaign_parameters,
|
|
44
|
+
consent: isValidConsentObject ? { ...payload?.consent } : {},
|
|
45
|
+
device: payload?.device,
|
|
46
|
+
ip: payload?.ip_address,
|
|
47
|
+
locale: payload?.locale,
|
|
48
|
+
location: payload?.location,
|
|
49
|
+
network: payload?.network,
|
|
50
|
+
os: payload?.operating_system,
|
|
51
|
+
page: payload?.page,
|
|
52
|
+
screen: payload?.screen,
|
|
53
|
+
userAgent: payload?.user_agent,
|
|
54
|
+
timezone: payload?.timezone,
|
|
55
|
+
groupId: payload?.group_id
|
|
56
|
+
},
|
|
57
|
+
traits: {
|
|
58
|
+
...payload?.traits,
|
|
59
|
+
...(payload.address ? { address: payload.address } : {})
|
|
60
|
+
},
|
|
61
|
+
type: 'identify'
|
|
62
|
+
};
|
|
36
63
|
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendIdentify']);
|
|
37
64
|
return { batch: [identifyPayload] };
|
|
38
|
-
},
|
|
39
|
-
performBatch: (_request, { payload, statsContext }) => {
|
|
40
|
-
const identifyPayload = payload.map((data) => {
|
|
41
|
-
if (!data.anonymous_id && !data.user_id) {
|
|
42
|
-
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
43
|
-
}
|
|
44
|
-
return convertPayload(data);
|
|
45
|
-
});
|
|
46
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:identifyBatchPayload']);
|
|
47
|
-
return { batch: identifyPayload };
|
|
48
65
|
}
|
|
49
66
|
};
|
|
50
|
-
function convertPayload(data) {
|
|
51
|
-
const isValidConsentObject = segment_properties_1.validateConsentObject(data?.consent);
|
|
52
|
-
return {
|
|
53
|
-
userId: data?.user_id,
|
|
54
|
-
anonymousId: data?.anonymous_id,
|
|
55
|
-
timestamp: data?.timestamp,
|
|
56
|
-
messageId: data?.message_id,
|
|
57
|
-
context: {
|
|
58
|
-
app: data?.application,
|
|
59
|
-
campaign: data?.campaign_parameters,
|
|
60
|
-
consent: isValidConsentObject ? { ...data?.consent } : {},
|
|
61
|
-
device: data?.device,
|
|
62
|
-
ip: data?.ip_address,
|
|
63
|
-
locale: data?.locale,
|
|
64
|
-
location: data?.location,
|
|
65
|
-
network: data?.network,
|
|
66
|
-
os: data?.operating_system,
|
|
67
|
-
page: data?.page,
|
|
68
|
-
screen: data?.screen,
|
|
69
|
-
userAgent: data?.user_agent,
|
|
70
|
-
timezone: data?.timezone,
|
|
71
|
-
groupId: data?.group_id
|
|
72
|
-
},
|
|
73
|
-
traits: {
|
|
74
|
-
...data?.traits
|
|
75
|
-
},
|
|
76
|
-
type: 'identify'
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
67
|
exports.default = action;
|
|
80
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendIdentify/index.ts"],"names":[],"mappings":";;AAGA,8DAsB8B;AAC9B,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,gIAAgI;IAClI,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,WAAW,EAAX,gCAAW;QACX,mBAAmB,EAAnB,wCAAmB;QACnB,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,QAAQ,EAAR,6BAAQ;QACR,OAAO,EAAP,4BAAO;QACP,gBAAgB,EAAhB,qCAAgB;QAChB,IAAI,EAAJ,yBAAI;QACJ,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,QAAQ,EAAR,6BAAQ;QACR,QAAQ,EAAR,6BAAQ;QACR,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendIdentify/index.ts"],"names":[],"mappings":";;AAGA,8DAsB8B;AAC9B,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,gIAAgI;IAClI,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,WAAW,EAAX,gCAAW;QACX,mBAAmB,EAAnB,wCAAmB;QACnB,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,QAAQ,EAAR,6BAAQ;QACR,OAAO,EAAP,4BAAO;QACP,gBAAgB,EAAhB,qCAAgB;QAChB,IAAI,EAAJ,yBAAI;QACJ,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,QAAQ,EAAR,6BAAQ;QACR,QAAQ,EAAR,6BAAQ;QACR,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV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AAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzD;YACD,IAAI,EAAE,UAAU;SACjB,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAA;QAClG,OAAO,EAAE,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE,CAAA;IACrC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -27,64 +27,50 @@ const action = {
|
|
|
27
27
|
group_id: segment_properties_1.group_id,
|
|
28
28
|
properties: segment_properties_1.properties,
|
|
29
29
|
message_id: segment_properties_1.message_id,
|
|
30
|
-
enable_batching: segment_properties_1.enable_batching,
|
|
31
30
|
consent: segment_properties_1.consent
|
|
32
31
|
},
|
|
33
32
|
perform: (_request, { payload, statsContext }) => {
|
|
34
33
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
35
34
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
36
35
|
}
|
|
37
|
-
const
|
|
36
|
+
const isValidConsentObject = segment_properties_1.validateConsentObject(payload?.consent);
|
|
37
|
+
const pagePayload = {
|
|
38
|
+
userId: payload?.user_id,
|
|
39
|
+
anonymousId: payload?.anonymous_id,
|
|
40
|
+
timestamp: payload?.timestamp,
|
|
41
|
+
name: payload?.page_name,
|
|
42
|
+
messageId: payload?.message_id,
|
|
43
|
+
context: {
|
|
44
|
+
app: payload?.application,
|
|
45
|
+
campaign: payload?.campaign_parameters,
|
|
46
|
+
consent: isValidConsentObject ? { ...payload?.consent } : {},
|
|
47
|
+
device: payload?.device,
|
|
48
|
+
ip: payload?.ip_address,
|
|
49
|
+
locale: payload?.locale,
|
|
50
|
+
location: payload?.location,
|
|
51
|
+
network: payload?.network,
|
|
52
|
+
os: payload?.operating_system,
|
|
53
|
+
page: payload?.page,
|
|
54
|
+
screen: payload?.screen,
|
|
55
|
+
userAgent: payload?.user_agent,
|
|
56
|
+
timezone: payload?.timezone,
|
|
57
|
+
groupId: payload?.group_id
|
|
58
|
+
},
|
|
59
|
+
properties: {
|
|
60
|
+
name: payload?.page_name,
|
|
61
|
+
category: payload?.page_category,
|
|
62
|
+
path: payload?.page?.path,
|
|
63
|
+
referrer: payload?.page?.referrer,
|
|
64
|
+
search: payload?.page?.search,
|
|
65
|
+
title: payload?.page?.title,
|
|
66
|
+
url: payload?.page?.url,
|
|
67
|
+
...payload?.properties
|
|
68
|
+
},
|
|
69
|
+
type: 'page'
|
|
70
|
+
};
|
|
38
71
|
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendPage']);
|
|
39
72
|
return { batch: [pagePayload] };
|
|
40
|
-
},
|
|
41
|
-
performBatch: (_request, { payload, statsContext }) => {
|
|
42
|
-
const pagePayload = payload.map((data) => {
|
|
43
|
-
if (!data.anonymous_id && !data.user_id) {
|
|
44
|
-
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
45
|
-
}
|
|
46
|
-
return convertPayload(data);
|
|
47
|
-
});
|
|
48
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendBatchPage']);
|
|
49
|
-
return { batch: pagePayload };
|
|
50
73
|
}
|
|
51
74
|
};
|
|
52
|
-
function convertPayload(data) {
|
|
53
|
-
const isValidConsentObject = segment_properties_1.validateConsentObject(data?.consent);
|
|
54
|
-
return {
|
|
55
|
-
userId: data?.user_id,
|
|
56
|
-
anonymousId: data?.anonymous_id,
|
|
57
|
-
timestamp: data?.timestamp,
|
|
58
|
-
name: data?.page_name,
|
|
59
|
-
messageId: data?.message_id,
|
|
60
|
-
context: {
|
|
61
|
-
app: data?.application,
|
|
62
|
-
campaign: data?.campaign_parameters,
|
|
63
|
-
consent: isValidConsentObject ? { ...data?.consent } : {},
|
|
64
|
-
device: data?.device,
|
|
65
|
-
ip: data?.ip_address,
|
|
66
|
-
locale: data?.locale,
|
|
67
|
-
location: data?.location,
|
|
68
|
-
network: data?.network,
|
|
69
|
-
os: data?.operating_system,
|
|
70
|
-
page: data?.page,
|
|
71
|
-
screen: data?.screen,
|
|
72
|
-
userAgent: data?.user_agent,
|
|
73
|
-
timezone: data?.timezone,
|
|
74
|
-
groupId: data?.group_id
|
|
75
|
-
},
|
|
76
|
-
properties: {
|
|
77
|
-
name: data?.page_name,
|
|
78
|
-
category: data?.page_category,
|
|
79
|
-
path: data?.page?.path,
|
|
80
|
-
referrer: data?.page?.referrer,
|
|
81
|
-
search: data?.page?.search,
|
|
82
|
-
title: data?.page?.title,
|
|
83
|
-
url: data?.page?.url,
|
|
84
|
-
...data?.properties
|
|
85
|
-
},
|
|
86
|
-
type: 'page'
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
75
|
exports.default = action;
|
|
90
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendPage/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendPage/index.ts"],"names":[],"mappings":";;AAGA,8DAuB8B;AAC9B,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,uFAAuF;IACpG,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,SAAS,EAAT,8BAAS;QACT,aAAa,EAAb,kCAAa;QACb,WAAW,EAAX,gCAAW;QACX,mBAAmB,EAAnB,wCAAmB;QACnB,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,QAAQ,EAAR,6BAAQ;QACR,OAAO,EAAP,4BAAO;QACP,gBAAgB,EAAhB,qCAAgB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,EAAE,OAAO,EAAE,QAAQ;gBAC3B,OAAO,EAAE,OAAO,EAAE,QAAQ;aAC3B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,OAAO,EAAE,SAAS;gBACxB,QAAQ,EAAE,OAAO,EAAE,aAAa;gBAChC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;gBACzB,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ;gBACjC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM;gBAC7B,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK;gBAC3B,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG;gBACvB,GAAG,OAAO,EAAE,UAAU;aACvB;YACD,IAAI,EAAE,MAAM;SACb,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAA;QAC9F,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -26,57 +26,43 @@ const action = {
|
|
|
26
26
|
group_id: segment_properties_1.group_id,
|
|
27
27
|
properties: segment_properties_1.properties,
|
|
28
28
|
message_id: segment_properties_1.message_id,
|
|
29
|
-
enable_batching: segment_properties_1.enable_batching,
|
|
30
29
|
consent: segment_properties_1.consent
|
|
31
30
|
},
|
|
32
31
|
perform: (_request, { payload, statsContext }) => {
|
|
33
32
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
34
33
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
35
34
|
}
|
|
36
|
-
const
|
|
35
|
+
const isValidConsentObject = segment_properties_1.validateConsentObject(payload?.consent);
|
|
36
|
+
const screenPayload = {
|
|
37
|
+
userId: payload?.user_id,
|
|
38
|
+
anonymousId: payload?.anonymous_id,
|
|
39
|
+
timestamp: payload?.timestamp,
|
|
40
|
+
name: payload?.screen_name,
|
|
41
|
+
messageId: payload?.message_id,
|
|
42
|
+
context: {
|
|
43
|
+
app: payload?.application,
|
|
44
|
+
campaign: payload?.campaign_parameters,
|
|
45
|
+
consent: isValidConsentObject ? { ...payload?.consent } : {},
|
|
46
|
+
device: payload?.device,
|
|
47
|
+
ip: payload?.ip_address,
|
|
48
|
+
locale: payload?.locale,
|
|
49
|
+
location: payload?.location,
|
|
50
|
+
network: payload?.network,
|
|
51
|
+
os: payload?.operating_system,
|
|
52
|
+
page: payload?.page,
|
|
53
|
+
screen: payload?.screen,
|
|
54
|
+
userAgent: payload?.user_agent,
|
|
55
|
+
groupId: payload?.group_id
|
|
56
|
+
},
|
|
57
|
+
properties: {
|
|
58
|
+
name: payload?.screen_name,
|
|
59
|
+
...payload?.properties
|
|
60
|
+
},
|
|
61
|
+
type: 'screen'
|
|
62
|
+
};
|
|
37
63
|
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendScreen']);
|
|
38
64
|
return { batch: [screenPayload] };
|
|
39
|
-
},
|
|
40
|
-
performBatch: (_request, { payload, statsContext }) => {
|
|
41
|
-
const screenPayload = payload.map((data) => {
|
|
42
|
-
if (!data.anonymous_id && !data.user_id) {
|
|
43
|
-
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
44
|
-
}
|
|
45
|
-
return convertPayload(data);
|
|
46
|
-
});
|
|
47
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendBatchScreen']);
|
|
48
|
-
return { batch: screenPayload };
|
|
49
65
|
}
|
|
50
66
|
};
|
|
51
|
-
function convertPayload(data) {
|
|
52
|
-
const isValidConsentObject = segment_properties_1.validateConsentObject(data?.consent);
|
|
53
|
-
return {
|
|
54
|
-
userId: data?.user_id,
|
|
55
|
-
anonymousId: data?.anonymous_id,
|
|
56
|
-
timestamp: data?.timestamp,
|
|
57
|
-
name: data?.screen_name,
|
|
58
|
-
messageId: data?.message_id,
|
|
59
|
-
context: {
|
|
60
|
-
app: data?.application,
|
|
61
|
-
campaign: data?.campaign_parameters,
|
|
62
|
-
consent: isValidConsentObject ? { ...data?.consent } : {},
|
|
63
|
-
device: data?.device,
|
|
64
|
-
ip: data?.ip_address,
|
|
65
|
-
locale: data?.locale,
|
|
66
|
-
location: data?.location,
|
|
67
|
-
network: data?.network,
|
|
68
|
-
os: data?.operating_system,
|
|
69
|
-
page: data?.page,
|
|
70
|
-
screen: data?.screen,
|
|
71
|
-
userAgent: data?.user_agent,
|
|
72
|
-
groupId: data?.group_id
|
|
73
|
-
},
|
|
74
|
-
properties: {
|
|
75
|
-
name: data?.screen_name,
|
|
76
|
-
...data?.properties
|
|
77
|
-
},
|
|
78
|
-
type: 'screen'
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
67
|
exports.default = action;
|
|
82
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendScreen/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendScreen/index.ts"],"names":[],"mappings":";;AAGA,8DAsB8B;AAC9B,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,8FAA8F;IAC3G,mBAAmB,EAAE,iBAAiB;IACtC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,WAAW,EAAX,gCAAW;QACX,WAAW,EAAX,gCAAW;QACX,mBAAmB,EAAnB,wCAAmB;QACnB,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,QAAQ,EAAR,6BAAQ;QACR,OAAO,EAAP,4BAAO;QACP,gBAAgB,EAAhB,qCAA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O,EAAE,OAAO,EAAE,QAAQ;aAC3B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,OAAO,EAAE,WAAW;gBAC1B,GAAG,OAAO,EAAE,UAAU;aACvB;YACD,IAAI,EAAE,QAAQ;SACf,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAA;QAChG,OAAO,EAAE,KAAK,EAAE,CAAC,aAAa,CAAC,EAAE,CAAA;IACnC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -27,60 +27,46 @@ const action = {
|
|
|
27
27
|
properties: segment_properties_1.properties,
|
|
28
28
|
traits: segment_properties_1.traits,
|
|
29
29
|
message_id: segment_properties_1.message_id,
|
|
30
|
-
enable_batching: segment_properties_1.enable_batching,
|
|
31
30
|
consent: segment_properties_1.consent
|
|
32
31
|
},
|
|
33
32
|
perform: (_request, { payload, statsContext }) => {
|
|
34
33
|
if (!payload.anonymous_id && !payload.user_id) {
|
|
35
34
|
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
36
35
|
}
|
|
37
|
-
const
|
|
36
|
+
const isValidConsentObject = segment_properties_1.validateConsentObject(payload?.consent);
|
|
37
|
+
const trackPayload = {
|
|
38
|
+
userId: payload?.user_id,
|
|
39
|
+
anonymousId: payload?.anonymous_id,
|
|
40
|
+
timestamp: payload?.timestamp,
|
|
41
|
+
event: payload?.event_name,
|
|
42
|
+
messageId: payload?.message_id,
|
|
43
|
+
context: {
|
|
44
|
+
traits: {
|
|
45
|
+
...payload?.traits
|
|
46
|
+
},
|
|
47
|
+
app: payload?.application,
|
|
48
|
+
campaign: payload?.campaign_parameters,
|
|
49
|
+
consent: isValidConsentObject ? { ...payload?.consent } : {},
|
|
50
|
+
device: payload?.device,
|
|
51
|
+
ip: payload?.ip_address,
|
|
52
|
+
locale: payload?.locale,
|
|
53
|
+
location: payload?.location,
|
|
54
|
+
network: payload?.network,
|
|
55
|
+
os: payload?.operating_system,
|
|
56
|
+
page: payload?.page,
|
|
57
|
+
screen: payload?.screen,
|
|
58
|
+
userAgent: payload?.user_agent,
|
|
59
|
+
timezone: payload?.timezone,
|
|
60
|
+
groupId: payload?.group_id
|
|
61
|
+
},
|
|
62
|
+
properties: {
|
|
63
|
+
...payload?.properties
|
|
64
|
+
},
|
|
65
|
+
type: 'track'
|
|
66
|
+
};
|
|
38
67
|
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendTrack']);
|
|
39
68
|
return { batch: [trackPayload] };
|
|
40
|
-
},
|
|
41
|
-
performBatch: (_request, { payload, statsContext }) => {
|
|
42
|
-
const trackPayload = payload.map((data) => {
|
|
43
|
-
if (!data.anonymous_id && !data.user_id) {
|
|
44
|
-
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
45
|
-
}
|
|
46
|
-
return convertPayload(data);
|
|
47
|
-
});
|
|
48
|
-
statsContext?.statsClient?.incr('tapi_internal', 1, [...statsContext.tags, 'action:sendBatchTrack']);
|
|
49
|
-
return { batch: trackPayload };
|
|
50
69
|
}
|
|
51
70
|
};
|
|
52
|
-
function convertPayload(data) {
|
|
53
|
-
const isValidConsentObject = segment_properties_1.validateConsentObject(data?.consent);
|
|
54
|
-
return {
|
|
55
|
-
userId: data?.user_id,
|
|
56
|
-
anonymousId: data?.anonymous_id,
|
|
57
|
-
timestamp: data?.timestamp,
|
|
58
|
-
event: data?.event_name,
|
|
59
|
-
messageId: data?.message_id,
|
|
60
|
-
context: {
|
|
61
|
-
traits: {
|
|
62
|
-
...data?.traits
|
|
63
|
-
},
|
|
64
|
-
app: data?.application,
|
|
65
|
-
campaign: data?.campaign_parameters,
|
|
66
|
-
consent: isValidConsentObject ? { ...data?.consent } : {},
|
|
67
|
-
device: data?.device,
|
|
68
|
-
ip: data?.ip_address,
|
|
69
|
-
locale: data?.locale,
|
|
70
|
-
location: data?.location,
|
|
71
|
-
network: data?.network,
|
|
72
|
-
os: data?.operating_system,
|
|
73
|
-
page: data?.page,
|
|
74
|
-
screen: data?.screen,
|
|
75
|
-
userAgent: data?.user_agent,
|
|
76
|
-
timezone: data?.timezone,
|
|
77
|
-
groupId: data?.group_id
|
|
78
|
-
},
|
|
79
|
-
properties: {
|
|
80
|
-
...data?.properties
|
|
81
|
-
},
|
|
82
|
-
type: 'track'
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
71
|
exports.default = action;
|
|
86
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendTrack/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendTrack/index.ts"],"names":[],"mappings":";;AAGA,8DAuB8B;AAC9B,sCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,iGAAiG;IAC9G,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,UAAU,EAAV,+BAAU;QACV,WAAW,EAAX,gCAAW;QACX,mBAAmB,EAAnB,wCAAmB;QACnB,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,QAAQ,EAAR,6BAAQ;QACR,OAAO,EAAP,4BAAO;QACP,gBAAgB,EAAhB,qCAAgB;QAChB,IAAI,EAAJ,yBAAI;QACJ,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,QAAQ,EAAR,6BAAQ;QACR,QAAQ,EAAR,6BAAQ;QACR,UAAU,EAAV,+BAAU;QACV,MAAM,EAAN,2BAAM;QACN,UAAU,EAAV,+BAAU;QACV,OAAO,EAAP,4BA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,OAAO;SACd,CAAA;QAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAA;QAC/F,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,CAAA;IAClC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -24,7 +24,6 @@ export declare const convertPayload: (payload: Payload, accountCustomFields: Cus
|
|
|
24
24
|
line?: string | null | undefined;
|
|
25
25
|
facebook?: string | null | undefined;
|
|
26
26
|
unique_name?: string | null | undefined;
|
|
27
|
-
identity?: string | null | undefined;
|
|
28
27
|
phone_number_id?: string | null | undefined;
|
|
29
28
|
external_id?: string | null | undefined;
|
|
30
29
|
anonymous_id?: string | null | undefined;
|
|
@@ -118,7 +118,7 @@ const action = {
|
|
|
118
118
|
},
|
|
119
119
|
phone_number: {
|
|
120
120
|
label: 'Phone Number',
|
|
121
|
-
description: `The contact's phone number.`,
|
|
121
|
+
description: `The contact's phone number. Note: This is different from the Phone Number ID field, but the same value can be stored in both fields.`,
|
|
122
122
|
type: 'string',
|
|
123
123
|
allowNull: true,
|
|
124
124
|
default: {
|
|
@@ -143,8 +143,8 @@ const action = {
|
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
line: {
|
|
146
|
-
label: '
|
|
147
|
-
description: `The contact's
|
|
146
|
+
label: 'Line',
|
|
147
|
+
description: `The contact's landline.`,
|
|
148
148
|
type: 'string',
|
|
149
149
|
allowNull: true,
|
|
150
150
|
default: {
|
|
@@ -156,8 +156,8 @@ const action = {
|
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
facebook: {
|
|
159
|
-
label: 'Facebook
|
|
160
|
-
description: `The contact's Facebook
|
|
159
|
+
label: 'Facebook',
|
|
160
|
+
description: `The contact's Facebook identifier.`,
|
|
161
161
|
type: 'string',
|
|
162
162
|
allowNull: true,
|
|
163
163
|
default: {
|
|
@@ -181,19 +181,6 @@ const action = {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
|
-
identity: {
|
|
185
|
-
label: 'Identity',
|
|
186
|
-
description: `The contact's identity.`,
|
|
187
|
-
type: 'string',
|
|
188
|
-
allowNull: true,
|
|
189
|
-
default: {
|
|
190
|
-
'@if': {
|
|
191
|
-
exists: { '@path': '$.traits.identity' },
|
|
192
|
-
then: { '@path': '$.traits.identity' },
|
|
193
|
-
else: { '@path': '$.properties.identity' }
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
184
|
primary_email: {
|
|
198
185
|
label: 'Email Address',
|
|
199
186
|
description: `The contact's email address.`,
|
|
@@ -210,7 +197,7 @@ const action = {
|
|
|
210
197
|
},
|
|
211
198
|
phone_number_id: {
|
|
212
199
|
label: 'Phone Number ID',
|
|
213
|
-
description: `
|
|
200
|
+
description: `Primary Phone Number used to identify a Contact. This must be a valid phone number.`,
|
|
214
201
|
type: 'string',
|
|
215
202
|
allowNull: true,
|
|
216
203
|
required: false,
|