@dalmore/api-contracts 0.0.0-dev.c751882 → 0.0.0-dev.c81baa3

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 (105) hide show
  1. package/common/constants.d.ts +43 -0
  2. package/common/constants.js +77 -0
  3. package/common/constants.js.map +1 -0
  4. package/common/helpers/index.d.ts +27 -0
  5. package/common/helpers/index.js +43 -0
  6. package/common/helpers/index.js.map +1 -1
  7. package/common/types/account.types.js +3 -3
  8. package/common/types/account.types.js.map +1 -1
  9. package/common/types/attribution.types.d.ts +582 -0
  10. package/common/types/attribution.types.js +126 -0
  11. package/common/types/attribution.types.js.map +1 -0
  12. package/common/types/auth.types.d.ts +36 -0
  13. package/common/types/auth.types.js +3 -2
  14. package/common/types/auth.types.js.map +1 -1
  15. package/common/types/cap-table.types.d.ts +172 -0
  16. package/common/types/cap-table.types.js +35 -0
  17. package/common/types/cap-table.types.js.map +1 -1
  18. package/common/types/cart.types.d.ts +3 -0
  19. package/common/types/cart.types.js +1 -0
  20. package/common/types/cart.types.js.map +1 -1
  21. package/common/types/common.types.d.ts +14 -4
  22. package/common/types/common.types.js +13 -3
  23. package/common/types/common.types.js.map +1 -1
  24. package/common/types/comply-advantage-api.types.d.ts +12 -12
  25. package/common/types/csv.types.d.ts +3612 -0
  26. package/common/types/csv.types.js +290 -0
  27. package/common/types/csv.types.js.map +1 -0
  28. package/common/types/disbursements.types.d.ts +211 -19
  29. package/common/types/disbursements.types.js +42 -3
  30. package/common/types/disbursements.types.js.map +1 -1
  31. package/common/types/file.types.d.ts +3 -0
  32. package/common/types/file.types.js +3 -0
  33. package/common/types/file.types.js.map +1 -1
  34. package/common/types/index.d.ts +2 -2
  35. package/common/types/index.js +2 -2
  36. package/common/types/index.js.map +1 -1
  37. package/common/types/individuals.types.d.ts +395 -5
  38. package/common/types/individuals.types.js +9 -12
  39. package/common/types/individuals.types.js.map +1 -1
  40. package/common/types/investor-account.types.js +2 -0
  41. package/common/types/investor-account.types.js.map +1 -1
  42. package/common/types/investors-offering.types.d.ts +8 -0
  43. package/common/types/investors-offering.types.js +1 -0
  44. package/common/types/investors-offering.types.js.map +1 -1
  45. package/common/types/invite.types.d.ts +3 -0
  46. package/common/types/invite.types.js +1 -0
  47. package/common/types/invite.types.js.map +1 -1
  48. package/common/types/issuer-offering.types.d.ts +173 -2
  49. package/common/types/issuer-offering.types.js +11 -22
  50. package/common/types/issuer-offering.types.js.map +1 -1
  51. package/common/types/legal-entity.types.d.ts +39 -1
  52. package/common/types/legal-entity.types.js +8 -5
  53. package/common/types/legal-entity.types.js.map +1 -1
  54. package/common/types/mail-template.types.d.ts +4 -4
  55. package/common/types/notification.types.d.ts +1 -0
  56. package/common/types/notification.types.js +3 -0
  57. package/common/types/notification.types.js.map +1 -1
  58. package/common/types/offering-submission.types.js +1 -1
  59. package/common/types/offering.types.d.ts +20 -10
  60. package/common/types/offering.types.js +32 -3
  61. package/common/types/offering.types.js.map +1 -1
  62. package/common/types/payment-methods.types.d.ts +365 -0
  63. package/common/types/payment-methods.types.js +121 -0
  64. package/common/types/payment-methods.types.js.map +1 -1
  65. package/common/types/reports.types.d.ts +12 -12
  66. package/common/types/review.types.js +1 -1
  67. package/common/types/review.types.js.map +1 -1
  68. package/common/types/state-machine.types.d.ts +3 -3
  69. package/common/types/state-machine.types.js +1 -1
  70. package/common/types/state-machine.types.js.map +1 -1
  71. package/common/types/task.types.d.ts +8 -0
  72. package/common/types/task.types.js +3 -0
  73. package/common/types/task.types.js.map +1 -1
  74. package/common/types/trade-line-item.types.d.ts +24 -0
  75. package/common/types/trade-line-item.types.js +3 -0
  76. package/common/types/trade-line-item.types.js.map +1 -1
  77. package/common/types/trade.types.d.ts +11 -14
  78. package/common/types/trade.types.js +16 -7
  79. package/common/types/trade.types.js.map +1 -1
  80. package/common/types/transaction.types.d.ts +24 -1
  81. package/common/types/transaction.types.js +26 -0
  82. package/common/types/transaction.types.js.map +1 -1
  83. package/common/types/user.types.d.ts +6 -112
  84. package/common/types/user.types.js +5 -26
  85. package/common/types/user.types.js.map +1 -1
  86. package/common/types/zapier.types.d.ts +126 -0
  87. package/common/types/zapier.types.js +247 -0
  88. package/common/types/zapier.types.js.map +1 -0
  89. package/contracts/clients/cart/index.d.ts +3 -0
  90. package/contracts/clients/csv/index.d.ts +1988 -0
  91. package/contracts/clients/csv/index.js +96 -0
  92. package/contracts/clients/csv/index.js.map +1 -0
  93. package/contracts/clients/index.d.ts +3934 -1058
  94. package/contracts/clients/index.js +8 -2
  95. package/contracts/clients/index.js.map +1 -1
  96. package/contracts/clients/individuals/index.d.ts +381 -5
  97. package/contracts/clients/legal-entities/index.d.ts +1 -1
  98. package/contracts/clients/offerings/index.d.ts +2 -2
  99. package/contracts/clients/review/index.d.ts +85 -0
  100. package/contracts/clients/review/index.js +27 -0
  101. package/contracts/clients/review/index.js.map +1 -0
  102. package/contracts/clients/webhooks/index.d.ts +506 -0
  103. package/contracts/clients/webhooks/index.js +118 -0
  104. package/contracts/clients/webhooks/index.js.map +1 -0
  105. package/package.json +1 -1
@@ -0,0 +1,582 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * UTM Source enum - Common marketing sources
4
+ */
5
+ export declare enum UtmSource {
6
+ GOOGLE = "GOOGLE",
7
+ FACEBOOK = "FACEBOOK",
8
+ TWITTER = "TWITTER",
9
+ LINKEDIN = "LINKEDIN",
10
+ INSTAGRAM = "INSTAGRAM",
11
+ TIKTOK = "TIKTOK",
12
+ EMAIL = "EMAIL",
13
+ DIRECT = "DIRECT",
14
+ ORGANIC = "ORGANIC",
15
+ REFERRAL = "REFERRAL",
16
+ OTHER = "OTHER"
17
+ }
18
+ /**
19
+ * Zod enum schema for UTM Source
20
+ */
21
+ export declare const UtmSourceZod: z.ZodNativeEnum<typeof UtmSource>;
22
+ /**
23
+ * Attribution Touch Data (from cookie)
24
+ * This represents the raw data structure stored in the cookie
25
+ * Platform click IDs are stored as a record: { "gclid": "abc123", "fbclid": "xyz789", "ttclid": "def456" }
26
+ */
27
+ export declare const AttributionTouchDataSchema: z.ZodObject<{
28
+ utmSource: z.ZodNativeEnum<typeof UtmSource>;
29
+ utmMedium: z.ZodString;
30
+ utmCampaign: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ utmTerm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ utmContent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ gclid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ fbclid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ ttclid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ msclkid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ twclid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ lifatid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ landingPage: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
41
+ documentReferrer: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ utmSource: UtmSource;
44
+ utmMedium: string;
45
+ landingPage?: string | null | undefined;
46
+ utmCampaign?: string | null | undefined;
47
+ utmTerm?: string | null | undefined;
48
+ utmContent?: string | null | undefined;
49
+ gclid?: string | null | undefined;
50
+ fbclid?: string | null | undefined;
51
+ ttclid?: string | null | undefined;
52
+ msclkid?: string | null | undefined;
53
+ twclid?: string | null | undefined;
54
+ lifatid?: string | null | undefined;
55
+ ref?: string | null | undefined;
56
+ documentReferrer?: string | null | undefined;
57
+ }, {
58
+ utmSource: UtmSource;
59
+ utmMedium: string;
60
+ landingPage?: string | null | undefined;
61
+ utmCampaign?: string | null | undefined;
62
+ utmTerm?: string | null | undefined;
63
+ utmContent?: string | null | undefined;
64
+ gclid?: string | null | undefined;
65
+ fbclid?: string | null | undefined;
66
+ ttclid?: string | null | undefined;
67
+ msclkid?: string | null | undefined;
68
+ twclid?: string | null | undefined;
69
+ lifatid?: string | null | undefined;
70
+ ref?: string | null | undefined;
71
+ documentReferrer?: string | null | undefined;
72
+ }>;
73
+ export type AttributionTouchData = z.infer<typeof AttributionTouchDataSchema>;
74
+ /**
75
+ * Attribution Touch Response Schema
76
+ * This represents the entity structure returned from the API
77
+ */
78
+ export declare const AttributionTouchSchema: z.ZodObject<{
79
+ id: z.ZodString;
80
+ __entity: z.ZodOptional<z.ZodString>;
81
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
82
+ updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
83
+ deletedAt: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
84
+ } & {
85
+ utmSource: z.ZodNullable<z.ZodNativeEnum<typeof UtmSource>>;
86
+ utmMedium: z.ZodNullable<z.ZodString>;
87
+ utmCampaign: z.ZodNullable<z.ZodString>;
88
+ utmTerm: z.ZodNullable<z.ZodString>;
89
+ utmContent: z.ZodNullable<z.ZodString>;
90
+ platformClickIds: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
91
+ ref: z.ZodNullable<z.ZodString>;
92
+ landingPage: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
93
+ documentReferrer: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
94
+ isFirstTouch: z.ZodBoolean;
95
+ isLastTouch: z.ZodBoolean;
96
+ touchCount: z.ZodNumber;
97
+ userId: z.ZodString;
98
+ accountId: z.ZodString;
99
+ tradeId: z.ZodNullable<z.ZodString>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ id: string;
102
+ createdAt: string | Date;
103
+ updatedAt: string | Date;
104
+ deletedAt: string | Date | null;
105
+ accountId: string;
106
+ userId: string;
107
+ tradeId: string | null;
108
+ landingPage: string | null;
109
+ utmSource: UtmSource | null;
110
+ utmMedium: string | null;
111
+ utmCampaign: string | null;
112
+ utmTerm: string | null;
113
+ utmContent: string | null;
114
+ ref: string | null;
115
+ documentReferrer: string | null;
116
+ platformClickIds: Record<string, string> | null;
117
+ isFirstTouch: boolean;
118
+ isLastTouch: boolean;
119
+ touchCount: number;
120
+ __entity?: string | undefined;
121
+ }, {
122
+ id: string;
123
+ createdAt: string | Date;
124
+ updatedAt: string | Date;
125
+ deletedAt: string | Date | null;
126
+ accountId: string;
127
+ userId: string;
128
+ tradeId: string | null;
129
+ landingPage: string | null;
130
+ utmSource: UtmSource | null;
131
+ utmMedium: string | null;
132
+ utmCampaign: string | null;
133
+ utmTerm: string | null;
134
+ utmContent: string | null;
135
+ ref: string | null;
136
+ documentReferrer: string | null;
137
+ platformClickIds: Record<string, string> | null;
138
+ isFirstTouch: boolean;
139
+ isLastTouch: boolean;
140
+ touchCount: number;
141
+ __entity?: string | undefined;
142
+ }>;
143
+ export type AttributionTouch = z.infer<typeof AttributionTouchSchema>;
144
+ /**
145
+ * Cookie name constant for attribution data
146
+ */
147
+ export declare const ATTRIBUTION_COOKIE_NAME = "dalmore_attribution";
148
+ /**
149
+ * Cookie parsing helper type
150
+ */
151
+ export type AttributionCookie = AttributionTouchData;
152
+ /**
153
+ * Attribution Touches Include Options
154
+ */
155
+ export declare const attributionTouchesInclude: z.ZodEnum<["user", "account", "trade"]>;
156
+ /**
157
+ * @description Query parameters for including related entities
158
+ */
159
+ export declare const AttributionTouchesIncludeQuery: z.ZodObject<{
160
+ include: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodString>, string[], string | undefined>, string[], string | undefined>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ include: string[];
163
+ }, {
164
+ include?: string | undefined;
165
+ }>;
166
+ export interface AttributionTouchesIncludeQuery extends z.infer<typeof AttributionTouchesIncludeQuery> {
167
+ }
168
+ /**
169
+ * Attribution Touches Filters
170
+ */
171
+ export declare const AttributionTouchesFiltersZod: z.ZodObject<{
172
+ userId: z.ZodOptional<z.ZodString>;
173
+ accountId: z.ZodOptional<z.ZodString>;
174
+ tradeId: z.ZodOptional<z.ZodString>;
175
+ isFirstTouch: z.ZodOptional<z.ZodBoolean>;
176
+ isLastTouch: z.ZodOptional<z.ZodBoolean>;
177
+ utmSource: z.ZodOptional<z.ZodNativeEnum<typeof UtmSource>>;
178
+ utmMedium: z.ZodOptional<z.ZodString>;
179
+ utmCampaign: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ accountId?: string | undefined;
182
+ userId?: string | undefined;
183
+ tradeId?: string | undefined;
184
+ utmSource?: UtmSource | undefined;
185
+ utmMedium?: string | undefined;
186
+ utmCampaign?: string | undefined;
187
+ isFirstTouch?: boolean | undefined;
188
+ isLastTouch?: boolean | undefined;
189
+ }, {
190
+ accountId?: string | undefined;
191
+ userId?: string | undefined;
192
+ tradeId?: string | undefined;
193
+ utmSource?: UtmSource | undefined;
194
+ utmMedium?: string | undefined;
195
+ utmCampaign?: string | undefined;
196
+ isFirstTouch?: boolean | undefined;
197
+ isLastTouch?: boolean | undefined;
198
+ }>;
199
+ export type AttributionTouchesFilters = z.infer<typeof AttributionTouchesFiltersZod>;
200
+ /**
201
+ * Paginated Attribution Touch Response
202
+ */
203
+ export declare const IPaginatedAttributionTouch: z.ZodObject<{
204
+ items: z.ZodArray<z.ZodObject<{
205
+ id: z.ZodString;
206
+ __entity: z.ZodOptional<z.ZodString>;
207
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
208
+ updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
209
+ deletedAt: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
210
+ } & {
211
+ utmSource: z.ZodNullable<z.ZodNativeEnum<typeof UtmSource>>;
212
+ utmMedium: z.ZodNullable<z.ZodString>;
213
+ utmCampaign: z.ZodNullable<z.ZodString>;
214
+ utmTerm: z.ZodNullable<z.ZodString>;
215
+ utmContent: z.ZodNullable<z.ZodString>;
216
+ platformClickIds: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
217
+ ref: z.ZodNullable<z.ZodString>;
218
+ landingPage: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
219
+ documentReferrer: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
220
+ isFirstTouch: z.ZodBoolean;
221
+ isLastTouch: z.ZodBoolean;
222
+ touchCount: z.ZodNumber;
223
+ userId: z.ZodString;
224
+ accountId: z.ZodString;
225
+ tradeId: z.ZodNullable<z.ZodString>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ id: string;
228
+ createdAt: string | Date;
229
+ updatedAt: string | Date;
230
+ deletedAt: string | Date | null;
231
+ accountId: string;
232
+ userId: string;
233
+ tradeId: string | null;
234
+ landingPage: string | null;
235
+ utmSource: UtmSource | null;
236
+ utmMedium: string | null;
237
+ utmCampaign: string | null;
238
+ utmTerm: string | null;
239
+ utmContent: string | null;
240
+ ref: string | null;
241
+ documentReferrer: string | null;
242
+ platformClickIds: Record<string, string> | null;
243
+ isFirstTouch: boolean;
244
+ isLastTouch: boolean;
245
+ touchCount: number;
246
+ __entity?: string | undefined;
247
+ }, {
248
+ id: string;
249
+ createdAt: string | Date;
250
+ updatedAt: string | Date;
251
+ deletedAt: string | Date | null;
252
+ accountId: string;
253
+ userId: string;
254
+ tradeId: string | null;
255
+ landingPage: string | null;
256
+ utmSource: UtmSource | null;
257
+ utmMedium: string | null;
258
+ utmCampaign: string | null;
259
+ utmTerm: string | null;
260
+ utmContent: string | null;
261
+ ref: string | null;
262
+ documentReferrer: string | null;
263
+ platformClickIds: Record<string, string> | null;
264
+ isFirstTouch: boolean;
265
+ isLastTouch: boolean;
266
+ touchCount: number;
267
+ __entity?: string | undefined;
268
+ }>, "many">;
269
+ meta: z.ZodObject<{
270
+ itemCount: z.ZodNumber;
271
+ totalItems: z.ZodOptional<z.ZodNumber>;
272
+ itemsPerPage: z.ZodNumber;
273
+ totalPages: z.ZodOptional<z.ZodNumber>;
274
+ currentPage: z.ZodNumber;
275
+ }, "strip", z.ZodTypeAny, {
276
+ itemCount: number;
277
+ itemsPerPage: number;
278
+ currentPage: number;
279
+ totalItems?: number | undefined;
280
+ totalPages?: number | undefined;
281
+ }, {
282
+ itemCount: number;
283
+ itemsPerPage: number;
284
+ currentPage: number;
285
+ totalItems?: number | undefined;
286
+ totalPages?: number | undefined;
287
+ }>;
288
+ }, "strip", z.ZodTypeAny, {
289
+ items: {
290
+ id: string;
291
+ createdAt: string | Date;
292
+ updatedAt: string | Date;
293
+ deletedAt: string | Date | null;
294
+ accountId: string;
295
+ userId: string;
296
+ tradeId: string | null;
297
+ landingPage: string | null;
298
+ utmSource: UtmSource | null;
299
+ utmMedium: string | null;
300
+ utmCampaign: string | null;
301
+ utmTerm: string | null;
302
+ utmContent: string | null;
303
+ ref: string | null;
304
+ documentReferrer: string | null;
305
+ platformClickIds: Record<string, string> | null;
306
+ isFirstTouch: boolean;
307
+ isLastTouch: boolean;
308
+ touchCount: number;
309
+ __entity?: string | undefined;
310
+ }[];
311
+ meta: {
312
+ itemCount: number;
313
+ itemsPerPage: number;
314
+ currentPage: number;
315
+ totalItems?: number | undefined;
316
+ totalPages?: number | undefined;
317
+ };
318
+ }, {
319
+ items: {
320
+ id: string;
321
+ createdAt: string | Date;
322
+ updatedAt: string | Date;
323
+ deletedAt: string | Date | null;
324
+ accountId: string;
325
+ userId: string;
326
+ tradeId: string | null;
327
+ landingPage: string | null;
328
+ utmSource: UtmSource | null;
329
+ utmMedium: string | null;
330
+ utmCampaign: string | null;
331
+ utmTerm: string | null;
332
+ utmContent: string | null;
333
+ ref: string | null;
334
+ documentReferrer: string | null;
335
+ platformClickIds: Record<string, string> | null;
336
+ isFirstTouch: boolean;
337
+ isLastTouch: boolean;
338
+ touchCount: number;
339
+ __entity?: string | undefined;
340
+ }[];
341
+ meta: {
342
+ itemCount: number;
343
+ itemsPerPage: number;
344
+ currentPage: number;
345
+ totalItems?: number | undefined;
346
+ totalPages?: number | undefined;
347
+ };
348
+ }>;
349
+ export type IPaginatedAttributionTouch = z.infer<typeof IPaginatedAttributionTouch>;
350
+ /**
351
+ * User Attribution Touch Summary Response
352
+ * Contains first and last touch for a user, total touches, and conversion path
353
+ */
354
+ export declare const UserAttributionTouchSummarySchema: z.ZodObject<{
355
+ firstTouch: z.ZodNullable<z.ZodObject<{
356
+ id: z.ZodString;
357
+ __entity: z.ZodOptional<z.ZodString>;
358
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
359
+ updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
360
+ deletedAt: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
361
+ } & {
362
+ utmSource: z.ZodNullable<z.ZodNativeEnum<typeof UtmSource>>;
363
+ utmMedium: z.ZodNullable<z.ZodString>;
364
+ utmCampaign: z.ZodNullable<z.ZodString>;
365
+ utmTerm: z.ZodNullable<z.ZodString>;
366
+ utmContent: z.ZodNullable<z.ZodString>;
367
+ platformClickIds: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
368
+ ref: z.ZodNullable<z.ZodString>;
369
+ landingPage: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
370
+ documentReferrer: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
371
+ isFirstTouch: z.ZodBoolean;
372
+ isLastTouch: z.ZodBoolean;
373
+ touchCount: z.ZodNumber;
374
+ userId: z.ZodString;
375
+ accountId: z.ZodString;
376
+ tradeId: z.ZodNullable<z.ZodString>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ id: string;
379
+ createdAt: string | Date;
380
+ updatedAt: string | Date;
381
+ deletedAt: string | Date | null;
382
+ accountId: string;
383
+ userId: string;
384
+ tradeId: string | null;
385
+ landingPage: string | null;
386
+ utmSource: UtmSource | null;
387
+ utmMedium: string | null;
388
+ utmCampaign: string | null;
389
+ utmTerm: string | null;
390
+ utmContent: string | null;
391
+ ref: string | null;
392
+ documentReferrer: string | null;
393
+ platformClickIds: Record<string, string> | null;
394
+ isFirstTouch: boolean;
395
+ isLastTouch: boolean;
396
+ touchCount: number;
397
+ __entity?: string | undefined;
398
+ }, {
399
+ id: string;
400
+ createdAt: string | Date;
401
+ updatedAt: string | Date;
402
+ deletedAt: string | Date | null;
403
+ accountId: string;
404
+ userId: string;
405
+ tradeId: string | null;
406
+ landingPage: string | null;
407
+ utmSource: UtmSource | null;
408
+ utmMedium: string | null;
409
+ utmCampaign: string | null;
410
+ utmTerm: string | null;
411
+ utmContent: string | null;
412
+ ref: string | null;
413
+ documentReferrer: string | null;
414
+ platformClickIds: Record<string, string> | null;
415
+ isFirstTouch: boolean;
416
+ isLastTouch: boolean;
417
+ touchCount: number;
418
+ __entity?: string | undefined;
419
+ }>>;
420
+ lastTouch: z.ZodNullable<z.ZodObject<{
421
+ id: z.ZodString;
422
+ __entity: z.ZodOptional<z.ZodString>;
423
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
424
+ updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
425
+ deletedAt: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
426
+ } & {
427
+ utmSource: z.ZodNullable<z.ZodNativeEnum<typeof UtmSource>>;
428
+ utmMedium: z.ZodNullable<z.ZodString>;
429
+ utmCampaign: z.ZodNullable<z.ZodString>;
430
+ utmTerm: z.ZodNullable<z.ZodString>;
431
+ utmContent: z.ZodNullable<z.ZodString>;
432
+ platformClickIds: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
433
+ ref: z.ZodNullable<z.ZodString>;
434
+ landingPage: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
435
+ documentReferrer: z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
436
+ isFirstTouch: z.ZodBoolean;
437
+ isLastTouch: z.ZodBoolean;
438
+ touchCount: z.ZodNumber;
439
+ userId: z.ZodString;
440
+ accountId: z.ZodString;
441
+ tradeId: z.ZodNullable<z.ZodString>;
442
+ }, "strip", z.ZodTypeAny, {
443
+ id: string;
444
+ createdAt: string | Date;
445
+ updatedAt: string | Date;
446
+ deletedAt: string | Date | null;
447
+ accountId: string;
448
+ userId: string;
449
+ tradeId: string | null;
450
+ landingPage: string | null;
451
+ utmSource: UtmSource | null;
452
+ utmMedium: string | null;
453
+ utmCampaign: string | null;
454
+ utmTerm: string | null;
455
+ utmContent: string | null;
456
+ ref: string | null;
457
+ documentReferrer: string | null;
458
+ platformClickIds: Record<string, string> | null;
459
+ isFirstTouch: boolean;
460
+ isLastTouch: boolean;
461
+ touchCount: number;
462
+ __entity?: string | undefined;
463
+ }, {
464
+ id: string;
465
+ createdAt: string | Date;
466
+ updatedAt: string | Date;
467
+ deletedAt: string | Date | null;
468
+ accountId: string;
469
+ userId: string;
470
+ tradeId: string | null;
471
+ landingPage: string | null;
472
+ utmSource: UtmSource | null;
473
+ utmMedium: string | null;
474
+ utmCampaign: string | null;
475
+ utmTerm: string | null;
476
+ utmContent: string | null;
477
+ ref: string | null;
478
+ documentReferrer: string | null;
479
+ platformClickIds: Record<string, string> | null;
480
+ isFirstTouch: boolean;
481
+ isLastTouch: boolean;
482
+ touchCount: number;
483
+ __entity?: string | undefined;
484
+ }>>;
485
+ totalTouches: z.ZodNumber;
486
+ conversionPath: z.ZodArray<z.ZodString, "many">;
487
+ }, "strip", z.ZodTypeAny, {
488
+ firstTouch: {
489
+ id: string;
490
+ createdAt: string | Date;
491
+ updatedAt: string | Date;
492
+ deletedAt: string | Date | null;
493
+ accountId: string;
494
+ userId: string;
495
+ tradeId: string | null;
496
+ landingPage: string | null;
497
+ utmSource: UtmSource | null;
498
+ utmMedium: string | null;
499
+ utmCampaign: string | null;
500
+ utmTerm: string | null;
501
+ utmContent: string | null;
502
+ ref: string | null;
503
+ documentReferrer: string | null;
504
+ platformClickIds: Record<string, string> | null;
505
+ isFirstTouch: boolean;
506
+ isLastTouch: boolean;
507
+ touchCount: number;
508
+ __entity?: string | undefined;
509
+ } | null;
510
+ lastTouch: {
511
+ id: string;
512
+ createdAt: string | Date;
513
+ updatedAt: string | Date;
514
+ deletedAt: string | Date | null;
515
+ accountId: string;
516
+ userId: string;
517
+ tradeId: string | null;
518
+ landingPage: string | null;
519
+ utmSource: UtmSource | null;
520
+ utmMedium: string | null;
521
+ utmCampaign: string | null;
522
+ utmTerm: string | null;
523
+ utmContent: string | null;
524
+ ref: string | null;
525
+ documentReferrer: string | null;
526
+ platformClickIds: Record<string, string> | null;
527
+ isFirstTouch: boolean;
528
+ isLastTouch: boolean;
529
+ touchCount: number;
530
+ __entity?: string | undefined;
531
+ } | null;
532
+ totalTouches: number;
533
+ conversionPath: string[];
534
+ }, {
535
+ firstTouch: {
536
+ id: string;
537
+ createdAt: string | Date;
538
+ updatedAt: string | Date;
539
+ deletedAt: string | Date | null;
540
+ accountId: string;
541
+ userId: string;
542
+ tradeId: string | null;
543
+ landingPage: string | null;
544
+ utmSource: UtmSource | null;
545
+ utmMedium: string | null;
546
+ utmCampaign: string | null;
547
+ utmTerm: string | null;
548
+ utmContent: string | null;
549
+ ref: string | null;
550
+ documentReferrer: string | null;
551
+ platformClickIds: Record<string, string> | null;
552
+ isFirstTouch: boolean;
553
+ isLastTouch: boolean;
554
+ touchCount: number;
555
+ __entity?: string | undefined;
556
+ } | null;
557
+ lastTouch: {
558
+ id: string;
559
+ createdAt: string | Date;
560
+ updatedAt: string | Date;
561
+ deletedAt: string | Date | null;
562
+ accountId: string;
563
+ userId: string;
564
+ tradeId: string | null;
565
+ landingPage: string | null;
566
+ utmSource: UtmSource | null;
567
+ utmMedium: string | null;
568
+ utmCampaign: string | null;
569
+ utmTerm: string | null;
570
+ utmContent: string | null;
571
+ ref: string | null;
572
+ documentReferrer: string | null;
573
+ platformClickIds: Record<string, string> | null;
574
+ isFirstTouch: boolean;
575
+ isLastTouch: boolean;
576
+ touchCount: number;
577
+ __entity?: string | undefined;
578
+ } | null;
579
+ totalTouches: number;
580
+ conversionPath: string[];
581
+ }>;
582
+ export type UserAttributionTouchSummary = z.infer<typeof UserAttributionTouchSummarySchema>;
@@ -0,0 +1,126 @@
1
+ import { z } from 'zod';
2
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
3
+ import { IBaseEntity } from './entity.types.js';
4
+ import { createUrlSchema, IPaginationMeta } from './common.types.js';
5
+ extendZodWithOpenApi(z);
6
+ /**
7
+ * UTM Source enum - Common marketing sources
8
+ */
9
+ export var UtmSource;
10
+ (function (UtmSource) {
11
+ UtmSource["GOOGLE"] = "GOOGLE";
12
+ UtmSource["FACEBOOK"] = "FACEBOOK";
13
+ UtmSource["TWITTER"] = "TWITTER";
14
+ UtmSource["LINKEDIN"] = "LINKEDIN";
15
+ UtmSource["INSTAGRAM"] = "INSTAGRAM";
16
+ UtmSource["TIKTOK"] = "TIKTOK";
17
+ UtmSource["EMAIL"] = "EMAIL";
18
+ UtmSource["DIRECT"] = "DIRECT";
19
+ UtmSource["ORGANIC"] = "ORGANIC";
20
+ UtmSource["REFERRAL"] = "REFERRAL";
21
+ UtmSource["OTHER"] = "OTHER";
22
+ })(UtmSource || (UtmSource = {}));
23
+ /**
24
+ * Zod enum schema for UTM Source
25
+ */
26
+ export const UtmSourceZod = z.nativeEnum(UtmSource);
27
+ /**
28
+ * Attribution Touch Data (from cookie)
29
+ * This represents the raw data structure stored in the cookie
30
+ * Platform click IDs are stored as a record: { "gclid": "abc123", "fbclid": "xyz789", "ttclid": "def456" }
31
+ */
32
+ export const AttributionTouchDataSchema = z.object({
33
+ // UTM Parameters
34
+ utmSource: UtmSourceZod,
35
+ utmMedium: z.string(),
36
+ utmCampaign: z.string().nullable().optional(),
37
+ utmTerm: z.string().nullable().optional(),
38
+ utmContent: z.string().nullable().optional(),
39
+ // Platform Click IDs
40
+ gclid: z.string().nullable().optional(), // Google Click ID
41
+ fbclid: z.string().nullable().optional(), // Facebook Click ID
42
+ ttclid: z.string().nullable().optional(), // TikTok Click ID
43
+ msclkid: z.string().nullable().optional(), // Microsoft Click ID
44
+ twclid: z.string().nullable().optional(), // Twitter Click ID
45
+ lifatid: z.string().nullable().optional(), // LinkedIn Click ID
46
+ // In-house Referral
47
+ ref: z.string().nullable().optional(),
48
+ // Landing Page
49
+ landingPage: createUrlSchema({ strict: true }).nullable().optional(),
50
+ documentReferrer: createUrlSchema({ strict: true }).nullable().optional(),
51
+ });
52
+ /**
53
+ * Attribution Touch Response Schema
54
+ * This represents the entity structure returned from the API
55
+ */
56
+ export const AttributionTouchSchema = IBaseEntity.extend({
57
+ utmSource: UtmSourceZod.nullable(),
58
+ utmMedium: z.string().nullable(),
59
+ utmCampaign: z.string().nullable(),
60
+ utmTerm: z.string().nullable(),
61
+ utmContent: z.string().nullable(),
62
+ platformClickIds: z.record(z.string()).nullable(),
63
+ ref: z.string().nullable(),
64
+ landingPage: createUrlSchema({ strict: true }).nullable(),
65
+ documentReferrer: createUrlSchema({ strict: true }).nullable(),
66
+ isFirstTouch: z.boolean(),
67
+ isLastTouch: z.boolean(),
68
+ touchCount: z.number().int(),
69
+ userId: z.string(),
70
+ accountId: z.string(),
71
+ tradeId: z.string().nullable(),
72
+ });
73
+ /**
74
+ * Cookie name constant for attribution data
75
+ */
76
+ export const ATTRIBUTION_COOKIE_NAME = 'dalmore_attribution';
77
+ /**
78
+ * Attribution Touches Include Options
79
+ */
80
+ export const attributionTouchesInclude = z.enum(['user', 'account', 'trade']);
81
+ /**
82
+ * @description Query parameters for including related entities
83
+ */
84
+ export const AttributionTouchesIncludeQuery = z.object({
85
+ include: z
86
+ .string()
87
+ .optional()
88
+ .transform((str) => (str ? str.split(',') : []))
89
+ .refine((includes) => includes.every((include) => attributionTouchesInclude.options.includes(include)), {
90
+ message: `Invalid include option provided. Valid options are: ${attributionTouchesInclude.options.join(', ')}`,
91
+ })
92
+ .openapi({
93
+ example: `${attributionTouchesInclude.options.join(', ')}`,
94
+ }),
95
+ });
96
+ /**
97
+ * Attribution Touches Filters
98
+ */
99
+ export const AttributionTouchesFiltersZod = z.object({
100
+ userId: z.string().optional(),
101
+ accountId: z.string().optional(),
102
+ tradeId: z.string().optional(),
103
+ isFirstTouch: z.coerce.boolean().optional(),
104
+ isLastTouch: z.coerce.boolean().optional(),
105
+ utmSource: UtmSourceZod.optional(),
106
+ utmMedium: z.string().optional(),
107
+ utmCampaign: z.string().optional(),
108
+ });
109
+ /**
110
+ * Paginated Attribution Touch Response
111
+ */
112
+ export const IPaginatedAttributionTouch = z.object({
113
+ items: z.array(AttributionTouchSchema),
114
+ meta: IPaginationMeta,
115
+ });
116
+ /**
117
+ * User Attribution Touch Summary Response
118
+ * Contains first and last touch for a user, total touches, and conversion path
119
+ */
120
+ export const UserAttributionTouchSummarySchema = z.object({
121
+ firstTouch: AttributionTouchSchema.nullable(),
122
+ lastTouch: AttributionTouchSchema.nullable(),
123
+ totalTouches: z.number().int(),
124
+ conversionPath: z.array(z.string()),
125
+ });
126
+ //# sourceMappingURL=attribution.types.js.map