@segment/action-destinations 3.337.2 → 3.337.3

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 (106) hide show
  1. package/dist/destinations/customerio/createUpdateDevice/generated-types.d.ts +3 -0
  2. package/dist/destinations/customerio/createUpdateDevice/index.js +29 -17
  3. package/dist/destinations/customerio/createUpdateDevice/index.js.map +1 -1
  4. package/dist/destinations/customerio/createUpdateObject/generated-types.d.ts +3 -0
  5. package/dist/destinations/customerio/createUpdateObject/index.js +80 -39
  6. package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
  7. package/dist/destinations/customerio/createUpdatePerson/generated-types.d.ts +4 -1
  8. package/dist/destinations/customerio/createUpdatePerson/index.d.ts +1 -1
  9. package/dist/destinations/customerio/createUpdatePerson/index.js +51 -41
  10. package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
  11. package/dist/destinations/customerio/deleteDevice/index.js +15 -5
  12. package/dist/destinations/customerio/deleteDevice/index.js.map +1 -1
  13. package/dist/destinations/customerio/deleteObject/generated-types.d.ts +4 -0
  14. package/dist/destinations/customerio/deleteObject/generated-types.js +3 -0
  15. package/dist/destinations/customerio/deleteObject/generated-types.js.map +1 -0
  16. package/dist/destinations/customerio/deleteObject/index.d.ts +5 -0
  17. package/dist/destinations/customerio/deleteObject/index.js +48 -0
  18. package/dist/destinations/customerio/deleteObject/index.js.map +1 -0
  19. package/dist/destinations/customerio/deletePerson/generated-types.d.ts +3 -0
  20. package/dist/destinations/customerio/deletePerson/generated-types.js +3 -0
  21. package/dist/destinations/customerio/deletePerson/generated-types.js.map +1 -0
  22. package/dist/destinations/customerio/deletePerson/index.d.ts +5 -0
  23. package/dist/destinations/customerio/deletePerson/index.js +41 -0
  24. package/dist/destinations/customerio/deletePerson/index.js.map +1 -0
  25. package/dist/destinations/customerio/deleteRelationship/generated-types.d.ts +6 -0
  26. package/dist/destinations/customerio/deleteRelationship/generated-types.js +3 -0
  27. package/dist/destinations/customerio/deleteRelationship/generated-types.js.map +1 -0
  28. package/dist/destinations/customerio/deleteRelationship/index.d.ts +5 -0
  29. package/dist/destinations/customerio/deleteRelationship/index.js +82 -0
  30. package/dist/destinations/customerio/deleteRelationship/index.js.map +1 -0
  31. package/dist/destinations/customerio/index.js +37 -15
  32. package/dist/destinations/customerio/index.js.map +1 -1
  33. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.d.ts +10 -0
  34. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js +3 -0
  35. package/dist/destinations/customerio/reportDeliveryEvent/generated-types.js.map +1 -0
  36. package/dist/destinations/customerio/reportDeliveryEvent/index.d.ts +5 -0
  37. package/dist/destinations/customerio/reportDeliveryEvent/index.js +121 -0
  38. package/dist/destinations/customerio/reportDeliveryEvent/index.js.map +1 -0
  39. package/dist/destinations/customerio/suppressPerson/generated-types.d.ts +3 -0
  40. package/dist/destinations/customerio/suppressPerson/generated-types.js +3 -0
  41. package/dist/destinations/customerio/suppressPerson/generated-types.js.map +1 -0
  42. package/dist/destinations/customerio/suppressPerson/index.d.ts +5 -0
  43. package/dist/destinations/customerio/suppressPerson/index.js +41 -0
  44. package/dist/destinations/customerio/suppressPerson/index.js.map +1 -0
  45. package/dist/destinations/customerio/test-helper.d.ts +6 -0
  46. package/dist/destinations/customerio/test-helper.js +84 -0
  47. package/dist/destinations/customerio/test-helper.js.map +1 -0
  48. package/dist/destinations/customerio/trackEvent/index.js +26 -32
  49. package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
  50. package/dist/destinations/customerio/trackPageView/generated-types.d.ts +1 -0
  51. package/dist/destinations/customerio/trackPageView/index.js +26 -29
  52. package/dist/destinations/customerio/trackPageView/index.js.map +1 -1
  53. package/dist/destinations/customerio/trackScreenView/generated-types.d.ts +1 -0
  54. package/dist/destinations/customerio/trackScreenView/index.js +25 -29
  55. package/dist/destinations/customerio/trackScreenView/index.js.map +1 -1
  56. package/dist/destinations/customerio/unsuppressPerson/generated-types.d.ts +3 -0
  57. package/dist/destinations/customerio/unsuppressPerson/generated-types.js +3 -0
  58. package/dist/destinations/customerio/unsuppressPerson/generated-types.js.map +1 -0
  59. package/dist/destinations/customerio/unsuppressPerson/index.d.ts +5 -0
  60. package/dist/destinations/customerio/unsuppressPerson/index.js +41 -0
  61. package/dist/destinations/customerio/unsuppressPerson/index.js.map +1 -0
  62. package/dist/destinations/customerio/utils.d.ts +44 -2
  63. package/dist/destinations/customerio/utils.js +88 -13
  64. package/dist/destinations/customerio/utils.js.map +1 -1
  65. package/dist/destinations/segment/segment-properties.d.ts +1 -0
  66. package/dist/destinations/segment/segment-properties.js +7 -1
  67. package/dist/destinations/segment/segment-properties.js.map +1 -1
  68. package/dist/destinations/segment/sendGroup/generated-types.d.ts +1 -0
  69. package/dist/destinations/segment/sendGroup/index.js +3 -2
  70. package/dist/destinations/segment/sendGroup/index.js.map +1 -1
  71. package/dist/destinations/segment/sendIdentify/generated-types.d.ts +1 -0
  72. package/dist/destinations/segment/sendIdentify/index.js +3 -2
  73. package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
  74. package/dist/destinations/segment/sendPage/generated-types.d.ts +1 -0
  75. package/dist/destinations/segment/sendPage/index.js +3 -2
  76. package/dist/destinations/segment/sendPage/index.js.map +1 -1
  77. package/dist/destinations/segment/sendScreen/generated-types.d.ts +1 -0
  78. package/dist/destinations/segment/sendScreen/index.js +3 -2
  79. package/dist/destinations/segment/sendScreen/index.js.map +1 -1
  80. package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -0
  81. package/dist/destinations/segment/sendTrack/index.js +3 -2
  82. package/dist/destinations/segment/sendTrack/index.js.map +1 -1
  83. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
  84. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
  85. package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
  86. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
  87. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +499 -0
  88. package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
  89. package/dist/destinations/snap-conversions-api/_tests_/index.test.js +4 -352
  90. package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
  91. package/dist/destinations/snap-conversions-api/index.js.map +1 -1
  92. package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +24 -20
  93. package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -1
  94. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
  95. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
  96. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
  97. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.d.ts +8 -0
  98. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js +126 -0
  99. package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js.map +1 -0
  100. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.d.ts +13 -0
  101. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js +40 -0
  102. package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js.map +1 -0
  103. package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +0 -5
  104. package/dist/destinations/snap-conversions-api/snap-capi-properties.js +1 -86
  105. package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deletePerson/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,iCAAiC;IAC9C,mBAAmB,EAAE,wBAAwB;IAC7C,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;YACD,QAAQ,EAAE,IAAI;SACf;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,QAAQ;YAChB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,QAAQ;YAChB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface Payload {
2
+ person_id: string;
3
+ anonymous_id?: string;
4
+ object_id: string;
5
+ object_type_id?: string;
6
+ }
@@ -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/customerio/deleteRelationship/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,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Delete Relationship',
6
+ description: `Delete a relationship between a person and an object in Customer.io.`,
7
+ defaultSubscription: 'event = "Relationship Deleted"',
8
+ fields: {
9
+ person_id: {
10
+ label: 'Person ID',
11
+ description: 'The ID used to uniquely identify a person in Customer.io. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
12
+ type: 'string',
13
+ default: {
14
+ '@if': {
15
+ exists: { '@path': '$.userId' },
16
+ then: { '@path': '$.userId' },
17
+ else: { '@path': '$.traits.email' }
18
+ }
19
+ },
20
+ required: true
21
+ },
22
+ anonymous_id: {
23
+ label: 'Anonymous ID',
24
+ description: 'An optional anonymous ID. This is used to tie anonymous events to this person. [Learn more](https://customer.io/docs/anonymous-events/).',
25
+ type: 'string',
26
+ default: {
27
+ '@path': '$.anonymousId'
28
+ }
29
+ },
30
+ object_id: {
31
+ label: 'Object ID',
32
+ description: 'An object ID used to identify an object.',
33
+ type: 'string',
34
+ default: {
35
+ '@path': '$.context.groupId'
36
+ },
37
+ required: true
38
+ },
39
+ object_type_id: {
40
+ label: 'Object Type ID',
41
+ description: 'An object ID type used to identify the type of object.',
42
+ type: 'string',
43
+ default: {
44
+ '@if': {
45
+ exists: { '@path': '$.properties.object_type_id' },
46
+ then: { '@path': '$.properties.object_type_id' },
47
+ else: { '@path': '$.properties.objectTypeId' }
48
+ }
49
+ }
50
+ }
51
+ },
52
+ performBatch: (request, { payload: payloads, settings }) => {
53
+ return utils_1.sendBatch(request, payloads.map((payload) => ({
54
+ action: 'delete_relationships',
55
+ settings,
56
+ ...mapPayload(payload)
57
+ })));
58
+ },
59
+ perform: (request, { payload, settings }) => {
60
+ return utils_1.sendSingle(request, {
61
+ action: 'delete_relationships',
62
+ settings,
63
+ ...mapPayload(payload)
64
+ });
65
+ }
66
+ };
67
+ function mapPayload(payload) {
68
+ const { anonymous_id, person_id } = payload;
69
+ return {
70
+ type: 'object',
71
+ payload: {
72
+ ...payload,
73
+ cio_relationships: [
74
+ {
75
+ identifiers: utils_1.resolveIdentifiers({ anonymous_id, person_id })
76
+ }
77
+ ]
78
+ }
79
+ };
80
+ }
81
+ exports.default = action;
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/deleteRelationship/index.ts"],"names":[],"mappings":";;AAGA,oCAAoE;AAEpE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,sEAAsE;IACnF,mBAAmB,EAAE,gCAAgC;IACrD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,mIAAmI;YACrI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;YACD,QAAQ,EAAE,IAAI;SACf;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EACT,0IAA0I;YAC5I,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,0CAA0C;YACvD,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;YACD,QAAQ,EAAE,IAAI;SACf;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;oBAClD,IAAI,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;oBAChD,IAAI,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;iBAC/C;aACF;SACF;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,sBAAsB;YAC9B,QAAQ;YACR,GAAG,UAAU,CAAC,OAAO,CAAC;SACvB,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,sBAAsB;YAC9B,QAAQ;YACR,GAAG,UAAU,CAAC,OAAO,CAAC;SACvB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IAE3C,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,GAAG,OAAO;YACV,iBAAiB,EAAE;gBACjB;oBACE,WAAW,EAAE,0BAAkB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;iBAC7D;aACF;SACF;KACF,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -5,12 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const actions_core_1 = require("@segment/actions-core");
7
7
  const createUpdateDevice_1 = __importDefault(require("./createUpdateDevice"));
8
- const deleteDevice_1 = __importDefault(require("./deleteDevice"));
8
+ const createUpdateObject_1 = __importDefault(require("./createUpdateObject"));
9
9
  const createUpdatePerson_1 = __importDefault(require("./createUpdatePerson"));
10
+ const deleteDevice_1 = __importDefault(require("./deleteDevice"));
11
+ const deleteRelationship_1 = __importDefault(require("./deleteRelationship"));
12
+ const deleteObject_1 = __importDefault(require("./deleteObject"));
13
+ const deletePerson_1 = __importDefault(require("./deletePerson"));
14
+ const reportDeliveryEvent_1 = __importDefault(require("./reportDeliveryEvent"));
15
+ const suppressPerson_1 = __importDefault(require("./suppressPerson"));
16
+ const unsuppressPerson_1 = __importDefault(require("./unsuppressPerson"));
10
17
  const trackEvent_1 = __importDefault(require("./trackEvent"));
11
18
  const trackPageView_1 = __importDefault(require("./trackPageView"));
12
19
  const trackScreenView_1 = __importDefault(require("./trackScreenView"));
13
- const createUpdateObject_1 = __importDefault(require("./createUpdateObject"));
14
20
  const utils_1 = require("./utils");
15
21
  const destination = {
16
22
  name: 'Actions Customerio',
@@ -22,13 +28,13 @@ const destination = {
22
28
  siteId: {
23
29
  description: 'Customer.io site ID. This can be found on your [API Credentials page](https://fly.customer.io/settings/api_credentials).',
24
30
  label: 'Site ID',
25
- type: 'string',
31
+ type: 'password',
26
32
  required: true
27
33
  },
28
34
  apiKey: {
29
35
  description: 'Customer.io API key. This can be found on your [API Credentials page](https://fly.customer.io/settings/api_credentials).',
30
36
  label: 'API Key',
31
- type: 'string',
37
+ type: 'password',
32
38
  required: true
33
39
  },
34
40
  accountRegion: {
@@ -52,11 +58,17 @@ const destination = {
52
58
  actions: {
53
59
  createUpdateDevice: createUpdateDevice_1.default,
54
60
  deleteDevice: deleteDevice_1.default,
61
+ deleteRelationship: deleteRelationship_1.default,
62
+ deletePerson: deletePerson_1.default,
63
+ deleteObject: deleteObject_1.default,
55
64
  createUpdatePerson: createUpdatePerson_1.default,
56
65
  trackEvent: trackEvent_1.default,
57
66
  trackPageView: trackPageView_1.default,
58
67
  trackScreenView: trackScreenView_1.default,
59
- createUpdateObject: createUpdateObject_1.default
68
+ createUpdateObject: createUpdateObject_1.default,
69
+ suppressPerson: suppressPerson_1.default,
70
+ unsuppressPerson: unsuppressPerson_1.default,
71
+ reportDeliveryEvent: reportDeliveryEvent_1.default
60
72
  },
61
73
  presets: [
62
74
  {
@@ -73,16 +85,20 @@ const destination = {
73
85
  mapping: actions_core_1.defaultValues(createUpdateDevice_1.default.fields),
74
86
  type: 'automatic'
75
87
  },
76
- {
77
- name: 'Delete Device',
78
- subscribe: 'event = "Application Uninstalled"',
79
- partnerAction: 'deleteDevice',
80
- mapping: actions_core_1.defaultValues(deleteDevice_1.default.fields),
81
- type: 'automatic'
82
- },
83
88
  {
84
89
  name: 'Track Event',
85
- subscribe: 'type = "track"',
90
+ subscribe: `
91
+ type = "track"
92
+ and event != "Application Installed"
93
+ and event != "Application Opened"
94
+ and event != "Application Uninstalled"
95
+ and event != "Relationship Deleted"
96
+ and event != "User Deleted"
97
+ and event != "User Suppressed"
98
+ and event != "User Unsuppressed"
99
+ and event != "Object Deleted"
100
+ and event != "Report Delivery Event"
101
+ `,
86
102
  partnerAction: 'trackEvent',
87
103
  mapping: actions_core_1.defaultValues(trackEvent_1.default.fields),
88
104
  type: 'automatic'
@@ -108,6 +124,13 @@ const destination = {
108
124
  mapping: actions_core_1.defaultValues(createUpdateObject_1.default.fields),
109
125
  type: 'automatic'
110
126
  },
127
+ {
128
+ name: 'Report Delivery Event',
129
+ subscribe: 'event = "Report Delivery Event"',
130
+ partnerAction: 'reportDeliveryEvent',
131
+ mapping: actions_core_1.defaultValues(reportDeliveryEvent_1.default.fields),
132
+ type: 'automatic'
133
+ },
111
134
  {
112
135
  name: 'Associated Entity Added',
113
136
  partnerAction: 'trackEvent',
@@ -170,9 +193,8 @@ const destination = {
170
193
  }
171
194
  ],
172
195
  onDelete(request, { settings, payload }) {
173
- const { accountRegion } = settings;
174
196
  const { userId } = payload;
175
- const url = `${utils_1.trackApiEndpoint(accountRegion)}/api/v1/customers/${userId}`;
197
+ const url = `${utils_1.trackApiEndpoint(settings)}/api/v1/customers/${userId}`;
176
198
  return request(url, {
177
199
  method: 'DELETE'
178
200
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/customerio/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAAqD;AACrD,8EAAqD;AACrD,kEAAyC;AACzC,8EAAqD;AACrD,8DAAqC;AACrC,oEAA2C;AAC3C,wEAA+C;AAC/C,8EAAqD;AAGrD,mCAAyD;AAEzD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,WAAW,EACT,0HAA0H;gBAC5H,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,MAAM,EAAE;gBACN,WAAW,EACT,0HAA0H;gBAC5H,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,WAAW,EAAE,wEAAwE;gBACrF,KAAK,EAAE,gBAAgB;gBACvB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAa,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7E,OAAO,EAAE,qBAAa,CAAC,EAAE;aAC1B;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,gCAAgC,CAAC,CAAA;QAClD,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ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,SAAS,EAAE,iCAAiC;SAC7C;QACD;YACE,IAAI,EAAE,sCAAsC;YAC5C,aAAa,EAAE,oBAAoB;YACnC,OAAO,EAAE;gBACP,GAAG,4BAAa,CAAC,4BAAkB,CAAC,MAAM,CAAC;gBAC3C,iBAAiB,EAAE;oBACjB,OAAO,EAAE,UAAU;iBACpB;aACF;YACD,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,gDAAgD;SAC5D;KACF;IAED,QAAQ,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;QACrC,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAA;QAClC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAE1B,MAAM,GAAG,GAAG,GAAG,wBAAgB,CAAC,aAAa,CAAC,qBAAqB,MAAM,EAAE,CAAA;QAE3E,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/customerio/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAAqD;AACrD,8EAAqD;AACrD,8EAAqD;AACrD,8EAAqD;AACrD,kEAAyC;AACzC,8EAAqD;AACrD,kEAAyC;AACzC,kEAAyC;AACzC,gFAAuD;AACvD,sEAA6C;AAC7C,0EAAiD;AACjD,8DAAqC;AACrC,oEAA2C;AAC3C,wEAA+C;AAG/C,mCAAyD;AAEzD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,WAAW,EACT,0HAA0H;gBAC5H,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;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E,CAAA;QAEtE,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ export interface Payload {
2
+ delivery_id: string;
3
+ metric: string;
4
+ recipient?: string;
5
+ reason?: string;
6
+ href?: string;
7
+ action_name?: string;
8
+ action_value?: string;
9
+ timestamp?: string | number;
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/customerio/reportDeliveryEvent/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,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Report Delivery Event',
6
+ description: 'Report delivery metrics for a message sent from the Customer.io Journeys product.',
7
+ defaultSubscription: 'event = "Report Delivery Event"',
8
+ fields: {
9
+ delivery_id: {
10
+ label: 'Delivery ID',
11
+ description: 'The CIO-Delivery-ID from the message that you want to associate the metric with.',
12
+ type: 'string',
13
+ default: {
14
+ '@path': '$.properties.deliveryId'
15
+ },
16
+ required: true
17
+ },
18
+ metric: {
19
+ label: 'Metric',
20
+ description: `The metric you want to report back to Customer.io. Not all metrics are available for all channels. Please refer to the [documentation](https://customer.io/docs/api/track/#operation/metrics) for more information.`,
21
+ type: 'string',
22
+ default: {
23
+ '@path': '$.properties.metric'
24
+ },
25
+ required: true,
26
+ choices: [
27
+ { label: 'Delivered', value: 'delivered' },
28
+ { label: 'Opened', value: 'opened' },
29
+ { label: 'Clicked', value: 'clicked' },
30
+ { label: 'Converted', value: 'converted' },
31
+ { label: 'Marked as Spam', value: 'spammed' },
32
+ { label: 'Bounced', value: 'bounced' },
33
+ { label: 'Suppressed', value: 'dropped' },
34
+ { label: 'Deferred', value: 'deferred' }
35
+ ]
36
+ },
37
+ recipient: {
38
+ label: 'Recipient',
39
+ description: `Information about who the message was delivered to. For email, SMS and mobile push this is the email address, phone number and device token, respectively.`,
40
+ type: 'string',
41
+ default: {
42
+ '@path': '$.properties.recipient'
43
+ }
44
+ },
45
+ reason: {
46
+ label: 'Reason',
47
+ description: 'For metrics indicating a failure, this field provides information for the failure.',
48
+ type: 'string',
49
+ default: {
50
+ '@path': '$.properties.reason'
51
+ }
52
+ },
53
+ href: {
54
+ label: 'Href',
55
+ description: 'For click metrics, this is the link that was clicked.',
56
+ type: 'string',
57
+ default: {
58
+ '@path': '$.properties.href'
59
+ }
60
+ },
61
+ action_name: {
62
+ label: 'Action Name',
63
+ description: 'For In-App messages, this is the name of the action that was clicked.',
64
+ type: 'string',
65
+ default: {
66
+ '@path': '$.properties.actionName'
67
+ }
68
+ },
69
+ action_value: {
70
+ label: 'Action Value',
71
+ description: 'For In-App messages, this is the value of the action that was clicked.',
72
+ type: 'string',
73
+ default: {
74
+ '@path': '$.properties.actionValue'
75
+ }
76
+ },
77
+ timestamp: {
78
+ label: 'Timestamp',
79
+ description: 'A timestamp of when the metric event took place. Default is when the event was triggered.',
80
+ type: 'datetime',
81
+ format: 'date-time',
82
+ default: {
83
+ '@path': '$.timestamp'
84
+ }
85
+ }
86
+ },
87
+ perform: (request, { payload, settings }) => {
88
+ const metricsRequest = {
89
+ delivery_id: payload.delivery_id,
90
+ metric: payload.metric,
91
+ timestamp: Math.floor(Date.now() / 1000)
92
+ };
93
+ const unix_timestamp = Number(utils_1.convertValidTimestamp(payload.timestamp));
94
+ if (!isNaN(unix_timestamp)) {
95
+ metricsRequest.timestamp = unix_timestamp;
96
+ }
97
+ if (payload.recipient) {
98
+ metricsRequest.recipient = payload.recipient;
99
+ }
100
+ if (payload.reason) {
101
+ metricsRequest.reason = payload.reason;
102
+ }
103
+ if (payload.href) {
104
+ metricsRequest.href = payload.href;
105
+ }
106
+ if (payload.action_name) {
107
+ metricsRequest.metadata = metricsRequest.metadata || {};
108
+ metricsRequest.metadata.action_name = payload.action_name;
109
+ }
110
+ if (payload.action_value) {
111
+ metricsRequest.metadata = metricsRequest.metadata || {};
112
+ metricsRequest.metadata.action_value = payload.action_value;
113
+ }
114
+ return request(utils_1.trackApiEndpoint(settings) + '/api/v1/metrics', {
115
+ json: metricsRequest,
116
+ method: 'post'
117
+ });
118
+ }
119
+ };
120
+ exports.default = action;
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/reportDeliveryEvent/index.ts"],"names":[],"mappings":";;AAGA,oCAAkE;AAElE,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,mFAAmF;IAChG,mBAAmB,EAAE,iCAAiC;IACtD,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,yBAAyB;aACnC;YACD,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,qNAAqN;YAClO,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,qBAAqB;aAC/B;YACD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;gBAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,EAAE,KAAK,EAAE,SAAS,EAA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E,MAAM;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAoBD,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ export interface Payload {
2
+ person_id: string;
3
+ }
@@ -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/customerio/suppressPerson/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,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const action = {
5
+ title: 'Suppress Person',
6
+ description: `Suppress a person in Customer.io. This will prevent the person from receiving any messages.`,
7
+ defaultSubscription: 'event = "User Suppressed"',
8
+ fields: {
9
+ person_id: {
10
+ label: 'Person ID',
11
+ description: 'The ID used to uniquely identify a person in Customer.io. Any valid identifier is supported, such as ID, cio_id, email, etc. Anonymous users cannot be suppressed. [Learn more](https://customer.io/docs/identifying-people/#identifiers).',
12
+ type: 'string',
13
+ default: {
14
+ '@if': {
15
+ exists: { '@path': '$.userId' },
16
+ then: { '@path': '$.userId' },
17
+ else: { '@path': '$.traits.email' }
18
+ }
19
+ },
20
+ required: true
21
+ }
22
+ },
23
+ performBatch: (request, { payload: payloads, settings }) => {
24
+ return utils_1.sendBatch(request, payloads.map((payload) => ({
25
+ action: 'suppress',
26
+ payload,
27
+ settings,
28
+ type: 'person'
29
+ })));
30
+ },
31
+ perform: (request, { payload, settings }) => {
32
+ return utils_1.sendSingle(request, {
33
+ action: 'suppress',
34
+ payload,
35
+ settings,
36
+ type: 'person'
37
+ });
38
+ }
39
+ };
40
+ exports.default = action;
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/customerio/suppressPerson/index.ts"],"names":[],"mappings":";;AAGA,oCAAgD;AAEhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,6FAA6F;IAC1G,mBAAmB,EAAE,2BAA2B;IAChD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EACT,4OAA4O;YAC9O,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;YACD,QAAQ,EAAE,IAAI;SACf;KACF;IAED,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzD,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC,CACJ,CAAA;IACH,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,kBAAU,CAAC,OAAO,EAAE;YACzB,MAAM,EAAE,UAAU;YAClB,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="lodash" />
2
+ import nock from 'nock';
3
+ import { AccountRegion } from './utils';
4
+ export declare const nockTrackInternalEndpoint: (region: AccountRegion) => nock.Scope;
5
+ export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/src/destination-kit/types").FieldValue | undefined>;
6
+ export declare function testRunner(fn: Function): void;
@@ -0,0 +1,84 @@
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.testRunner = exports.getDefaultMappings = exports.nockTrackInternalEndpoint = void 0;
7
+ const nock_1 = __importDefault(require("nock"));
8
+ const mapValues_1 = __importDefault(require("lodash/mapValues"));
9
+ const actions_core_1 = require("@segment/actions-core");
10
+ const index_1 = __importDefault(require("./index"));
11
+ const utils_1 = require("./utils");
12
+ const testDestination = actions_core_1.createTestIntegration(index_1.default);
13
+ var EndpointType;
14
+ (function (EndpointType) {
15
+ EndpointType["BATCH"] = "batch";
16
+ EndpointType["SINGLE"] = "entity";
17
+ })(EndpointType || (EndpointType = {}));
18
+ const endpointByType = {
19
+ [EndpointType.BATCH]: 'batch',
20
+ [EndpointType.SINGLE]: 'entity'
21
+ };
22
+ const trackServiceByRegion = {
23
+ [utils_1.AccountRegion.US]: nock_1.default('https://track.customer.io'),
24
+ [utils_1.AccountRegion.EU]: nock_1.default('https://track-eu.customer.io')
25
+ };
26
+ function wrapFn(fn, type, region) {
27
+ return () => {
28
+ const settings = {
29
+ siteId: '12345',
30
+ apiKey: 'abcde',
31
+ accountRegion: region
32
+ };
33
+ const action = async (name, args) => {
34
+ const actionFn = {
35
+ [EndpointType.BATCH]: testDestination.testBatchAction,
36
+ [EndpointType.SINGLE]: testDestination.testAction
37
+ }[type];
38
+ if (type === EndpointType.BATCH) {
39
+ args.events = [args.event];
40
+ }
41
+ const responses = (await actionFn?.call(testDestination, name, args));
42
+ if (!responses.length) {
43
+ if (type === EndpointType.BATCH) {
44
+ await testDestination.testAction(name, args);
45
+ }
46
+ throw new Error(`No responses received.`);
47
+ }
48
+ expect(responses.length).toBe(1);
49
+ expect(responses[0].status).toBe(200);
50
+ expect(responses[0].headers.toJSON()).toMatchObject({
51
+ 'content-type': 'application/json'
52
+ });
53
+ expect(responses[0].data).toMatchObject({});
54
+ if (type === EndpointType.BATCH) {
55
+ return responses[0].options.json.batch[0];
56
+ }
57
+ return responses[0].options.json;
58
+ };
59
+ return fn(settings, action);
60
+ };
61
+ }
62
+ const nockTrackInternalEndpoint = (region) => trackServiceByRegion[region];
63
+ exports.nockTrackInternalEndpoint = nockTrackInternalEndpoint;
64
+ function getDefaultMappings(action) {
65
+ const fields = testDestination.definition.actions[action].fields;
66
+ const defaultMappings = mapValues_1.default(fields, 'default');
67
+ return defaultMappings;
68
+ }
69
+ exports.getDefaultMappings = getDefaultMappings;
70
+ function testRunner(fn) {
71
+ describe.each(Object.values(endpointByType))(`when using %s requests`, (type) => {
72
+ describe.each(Object.values(utils_1.AccountRegion))(`when using the %s region`, (region) => {
73
+ beforeEach(() => {
74
+ trackServiceByRegion[region].post(`/api/v2/${type}`).reply(200, {});
75
+ });
76
+ afterEach(() => {
77
+ nock_1.default.cleanAll();
78
+ });
79
+ return wrapFn(fn, type, region)();
80
+ });
81
+ });
82
+ }
83
+ exports.testRunner = testRunner;
84
+ //# sourceMappingURL=test-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../src/destinations/customerio/test-helper.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,iEAAwC;AACxC,wDAAgF;AAChF,oDAAgC;AAEhC,mCAAuC;AAEvC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAU,CAAC,CAAA;AAEzD,IAAK,YAGJ;AAHD,WAAK,YAAY;IACf,+BAAe,CAAA;IACf,iCAAiB,CAAA;AACnB,CAAC,EAHI,YAAY,KAAZ,YAAY,QAGhB;AACD,MAAM,cAAc,GAAG;IACrB,CAAC,YAAY,CAAC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,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,EAAE;YACjF,UAAU,CAAC,GAAG,EAAE;gBACd,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACrE,CAAC,CAAC,CAAA;YAEF,SAAS,CAAC,GAAG,EAAE;gBACb,cAAI,CAAC,QAAQ,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;YAEF,OAAO,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAdD,gCAcC"}
@@ -4,7 +4,18 @@ const utils_1 = require("../utils");
4
4
  const action = {
5
5
  title: 'Track Event',
6
6
  description: 'Track an event for a known or anonymous person.',
7
- defaultSubscription: 'type = "track"',
7
+ defaultSubscription: `
8
+ type = "track"
9
+ and event != "Application Installed"
10
+ and event != "Application Opened"
11
+ and event != "Application Uninstalled"
12
+ and event != "Relationship Deleted"
13
+ and event != "User Deleted"
14
+ and event != "User Suppressed"
15
+ and event != "User Unsuppressed"
16
+ and event != "Group Deleted"
17
+ and event != "Report Delivery Event"
18
+ `,
8
19
  fields: {
9
20
  id: {
10
21
  label: 'Person ID',
@@ -62,38 +73,21 @@ const action = {
62
73
  default: true
63
74
  }
64
75
  },
65
- perform: (request, { settings, payload }) => {
66
- let timestamp = payload.timestamp;
67
- let data = payload.data;
68
- if (payload.convert_timestamp !== false) {
69
- if (timestamp) {
70
- timestamp = utils_1.convertValidTimestamp(timestamp);
71
- }
72
- if (data) {
73
- data = utils_1.convertAttributeTimestamps(data);
74
- }
75
- }
76
- const body = {
77
- name: payload.name,
78
- data,
79
- timestamp
80
- };
81
- if (payload.event_id) {
82
- body.id = payload.event_id;
83
- }
84
- let url;
85
- if (payload.id) {
86
- url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/customers/${payload.id}/events`;
87
- }
88
- else {
89
- url = `${utils_1.trackApiEndpoint(settings.accountRegion)}/api/v1/events`;
90
- body.anonymous_id = payload.anonymous_id;
91
- }
92
- return request(url, {
93
- method: 'post',
94
- json: body
95
- });
76
+ performBatch: (request, { payload: payloads, settings }) => {
77
+ return utils_1.sendBatch(request, payloads.map((payload) => ({ action: 'event', payload: mapPayload(payload), settings, type: 'person' })));
78
+ },
79
+ perform: (request, { payload, settings }) => {
80
+ return utils_1.sendSingle(request, { action: 'event', payload: mapPayload(payload), settings, type: 'person' });
96
81
  }
97
82
  };
83
+ function mapPayload(payload) {
84
+ const { id, event_id, data, ...rest } = payload;
85
+ return {
86
+ ...rest,
87
+ person_id: id,
88
+ id: event_id,
89
+ attributes: data
90
+ };
91
+ }
98
92
  exports.default = action;
99
93
  //# sourceMappingURL=index.js.map