@dalmore/api-contracts 1.0.7 → 1.0.8

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 (138) hide show
  1. package/README.md +18 -2
  2. package/index.mjs +1 -4
  3. package/package.json +4 -4
  4. package/src/common/types/account-contact.types.ts +98 -0
  5. package/src/common/types/account-detail.types.ts +27 -0
  6. package/src/common/types/account-integration.types.ts +143 -0
  7. package/src/common/types/account-manager.types.ts +124 -0
  8. package/src/common/types/account.types.ts +296 -0
  9. package/src/common/types/activity.types.ts +274 -0
  10. package/src/common/types/address.spec.ts +203 -0
  11. package/src/common/types/address.types.ts +41 -0
  12. package/src/common/types/aic.types.ts +246 -0
  13. package/src/common/types/aml.types.ts +18 -0
  14. package/src/common/types/api-key-logs.types.ts +66 -0
  15. package/src/common/types/api-keys.types.ts +69 -0
  16. package/src/common/types/asset.types.ts +338 -0
  17. package/src/common/types/auth.types.ts +370 -0
  18. package/src/common/types/batch-jobs.types.ts +151 -0
  19. package/src/common/types/bonus-tier.types.ts +147 -0
  20. package/src/common/types/cart.types.ts +18 -0
  21. package/src/common/types/checklist-items.types.ts +70 -0
  22. package/src/common/types/checklist.types.ts +97 -0
  23. package/src/common/types/common.types.spec.ts +336 -0
  24. package/src/common/types/common.types.ts +1520 -0
  25. package/src/common/types/comply-advantage-api.types.ts +316 -0
  26. package/src/common/types/comply-advantage.types.ts +25 -0
  27. package/src/common/types/contact-us.types.ts +107 -0
  28. package/src/common/types/contract-helpers.ts +205 -0
  29. package/src/common/types/countries.types.ts +375 -0
  30. package/src/common/types/covered-person.types.ts +274 -0
  31. package/src/common/types/dashboard.types.ts +799 -0
  32. package/src/common/types/data-record.types.ts +325 -0
  33. package/src/common/types/data-room.types.ts +242 -0
  34. package/src/common/types/default-theme-config.types.ts +87 -0
  35. package/src/common/types/disbursement-adjustment.types.ts +32 -0
  36. package/src/common/types/disbursement-approval-user.types.ts +100 -0
  37. package/src/common/types/disbursement-review.types.ts +110 -0
  38. package/src/common/types/disbursement-transaction.types.ts +72 -0
  39. package/src/common/types/disbursements.types.ts +310 -0
  40. package/src/common/types/domain-filter.types.ts +55 -0
  41. package/src/common/types/email-theme.types.ts +442 -0
  42. package/src/common/types/entity.types.ts +15 -0
  43. package/src/common/types/error-responses.types.ts +135 -0
  44. package/src/common/types/escrow-account.types.ts +104 -0
  45. package/src/common/types/exchange-api-key.types.ts +121 -0
  46. package/src/common/types/exchange-import.types.ts +36 -0
  47. package/src/common/types/exchange-provider.types.ts +329 -0
  48. package/src/common/types/file.types.ts +461 -0
  49. package/src/common/types/files.types.spec.ts +154 -0
  50. package/src/common/types/health.types.ts +29 -0
  51. package/src/common/types/index.ts +48 -0
  52. package/src/common/types/individuals.types.ts +554 -0
  53. package/src/common/types/investor-account.types.ts +1239 -0
  54. package/src/common/types/investorAccountIdSchema.type.ts +0 -0
  55. package/src/common/types/investors-offering.types.ts +65 -0
  56. package/src/common/types/invite.types.ts +133 -0
  57. package/src/common/types/issuer-bank-account.types.ts +107 -0
  58. package/src/common/types/issuer-offering.types.ts +306 -0
  59. package/src/common/types/issuer-payment-method.types.spec.ts +612 -0
  60. package/src/common/types/issuer-payment-method.types.ts +341 -0
  61. package/src/common/types/issuer.types.ts +312 -0
  62. package/src/common/types/job-item.types.ts +119 -0
  63. package/src/common/types/jobs.types.ts +171 -0
  64. package/src/common/types/kyb.types.ts +53 -0
  65. package/src/common/types/kyc.types.ts +188 -0
  66. package/src/common/types/legal-entity.types.ts +185 -0
  67. package/src/common/types/login-history.types.ts +46 -0
  68. package/src/common/types/mail-template.types.ts +436 -0
  69. package/src/common/types/north-cap-integration.types.ts +190 -0
  70. package/src/common/types/note.types.ts +109 -0
  71. package/src/common/types/notification.types.ts +58 -0
  72. package/src/common/types/notion-api.types.ts +374 -0
  73. package/src/common/types/notion-database.types.ts +125 -0
  74. package/src/common/types/notion-page.types.ts +267 -0
  75. package/src/common/types/offering-reports.types.ts +153 -0
  76. package/src/common/types/offering-submission.types.ts +314 -0
  77. package/src/common/types/offering.types.spec.ts +91 -0
  78. package/src/common/types/offering.types.ts +590 -0
  79. package/src/common/types/page-revision.types.ts +86 -0
  80. package/src/common/types/page.types.ts +436 -0
  81. package/src/common/types/password.type.ts +15 -0
  82. package/src/common/types/payment-methods.types.ts +298 -0
  83. package/src/common/types/phone.spec.ts +76 -0
  84. package/src/common/types/phone.type.ts +27 -0
  85. package/src/common/types/portfolio.types.ts +50 -0
  86. package/src/common/types/privacy-policy-and-tos.types.ts +231 -0
  87. package/src/common/types/queue.types.ts +112 -0
  88. package/src/common/types/registered-reps.types.ts +25 -0
  89. package/src/common/types/rejection-reasons.types.ts +56 -0
  90. package/src/common/types/reminder-config.types.ts +40 -0
  91. package/src/common/types/review.types.ts +133 -0
  92. package/src/common/types/role.types.ts +26 -0
  93. package/src/common/types/secondary-customer.types.ts +66 -0
  94. package/src/common/types/secondary-issuer.types.ts +50 -0
  95. package/src/common/types/secondary-order.types.ts +58 -0
  96. package/src/common/types/secondary-security.types.ts +60 -0
  97. package/src/common/types/secondary-trade.entity.ts +16 -0
  98. package/src/common/types/secondary-trade.types.ts +95 -0
  99. package/src/common/types/secure-request.types.ts +68 -0
  100. package/src/common/types/signer.types.ts +651 -0
  101. package/src/common/types/site-link.types.spec.ts +134 -0
  102. package/src/common/types/site-link.types.ts +166 -0
  103. package/src/common/types/site-settings.types.ts +726 -0
  104. package/src/common/types/site.types.ts +270 -0
  105. package/src/common/types/sms.types.ts +30 -0
  106. package/src/common/types/state-machine.types.ts +177 -0
  107. package/src/common/types/states.types.ts +163 -0
  108. package/src/common/types/subdoc-preview.types.ts +35 -0
  109. package/src/common/types/task.types.ts +258 -0
  110. package/src/common/types/trade-adjustment.type.ts +33 -0
  111. package/src/common/types/trade-line-item.type.ts +132 -0
  112. package/src/common/types/trade.types.ts +912 -0
  113. package/src/common/types/transaction.types.ts +198 -0
  114. package/src/common/types/trusted-contact.types.ts +122 -0
  115. package/src/common/types/typography.types.ts +75 -0
  116. package/src/common/types/user-manual.types.ts +290 -0
  117. package/src/common/types/user-setting.types.ts +133 -0
  118. package/src/common/types/user.types.ts +320 -0
  119. package/src/common/types/webhook.types.ts +588 -0
  120. package/src/common/types/zip.type.ts +36 -0
  121. package/src/contracts/clients/accounts/index.ts +61 -0
  122. package/src/contracts/clients/aic/index.ts +59 -0
  123. package/src/contracts/clients/api-key-logs/index.ts +53 -0
  124. package/src/contracts/clients/api-keys/index.ts +73 -0
  125. package/src/contracts/clients/assets/index.ts +102 -0
  126. package/src/contracts/clients/auth/index.ts +50 -0
  127. package/src/contracts/clients/files/index.ts +166 -0
  128. package/src/contracts/clients/files-public/index.ts +166 -0
  129. package/src/contracts/clients/index.ts +44 -0
  130. package/src/contracts/clients/individuals/index.ts +93 -0
  131. package/src/contracts/clients/investor-accounts/index.ts +93 -0
  132. package/src/contracts/clients/issuers/index.ts +94 -0
  133. package/src/contracts/clients/legal-entities/index.ts +93 -0
  134. package/src/contracts/clients/offerings/index.ts +117 -0
  135. package/src/contracts/clients/secure-requests/index.ts +34 -0
  136. package/src/contracts/clients/sites/index.ts +56 -0
  137. package/src/contracts/clients/trades/index.ts +122 -0
  138. package/dist/contracts/clients/index.d.ts +0 -19
@@ -0,0 +1,298 @@
1
+ import { TypeID } from 'typeid-js';
2
+ import { z } from 'zod';
3
+ import { CountryEnumSchema } from './countries.types';
4
+ import { userIdSchema } from './user.types';
5
+ import { PaymentMethodType } from './common.types';
6
+ // Re-export PaymentMethodType for backward compatibility
7
+ export { PaymentMethodType };
8
+
9
+ export const paymentMethodIdSchema = z.string().refine(
10
+ (value) => {
11
+ try {
12
+ const tid = TypeID.fromString(value);
13
+ return tid.getType() === 'payment_method';
14
+ } catch {
15
+ return false;
16
+ }
17
+ },
18
+ {
19
+ message: `Invalid payment_method ID format. Must be a valid TypeID with "payment_method" prefix. Example: payment_method_01j5y5ghx5fg68d663j1fvy2x7`,
20
+ },
21
+ );
22
+
23
+ export enum PaymentMethodProvider {
24
+ STRIPE = 'STRIPE',
25
+ PLAID = 'PLAID',
26
+ OTHER = 'OTHER',
27
+ }
28
+ export enum PaymentMethodStatus {
29
+ PENDING = 'PENDING',
30
+ VERIFIED = 'VERIFIED',
31
+ CANCELLED = 'CANCELLED',
32
+ ERRORED = 'ERRORED',
33
+ }
34
+
35
+ // https://docs.stripe.com/api/setup_intents/create
36
+ // https://docs.stripe.com/api/payment_methods/object#payment_method_object-type
37
+ export enum SetupIntentPaymentMethodType {
38
+ card = 'card',
39
+ us_bank_account = 'us_bank_account',
40
+ ach = 'ach', // ACH is not directly supported by Stripe but we add it here to differentiate between instant bank account
41
+ }
42
+
43
+ export const PostPaymentMethod = z.object({
44
+ paymentMethodType: z.nativeEnum(PaymentMethodType),
45
+ paymentMethodProvider: z.nativeEnum(PaymentMethodProvider),
46
+ status: z.nativeEnum(PaymentMethodStatus).optional(),
47
+ clientSecret: z.string().min(1).max(255).optional(),
48
+ tid: z.string(),
49
+ name: z
50
+ .string()
51
+ .min(2, 'name is less than 2 characters')
52
+ .max(30, 'name is more than 30 characters'),
53
+ last4: z.string().length(4, 'last4 shall be 4 characters'),
54
+ brand: z
55
+ .string()
56
+ .min(2, 'brand is less than 2 characters')
57
+ .max(30, 'brand is more than 30 characters')
58
+ .optional(),
59
+ country: CountryEnumSchema.optional(),
60
+ });
61
+ export type PostPaymentMethod = z.infer<typeof PostPaymentMethod>;
62
+
63
+ export const PostProviderPaymentMethod = z.object({
64
+ providerPaymentMethodId: z.string(),
65
+ paymentMethodType: z.enum([PaymentMethodType.BANK_ACCOUNT]),
66
+ clientSecret: z.string(),
67
+ });
68
+ export type PostProviderPaymentMethod = z.infer<
69
+ typeof PostProviderPaymentMethod
70
+ >;
71
+
72
+ export const CompliancePostPaymentMethod = PostPaymentMethod.omit({
73
+ tid: true,
74
+ }).extend({
75
+ tid: z.string().optional(),
76
+ userId: z.lazy(() => userIdSchema),
77
+ });
78
+
79
+ export const UpdatePaymentMethod = z.object({
80
+ paymentMethodType: z.nativeEnum(PaymentMethodType).optional(),
81
+ paymentMethodProvider: z.nativeEnum(PaymentMethodProvider).optional(),
82
+ status: z.nativeEnum(PaymentMethodStatus).optional(),
83
+ clientSecret: z.string().min(1).max(255).optional(),
84
+ tid: z.string().optional(),
85
+ name: z
86
+ .string()
87
+ .min(2, 'name is less than 2 characters')
88
+ .max(30, 'name is more than 30 characters')
89
+ .optional(),
90
+ last4: z.string().length(4, 'last4 shall be 4 characters').optional(),
91
+ brand: z
92
+ .string()
93
+ .min(2, 'brand is less than 2 characters')
94
+ .max(30, 'brand is more than 30 characters')
95
+ .optional(),
96
+ country: CountryEnumSchema.optional(),
97
+ });
98
+
99
+ export const PaymentMethodFilterQuery = z.object({
100
+ userId: z.lazy(() => userIdSchema).optional(),
101
+ });
102
+ export type PaymentMethodFilterQuery = z.infer<typeof PaymentMethodFilterQuery>;
103
+
104
+ export const PaymentMethodResponse = z.object({
105
+ id: paymentMethodIdSchema,
106
+ paymentMethodType: z.nativeEnum(PaymentMethodType),
107
+ paymentMethodProvider: z.nativeEnum(PaymentMethodProvider),
108
+ status: z.nativeEnum(PaymentMethodStatus),
109
+ clientSecret: z.string().nullable(),
110
+ tid: z.string().nullable(),
111
+ name: z.string(),
112
+ last4: z.string().nullable(),
113
+ brand: z.string().nullable(),
114
+ country: z.string().nullable(),
115
+ userId: z.string().nullable(),
116
+ });
117
+ export type PaymentMethodResponse = z.infer<typeof PaymentMethodResponse>;
118
+ export const PaymentMethodResponseArray = z.array(PaymentMethodResponse);
119
+
120
+ // https://docs.stripe.com/api/payment_intents/object#payment_intent_object-status
121
+ export enum StripePaymentIntentStatus {
122
+ SUCCEEDED = 'succeeded',
123
+ REQUIRES_PAYMENT_METHOD = 'requires_payment_method',
124
+ REQUIRES_CONFIRMATION = 'requires_confirmation',
125
+ REQUIRES_ACTION = 'requires_action',
126
+ REQUIRES_CAPTURE = 'requires_capture',
127
+ PROCESSING = 'processing',
128
+ CANCELED = 'canceled',
129
+ }
130
+
131
+ export const PaymentProviderResult = z.object({
132
+ id: z.string(),
133
+ amount: z.number(),
134
+ currency: z.string(),
135
+ provider: z.nativeEnum(PaymentMethodProvider),
136
+ created: z.date(),
137
+ status: z.nativeEnum(StripePaymentIntentStatus),
138
+ });
139
+ export type PaymentProviderResult = z.infer<typeof PaymentProviderResult>;
140
+
141
+ export const PostSetupIntentBody = z.object({
142
+ paymentMethodType: z.nativeEnum(SetupIntentPaymentMethodType),
143
+ });
144
+ export type PostSetupIntentBody = z.infer<typeof PostSetupIntentBody>;
145
+
146
+ export const SetupIntentResponse = z.object({
147
+ id: z.string(),
148
+ object: z.literal('setup_intent'),
149
+ application: z.string().nullable(),
150
+ cancellation_reason: z.string().nullable(),
151
+ client_secret: z.string(),
152
+ created: z.number(),
153
+ customer: z.string().nullable(),
154
+ description: z.string().nullable(),
155
+ flow_directions: z.string().nullable(),
156
+ last_setup_error: z.string().nullable(),
157
+ latest_attempt: z.string().nullable(),
158
+ livemode: z.boolean(),
159
+ mandate: z.string().nullable(),
160
+ metadata: z.record(z.any()),
161
+ next_action: z.string().nullable(),
162
+ on_behalf_of: z.string().nullable(),
163
+ payment_method: z.string().nullable(),
164
+ payment_method_options: z.object({
165
+ card: z.object({
166
+ mandate_options: z.string().nullable(),
167
+ network: z.string().nullable(),
168
+ request_three_d_secure: z.string(),
169
+ }),
170
+ }),
171
+ payment_method_types: z.array(z.string()),
172
+ single_use_mandate: z.string().nullable(),
173
+ status: z.string(),
174
+ usage: z.string(),
175
+ });
176
+ export type SetupIntentResponse = z.infer<typeof SetupIntentResponse>;
177
+
178
+ export const StripePaymentMethod = z.object({
179
+ id: z.string(),
180
+ object: z.string(),
181
+ billing_details: z.object({
182
+ address: z.object({
183
+ city: z.string().nullable(),
184
+ country: z.string().nullable(),
185
+ line1: z.string().nullable(),
186
+ line2: z.string().nullable(),
187
+ postal_code: z.string().nullable(),
188
+ state: z.string().nullable(),
189
+ }),
190
+ email: z.string(),
191
+ name: z.string(),
192
+ phone: z.string().nullable(),
193
+ tax_id: z.string().nullable(),
194
+ }),
195
+ card: z
196
+ .object({
197
+ brand: z.string(),
198
+ checks: z.object({
199
+ address_line1_check: z.string().nullable(),
200
+ address_postal_code_check: z.string().nullable(),
201
+ cvc_check: z.string().nullable(),
202
+ }),
203
+ country: z.string(),
204
+ exp_month: z.number().nullable(),
205
+ exp_year: z.number().nullable(),
206
+ fingerprint: z.string().nullable(),
207
+ funding: z.string().nullable(),
208
+ generated_from: z.string().nullable(),
209
+ last4: z.string(),
210
+ networks: z.object({
211
+ available: z.array(z.string()),
212
+ preferred: z.string().nullable(),
213
+ }),
214
+ three_d_secure_usage: z.object({ supported: z.boolean() }),
215
+ wallet: z.string().nullable(),
216
+ })
217
+ .nullable(),
218
+ us_bank_account: z.object({
219
+ account_holder_type: z.string(),
220
+ account_type: z.string(),
221
+ bank_name: z.string(),
222
+ financial_connections_account: z.string(),
223
+ fingerprint: z.string(),
224
+ last4: z.string(),
225
+ networks: z.object({
226
+ preferred: z.string().nullable(),
227
+ supported: z.array(z.string()),
228
+ }),
229
+ routing_number: z.string(),
230
+ status_details: z.object({
231
+ reason: z.string().nullable(),
232
+ }),
233
+ }),
234
+ created: z.number(),
235
+ customer: z.string(),
236
+ livemode: z.boolean(),
237
+ metadata: z.object({}),
238
+ redaction: z.string().nullable(),
239
+ type: z.string(),
240
+ });
241
+ export type StripePaymentMethod = z.infer<typeof StripePaymentMethod>;
242
+
243
+ export const StripeConnectedAccountZod = z.object({
244
+ id: z.string(),
245
+ name: z.string(),
246
+ });
247
+ export type StripeConnectedAccountZod = z.infer<
248
+ typeof StripeConnectedAccountZod
249
+ >;
250
+
251
+ // Stripe Connect Account Management Types
252
+ // https://docs.stripe.com/api/accounts/create
253
+ export enum StripeBusinessType {
254
+ INDIVIDUAL = 'individual',
255
+ COMPANY = 'company',
256
+ GOVERNMENT_ENTITY = 'government_entity',
257
+ NON_PROFIT = 'non_profit',
258
+ }
259
+
260
+ export const CreateConnectedAccountDataZod = z.object({
261
+ email: z.string().email(),
262
+ businessType: z.nativeEnum(StripeBusinessType),
263
+ country: z.string().length(2).optional().default('US'),
264
+ companyName: z.string().optional(),
265
+ individualFirstName: z.string().optional(),
266
+ individualLastName: z.string().optional(),
267
+ });
268
+
269
+ export type CreateConnectedAccountData = z.infer<
270
+ typeof CreateConnectedAccountDataZod
271
+ >;
272
+
273
+ export const ConnectedAccountResponseZod = z.object({
274
+ id: z.string(),
275
+ email: z.string().optional(),
276
+ country: z.string(),
277
+ business_type: z.string().optional(),
278
+ charges_enabled: z.boolean(),
279
+ payouts_enabled: z.boolean(),
280
+ details_submitted: z.boolean(),
281
+ requirements: z.object({
282
+ currently_due: z.array(z.string()),
283
+ eventually_due: z.array(z.string()),
284
+ past_due: z.array(z.string()),
285
+ disabled_reason: z.string().nullable(),
286
+ }),
287
+ });
288
+
289
+ export type ConnectedAccountResponse = z.infer<
290
+ typeof ConnectedAccountResponseZod
291
+ >;
292
+
293
+ export const AccountLinkResponseZod = z.object({
294
+ url: z.string().url(),
295
+ expires_at: z.number(),
296
+ });
297
+
298
+ export type AccountLinkResponse = z.infer<typeof AccountLinkResponseZod>;
@@ -0,0 +1,76 @@
1
+ import { PhoneZodSchema } from './phone.type';
2
+
3
+ describe('PhoneSchema Tests', () => {
4
+ it('should pass if US phone is valid', () => {
5
+ const phone = '+1-212-456-7890';
6
+ const parseRes = PhoneZodSchema.safeParse(phone);
7
+
8
+ const result = parseRes.success;
9
+ expect(result).toBeTruthy();
10
+ });
11
+
12
+ it('should pass if EG phone is valid', () => {
13
+ const phone = '+201088511706';
14
+ const parseRes = PhoneZodSchema.safeParse(phone);
15
+
16
+ const result = parseRes.success;
17
+ expect(result).toBeTruthy();
18
+ });
19
+
20
+ it('should fail if EG phone is not valid', () => {
21
+ const phone = '+2010885101706';
22
+ const parseRes = PhoneZodSchema.safeParse(phone);
23
+
24
+ const result = parseRes.success;
25
+ expect(result).toBeFalsy();
26
+ });
27
+
28
+ it('should fail if phone is not valid', () => {
29
+ const phone = '+201706';
30
+ const parseRes = PhoneZodSchema.safeParse(phone);
31
+
32
+ const result = parseRes.success;
33
+ expect(result).toBeFalsy();
34
+ });
35
+
36
+ it('should not fail if phone is empty string', () => {
37
+ const phone = '';
38
+ const parseRes = PhoneZodSchema.safeParse(phone);
39
+
40
+ const result = parseRes.success;
41
+ expect(result).toBeTruthy();
42
+ });
43
+
44
+ it('should fail if phone is too long string', () => {
45
+ const phone = '+125055501990001';
46
+ const parseRes = PhoneZodSchema.safeParse(phone);
47
+
48
+ const result = parseRes.success;
49
+ expect(result).toBeFalsy();
50
+ });
51
+
52
+ it('should fail if phone contains letters', () => {
53
+ const phone = '+12505d50199';
54
+ const parseRes = PhoneZodSchema.safeParse(phone);
55
+
56
+ const result = parseRes.success;
57
+ expect(result).toBeFalsy();
58
+ });
59
+
60
+ it('should pass if US phone is valid', () => {
61
+ const phone = '+12505550199';
62
+ const parseRes = PhoneZodSchema.safeParse(phone);
63
+
64
+ const result = parseRes.success;
65
+ expect(result).toBeTruthy();
66
+ });
67
+
68
+ it('should pass if US phone is valid', () => {
69
+ const phone = '+12124567890';
70
+
71
+ const parseRes = PhoneZodSchema.safeParse(phone);
72
+
73
+ const result = parseRes.success;
74
+ expect(result).toBeTruthy();
75
+ });
76
+ });
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { normalizePhoneNumber } from './contract-helpers';
3
+ import { CountryCodes } from './countries.types';
4
+ import { CountryCode } from 'libphonenumber-js';
5
+ import { ok } from 'neverthrow';
6
+
7
+ export const PhoneZodSchema = z
8
+ .string()
9
+ .nullable()
10
+ .transform((phone) => {
11
+ if (phone === null || phone === '') return ok(null); // Allow null values
12
+ let result!: ReturnType<typeof normalizePhoneNumber>;
13
+ for (const code of CountryCodes) {
14
+ if (result && result.isOk()) break;
15
+ result = normalizePhoneNumber(phone, code as CountryCode);
16
+ }
17
+
18
+ return result;
19
+ })
20
+ .refine((result) => result.isOk(), { message: 'phone is not valid' })
21
+ .transform((result) => {
22
+ if (result.isErr()) return ''; // the condition shall always evaluate to false!, it just calms TS :)
23
+ const parsedPhoneNumber = result?.value;
24
+ if (parsedPhoneNumber === null) return '';
25
+ const phone = parsedPhoneNumber.number.toString();
26
+ return phone;
27
+ });
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { AssetType, InvestorAccountType, TradeStatus } from './common.types';
3
+
4
+ export const PortfolioResponse = z.object({
5
+ totalAmount: z.string(),
6
+ id: z.string(),
7
+ type: z.nativeEnum(InvestorAccountType),
8
+ name: z.string(),
9
+ });
10
+
11
+ export type PortfolioResponse = z.infer<typeof PortfolioResponse>;
12
+ export const PortfolioResponseList = z.object({
13
+ totalAmount: z.number().default(0),
14
+ portfollios: z.array(PortfolioResponse),
15
+ });
16
+ export type PortfolioResponseList = z.infer<typeof PortfolioResponseList>;
17
+
18
+ export const AccountPortfolio = z.object({
19
+ totalAmount: z.string(),
20
+ id: z.string(),
21
+ name: z.string(),
22
+ description: z.string().nullable(),
23
+ type: z.nativeEnum(AssetType),
24
+ accountTotalAmount: z.string(),
25
+ percentage: z.string(),
26
+ });
27
+
28
+ export type AccountPortfolio = z.infer<typeof AccountPortfolio>;
29
+
30
+ export const AccountPortfolioResponse = z.object({
31
+ totalAmount: z.number().default(0),
32
+ portfollios: z.array(AccountPortfolio),
33
+ });
34
+ export type AccountPortfolioResponse = z.infer<typeof AccountPortfolioResponse>;
35
+
36
+ export const TradeStatusBreakdown = z.object({
37
+ tradeStatus: z.nativeEnum(TradeStatus),
38
+ count: z.number(),
39
+ amount: z.number(),
40
+ percentage: z.string(),
41
+ });
42
+ export type TradeStatusBreakdown = z.infer<typeof TradeStatusBreakdown>;
43
+
44
+ export const TradeStatusBreakdownResponse = z.object({
45
+ totalAmount: z.number(),
46
+ tradeStatusBreakdown: z.array(TradeStatusBreakdown),
47
+ });
48
+ export type TradeStatusBreakdownResponse = z.infer<
49
+ typeof TradeStatusBreakdownResponse
50
+ >;