@segment/action-destinations 3.125.1-staging.106 → 3.126.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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/destinations/actable-predictive/index.js +1 -1
  3. package/dist/destinations/actable-predictive/index.js.map +1 -1
  4. package/dist/destinations/actable-predictive/sendCustomEvent/index.js +13 -13
  5. package/dist/destinations/actable-predictive/sendCustomEvent/index.js.map +1 -1
  6. package/dist/destinations/actable-predictive/sendEmailEvent/index.js +21 -21
  7. package/dist/destinations/actable-predictive/sendEmailEvent/index.js.map +1 -1
  8. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js +29 -29
  9. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js.map +1 -1
  10. package/dist/destinations/actable-predictive/sendWebEvent/index.js +26 -26
  11. package/dist/destinations/actable-predictive/sendWebEvent/index.js.map +1 -1
  12. package/dist/destinations/clevertap/userDelete/index.js +4 -4
  13. package/dist/destinations/clevertap/userDelete/index.js.map +1 -1
  14. package/dist/destinations/index.js +1 -0
  15. package/dist/destinations/index.js.map +1 -1
  16. package/dist/destinations/mixpanel/index.js +1 -1
  17. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  18. package/dist/destinations/mixpanel/trackEvent/functions.js +1 -1
  19. package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
  20. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  21. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  22. package/dist/destinations/mixpanel/utils.js +1 -1
  23. package/dist/destinations/mixpanel/utils.js.map +1 -1
  24. package/dist/destinations/vwo/generated-types.d.ts +3 -0
  25. package/dist/destinations/vwo/generated-types.js +3 -0
  26. package/dist/destinations/vwo/generated-types.js.map +1 -0
  27. package/dist/destinations/vwo/identifyUser/generated-types.d.ts +12 -0
  28. package/dist/destinations/vwo/identifyUser/generated-types.js +3 -0
  29. package/dist/destinations/vwo/identifyUser/generated-types.js.map +1 -0
  30. package/dist/destinations/vwo/identifyUser/index.d.ts +5 -0
  31. package/dist/destinations/vwo/identifyUser/index.js +80 -0
  32. package/dist/destinations/vwo/identifyUser/index.js.map +1 -0
  33. package/dist/destinations/vwo/index.d.ts +4 -0
  34. package/dist/destinations/vwo/index.js +60 -0
  35. package/dist/destinations/vwo/index.js.map +1 -0
  36. package/dist/destinations/vwo/pageVisit/generated-types.d.ts +10 -0
  37. package/dist/destinations/vwo/pageVisit/generated-types.js +3 -0
  38. package/dist/destinations/vwo/pageVisit/generated-types.js.map +1 -0
  39. package/dist/destinations/vwo/pageVisit/index.d.ts +5 -0
  40. package/dist/destinations/vwo/pageVisit/index.js +77 -0
  41. package/dist/destinations/vwo/pageVisit/index.js.map +1 -0
  42. package/dist/destinations/vwo/trackEvent/generated-types.d.ts +13 -0
  43. package/dist/destinations/vwo/trackEvent/generated-types.js +3 -0
  44. package/dist/destinations/vwo/trackEvent/generated-types.js.map +1 -0
  45. package/dist/destinations/vwo/trackEvent/index.d.ts +5 -0
  46. package/dist/destinations/vwo/trackEvent/index.js +86 -0
  47. package/dist/destinations/vwo/trackEvent/index.js.map +1 -0
  48. package/dist/destinations/vwo/types.d.ts +42 -0
  49. package/dist/destinations/vwo/types.js +3 -0
  50. package/dist/destinations/vwo/types.js.map +1 -0
  51. package/dist/destinations/vwo/utility.d.ts +13 -0
  52. package/dist/destinations/vwo/utility.js +59 -0
  53. package/dist/destinations/vwo/utility.js.map +1 -0
  54. package/package.json +4 -4
@@ -0,0 +1,12 @@
1
+ export interface Payload {
2
+ attributes: {
3
+ [k: string]: unknown;
4
+ };
5
+ vwoUuid: string;
6
+ page: {
7
+ [k: string]: unknown;
8
+ };
9
+ ip?: string;
10
+ userAgent: string;
11
+ timestamp: string;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/identifyUser/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utility_1 = require("../utility");
4
+ const action = {
5
+ title: 'Identify User',
6
+ description: "Maps segment's visitor traits to VWO visitors' attributes",
7
+ defaultSubscription: 'type = "identify"',
8
+ fields: {
9
+ attributes: {
10
+ description: 'A JSON object containing additional attributes that will be associated with the event.',
11
+ label: 'attributes',
12
+ required: true,
13
+ type: 'object',
14
+ default: {
15
+ '@path': '$.traits'
16
+ }
17
+ },
18
+ vwoUuid: {
19
+ description: 'VWO UUID',
20
+ label: 'VWO UUID',
21
+ required: true,
22
+ type: 'string',
23
+ default: {
24
+ '@path': '$.traits.vwo_uuid'
25
+ }
26
+ },
27
+ page: {
28
+ description: 'Page Context',
29
+ label: 'Page',
30
+ required: true,
31
+ type: 'object',
32
+ default: {
33
+ '@path': '$.context.page'
34
+ }
35
+ },
36
+ ip: {
37
+ description: 'IP Address',
38
+ label: 'IP Address',
39
+ required: false,
40
+ type: 'string',
41
+ default: {
42
+ '@path': '$.context.ip'
43
+ }
44
+ },
45
+ userAgent: {
46
+ description: 'User Agent',
47
+ label: 'User Agent',
48
+ required: true,
49
+ type: 'string',
50
+ default: {
51
+ '@path': '$.context.userAgent'
52
+ }
53
+ },
54
+ timestamp: {
55
+ description: 'Timestamp',
56
+ label: 'Timestamp',
57
+ required: true,
58
+ type: 'string',
59
+ default: {
60
+ '@path': '$.timestamp'
61
+ }
62
+ }
63
+ },
64
+ perform: (request, { settings, payload }) => {
65
+ const eventName = 'vwo_syncVisitorProp';
66
+ const attributes = payload.attributes;
67
+ delete attributes['vwo_uuid'];
68
+ const visitor = { props: utility_1.formatAttributes(attributes) };
69
+ const { headers, structuredPayload } = utility_1.formatPayload(eventName, payload, true);
70
+ structuredPayload.d.visitor = structuredPayload.d.event.props['$visitor'] = visitor;
71
+ const endpoint = `https://dev.visualwebsiteoptimizer.com/events/t?en=${eventName}&a=${settings.vwoAccountId}`;
72
+ return request(endpoint, {
73
+ method: 'POST',
74
+ json: structuredPayload,
75
+ headers
76
+ });
77
+ }
78
+ };
79
+ exports.default = action;
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/identifyUser/index.ts"],"names":[],"mappings":";;AAGA,wCAA4D;AAE5D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,2DAA2D;IACxE,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,UAAU,EAAE;YACV,WAAW,EAAE,wFAAwF;YACrG,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,UAAU;YACvB,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,cAAc;YAC3B,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,EAAE,EAAE;YACF,WAAW,EAAE,YAAY;YACzB,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;QACD,SAAS,EAAE;YACT,WAAW,EAAE,YAAY;YACzB,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,qBAAqB;aAC/B;SACF;QACD,SAAS,EAAE;YACT,WAAW,EAAE,WAAW;YACxB,KAAK,EAAE,WAAW;YAClB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,MAAM,SAAS,GAAG,qBAAqB,CAAA;QACvC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACrC,OAAO,UAAU,CAAC,UAAU,CAAC,CAAA;QAC7B,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,0BAAgB,CAAC,UAAU,CAAC,EAAE,CAAA;QACvD,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,uBAAa,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;QAC9E,iBAAiB,CAAC,CAAC,CAAC,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,OAAO,CAAA;QACnF,MAAM,QAAQ,GAAG,sDAAsD,SAAS,MAAM,QAAQ,CAAC,YAAY,EAAE,CAAA;QAC7G,OAAO,OAAO,CAAC,QAAQ,EAAE;YACvB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iBAAiB;YACvB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const actions_core_1 = require("@segment/actions-core");
7
+ const trackEvent_1 = __importDefault(require("./trackEvent"));
8
+ const identifyUser_1 = __importDefault(require("./identifyUser"));
9
+ const pageVisit_1 = __importDefault(require("./pageVisit"));
10
+ const destination = {
11
+ name: 'VWO Cloud Mode (Actions)',
12
+ slug: 'actions-vwo-cloud',
13
+ mode: 'cloud',
14
+ presets: [
15
+ {
16
+ name: 'Track Event',
17
+ subscribe: 'type = "track"',
18
+ partnerAction: 'trackEvent',
19
+ mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
20
+ },
21
+ {
22
+ name: 'Identify User',
23
+ subscribe: 'type = "identify"',
24
+ partnerAction: 'identifyUser',
25
+ mapping: actions_core_1.defaultValues(identifyUser_1.default.fields)
26
+ },
27
+ {
28
+ name: 'Page Visit',
29
+ subscribe: 'type = "page"',
30
+ partnerAction: 'pageVisit',
31
+ mapping: actions_core_1.defaultValues(pageVisit_1.default.fields)
32
+ }
33
+ ],
34
+ authentication: {
35
+ scheme: 'custom',
36
+ fields: {
37
+ vwoAccountId: {
38
+ label: 'Your VWO account ID, used for fetching your VWO async smart code. ',
39
+ description: 'Enter your VWO Account ID',
40
+ type: 'number',
41
+ required: true
42
+ }
43
+ },
44
+ testAuthentication: (_request, { settings }) => {
45
+ if (settings.vwoAccountId < 1 || settings.vwoAccountId.toString().length > 7) {
46
+ throw new Error('Invalid AccountID. Please check your AccountID');
47
+ }
48
+ else {
49
+ return true;
50
+ }
51
+ }
52
+ },
53
+ actions: {
54
+ trackEvent: trackEvent_1.default,
55
+ identifyUser: identifyUser_1.default,
56
+ pageVisit: pageVisit_1.default
57
+ }
58
+ };
59
+ exports.default = destination;
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
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Y,EAAZ,sBAAY;QACZ,SAAS,EAAT,mBAAS;KACV;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ export interface Payload {
2
+ url: string;
3
+ vwoUuid: string;
4
+ page: {
5
+ [k: string]: unknown;
6
+ };
7
+ ip?: string;
8
+ userAgent: string;
9
+ timestamp: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/pageVisit/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utility_1 = require("../utility");
4
+ const action = {
5
+ title: 'Page Visit',
6
+ description: 'Sends page visit information to VWO',
7
+ fields: {
8
+ url: {
9
+ description: 'The URL of the page',
10
+ label: 'Page URL',
11
+ required: true,
12
+ type: 'string',
13
+ default: {
14
+ '@path': '$.context.page.url'
15
+ }
16
+ },
17
+ vwoUuid: {
18
+ description: 'VWO UUID',
19
+ label: 'VWO UUID',
20
+ required: true,
21
+ type: 'string',
22
+ default: {
23
+ '@path': '$.properties.vwo_uuid'
24
+ }
25
+ },
26
+ page: {
27
+ description: 'Page Context',
28
+ label: 'Page',
29
+ required: true,
30
+ type: 'object',
31
+ default: {
32
+ '@path': '$.context.page'
33
+ }
34
+ },
35
+ ip: {
36
+ description: 'IP Address',
37
+ label: 'IP Address',
38
+ required: false,
39
+ type: 'string',
40
+ default: {
41
+ '@path': '$.context.ip'
42
+ }
43
+ },
44
+ userAgent: {
45
+ description: 'User Agent',
46
+ label: 'User Agent',
47
+ required: true,
48
+ type: 'string',
49
+ default: {
50
+ '@path': '$.context.userAgent'
51
+ }
52
+ },
53
+ timestamp: {
54
+ description: 'Timestamp',
55
+ label: 'Timestamp',
56
+ required: true,
57
+ type: 'string',
58
+ default: {
59
+ '@path': '$.timestamp'
60
+ }
61
+ }
62
+ },
63
+ defaultSubscription: 'type = "page"',
64
+ perform: (request, { settings, payload }) => {
65
+ const eventName = 'vwo_pageView';
66
+ const { headers, structuredPayload } = utility_1.formatPayload(eventName, payload, false);
67
+ structuredPayload.d.event.props['url'] = payload.url;
68
+ const endpoint = `https://dev.visualwebsiteoptimizer.com/events/t?en=${eventName}&a=${settings.vwoAccountId}`;
69
+ return request(endpoint, {
70
+ method: 'POST',
71
+ json: structuredPayload,
72
+ headers
73
+ });
74
+ }
75
+ };
76
+ exports.default = action;
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/pageVisit/index.ts"],"names":[],"mappings":";;AAGA,wCAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qCAAqC;IAClD,MAAM,EAAE;QACN,GAAG,EAAE;YACH,WAAW,EAAE,qBAAqB;YAClC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,UAAU;YACvB,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,cAAc;YAC3B,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OA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8
+ [k: string]: unknown;
9
+ };
10
+ ip?: string;
11
+ userAgent: string;
12
+ timestamp: string;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/trackEvent/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utility_1 = require("../utility");
4
+ const action = {
5
+ title: 'Track Event',
6
+ description: 'Sends track events to VWO',
7
+ defaultSubscription: 'type = "track"',
8
+ fields: {
9
+ name: {
10
+ description: 'The name of the event.',
11
+ label: 'Name',
12
+ required: true,
13
+ type: 'string',
14
+ default: {
15
+ '@path': '$.event'
16
+ }
17
+ },
18
+ properties: {
19
+ description: 'A JSON object containing additional properties that will be associated with the event.',
20
+ label: 'Properties',
21
+ required: false,
22
+ type: 'object',
23
+ default: {
24
+ '@path': '$.properties'
25
+ }
26
+ },
27
+ vwoUuid: {
28
+ description: 'VWO UUID',
29
+ label: 'VWO UUID',
30
+ required: true,
31
+ type: 'string',
32
+ default: {
33
+ '@path': '$.properties.vwo_uuid'
34
+ }
35
+ },
36
+ page: {
37
+ description: 'Page Context',
38
+ label: 'Page',
39
+ required: true,
40
+ type: 'object',
41
+ default: {
42
+ '@path': '$.context.page'
43
+ }
44
+ },
45
+ ip: {
46
+ description: 'IP Address',
47
+ label: 'IP Address',
48
+ required: false,
49
+ type: 'string',
50
+ default: {
51
+ '@path': '$.context.ip'
52
+ }
53
+ },
54
+ userAgent: {
55
+ description: 'User Agent',
56
+ label: 'User Agent',
57
+ required: true,
58
+ type: 'string',
59
+ default: {
60
+ '@path': '$.context.userAgent'
61
+ }
62
+ },
63
+ timestamp: {
64
+ description: 'Timestamp',
65
+ label: 'Timestamp',
66
+ required: true,
67
+ type: 'string',
68
+ default: {
69
+ '@path': '$.timestamp'
70
+ }
71
+ }
72
+ },
73
+ perform: (request, { settings, payload }) => {
74
+ const sanitisedEventName = utility_1.sanitiseEventName(payload.name);
75
+ const { headers, structuredPayload } = utility_1.formatPayload(sanitisedEventName, payload, true, true);
76
+ structuredPayload.d.event.props.vwoMeta['ogName'] = payload.name;
77
+ const endpoint = `https://dev.visualwebsiteoptimizer.com/events/t?en=${sanitisedEventName}&a=${settings.vwoAccountId}`;
78
+ return request(endpoint, {
79
+ method: 'POST',
80
+ headers,
81
+ json: structuredPayload
82
+ });
83
+ }
84
+ };
85
+ exports.default = action;
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/vwo/trackEvent/index.ts"],"names":[],"mappings":";;AAGA,wCAA6D;AAE7D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,2BAA2B;IACxC,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,WAAW,EAAE,wBAAwB;YACrC,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,wFAAwF;YACrG,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,UAAU;YACvB,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAA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YACvB,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI,EAAE,iBAAiB;SACxB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,42 @@
1
+ export declare type vwoPayload = {
2
+ d: {
3
+ msgId: string;
4
+ visId: string;
5
+ event: {
6
+ props: {
7
+ vwo_og_event?: string;
8
+ page: {
9
+ [k: string]: unknown;
10
+ };
11
+ [k: string]: unknown;
12
+ isCustomEvent?: boolean;
13
+ vwoMeta: {
14
+ source: string;
15
+ ogName?: string;
16
+ [k: string]: unknown;
17
+ };
18
+ };
19
+ name: string;
20
+ time: number;
21
+ };
22
+ visitor?: {
23
+ [k: string]: unknown;
24
+ };
25
+ sessionId: number;
26
+ };
27
+ };
28
+ export declare type commonPayload = {
29
+ properties?: {
30
+ [k: string]: unknown;
31
+ };
32
+ attributes?: {
33
+ [k: string]: unknown;
34
+ };
35
+ vwoUuid: string;
36
+ page: {
37
+ [k: string]: unknown;
38
+ };
39
+ ip?: string;
40
+ userAgent: string;
41
+ timestamp: string;
42
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/vwo/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { commonPayload, vwoPayload } from './types';
2
+ export declare function formatPayload(name: string, payload: commonPayload, isCustomEvent: boolean, isTrack?: boolean): {
3
+ headers: {
4
+ [k: string]: string;
5
+ };
6
+ structuredPayload: vwoPayload;
7
+ };
8
+ export declare function sanitiseEventName(name: string): string;
9
+ export declare function formatAttributes(attributes: {
10
+ [k: string]: unknown;
11
+ } | undefined): {
12
+ [k: string]: unknown;
13
+ };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatAttributes = exports.sanitiseEventName = exports.formatPayload = void 0;
4
+ function formatPayload(name, payload, isCustomEvent, isTrack = false) {
5
+ let formattedProperties = {};
6
+ const vwoUuid = payload.vwoUuid;
7
+ if (isTrack) {
8
+ formattedProperties = { ...payload.properties };
9
+ delete formattedProperties['vwo_uuid'];
10
+ }
11
+ const epochTime = new Date(payload.timestamp).valueOf();
12
+ const time = Math.floor(epochTime);
13
+ const sessionId = Math.floor(epochTime / 1000);
14
+ const page = {
15
+ ...payload.page,
16
+ referrerUrl: payload.page['referrer']
17
+ };
18
+ const structuredPayload = {
19
+ d: {
20
+ msgId: `${vwoUuid}-${sessionId}`,
21
+ visId: vwoUuid,
22
+ event: {
23
+ props: {
24
+ ...formattedProperties,
25
+ page,
26
+ isCustomEvent,
27
+ vwoMeta: {
28
+ source: 'segment.cloud',
29
+ metric: {}
30
+ }
31
+ },
32
+ name,
33
+ time
34
+ },
35
+ sessionId
36
+ }
37
+ };
38
+ const headers = {
39
+ 'User-Agent': payload.userAgent
40
+ };
41
+ if (payload.ip) {
42
+ headers['X-Forwarded-For'] = payload.ip;
43
+ }
44
+ return { headers, structuredPayload };
45
+ }
46
+ exports.formatPayload = formatPayload;
47
+ function sanitiseEventName(name) {
48
+ return 'segment_' + name;
49
+ }
50
+ exports.sanitiseEventName = sanitiseEventName;
51
+ function formatAttributes(attributes) {
52
+ const formattedAttributes = {};
53
+ for (const key in attributes) {
54
+ formattedAttributes[`segment_${key}`] = attributes[key];
55
+ }
56
+ return formattedAttributes;
57
+ }
58
+ exports.formatAttributes = formatAttributes;
59
+ //# sourceMappingURL=utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../src/destinations/vwo/utility.ts"],"names":[],"mappings":";;;AAEA,SAAgB,aAAa,CAAC,IAAY,EAAE,OAAsB,EAAE,aAAsB,EAAE,OAAO,GAAG,KAAK;IACzG,IAAI,mBAAmB,GAA6B,EAAE,CAAA;IACtD,MAAM,OAAO,GAAG,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/E,MAAM,mBAAmB,GAA6B,EAAE,CAAA;IACxD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,mBAAmB,CAAC,WAAW,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;KACxD;IACD,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAND,4CAMC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.125.1-staging.106+a6e119cd",
4
+ "version": "3.126.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@amplitude/ua-parser-js": "^0.7.25",
40
40
  "@segment/a1-notation": "^2.1.4",
41
- "@segment/actions-core": "^3.47.0",
42
- "@segment/actions-shared": "^1.29.0",
41
+ "@segment/actions-core": "^3.48.0",
42
+ "@segment/actions-shared": "^1.30.0",
43
43
  "cheerio": "^1.0.0-rc.10",
44
44
  "dayjs": "^1.10.7",
45
45
  "escape-goat": "^3",
@@ -65,5 +65,5 @@
65
65
  "lcov"
66
66
  ]
67
67
  },
68
- "gitHead": "a6e119cd7cdddad8f8c132b693ef797f2d456f20"
68
+ "gitHead": "f9f34d2776a0e8c7247a437709f20f25a4b9d83e"
69
69
  }