@temboplus/tembo-dashboard 0.0.1

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 (35) hide show
  1. package/README.md +130 -0
  2. package/dist/index.cjs.js +2 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.esm.js +2 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/lib/api/base-repository.d.ts +168 -0
  8. package/dist/lib/api/common-schemas.d.ts +115 -0
  9. package/dist/lib/api/index.d.ts +2 -0
  10. package/dist/lib/error/error.api.d.ts +62 -0
  11. package/dist/lib/error/index.d.ts +1 -0
  12. package/dist/lib/models/index.d.ts +2 -0
  13. package/dist/lib/models/transaction-summary.model.d.ts +22 -0
  14. package/dist/lib/models/wallet-info.model.d.ts +17 -0
  15. package/dist/lib/query/index.d.ts +2 -0
  16. package/dist/lib/query/query.builder.d.ts +65 -0
  17. package/dist/lib/query/query.types.d.ts +36 -0
  18. package/dist/modules/auth/auth.api-contract.d.ts +52 -0
  19. package/dist/modules/auth/auth.dtos.d.ts +31 -0
  20. package/dist/modules/auth/auth.repository.d.ts +17 -0
  21. package/dist/modules/auth/index.d.ts +4 -0
  22. package/dist/modules/auth/user.model.d.ts +48 -0
  23. package/dist/modules/collection/collection.api-contract.d.ts +385 -0
  24. package/dist/modules/collection/collection.dtos.d.ts +195 -0
  25. package/dist/modules/collection/collection.model.d.ts +145 -0
  26. package/dist/modules/collection/collection.query-builder.d.ts +18 -0
  27. package/dist/modules/collection/collection.repository.d.ts +38 -0
  28. package/dist/modules/collection/index.d.ts +5 -0
  29. package/dist/modules/payout/index.d.ts +5 -0
  30. package/dist/modules/payout/payout.api-contract.d.ts +427 -0
  31. package/dist/modules/payout/payout.dtos.d.ts +188 -0
  32. package/dist/modules/payout/payout.model.d.ts +156 -0
  33. package/dist/modules/payout/payout.query-builder.d.ts +15 -0
  34. package/dist/modules/payout/payout.repository.d.ts +34 -0
  35. package/package.json +60 -0
@@ -0,0 +1,156 @@
1
+ import { Amount, AmountJson, Bank } from "@temboplus/frontend-core";
2
+ import { BANK_PAYOUT_CHANNEL, MOBILE_PAYOUT_CHANNEL, PAYOUT_CHANNEL, PAYOUT_STATUS } from "./payout.dtos";
3
+ export interface PayoutStatusInfo {
4
+ label: string;
5
+ description: string;
6
+ category: "success" | "pending" | "failed";
7
+ color: "success" | "warning" | "error";
8
+ userFriendlyMessage: string;
9
+ }
10
+ export declare const PAYOUT_STATUS_INFO: Record<PAYOUT_STATUS, PayoutStatusInfo>;
11
+ export interface MobileChannelInfo {
12
+ networkOperator: string;
13
+ serviceName: string;
14
+ }
15
+ export declare const MOBILE_CHANNEL_INFO: Record<MOBILE_PAYOUT_CHANNEL, MobileChannelInfo>;
16
+ export declare function isMobileChannel(channel: PAYOUT_CHANNEL): channel is MOBILE_PAYOUT_CHANNEL;
17
+ export declare function isBankChannel(channel: PAYOUT_CHANNEL): channel is BANK_PAYOUT_CHANNEL;
18
+ export declare function getFailedStatuses(): PAYOUT_STATUS[];
19
+ export interface PayoutData {
20
+ id: string;
21
+ serviceCode: PAYOUT_CHANNEL;
22
+ msisdn: string;
23
+ amount: number;
24
+ transactionDate: string;
25
+ statusDescription: string;
26
+ statusCodeText: PAYOUT_STATUS;
27
+ transactionId: string;
28
+ transactionRef: string;
29
+ recipientNames?: string;
30
+ narration: string;
31
+ serviceFee?: number;
32
+ notes?: string;
33
+ swiftCode?: string;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ statusCode: string;
37
+ countryCode: string;
38
+ postedAmount?: string;
39
+ walletId?: string;
40
+ currencyCode: string;
41
+ externalId?: string | null;
42
+ cbaReferenceNo?: string;
43
+ beepTransactionId?: string;
44
+ receiptNumber?: string;
45
+ reversedTransactionId?: string | null;
46
+ serviceFeeTransactionId?: string;
47
+ isReconciled?: number;
48
+ requestId?: string;
49
+ }
50
+ export interface PayoutJson {
51
+ id: string;
52
+ serviceCode: PAYOUT_CHANNEL;
53
+ msisdn: string;
54
+ amount: AmountJson;
55
+ transactionDate: string;
56
+ statusDescription: string;
57
+ statusCodeText: PAYOUT_STATUS;
58
+ transactionId: string;
59
+ transactionRef: string;
60
+ recipientNames?: string;
61
+ narration: string;
62
+ serviceFee?: AmountJson;
63
+ notes?: string;
64
+ swiftCode?: string;
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ statusCode: string;
68
+ countryCode: string;
69
+ postedAmount?: AmountJson;
70
+ walletId?: string;
71
+ currencyCode: string;
72
+ externalId?: string | null;
73
+ cbaReferenceNo?: string;
74
+ beepTransactionId?: string;
75
+ receiptNumber?: string;
76
+ reversedTransactionId?: string | null;
77
+ serviceFeeTransactionId?: string;
78
+ isReconciled?: number;
79
+ requestId?: string;
80
+ }
81
+ /**
82
+ * Represents a payout transaction
83
+ */
84
+ export declare class Payout {
85
+ readonly id: string;
86
+ readonly serviceCode: PAYOUT_CHANNEL;
87
+ readonly msisdn: string;
88
+ readonly amount: Amount;
89
+ readonly transactionDate: Date;
90
+ readonly statusDescription: string;
91
+ readonly statusCodeText: PAYOUT_STATUS;
92
+ readonly transactionId: string;
93
+ readonly transactionRef: string;
94
+ readonly recipientNames?: string;
95
+ readonly narration: string;
96
+ readonly serviceFee?: Amount;
97
+ readonly notes?: string;
98
+ readonly swiftCode?: string;
99
+ readonly createdAt: Date;
100
+ readonly updatedAt: Date;
101
+ readonly statusCode: string;
102
+ readonly countryCode: string;
103
+ readonly postedAmount?: Amount;
104
+ readonly walletId?: string;
105
+ readonly currencyCode: string;
106
+ readonly externalId?: string | null;
107
+ readonly cbaReferenceNo?: string;
108
+ readonly beepTransactionId?: string;
109
+ readonly receiptNumber?: string;
110
+ readonly reversedTransactionId?: string | null;
111
+ readonly serviceFeeTransactionId?: string;
112
+ readonly isReconciled?: number;
113
+ readonly requestId?: string;
114
+ constructor(data: PayoutData);
115
+ /**
116
+ * Check if payout is pending
117
+ */
118
+ isPending(): boolean;
119
+ /**
120
+ * Check if payout was successful
121
+ */
122
+ isSuccessful(): boolean;
123
+ /**
124
+ * Check if payout failed
125
+ */
126
+ isFailed(): boolean;
127
+ /**
128
+ * Get status color and label
129
+ */
130
+ getStatusInfo(): PayoutStatusInfo;
131
+ /**
132
+ * Get channel information with bank detection for bank transfers
133
+ */
134
+ getChannelInfo(): MobileChannelInfo | Bank | undefined;
135
+ /**
136
+ * Get provider name from channel
137
+ */
138
+ getProviderName(): string;
139
+ /**
140
+ * Create Payout instance from raw API data
141
+ */
142
+ static from(data: any): Payout | undefined;
143
+ static createMany(dataArray: any[]): Payout[];
144
+ /**
145
+ * Create Payout instance from JSON representation (with Amount objects serialized)
146
+ */
147
+ static fromJson(json: PayoutJson): Payout | undefined;
148
+ /**
149
+ * Create multiple Payout instances from JSON array
150
+ */
151
+ static createManyFromJson(jsonArray: PayoutJson[]): Payout[];
152
+ /**
153
+ * Convert to JSON representation with proper typing
154
+ */
155
+ toJson(): PayoutJson;
156
+ }
@@ -0,0 +1,15 @@
1
+ import { QueryBuilder } from "@/lib/query";
2
+ import { PAYOUT_STATUS, PAYOUT_CHANNEL, PayoutQueryParamsDTO } from "./payout.dtos";
3
+ /**
4
+ * Specialized query builder for payout queries
5
+ */
6
+ export declare class PayoutQueryBuilder extends QueryBuilder {
7
+ whereStatus(status: PAYOUT_STATUS): this;
8
+ whereChannel(channel: PAYOUT_CHANNEL): this;
9
+ wherePending(): this;
10
+ whereSuccessful(): this;
11
+ whereFailed(): this;
12
+ whereAmountBetween(min: number, max: number): this;
13
+ whereRecipient(msisdn: string): this;
14
+ toPayoutQuery(): PayoutQueryParamsDTO;
15
+ }
@@ -0,0 +1,34 @@
1
+ import { BaseRepository, PaginationDTO } from "@/lib/api";
2
+ import { payoutContract } from "./payout.api-contract";
3
+ import { type PayoutQueryParamsDTO } from "./payout.dtos";
4
+ import { Payout } from "./payout.model";
5
+ import { WalletInfo, TransactionSummary } from "@/lib/models";
6
+ /**
7
+ * Repository class for managing payouts through API interactions.
8
+ * Handles payout operations, filtering, and transaction management.
9
+ */
10
+ export declare class PayoutRepository extends BaseRepository<typeof payoutContract> {
11
+ constructor(options?: {
12
+ token?: string;
13
+ root?: string;
14
+ });
15
+ /**
16
+ * Get all payouts with filtering and pagination
17
+ */
18
+ getPayouts(query?: PayoutQueryParamsDTO): Promise<{
19
+ payouts: Payout[];
20
+ pagination: PaginationDTO;
21
+ }>;
22
+ /**
23
+ * Get a specific payout by ID
24
+ */
25
+ getPayout(id: string): Promise<Payout>;
26
+ /**
27
+ * Get payout summary statistics
28
+ */
29
+ getPayoutSummary(): Promise<TransactionSummary>;
30
+ /**
31
+ * Get account balance and status information
32
+ */
33
+ getAccountBalance(): Promise<WalletInfo>;
34
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@temboplus/tembo-dashboard",
3
+ "version": "0.0.1",
4
+ "description": "A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.",
5
+ "main": "./dist/index.cjs.js",
6
+ "module": "./dist/index.esm.js",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.cjs.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "rollup -c rollup.config.js",
21
+ "prepare": "npm run build",
22
+ "dev": "npm run build -- --watch",
23
+ "test": "echo \"Error: no test specified\" && exit 1"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/TemboPlus-Frontend/tembo-dashboard-js.git"
28
+ },
29
+ "keywords": [
30
+ "temboplus",
31
+ "tembo-dashboard"
32
+ ],
33
+ "author": "Okello Gerald",
34
+ "license": "MIT",
35
+ "bugs": {
36
+ "url": "https://github.com/TemboPlus-Frontend/tembo-dashboard-js/issues"
37
+ },
38
+ "homepage": "https://github.com/TemboPlus-Frontend/tembo-dashboard-js#readme",
39
+ "peerDependencies": {
40
+ "@temboplus/frontend-core": "^0.2.11",
41
+ "@ts-rest/core": "^3.52.1",
42
+ "tslib": "^2.8.1",
43
+ "uuid": "^11.1.0",
44
+ "zod": "^3.24.2"
45
+ },
46
+ "devDependencies": {
47
+ "@rollup/plugin-alias": "^5.1.1",
48
+ "@rollup/plugin-commonjs": "^28.0.3",
49
+ "@rollup/plugin-json": "^6.1.0",
50
+ "@rollup/plugin-node-resolve": "^16.0.1",
51
+ "@rollup/plugin-terser": "^0.4.4",
52
+ "@rollup/plugin-typescript": "^12.1.3",
53
+ "@types/jest": "^29.5.14",
54
+ "jest": "^29.7.0",
55
+ "rollup": "^4.39.0",
56
+ "ts-jest": "^29.3.1",
57
+ "ts-node": "^10.9.2",
58
+ "typescript": "^5.8.3"
59
+ }
60
+ }