@segment/action-destinations 3.132.1-ga4-cloud.16 → 3.132.1-intercom-fix.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/google-analytics-4/addPaymentInfo/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +6 -10
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToCart/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/addToCart/index.js +6 -10
- package/dist/destinations/google-analytics-4/addToCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/addToWishlist/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/addToWishlist/index.js +6 -10
- package/dist/destinations/google-analytics-4/addToWishlist/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/beginCheckout/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/beginCheckout/index.js +6 -10
- package/dist/destinations/google-analytics-4/beginCheckout/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/customEvent/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/customEvent/index.js +6 -10
- package/dist/destinations/google-analytics-4/customEvent/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-functions.d.ts +0 -7
- package/dist/destinations/google-analytics-4/ga4-functions.js +1 -38
- package/dist/destinations/google-analytics-4/ga4-functions.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-properties.d.ts +0 -2
- package/dist/destinations/google-analytics-4/ga4-properties.js +3 -17
- package/dist/destinations/google-analytics-4/ga4-properties.js.map +1 -1
- package/dist/destinations/google-analytics-4/ga4-types.d.ts +0 -14
- package/dist/destinations/google-analytics-4/ga4-types.js +0 -6
- package/dist/destinations/google-analytics-4/ga4-types.js.map +1 -1
- package/dist/destinations/google-analytics-4/generateLead/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/generateLead/index.js +6 -10
- package/dist/destinations/google-analytics-4/generateLead/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/generated-types.d.ts +1 -2
- package/dist/destinations/google-analytics-4/index.js +10 -15
- package/dist/destinations/google-analytics-4/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/login/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/login/index.js +6 -10
- package/dist/destinations/google-analytics-4/login/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/pageView/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/pageView/index.js +6 -10
- package/dist/destinations/google-analytics-4/pageView/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/purchase/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/purchase/index.js +6 -10
- package/dist/destinations/google-analytics-4/purchase/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/refund/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/refund/index.js +6 -10
- package/dist/destinations/google-analytics-4/refund/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/removeFromCart/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/removeFromCart/index.js +6 -10
- package/dist/destinations/google-analytics-4/removeFromCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/search/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/search/index.js +6 -10
- package/dist/destinations/google-analytics-4/search/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectItem/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/selectItem/index.js +6 -10
- package/dist/destinations/google-analytics-4/selectItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/selectPromotion/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/selectPromotion/index.js +6 -10
- package/dist/destinations/google-analytics-4/selectPromotion/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/signUp/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/signUp/index.js +6 -10
- package/dist/destinations/google-analytics-4/signUp/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewCart/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/viewCart/index.js +6 -10
- package/dist/destinations/google-analytics-4/viewCart/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItem/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/viewItem/index.js +6 -10
- package/dist/destinations/google-analytics-4/viewItem/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewItemList/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/viewItemList/index.js +6 -10
- package/dist/destinations/google-analytics-4/viewItemList/index.js.map +1 -1
- package/dist/destinations/google-analytics-4/viewPromotion/generated-types.d.ts +1 -3
- package/dist/destinations/google-analytics-4/viewPromotion/index.js +6 -10
- package/dist/destinations/google-analytics-4/viewPromotion/index.js.map +1 -1
- package/dist/destinations/intercom/index.js +1 -1
- package/dist/destinations/intercom/index.js.map +1 -1
- package/dist/destinations/mixpanel/identifyUser/index.js +1 -1
- package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/functions.js +2 -2
- package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
- package/dist/destinations/mixpanel/utils.d.ts +2 -2
- package/dist/destinations/mixpanel/utils.js +5 -9
- package/dist/destinations/mixpanel/utils.js.map +1 -1
- package/dist/destinations/saleswings/api.d.ts +4 -35
- package/dist/destinations/saleswings/api.js +7 -16
- package/dist/destinations/saleswings/api.js.map +1 -1
- package/dist/destinations/saleswings/common.d.ts +3 -3
- package/dist/destinations/saleswings/common.js +6 -18
- package/dist/destinations/saleswings/common.js.map +1 -1
- package/dist/destinations/saleswings/fields.d.ts +2 -2
- package/dist/destinations/saleswings/fields.js +3 -3
- package/dist/destinations/saleswings/generated-types.d.ts +1 -0
- package/dist/destinations/saleswings/index.js +12 -2
- package/dist/destinations/saleswings/index.js.map +1 -1
- package/dist/destinations/saleswings/submitIdentifyEvent/generated-types.d.ts +2 -2
- package/dist/destinations/saleswings/submitIdentifyEvent/index.js +4 -18
- package/dist/destinations/saleswings/submitIdentifyEvent/index.js.map +1 -1
- package/dist/destinations/saleswings/submitPageEvent/generated-types.d.ts +2 -2
- package/dist/destinations/saleswings/submitPageEvent/index.js +4 -18
- package/dist/destinations/saleswings/submitPageEvent/index.js.map +1 -1
- package/dist/destinations/saleswings/submitScreenEvent/generated-types.d.ts +2 -2
- package/dist/destinations/saleswings/submitScreenEvent/index.js +4 -21
- package/dist/destinations/saleswings/submitScreenEvent/index.js.map +1 -1
- package/dist/destinations/saleswings/submitTrackEvent/generated-types.d.ts +2 -2
- package/dist/destinations/saleswings/submitTrackEvent/index.js +4 -21
- package/dist/destinations/saleswings/submitTrackEvent/index.js.map +1 -1
- package/dist/destinations/saleswings/testing.d.ts +1 -3
- package/dist/destinations/saleswings/testing.js +13 -23
- package/dist/destinations/saleswings/testing.js.map +1 -1
- package/dist/destinations/webhook/__test__/webhook.test.js +36 -0
- package/dist/destinations/webhook/__test__/webhook.test.js.map +1 -1
- package/dist/destinations/webhook/index.js +3 -4
- package/dist/destinations/webhook/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/destinations/saleswings/converter.d.ts +0 -12
- package/dist/destinations/saleswings/converter.js +0 -34
- package/dist/destinations/saleswings/converter.js.map +0 -1
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export declare class TrackingEvent {
|
|
7
|
-
leadRefs: LeadRef[];
|
|
8
|
-
kind: string;
|
|
9
|
-
data: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
referrerUrl?: string;
|
|
12
|
-
userAgent?: string;
|
|
13
|
-
timestamp: number;
|
|
14
|
-
values: ValueMap;
|
|
15
|
-
readonly type: string;
|
|
16
|
-
constructor(fields?: Partial<TrackingEvent>);
|
|
17
|
-
}
|
|
18
|
-
export declare class PageVisitEvent {
|
|
19
|
-
leadRefs: LeadRef[];
|
|
20
|
-
url: string;
|
|
21
|
-
referrerUrl?: string;
|
|
22
|
-
userAgent?: string;
|
|
23
|
-
timestamp: number;
|
|
24
|
-
readonly type: string;
|
|
25
|
-
constructor(fields?: Partial<PageVisitEvent>);
|
|
26
|
-
}
|
|
27
|
-
export declare type Value = string | number | boolean;
|
|
28
|
-
export declare type ValueMap = {
|
|
29
|
-
[k: string]: Value;
|
|
30
|
-
};
|
|
31
|
-
export declare type LeadRefType = 'email' | 'client-id';
|
|
32
|
-
export declare type LeadRef = {
|
|
33
|
-
type: LeadRefType;
|
|
34
|
-
value: string;
|
|
35
|
-
};
|
|
1
|
+
export declare type EventType = 'track' | 'identify' | 'page' | 'screen';
|
|
2
|
+
export declare const submitEventUrl: (env: string, eventType: EventType) => string;
|
|
3
|
+
export declare const submitEventBatchUrl: (env: string, eventType: EventType) => string;
|
|
4
|
+
export declare const getAccountUrl: (env: string) => string;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
exports.TrackingEvent = TrackingEvent;
|
|
12
|
-
class PageVisitEvent {
|
|
13
|
-
constructor(fields) {
|
|
14
|
-
this.type = 'page-visit';
|
|
15
|
-
Object.assign(this, fields);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.PageVisitEvent = PageVisitEvent;
|
|
3
|
+
exports.getAccountUrl = exports.submitEventBatchUrl = exports.submitEventUrl = void 0;
|
|
4
|
+
const submitEventUrl = (env, eventType) => `https://${env}.saleswings.pro/api/segment/events/${eventType}`;
|
|
5
|
+
exports.submitEventUrl = submitEventUrl;
|
|
6
|
+
const submitEventBatchUrl = (env, eventType) => `https://${env}.saleswings.pro/api/segment/events/${eventType}/batches`;
|
|
7
|
+
exports.submitEventBatchUrl = submitEventBatchUrl;
|
|
8
|
+
const getAccountUrl = (env) => `https://${env}.saleswings.pro/api/core/project/account`;
|
|
9
|
+
exports.getAccountUrl = getAccountUrl;
|
|
19
10
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/api.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,SAAoB,EAAU,EAAE,CAC1E,WAAW,GAAG,sCAAsC,SAAS,EAAE,CAAA;AADpD,QAAA,cAAc,kBACsC;AAC1D,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,SAAoB,EAAU,EAAE,CAC/E,WAAW,GAAG,sCAAsC,SAAS,UAAU,CAAA;AAD5D,QAAA,mBAAmB,uBACyC;AAClE,MAAM,aAAa,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,WAAW,GAAG,0CAA0C,CAAA;AAAjG,QAAA,aAAa,iBAAoF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestFn } from '@segment/actions-core';
|
|
2
|
-
import {
|
|
2
|
+
import { EventType } from './api';
|
|
3
3
|
import { Settings } from './generated-types';
|
|
4
|
-
export declare function perform<Payload>(
|
|
5
|
-
export declare function performBatch<Payload>(
|
|
4
|
+
export declare function perform<Payload>(eventType: EventType): RequestFn<Settings, Payload>;
|
|
5
|
+
export declare function performBatch<Payload>(eventType: EventType): RequestFn<Settings, Payload[]>;
|
|
@@ -2,36 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.performBatch = exports.perform = void 0;
|
|
4
4
|
const api_1 = require("./api");
|
|
5
|
-
function perform(
|
|
5
|
+
function perform(eventType) {
|
|
6
6
|
return (request, data) => {
|
|
7
|
-
|
|
8
|
-
if (!event)
|
|
9
|
-
return;
|
|
10
|
-
return request(`${api_1.apiBaseUrl}/events`, {
|
|
7
|
+
return request(api_1.submitEventUrl(data.settings.environment, eventType), {
|
|
11
8
|
method: 'post',
|
|
12
|
-
json:
|
|
9
|
+
json: data.payload,
|
|
13
10
|
headers: { Authorization: `Bearer ${data.settings.apiKey}` }
|
|
14
11
|
});
|
|
15
12
|
};
|
|
16
13
|
}
|
|
17
14
|
exports.perform = perform;
|
|
18
|
-
function performBatch(
|
|
15
|
+
function performBatch(eventType) {
|
|
19
16
|
return (request, data) => {
|
|
20
|
-
|
|
21
|
-
if (!batch)
|
|
22
|
-
return;
|
|
23
|
-
return request(`${api_1.apiBaseUrl}/events/batches`, {
|
|
17
|
+
return request(api_1.submitEventBatchUrl(data.settings.environment, eventType), {
|
|
24
18
|
method: 'post',
|
|
25
|
-
json:
|
|
19
|
+
json: data.payload,
|
|
26
20
|
headers: { Authorization: `Bearer ${data.settings.apiKey}` }
|
|
27
21
|
});
|
|
28
22
|
};
|
|
29
23
|
}
|
|
30
24
|
exports.performBatch = performBatch;
|
|
31
|
-
function convertEventBatch(payloads, convertEvent) {
|
|
32
|
-
const events = payloads.map(convertEvent).filter((evt) => evt);
|
|
33
|
-
if (events.length == 0)
|
|
34
|
-
return undefined;
|
|
35
|
-
return { events };
|
|
36
|
-
}
|
|
37
25
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/common.ts"],"names":[],"mappings":";;;AACA,+
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/common.ts"],"names":[],"mappings":";;;AACA,+BAAsE;AAGtE,SAAgB,OAAO,CAAU,SAAoB;IACnD,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACvB,OAAO,OAAO,CAAC,oBAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;SAC7D,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AARD,0BAQC;AAED,SAAgB,YAAY,CAAU,SAAoB;IACxD,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACvB,OAAO,OAAO,CAAC,yBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE;YACxE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;SAC7D,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AARD,oCAQC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputField } from '@segment/actions-core';
|
|
2
2
|
import { Directive } from '@segment/actions-core/src/destination-kit/types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const userID: InputField;
|
|
4
|
+
export declare const anonymousID: InputField;
|
|
5
5
|
export declare const email: InputField;
|
|
6
6
|
export declare const url: InputField;
|
|
7
7
|
export declare const referrerUrl: InputField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.values = exports.data = exports.kind = exports.timestamp = exports.userAgent = exports.referrerUrl = exports.url = exports.email = exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.values = exports.data = exports.kind = exports.timestamp = exports.userAgent = exports.referrerUrl = exports.url = exports.email = exports.anonymousID = exports.userID = void 0;
|
|
4
|
+
exports.userID = {
|
|
5
5
|
label: 'Segment User ID',
|
|
6
6
|
description: 'Permanent identifier of a Segment user the event is attributed to.',
|
|
7
7
|
type: 'string',
|
|
@@ -10,7 +10,7 @@ exports.userId = {
|
|
|
10
10
|
'@path': '$.userId'
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
exports.
|
|
13
|
+
exports.anonymousID = {
|
|
14
14
|
label: 'Segment Anonymous User ID',
|
|
15
15
|
description: 'A pseudo-unique substitute for a Segment user ID the event is attributed to.',
|
|
16
16
|
type: 'string',
|
|
@@ -21,13 +21,23 @@ const destination = {
|
|
|
21
21
|
description: 'Segment.io API key for your SalesWings project.',
|
|
22
22
|
type: 'password',
|
|
23
23
|
required: true
|
|
24
|
+
},
|
|
25
|
+
environment: {
|
|
26
|
+
label: 'Environment',
|
|
27
|
+
description: 'SalesWings environment this destination is connected with.',
|
|
28
|
+
type: 'string',
|
|
29
|
+
choices: [
|
|
30
|
+
{ value: 'helium', label: 'Helium (live environment)' },
|
|
31
|
+
{ value: 'ozone', label: 'Ozone (test environment)' }
|
|
32
|
+
],
|
|
33
|
+
required: true,
|
|
34
|
+
default: 'helium'
|
|
24
35
|
}
|
|
25
36
|
},
|
|
26
37
|
testAuthentication: async (request, { settings }) => {
|
|
27
|
-
|
|
38
|
+
return request(api_1.getAccountUrl('helium'), {
|
|
28
39
|
headers: { Authorization: `Bearer ${settings.apiKey}` }
|
|
29
40
|
});
|
|
30
|
-
return resp.status == 200;
|
|
31
41
|
}
|
|
32
42
|
},
|
|
33
43
|
presets: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAC5E,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAC5E,+BAAqC;AAGrC,0EAAiD;AACjD,gFAAuD;AACvD,wEAA+C;AAC/C,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,EAAE,iBAAiB;YAChC,OAAO,EAAE,4BAAa,CAAC,yBAAe,CAAC,MAAM,CAAC;SAC/C;QACD;YACE,IAAI,EAAE,qBAAqB;YAC3B,SAAS,EAAE,iBAAiB;YAC5B,aAAa,EAAE,mBAAmB;YAClC,OAAO,EAAE,4BAAa,CAAC,2BAAiB,CAAC,MAAM,CAAC;SACjD;KACF;IAED,OAAO,EAAE;QACP,gBAAgB,EAAhB,0BAAgB;QAChB,mBAAmB,EAAnB,6BAAmB;QACnB,eAAe,EAAf,yBAAe;QACf,iBAAiB,EAAjB,2BAAiB;KAClB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const api_1 = require("../api");
|
|
4
3
|
const fields_1 = require("../fields");
|
|
5
|
-
const converter_1 = require("../converter");
|
|
6
4
|
const common_1 = require("../common");
|
|
7
|
-
const convertEvent = (payload) => {
|
|
8
|
-
return new api_1.TrackingEvent({
|
|
9
|
-
leadRefs: converter_1.convertLeadRefs(payload),
|
|
10
|
-
kind: payload.kind,
|
|
11
|
-
data: payload.data,
|
|
12
|
-
url: payload.url,
|
|
13
|
-
referrerUrl: payload.referrerUrl,
|
|
14
|
-
userAgent: payload.userAgent,
|
|
15
|
-
timestamp: converter_1.convertTimestamp(payload.timestamp),
|
|
16
|
-
values: converter_1.convertValues(payload.values)
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
5
|
const action = {
|
|
20
6
|
title: 'Submit Identify Event',
|
|
21
7
|
description: 'Send your Segment Identify events to SalesWings to use them for tagging, scoring and prioritising your leads.',
|
|
@@ -23,8 +9,8 @@ const action = {
|
|
|
23
9
|
fields: {
|
|
24
10
|
kind: fields_1.kind('Identify'),
|
|
25
11
|
data: fields_1.data({ '@path': '$.traits.email' }),
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
userID: fields_1.userID,
|
|
13
|
+
anonymousID: fields_1.anonymousID,
|
|
28
14
|
email: { ...fields_1.email, required: true },
|
|
29
15
|
url: fields_1.url,
|
|
30
16
|
referrerUrl: fields_1.referrerUrl,
|
|
@@ -32,8 +18,8 @@ const action = {
|
|
|
32
18
|
timestamp: fields_1.timestamp,
|
|
33
19
|
values: fields_1.values({ '@path': '$.traits' })
|
|
34
20
|
},
|
|
35
|
-
perform: common_1.perform(
|
|
36
|
-
performBatch: common_1.performBatch(
|
|
21
|
+
perform: common_1.perform('identify'),
|
|
22
|
+
performBatch: common_1.performBatch('identify')
|
|
37
23
|
};
|
|
38
24
|
exports.default = action;
|
|
39
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitIdentifyEvent/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitIdentifyEvent/index.ts"],"names":[],"mappings":";;AAGA,sCAAkH;AAClH,sCAAiD;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EACT,+GAA+G;IACjH,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,IAAI,EAAE,aAAI,CAAC,UAAU,CAAC;QACtB,IAAI,EAAE,aAAI,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;QACzC,MAAM,EAAN,eAAM;QACN,WAAW,EAAX,oBAAW;QACX,KAAK,EAAE,EAAE,GAAG,cAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnC,GAAG,EAAH,YAAG;QACH,WAAW,EAAX,oBAAW;QACX,SAAS,EAAT,kBAAS;QACT,SAAS,EAAT,kBAAS;QACT,MAAM,EAAE,eAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KACxC;IACD,OAAO,EAAE,gBAAO,CAAC,UAAU,CAAC;IAC5B,YAAY,EAAE,qBAAY,CAAC,UAAU,CAAC;CACvC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const api_1 = require("../api");
|
|
4
3
|
const fields_1 = require("../fields");
|
|
5
|
-
const converter_1 = require("../converter");
|
|
6
4
|
const common_1 = require("../common");
|
|
7
|
-
const convertEvent = (payload) => {
|
|
8
|
-
const leadRefs = converter_1.convertLeadRefs(payload);
|
|
9
|
-
if (leadRefs.length == 0)
|
|
10
|
-
return undefined;
|
|
11
|
-
return new api_1.PageVisitEvent({
|
|
12
|
-
leadRefs,
|
|
13
|
-
url: payload.url,
|
|
14
|
-
referrerUrl: payload.referrerUrl,
|
|
15
|
-
userAgent: payload.userAgent,
|
|
16
|
-
timestamp: converter_1.convertTimestamp(payload.timestamp)
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
5
|
const action = {
|
|
20
6
|
title: 'Submit Page Event',
|
|
21
7
|
description: 'Send your Segment Page events to SalesWings to use them for tagging, scoring and prioritising your leads.',
|
|
22
8
|
defaultSubscription: 'type = "page"',
|
|
23
9
|
fields: {
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
userID: fields_1.userID,
|
|
11
|
+
anonymousID: fields_1.anonymousID,
|
|
26
12
|
url: { ...fields_1.url, required: true },
|
|
27
13
|
referrerUrl: fields_1.referrerUrl,
|
|
28
14
|
userAgent: fields_1.userAgent,
|
|
29
15
|
timestamp: fields_1.timestamp
|
|
30
16
|
},
|
|
31
|
-
perform: common_1.perform(
|
|
32
|
-
performBatch: common_1.performBatch(
|
|
17
|
+
perform: common_1.perform('page'),
|
|
18
|
+
performBatch: common_1.performBatch('page')
|
|
33
19
|
};
|
|
34
20
|
exports.default = action;
|
|
35
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitPageEvent/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitPageEvent/index.ts"],"names":[],"mappings":";;AAGA,sCAAuF;AACvF,sCAAiD;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,2GAA2G;IAC7G,mBAAmB,EAAE,eAAe;IACpC,MAAM,EAAE;QACN,MAAM,EAAN,eAAM;QACN,WAAW,EAAX,oBAAW;QACX,GAAG,EAAE,EAAE,GAAG,YAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/B,WAAW,EAAX,oBAAW;QACX,SAAS,EAAT,kBAAS;QACT,SAAS,EAAT,kBAAS;KACV;IACD,OAAO,EAAE,gBAAO,CAAC,MAAM,CAAC;IACxB,YAAY,EAAE,qBAAY,CAAC,MAAM,CAAC;CACnC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const api_1 = require("../api");
|
|
4
3
|
const fields_1 = require("../fields");
|
|
5
|
-
const converter_1 = require("../converter");
|
|
6
4
|
const common_1 = require("../common");
|
|
7
|
-
const convertEvent = (payload) => {
|
|
8
|
-
const leadRefs = converter_1.convertLeadRefs(payload);
|
|
9
|
-
if (leadRefs.length == 0)
|
|
10
|
-
return undefined;
|
|
11
|
-
return new api_1.TrackingEvent({
|
|
12
|
-
leadRefs,
|
|
13
|
-
kind: payload.kind,
|
|
14
|
-
data: payload.data,
|
|
15
|
-
url: payload.url,
|
|
16
|
-
referrerUrl: payload.referrerUrl,
|
|
17
|
-
userAgent: payload.userAgent,
|
|
18
|
-
timestamp: converter_1.convertTimestamp(payload.timestamp),
|
|
19
|
-
values: converter_1.convertValues(payload.values)
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
5
|
const action = {
|
|
23
6
|
title: 'Submit Screen Event',
|
|
24
7
|
description: 'Send your Segment Screen events to SalesWings to use them for tagging, scoring and prioritising your leads.',
|
|
@@ -26,8 +9,8 @@ const action = {
|
|
|
26
9
|
fields: {
|
|
27
10
|
kind: fields_1.kind('Screen'),
|
|
28
11
|
data: fields_1.data({ '@path': '$.name' }),
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
userID: fields_1.userID,
|
|
13
|
+
anonymousID: fields_1.anonymousID,
|
|
31
14
|
email: fields_1.email,
|
|
32
15
|
url: fields_1.url,
|
|
33
16
|
referrerUrl: fields_1.referrerUrl,
|
|
@@ -35,8 +18,8 @@ const action = {
|
|
|
35
18
|
timestamp: fields_1.timestamp,
|
|
36
19
|
values: fields_1.values({ '@path': '$.properties' })
|
|
37
20
|
},
|
|
38
|
-
perform: common_1.perform(
|
|
39
|
-
performBatch: common_1.performBatch(
|
|
21
|
+
perform: common_1.perform('screen'),
|
|
22
|
+
performBatch: common_1.performBatch('screen')
|
|
40
23
|
};
|
|
41
24
|
exports.default = action;
|
|
42
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitScreenEvent/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitScreenEvent/index.ts"],"names":[],"mappings":";;AAGA,sCAAkH;AAClH,sCAAiD;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,6GAA6G;IAC/G,mBAAmB,EAAE,iBAAiB;IACtC,MAAM,EAAE;QACN,IAAI,EAAE,aAAI,CAAC,QAAQ,CAAC;QACpB,IAAI,EAAE,aAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QACjC,MAAM,EAAN,eAAM;QACN,WAAW,EAAX,oBAAW;QACX,KAAK,EAAL,cAAK;QACL,GAAG,EAAH,YAAG;QACH,WAAW,EAAX,oBAAW;QACX,SAAS,EAAT,kBAAS;QACT,SAAS,EAAT,kBAAS;QACT,MAAM,EAAE,eAAM,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;KAC5C;IACD,OAAO,EAAE,gBAAO,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,qBAAY,CAAC,QAAQ,CAAC;CACrC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const api_1 = require("../api");
|
|
4
3
|
const fields_1 = require("../fields");
|
|
5
|
-
const converter_1 = require("../converter");
|
|
6
4
|
const common_1 = require("../common");
|
|
7
|
-
const convertEvent = (payload) => {
|
|
8
|
-
const leadRefs = converter_1.convertLeadRefs(payload);
|
|
9
|
-
if (leadRefs.length == 0)
|
|
10
|
-
return undefined;
|
|
11
|
-
return new api_1.TrackingEvent({
|
|
12
|
-
leadRefs,
|
|
13
|
-
kind: payload.kind,
|
|
14
|
-
data: payload.data,
|
|
15
|
-
url: payload.url,
|
|
16
|
-
referrerUrl: payload.referrerUrl,
|
|
17
|
-
userAgent: payload.userAgent,
|
|
18
|
-
timestamp: converter_1.convertTimestamp(payload.timestamp),
|
|
19
|
-
values: converter_1.convertValues(payload.values)
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
5
|
const action = {
|
|
23
6
|
title: 'Submit Track Event',
|
|
24
7
|
description: 'Send your Segment Track events to SalesWings to use them for tagging, scoring and prioritising your leads.',
|
|
@@ -26,8 +9,8 @@ const action = {
|
|
|
26
9
|
fields: {
|
|
27
10
|
kind: fields_1.kind('Track'),
|
|
28
11
|
data: fields_1.data({ '@path': '$.event' }),
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
userID: fields_1.userID,
|
|
13
|
+
anonymousID: fields_1.anonymousID,
|
|
31
14
|
email: fields_1.email,
|
|
32
15
|
url: fields_1.url,
|
|
33
16
|
referrerUrl: fields_1.referrerUrl,
|
|
@@ -35,8 +18,8 @@ const action = {
|
|
|
35
18
|
timestamp: fields_1.timestamp,
|
|
36
19
|
values: fields_1.values({ '@path': '$.properties' })
|
|
37
20
|
},
|
|
38
|
-
perform: common_1.perform(
|
|
39
|
-
performBatch: common_1.performBatch(
|
|
21
|
+
perform: common_1.perform('track'),
|
|
22
|
+
performBatch: common_1.performBatch('track')
|
|
40
23
|
};
|
|
41
24
|
exports.default = action;
|
|
42
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitTrackEvent/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/saleswings/submitTrackEvent/index.ts"],"names":[],"mappings":";;AAGA,sCAAkH;AAClH,sCAAiD;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,4GAA4G;IAC9G,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE,aAAI,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,aAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;QAClC,MAAM,EAAN,eAAM;QACN,WAAW,EAAX,oBAAW;QACX,KAAK,EAAL,cAAK;QACL,GAAG,EAAH,YAAG;QACH,WAAW,EAAX,oBAAW;QACX,SAAS,EAAT,kBAAS;QACT,SAAS,EAAT,kBAAS;QACT,MAAM,EAAE,eAAM,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;KAC5C;IACD,OAAO,EAAE,gBAAO,CAAC,OAAO,CAAC;IACzB,YAAY,EAAE,qBAAY,CAAC,OAAO,CAAC;CACpC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SegmentEvent } from '@segment/actions-core';
|
|
2
2
|
export declare const settings: {
|
|
3
3
|
apiKey: string;
|
|
4
|
+
environment: string;
|
|
4
5
|
};
|
|
5
6
|
export declare const testAction: (actionName: string, event: SegmentEvent) => Promise<any>;
|
|
6
7
|
export declare const testBatchAction: (actionName: string, events: SegmentEvent[]) => Promise<any>;
|
|
7
|
-
export declare const testActionWithSkippedEvent: (actionName: string, event: SegmentEvent) => Promise<void>;
|
|
8
|
-
export declare const testBatchActionSkippedEvents: (actionName: string, events: SegmentEvent[]) => Promise<void>;
|
|
9
|
-
export declare const expectedTs: (segmentEventTs: string | Date | undefined) => number;
|
|
10
8
|
export declare const userAgent = "\"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1";
|
|
@@ -3,15 +3,17 @@ 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.userAgent = exports.
|
|
6
|
+
exports.userAgent = exports.testBatchAction = exports.testAction = exports.settings = void 0;
|
|
7
7
|
const actions_core_1 = require("@segment/actions-core");
|
|
8
8
|
const nock_1 = __importDefault(require("nock"));
|
|
9
9
|
const api_1 = require("./api");
|
|
10
10
|
const index_1 = __importDefault(require("./index"));
|
|
11
11
|
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
12
|
-
exports.settings = { apiKey: 'TEST_API_KEY' };
|
|
12
|
+
exports.settings = { apiKey: 'TEST_API_KEY', environment: 'helium' };
|
|
13
13
|
const testAction = async (actionName, event) => {
|
|
14
|
-
nock_1.default(api_1.
|
|
14
|
+
nock_1.default(api_1.submitEventUrl(exports.settings.environment, eventType(event)))
|
|
15
|
+
.post('')
|
|
16
|
+
.reply(200, {});
|
|
15
17
|
const input = { event, settings: exports.settings, useDefaultMappings: true };
|
|
16
18
|
const responses = await testDestination.testAction(actionName, input);
|
|
17
19
|
expect(responses.length).toBe(1);
|
|
@@ -22,7 +24,9 @@ const testAction = async (actionName, event) => {
|
|
|
22
24
|
};
|
|
23
25
|
exports.testAction = testAction;
|
|
24
26
|
const testBatchAction = async (actionName, events) => {
|
|
25
|
-
nock_1.default(api_1.
|
|
27
|
+
nock_1.default(api_1.submitEventBatchUrl(exports.settings.environment, eventType(events[0])))
|
|
28
|
+
.post('')
|
|
29
|
+
.reply(200, {});
|
|
26
30
|
const input = { events, settings: exports.settings, useDefaultMappings: true };
|
|
27
31
|
const responses = await testDestination.testBatchAction(actionName, input);
|
|
28
32
|
expect(responses.length).toBe(1);
|
|
@@ -32,24 +36,10 @@ const testBatchAction = async (actionName, events) => {
|
|
|
32
36
|
return JSON.parse(rawBody);
|
|
33
37
|
};
|
|
34
38
|
exports.testBatchAction = testBatchAction;
|
|
35
|
-
const testActionWithSkippedEvent = async (actionName, event) => {
|
|
36
|
-
const responses = await testDestination.testAction(actionName, { event, settings: exports.settings, useDefaultMappings: true });
|
|
37
|
-
expect(responses.length).toBe(0);
|
|
38
|
-
};
|
|
39
|
-
exports.testActionWithSkippedEvent = testActionWithSkippedEvent;
|
|
40
|
-
const testBatchActionSkippedEvents = async (actionName, events) => {
|
|
41
|
-
const responses = await testDestination.testBatchAction(actionName, { events, settings: exports.settings, useDefaultMappings: true });
|
|
42
|
-
expect(responses.length).toBe(0);
|
|
43
|
-
};
|
|
44
|
-
exports.testBatchActionSkippedEvents = testBatchActionSkippedEvents;
|
|
45
|
-
const expectedTs = (segmentEventTs) => {
|
|
46
|
-
if (segmentEventTs === undefined)
|
|
47
|
-
throw new Error('Unexpected state: test event created without a timestamp');
|
|
48
|
-
else if (typeof segmentEventTs === 'string')
|
|
49
|
-
return Date.parse(segmentEventTs);
|
|
50
|
-
else
|
|
51
|
-
return segmentEventTs.valueOf();
|
|
52
|
-
};
|
|
53
|
-
exports.expectedTs = expectedTs;
|
|
54
39
|
exports.userAgent = '"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1';
|
|
40
|
+
const eventType = (event) => {
|
|
41
|
+
if (event.type == 'track' || event.type == 'identify' || event.type == 'screen' || event.type == 'page')
|
|
42
|
+
return event.type;
|
|
43
|
+
throw new Error(`Not supported event type for tests: ${event.type}`);
|
|
44
|
+
};
|
|
55
45
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/testing.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA2E;AAC3E,gDAAuB;AACvB,+
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/destinations/saleswings/testing.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA2E;AAC3E,gDAAuB;AACvB,+BAAsE;AACtE,oDAAiC;AAEjC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAW,CAAC,CAAA;AAE7C,QAAA,QAAQ,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAA;AAElE,MAAM,UAAU,GAAG,KAAK,EAAE,UAAkB,EAAE,KAAmB,EAAgB,EAAE;IACxF,cAAI,CAAC,oBAAc,CAAC,gBAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SACzD,IAAI,CAAC,EAAE,CAAC;SACR,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACjB,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAR,gBAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;IAC3D,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,U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,CAAC,IAAI,EAAE,CAAA;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC,CAAA;AAXY,QAAA,eAAe,mBAW3B;AAEY,QAAA,SAAS,GACpB,wIAAwI,CAAA;AAE1I,MAAM,SAAS,GAAG,CAAC,KAAmB,EAAa,EAAE;IACnD,IAAI,KAAK,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,UAAU,IAAI,KAAK,CAAC,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM;QACrG,OAAO,KAAK,CAAC,IAAI,CAAA;IACnB,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;AACtE,CAAC,CAAA"}
|
|
@@ -76,6 +76,42 @@ describe('Webhook', () => {
|
|
|
76
76
|
expect(responses.length).toBe(1);
|
|
77
77
|
expect(responses[0].status).toBe(200);
|
|
78
78
|
});
|
|
79
|
+
it('supports request signing with batched events', async () => {
|
|
80
|
+
const url = 'https://example.com';
|
|
81
|
+
const events = [
|
|
82
|
+
actions_core_1.createTestEvent({
|
|
83
|
+
properties: { cool: false }
|
|
84
|
+
}),
|
|
85
|
+
actions_core_1.createTestEvent({
|
|
86
|
+
properties: { cool: true }
|
|
87
|
+
})
|
|
88
|
+
];
|
|
89
|
+
const payload = JSON.stringify(events.map(({ properties }) => properties));
|
|
90
|
+
console.log(payload);
|
|
91
|
+
const sharedSecret = 'abc123';
|
|
92
|
+
nock_1.default(url)
|
|
93
|
+
.post('/', payload)
|
|
94
|
+
.reply(async function (_uri, body) {
|
|
95
|
+
const expectSignature = this.req.headers['x-signature'][0];
|
|
96
|
+
const actualSignature = crypto_1.createHmac('sha1', sharedSecret).update(JSON.stringify(body[0])).digest('hex');
|
|
97
|
+
if (expectSignature.length !== actualSignature.length ||
|
|
98
|
+
!crypto_1.timingSafeEqual(Buffer.from(actualSignature, 'hex'), Buffer.from(expectSignature, 'hex'))) {
|
|
99
|
+
return [400, 'Invalid signature123'];
|
|
100
|
+
}
|
|
101
|
+
return [200, 'OK'];
|
|
102
|
+
});
|
|
103
|
+
const responses = await testDestination.testBatchAction('send', {
|
|
104
|
+
events,
|
|
105
|
+
mapping: {
|
|
106
|
+
url,
|
|
107
|
+
data: { '@path': '$.properties' }
|
|
108
|
+
},
|
|
109
|
+
settings: { sharedSecret },
|
|
110
|
+
useDefaultMappings: true
|
|
111
|
+
});
|
|
112
|
+
expect(responses.length).toBe(1);
|
|
113
|
+
expect(responses[0].status).toBe(200);
|
|
114
|
+
});
|
|
79
115
|
});
|
|
80
116
|
});
|
|
81
117
|
//# sourceMappingURL=webhook.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/__test__/webhook.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAA8E;AAC9E,qDAA8B;AAC9B,mCAAoD;
|
|
1
|
+
{"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/__test__/webhook.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAA8E;AAC9E,qDAA8B;AAC9B,mCAAoD;AAGpD,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAO,CAAC,CAAA;AAEtD,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,GAAG,GAAG,qBAAqB,CAAA;YACjC,MAAM,KAAK,GAAG,8BAAe,EAAE,CAAA;YAE/B,cAAI,CAAC,GAAG,CAAC;iBACN,IAAI,CAAC,GAAG,EAAE,KAAY,CAAC;iBACvB,KAAK,CAAC,GAAG,CAAC,CAAA;YAEb,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,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