@segment/action-destinations 3.165.1-update-actions-core.4 → 3.166.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 (40) hide show
  1. package/dist/destinations/calliper/alias/generated-types.d.ts +5 -0
  2. package/dist/destinations/calliper/alias/generated-types.js +3 -0
  3. package/dist/destinations/calliper/alias/generated-types.js.map +1 -0
  4. package/dist/destinations/calliper/alias/index.d.ts +5 -0
  5. package/dist/destinations/calliper/alias/index.js +60 -0
  6. package/dist/destinations/calliper/alias/index.js.map +1 -0
  7. package/dist/destinations/calliper/generated-types.d.ts +4 -0
  8. package/dist/destinations/calliper/generated-types.js +3 -0
  9. package/dist/destinations/calliper/generated-types.js.map +1 -0
  10. package/dist/destinations/calliper/identifyGroup/generated-types.d.ts +7 -0
  11. package/dist/destinations/calliper/identifyGroup/generated-types.js +3 -0
  12. package/dist/destinations/calliper/identifyGroup/generated-types.js.map +1 -0
  13. package/dist/destinations/calliper/identifyGroup/index.d.ts +5 -0
  14. package/dist/destinations/calliper/identifyGroup/index.js +53 -0
  15. package/dist/destinations/calliper/identifyGroup/index.js.map +1 -0
  16. package/dist/destinations/calliper/identifyUser/generated-types.d.ts +14 -0
  17. package/dist/destinations/calliper/identifyUser/generated-types.js +3 -0
  18. package/dist/destinations/calliper/identifyUser/generated-types.js.map +1 -0
  19. package/dist/destinations/calliper/identifyUser/index.d.ts +5 -0
  20. package/dist/destinations/calliper/identifyUser/index.js +152 -0
  21. package/dist/destinations/calliper/identifyUser/index.js.map +1 -0
  22. package/dist/destinations/calliper/index.d.ts +4 -0
  23. package/dist/destinations/calliper/index.js +81 -0
  24. package/dist/destinations/calliper/index.js.map +1 -0
  25. package/dist/destinations/calliper/trackEvent/eventProperties.d.ts +2 -0
  26. package/dist/destinations/calliper/trackEvent/eventProperties.js +231 -0
  27. package/dist/destinations/calliper/trackEvent/eventProperties.js.map +1 -0
  28. package/dist/destinations/calliper/trackEvent/generated-types.d.ts +32 -0
  29. package/dist/destinations/calliper/trackEvent/generated-types.js +3 -0
  30. package/dist/destinations/calliper/trackEvent/generated-types.js.map +1 -0
  31. package/dist/destinations/calliper/trackEvent/index.d.ts +5 -0
  32. package/dist/destinations/calliper/trackEvent/index.js +65 -0
  33. package/dist/destinations/calliper/trackEvent/index.js.map +1 -0
  34. package/dist/destinations/calliper/utils/constants.d.ts +1 -0
  35. package/dist/destinations/calliper/utils/constants.js +5 -0
  36. package/dist/destinations/calliper/utils/constants.js.map +1 -0
  37. package/dist/destinations/calliper/utils/helpers.d.ts +1 -0
  38. package/dist/destinations/calliper/utils/helpers.js +8 -0
  39. package/dist/destinations/calliper/utils/helpers.js.map +1 -0
  40. package/package.json +4 -4
@@ -0,0 +1,5 @@
1
+ export interface Payload {
2
+ time?: string | number;
3
+ new_id?: string | null;
4
+ previous_id?: string;
5
+ }
@@ -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/calliper/alias/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { 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,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 constants_1 = require("../utils/constants");
7
+ const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
8
+ const action = {
9
+ title: 'Alias',
10
+ description: 'Create an alias to a user id. Used when a single user has been initially identified as several users.',
11
+ fields: {
12
+ time: {
13
+ label: 'Timestamp',
14
+ type: 'datetime',
15
+ description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
16
+ default: {
17
+ '@path': '$.timestamp'
18
+ }
19
+ },
20
+ new_id: {
21
+ label: 'New ID',
22
+ type: 'string',
23
+ allowNull: true,
24
+ description: 'A new user id to be merged with the original distinct id. Each alias can only map to one distinct id.',
25
+ default: {
26
+ '@if': {
27
+ exists: { '@path': '$.userId' },
28
+ then: { '@path': '$.userId' },
29
+ else: { '@path': '$.anonymousId' }
30
+ }
31
+ }
32
+ },
33
+ previous_id: {
34
+ label: 'Previous ID',
35
+ type: 'string',
36
+ description: 'A previous user id to be merged with the alias.',
37
+ default: {
38
+ '@path': '$.previousId'
39
+ }
40
+ }
41
+ },
42
+ perform: async (request, { payload, settings }) => {
43
+ const datetime = payload.time;
44
+ const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
45
+ return await request(`${constants_1.API_URL}/user/alias`, {
46
+ method: 'post',
47
+ json: {
48
+ companyId: settings.companyId,
49
+ key: settings.segmentKey,
50
+ alias: {
51
+ time,
52
+ new_id: payload.new_id,
53
+ previous_id: payload.previous_id
54
+ }
55
+ }
56
+ });
57
+ }
58
+ };
59
+ exports.default = action;
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/alias/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA4C;AAC5C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,uGAAuG;IACpH,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YAC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
+ 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/calliper/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface Payload {
2
+ time?: string | number;
3
+ group_id: string;
4
+ traits?: {
5
+ [k: string]: unknown;
6
+ };
7
+ }
@@ -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/calliper/identifyGroup/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { 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,53 @@
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 constants_1 = require("../utils/constants");
7
+ const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
8
+ const action = {
9
+ title: 'Identify Group',
10
+ description: 'Updates or adds properties to a group. Group is created if it does not exist.',
11
+ defaultSubscription: 'type = "group"',
12
+ fields: {
13
+ time: {
14
+ label: 'Timestamp',
15
+ type: 'datetime',
16
+ description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
17
+ default: {
18
+ '@path': '$.timestamp'
19
+ }
20
+ },
21
+ group_id: {
22
+ label: 'Group ID',
23
+ type: 'string',
24
+ description: 'The unique identifier of the group.',
25
+ required: true,
26
+ default: {
27
+ '@path': '$.groupId'
28
+ }
29
+ },
30
+ traits: {
31
+ label: 'Group Properties',
32
+ type: 'object',
33
+ description: 'The properties to set on the group profile.',
34
+ default: {
35
+ '@path': '$.traits'
36
+ }
37
+ }
38
+ },
39
+ perform: async (request, { payload, settings }) => {
40
+ const datetime = payload.time;
41
+ const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
42
+ return await request(`${constants_1.API_URL}/group/identify`, {
43
+ method: 'post',
44
+ json: {
45
+ companyId: settings.companyId,
46
+ key: settings.segmentKey,
47
+ group: { time, group_id: payload.group_id, traits: payload.traits }
48
+ }
49
+ });
50
+ }
51
+ };
52
+ exports.default = action;
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyGroup/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA4C;AAC5C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,+EAA+E;IAC5F,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,kBAAkB;YACzB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;QAC7B,MAAM,IAAI,GAAG,QAAQ,IAAI,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAEnG,OAAO,MAAM,OAAO,CAAC,GAAG,mBAAO,iBAAiB,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,SAAS,EAAE,QAAQ,CAAC,SAAS;gBAC7B,GAAG,EAAE,QAAQ,CAAC,UAAU;gBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;aACpE;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,14 @@
1
+ export interface Payload {
2
+ time?: string | number;
3
+ user_id?: string | null;
4
+ anonymous_id?: string | null;
5
+ first_name?: string;
6
+ last_name?: string;
7
+ name?: string;
8
+ email?: string;
9
+ phone?: string;
10
+ created_at?: string | number;
11
+ traits?: {
12
+ [k: string]: unknown;
13
+ };
14
+ }
@@ -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/calliper/identifyUser/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { 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,152 @@
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 constants_1 = require("../utils/constants");
8
+ const helpers_1 = require("../utils/helpers");
9
+ const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
10
+ const action = {
11
+ title: 'Identify User',
12
+ description: 'Set the user ID to recognise other evens by the same user',
13
+ defaultSubscription: 'type = "identify"',
14
+ fields: {
15
+ time: {
16
+ label: 'Timestamp',
17
+ type: 'datetime',
18
+ description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
19
+ default: {
20
+ '@path': '$.timestamp'
21
+ }
22
+ },
23
+ user_id: {
24
+ label: 'User ID',
25
+ type: 'string',
26
+ allowNull: true,
27
+ description: 'A distinct ID of an identified (logged in) user.',
28
+ default: {
29
+ '@path': '$.userId'
30
+ }
31
+ },
32
+ anonymous_id: {
33
+ label: 'Anonymous ID',
34
+ type: 'string',
35
+ allowNull: true,
36
+ description: 'A distinct ID of an unidentified (logged out) user. Device id is used if available',
37
+ default: {
38
+ '@path': '$.anonymousId'
39
+ }
40
+ },
41
+ first_name: {
42
+ description: "User's first name",
43
+ label: 'First Name',
44
+ type: 'string',
45
+ required: false,
46
+ default: {
47
+ '@if': {
48
+ exists: { '@path': '$.traits.first_name' },
49
+ then: { '@path': '$.traits.first_name' },
50
+ else: { '@path': '$.traits.firstName' }
51
+ }
52
+ }
53
+ },
54
+ last_name: {
55
+ description: "User's last name",
56
+ label: 'Last Name',
57
+ type: 'string',
58
+ required: false,
59
+ default: {
60
+ '@if': {
61
+ exists: { '@path': '$.traits.last_name' },
62
+ then: { '@path': '$.traits.last_name' },
63
+ else: { '@path': '$.traits.lastName' }
64
+ }
65
+ }
66
+ },
67
+ name: {
68
+ description: "User's full name",
69
+ label: 'Name',
70
+ type: 'string',
71
+ required: false,
72
+ default: {
73
+ '@path': '$.traits.name'
74
+ }
75
+ },
76
+ email: {
77
+ description: "User's email address",
78
+ label: 'Email',
79
+ type: 'string',
80
+ required: false,
81
+ default: {
82
+ '@path': '$.traits.email'
83
+ }
84
+ },
85
+ phone: {
86
+ description: "User's phone number",
87
+ label: 'Phone',
88
+ type: 'string',
89
+ required: false,
90
+ default: {
91
+ '@path': '$.traits.phone'
92
+ }
93
+ },
94
+ created_at: {
95
+ description: 'The timestamp for when the user profile was first created',
96
+ label: 'User Creation Time',
97
+ type: 'datetime',
98
+ required: false,
99
+ default: {
100
+ '@if': {
101
+ exists: { '@path': '$.traits.createdAt' },
102
+ then: { '@path': '$.traits.createdAt' },
103
+ else: { '@path': '$.traits.created_at' }
104
+ }
105
+ }
106
+ },
107
+ traits: {
108
+ label: 'User Properties',
109
+ type: 'object',
110
+ description: 'Properties to set on the user profile',
111
+ default: {
112
+ '@path': '$.traits'
113
+ }
114
+ }
115
+ },
116
+ perform: async (request, { payload, settings }) => {
117
+ const datetime = payload.time;
118
+ const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
119
+ const name = helpers_1.formatName(payload.first_name, payload.last_name, payload.name);
120
+ return await request(`${constants_1.API_URL}/user/identify`, {
121
+ method: 'post',
122
+ json: {
123
+ companyId: settings.companyId,
124
+ key: settings.segmentKey,
125
+ user: {
126
+ time,
127
+ user_id: payload.user_id,
128
+ anonymous_id: payload.anonymous_id,
129
+ created_at: payload.created_at,
130
+ email: payload.email,
131
+ first_name: payload.first_name,
132
+ last_name: payload.last_name,
133
+ name,
134
+ phone: payload.phone,
135
+ traits: actions_core_1.omit(payload.traits, [
136
+ 'created',
137
+ 'email',
138
+ 'firstName',
139
+ 'first_name',
140
+ 'lastName',
141
+ 'last_name',
142
+ 'name',
143
+ 'username',
144
+ 'phone'
145
+ ])
146
+ }
147
+ }
148
+ });
149
+ }
150
+ };
151
+ exports.default = action;
152
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/identifyUser/index.ts"],"names":[],"mappings":";;;;;AACA,wDAA4C;AAG5C,kDAA4C;AAC5C,8CAA6C;AAC7C,+DAAsC;AAEtC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,2DAA2D;IACxE,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,oOAAoO;YACtO,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,kDAAkD;YAC/D,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,oFAAoF;YACjG,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,mBAAmB;YAChC,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;iBACxC;aACF;SACF;QACD,SAAS,EAAE;YACT,WAAW,EAAE,kBAAkB;YAC/B,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE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+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,81 @@
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 constants_1 = require("./utils/constants");
8
+ const trackEvent_1 = __importDefault(require("./trackEvent"));
9
+ const identifyUser_1 = __importDefault(require("./identifyUser"));
10
+ const identifyGroup_1 = __importDefault(require("./identifyGroup"));
11
+ const alias_1 = __importDefault(require("./alias"));
12
+ const destination = {
13
+ name: 'Calliper Cloud (Actions)',
14
+ slug: 'calliper-cloud-actions',
15
+ mode: 'cloud',
16
+ authentication: {
17
+ scheme: 'custom',
18
+ fields: {
19
+ companyId: {
20
+ label: 'Company id',
21
+ description: 'Your company id in Calliper. During the onboarding you can find it by selecting Segment integration. After onboarding is complete you can find it by opening "Data Sources" in the main menu, pressing "New Data Source" and pressing "Connect" on a Segment card.',
22
+ type: 'string',
23
+ required: true
24
+ },
25
+ segmentKey: {
26
+ label: 'Segment Key',
27
+ description: 'Your Segment Key in Calliper. Please follow the instructions to find the Company id, secret key is located in a field next to it.',
28
+ type: 'string',
29
+ required: true
30
+ }
31
+ },
32
+ testAuthentication: (request, { settings }) => {
33
+ return request(`${constants_1.API_URL}/validate-credentials`, {
34
+ method: 'post',
35
+ json: {
36
+ companyId: settings.companyId,
37
+ key: settings.segmentKey
38
+ }
39
+ });
40
+ }
41
+ },
42
+ onDelete: async (request, { settings, payload }) => {
43
+ if (!payload.userId)
44
+ throw new actions_core_1.IntegrationError('User id is required for deletion', 'Missing required field', 400);
45
+ return request(`${constants_1.API_URL}/user/${payload.userId}`, {
46
+ method: 'delete',
47
+ json: {
48
+ companyId: settings.companyId,
49
+ key: settings.segmentKey
50
+ }
51
+ });
52
+ },
53
+ presets: [
54
+ {
55
+ name: 'Track Event',
56
+ subscribe: 'type = "track"',
57
+ partnerAction: 'trackEvent',
58
+ mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
59
+ },
60
+ {
61
+ name: 'Identify User',
62
+ subscribe: 'type = "identify"',
63
+ partnerAction: 'identifyUser',
64
+ mapping: actions_core_1.defaultValues(identifyUser_1.default.fields)
65
+ },
66
+ {
67
+ name: 'Identify Group',
68
+ subscribe: 'type = "group"',
69
+ partnerAction: 'identifyGroup',
70
+ mapping: actions_core_1.defaultValues(identifyGroup_1.default.fields)
71
+ }
72
+ ],
73
+ actions: {
74
+ trackEvent: trackEvent_1.default,
75
+ identifyUser: identifyUser_1.default,
76
+ identifyGroup: identifyGroup_1.default,
77
+ alias: alias_1.default
78
+ }
79
+ };
80
+ exports.default = destination;
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/calliper/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAuE;AAGvE,iDAA2C;AAE3C,8DAAqC;AAErC,kEAAyC;AAEzC,oEAA2C;AAE3C,oDAA2B;AAE3B,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,oQAAoQ;gBACtQ,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,mIAAmI;gBACrI,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QAED,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,OAAO,OAAO,CAAC,GAAG,mBAAO,uBAAuB,EAAE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import { InputField } from '@segment/actions-core';
2
+ export declare const eventProperties: Record<string, InputField>;
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventProperties = void 0;
4
+ exports.eventProperties = {
5
+ event: {
6
+ label: 'Event Type',
7
+ type: 'string',
8
+ description: 'A type of your event, e.g. a sign up or a name of an action within your product.',
9
+ required: true,
10
+ default: {
11
+ '@path': '$.event'
12
+ }
13
+ },
14
+ time: {
15
+ label: 'Timestamp',
16
+ type: 'datetime',
17
+ description: 'The timestamp of the event. Could be any date string/number value compatible with JavaScript Date constructor: e.g. milliseconds epoch or an ISO datetime. If time is not sent with the event, it will be set to the request time.',
18
+ default: {
19
+ '@path': '$.timestamp'
20
+ }
21
+ },
22
+ anonymous_id: {
23
+ label: 'Anonymous ID',
24
+ type: 'string',
25
+ description: 'A distinct ID of an unidentified (logged out) user. Device id is used if available',
26
+ default: {
27
+ '@path': '$.anonymousId'
28
+ }
29
+ },
30
+ user_id: {
31
+ label: 'User ID',
32
+ type: 'string',
33
+ description: 'A distinct ID of an identified (logged in) user.',
34
+ default: {
35
+ '@path': '$.userId'
36
+ }
37
+ },
38
+ group_id: {
39
+ label: 'Group ID',
40
+ type: 'string',
41
+ description: 'The unique identifier of the group that performed this event.',
42
+ default: {
43
+ '@path': '$.context.groupId'
44
+ }
45
+ },
46
+ event_unique_id: {
47
+ label: 'Event ID',
48
+ type: 'string',
49
+ description: 'A random id that is unique to an event. ID is being used to prevent event duplication. All the events that share the same unique id besides the first one will be ignored.',
50
+ default: {
51
+ '@path': '$.messageId'
52
+ }
53
+ },
54
+ app_version: {
55
+ label: 'App Version',
56
+ type: 'string',
57
+ description: 'The current version of your application.',
58
+ default: {
59
+ '@path': '$.context.app.version'
60
+ }
61
+ },
62
+ os_name: {
63
+ label: 'OS Name',
64
+ type: 'string',
65
+ description: 'The name of the mobile operating system or browser that the user is using.',
66
+ default: {
67
+ '@path': '$.context.os.name'
68
+ }
69
+ },
70
+ os_version: {
71
+ label: 'OS Version',
72
+ type: 'string',
73
+ description: 'The version of the mobile operating system or browser the user is using.',
74
+ default: {
75
+ '@path': '$.context.os.version'
76
+ }
77
+ },
78
+ device_id: {
79
+ label: 'Device ID',
80
+ type: 'string',
81
+ description: 'A unique identifier for the device the user is using.',
82
+ default: {
83
+ '@path': '$.context.device.id'
84
+ }
85
+ },
86
+ platform: {
87
+ label: 'Platform',
88
+ type: 'string',
89
+ description: 'Platform of the device.',
90
+ default: {
91
+ '@path': '$.context.device.type'
92
+ }
93
+ },
94
+ device_manufacturer: {
95
+ label: 'Device Manufacturer',
96
+ type: 'string',
97
+ description: 'The device manufacturer that the user is using.',
98
+ default: {
99
+ '@path': '$.context.device.manufacturer'
100
+ }
101
+ },
102
+ device_model: {
103
+ label: 'Device Model',
104
+ type: 'string',
105
+ description: 'The device model that the user is using.',
106
+ default: {
107
+ '@path': '$.context.device.model'
108
+ }
109
+ },
110
+ carrier: {
111
+ label: 'Carrier',
112
+ type: 'string',
113
+ description: 'The carrier that the user is using.',
114
+ default: {
115
+ '@path': '$.context.network.carrier'
116
+ }
117
+ },
118
+ cellular: {
119
+ label: 'Cellular Enabled',
120
+ type: 'boolean',
121
+ description: 'Whether cellular is enabled.',
122
+ default: {
123
+ '@path': '$.context.network.cellular'
124
+ }
125
+ },
126
+ country: {
127
+ label: 'Country',
128
+ type: 'string',
129
+ description: 'The current country of the user.',
130
+ default: {
131
+ '@path': '$.context.location.country'
132
+ }
133
+ },
134
+ region: {
135
+ label: 'Region',
136
+ type: 'string',
137
+ description: 'The current region of the user.',
138
+ default: {
139
+ '@path': '$.context.location.region'
140
+ }
141
+ },
142
+ city: {
143
+ label: 'City',
144
+ type: 'string',
145
+ description: 'The current city of the user.',
146
+ default: {
147
+ '@path': '$.context.location.city'
148
+ }
149
+ },
150
+ language: {
151
+ label: 'Language',
152
+ type: 'string',
153
+ description: 'The language set by the user.',
154
+ default: {
155
+ '@path': '$.context.locale'
156
+ }
157
+ },
158
+ library_name: {
159
+ label: 'Library Name',
160
+ type: 'string',
161
+ description: 'The name of the SDK used to send events.',
162
+ default: {
163
+ '@path': '$.context.library.name'
164
+ }
165
+ },
166
+ library_version: {
167
+ label: 'Library Version',
168
+ type: 'string',
169
+ description: 'The version of the SDK used to send events.',
170
+ default: {
171
+ '@path': '$.context.library.version'
172
+ }
173
+ },
174
+ ip: {
175
+ label: 'IP Address',
176
+ type: 'string',
177
+ description: "The IP address of the user. This is only used for geolocation and won't be stored.",
178
+ default: {
179
+ '@path': '$.context.ip'
180
+ }
181
+ },
182
+ url: {
183
+ label: 'URL',
184
+ type: 'string',
185
+ description: 'The full URL of the webpage on which the event is triggered.',
186
+ default: {
187
+ '@path': '$.context.page.url'
188
+ }
189
+ },
190
+ path: {
191
+ label: 'Page Path',
192
+ type: 'string',
193
+ description: 'The relative URL of the webpage on which the event is triggered.',
194
+ default: {
195
+ '@path': '$.context.page.path'
196
+ }
197
+ },
198
+ page_title: {
199
+ label: 'Page Title',
200
+ type: 'string',
201
+ description: 'The name of the webpage on which the event is triggered.',
202
+ default: {
203
+ '@path': '$.context.page.title'
204
+ }
205
+ },
206
+ referrer: {
207
+ label: 'Referrer',
208
+ type: 'string',
209
+ description: 'Referrer url',
210
+ default: {
211
+ '@path': '$.context.page.referrer'
212
+ }
213
+ },
214
+ user_agent: {
215
+ label: 'User Agent',
216
+ type: 'string',
217
+ description: 'User agent',
218
+ default: {
219
+ '@path': '$.context.userAgent'
220
+ }
221
+ },
222
+ event_properties: {
223
+ label: 'Event Properties',
224
+ type: 'object',
225
+ description: 'An object of key-value pairs that represent additional data to be sent along with the event.',
226
+ default: {
227
+ '@path': '$.properties'
228
+ }
229
+ }
230
+ };
231
+ //# sourceMappingURL=eventProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventProperties.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/trackEvent/eventProperties.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAA+B;IACz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AU;QACjB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE;YACP,OAAO,EAAE,yBAAyB;SACnC;KACF;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE;YACP,OAAO,EAAE,qBAAqB;SAC/B;KACF;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,8FAA8F;QAC3G,OAAO,EAAE;YACP,OAAO,EAAE,cAAc;SACxB;KACF;CACF,CAAA"}
@@ -0,0 +1,32 @@
1
+ export interface Payload {
2
+ event: string;
3
+ time?: string | number;
4
+ anonymous_id?: string;
5
+ user_id?: string;
6
+ group_id?: string;
7
+ event_unique_id?: string;
8
+ app_version?: string;
9
+ os_name?: string;
10
+ os_version?: string;
11
+ device_id?: string;
12
+ platform?: string;
13
+ device_manufacturer?: string;
14
+ device_model?: string;
15
+ carrier?: string;
16
+ cellular?: boolean;
17
+ country?: string;
18
+ region?: string;
19
+ city?: string;
20
+ language?: string;
21
+ library_name?: string;
22
+ library_version?: string;
23
+ ip?: string;
24
+ url?: string;
25
+ path?: string;
26
+ page_title?: string;
27
+ referrer?: string;
28
+ user_agent?: string;
29
+ event_properties?: {
30
+ [k: string]: unknown;
31
+ };
32
+ }
@@ -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/calliper/trackEvent/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { 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,65 @@
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 eventProperties_1 = require("./eventProperties");
7
+ const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
8
+ const constants_1 = require("../utils/constants");
9
+ const formatEvent = (payload) => {
10
+ const datetime = payload.time;
11
+ const time = datetime && dayjs_1.default.utc(datetime).isValid() ? dayjs_1.default.utc(datetime).valueOf() : Date.now();
12
+ return {
13
+ event: payload.event,
14
+ time: time,
15
+ anonymous_id: payload.anonymous_id,
16
+ user_id: payload.user_id,
17
+ group_id: payload.group_id,
18
+ event_unique_id: payload.event_unique_id,
19
+ app_version: payload.app_version,
20
+ os_name: payload.os_name,
21
+ device_id: payload.device_id,
22
+ platform: payload.platform,
23
+ device_manufacturer: payload.device_manufacturer,
24
+ device_model: payload.device_model,
25
+ carrier: payload.carrier,
26
+ cellular: payload.cellular,
27
+ country: payload.country,
28
+ region: payload.region,
29
+ city: payload.city,
30
+ language: payload.language,
31
+ library_name: `Segment: ${payload.library_name}`,
32
+ library_version: payload.library_version,
33
+ ip: payload.ip,
34
+ url: payload.url,
35
+ path: payload.path,
36
+ page_title: payload.page_title,
37
+ user_agent: payload.user_agent,
38
+ properties: payload.event_properties
39
+ };
40
+ };
41
+ const processData = async (request, settings, payload) => {
42
+ const events = payload.map(formatEvent);
43
+ return request(`${constants_1.API_URL}/event/batch`, {
44
+ method: 'post',
45
+ json: {
46
+ company_id: settings.companyId,
47
+ key: settings.segmentKey,
48
+ events
49
+ }
50
+ });
51
+ };
52
+ const action = {
53
+ title: 'Track Event',
54
+ description: 'Send your product event to Calliper.',
55
+ defaultSubscription: 'type = "track"',
56
+ fields: eventProperties_1.eventProperties,
57
+ performBatch: async (request, { settings, payload }) => {
58
+ return processData(request, settings, payload);
59
+ },
60
+ perform: async (request, { settings, payload }) => {
61
+ return processData(request, settings, [payload]);
62
+ }
63
+ };
64
+ exports.default = action;
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,uDAAmD;AACnD,+DAAsC;AACtC,kDAA4C;AAE5C,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,EAAE;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAA;IAC7B,MAAM,IAAI,GAAG,QAAQ,IAAI,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IACnG,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,YAAY,OAAO,CAAC,YAAY,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5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_URL = void 0;
4
+ exports.API_URL = 'https://api.getcalliper.com/segment';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,qCAAqC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare function formatName(firstName: unknown, lastName: unknown, name: unknown): unknown;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatName = void 0;
4
+ function formatName(firstName, lastName, name) {
5
+ return name ?? ([firstName, lastName].filter(Boolean).join(' ') || undefined);
6
+ }
7
+ exports.formatName = formatName;
8
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/destinations/calliper/utils/helpers.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,SAAkB,EAAE,QAAiB,EAAE,IAAa;IAC7E,OAAO,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAA;AAC/E,CAAC;AAFD,gCAEC"}
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.165.1-update-actions-core.4+747d12d3",
4
+ "version": "3.166.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -40,8 +40,8 @@
40
40
  "dependencies": {
41
41
  "@amplitude/ua-parser-js": "^0.7.25",
42
42
  "@segment/a1-notation": "^2.1.4",
43
- "@segment/actions-core": "^3.64.1-update-actions-core.4+747d12d3",
44
- "@segment/actions-shared": "^1.46.1-update-actions-core.4+747d12d3",
43
+ "@segment/actions-core": "^3.65.0",
44
+ "@segment/actions-shared": "^1.47.0",
45
45
  "@types/node": "^18.11.15",
46
46
  "aws4": "^1.12.0",
47
47
  "cheerio": "^1.0.0-rc.10",
@@ -71,5 +71,5 @@
71
71
  "lcov"
72
72
  ]
73
73
  },
74
- "gitHead": "747d12d30110814b347827eeaf3d8b02968b1e2b"
74
+ "gitHead": "2ddadb41c1bc56d67abcf354f5f034d982d3f8c7"
75
75
  }