@segment/action-destinations 3.438.0 → 3.440.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 (134) hide show
  1. package/dist/destinations/aws-kinesis/generated-types.d.ts +2 -0
  2. package/dist/destinations/aws-kinesis/generated-types.js.map +1 -0
  3. package/dist/destinations/aws-kinesis/index.d.ts +4 -0
  4. package/dist/destinations/aws-kinesis/index.js +24 -0
  5. package/dist/destinations/aws-kinesis/index.js.map +1 -0
  6. package/dist/destinations/aws-kinesis/send/generated-types.d.ts +8 -0
  7. package/dist/destinations/aws-kinesis/send/generated-types.js.map +1 -0
  8. package/dist/destinations/{yonoma/sendEvent → aws-kinesis/send}/index.d.ts +1 -1
  9. package/dist/destinations/aws-kinesis/send/index.js +41 -0
  10. package/dist/destinations/aws-kinesis/send/index.js.map +1 -0
  11. package/dist/destinations/criteo-audiences/addUserToAudience/generated-types.d.ts +1 -0
  12. package/dist/destinations/criteo-audiences/addUserToAudience/index.js +7 -0
  13. package/dist/destinations/criteo-audiences/addUserToAudience/index.js.map +1 -1
  14. package/dist/destinations/criteo-audiences/removeUserFromAudience/generated-types.d.ts +1 -0
  15. package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js +7 -0
  16. package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js.map +1 -1
  17. package/dist/destinations/first-party-dv360/index.js +1 -1
  18. package/dist/destinations/first-party-dv360/index.js.map +1 -1
  19. package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
  20. package/dist/destinations/google-enhanced-conversions/functions.js +1 -1
  21. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
  22. package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js +2 -2
  23. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +2 -2
  24. package/dist/destinations/google-enhanced-conversions/uploadClickConversion2/index.js +2 -2
  25. package/dist/destinations/google-enhanced-conversions/userList/index.js +3 -3
  26. package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
  27. package/dist/destinations/linkedin-audiences/{api/index.d.ts → api.d.ts} +3 -3
  28. package/dist/destinations/linkedin-audiences/{api/index.js → api.js} +2 -2
  29. package/dist/destinations/linkedin-audiences/api.js.map +1 -0
  30. package/dist/destinations/linkedin-audiences/updateAudience/fields.d.ts +2 -0
  31. package/dist/destinations/linkedin-audiences/updateAudience/fields.js +126 -0
  32. package/dist/destinations/linkedin-audiences/updateAudience/fields.js.map +1 -0
  33. package/dist/destinations/linkedin-audiences/updateAudience/functions.d.ts +5 -0
  34. package/dist/destinations/linkedin-audiences/updateAudience/functions.js +112 -0
  35. package/dist/destinations/linkedin-audiences/updateAudience/functions.js.map +1 -0
  36. package/dist/destinations/linkedin-audiences/updateAudience/index.js +5 -232
  37. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
  38. package/dist/destinations/ms-bing-ads-audiences/index.js +1 -1
  39. package/dist/destinations/ms-bing-ads-audiences/index.js.map +1 -1
  40. package/dist/destinations/ms-bing-ads-audiences/syncAudiences/fields.js +13 -17
  41. package/dist/destinations/ms-bing-ads-audiences/syncAudiences/fields.js.map +1 -1
  42. package/dist/destinations/snap-audiences/constants.d.ts +2 -0
  43. package/dist/destinations/snap-audiences/constants.js +6 -0
  44. package/dist/destinations/snap-audiences/constants.js.map +1 -0
  45. package/dist/destinations/snap-audiences/index.js +24 -40
  46. package/dist/destinations/snap-audiences/index.js.map +1 -1
  47. package/dist/destinations/snap-audiences/syncAudience/constants.d.ts +5 -0
  48. package/dist/destinations/snap-audiences/syncAudience/constants.js +9 -0
  49. package/dist/destinations/snap-audiences/syncAudience/constants.js.map +1 -0
  50. package/dist/destinations/snap-audiences/syncAudience/fields.d.ts +2 -0
  51. package/dist/destinations/snap-audiences/syncAudience/fields.js +90 -0
  52. package/dist/destinations/snap-audiences/syncAudience/fields.js.map +1 -0
  53. package/dist/destinations/snap-audiences/syncAudience/functions.d.ts +5 -0
  54. package/dist/destinations/snap-audiences/syncAudience/functions.js +119 -0
  55. package/dist/destinations/snap-audiences/syncAudience/functions.js.map +1 -0
  56. package/dist/destinations/snap-audiences/syncAudience/generated-types.d.ts +2 -1
  57. package/dist/destinations/snap-audiences/syncAudience/index.js +6 -146
  58. package/dist/destinations/snap-audiences/syncAudience/index.js.map +1 -1
  59. package/dist/destinations/snap-audiences/syncAudience/types.d.ts +18 -0
  60. package/dist/destinations/snap-audiences/syncAudience/types.js.map +1 -0
  61. package/dist/destinations/snap-audiences/types.d.ts +19 -0
  62. package/dist/destinations/snap-audiences/types.js.map +1 -0
  63. package/dist/destinations/stackadapt-audiences/common-constants.d.ts +2 -0
  64. package/dist/destinations/stackadapt-audiences/common-constants.js +6 -0
  65. package/dist/destinations/stackadapt-audiences/common-constants.js.map +1 -0
  66. package/dist/destinations/stackadapt-audiences/common-functions.d.ts +0 -7
  67. package/dist/destinations/stackadapt-audiences/common-functions.js +0 -193
  68. package/dist/destinations/stackadapt-audiences/common-functions.js.map +1 -1
  69. package/dist/destinations/stackadapt-audiences/common-types.d.ts +15 -0
  70. package/dist/destinations/stackadapt-audiences/common-types.js +3 -0
  71. package/dist/destinations/stackadapt-audiences/common-types.js.map +1 -0
  72. package/dist/destinations/stackadapt-audiences/{constants.js → forwardAudienceEvent/constants.js} +1 -22
  73. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/constants.js.map +1 -0
  74. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.d.ts +1 -0
  75. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js +184 -1
  76. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js.map +1 -1
  77. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.d.ts +6 -0
  78. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +184 -0
  79. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +1 -0
  80. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/generated-types.d.ts +0 -3
  81. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js +4 -5
  82. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js.map +1 -1
  83. package/dist/destinations/stackadapt-audiences/{types.d.ts → forwardAudienceEvent/types.d.ts} +0 -15
  84. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/types.js +3 -0
  85. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/types.js.map +1 -0
  86. package/dist/destinations/stackadapt-audiences/index.d.ts +1 -1
  87. package/dist/destinations/stackadapt-audiences/index.js +5 -7
  88. package/dist/destinations/stackadapt-audiences/index.js.map +1 -1
  89. package/dist/destinations/yonoma/index.js +0 -2
  90. package/dist/destinations/yonoma/index.js.map +1 -1
  91. package/dist/destinations/yonoma/trackEvent/generated-types.d.ts +24 -3
  92. package/dist/destinations/yonoma/trackEvent/index.js +140 -16
  93. package/dist/destinations/yonoma/trackEvent/index.js.map +1 -1
  94. package/dist/destinations/yonoma/trackEvent/types.d.ts +24 -3
  95. package/dist/destinations/yonoma/trackPageView/generated-types.d.ts +23 -7
  96. package/dist/destinations/yonoma/trackPageView/index.js +133 -50
  97. package/dist/destinations/yonoma/trackPageView/index.js.map +1 -1
  98. package/dist/destinations/yonoma/trackPageView/types.d.ts +22 -4
  99. package/dist/destinations/yonoma/upsertContact/generated-types.d.ts +25 -3
  100. package/dist/destinations/yonoma/upsertContact/index.js +153 -21
  101. package/dist/destinations/yonoma/upsertContact/index.js.map +1 -1
  102. package/dist/destinations/yonoma/upsertContact/types.d.ts +26 -4
  103. package/package.json +2 -2
  104. package/dist/destinations/linkedin-audiences/api/index.js.map +0 -1
  105. package/dist/destinations/snap-audiences/syncAudience/utils.d.ts +0 -8
  106. package/dist/destinations/snap-audiences/syncAudience/utils.js +0 -61
  107. package/dist/destinations/snap-audiences/syncAudience/utils.js.map +0 -1
  108. package/dist/destinations/stackadapt-audiences/common-fields.d.ts +0 -2
  109. package/dist/destinations/stackadapt-audiences/common-fields.js +0 -227
  110. package/dist/destinations/stackadapt-audiences/common-fields.js.map +0 -1
  111. package/dist/destinations/stackadapt-audiences/constants.js.map +0 -1
  112. package/dist/destinations/stackadapt-audiences/forwardProfile/generated-types.d.ts +0 -26
  113. package/dist/destinations/stackadapt-audiences/forwardProfile/generated-types.js.map +0 -1
  114. package/dist/destinations/stackadapt-audiences/forwardProfile/index.d.ts +0 -5
  115. package/dist/destinations/stackadapt-audiences/forwardProfile/index.js +0 -140
  116. package/dist/destinations/stackadapt-audiences/forwardProfile/index.js.map +0 -1
  117. package/dist/destinations/stackadapt-audiences/types.js.map +0 -1
  118. package/dist/destinations/yonoma/sendEvent/constants.d.ts +0 -1
  119. package/dist/destinations/yonoma/sendEvent/constants.js +0 -5
  120. package/dist/destinations/yonoma/sendEvent/constants.js.map +0 -1
  121. package/dist/destinations/yonoma/sendEvent/functions.d.ts +0 -1
  122. package/dist/destinations/yonoma/sendEvent/functions.js +0 -19
  123. package/dist/destinations/yonoma/sendEvent/functions.js.map +0 -1
  124. package/dist/destinations/yonoma/sendEvent/generated-types.d.ts +0 -13
  125. package/dist/destinations/yonoma/sendEvent/generated-types.js.map +0 -1
  126. package/dist/destinations/yonoma/sendEvent/index.js +0 -103
  127. package/dist/destinations/yonoma/sendEvent/index.js.map +0 -1
  128. package/dist/destinations/yonoma/sendEvent/types.d.ts +0 -10
  129. package/dist/destinations/yonoma/sendEvent/types.js.map +0 -1
  130. /package/dist/destinations/{stackadapt-audiences/forwardProfile → aws-kinesis}/generated-types.js +0 -0
  131. /package/dist/destinations/{yonoma/sendEvent → aws-kinesis/send}/generated-types.js +0 -0
  132. /package/dist/destinations/{stackadapt-audiences → snap-audiences/syncAudience}/types.js +0 -0
  133. /package/dist/destinations/{yonoma/sendEvent → snap-audiences}/types.js +0 -0
  134. /package/dist/destinations/stackadapt-audiences/{constants.d.ts → forwardAudienceEvent/constants.d.ts} +0 -0
@@ -1,11 +1,32 @@
1
1
  export interface TrackEventJSON {
2
2
  event: string;
3
- userId?: string;
3
+ userId: string;
4
4
  anonymousId?: string;
5
- email?: string;
5
+ email: string;
6
6
  listId: string;
7
+ timestamp?: string;
8
+ ip?: string;
9
+ userAgent?: string;
10
+ page?: {
11
+ url?: string;
12
+ title?: string;
13
+ referrer?: string;
14
+ path?: string;
15
+ search?: string;
16
+ };
17
+ campaign?: {
18
+ name?: string;
19
+ source?: string;
20
+ medium?: string;
21
+ term?: string;
22
+ content?: string;
23
+ };
24
+ location?: {
25
+ country?: string;
26
+ region?: string;
27
+ city?: string;
28
+ };
7
29
  properties?: {
8
30
  [key: string]: unknown;
9
31
  };
10
- timestamp?: string | number;
11
32
  }
@@ -1,17 +1,33 @@
1
1
  export interface Payload {
2
- pageDetails: {
3
- title?: string;
4
- url: string;
5
- referrer?: string;
6
- };
7
- identifiers: {
2
+ identifiers?: {
8
3
  userId?: string;
9
4
  anonymousId?: string;
10
5
  email?: string;
11
6
  };
12
7
  listId: string;
8
+ timestamp?: string;
9
+ ip?: string;
10
+ userAgent?: string;
11
+ page?: {
12
+ url?: string;
13
+ title?: string;
14
+ referrer?: string;
15
+ path?: string;
16
+ search?: string;
17
+ };
18
+ campaign?: {
19
+ name?: string;
20
+ source?: string;
21
+ medium?: string;
22
+ term?: string;
23
+ content?: string;
24
+ };
25
+ location?: {
26
+ country?: string;
27
+ region?: string;
28
+ city?: string;
29
+ };
13
30
  properties?: {
14
31
  [k: string]: unknown;
15
32
  };
16
- timestamp?: string;
17
33
  }
@@ -1,46 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
3
  const constants_1 = require("./constants");
5
4
  const action = {
6
5
  title: 'Track Page View',
7
6
  description: 'Log page visits to build behavioral profiles and trigger view-based automations in Yonoma.',
8
7
  defaultSubscription: 'type = "page"',
9
8
  fields: {
10
- pageDetails: {
11
- label: 'Page Details',
12
- type: 'object',
13
- description: 'The details of the page being viewed.',
14
- required: true,
15
- properties: {
16
- title: {
17
- label: 'Page Title',
18
- type: 'string',
19
- description: 'Title of the page.'
20
- },
21
- url: {
22
- label: 'Page URL',
23
- type: 'string',
24
- description: 'Full URL of the page visited.',
25
- required: true
26
- },
27
- referrer: {
28
- label: 'Referrer URL',
29
- type: 'string',
30
- description: 'URL of the referring page.'
31
- }
32
- },
33
- default: {
34
- title: { '@path': '$.context.page.title' },
35
- url: { '@path': '$.context.page.url' },
36
- referrer: { '@path': '$.context.page.referrer' }
37
- }
38
- },
39
9
  identifiers: {
40
10
  label: 'Identifiers',
41
11
  type: 'object',
42
- description: 'Unique identifiers for the contact. At least one of userId or anonymousId is required.',
43
- required: true,
12
+ description: 'Unique identifiers for the contact.',
44
13
  additionalProperties: false,
45
14
  properties: {
46
15
  userId: {
@@ -56,7 +25,7 @@ const action = {
56
25
  email: {
57
26
  label: 'Email',
58
27
  type: 'string',
59
- description: "Contact's email address. Required if userId is not provided."
28
+ description: "Contact's email address."
60
29
  }
61
30
  },
62
31
  default: {
@@ -84,39 +53,153 @@ const action = {
84
53
  }
85
54
  }
86
55
  },
87
- properties: {
88
- label: 'Event Properties',
89
- type: 'object',
90
- description: 'Additional properties associated with the event.',
91
- required: false,
92
- defaultObjectUI: 'keyvalue',
93
- default: { '@path': '$.properties' }
94
- },
95
56
  timestamp: {
96
57
  label: 'Timestamp',
97
58
  type: 'string',
98
59
  description: 'The timestamp of the event. Defaults to the current time if not provided.',
99
60
  format: 'date-time',
100
61
  default: { '@path': '$.timestamp' }
62
+ },
63
+ ip: {
64
+ label: 'IP Address',
65
+ type: 'string',
66
+ description: 'The IP address of the user. Defaults to the current user IP if not provided.',
67
+ default: { '@path': '$.context.ip' }
68
+ },
69
+ userAgent: {
70
+ label: 'User Agent',
71
+ type: 'string',
72
+ description: 'The user agent of the user.',
73
+ default: { '@path': '$.context.userAgent' }
74
+ },
75
+ page: {
76
+ label: 'Page',
77
+ type: 'object',
78
+ description: 'The details of the page being viewed.',
79
+ properties: {
80
+ url: {
81
+ label: 'Page URL',
82
+ type: 'string',
83
+ description: 'Full URL of the page visited.'
84
+ },
85
+ title: {
86
+ label: 'Page Title',
87
+ type: 'string',
88
+ description: 'Title of the page.'
89
+ },
90
+ referrer: {
91
+ label: 'Referrer URL',
92
+ type: 'string',
93
+ description: 'URL of the referring page.'
94
+ },
95
+ path: {
96
+ label: 'Page Path',
97
+ type: 'string',
98
+ description: 'Path of the page being viewed.'
99
+ },
100
+ search: {
101
+ label: 'Search Query',
102
+ type: 'string',
103
+ description: 'Search query used to find the page.'
104
+ }
105
+ },
106
+ default: {
107
+ title: { '@path': '$.context.page.title' },
108
+ url: { '@path': '$.context.page.url' },
109
+ referrer: { '@path': '$.context.page.referrer' },
110
+ path: { '@path': '$.context.page.path' },
111
+ search: { '@path': '$.context.page.search' }
112
+ }
113
+ },
114
+ campaign: {
115
+ label: 'Campaign',
116
+ type: 'object',
117
+ description: 'The marketing campaign that referred the user to the site.',
118
+ properties: {
119
+ name: {
120
+ label: 'UTM Campaign Name',
121
+ type: 'string',
122
+ description: 'Name of the campaign.'
123
+ },
124
+ source: {
125
+ label: 'UTM Campaign Source',
126
+ type: 'string',
127
+ description: 'Source of the campaign UTM parameter.'
128
+ },
129
+ medium: {
130
+ label: 'UTM Campaign Medium',
131
+ type: 'string',
132
+ description: 'Medium of the campaign UTM parameter.'
133
+ },
134
+ term: {
135
+ label: 'UTM Campaign Term',
136
+ type: 'string',
137
+ description: 'Term or keyword of the campaign UTM parameter.'
138
+ },
139
+ content: {
140
+ label: 'UTM Campaign Content',
141
+ type: 'string',
142
+ description: 'Content of the campaign UTM parameter.'
143
+ }
144
+ },
145
+ default: {
146
+ name: { '@path': '$.context.campaign.name' },
147
+ source: { '@path': '$.context.campaign.source' },
148
+ medium: { '@path': '$.context.campaign.medium' },
149
+ term: { '@path': '$.context.campaign.term' },
150
+ content: { '@path': '$.context.campaign.content' }
151
+ }
152
+ },
153
+ location: {
154
+ label: 'Location',
155
+ type: 'object',
156
+ description: 'The geographic location of the user.',
157
+ properties: {
158
+ country: {
159
+ label: 'Country',
160
+ type: 'string',
161
+ description: 'Country of the user.'
162
+ },
163
+ region: {
164
+ label: 'Region/State',
165
+ type: 'string',
166
+ description: 'Region or state of the user.'
167
+ },
168
+ city: {
169
+ label: 'City',
170
+ type: 'string',
171
+ description: 'City of the user.'
172
+ }
173
+ },
174
+ default: {
175
+ country: { '@path': '$.context.location.country' },
176
+ region: { '@path': '$.context.location.region' },
177
+ city: { '@path': '$.context.location.city' }
178
+ }
179
+ },
180
+ properties: {
181
+ label: 'Additional Page Properties',
182
+ type: 'object',
183
+ description: 'Additional properties associated with the event.',
184
+ defaultObjectUI: 'keyvalue'
101
185
  }
102
186
  },
103
187
  perform: async (request, { payload }) => {
104
- const { pageDetails: { title, url, referrer } = {}, listId, properties, identifiers: { userId, email, anonymousId } = {}, timestamp } = payload;
105
- if (!userId && !email && !anonymousId) {
106
- throw new actions_core_1.PayloadValidationError('At least one identifier (userId, email, or anonymousId) is required.');
107
- }
188
+ const { identifiers: { userId, email, anonymousId } = {}, listId, timestamp, ip, userAgent, page, campaign, location, properties } = payload;
108
189
  delete properties?.email;
109
190
  delete properties?.list_id;
110
191
  const json = {
111
- url: url,
112
- ...(referrer ? { referrer } : {}),
113
- ...(title ? { title } : {}),
114
192
  ...(userId ? { userId } : {}),
115
193
  ...(anonymousId ? { anonymousId } : {}),
116
194
  ...(email ? { email } : {}),
117
195
  listId,
118
- properties,
119
- timestamp
196
+ timestamp,
197
+ ip,
198
+ userAgent,
199
+ page,
200
+ campaign,
201
+ location,
202
+ properties
120
203
  };
121
204
  return await request(constants_1.TRACK_PAGE_VIEW_URL, {
122
205
  method: 'POST',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yonoma/trackPageView/index.ts"],"names":[],"mappings":";;AAAA,wDAAgF;AAIhF,2CAAiD;AAEjD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;I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J,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,13 +1,31 @@
1
1
  export interface TrackPageEventJSON {
2
- url: string;
3
- title?: string;
4
- referrer?: string;
5
2
  userId?: string;
6
3
  anonymousId?: string;
7
4
  email?: string;
8
5
  listId: string;
6
+ timestamp?: string;
7
+ ip?: string;
8
+ userAgent?: string;
9
+ page?: {
10
+ url?: string;
11
+ title?: string;
12
+ referrer?: string;
13
+ path?: string;
14
+ search?: string;
15
+ };
16
+ campaign?: {
17
+ name?: string;
18
+ source?: string;
19
+ medium?: string;
20
+ term?: string;
21
+ content?: string;
22
+ };
23
+ location?: {
24
+ country?: string;
25
+ region?: string;
26
+ city?: string;
27
+ };
9
28
  properties?: {
10
29
  [key: string]: unknown;
11
30
  };
12
- timestamp?: string | number;
13
31
  }
@@ -1,10 +1,33 @@
1
1
  export interface Payload {
2
2
  identifiers: {
3
- userId?: string;
3
+ userId: string;
4
4
  anonymousId?: string;
5
- email?: string;
5
+ email: string;
6
6
  };
7
7
  listId: string;
8
+ status: boolean;
9
+ timestamp?: string;
10
+ ip?: string;
11
+ userAgent?: string;
12
+ page?: {
13
+ url?: string;
14
+ title?: string;
15
+ referrer?: string;
16
+ path?: string;
17
+ search?: string;
18
+ };
19
+ campaign?: {
20
+ name?: string;
21
+ source?: string;
22
+ medium?: string;
23
+ term?: string;
24
+ content?: string;
25
+ };
26
+ location?: {
27
+ country?: string;
28
+ region?: string;
29
+ city?: string;
30
+ };
8
31
  properties?: {
9
32
  firstName?: string;
10
33
  lastName?: string;
@@ -16,7 +39,6 @@ export interface Payload {
16
39
  country?: string;
17
40
  zipcode?: string;
18
41
  };
19
- status: boolean;
20
42
  tags_to_add?: string[];
21
43
  tags_to_remove?: string[];
22
44
  }
@@ -11,14 +11,15 @@ const action = {
11
11
  identifiers: {
12
12
  label: 'Identifiers',
13
13
  type: 'object',
14
- description: 'Unique identifiers for the contact. At least one of userId or anonymousId is required.',
14
+ description: 'Unique identifiers for the contact. User ID and email are required. Anonymous ID is optional.',
15
15
  required: true,
16
16
  additionalProperties: false,
17
17
  properties: {
18
18
  userId: {
19
19
  label: 'User ID',
20
20
  type: 'string',
21
- description: 'Unique user identifier from your app.'
21
+ description: 'Unique user identifier from your app.',
22
+ required: true
22
23
  },
23
24
  anonymousId: {
24
25
  label: 'Anonymous ID',
@@ -28,7 +29,8 @@ const action = {
28
29
  email: {
29
30
  label: 'Email',
30
31
  type: 'string',
31
- description: "Contact's email address. Required if userId is not provided."
32
+ description: "Contact's email address.",
33
+ required: true
32
34
  }
33
35
  },
34
36
  default: {
@@ -44,6 +46,137 @@ const action = {
44
46
  required: true,
45
47
  default: { '@path': '$.traits.list_id' }
46
48
  },
49
+ status: {
50
+ label: 'Email subscription status',
51
+ type: 'boolean',
52
+ description: 'Indicates if the Contact is subscribed or unsubscribed from marketing emails. Set to true to subscribe, false to unsubscribe.',
53
+ required: true,
54
+ default: true
55
+ },
56
+ timestamp: {
57
+ label: 'Timestamp',
58
+ type: 'string',
59
+ description: 'The timestamp of the event. Defaults to the current time if not provided.',
60
+ format: 'date-time',
61
+ default: { '@path': '$.timestamp' }
62
+ },
63
+ ip: {
64
+ label: 'IP Address',
65
+ type: 'string',
66
+ description: 'The IP address of the user. Defaults to the current user IP if not provided.',
67
+ default: { '@path': '$.context.ip' }
68
+ },
69
+ userAgent: {
70
+ label: 'User Agent',
71
+ type: 'string',
72
+ description: 'The user agent of the user.',
73
+ default: { '@path': '$.context.userAgent' }
74
+ },
75
+ page: {
76
+ label: 'Page',
77
+ type: 'object',
78
+ description: 'The details of the page being viewed.',
79
+ properties: {
80
+ url: {
81
+ label: 'Page URL',
82
+ type: 'string',
83
+ description: 'Full URL of the page visited.'
84
+ },
85
+ title: {
86
+ label: 'Page Title',
87
+ type: 'string',
88
+ description: 'Title of the page.'
89
+ },
90
+ referrer: {
91
+ label: 'Referrer URL',
92
+ type: 'string',
93
+ description: 'URL of the referring page.'
94
+ },
95
+ path: {
96
+ label: 'Page Path',
97
+ type: 'string',
98
+ description: 'Path of the page being viewed.'
99
+ },
100
+ search: {
101
+ label: 'Search Query',
102
+ type: 'string',
103
+ description: 'Search query used to find the page.'
104
+ }
105
+ },
106
+ default: {
107
+ title: { '@path': '$.context.page.title' },
108
+ url: { '@path': '$.context.page.url' },
109
+ referrer: { '@path': '$.context.page.referrer' },
110
+ path: { '@path': '$.context.page.path' },
111
+ search: { '@path': '$.context.page.search' }
112
+ }
113
+ },
114
+ campaign: {
115
+ label: 'Campaign',
116
+ type: 'object',
117
+ description: 'The marketing campaign that referred the user to the site.',
118
+ properties: {
119
+ name: {
120
+ label: 'UTM Campaign Name',
121
+ type: 'string',
122
+ description: 'Name of the campaign.'
123
+ },
124
+ source: {
125
+ label: 'UTM Campaign Source',
126
+ type: 'string',
127
+ description: 'Source of the campaign UTM parameter.'
128
+ },
129
+ medium: {
130
+ label: 'UTM Campaign Medium',
131
+ type: 'string',
132
+ description: 'Medium of the campaign UTM parameter.'
133
+ },
134
+ term: {
135
+ label: 'UTM Campaign Term',
136
+ type: 'string',
137
+ description: 'Term or keyword of the campaign UTM parameter.'
138
+ },
139
+ content: {
140
+ label: 'UTM Campaign Content',
141
+ type: 'string',
142
+ description: 'Content of the campaign UTM parameter.'
143
+ }
144
+ },
145
+ default: {
146
+ name: { '@path': '$.context.campaign.name' },
147
+ source: { '@path': '$.context.campaign.source' },
148
+ medium: { '@path': '$.context.campaign.medium' },
149
+ term: { '@path': '$.context.campaign.term' },
150
+ content: { '@path': '$.context.campaign.content' }
151
+ }
152
+ },
153
+ location: {
154
+ label: 'Location',
155
+ type: 'object',
156
+ description: 'The geographic location of the user.',
157
+ properties: {
158
+ country: {
159
+ label: 'Country',
160
+ type: 'string',
161
+ description: 'Country of the user.'
162
+ },
163
+ region: {
164
+ label: 'Region/State',
165
+ type: 'string',
166
+ description: 'Region or state of the user.'
167
+ },
168
+ city: {
169
+ label: 'City',
170
+ type: 'string',
171
+ description: 'City of the user.'
172
+ }
173
+ },
174
+ default: {
175
+ country: { '@path': '$.context.location.country' },
176
+ region: { '@path': '$.context.location.region' },
177
+ city: { '@path': '$.context.location.city' }
178
+ }
179
+ },
47
180
  properties: {
48
181
  label: 'Contact Properties',
49
182
  type: 'object',
@@ -110,13 +243,6 @@ const action = {
110
243
  zipcode: { '@path': '$.traits.address.postal_code' }
111
244
  }
112
245
  },
113
- status: {
114
- label: 'Email subscription status',
115
- type: 'boolean',
116
- description: 'Indicates if the Contact is subscribed or unsubscribed from marketing emails. Set to true to subscribe, false to unsubscribe.',
117
- required: true,
118
- default: true
119
- },
120
246
  tags_to_add: {
121
247
  label: 'Tags to Add',
122
248
  type: 'string',
@@ -135,16 +261,22 @@ const action = {
135
261
  }
136
262
  },
137
263
  perform: async (request, { payload }) => {
138
- const { listId, properties: { firstName, lastName, phone, dateOfBirth, address, city, state, country, zipcode } = {}, status, tags_to_add, tags_to_remove, identifiers: { userId, email, anonymousId } = {} } = payload;
264
+ const { identifiers: { userId, email }, identifiers: { anonymousId } = {}, listId, status, ip, timestamp, userAgent, page, campaign, location, properties: { firstName, lastName, phone, dateOfBirth, address, city, state, country, zipcode } = {}, tags_to_add, tags_to_remove } = payload;
139
265
  if (!userId && !email && !anonymousId) {
140
266
  throw new actions_core_1.PayloadValidationError('At least one identifier (userId, email, or anonymousId) is required.');
141
267
  }
142
268
  const jsonUpsertContact = {
143
- ...(userId ? { userId } : {}),
269
+ userId,
144
270
  ...(anonymousId ? { anonymousId } : {}),
145
- ...(email ? { email } : {}),
271
+ email,
146
272
  listId,
147
- ...(typeof status === 'boolean' ? { status } : {}),
273
+ status,
274
+ timestamp,
275
+ ip,
276
+ userAgent,
277
+ page,
278
+ campaign,
279
+ location,
148
280
  properties: {
149
281
  ...(firstName ? { firstName } : {}),
150
282
  ...(lastName ? { lastName } : {}),
@@ -154,15 +286,15 @@ const action = {
154
286
  ...(city ? { city } : {}),
155
287
  ...(state ? { state } : {}),
156
288
  ...(country ? { country } : {}),
157
- ...(zipcode ? { zipcode } : {})
289
+ ...(zipcode ? { zipcode } : {}),
290
+ ...((typeof tags_to_add === 'string' || (Array.isArray(tags_to_add) && tags_to_add.length > 0))
291
+ ? { tags_to_add: Array.isArray(tags_to_add) ? tags_to_add : [tags_to_add] }
292
+ : {}),
293
+ ...((typeof tags_to_remove === 'string' || (Array.isArray(tags_to_remove) && tags_to_remove.length > 0))
294
+ ? { tags_to_remove: Array.isArray(tags_to_remove) ? tags_to_remove : [tags_to_remove] }
295
+ : {})
158
296
  }
159
297
  };
160
- if (typeof tags_to_add === 'string' || ((Array.isArray(tags_to_add) && tags_to_add.length > 0))) {
161
- jsonUpsertContact.properties.tags_to_add = Array.isArray(tags_to_add) ? tags_to_add : [tags_to_add];
162
- }
163
- if (typeof tags_to_remove === 'string' || ((Array.isArray(tags_to_remove) && tags_to_remove.length > 0))) {
164
- jsonUpsertContact.properties.tags_to_remove = Array.isArray(tags_to_remove) ? tags_to_remove : [tags_to_remove];
165
- }
166
298
  await request(constants_1.UPSERT_CONTACT_URL, {
167
299
  method: 'POST',
168
300
  json: jsonUpsertContact