@segment/action-destinations 3.172.0 → 3.174.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 (62) hide show
  1. package/dist/destinations/acoustic/Utility/eventprocessing.d.ts +1 -5
  2. package/dist/destinations/acoustic/Utility/eventprocessing.js +66 -62
  3. package/dist/destinations/acoustic/Utility/eventprocessing.js.map +1 -1
  4. package/dist/destinations/acoustic/Utility/tablemaintutilities.d.ts +13 -1
  5. package/dist/destinations/acoustic/Utility/tablemaintutilities.js +108 -59
  6. package/dist/destinations/acoustic/Utility/tablemaintutilities.js.map +1 -1
  7. package/dist/destinations/acoustic/generated-types.d.ts +5 -4
  8. package/dist/destinations/acoustic/index.js +18 -26
  9. package/dist/destinations/acoustic/index.js.map +1 -1
  10. package/dist/destinations/acoustic/receiveEvents/generated-types.d.ts +6 -0
  11. package/dist/destinations/acoustic/receiveEvents/index.js +33 -19
  12. package/dist/destinations/acoustic/receiveEvents/index.js.map +1 -1
  13. package/dist/destinations/canny-functions/constants/api.d.ts +1 -0
  14. package/dist/destinations/canny-functions/constants/api.js +5 -0
  15. package/dist/destinations/canny-functions/constants/api.js.map +1 -0
  16. package/dist/destinations/canny-functions/constants/traits.d.ts +2 -0
  17. package/dist/destinations/canny-functions/constants/traits.js +6 -0
  18. package/dist/destinations/canny-functions/constants/traits.js.map +1 -0
  19. package/dist/destinations/canny-functions/generated-types.d.ts +3 -0
  20. package/dist/destinations/canny-functions/generated-types.js +3 -0
  21. package/dist/destinations/canny-functions/generated-types.js.map +1 -0
  22. package/dist/destinations/canny-functions/group/generated-types.d.ts +7 -0
  23. package/dist/destinations/canny-functions/group/generated-types.js +3 -0
  24. package/dist/destinations/canny-functions/group/generated-types.js.map +1 -0
  25. package/dist/destinations/canny-functions/group/index.d.ts +5 -0
  26. package/dist/destinations/canny-functions/group/index.js +46 -0
  27. package/dist/destinations/canny-functions/group/index.js.map +1 -0
  28. package/dist/destinations/canny-functions/identify/generated-types.d.ts +15 -0
  29. package/dist/destinations/canny-functions/identify/generated-types.js +3 -0
  30. package/dist/destinations/canny-functions/identify/generated-types.js.map +1 -0
  31. package/dist/destinations/canny-functions/identify/index.d.ts +5 -0
  32. package/dist/destinations/canny-functions/identify/index.js +95 -0
  33. package/dist/destinations/canny-functions/identify/index.js.map +1 -0
  34. package/dist/destinations/canny-functions/index.d.ts +4 -0
  35. package/dist/destinations/canny-functions/index.js +60 -0
  36. package/dist/destinations/canny-functions/index.js.map +1 -0
  37. package/dist/destinations/heap/trackEvent/index.js +2 -2
  38. package/dist/destinations/heap/trackEvent/index.js.map +1 -1
  39. package/dist/destinations/index.js +2 -0
  40. package/dist/destinations/index.js.map +1 -1
  41. package/dist/destinations/koala/generated-types.d.ts +3 -0
  42. package/dist/destinations/koala/generated-types.js +3 -0
  43. package/dist/destinations/koala/generated-types.js.map +1 -0
  44. package/dist/destinations/koala/identify/generated-types.d.ts +12 -0
  45. package/dist/destinations/koala/identify/generated-types.js +3 -0
  46. package/dist/destinations/koala/identify/generated-types.js.map +1 -0
  47. package/dist/destinations/koala/identify/index.d.ts +5 -0
  48. package/dist/destinations/koala/identify/index.js +85 -0
  49. package/dist/destinations/koala/identify/index.js.map +1 -0
  50. package/dist/destinations/koala/index.d.ts +5 -0
  51. package/dist/destinations/koala/index.js +52 -0
  52. package/dist/destinations/koala/index.js.map +1 -0
  53. package/dist/destinations/koala/lib/ajs-detection.d.ts +6 -0
  54. package/dist/destinations/koala/lib/ajs-detection.js +8 -0
  55. package/dist/destinations/koala/lib/ajs-detection.js.map +1 -0
  56. package/dist/destinations/koala/track/generated-types.d.ts +16 -0
  57. package/dist/destinations/koala/track/generated-types.js +3 -0
  58. package/dist/destinations/koala/track/generated-types.js.map +1 -0
  59. package/dist/destinations/koala/track/index.d.ts +5 -0
  60. package/dist/destinations/koala/track/index.js +103 -0
  61. package/dist/destinations/koala/track/index.js.map +1 -0
  62. package/package.json +2 -2
@@ -0,0 +1,52 @@
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
+ exports.KOALA_PATH = void 0;
7
+ const actions_core_1 = require("@segment/actions-core");
8
+ const track_1 = __importDefault(require("./track"));
9
+ const identify_1 = __importDefault(require("./identify"));
10
+ exports.KOALA_PATH = process.env.NODE_ENV === 'development'
11
+ ? 'http://localhost:3001/web/projects'
12
+ : 'https://api2.getkoala.com/web/projects';
13
+ const presets = [
14
+ {
15
+ name: 'Track Calls',
16
+ subscribe: 'type = "track"',
17
+ partnerAction: 'track',
18
+ mapping: actions_core_1.defaultValues(track_1.default.fields)
19
+ },
20
+ {
21
+ name: 'Identify Calls',
22
+ subscribe: 'type = "identify"',
23
+ partnerAction: 'identify',
24
+ mapping: actions_core_1.defaultValues(identify_1.default.fields)
25
+ }
26
+ ];
27
+ const destination = {
28
+ name: 'Koala (Cloud)',
29
+ slug: 'actions-koala-cloud',
30
+ mode: 'cloud',
31
+ authentication: {
32
+ scheme: 'custom',
33
+ fields: {
34
+ public_key: {
35
+ label: 'Public Key',
36
+ description: 'Your public key',
37
+ type: 'string',
38
+ required: true
39
+ }
40
+ },
41
+ testAuthentication: (request, { settings }) => {
42
+ return request(`${exports.KOALA_PATH}/${settings.public_key}/auth`, { method: 'get' });
43
+ }
44
+ },
45
+ presets,
46
+ actions: {
47
+ track: track_1.default,
48
+ identify: identify_1.default
49
+ }
50
+ };
51
+ exports.default = destination;
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/koala/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA4E;AAG5E,oDAA2B;AAC3B,0DAAiC;AAEpB,QAAA,UAAU,GACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACpC,CAAC,CAAC,oCAAoC;IACtC,CAAC,CAAC,wCAAwC,CAAA;AAE9C,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,gBAAgB;QAC3B,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,4BAAa,CAAC,eAAK,CAAC,MAAM,CAAC;KACrC;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,mBAAmB;QAC9B,aAAa,EAAE,UAAU;QACzB,OAAO,EAAE,4BAAa,CAAC,kBAAQ,CAAC,MAAM,CAAC;KACxC;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,UAAU,EAAE;gBACV,KAAK,EAAE,YAAY;gBACnB,WAAW,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,OAAO,OAAO,CAAC,GAAG,kBAAU,IAAI,QAAQ,CAAC,UAAU,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;QAChF,CAAC;KACF;IACD,OAAO;IACP,OAAO,EAAE;QACP,KAAK,EAAL,eAAK;QACL,QAAQ,EAAR,kBAAQ;KACT;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface AnalyticsEventContext {
2
+ library?: {
3
+ name?: string;
4
+ };
5
+ }
6
+ export declare function isAJSEvent(eventContext?: AnalyticsEventContext): boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAJSEvent = void 0;
4
+ function isAJSEvent(eventContext) {
5
+ return eventContext?.library?.name === 'analytics.js';
6
+ }
7
+ exports.isAJSEvent = isAJSEvent;
8
+ //# sourceMappingURL=ajs-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajs-detection.js","sourceRoot":"","sources":["../../../../src/destinations/koala/lib/ajs-detection.ts"],"names":[],"mappings":";;;AAMA,SAAgB,UAAU,CAAC,YAAoC;IAC7D,OAAO,YAAY,EAAE,OAAO,EAAE,IAAI,KAAK,cAAc,CAAA;AACvD,CAAC;AAFD,gCAEC"}
@@ -0,0 +1,16 @@
1
+ export interface Payload {
2
+ email?: string;
3
+ event: string;
4
+ properties?: {
5
+ [k: string]: unknown;
6
+ };
7
+ sent_at: string;
8
+ context?: {
9
+ [k: string]: unknown;
10
+ };
11
+ traits?: {
12
+ [k: string]: unknown;
13
+ };
14
+ device_ip?: string;
15
+ message_id: string;
16
+ }
@@ -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/koala/track/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,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("..");
4
+ const ajs_detection_1 = require("../lib/ajs-detection");
5
+ const action = {
6
+ title: 'Track',
7
+ description: 'Send an Event to Koala.',
8
+ defaultSubscription: 'type = "track"',
9
+ fields: {
10
+ email: {
11
+ type: 'string',
12
+ label: 'Email',
13
+ description: 'The email to associate with the user',
14
+ required: false,
15
+ default: {
16
+ '@if': {
17
+ exists: { '@path': '$.traits.email' },
18
+ then: { '@path': '$.traits.email' },
19
+ else: { '@path': '$.email' }
20
+ }
21
+ }
22
+ },
23
+ event: {
24
+ type: 'string',
25
+ required: true,
26
+ description: 'The event name',
27
+ label: 'Event Name',
28
+ default: { '@path': '$.event' }
29
+ },
30
+ properties: {
31
+ type: 'object',
32
+ required: false,
33
+ description: 'Properties to send with the event',
34
+ label: 'Event properties',
35
+ default: { '@path': '$.properties' }
36
+ },
37
+ sent_at: {
38
+ type: 'string',
39
+ format: 'date-time',
40
+ required: true,
41
+ description: 'The timestamp of the event',
42
+ label: 'Sent At',
43
+ default: { '@path': '$.timestamp' }
44
+ },
45
+ context: {
46
+ type: 'object',
47
+ required: false,
48
+ description: 'Context properties to send with the event',
49
+ label: 'Context properties',
50
+ default: { '@path': '$.context' }
51
+ },
52
+ traits: {
53
+ type: 'object',
54
+ required: false,
55
+ description: 'Traits inherited from the context object',
56
+ label: 'Context properties',
57
+ default: { '@path': '$.context.traits' }
58
+ },
59
+ device_ip: {
60
+ type: 'string',
61
+ required: false,
62
+ description: 'The device IP collected from the context',
63
+ label: 'Context properties',
64
+ default: { '@path': '$.context.ip' }
65
+ },
66
+ message_id: {
67
+ type: 'string',
68
+ required: true,
69
+ description: 'The Segment messageId',
70
+ label: 'MessageId',
71
+ default: { '@path': '$.messageId' }
72
+ }
73
+ },
74
+ perform: (request, data) => {
75
+ const profileId = data.payload.properties?.profile_id;
76
+ const traits = data.payload.traits ?? {};
77
+ const email = data.payload.email ?? data.payload.properties?.email ?? traits.email;
78
+ const ip = data.payload.properties?.ip ?? data.payload.device_ip;
79
+ if (ajs_detection_1.isAJSEvent(data.payload.context)) {
80
+ return Promise.resolve();
81
+ }
82
+ if (!profileId && !email) {
83
+ return Promise.resolve();
84
+ }
85
+ return request(`${__1.KOALA_PATH}/${data.settings.public_key}/batch`, {
86
+ method: 'post',
87
+ json: {
88
+ profile_id: profileId,
89
+ email,
90
+ traits,
91
+ ip,
92
+ events: [
93
+ {
94
+ type: 'track',
95
+ ...data.payload
96
+ }
97
+ ]
98
+ }
99
+ });
100
+ }
101
+ };
102
+ exports.default = action;
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/koala/track/index.ts"],"names":[],"mappings":";;AACA,0BAA+B;AAG/B,wDAAwE;AAExE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,yBAAyB;IACtC,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;oBACnC,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;iBAC7B;aACF;SACF;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,gBAAgB;YAC7B,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;SAChC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,mCAAmC;YAChD,KAAK,EAAE,kBAAkB;YACzB,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4BAA4B;YACzC,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,2CAA2C;YACxD,KAAK,EAAE,oBAAo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ED,OAAO,OAAO,CAAC,GAAG,cAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,QAAQ,EAAE;YAChE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,SAAS;gBACrB,KAAK;gBACL,MAAM;gBACN,EAAE;gBACF,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,OAAO;wBACb,GAAG,IAAI,CAAC,OAAO;qBAChB;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
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.172.0",
4
+ "version": "3.174.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -71,5 +71,5 @@
71
71
  "lcov"
72
72
  ]
73
73
  },
74
- "gitHead": "334c1e37af393d4f3b09e0a2de7c40c052ccef4b"
74
+ "gitHead": "009485df5a361c964c72ab07eb2d89a7df172f9e"
75
75
  }