@temboplus/tembo-dashboard 0.0.26-beta.4 → 0.0.26-beta.5

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.
@@ -1,4 +1,4 @@
1
- import { QueryBuilder } from "@/lib/query";
1
+ import { QueryBuilder } from "../../lib/query";
2
2
  import { PAYOUT_STATUS, PAYOUT_CHANNEL, PayoutFilters } from "./payout.types";
3
3
  /**
4
4
  * Payout-specific query builder that extends the base QueryBuilder
@@ -1,9 +1,9 @@
1
- import { BaseRepository, PaginationDTO } from "@/lib/api";
1
+ import { BaseRepository, PaginationDTO } from "../../lib/api";
2
2
  import { payoutContract } from "./payout.api-contract";
3
3
  import { Payout } from "./payout.model";
4
4
  import { PayoutQuery } from "./payout.query";
5
5
  import { PayoutFilters } from "./payout.types";
6
- import { TransactionSummary } from "@/lib/models";
6
+ import { TransactionSummary } from "../../lib/models";
7
7
  /**
8
8
  * Flexible query input type - supports the class, filters interface, URL params, etc.
9
9
  */
@@ -7,26 +7,53 @@ export declare const walletContract: {
7
7
  path: "";
8
8
  responses: {
9
9
  200: z.ZodArray<z.ZodObject<{
10
+ id: z.ZodString;
10
11
  accountNo: z.ZodString;
11
12
  accountName: z.ZodString;
13
+ shadowAccountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
16
  type: z.ZodString;
17
+ vendorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
18
  balance: z.ZodNumber;
19
+ minBalance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
20
+ approvalLimit: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
14
21
  currency: z.ZodString;
15
22
  countryCode: z.ZodString;
23
+ createdAt: z.ZodString;
24
+ updatedAt: z.ZodString;
16
25
  }, "strip", z.ZodTypeAny, {
17
26
  type: string;
27
+ createdAt: string;
18
28
  balance: number;
19
29
  accountName: string;
20
30
  accountNo: string;
31
+ id: string;
32
+ updatedAt: string;
21
33
  countryCode: string;
22
34
  currency: string;
35
+ minBalance: string | number;
36
+ approvalLimit: string | number;
37
+ reference?: string | null | undefined;
38
+ externalId?: string | null | undefined;
39
+ shadowAccountNo?: string | null | undefined;
40
+ vendorId?: string | null | undefined;
23
41
  }, {
24
42
  type: string;
43
+ createdAt: string;
25
44
  balance: number;
26
45
  accountName: string;
27
46
  accountNo: string;
47
+ id: string;
48
+ updatedAt: string;
28
49
  countryCode: string;
29
50
  currency: string;
51
+ minBalance: string | number;
52
+ approvalLimit: string | number;
53
+ reference?: string | null | undefined;
54
+ externalId?: string | null | undefined;
55
+ shadowAccountNo?: string | null | undefined;
56
+ vendorId?: string | null | undefined;
30
57
  }>, "many">;
31
58
  401: z.ZodObject<{
32
59
  reason: z.ZodOptional<z.ZodString>;
@@ -84,26 +111,53 @@ export declare const walletContract: {
84
111
  path: "/:accountNo";
85
112
  responses: {
86
113
  200: z.ZodObject<{
114
+ id: z.ZodString;
87
115
  accountNo: z.ZodString;
88
116
  accountName: z.ZodString;
117
+ shadowAccountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
118
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
120
  type: z.ZodString;
121
+ vendorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
122
  balance: z.ZodNumber;
123
+ minBalance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
124
+ approvalLimit: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
91
125
  currency: z.ZodString;
92
126
  countryCode: z.ZodString;
127
+ createdAt: z.ZodString;
128
+ updatedAt: z.ZodString;
93
129
  }, "strip", z.ZodTypeAny, {
94
130
  type: string;
131
+ createdAt: string;
95
132
  balance: number;
96
133
  accountName: string;
97
134
  accountNo: string;
135
+ id: string;
136
+ updatedAt: string;
98
137
  countryCode: string;
99
138
  currency: string;
139
+ minBalance: string | number;
140
+ approvalLimit: string | number;
141
+ reference?: string | null | undefined;
142
+ externalId?: string | null | undefined;
143
+ shadowAccountNo?: string | null | undefined;
144
+ vendorId?: string | null | undefined;
100
145
  }, {
101
146
  type: string;
147
+ createdAt: string;
102
148
  balance: number;
103
149
  accountName: string;
104
150
  accountNo: string;
151
+ id: string;
152
+ updatedAt: string;
105
153
  countryCode: string;
106
154
  currency: string;
155
+ minBalance: string | number;
156
+ approvalLimit: string | number;
157
+ reference?: string | null | undefined;
158
+ externalId?: string | null | undefined;
159
+ shadowAccountNo?: string | null | undefined;
160
+ vendorId?: string | null | undefined;
107
161
  }>;
108
162
  401: z.ZodObject<{
109
163
  reason: z.ZodOptional<z.ZodString>;
@@ -148,17 +202,17 @@ export declare const walletContract: {
148
202
  };
149
203
  };
150
204
  getWalletBalance: {
151
- summary: "Get wallet balance";
152
- description: "Retrieve the current and available balance for a specific wallet account number.";
153
- method: "POST";
154
- body: z.ZodObject<{
205
+ pathParams: z.ZodObject<{
155
206
  accountNo: z.ZodString;
156
207
  }, "strip", z.ZodTypeAny, {
157
208
  accountNo: string;
158
209
  }, {
159
210
  accountNo: string;
160
211
  }>;
161
- path: "/balance";
212
+ summary: "Get wallet balance";
213
+ description: "Retrieve the current and available balance for a specific wallet account number.";
214
+ method: "GET";
215
+ path: "/:accountNo/balance";
162
216
  responses: {
163
217
  200: z.ZodObject<{
164
218
  availableBalance: z.ZodNumber;
@@ -166,48 +220,19 @@ export declare const walletContract: {
166
220
  accountStatus: z.ZodString;
167
221
  accountNo: z.ZodString;
168
222
  accountName: z.ZodString;
169
- type: z.ZodString;
170
- currencyCode: z.ZodString;
171
- countryCode: z.ZodString;
172
223
  }, "strip", z.ZodTypeAny, {
173
- type: string;
174
224
  availableBalance: number;
175
225
  accountName: string;
176
226
  accountNo: string;
177
- currencyCode: string;
178
- countryCode: string;
179
227
  currentBalance: number;
180
228
  accountStatus: string;
181
229
  }, {
182
- type: string;
183
230
  availableBalance: number;
184
231
  accountName: string;
185
232
  accountNo: string;
186
- currencyCode: string;
187
- countryCode: string;
188
233
  currentBalance: number;
189
234
  accountStatus: string;
190
235
  }>;
191
- 400: z.ZodObject<{
192
- reason: z.ZodOptional<z.ZodString>;
193
- error: z.ZodOptional<z.ZodString>;
194
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
195
- message: z.ZodOptional<z.ZodString>;
196
- } & {
197
- statusCode: z.ZodLiteral<400>;
198
- }, "strip", z.ZodTypeAny, {
199
- statusCode: 400;
200
- message?: string | undefined;
201
- error?: string | undefined;
202
- details?: Record<string, unknown> | undefined;
203
- reason?: string | undefined;
204
- }, {
205
- statusCode: 400;
206
- message?: string | undefined;
207
- error?: string | undefined;
208
- details?: Record<string, unknown> | undefined;
209
- reason?: string | undefined;
210
- }>;
211
236
  401: z.ZodObject<{
212
237
  reason: z.ZodOptional<z.ZodString>;
213
238
  error: z.ZodOptional<z.ZodString>;
@@ -271,28 +296,33 @@ export declare const walletContract: {
271
296
  };
272
297
  };
273
298
  getWalletStatement: {
274
- summary: "Get wallet statement";
275
- description: "Retrieve statement entries for a specific wallet within a date range.";
276
- method: "POST";
277
- body: z.ZodObject<{
299
+ pathParams: z.ZodObject<{
278
300
  accountNo: z.ZodString;
301
+ }, "strip", z.ZodTypeAny, {
302
+ accountNo: string;
303
+ }, {
304
+ accountNo: string;
305
+ }>;
306
+ query: z.ZodObject<{
279
307
  startDate: z.ZodString;
280
308
  endDate: z.ZodString;
281
309
  }, "strip", z.ZodTypeAny, {
282
- accountNo: string;
283
310
  startDate: string;
284
311
  endDate: string;
285
312
  }, {
286
- accountNo: string;
287
313
  startDate: string;
288
314
  endDate: string;
289
315
  }>;
290
- path: "/statement";
316
+ summary: "Get wallet statement";
317
+ description: "Retrieve statement entries for a specific wallet within a date range.";
318
+ method: "GET";
319
+ path: "/:accountNo/statement";
291
320
  responses: {
292
321
  200: z.ZodArray<z.ZodObject<{
293
322
  accountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
294
323
  debitOrCredit: z.ZodEnum<["CR", "DR"]>;
295
324
  tranRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
325
+ cbaRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
296
326
  narration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
327
  txnDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
298
328
  valueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
@@ -306,6 +336,7 @@ export declare const walletContract: {
306
336
  valueDate: string | null;
307
337
  accountNo?: string | null | undefined;
308
338
  tranRefNo?: string | null | undefined;
339
+ cbaRefNo?: string | null | undefined;
309
340
  narration?: string | null | undefined;
310
341
  amountCredited?: number | null | undefined;
311
342
  amountDebited?: number | null | undefined;
@@ -314,6 +345,7 @@ export declare const walletContract: {
314
345
  debitOrCredit: "CR" | "DR";
315
346
  accountNo?: string | null | undefined;
316
347
  tranRefNo?: string | null | undefined;
348
+ cbaRefNo?: string | null | undefined;
317
349
  narration?: string | null | undefined;
318
350
  txnDate?: string | null | undefined;
319
351
  valueDate?: string | null | undefined;
@@ -1,30 +1,58 @@
1
1
  import { Amount, AmountJson, CurrencyCode } from "@temboplus/frontend-core";
2
2
  export interface WalletData {
3
+ id: string;
3
4
  accountNo: string;
4
5
  accountName: string;
6
+ shadowAccountNo?: string | null;
7
+ externalId?: string | null;
8
+ reference?: string | null;
5
9
  type: string;
10
+ vendorId?: string | null;
6
11
  balance: number;
12
+ minBalance: number | string;
13
+ approvalLimit: number | string;
7
14
  currency: string;
8
15
  countryCode: string;
16
+ createdAt: string;
17
+ updatedAt: string;
9
18
  }
10
19
  export interface WalletJson {
20
+ id: string;
11
21
  accountNo: string;
12
22
  accountName: string;
23
+ shadowAccountNo?: string | null;
24
+ externalId?: string | null;
25
+ reference?: string | null;
13
26
  type: string;
27
+ vendorId?: string | null;
14
28
  balance: AmountJson;
29
+ minBalance: AmountJson;
30
+ approvalLimit: AmountJson;
15
31
  currency: CurrencyCode;
16
32
  countryCode: string;
33
+ createdAt: string;
34
+ updatedAt: string;
17
35
  }
18
36
  export declare class Wallet {
37
+ readonly id: string;
19
38
  readonly accountNo: string;
20
39
  readonly accountName: string;
40
+ readonly shadowAccountNo?: string | null;
41
+ readonly externalId?: string | null;
42
+ readonly reference?: string | null;
21
43
  readonly type: string;
44
+ readonly vendorId?: string | null;
22
45
  readonly balance: Amount;
46
+ readonly minBalance: Amount;
47
+ readonly approvalLimit: Amount;
23
48
  readonly currency: CurrencyCode;
24
49
  readonly countryCode: string;
50
+ readonly createdAt: Date;
51
+ readonly updatedAt: Date;
25
52
  private readonly _originalData;
26
53
  constructor(data: WalletData);
27
54
  getOriginalData(): Readonly<WalletData>;
55
+ private parseAmountValue;
28
56
  isCollectionWallet(): boolean;
29
57
  isDisbursementWallet(): boolean;
30
58
  isDefaultWallet(): boolean;
@@ -1,5 +1,5 @@
1
- import { BaseRepository } from "@/lib/api";
2
- import { StatementEntry, WalletInfo } from "@/lib/models";
1
+ import { BaseRepository } from "../../lib/api";
2
+ import { StatementEntry, WalletInfo } from "../../lib/models";
3
3
  import { Wallet } from "./wallet.model";
4
4
  import { walletContract } from "./wallet.api-contract";
5
5
  import { TransferRequestDTO, TransferResponseDTO } from "./wallet.types";
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export declare enum WALLET_TYPE {
3
+ VENDOR = "Vendor",
3
4
  DEFAULT_DISBURSEMENT = "DEFAULT DISBURSEMENT",
4
5
  DEFAULT_COLLECTION = "DEFAULT COLLECTION",
5
6
  COLLECTION = "COLLECTION",
@@ -7,29 +8,56 @@ export declare enum WALLET_TYPE {
7
8
  }
8
9
  export declare const WalletDTOSchemas: {
9
10
  wallet: z.ZodObject<{
11
+ id: z.ZodString;
10
12
  accountNo: z.ZodString;
11
13
  accountName: z.ZodString;
14
+ shadowAccountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
17
  type: z.ZodString;
18
+ vendorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
19
  balance: z.ZodNumber;
20
+ minBalance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
21
+ approvalLimit: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
14
22
  currency: z.ZodString;
15
23
  countryCode: z.ZodString;
24
+ createdAt: z.ZodString;
25
+ updatedAt: z.ZodString;
16
26
  }, "strip", z.ZodTypeAny, {
17
27
  type: string;
28
+ createdAt: string;
18
29
  balance: number;
19
30
  accountName: string;
20
31
  accountNo: string;
32
+ id: string;
33
+ updatedAt: string;
21
34
  countryCode: string;
22
35
  currency: string;
36
+ minBalance: string | number;
37
+ approvalLimit: string | number;
38
+ reference?: string | null | undefined;
39
+ externalId?: string | null | undefined;
40
+ shadowAccountNo?: string | null | undefined;
41
+ vendorId?: string | null | undefined;
23
42
  }, {
24
43
  type: string;
44
+ createdAt: string;
25
45
  balance: number;
26
46
  accountName: string;
27
47
  accountNo: string;
48
+ id: string;
49
+ updatedAt: string;
28
50
  countryCode: string;
29
51
  currency: string;
52
+ minBalance: string | number;
53
+ approvalLimit: string | number;
54
+ reference?: string | null | undefined;
55
+ externalId?: string | null | undefined;
56
+ shadowAccountNo?: string | null | undefined;
57
+ vendorId?: string | null | undefined;
30
58
  }>;
31
59
  walletType: z.ZodNativeEnum<typeof WALLET_TYPE>;
32
- walletBalanceRequest: z.ZodObject<{
60
+ walletPathParams: z.ZodObject<{
33
61
  accountNo: z.ZodString;
34
62
  }, "strip", z.ZodTypeAny, {
35
63
  accountNo: string;
@@ -42,38 +70,26 @@ export declare const WalletDTOSchemas: {
42
70
  accountStatus: z.ZodString;
43
71
  accountNo: z.ZodString;
44
72
  accountName: z.ZodString;
45
- type: z.ZodString;
46
- currencyCode: z.ZodString;
47
- countryCode: z.ZodString;
48
73
  }, "strip", z.ZodTypeAny, {
49
- type: string;
50
74
  availableBalance: number;
51
75
  accountName: string;
52
76
  accountNo: string;
53
- currencyCode: string;
54
- countryCode: string;
55
77
  currentBalance: number;
56
78
  accountStatus: string;
57
79
  }, {
58
- type: string;
59
80
  availableBalance: number;
60
81
  accountName: string;
61
82
  accountNo: string;
62
- currencyCode: string;
63
- countryCode: string;
64
83
  currentBalance: number;
65
84
  accountStatus: string;
66
85
  }>;
67
- walletStatementRequest: z.ZodObject<{
68
- accountNo: z.ZodString;
86
+ walletStatementQuery: z.ZodObject<{
69
87
  startDate: z.ZodString;
70
88
  endDate: z.ZodString;
71
89
  }, "strip", z.ZodTypeAny, {
72
- accountNo: string;
73
90
  startDate: string;
74
91
  endDate: string;
75
92
  }, {
76
- accountNo: string;
77
93
  startDate: string;
78
94
  endDate: string;
79
95
  }>;
@@ -120,8 +136,8 @@ export declare const WalletDTOSchemas: {
120
136
  }>;
121
137
  };
122
138
  export type WalletDTO = z.infer<typeof WalletDTOSchemas.wallet>;
123
- export type WalletBalanceRequestDTO = z.infer<typeof WalletDTOSchemas.walletBalanceRequest>;
139
+ export type WalletPathParamsDTO = z.infer<typeof WalletDTOSchemas.walletPathParams>;
124
140
  export type WalletBalanceDTO = z.infer<typeof WalletDTOSchemas.walletBalance>;
125
- export type WalletStatementRequestDTO = z.infer<typeof WalletDTOSchemas.walletStatementRequest>;
141
+ export type WalletStatementQueryDTO = z.infer<typeof WalletDTOSchemas.walletStatementQuery>;
126
142
  export type TransferRequestDTO = z.infer<typeof WalletDTOSchemas.transferRequest>;
127
143
  export type TransferResponseDTO = z.infer<typeof WalletDTOSchemas.transferResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/tembo-dashboard",
3
- "version": "0.0.26-beta.4",
3
+ "version": "0.0.26-beta.5",
4
4
  "description": "A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "scripts": {
20
- "build": "rollup -c rollup.config.js",
20
+ "build": "rollup -c rollup.config.js && tsc-alias -p tsconfig.json --outDir dist",
21
21
  "prepare": "npm run build",
22
22
  "dev": "npm run build -- --watch",
23
23
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -54,6 +54,7 @@
54
54
  "rollup": "^4.39.0",
55
55
  "ts-jest": "^29.3.1",
56
56
  "ts-node": "^10.9.2",
57
+ "tsc-alias": "^1.8.16",
57
58
  "typescript": "^5.8.3"
58
59
  },
59
60
  "dependencies": {