@dalmore/api-contracts 1.0.9 → 1.0.10

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 (147) hide show
  1. package/README.md +48 -39
  2. package/common/helpers/index.ts +59 -0
  3. package/{src/common → common}/types/account-contact.types.ts +2 -1
  4. package/{src/common → common}/types/account-manager.types.ts +3 -7
  5. package/common/types/account-setting.types.ts +65 -0
  6. package/{src/common → common}/types/account.types.ts +1 -0
  7. package/{src/common → common}/types/activity.types.ts +1 -1
  8. package/{src/common → common}/types/api-key-logs.types.ts +1 -1
  9. package/{src/common → common}/types/asset.types.ts +14 -14
  10. package/{src/common → common}/types/auth.types.ts +7 -18
  11. package/{src/common → common}/types/bonus-tier.types.ts +33 -0
  12. package/{src/common → common}/types/cart.types.ts +4 -1
  13. package/{src/common → common}/types/common.types.ts +39 -7
  14. package/{src/common → common}/types/contact-us.types.ts +6 -2
  15. package/{src/common → common}/types/covered-person.types.ts +2 -1
  16. package/{src/common → common}/types/dashboard.types.ts +2 -9
  17. package/{src/common → common}/types/data-record.types.ts +1 -1
  18. package/{src/common → common}/types/disbursements.types.ts +119 -3
  19. package/{src/common → common}/types/escrow-account.types.ts +3 -3
  20. package/{src/common → common}/types/file.types.ts +20 -4
  21. package/common/types/i-will-do-it-later.types.ts +68 -0
  22. package/{src/common → common}/types/index.ts +2 -0
  23. package/{src/common → common}/types/individuals.types.ts +5 -17
  24. package/{src/common → common}/types/investor-account.types.ts +2 -1
  25. package/{src/common → common}/types/invite.types.ts +27 -1
  26. package/{src/common → common}/types/issuer-offering.types.ts +113 -30
  27. package/{src/common → common}/types/issuer-payment-method.types.ts +41 -0
  28. package/{src/common → common}/types/issuer.types.ts +9 -0
  29. package/{src/common → common}/types/legal-entity.types.ts +3 -2
  30. package/{src/common → common}/types/note.types.ts +1 -1
  31. package/common/types/notification.types.ts +544 -0
  32. package/{src/common → common}/types/offering.types.ts +106 -20
  33. package/{src/common → common}/types/page.types.ts +1 -1
  34. package/{src/common → common}/types/phone.type.ts +1 -1
  35. package/{src/common → common}/types/site-settings.types.ts +2 -1
  36. package/{src/common → common}/types/site.types.ts +2 -9
  37. package/{src/common/types/trade-line-item.type.ts → common/types/trade-line-item.types.ts} +2 -9
  38. package/{src/common → common}/types/trade.types.ts +137 -4
  39. package/{src/common → common}/types/transaction.types.ts +12 -1
  40. package/{src/common → common}/types/trusted-contact.types.ts +7 -7
  41. package/{src/common → common}/types/user.types.ts +17 -33
  42. package/{src/common → common}/types/zip.type.ts +1 -1
  43. package/contracts/clients/cart/index.ts +80 -0
  44. package/{src/contracts → contracts}/clients/files/index.ts +14 -1
  45. package/{src/contracts → contracts}/clients/files-public/index.ts +15 -1
  46. package/{src/contracts → contracts}/clients/index.ts +10 -0
  47. package/contracts/clients/issuer-payment-methods/index.ts +39 -0
  48. package/contracts/clients/payment-methods/index.ts +85 -0
  49. package/contracts/clients/trade-line-items/index.ts +66 -0
  50. package/{src/contracts → contracts}/clients/trades/index.ts +65 -1
  51. package/contracts/clients/transactions/index.ts +37 -0
  52. package/index.ts +10 -0
  53. package/package.json +32 -11
  54. package/index.mjs +0 -10876
  55. package/src/common/types/address.spec.ts +0 -203
  56. package/src/common/types/common.types.spec.ts +0 -336
  57. package/src/common/types/contract-helpers.ts +0 -205
  58. package/src/common/types/files.types.spec.ts +0 -154
  59. package/src/common/types/issuer-payment-method.types.spec.ts +0 -612
  60. package/src/common/types/notification.types.ts +0 -58
  61. package/src/common/types/offering.types.spec.ts +0 -91
  62. package/src/common/types/phone.spec.ts +0 -76
  63. package/src/common/types/site-link.types.spec.ts +0 -134
  64. /package/{src/common → common}/types/account-detail.types.ts +0 -0
  65. /package/{src/common → common}/types/account-integration.types.ts +0 -0
  66. /package/{src/common → common}/types/address.types.ts +0 -0
  67. /package/{src/common → common}/types/aic.types.ts +0 -0
  68. /package/{src/common → common}/types/aml.types.ts +0 -0
  69. /package/{src/common → common}/types/api-keys.types.ts +0 -0
  70. /package/{src/common → common}/types/batch-jobs.types.ts +0 -0
  71. /package/{src/common → common}/types/checklist-items.types.ts +0 -0
  72. /package/{src/common → common}/types/checklist.types.ts +0 -0
  73. /package/{src/common → common}/types/comply-advantage-api.types.ts +0 -0
  74. /package/{src/common → common}/types/comply-advantage.types.ts +0 -0
  75. /package/{src/common → common}/types/countries.types.ts +0 -0
  76. /package/{src/common → common}/types/data-room.types.ts +0 -0
  77. /package/{src/common → common}/types/default-theme-config.types.ts +0 -0
  78. /package/{src/common → common}/types/disbursement-adjustment.types.ts +0 -0
  79. /package/{src/common → common}/types/disbursement-approval-user.types.ts +0 -0
  80. /package/{src/common → common}/types/disbursement-review.types.ts +0 -0
  81. /package/{src/common → common}/types/disbursement-transaction.types.ts +0 -0
  82. /package/{src/common → common}/types/domain-filter.types.ts +0 -0
  83. /package/{src/common → common}/types/email-theme.types.ts +0 -0
  84. /package/{src/common → common}/types/entity.types.ts +0 -0
  85. /package/{src/common → common}/types/error-responses.types.ts +0 -0
  86. /package/{src/common → common}/types/exchange-api-key.types.ts +0 -0
  87. /package/{src/common → common}/types/exchange-import.types.ts +0 -0
  88. /package/{src/common → common}/types/exchange-provider.types.ts +0 -0
  89. /package/{src/common → common}/types/health.types.ts +0 -0
  90. /package/{src/common → common}/types/investorAccountIdSchema.type.ts +0 -0
  91. /package/{src/common → common}/types/investors-offering.types.ts +0 -0
  92. /package/{src/common → common}/types/issuer-bank-account.types.ts +0 -0
  93. /package/{src/common → common}/types/job-item.types.ts +0 -0
  94. /package/{src/common → common}/types/jobs.types.ts +0 -0
  95. /package/{src/common → common}/types/kyb.types.ts +0 -0
  96. /package/{src/common → common}/types/kyc.types.ts +0 -0
  97. /package/{src/common → common}/types/login-history.types.ts +0 -0
  98. /package/{src/common → common}/types/mail-template.types.ts +0 -0
  99. /package/{src/common → common}/types/north-cap-integration.types.ts +0 -0
  100. /package/{src/common → common}/types/notion-api.types.ts +0 -0
  101. /package/{src/common → common}/types/notion-database.types.ts +0 -0
  102. /package/{src/common → common}/types/notion-page.types.ts +0 -0
  103. /package/{src/common → common}/types/offering-reports.types.ts +0 -0
  104. /package/{src/common → common}/types/offering-submission.types.ts +0 -0
  105. /package/{src/common → common}/types/page-revision.types.ts +0 -0
  106. /package/{src/common → common}/types/password.type.ts +0 -0
  107. /package/{src/common → common}/types/payment-methods.types.ts +0 -0
  108. /package/{src/common → common}/types/portfolio.types.ts +0 -0
  109. /package/{src/common → common}/types/privacy-policy-and-tos.types.ts +0 -0
  110. /package/{src/common → common}/types/queue.types.ts +0 -0
  111. /package/{src/common → common}/types/registered-reps.types.ts +0 -0
  112. /package/{src/common → common}/types/rejection-reasons.types.ts +0 -0
  113. /package/{src/common → common}/types/reminder-config.types.ts +0 -0
  114. /package/{src/common → common}/types/review.types.ts +0 -0
  115. /package/{src/common → common}/types/role.types.ts +0 -0
  116. /package/{src/common → common}/types/secondary-customer.types.ts +0 -0
  117. /package/{src/common → common}/types/secondary-issuer.types.ts +0 -0
  118. /package/{src/common → common}/types/secondary-order.types.ts +0 -0
  119. /package/{src/common → common}/types/secondary-security.types.ts +0 -0
  120. /package/{src/common → common}/types/secondary-trade.entity.ts +0 -0
  121. /package/{src/common → common}/types/secondary-trade.types.ts +0 -0
  122. /package/{src/common → common}/types/secure-request.types.ts +0 -0
  123. /package/{src/common → common}/types/signer.types.ts +0 -0
  124. /package/{src/common → common}/types/site-link.types.ts +0 -0
  125. /package/{src/common → common}/types/sms.types.ts +0 -0
  126. /package/{src/common → common}/types/state-machine.types.ts +0 -0
  127. /package/{src/common → common}/types/states.types.ts +0 -0
  128. /package/{src/common → common}/types/subdoc-preview.types.ts +0 -0
  129. /package/{src/common → common}/types/task.types.ts +0 -0
  130. /package/{src/common → common}/types/trade-adjustment.type.ts +0 -0
  131. /package/{src/common → common}/types/typography.types.ts +0 -0
  132. /package/{src/common → common}/types/user-manual.types.ts +0 -0
  133. /package/{src/common → common}/types/user-setting.types.ts +0 -0
  134. /package/{src/common → common}/types/webhook.types.ts +0 -0
  135. /package/{src/contracts → contracts}/clients/accounts/index.ts +0 -0
  136. /package/{src/contracts → contracts}/clients/aic/index.ts +0 -0
  137. /package/{src/contracts → contracts}/clients/api-key-logs/index.ts +0 -0
  138. /package/{src/contracts → contracts}/clients/api-keys/index.ts +0 -0
  139. /package/{src/contracts → contracts}/clients/assets/index.ts +0 -0
  140. /package/{src/contracts → contracts}/clients/auth/index.ts +0 -0
  141. /package/{src/contracts → contracts}/clients/individuals/index.ts +0 -0
  142. /package/{src/contracts → contracts}/clients/investor-accounts/index.ts +0 -0
  143. /package/{src/contracts → contracts}/clients/issuers/index.ts +0 -0
  144. /package/{src/contracts → contracts}/clients/legal-entities/index.ts +0 -0
  145. /package/{src/contracts → contracts}/clients/offerings/index.ts +0 -0
  146. /package/{src/contracts → contracts}/clients/secure-requests/index.ts +0 -0
  147. /package/{src/contracts → contracts}/clients/sites/index.ts +0 -0
@@ -7,6 +7,7 @@ import {
7
7
  FileLabels,
8
8
  IPaginationMeta,
9
9
  OfferingType,
10
+ StringToBooleanSchema,
10
11
  } from './common.types';
11
12
  import { accountIdSchema } from './account.types';
12
13
 
@@ -330,15 +331,7 @@ export const GetInvestmentDashboardQueryZod = z.object({
330
331
  offerings: OfferingsArrayQueryZod.optional(),
331
332
  offeringTypes: OfferingTypesQueryZod.optional(),
332
333
  timeFilteringType: z.nativeEnum(DashboardTimeFilteringType),
333
- debug: z.preprocess(
334
- (val) =>
335
- val === 'true' || val === '1'
336
- ? true
337
- : val === 'false' || val === '0'
338
- ? false
339
- : val,
340
- z.boolean().optional(),
341
- ),
334
+ debug: StringToBooleanSchema.optional(),
342
335
  });
343
336
  export type GetInvestmentDashboardQueryZod = z.infer<
344
337
  typeof GetInvestmentDashboardQueryZod
@@ -166,7 +166,7 @@ export interface BaseDataRecordStructure extends IBaseEntityType {
166
166
  data?: BaseDataRecordStructure[] | undefined;
167
167
  }
168
168
 
169
- export const DataRecordStructureZod = z
169
+ export const DataRecordStructureZod: z.ZodType<BaseDataRecordStructure> = z
170
170
  .lazy(() =>
171
171
  IBaseEntity.extend({
172
172
  name: z.string().min(1).max(255),
@@ -11,14 +11,17 @@ import {
11
11
  import { tradeIdSchema } from './trade.types';
12
12
  import { accountIdSchema } from './account.types';
13
13
  import { TypeID } from 'typeid-js';
14
- import { issuerIdSchema } from './issuer.types';
15
- import { issuerBankAccountIdSchema } from './issuer-bank-account.types';
14
+ import { IIssuer, issuerIdSchema } from './issuer.types';
15
+ import {
16
+ IIssuerBankAccount,
17
+ issuerBankAccountIdSchema,
18
+ } from './issuer-bank-account.types';
16
19
  import { userIdSchema, UserZod } from './user.types';
17
20
  import {
18
21
  PostDisbursementAdjustmentZod,
19
22
  DisbursementAdjustmentType,
20
23
  } from './disbursement-adjustment.types';
21
- import { escrowAccountIdSchema } from './escrow-account.types';
24
+ import { IEscrowAccount, escrowAccountIdSchema } from './escrow-account.types';
22
25
 
23
26
  export const disbursementIdSchema = z.string().refine(
24
27
  (value) => {
@@ -308,3 +311,116 @@ export const DisbursementSummaryZod = z.object({
308
311
  amountToBeTransferred: z.number(),
309
312
  });
310
313
  export type DisbursementSummaryZod = z.infer<typeof DisbursementSummaryZod>;
314
+
315
+ // GET /disbursements/preview query parameters
316
+ export const GetDisbursementPreviewQueryZod = z.object({
317
+ offeringId: offeringIdSchema,
318
+ selectedTrades: z
319
+ .string()
320
+ .optional()
321
+ .transform((str) => (str ? str.split(',') : []))
322
+ .refine(
323
+ (ids) =>
324
+ ids.every((id) => {
325
+ try {
326
+ const tid = TypeID.fromString(id);
327
+ return tid.getType() === 'trade';
328
+ } catch {
329
+ return false;
330
+ }
331
+ }),
332
+ {
333
+ message: 'All selected trades must be valid trade IDs',
334
+ },
335
+ )
336
+ .openapi({
337
+ example: 'trade_01abc123,trade_01def456',
338
+ }),
339
+ });
340
+ export type GetDisbursementPreviewQueryZod = z.infer<
341
+ typeof GetDisbursementPreviewQueryZod
342
+ >;
343
+
344
+ // Context fields for disbursement preview
345
+ export const DisbursementPreviewContextZod = z.object({
346
+ issuer: z.lazy(() => IIssuer).nullable(),
347
+ offering: z.lazy(() => IOffering).nullable(),
348
+ escrowAccount: z.lazy(() => IEscrowAccount).nullable(),
349
+ destinationBank: z.lazy(() => IIssuerBankAccount).nullable(),
350
+ });
351
+ export type DisbursementPreviewContextZod = z.infer<
352
+ typeof DisbursementPreviewContextZod
353
+ >;
354
+
355
+ // Balance values for disbursement preview
356
+ export const DisbursementPreviewBalanceZod = z.object({
357
+ totalRaised: z.number(),
358
+ totalDisbursed: z.number(),
359
+ pending: z.number(),
360
+ refundPool: z.number(),
361
+ availableForDisbursement: z.number(),
362
+ });
363
+ export type DisbursementPreviewBalanceZod = z.infer<
364
+ typeof DisbursementPreviewBalanceZod
365
+ >;
366
+
367
+ // Trade summary for disbursement preview
368
+ export const DisbursementPreviewTradeSummaryZod = z.object({
369
+ selectedTradesCount: z.number(),
370
+ selectedTradesTotalAmount: z.number(),
371
+ });
372
+ export type DisbursementPreviewTradeSummaryZod = z.infer<
373
+ typeof DisbursementPreviewTradeSummaryZod
374
+ >;
375
+
376
+ // Contingency validation result
377
+ export const DisbursementPreviewContingencyZod = z.object({
378
+ contingencyPassed: z.boolean(),
379
+ contingencyMessage: z.string().nullable(),
380
+ contingencyAmount: z.number(),
381
+ });
382
+ export type DisbursementPreviewContingencyZod = z.infer<
383
+ typeof DisbursementPreviewContingencyZod
384
+ >;
385
+
386
+ // Amount defaults and constraints
387
+ export const DisbursementPreviewAmountZod = z.object({
388
+ defaultAmount: z.number(),
389
+ minAmount: z.number(),
390
+ maxAmount: z.number(),
391
+ });
392
+ export type DisbursementPreviewAmountZod = z.infer<
393
+ typeof DisbursementPreviewAmountZod
394
+ >;
395
+
396
+ // Complete response for GET /disbursements/preview
397
+ export const DisbursementPreviewZod = z.object({
398
+ context: DisbursementPreviewContextZod,
399
+ balance: DisbursementPreviewBalanceZod,
400
+ tradeSummary: DisbursementPreviewTradeSummaryZod,
401
+ contingency: DisbursementPreviewContingencyZod,
402
+ amount: DisbursementPreviewAmountZod,
403
+ });
404
+ export type DisbursementPreviewZod = z.infer<typeof DisbursementPreviewZod>;
405
+
406
+ export const EligibleOfferingZod = z.object({
407
+ offeringId: offeringIdSchema,
408
+ offeringName: z.string(),
409
+ availableAmount: z.number(),
410
+ });
411
+ export type EligibleOfferingZod = z.infer<typeof EligibleOfferingZod>;
412
+
413
+ export const IPaginatedEligibleOffering = z.object({
414
+ items: z.array(EligibleOfferingZod),
415
+ meta: IPaginationMeta,
416
+ });
417
+ export type IPaginatedEligibleOffering = z.infer<
418
+ typeof IPaginatedEligibleOffering
419
+ >;
420
+
421
+ export const EligibleOfferingsFiltersZod = z.object({
422
+ search: z.string().optional(),
423
+ });
424
+ export type EligibleOfferingsFiltersZod = z.infer<
425
+ typeof EligibleOfferingsFiltersZod
426
+ >;
@@ -1,6 +1,6 @@
1
1
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
2
2
  import { z } from 'zod';
3
- import { AccountZod, IPaginationMeta } from './common.types';
3
+ import { AccountZod, EmailSchema, IPaginationMeta } from './common.types';
4
4
  import { IBaseEntity } from './entity.types';
5
5
  import { TypeID } from 'typeid-js';
6
6
  import { accountIdSchema } from './account.types';
@@ -43,7 +43,7 @@ export const PostEscrowAccount = z.object({
43
43
  accountNumber: z.string().optional().nullable(),
44
44
  routingNumber: z.string().min(9).max(9).optional().nullable(),
45
45
  agentName: z.string().min(2).max(50),
46
- agentEmail: z.string().email(),
46
+ agentEmail: EmailSchema,
47
47
  });
48
48
 
49
49
  export type PostEscrowAccount = z.infer<typeof PostEscrowAccount>;
@@ -65,7 +65,7 @@ export const PatchEscrowAccount = z.object({
65
65
  accountNumber: z.string().min(10).max(18).optional().nullable().optional(),
66
66
  routingNumber: z.string().min(9).max(9).optional().nullable().optional(),
67
67
  agentName: z.string().min(2).max(50).optional(),
68
- agentEmail: z.string().email().optional(),
68
+ agentEmail: EmailSchema.optional(),
69
69
  });
70
70
 
71
71
  export type PatchEscrowAccount = z.infer<typeof PatchEscrowAccount>;
@@ -17,7 +17,7 @@ import { KybZod } from './kyb.types';
17
17
  import { IIndividualZod, individualIdSchema } from './individuals.types';
18
18
  import { LegalEntityZod } from './legal-entity.types';
19
19
  import { IInvestorAccount } from './investor-account.types';
20
- import { TradeZod } from './trade.types';
20
+ import { tradeIdSchema, TradeZod } from './trade.types';
21
21
 
22
22
  extendZodWithOpenApi(z);
23
23
 
@@ -168,13 +168,13 @@ export type PostFileQueryParams = z.infer<typeof PostFileQueryParams>;
168
168
 
169
169
  /**
170
170
  * CLIENT portal specific schema for file uploads
171
- * Only allows INDIVIDUALS as target for file uploads
171
+ * Only allows INDIVIDUALS and TRADES as target for file uploads
172
172
  */
173
173
  export const ClientPostFileQueryParams = z.object({
174
174
  name: z.string().min(1).max(100).openapi({ example: 'file_name' }),
175
175
  category: z.string().max(50).openapi({ example: 'application' }),
176
176
  label: FileLabelsEnum.openapi({ example: FileLabels.OTHER }),
177
- targetId: individualIdSchema.openapi({
177
+ targetId: z.union([individualIdSchema, tradeIdSchema]).openapi({
178
178
  example: 'individual_01kcrsny60fb9rjc8bbqc3b80c',
179
179
  }),
180
180
  metadata: metadataSchema.nullable().optional(),
@@ -314,8 +314,23 @@ export const reviewFiles = z.object({
314
314
  });
315
315
  export type reviewFiles = z.infer<typeof reviewFiles>;
316
316
 
317
+ /**
318
+ * Zod preprocessor that trims strings and converts empty/whitespace-only strings to null
319
+ */
320
+ const trimAndNullifyString = z.preprocess((val) => {
321
+ if (typeof val === 'string') {
322
+ const trimmed = val.trim();
323
+ return trimmed === '' ? null : trimmed;
324
+ }
325
+ return val;
326
+ }, z.unknown());
327
+
317
328
  export const PatchFileMetadata = z.object({
318
- corrected: z.record(z.string(), z.unknown()),
329
+ corrected: z.record(z.string(), trimAndNullifyString),
330
+ expectedCorrected: z
331
+ .record(z.string(), trimAndNullifyString)
332
+ .nullable()
333
+ .optional(),
319
334
  });
320
335
  export type PatchFileMetadata = z.infer<typeof PatchFileMetadata>;
321
336
 
@@ -343,6 +358,7 @@ export const FileMetadataSchema = z.object({
343
358
  },
344
359
  ),
345
360
  corrected: z.record(z.any()).optional(),
361
+ expectedCorrected: z.record(z.any()).optional(),
346
362
  });
347
363
  export type FileMetadata = z.infer<typeof FileMetadataSchema>;
348
364
 
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { PortalType, TargetTableEnum } from './common.types';
3
+ import { TaskPriority, TaskType } from './task.types';
4
+
5
+ export enum IWillDoItLaterType {
6
+ KYC = 'KYC',
7
+ // Future types can be added here:
8
+ // AIC = 'AIC',
9
+ // AML = 'AML',
10
+ }
11
+
12
+ export const IWillDoItLaterBodySchema = z.object({
13
+ type: z.nativeEnum(IWillDoItLaterType).default(IWillDoItLaterType.KYC),
14
+ });
15
+
16
+ export type IWillDoItLaterBodyType = z.infer<typeof IWillDoItLaterBodySchema>;
17
+
18
+ export const IWillDoItLaterResponseSchema = z.object({
19
+ message: z.string(),
20
+ });
21
+
22
+ export type IWillDoItLaterResponseType = z.infer<
23
+ typeof IWillDoItLaterResponseSchema
24
+ >;
25
+
26
+ /**
27
+ * @description Context required for processing "I'll do it later" actions.
28
+ */
29
+ export interface IWillDoItLaterContext {
30
+ /** The ID of the target entity */
31
+ targetId: string;
32
+ /** The table name of the target entity */
33
+ targetTable: (typeof TargetTableEnum)[number];
34
+ /** The account ID associated with the action */
35
+ accountId: string;
36
+ /** The user ID who will be assigned the task */
37
+ assigneeId: string;
38
+ }
39
+
40
+ /**
41
+ * @description Configuration for each "I'll do it later" action type.
42
+ * Maps action types to their corresponding task configuration.
43
+ */
44
+ export interface IWillDoItLaterTaskConfig {
45
+ taskType: TaskType;
46
+ portalType: PortalType;
47
+ title: string;
48
+ description: string;
49
+ priority: TaskPriority;
50
+ }
51
+
52
+ /**
53
+ * @description Mapping of "I'll do it later" types to their task configurations.
54
+ * This allows for easy extension of new action types without modifying the service logic.
55
+ */
56
+ export const IWillDoItLaterTaskConfigMap: Record<
57
+ IWillDoItLaterType,
58
+ IWillDoItLaterTaskConfig
59
+ > = {
60
+ [IWillDoItLaterType.KYC]: {
61
+ taskType: TaskType.COMPLETE_KYC,
62
+ portalType: PortalType.INVESTOR,
63
+ title: 'Complete KYC',
64
+ description:
65
+ 'We are unable to verify your KYC information. Please complete your KYC.',
66
+ priority: TaskPriority.HIGH,
67
+ },
68
+ };
@@ -42,6 +42,8 @@ export * from './domain-filter.types';
42
42
  export * from './aic.types';
43
43
  export * from './default-theme-config.types';
44
44
  export * from './offering-reports.types';
45
+ export * from './i-will-do-it-later.types';
46
+ export * from './payment-methods.types';
45
47
 
46
48
  export enum Versions {
47
49
  V1 = 'v1',
@@ -12,12 +12,11 @@ import {
12
12
  InvestorAccountType,
13
13
  SetupStatusType,
14
14
  SetupStepType,
15
- ComplianceReview,
16
15
  RetirementAccountType,
17
- TradeStatus,
18
16
  EmploymentStatus,
19
17
  SourceOfIncome,
20
18
  AMLProvider,
19
+ EmailSchema,
21
20
  } from './common.types';
22
21
  import { IBaseEntity } from './entity.types';
23
22
  import { IInvestorAccount } from './investor-account.types';
@@ -60,8 +59,8 @@ export enum aicQuestionnaireQuestionType {
60
59
  }
61
60
 
62
61
  export enum FilterBy {
63
- TRADE = 'TRADE',
64
- INVESTOR = 'INVESTOR',
62
+ ALL = 'ALL',
63
+ PENDING_TRADES = 'PENDING_TRADES',
65
64
  }
66
65
 
67
66
  export const aicQuestionnaireQuestion = z.object({
@@ -243,17 +242,6 @@ export const IndividualFiltersZod = z.object({
243
242
 
244
243
  export const ComplianceIndividualFiltersZod = IndividualFiltersZod.extend({
245
244
  filterBy: z.nativeEnum(FilterBy).optional(),
246
- tradeStatus: z.nativeEnum(TradeStatus).optional(),
247
- complianceReview: z.nativeEnum(ComplianceReview).optional(),
248
- hasPendingTrades: z.preprocess(
249
- (val) =>
250
- val === 'true' || val === '1'
251
- ? true
252
- : val === 'false' || val === '0'
253
- ? false
254
- : val,
255
- z.boolean().optional(),
256
- ),
257
245
  });
258
246
 
259
247
  /**
@@ -301,7 +289,7 @@ export const PostIndividualBodySchema = z
301
289
  .string()
302
290
  .length(3, 'currencyCode must be 3 digits')
303
291
  .optional(),
304
- email: z.string().email().optional(),
292
+ email: EmailSchema.optional(),
305
293
  role: z.nativeEnum(IndividualRole),
306
294
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
307
295
  ownership: z.coerce
@@ -400,7 +388,7 @@ export const UpdateIndividualBodySchema = z
400
388
  .length(3, 'currencyCode must be 3 digits')
401
389
  .optional(),
402
390
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
403
- email: z.string().email().optional(),
391
+ email: EmailSchema.optional(),
404
392
  ownership: z.coerce
405
393
  .number()
406
394
  .min(0, 'Ownership is less than 0')
@@ -24,6 +24,7 @@ import {
24
24
  SortBy,
25
25
  SortOrder,
26
26
  AMLProvider,
27
+ EmailSchema,
27
28
  } from './common.types';
28
29
  import { accountIdSchema } from './account.types';
29
30
  import { SaStatus, tradeIdSchema, TradeZod } from './trade.types';
@@ -131,7 +132,7 @@ export type PostClientInvestorAccountBody = z.infer<
131
132
 
132
133
  export const UpdateInvestorAccountBodySchema = z.object({
133
134
  name: z.string().optional(),
134
- email: z.string().email().optional(),
135
+ email: EmailSchema.optional(),
135
136
  });
136
137
  export type UpdateInvestorAccountBody = z.infer<
137
138
  typeof UpdateInvestorAccountBodySchema
@@ -3,7 +3,9 @@ import {
3
3
  AccountZod,
4
4
  IPaginationMeta,
5
5
  IssuerRole,
6
+ PortalType,
6
7
  UserRole,
8
+ EmailSchema,
7
9
  } from './common.types';
8
10
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
9
11
  import { TypeID } from 'typeid-js';
@@ -48,7 +50,7 @@ export const InviteWithUrl = InviteWithoutSecretZod.extend({
48
50
  export type InviteWithUrl = z.infer<typeof InviteWithUrl>;
49
51
 
50
52
  export const PostIssuerInviteZod = z.object({
51
- email: z.string().email(),
53
+ email: EmailSchema,
52
54
  role: z.nativeEnum(IssuerRole),
53
55
  });
54
56
 
@@ -131,3 +133,27 @@ export const PatchInviteForComplianceZod = PatchInviteRoleZod.extend({
131
133
  export type PatchInviteForComplianceZod = z.infer<
132
134
  typeof PatchInviteForComplianceZod
133
135
  >;
136
+
137
+ export const PostInviteZod = z.object({
138
+ email: EmailSchema,
139
+ role: z.nativeEnum(UserRole).openapi({
140
+ example: UserRole.ADMIN,
141
+ }),
142
+ accountId: z.string().optional().openapi({
143
+ example: 'account_01j5y5ghx5fg68d663j1fvy2x7',
144
+ }),
145
+ portalType: z.nativeEnum(PortalType).optional().openapi({
146
+ example: PortalType.ISSUER,
147
+ }),
148
+ });
149
+
150
+ export type PostInviteZod = z.infer<typeof PostInviteZod>;
151
+
152
+ export const CompliancePostInviteZod = z.object({
153
+ email: EmailSchema,
154
+ role: z.nativeEnum(UserRole).openapi({
155
+ example: UserRole.ADMIN,
156
+ }),
157
+ });
158
+
159
+ export type CompliancePostInviteZod = z.infer<typeof CompliancePostInviteZod>;
@@ -8,10 +8,13 @@ import {
8
8
  ManagedByType,
9
9
  OfferingVersioningType,
10
10
  ComplianceReview,
11
+ DurationType,
12
+ AssetType,
13
+ StringToBooleanSchema,
11
14
  } from './common.types';
12
15
  import { IBaseEntity } from './entity.types';
13
16
  import { IIssuer, issuerIdSchema } from './issuer.types';
14
- import { IAsset } from './asset.types';
17
+ import { IAsset, postAssetRefinement, AssetTemplateType } from './asset.types';
15
18
  import { fileIdSchema, FileZod } from './file.types';
16
19
  import { accountIdSchema } from './account.types';
17
20
 
@@ -128,20 +131,60 @@ export const PostIssuerOffering = z
128
131
  .nullable()
129
132
  .openapi({ example: 'This is a description of the offering.' }),
130
133
  managedBy: z.nativeEnum(ManagedByType).optional(),
134
+ assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
135
+ assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
136
+ pricePerUnit: z
137
+ .number()
138
+ .min(0.01)
139
+ .max(10000000000)
140
+ .nullable()
141
+ .openapi({ example: 2000 }),
142
+ totalUnits: z
143
+ .number()
144
+ .min(1)
145
+ .max(10000000000)
146
+ .nullable()
147
+ .openapi({ example: 5200 }),
148
+ yield: z
149
+ .number()
150
+ .min(0.01)
151
+ .max(10000000000)
152
+ .nullable()
153
+ .optional()
154
+ .openapi({ example: 1200 }),
155
+ duration: z
156
+ .number()
157
+ .min(1)
158
+ .max(1000)
159
+ .nullable()
160
+ .optional()
161
+ .openapi({ example: 1 }),
162
+ durationType: z
163
+ .nativeEnum(DurationType)
164
+ .nullable()
165
+ .optional()
166
+ .openapi({ example: DurationType.DAY }),
167
+ template: z
168
+ .nativeEnum(AssetTemplateType)
169
+ .default(AssetTemplateType.STANDARD)
170
+ .openapi({ example: AssetTemplateType.STANDARD }),
171
+ tiers: z.array(z.number().positive()).nullable().optional(),
172
+ enableBonus: z.boolean().default(false).optional(),
131
173
  })
132
- .refine(
133
- (data) => {
134
- // Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
135
- if (data.minInvestment && data.maxInvestment) {
136
- return data.minInvestment < data.maxInvestment;
174
+ .superRefine((data, ctx) => {
175
+ // Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
176
+ if (data.minInvestment && data.maxInvestment) {
177
+ if (data.minInvestment >= data.maxInvestment) {
178
+ ctx.addIssue({
179
+ path: ['minInvestment'],
180
+ message: 'Minimum investment must be less than maximum investment.',
181
+ code: z.ZodIssueCode.custom,
182
+ });
137
183
  }
138
- return true; // If one or both values are undefined, skip this check
139
- },
140
- {
141
- message: 'Minimum investment must be less than maximum investment.',
142
- path: ['minInvestment'],
143
- },
144
- );
184
+ }
185
+ // Apply asset-specific refinements
186
+ postAssetRefinement(data, ctx);
187
+ });
145
188
 
146
189
  export type PostIssuerOffering = z.infer<typeof PostIssuerOffering>;
147
190
  export const PatchIssuerOffering = z.object({
@@ -151,38 +194,39 @@ export const PatchIssuerOffering = z.object({
151
194
  .max(100)
152
195
  .optional()
153
196
  .openapi({ example: 'Airbnb IPO' }),
197
+ type: z
198
+ .nativeEnum(OfferingType)
199
+ .optional()
200
+ .openapi({ example: OfferingType.REG_D }),
154
201
  targetAmount: z
155
202
  .number()
156
203
  .min(0)
157
204
  .max(10000000000)
158
205
  .optional()
159
206
  .openapi({ example: 120000 }),
160
- raiseAmount: z
161
- .number()
162
- .min(0)
163
- .max(10000000000)
164
- .optional()
165
- .openapi({ example: 200000 }),
166
207
  minInvestment: z
167
208
  .number()
168
209
  .min(0)
169
210
  .max(10000000000)
211
+ .nullable()
170
212
  .optional()
171
213
  .openapi({ example: 1000 }),
172
214
  maxInvestment: z
173
215
  .number()
174
216
  .min(0)
175
217
  .max(10000000000)
218
+ .nullable()
176
219
  .optional()
177
220
  .openapi({ example: 20000 }),
178
221
  contingencyAmount: z
179
222
  .number()
180
223
  .min(0)
181
224
  .max(10000000000)
225
+ .nullable()
182
226
  .optional()
183
227
  .openapi({ example: 5000 }),
184
- startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
185
- endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
228
+ startAt: dateSchema.nullable().optional().openapi({ example: '10/20/2024' }),
229
+ endAt: dateSchema.nullable().optional().openapi({ example: '10/27/2024' }),
186
230
  cancellationPeriod: z
187
231
  .number()
188
232
  .min(1)
@@ -212,6 +256,53 @@ export const PatchIssuerOffering = z.object({
212
256
  managedBy: z.nativeEnum(ManagedByType).optional(),
213
257
  showTotalRaised: z.boolean().optional(),
214
258
  issuerId: issuerIdSchema.optional(),
259
+ assetName: z.string().min(2).max(50).optional().openapi({ example: 'Z' }),
260
+ assetType: z
261
+ .nativeEnum(AssetType)
262
+ .optional()
263
+ .openapi({ example: AssetType.STOCK }),
264
+ pricePerUnit: z
265
+ .number()
266
+ .min(0.01)
267
+ .max(10000000000)
268
+ .nullable()
269
+ .optional()
270
+ .openapi({ example: 2000 }),
271
+ totalUnits: z
272
+ .number()
273
+ .min(1)
274
+ .max(10000000000)
275
+ .nullable()
276
+ .optional()
277
+ .openapi({ example: 5200 }),
278
+ yield: z
279
+ .number()
280
+ .min(0.01)
281
+ .max(10000000000)
282
+ .nullable()
283
+ .optional()
284
+ .openapi({ example: 1200 }),
285
+ duration: z
286
+ .number()
287
+ .min(1)
288
+ .max(1000)
289
+ .nullable()
290
+ .optional()
291
+ .openapi({ example: 1 }),
292
+ durationType: z
293
+ .nativeEnum(DurationType)
294
+ .nullable()
295
+ .optional()
296
+ .openapi({ example: DurationType.DAY }),
297
+ template: z
298
+ .nativeEnum(AssetTemplateType)
299
+ .default(AssetTemplateType.STANDARD)
300
+ .openapi({ example: AssetTemplateType.STANDARD })
301
+ .nullable()
302
+ .optional(),
303
+ tiers: z.array(z.number().positive()).nullable().optional(),
304
+ enabled: z.boolean().optional(),
305
+ enableBonus: z.boolean().optional(),
215
306
  });
216
307
  export type PatchIssuerOffering = z.infer<typeof PatchIssuerOffering>;
217
308
 
@@ -281,15 +372,7 @@ export const IssuerOfferingsFilterZod = z.object({
281
372
  issuerId: z.lazy(() => issuerIdSchema).optional(),
282
373
  type: z.nativeEnum(OfferingType).optional(),
283
374
  status: z.nativeEnum(ComplianceReview).optional(),
284
- enabled: z.preprocess(
285
- (val) =>
286
- val === 'true' || val === '1'
287
- ? true
288
- : val === 'false' || val === '0'
289
- ? false
290
- : val,
291
- z.boolean().optional(),
292
- ),
375
+ enabled: StringToBooleanSchema.optional(),
293
376
  managedBy: z.nativeEnum(ManagedByType).optional(),
294
377
  versioningType: z.nativeEnum(OfferingVersioningType).optional(),
295
378
  combinedStatus: z.nativeEnum(OfferingStatus).optional(),