@temboplus/afloat 0.1.13 → 0.1.31
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.
- package/esm/src/features/auth/access/contract.d.ts +14 -0
- package/esm/src/features/auth/access/contract.d.ts.map +1 -0
- package/esm/src/features/auth/access/contract.js +14 -0
- package/esm/src/features/auth/contract.d.ts +20 -20
- package/esm/src/features/auth/contract.js +2 -2
- package/esm/src/features/auth/identity/contract.d.ts +0 -7
- package/esm/src/features/auth/identity/contract.d.ts.map +1 -1
- package/esm/src/features/auth/identity/contract.js +0 -1
- package/esm/src/features/auth/identity/repository.d.ts +2 -2
- package/esm/src/features/auth/identity/repository.d.ts.map +1 -1
- package/esm/src/features/auth/identity/repository.js +5 -5
- package/esm/src/features/auth/manager.js +1 -1
- package/esm/src/features/auth/profile/contract.d.ts +17 -25
- package/esm/src/features/auth/profile/contract.d.ts.map +1 -1
- package/esm/src/features/auth/profile/contract.js +2 -4
- package/esm/src/features/auth/repository.d.ts +0 -1
- package/esm/src/features/auth/repository.d.ts.map +1 -1
- package/esm/src/features/auth/repository.js +3 -11
- package/esm/src/features/auth/storage/server_token_handler.d.ts +7 -6
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
- package/esm/src/features/auth/storage/server_token_handler.js +73 -26
- package/esm/src/features/contact/contract.d.ts +10 -10
- package/esm/src/features/payout/contract.d.ts +16 -16
- package/esm/src/features/wallet/contract.d.ts +3 -6
- package/esm/src/features/wallet/contract.d.ts.map +1 -1
- package/esm/src/features/wallet/repository.d.ts +1 -28
- package/esm/src/features/wallet/repository.d.ts.map +1 -1
- package/esm/src/features/wallet/repository.js +0 -51
- package/esm/src/models/contact/derivatives/contact.js +2 -2
- package/esm/src/models/contact/derivatives/contact_info.d.ts +8 -8
- package/esm/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
- package/esm/src/models/contact/derivatives/contact_info.js +12 -12
- package/esm/src/models/payout/channel.d.ts +4 -4
- package/esm/src/models/payout/channel.d.ts.map +1 -1
- package/esm/src/models/payout/channel.js +10 -3
- package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -1
- package/esm/src/models/payout/derivatives/payout.js +2 -2
- package/esm/src/models/payout/schemas.d.ts +2 -1
- package/esm/src/models/payout/schemas.d.ts.map +1 -1
- package/esm/src/models/payout/schemas.js +1 -0
- package/esm/src/models/payout/status.d.ts +1 -0
- package/esm/src/models/payout/status.d.ts.map +1 -1
- package/esm/src/models/payout/status.js +1 -0
- package/esm/src/models/user/profile.d.ts +135 -12
- package/esm/src/models/user/profile.d.ts.map +1 -1
- package/esm/src/models/user/profile.js +321 -12
- package/esm/src/models/user/user.d.ts +14 -17
- package/esm/src/models/user/user.d.ts.map +1 -1
- package/esm/src/models/user/user.js +109 -26
- package/esm/src/models/wallet/guards.d.ts.map +1 -1
- package/esm/src/models/wallet/guards.js +8 -2
- package/esm/src/models/wallet/index.d.ts +0 -1
- package/esm/src/models/wallet/index.d.ts.map +1 -1
- package/esm/src/models/wallet/index.js +0 -1
- package/esm/src/models/wallet/schemas.d.ts +1 -2
- package/esm/src/models/wallet/schemas.d.ts.map +1 -1
- package/esm/src/models/wallet/schemas.js +3 -12
- package/esm/src/shared/token_required_repository.d.ts +78 -0
- package/esm/src/shared/token_required_repository.d.ts.map +1 -0
- package/esm/src/shared/token_required_repository.js +128 -0
- package/package.json +7 -7
- package/script/src/features/auth/access/contract.d.ts +14 -0
- package/script/src/features/auth/access/contract.d.ts.map +1 -0
- package/script/src/features/auth/access/contract.js +17 -0
- package/script/src/features/auth/contract.d.ts +20 -20
- package/script/src/features/auth/contract.js +1 -1
- package/script/src/features/auth/identity/contract.d.ts +0 -7
- package/script/src/features/auth/identity/contract.d.ts.map +1 -1
- package/script/src/features/auth/identity/contract.js +0 -1
- package/script/src/features/auth/identity/repository.d.ts +2 -2
- package/script/src/features/auth/identity/repository.d.ts.map +1 -1
- package/script/src/features/auth/identity/repository.js +5 -5
- package/script/src/features/auth/manager.js +1 -1
- package/script/src/features/auth/profile/contract.d.ts +17 -25
- package/script/src/features/auth/profile/contract.d.ts.map +1 -1
- package/script/src/features/auth/profile/contract.js +1 -3
- package/script/src/features/auth/repository.d.ts +0 -1
- package/script/src/features/auth/repository.d.ts.map +1 -1
- package/script/src/features/auth/repository.js +3 -11
- package/script/src/features/auth/storage/server_token_handler.d.ts +7 -6
- package/script/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
- package/script/src/features/auth/storage/server_token_handler.js +72 -25
- package/script/src/features/contact/contract.d.ts +10 -10
- package/script/src/features/payout/contract.d.ts +16 -16
- package/script/src/features/wallet/contract.d.ts +3 -6
- package/script/src/features/wallet/contract.d.ts.map +1 -1
- package/script/src/features/wallet/repository.d.ts +1 -28
- package/script/src/features/wallet/repository.d.ts.map +1 -1
- package/script/src/features/wallet/repository.js +0 -51
- package/script/src/models/contact/derivatives/contact.js +1 -1
- package/script/src/models/contact/derivatives/contact_info.d.ts +8 -8
- package/script/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
- package/script/src/models/contact/derivatives/contact_info.js +11 -11
- package/script/src/models/payout/channel.d.ts +4 -4
- package/script/src/models/payout/channel.d.ts.map +1 -1
- package/script/src/models/payout/channel.js +10 -3
- package/script/src/models/payout/derivatives/payout.d.ts.map +1 -1
- package/script/src/models/payout/derivatives/payout.js +1 -1
- package/script/src/models/payout/schemas.d.ts +2 -1
- package/script/src/models/payout/schemas.d.ts.map +1 -1
- package/script/src/models/payout/schemas.js +1 -0
- package/script/src/models/payout/status.d.ts +1 -0
- package/script/src/models/payout/status.d.ts.map +1 -1
- package/script/src/models/payout/status.js +1 -0
- package/script/src/models/user/profile.d.ts +135 -12
- package/script/src/models/user/profile.d.ts.map +1 -1
- package/script/src/models/user/profile.js +323 -13
- package/script/src/models/user/user.d.ts +14 -17
- package/script/src/models/user/user.d.ts.map +1 -1
- package/script/src/models/user/user.js +109 -26
- package/script/src/models/wallet/guards.d.ts.map +1 -1
- package/script/src/models/wallet/guards.js +8 -2
- package/script/src/models/wallet/index.d.ts +0 -1
- package/script/src/models/wallet/index.d.ts.map +1 -1
- package/script/src/models/wallet/index.js +0 -1
- package/script/src/models/wallet/schemas.d.ts +1 -2
- package/script/src/models/wallet/schemas.d.ts.map +1 -1
- package/script/src/models/wallet/schemas.js +3 -12
- package/script/src/shared/token_required_repository.d.ts +78 -0
- package/script/src/shared/token_required_repository.d.ts.map +1 -0
- package/script/src/shared/token_required_repository.js +132 -0
- package/esm/src/features/auth/profile/repository.d.ts +0 -11
- package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
- package/esm/src/features/auth/profile/repository.js +0 -21
- package/esm/src/features/files-gen/contract.d.ts +0 -67
- package/esm/src/features/files-gen/contract.d.ts.map +0 -1
- package/esm/src/features/files-gen/contract.js +0 -40
- package/esm/src/features/files-gen/repository.d.ts +0 -50
- package/esm/src/features/files-gen/repository.d.ts.map +0 -1
- package/esm/src/features/files-gen/repository.js +0 -56
- package/esm/src/models/wallet/statement.d.ts +0 -27
- package/esm/src/models/wallet/statement.d.ts.map +0 -1
- package/esm/src/models/wallet/statement.js +0 -13
- package/script/src/features/auth/profile/repository.d.ts +0 -11
- package/script/src/features/auth/profile/repository.d.ts.map +0 -1
- package/script/src/features/auth/profile/repository.js +0 -25
- package/script/src/features/files-gen/contract.d.ts +0 -67
- package/script/src/features/files-gen/contract.d.ts.map +0 -1
- package/script/src/features/files-gen/contract.js +0 -43
- package/script/src/features/files-gen/repository.d.ts +0 -50
- package/script/src/features/files-gen/repository.d.ts.map +0 -1
- package/script/src/features/files-gen/repository.js +0 -60
- package/script/src/models/wallet/statement.d.ts +0 -27
- package/script/src/models/wallet/statement.d.ts.map +0 -1
- package/script/src/models/wallet/statement.js +0 -16
|
@@ -64,8 +64,7 @@ export declare const contract: {
|
|
|
64
64
|
path: "/statement";
|
|
65
65
|
responses: {
|
|
66
66
|
201: z.ZodArray<z.ZodObject<{
|
|
67
|
-
accountNo: z.
|
|
68
|
-
cbaRefNo: z.ZodEffects<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
accountNo: z.ZodString;
|
|
69
68
|
debitOrCredit: z.ZodString;
|
|
70
69
|
tranRefNo: z.ZodString;
|
|
71
70
|
narration: z.ZodString;
|
|
@@ -75,6 +74,7 @@ export declare const contract: {
|
|
|
75
74
|
amountDebited: z.ZodNumber;
|
|
76
75
|
balance: z.ZodNumber;
|
|
77
76
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
77
|
+
accountNo: string;
|
|
78
78
|
debitOrCredit: string;
|
|
79
79
|
tranRefNo: string;
|
|
80
80
|
narration: string;
|
|
@@ -83,9 +83,8 @@ export declare const contract: {
|
|
|
83
83
|
amountCredited: number;
|
|
84
84
|
amountDebited: number;
|
|
85
85
|
balance: number;
|
|
86
|
-
accountNo?: string | undefined;
|
|
87
|
-
cbaRefNo?: string | undefined;
|
|
88
86
|
}, {
|
|
87
|
+
accountNo: string;
|
|
89
88
|
debitOrCredit: string;
|
|
90
89
|
tranRefNo: string;
|
|
91
90
|
narration: string;
|
|
@@ -94,8 +93,6 @@ export declare const contract: {
|
|
|
94
93
|
amountCredited: number;
|
|
95
94
|
amountDebited: number;
|
|
96
95
|
balance: number;
|
|
97
|
-
accountNo?: string | undefined;
|
|
98
|
-
cbaRefNo?: string | undefined;
|
|
99
96
|
}>, "many">;
|
|
100
97
|
};
|
|
101
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepository } from "../../shared/base_repository.js";
|
|
2
2
|
import { contract } from "./contract.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Wallet, WalletStatementItem } from "../../models/wallet/index.js";
|
|
4
4
|
import type { AfloatAuth } from "../auth/manager.js";
|
|
5
5
|
/**
|
|
6
6
|
* Repository class for managing wallet operations including balance checking,
|
|
@@ -18,12 +18,6 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
|
|
|
18
18
|
root?: string;
|
|
19
19
|
auth?: AfloatAuth;
|
|
20
20
|
});
|
|
21
|
-
/**
|
|
22
|
-
* Gets an instance of the file generation repository.
|
|
23
|
-
* @private
|
|
24
|
-
* @returns {AfloatFilesRepo} A new instance of AfloatFilesRepo
|
|
25
|
-
*/
|
|
26
|
-
private get fileGenRepo();
|
|
27
21
|
/**
|
|
28
22
|
* Retrieves the current available balance for the wallet.
|
|
29
23
|
* @throws {PermissionError} If user lacks the ViewBalance permission
|
|
@@ -56,26 +50,5 @@ export declare class WalletRepo extends BaseRepository<typeof contract> {
|
|
|
56
50
|
};
|
|
57
51
|
accountNo?: string;
|
|
58
52
|
}): Promise<WalletStatementItem[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Generates a statement file for the specified period and account.
|
|
61
|
-
* @param {STATEMENT_OUTPUT_TYPE} fileType - The desired output format type for the statement
|
|
62
|
-
* @param {Object} props - The statement generation properties
|
|
63
|
-
* @param {Date} props.startDate - Start date for the statement period
|
|
64
|
-
* @param {Date} props.endDate - End date for the statement period
|
|
65
|
-
* @param {string} [props.accountNo] - Optional account number to generate statement for
|
|
66
|
-
* @throws {PermissionError} If user lacks the ViewStatement permission
|
|
67
|
-
* @returns {Promise<StatementFile>} The generated statement file
|
|
68
|
-
*/
|
|
69
|
-
genStatement(fileType: STATEMENT_OUTPUT_TYPE, props: {
|
|
70
|
-
startDate: Date;
|
|
71
|
-
endDate: Date;
|
|
72
|
-
accountNo?: string;
|
|
73
|
-
}): Promise<StatementFile>;
|
|
74
|
-
/**
|
|
75
|
-
* Generates a PDF containing detailed wallet account information.
|
|
76
|
-
* @throws {PermissionError} If user lacks the ViewBalance permission
|
|
77
|
-
* @returns {Promise<StatementFile>} The generated PDF file containing wallet details
|
|
78
|
-
*/
|
|
79
|
-
genWalletDetailsPDF(): Promise<StatementFile>;
|
|
80
53
|
}
|
|
81
54
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/wallet/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC;IAC7D;;;;;OAKG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE;IAOxD;;;;;OAKG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAoBnC;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAUrC;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE;YAAE,SAAS,EAAE,IAAI,CAAC;YAAC,OAAO,EAAE,IAAI,CAAA;SAAE,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,mBAAmB,EAAE,CAAC;CA2BlC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WalletRepo = void 0;
|
|
4
4
|
const base_repository_js_1 = require("../../shared/base_repository.js");
|
|
5
5
|
const contract_js_1 = require("./contract.js");
|
|
6
|
-
const repository_js_1 = require("../files-gen/repository.js");
|
|
7
6
|
const permission_js_1 = require("../../models/permission.js");
|
|
8
7
|
const index_js_1 = require("../../errors/index.js");
|
|
9
8
|
/**
|
|
@@ -24,14 +23,6 @@ class WalletRepo extends base_repository_js_1.BaseRepository {
|
|
|
24
23
|
auth: props?.auth,
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Gets an instance of the file generation repository.
|
|
29
|
-
* @private
|
|
30
|
-
* @returns {AfloatFilesRepo} A new instance of AfloatFilesRepo
|
|
31
|
-
*/
|
|
32
|
-
get fileGenRepo() {
|
|
33
|
-
return new repository_js_1.AfloatFilesRepo({ auth: this.auth });
|
|
34
|
-
}
|
|
35
26
|
/**
|
|
36
27
|
* Retrieves the current available balance for the wallet.
|
|
37
28
|
* @throws {PermissionError} If user lacks the ViewBalance permission
|
|
@@ -99,47 +90,5 @@ class WalletRepo extends base_repository_js_1.BaseRepository {
|
|
|
99
90
|
}
|
|
100
91
|
throw new Error("An error occured while fetching statement");
|
|
101
92
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Generates a statement file for the specified period and account.
|
|
104
|
-
* @param {STATEMENT_OUTPUT_TYPE} fileType - The desired output format type for the statement
|
|
105
|
-
* @param {Object} props - The statement generation properties
|
|
106
|
-
* @param {Date} props.startDate - Start date for the statement period
|
|
107
|
-
* @param {Date} props.endDate - End date for the statement period
|
|
108
|
-
* @param {string} [props.accountNo] - Optional account number to generate statement for
|
|
109
|
-
* @throws {PermissionError} If user lacks the ViewStatement permission
|
|
110
|
-
* @returns {Promise<StatementFile>} The generated statement file
|
|
111
|
-
*/
|
|
112
|
-
async genStatement(fileType, props) {
|
|
113
|
-
const auth = this.getAuthForPermissionCheck();
|
|
114
|
-
const requirePerm = permission_js_1.Permissions.Wallet.ViewStatement;
|
|
115
|
-
if (!auth.checkPermission(requirePerm)) {
|
|
116
|
-
throw new index_js_1.PermissionError({
|
|
117
|
-
message: "You are not authorized to view the statement.",
|
|
118
|
-
requiredPermissions: [requirePerm],
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return await this.fileGenRepo.downloadStatement({
|
|
122
|
-
start_date: props.startDate,
|
|
123
|
-
end_date: props.endDate,
|
|
124
|
-
return_file_type: fileType,
|
|
125
|
-
account_no: props.accountNo,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Generates a PDF containing detailed wallet account information.
|
|
130
|
-
* @throws {PermissionError} If user lacks the ViewBalance permission
|
|
131
|
-
* @returns {Promise<StatementFile>} The generated PDF file containing wallet details
|
|
132
|
-
*/
|
|
133
|
-
async genWalletDetailsPDF() {
|
|
134
|
-
const auth = this.getAuthForPermissionCheck();
|
|
135
|
-
const requirePerm = permission_js_1.Permissions.Wallet.ViewBalance;
|
|
136
|
-
if (!auth.checkPermission(requirePerm)) {
|
|
137
|
-
throw new index_js_1.PermissionError({
|
|
138
|
-
message: "You are not authorized to view the account details.",
|
|
139
|
-
requiredPermissions: [requirePerm],
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return await this.fileGenRepo.genAccountDetailsPDF();
|
|
143
|
-
}
|
|
144
93
|
}
|
|
145
94
|
exports.WalletRepo = WalletRepo;
|
|
@@ -71,7 +71,7 @@ class Contact {
|
|
|
71
71
|
*/
|
|
72
72
|
get info() {
|
|
73
73
|
if (this.data.type === "Mobile") {
|
|
74
|
-
const phone = frontend_core_1.
|
|
74
|
+
const phone = frontend_core_1.TZPhoneNumber.from(this.data.accountNo);
|
|
75
75
|
if (phone) {
|
|
76
76
|
return new index_js_1.MobileContactInfo(this.data.displayName, phone);
|
|
77
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContactType } from "../index.js";
|
|
2
|
-
import { Bank,
|
|
2
|
+
import { Bank, TZPhoneNumber } from "@temboplus/frontend-core";
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class that provides a common interface for different types of contact information.
|
|
5
5
|
* This class defines the structure and validation requirements for both mobile and bank contacts.
|
|
@@ -65,17 +65,17 @@ declare abstract class BaseContactInfo {
|
|
|
65
65
|
* @extends BaseContactInfo
|
|
66
66
|
* @class MobileContactInfo
|
|
67
67
|
* @property {string} name - The contact's personal name
|
|
68
|
-
* @property {
|
|
68
|
+
* @property {TZPhoneNumber} phoneNumber - The contact's phone number object
|
|
69
69
|
*/
|
|
70
70
|
export declare class MobileContactInfo extends BaseContactInfo {
|
|
71
71
|
readonly name: string;
|
|
72
|
-
readonly phoneNumber:
|
|
72
|
+
readonly phoneNumber: TZPhoneNumber;
|
|
73
73
|
/**
|
|
74
74
|
* Creates a new mobile contact
|
|
75
75
|
* @param {string} name - The contact's personal name
|
|
76
|
-
* @param {
|
|
76
|
+
* @param {TZPhoneNumber} phoneNumber - The contact's phone number
|
|
77
77
|
*/
|
|
78
|
-
constructor(name: string, phoneNumber:
|
|
78
|
+
constructor(name: string, phoneNumber: TZPhoneNumber);
|
|
79
79
|
/**
|
|
80
80
|
* Validates the mobile contact information
|
|
81
81
|
* Checks that:
|
|
@@ -96,14 +96,14 @@ export declare class MobileContactInfo extends BaseContactInfo {
|
|
|
96
96
|
* if (MobileContactInfo.is(maybeContact)) {
|
|
97
97
|
* // maybeContact is typed as MobileContactInfo
|
|
98
98
|
* console.log(maybeContact.name);
|
|
99
|
-
* console.log(maybeContact.
|
|
99
|
+
* console.log(maybeContact.TZPhoneNumber.label);
|
|
100
100
|
* }
|
|
101
101
|
*
|
|
102
102
|
* @remarks
|
|
103
103
|
* - Name must be a non-empty string
|
|
104
104
|
* - Phone number can be either:
|
|
105
|
-
* - A string that can be parsed into a valid
|
|
106
|
-
* - A
|
|
105
|
+
* - A string that can be parsed into a valid TZPhoneNumber
|
|
106
|
+
* - A TZPhoneNumber object with valid properties
|
|
107
107
|
* - Returns false if either property is invalid or missing
|
|
108
108
|
*/
|
|
109
109
|
static is(obj: unknown): obj is MobileContactInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact_info.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/contact/derivatives/contact_info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"contact_info.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/contact/derivatives/contact_info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,IAAI,EAEJ,aAAa,EACd,MAAM,0BAA0B,CAAC;AAMlC;;;;;;;GAOG;AACH,uBAAe,eAAe;IAC5B,SAAgB,IAAI,EAAE,WAAW,CAAC;IAElC;;;OAGG;gBACS,IAAI,EAAE,WAAW;IAI7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,IAAI,OAAO;IAE5B;;;;OAIG;IACH,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC;IAE/B;;;;OAIG;IACH,QAAQ,KAAK,gBAAgB,IAAI,MAAM,CAAC;IAExC;;;;OAIG;IACH,QAAQ,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;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,eAAe,CAAC"}
|
|
@@ -33,13 +33,13 @@ class BaseContactInfo {
|
|
|
33
33
|
* @extends BaseContactInfo
|
|
34
34
|
* @class MobileContactInfo
|
|
35
35
|
* @property {string} name - The contact's personal name
|
|
36
|
-
* @property {
|
|
36
|
+
* @property {TZPhoneNumber} phoneNumber - The contact's phone number object
|
|
37
37
|
*/
|
|
38
38
|
class MobileContactInfo extends BaseContactInfo {
|
|
39
39
|
/**
|
|
40
40
|
* Creates a new mobile contact
|
|
41
41
|
* @param {string} name - The contact's personal name
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {TZPhoneNumber} phoneNumber - The contact's phone number
|
|
43
43
|
*/
|
|
44
44
|
constructor(name, phoneNumber) {
|
|
45
45
|
super("Mobile");
|
|
@@ -65,7 +65,7 @@ class MobileContactInfo extends BaseContactInfo {
|
|
|
65
65
|
*/
|
|
66
66
|
validate() {
|
|
67
67
|
return this.phoneNumber !== undefined &&
|
|
68
|
-
frontend_core_1.
|
|
68
|
+
frontend_core_1.TZPhoneNumber.canConstruct(this.phoneNumber.compactNumber) &&
|
|
69
69
|
this.name.length > 0;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -80,14 +80,14 @@ class MobileContactInfo extends BaseContactInfo {
|
|
|
80
80
|
* if (MobileContactInfo.is(maybeContact)) {
|
|
81
81
|
* // maybeContact is typed as MobileContactInfo
|
|
82
82
|
* console.log(maybeContact.name);
|
|
83
|
-
* console.log(maybeContact.
|
|
83
|
+
* console.log(maybeContact.TZPhoneNumber.label);
|
|
84
84
|
* }
|
|
85
85
|
*
|
|
86
86
|
* @remarks
|
|
87
87
|
* - Name must be a non-empty string
|
|
88
88
|
* - Phone number can be either:
|
|
89
|
-
* - A string that can be parsed into a valid
|
|
90
|
-
* - A
|
|
89
|
+
* - A string that can be parsed into a valid TZPhoneNumber
|
|
90
|
+
* - A TZPhoneNumber object with valid properties
|
|
91
91
|
* - Returns false if either property is invalid or missing
|
|
92
92
|
*/
|
|
93
93
|
static is(obj) {
|
|
@@ -98,14 +98,14 @@ class MobileContactInfo extends BaseContactInfo {
|
|
|
98
98
|
if (typeof mobileContactInfo.name !== "string")
|
|
99
99
|
return false;
|
|
100
100
|
const name = mobileContactInfo.name;
|
|
101
|
-
// checks if
|
|
101
|
+
// checks if TZPhoneNumber exists and is valid
|
|
102
102
|
let phone_number = undefined;
|
|
103
103
|
if (typeof mobileContactInfo.phoneNumber === "string") {
|
|
104
|
-
phone_number = frontend_core_1.
|
|
104
|
+
phone_number = frontend_core_1.TZPhoneNumber.from(mobileContactInfo.phoneNumber);
|
|
105
105
|
}
|
|
106
106
|
if (typeof mobileContactInfo.phoneNumber === "object") {
|
|
107
107
|
const obj = mobileContactInfo.phoneNumber;
|
|
108
|
-
const isValidPhone = frontend_core_1.
|
|
108
|
+
const isValidPhone = frontend_core_1.TZPhoneNumber.is(obj);
|
|
109
109
|
if (isValidPhone) {
|
|
110
110
|
phone_number = obj;
|
|
111
111
|
}
|
|
@@ -122,7 +122,7 @@ class MobileContactInfo extends BaseContactInfo {
|
|
|
122
122
|
* @returns {string} Formatted phone number
|
|
123
123
|
*/
|
|
124
124
|
get accNumber() {
|
|
125
|
-
return this.phoneNumber.
|
|
125
|
+
return this.phoneNumber.getWithFormat(frontend_core_1.PhoneNumberFormat.INTERNATIONAL);
|
|
126
126
|
}
|
|
127
127
|
get channel() {
|
|
128
128
|
return this.phoneNumber.networkOperator.mobileMoneyService;
|
|
@@ -224,7 +224,7 @@ class BankContactInfo extends BaseContactInfo {
|
|
|
224
224
|
if (typeof bankContactInfo.accNumber !== "string")
|
|
225
225
|
return false;
|
|
226
226
|
const accNumber = bankContactInfo.accNumber;
|
|
227
|
-
// checks if
|
|
227
|
+
// checks if TZPhoneNumber exists and is valid
|
|
228
228
|
let bank = undefined;
|
|
229
229
|
if (typeof bankContactInfo.bank === "object") {
|
|
230
230
|
const obj = bankContactInfo.bank;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TZPhoneNumber } from "@temboplus/frontend-core";
|
|
2
2
|
/**
|
|
3
3
|
* Represents the available channels through which payouts can be processed.
|
|
4
4
|
* @enum {string}
|
|
@@ -48,11 +48,11 @@ export declare const createPayoutChannelCode: {
|
|
|
48
48
|
verto: () => "TZ-VERTO-B2C";
|
|
49
49
|
/**
|
|
50
50
|
* Creates a mobile money channel code based on the telecom provider
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {TZPhoneNumber} phoneNumber - Phone number object containing telecom information
|
|
52
52
|
* @returns {PayoutChannelCode} Channel code in format "TZ-{TELECOM}-B2C"
|
|
53
53
|
*
|
|
54
|
-
* @see {@link
|
|
54
|
+
* @see {@link TZPhoneNumber} from "@jsr/temboplus__tembo-core" for phone number structure
|
|
55
55
|
*/
|
|
56
|
-
mobile: (phoneNumber:
|
|
56
|
+
mobile: (phoneNumber: TZPhoneNumber) => PayoutChannelCode;
|
|
57
57
|
};
|
|
58
58
|
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE/E;;;;GAIG;AACH,oBAAY,cAAc;IACxB,sDAAsD;IACtD,MAAM,WAAW;IACjB,6DAA6D;IAC7D,IAAI,SAAS;IACb,mDAAmD;IACnD,cAAc,mBAAmB;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,cAAc,GACd,MAAM,MAAM,MAAM,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;OAGG;gBACO,aAAa;IAEvB;;;OAGG;iBACQ,cAAc;IAEzB;;;;;;OAMG;0BAC4B,aAAa,KAAG,iBAAiB;CAOjE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPayoutChannelCode = exports.PAYOUT_CHANNEL = void 0;
|
|
4
|
+
const frontend_core_1 = require("@temboplus/frontend-core");
|
|
4
5
|
/**
|
|
5
6
|
* Represents the available channels through which payouts can be processed.
|
|
6
7
|
* @enum {string}
|
|
@@ -40,10 +41,16 @@ exports.createPayoutChannelCode = {
|
|
|
40
41
|
verto: () => "TZ-VERTO-B2C",
|
|
41
42
|
/**
|
|
42
43
|
* Creates a mobile money channel code based on the telecom provider
|
|
43
|
-
* @param {
|
|
44
|
+
* @param {TZPhoneNumber} phoneNumber - Phone number object containing telecom information
|
|
44
45
|
* @returns {PayoutChannelCode} Channel code in format "TZ-{TELECOM}-B2C"
|
|
45
46
|
*
|
|
46
|
-
* @see {@link
|
|
47
|
+
* @see {@link TZPhoneNumber} from "@jsr/temboplus__tembo-core" for phone number structure
|
|
47
48
|
*/
|
|
48
|
-
mobile: (phoneNumber)
|
|
49
|
+
mobile: function (phoneNumber) {
|
|
50
|
+
//! fix: Channeling all Vodacom numbers to Tigo. Request from Mr. Tesha to solve some specific problem
|
|
51
|
+
if (phoneNumber.networkOperator.id === frontend_core_1.NetworkOperator.VODACOM) {
|
|
52
|
+
return `TZ-${frontend_core_1.NetworkOperator.TIGO.toString().toUpperCase()}-B2C`;
|
|
53
|
+
}
|
|
54
|
+
return `TZ-${phoneNumber.networkOperator.id.toString().toUpperCase()}-B2C`;
|
|
55
|
+
},
|
|
49
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/payout/derivatives/payout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/payout/derivatives/payout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,sBAAsB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG1E;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAElC;;OAEG;IACH,OAAO;IAKP,uCAAuC;IACvC,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,qDAAqD;IACrD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,kCAAkC;IAClC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,2CAA2C;IAC3C,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,+CAA+C;IAC/C,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,wCAAwC;IACxC,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,iDAAiD;IACjD,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;;;;;;;;;;OAWG;IACH,IAAI,MAAM,IAAI,aAAa,CAe1B;IAED,2DAA2D;IAC3D,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,iDAAiD;IACjD,IAAI,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED,wCAAwC;IACxC,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED,6CAA6C;IAC7C,IAAI,SAAS,IAAI,IAAI,CAEpB;IAED,4CAA4C;IAC5C,IAAI,cAAc,IAAI,sBAAsB,CAE3C;IAED,+CAA+C;IAC/C,IAAI,SAAS,IAAI,cAAc,GAAG,SAAS,CAE1C;IAED,qDAAqD;IACrD,IAAI,UAAU,IAAI,cAAc,GAAG,SAAS,CAE3C;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,WAAW,IAAI,WAAW,GAAG,SAAS,CA8BzC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAIvC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE;IAIpD;;;OAGG;WACW,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAQzD;;;;;;;;;;;;;;;;;;;;;OAqBG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM;IAUvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;WACW,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM;IAO7C;;OAEG;IACI,MAAM,IAAI,UAAU;CAG5B"}
|
|
@@ -136,7 +136,7 @@ class Payout {
|
|
|
136
136
|
get contactInfo() {
|
|
137
137
|
let contactInfo;
|
|
138
138
|
// extracting mobile contact information
|
|
139
|
-
const phone = frontend_core_1.
|
|
139
|
+
const phone = frontend_core_1.TZPhoneNumber.from(this.data.msisdn);
|
|
140
140
|
if (phone) {
|
|
141
141
|
contactInfo = new index_js_1.MobileContactInfo(this.data.payeeName, phone);
|
|
142
142
|
}
|
|
@@ -20,7 +20,8 @@ type PayoutStatusType = z.ZodEnum<[
|
|
|
20
20
|
typeof PAYOUT_STATUS.PAID,
|
|
21
21
|
typeof PAYOUT_STATUS.FAILED,
|
|
22
22
|
typeof PAYOUT_STATUS.REJECTED,
|
|
23
|
-
typeof PAYOUT_STATUS.PENDING
|
|
23
|
+
typeof PAYOUT_STATUS.PENDING,
|
|
24
|
+
typeof PAYOUT_STATUS.QUEUED
|
|
24
25
|
]>;
|
|
25
26
|
/**
|
|
26
27
|
* Type definition for payout approval status enum
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,KAAK,cAAc,GAAG,CAAC,CAAC,SAAS,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC;CACvB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,KAAK,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAC;IAChC,OAAO,aAAa,CAAC,OAAO;IAC5B,OAAO,aAAa,CAAC,IAAI;IACzB,OAAO,aAAa,CAAC,MAAM;IAC3B,OAAO,aAAa,CAAC,QAAQ;IAC7B,OAAO,aAAa,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,KAAK,cAAc,GAAG,CAAC,CAAC,SAAS,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC;CACvB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,KAAK,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAC;IAChC,OAAO,aAAa,CAAC,OAAO;IAC5B,OAAO,aAAa,CAAC,IAAI;IACzB,OAAO,aAAa,CAAC,MAAM;IAC3B,OAAO,aAAa,CAAC,QAAQ;IAC7B,OAAO,aAAa,CAAC,OAAO;IAC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AA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
|
|
@@ -8,6 +8,7 @@ exports.PAYOUT_APPROVAL_STATUS = exports.PAYOUT_STATUS = void 0;
|
|
|
8
8
|
*/
|
|
9
9
|
var PAYOUT_STATUS;
|
|
10
10
|
(function (PAYOUT_STATUS) {
|
|
11
|
+
PAYOUT_STATUS["QUEUED"] = "QUEUED";
|
|
11
12
|
/** Payout is awaiting processing */
|
|
12
13
|
PAYOUT_STATUS["PENDING"] = "PENDING";
|
|
13
14
|
/** Payout has been successfully processed */
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { PhoneNumber } from "@temboplus/frontend-core";
|
|
2
3
|
/**
|
|
3
4
|
* Type definition for profile schema using Zod.
|
|
4
5
|
* This type helper ensures type safety when implementing the actual schema.
|
|
5
6
|
*/
|
|
6
|
-
type
|
|
7
|
+
type ProfileZodSchemaType = z.ZodObject<{
|
|
7
8
|
id: z.ZodString;
|
|
8
|
-
firstName: z.ZodString
|
|
9
|
-
lastName: z.ZodString
|
|
9
|
+
firstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
lastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
10
11
|
displayName: z.ZodString;
|
|
11
|
-
phone: z.ZodString
|
|
12
|
+
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
12
13
|
accountNo: z.ZodString;
|
|
13
|
-
email: z.ZodString
|
|
14
|
+
email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
14
15
|
}>;
|
|
15
16
|
/**
|
|
16
17
|
* Zod schema for validating user profile data.
|
|
@@ -19,20 +20,142 @@ type ProfileType = z.ZodObject<{
|
|
|
19
20
|
* @const {ProfileType}
|
|
20
21
|
*
|
|
21
22
|
* @property {string} id - Unique identifier for the profile
|
|
22
|
-
* @property {string} firstName - User's first name
|
|
23
|
-
* @property {string} lastName - User's last name
|
|
23
|
+
* @property {string | null | undefined} firstName - User's first name, can be null or undefined
|
|
24
|
+
* @property {string | null | undefined} lastName - User's last name, can be null or undefined
|
|
24
25
|
* @property {string} displayName - User's display name
|
|
25
|
-
* @property {string} phone - User's contact phone number
|
|
26
|
+
* @property {string | null | undefined} phone - User's contact phone number, can be null or undefined
|
|
26
27
|
* @property {string} accountNo - User's account number
|
|
27
|
-
* @property {string} email - User's email address
|
|
28
|
+
* @property {string | null | undefined} email - User's email address, can be null or undefined
|
|
28
29
|
*/
|
|
29
|
-
export declare const profileSchema:
|
|
30
|
+
export declare const profileSchema: ProfileZodSchemaType;
|
|
30
31
|
/**
|
|
31
32
|
* TypeScript type representing a validated user profile.
|
|
32
33
|
* Use this type for profile instances that have been validated against the schema.
|
|
34
|
+
*/
|
|
35
|
+
export type ProfileType = z.infer<typeof profileSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Represents a user profile in the system.
|
|
33
38
|
*
|
|
34
|
-
*
|
|
39
|
+
* This class provides methods for creating, validating, and manipulating user profile data.
|
|
40
|
+
* It integrates with the Zod schema validation for data integrity.
|
|
35
41
|
*/
|
|
36
|
-
export
|
|
42
|
+
export declare class Profile {
|
|
43
|
+
/** Unique identifier for the profile */
|
|
44
|
+
private _id;
|
|
45
|
+
/** User's first name */
|
|
46
|
+
private _firstName?;
|
|
47
|
+
/** User's last name */
|
|
48
|
+
private _lastName?;
|
|
49
|
+
/** User's display name, can be used for presentation */
|
|
50
|
+
private _displayName;
|
|
51
|
+
/** User's phone number, stored as a PhoneNumber object */
|
|
52
|
+
private _phone?;
|
|
53
|
+
/** User's account number */
|
|
54
|
+
private _accountNo;
|
|
55
|
+
/** User's email address */
|
|
56
|
+
private _email?;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the profile schema used for validation.
|
|
59
|
+
*/
|
|
60
|
+
static get schema(): ProfileZodSchemaType;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new Profile instance with the provided data.
|
|
63
|
+
*
|
|
64
|
+
* Private constructor to enforce use of static factory methods.
|
|
65
|
+
*
|
|
66
|
+
* @param data - Object containing profile information
|
|
67
|
+
*/
|
|
68
|
+
private constructor();
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new Profile instance with the provided data.
|
|
71
|
+
*
|
|
72
|
+
* @param data - Object containing profile information.
|
|
73
|
+
*/
|
|
74
|
+
static create(data: {
|
|
75
|
+
id: string;
|
|
76
|
+
firstName?: string | null;
|
|
77
|
+
lastName?: string | null;
|
|
78
|
+
displayName: string;
|
|
79
|
+
phone?: string | null;
|
|
80
|
+
accountNo: string;
|
|
81
|
+
email?: string | null;
|
|
82
|
+
}): Profile | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the profile's unique identifier.
|
|
85
|
+
*/
|
|
86
|
+
get id(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Gets the user's first name.
|
|
89
|
+
*/
|
|
90
|
+
get firstName(): string | null | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Gets the user's last name.
|
|
93
|
+
*/
|
|
94
|
+
get lastName(): string | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Gets the user's display name.
|
|
97
|
+
*/
|
|
98
|
+
get displayName(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the user's phone number object.
|
|
101
|
+
*/
|
|
102
|
+
get phone(): PhoneNumber | null | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the user's account number.
|
|
105
|
+
*/
|
|
106
|
+
get accountNo(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the user's email address.
|
|
109
|
+
*/
|
|
110
|
+
get email(): string | null | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Gets the user's formatted phone number in international format.
|
|
113
|
+
*/
|
|
114
|
+
get formattedPhone(): string | null | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the user's name for display purposes.
|
|
117
|
+
* Returns the display name if it exists, otherwise returns the first and last name combined.
|
|
118
|
+
*/
|
|
119
|
+
getName(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Creates a plain object representation of the profile for validation or serialization.
|
|
122
|
+
*
|
|
123
|
+
* @returns A plain object matching the ProfileType interface
|
|
124
|
+
*/
|
|
125
|
+
toObject(): ProfileType;
|
|
126
|
+
/**
|
|
127
|
+
* Converts the profile to a JSON string.
|
|
128
|
+
*
|
|
129
|
+
* @returns A JSON string representation of the profile
|
|
130
|
+
*/
|
|
131
|
+
toJSON(): string;
|
|
132
|
+
/**
|
|
133
|
+
* Validates the profile data against the Zod schema.
|
|
134
|
+
*
|
|
135
|
+
* @returns True if the profile is valid, false otherwise
|
|
136
|
+
*/
|
|
137
|
+
validate(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Creates a Profile instance from a JSON string.
|
|
140
|
+
*
|
|
141
|
+
* @param jsonString - JSON string containing profile data
|
|
142
|
+
* @returns A new Profile instance, or undefined if parsing failed
|
|
143
|
+
*/
|
|
144
|
+
static fromJSON(jsonString: string): Profile | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Creates a Profile instance from a plain object.
|
|
147
|
+
*
|
|
148
|
+
* @param data - Object containing profile data
|
|
149
|
+
* @returns A new Profile instance, or undefined if parsing failed
|
|
150
|
+
*/
|
|
151
|
+
static from(data: any): Profile | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Type guard to check if an unknown object is a valid Profile instance.
|
|
154
|
+
*
|
|
155
|
+
* @param obj - The object to check
|
|
156
|
+
* @returns Type predicate indicating if the object is a valid Profile
|
|
157
|
+
*/
|
|
158
|
+
static is(obj: unknown): obj is Profile;
|
|
159
|
+
}
|
|
37
160
|
export {};
|
|
38
161
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,KAAK,oBAAoB,GAAG,CAAC,CAAC,SAAS,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,QAAQ,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,WAAW,EAAE,CAAC,CAAC,SAAS,C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