highcourt-affidavit 1.0.4 → 1.0.6
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/README.md +373 -263
- package/fesm2022/highcourt-affidavit.mjs +236 -210
- package/fesm2022/highcourt-affidavit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/highcourt-affidavit.d.ts +34 -20
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
# Federal High Court Affidavit Library
|
|
1
|
+
# Federal High Court Affidavit Library
|
|
2
|
+
## Angular Library & Web Components – Complete Integration Guide
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
---
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## 1. Overview
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
The **Federal High Court Affidavit Library** is delivered in **two complementary integration models**:
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- **Error Handling:** Built-in error handling mechanisms to address potential issues during affidavit creation
|
|
19
|
-
- **TypeScript Support:** Full TypeScript support with type definitions
|
|
15
|
+
1. **Angular Library (`highcourt-affidavit`)**
|
|
16
|
+
Designed for internal Angular applications that require:
|
|
17
|
+
- Tight framework integration
|
|
18
|
+
- Service-based API access
|
|
19
|
+
- Full TypeScript support
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
2. **Web Components (`highcourt-affidavit-elements`)**
|
|
22
|
+
Framework-agnostic custom elements for:
|
|
23
|
+
- Partner portals and MDAs
|
|
24
|
+
- Angular, React, Vue, or plain HTML
|
|
25
|
+
- CDN-based, copy‑paste integration
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
- Node.js 18 or higher
|
|
25
|
-
- npm or yarn package manager
|
|
27
|
+
This document provides **complete documentation** for **both the Angular library and all Web Components**, including **all callback events**.
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
---
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
# PART A — ANGULAR LIBRARY (`highcourt-affidavit`)
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
npm install highcourt-affidavit
|
|
33
|
-
```
|
|
33
|
+
## 2. Installation
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
```bash
|
|
36
|
+
npm install highcourt-affidavit
|
|
37
|
+
# or
|
|
38
|
+
yarn add highcourt-affidavit
|
|
39
|
+
```
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
---
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
## 3. Module Setup
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
import { NgModule } from "@angular/core";
|
|
@@ -49,318 +49,428 @@ import { environment } from "../environments/environment";
|
|
|
49
49
|
|
|
50
50
|
@NgModule({
|
|
51
51
|
imports: [
|
|
52
|
-
HighcourtAffidavitModule.forRoot(
|
|
52
|
+
HighcourtAffidavitModule.forRoot(
|
|
53
|
+
environment.affidavit_api_secret_key,
|
|
54
|
+
environment.mode //(in: 'development', 'production')
|
|
55
|
+
),
|
|
53
56
|
],
|
|
54
|
-
// ...
|
|
55
57
|
})
|
|
56
58
|
export class AppModule {}
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
>
|
|
61
|
+
> Ensure `affidavit_api_secret_key` and `affidavit_api_public_key` are defined in your environment files.
|
|
62
|
+
|
|
63
|
+
---
|
|
60
64
|
|
|
61
|
-
##
|
|
65
|
+
## 4. Angular Components
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
### 4.1 `<highcourt-affidavit>` – Single Affidavit
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<highcourt-affidavit [templateId]="template_id"
|
|
71
|
+
(callBack)="handleAffidavitCallback($event)">
|
|
72
|
+
</highcourt-affidavit>
|
|
73
|
+
```
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
**Events**
|
|
76
|
+
- `callBack` – affidavit application completed
|
|
77
|
+
- `paymentSuccess` – payment completed (if applicable)
|
|
78
|
+
- `overlayClose` – overlay closed by user/system
|
|
66
79
|
|
|
67
|
-
|
|
80
|
+
---
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
### 4.2 `<e-affidavit-bulk-create-applications>` – Bulk Affidavits
|
|
70
83
|
|
|
71
84
|
```html
|
|
72
|
-
<
|
|
85
|
+
<e-affidavit-bulk-create-applications
|
|
86
|
+
[payload]="bulkPayload"
|
|
87
|
+
[affidavitTemplateId]="templateId"
|
|
88
|
+
[client_ref]="clientRef"
|
|
89
|
+
(callBack)="handleBulkCallback($event)">
|
|
90
|
+
</e-affidavit-bulk-create-applications>
|
|
73
91
|
```
|
|
74
92
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
**Events**
|
|
94
|
+
- `callBack` – bulk workflow completed
|
|
95
|
+
- `overlayClose` – bulk workspace closed
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
### 4.3 `<e-affidavit-applications-details-page>` – Bulk Affidavits
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<e-affidavit-applications-details-page
|
|
102
|
+
[client_ref]="clientRef"
|
|
103
|
+
(handlePayment)="handlePaymentSuccess($event)">
|
|
104
|
+
</e-affidavit-applications-details-page>
|
|
82
105
|
```
|
|
83
106
|
|
|
84
|
-
|
|
107
|
+
**Events**
|
|
108
|
+
- `handlePayment` – payment completed
|
|
109
|
+
- `overlayClose` – bulk workspace closed
|
|
85
110
|
|
|
86
|
-
|
|
111
|
+
---
|
|
87
112
|
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
## 5. Angular Services
|
|
114
|
+
|
|
115
|
+
### `HighcourtAffidavitLibraryService`
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
this.affidavitService.create(data).subscribe(...)
|
|
119
|
+
this.affidavitService.createBulk(data).subscribe(...)
|
|
120
|
+
...
|
|
90
121
|
```
|
|
91
122
|
|
|
123
|
+
Used for **headless / backend-driven** affidavit creation.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 6. Angular Callback Contract
|
|
128
|
+
|
|
92
129
|
```ts
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
deponent_nin: 12345678912,
|
|
98
|
-
// ... other required fields
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
getApp(data: any) {
|
|
103
|
-
console.log("Bulk Application", data);
|
|
104
|
-
// Handle the bulk affidavit creation response
|
|
105
|
-
}
|
|
130
|
+
interface AngularAffidavitCallback {
|
|
131
|
+
status: "success" | "error";
|
|
132
|
+
reference?: string;
|
|
133
|
+
data: any;
|
|
106
134
|
}
|
|
107
135
|
```
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
---
|
|
110
138
|
|
|
111
|
-
|
|
139
|
+
# PART B — WEB COMPONENTS (`highcourt-affidavit-elements`)
|
|
112
140
|
|
|
113
|
-
|
|
114
|
-
<e-affidavit-bulk-create-applications [page]="'details'" [client_ref]="'POSSAP-0023-2343243212211'"> </e-affidavit-bulk-create-applications>
|
|
115
|
-
```
|
|
141
|
+
## 7. What Are the Web Components?
|
|
116
142
|
|
|
117
|
-
|
|
143
|
+
Web Components are **native browser custom elements** built with Angular Elements.
|
|
144
|
+
They encapsulate:
|
|
145
|
+
- UI & validation
|
|
146
|
+
- Workflow orchestration
|
|
147
|
+
- Payment initiation
|
|
148
|
+
- Secure API calls
|
|
149
|
+
- Event emission
|
|
118
150
|
|
|
119
|
-
|
|
151
|
+
They **do not require Angular/React/Vuejs** in the consuming app.
|
|
120
152
|
|
|
121
|
-
|
|
122
|
-
import { Component } from "@angular/core";
|
|
123
|
-
import { HighcourtAffidavitLibraryService } from "highcourt-affidavit";
|
|
153
|
+
---
|
|
124
154
|
|
|
125
|
-
|
|
126
|
-
selector: "app-create-affidavit",
|
|
127
|
-
templateUrl: "./create-affidavit.component.html",
|
|
128
|
-
})
|
|
129
|
-
export class CreateAffidavitComponent {
|
|
130
|
-
constructor(private affidavitService: HighcourtAffidavitLibraryService) {}
|
|
131
|
-
|
|
132
|
-
createAffidavit() {
|
|
133
|
-
const affidavitData = {
|
|
134
|
-
affidavit_type_name: "Affidavit of Ownership",
|
|
135
|
-
deponent_name: "Ahmad Ibrahim",
|
|
136
|
-
deponent_nin: 12345678912,
|
|
137
|
-
town_native: "Gusau",
|
|
138
|
-
town_resident: "Gusau",
|
|
139
|
-
occupation: "Software Developer",
|
|
140
|
-
gender: "Male",
|
|
141
|
-
religion: "Islam",
|
|
142
|
-
signature_file: "signature.png", // Should be provided in binary format
|
|
143
|
-
passport_photo_file: "passport.jpg", // Should be provided in binary format
|
|
144
|
-
identity_photo_file: "id-card.jpeg", // Should be provided in binary format
|
|
145
|
-
applicant_email: "applicant@mail.com",
|
|
146
|
-
applicant_phone: "07066666666",
|
|
147
|
-
adult_minor: "adult",
|
|
148
|
-
affidavit_template_id: 1,
|
|
149
|
-
lga_id: 1,
|
|
150
|
-
court_id: 1,
|
|
151
|
-
formEntries: [
|
|
152
|
-
{
|
|
153
|
-
placeholder: "fullName",
|
|
154
|
-
label: "Full Name",
|
|
155
|
-
provided_value: "Ahmad Ibrahim",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
clauseEntries: [{ entry: "Affidavit Clause" }],
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
this.affidavitService.create(affidavitData).subscribe({
|
|
162
|
-
next: (response) => {
|
|
163
|
-
console.log("Affidavit Created:", response);
|
|
164
|
-
// Handle successful creation
|
|
165
|
-
},
|
|
166
|
-
error: (error) => {
|
|
167
|
-
console.error("Affidavit Creation Failed:", error);
|
|
168
|
-
// Handle error
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
}
|
|
155
|
+
## 8. Available Web Components
|
|
172
156
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
court_id: 1,
|
|
180
|
-
applications: [
|
|
181
|
-
{
|
|
182
|
-
deponent_name: "Ahmad Ibrahim",
|
|
183
|
-
deponent_nin: 12345678912,
|
|
184
|
-
town_native: "Gusau",
|
|
185
|
-
town_resident: "Gusau",
|
|
186
|
-
occupation: "Software Developer",
|
|
187
|
-
gender: "Male",
|
|
188
|
-
religion: "Islam",
|
|
189
|
-
signature_file: "signature.png", // Should be provided in binary format
|
|
190
|
-
passport_photo_file: "passport.jpg", // Should be provided in binary format
|
|
191
|
-
identity_photo_file: "id-card.jpeg", // Should be provided in binary format
|
|
192
|
-
lga_id: 1,
|
|
193
|
-
court_id: 1,
|
|
194
|
-
formEntries: [
|
|
195
|
-
{
|
|
196
|
-
placeholder: "fullName",
|
|
197
|
-
label: "Full Name",
|
|
198
|
-
provided_value: "Ahmad Ibrahim",
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
clauseEntries: [{ entry: "Affidavit Clause" }],
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
this.affidavitService.createBulk(affidavitData).subscribe({
|
|
207
|
-
next: (response) => {
|
|
208
|
-
console.log("Affidavits Created:", response);
|
|
209
|
-
// Handle successful bulk creation
|
|
210
|
-
},
|
|
211
|
-
error: (error) => {
|
|
212
|
-
console.error("Affidavits Creation Failed:", error);
|
|
213
|
-
// Handle error
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
```
|
|
157
|
+
| Component | Tag | Purpose |
|
|
158
|
+
|--------|-----|--------|
|
|
159
|
+
| Affidavit Application | `<highcourt-affidavit>` | Create & submit affidavits |
|
|
160
|
+
| Payment | `<pay-affidavit>` | Pay for an existing affidavit |
|
|
161
|
+
| Bulk Workspace | `<bulk-create-applications>` | Manage multiple affidavits |
|
|
162
|
+
| Bulk Applications Details | `<e-affidavit-applications-details-page>` | Manage multiple affidavits Payment |
|
|
219
163
|
|
|
220
|
-
|
|
164
|
+
---
|
|
221
165
|
|
|
222
|
-
##
|
|
166
|
+
## 9. Distribution (CDN – Recommended)
|
|
223
167
|
|
|
224
|
-
|
|
168
|
+
```html
|
|
169
|
+
<link rel="stylesheet"
|
|
170
|
+
href="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/styles.css" />
|
|
225
171
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
@import "~primeicons/primeicons.css";
|
|
230
|
-
@import "~highcourt-affidavit/src/lib/styles.scss";
|
|
231
|
-
@import url("https://fonts.googleapis.com/css?family=Comfortaa");
|
|
172
|
+
<script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/polyfills.js" type="module"></script>
|
|
173
|
+
<script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/scripts.js" defer></script>
|
|
174
|
+
<script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/main.js" type="module"></script>
|
|
232
175
|
```
|
|
233
176
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
177
|
+
### Alternatively
|
|
178
|
+
```html
|
|
179
|
+
<script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/loader.js" ></script>
|
|
237
180
|
|
|
238
|
-
```ts
|
|
239
|
-
export const environment = {
|
|
240
|
-
production: false,
|
|
241
|
-
affidavit_api_secret_key: "your_secret_key",
|
|
242
|
-
affidavit_api_public_key: "your_public_key",
|
|
243
|
-
mode: "test", // Can be either 'production' or 'test'
|
|
244
|
-
};
|
|
245
181
|
```
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 10. `<highcourt-affidavit>` – Web Component
|
|
185
|
+
|
|
186
|
+
### Attributes
|
|
246
187
|
|
|
247
|
-
|
|
188
|
+
| Attribute | Required | Description |
|
|
189
|
+
|--------|----------|-------------|
|
|
190
|
+
| `token` | ❌ | API key |
|
|
191
|
+
| `mode` | ❌ | `development` or `production` |
|
|
192
|
+
| `template-id` | ❌ | Affidavit template |
|
|
193
|
+
| `templateId` | ❌ | Affidavit template |
|
|
194
|
+
| `client-ref` | ❌ | Client reference |
|
|
195
|
+
| `clientRef` | ❌ | Client reference |
|
|
196
|
+
| `payload` | ❌ | Prefilled data |
|
|
248
197
|
|
|
249
|
-
###
|
|
198
|
+
### Callbacks
|
|
250
199
|
|
|
251
|
-
|
|
200
|
+
| Event | Description |
|
|
201
|
+
|-----|------------|
|
|
202
|
+
| `callBack` | Application submitted |
|
|
203
|
+
| `on-payment-success` / `paymentSuccess` | Payment completed |
|
|
204
|
+
| `overlay-close` / `overlayClose` | Overlay closed |
|
|
252
205
|
|
|
253
|
-
|
|
206
|
+
---
|
|
254
207
|
|
|
255
|
-
|
|
208
|
+
## 11. `<pay-affidavit>` – Web Component
|
|
256
209
|
|
|
257
|
-
|
|
258
|
-
- `mode` (optional): Environment mode ('production' or 'test')
|
|
210
|
+
### Attributes
|
|
259
211
|
|
|
260
|
-
|
|
212
|
+
| Attribute | Required | Description |
|
|
213
|
+
|--------|----------|-------------|
|
|
214
|
+
| `token` | ✅ | API key |
|
|
215
|
+
| `app-no` | ✅ | Application number |
|
|
216
|
+
| `should-display-details` | ❌ | Show payment breakdown |
|
|
261
217
|
|
|
262
|
-
|
|
218
|
+
### Callbacks
|
|
263
219
|
|
|
264
|
-
|
|
220
|
+
| Event | Description |
|
|
221
|
+
|-----|------------|
|
|
222
|
+
| `handlePayment` | Payment processed (success/failure) |
|
|
223
|
+
| `overlayClose` | Payment overlay closed |
|
|
224
|
+
|
|
225
|
+
```js
|
|
226
|
+
payElement.addEventListener("handlePayment", (e) => {
|
|
227
|
+
console.log("Payment status:", e.detail.status);
|
|
228
|
+
});
|
|
229
|
+
```
|
|
265
230
|
|
|
266
|
-
|
|
231
|
+
---
|
|
267
232
|
|
|
268
|
-
|
|
233
|
+
## 12. `<bulk-create-applications>` – Web Component
|
|
269
234
|
|
|
270
|
-
|
|
271
|
-
- `affidavitTemplateId`: Template ID for the affidavits
|
|
272
|
-
- `client_ref`: Unique reference for the bulk operation
|
|
273
|
-
- `page` (optional): Set to 'details' to view application details
|
|
274
|
-
- `token` (optional): Your API secret key
|
|
275
|
-
- `mode` (optional): Environment mode
|
|
235
|
+
### Attributes
|
|
276
236
|
|
|
277
|
-
|
|
237
|
+
| Attribute | Required | Description |
|
|
238
|
+
|--------|----------|-------------|
|
|
239
|
+
| `token` | ❌ | API key |
|
|
240
|
+
| `mode` | ❌ | Environment |
|
|
241
|
+
| `affidavit-template-id` | ✅ | Template ID |
|
|
242
|
+
| `client-ref` | ❌ | Bulk session reference |
|
|
243
|
+
| `page` | ❌ | new | review | details | summary |
|
|
278
244
|
|
|
279
|
-
|
|
245
|
+
### Callbacks
|
|
280
246
|
|
|
281
|
-
|
|
247
|
+
| Event | Description |
|
|
248
|
+
|-----|------------|
|
|
249
|
+
| `callBack` | Bulk submission completed |
|
|
250
|
+
| `overlayClose` | Workspace closed |
|
|
282
251
|
|
|
283
|
-
|
|
252
|
+
---
|
|
253
|
+
## 13. `<e-affidavit-applications-details-page>` – Web Component
|
|
284
254
|
|
|
285
|
-
|
|
255
|
+
### Attributes
|
|
286
256
|
|
|
287
|
-
|
|
257
|
+
| Attribute | Required | Description |
|
|
258
|
+
|--------|----------|-------------|
|
|
259
|
+
| `token` | ❌ | API key |
|
|
260
|
+
| `mode` | ❌ | Environment |
|
|
261
|
+
| `client_ref` | ✅ | Bulk session reference |
|
|
288
262
|
|
|
289
|
-
|
|
290
|
-
- `createBulk(affidavitData)`: Create multiple affidavits
|
|
263
|
+
### Callbacks
|
|
291
264
|
|
|
292
|
-
|
|
265
|
+
| Event | Description |
|
|
266
|
+
|-----|------------|
|
|
267
|
+
| `handlePayment` | Bulk submission completed |
|
|
268
|
+
| `overlayClose` | Workspace closed |
|
|
293
269
|
|
|
294
|
-
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 14. Unified Web Component Callback Contract
|
|
295
273
|
|
|
296
274
|
```ts
|
|
297
|
-
interface
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
identity_photo_file: string; // Binary format
|
|
309
|
-
applicant_email: string;
|
|
310
|
-
applicant_phone: string;
|
|
311
|
-
adult_minor: "adult" | "minor";
|
|
312
|
-
affidavit_template_id: number;
|
|
313
|
-
lga_id: number;
|
|
314
|
-
court_id: number;
|
|
315
|
-
formEntries: FormEntry[];
|
|
316
|
-
clauseEntries: ClauseEntry[];
|
|
275
|
+
interface WebComponentCallback {
|
|
276
|
+
component: "highcourt-affidavit" | "pay-affidavit" | "bulk-create-applications";
|
|
277
|
+
action:
|
|
278
|
+
| "application_submitted"
|
|
279
|
+
| "payment_completed"
|
|
280
|
+
| "bulk_completed"
|
|
281
|
+
| "overlay_closed"
|
|
282
|
+
status: "success" | "pending" | "failed" | "cancelled";
|
|
283
|
+
reference?: string;
|
|
284
|
+
data: any;
|
|
285
|
+
timestamp: string;
|
|
317
286
|
}
|
|
287
|
+
```
|
|
318
288
|
|
|
319
|
-
|
|
320
|
-
placeholder: string;
|
|
321
|
-
label: string;
|
|
322
|
-
provided_value: string;
|
|
323
|
-
}
|
|
289
|
+
---
|
|
324
290
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
291
|
+
## 15. Global Callback Listener
|
|
292
|
+
|
|
293
|
+
```js
|
|
294
|
+
document.addEventListener("callBack", (event) => {
|
|
295
|
+
console.log("Global callback:", event.detail);
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 16. Using Web Components in Angular Apps
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
305
|
+
|
|
306
|
+
@NgModule({
|
|
307
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
308
|
+
})
|
|
309
|
+
export class AppModule {}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```html
|
|
313
|
+
<div class="mb-4" *ngIf="showAffidavitOverlay">
|
|
314
|
+
<h4>📝 Affidavit Application Component</h4>
|
|
315
|
+
<highcourt-affidavit [appNo]="appNo" [templateId]="templateId"
|
|
316
|
+
[payload]="payload" [appNo]="appNo"
|
|
317
|
+
(callBack)="handleAffidavitCallback($event)" [clientRef]="clientRef"
|
|
318
|
+
(overlayClose)="handleAffidavitOverlayClose($event)"
|
|
319
|
+
(paymentSuccess)="handleAffidavitPaymentSuccess($event)">
|
|
320
|
+
</highcourt-affidavit>
|
|
321
|
+
</div>
|
|
328
322
|
```
|
|
329
323
|
|
|
330
|
-
|
|
324
|
+
```ts
|
|
325
|
+
import { Component, OnInit } from '@angular/core';
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
@Component({
|
|
329
|
+
selector: 'app-root',
|
|
330
|
+
templateUrl: './app.component.html',
|
|
331
|
+
styleUrl: './app.component.scss',
|
|
332
|
+
standalone: false
|
|
333
|
+
})
|
|
334
|
+
export class AppComponent implements OnInit {
|
|
335
|
+
// Configuration
|
|
336
|
+
token = 'FHC-INTEG-pk_f0a01636119a45d218c2016758e368be';
|
|
337
|
+
mode = 'test';
|
|
338
|
+
templateId = 96;
|
|
339
|
+
appNo = 'APP-1768501941-0004';
|
|
340
|
+
clientRef = 'APP-SESSION-01';
|
|
341
|
+
showAffidavitOverlay = true;
|
|
342
|
+
|
|
343
|
+
// Payload data for pre-filling the affidavit form
|
|
344
|
+
payload = {
|
|
345
|
+
affidavit_type_name: 'Affidavit of Ownership',
|
|
346
|
+
deponent_name: 'Ahmad Ibrahim',
|
|
347
|
+
deponent_nin: 12345678912,
|
|
348
|
+
town_native: 'Gusau',
|
|
349
|
+
town_resident: 'Gusau',
|
|
350
|
+
occupation: 'Software Developer',
|
|
351
|
+
gender: 'Male',
|
|
352
|
+
religion: 'Islam',
|
|
353
|
+
applicant_email: 'applicant@mail.com',
|
|
354
|
+
applicant_phone: '07066666666',
|
|
355
|
+
adult_minor: 'adult',
|
|
356
|
+
affidavit_template_id: 96,
|
|
357
|
+
state_id: 1,
|
|
358
|
+
court_id: 1,
|
|
359
|
+
formEntries: [
|
|
360
|
+
{
|
|
361
|
+
placeholder: "deponent_company_position",
|
|
362
|
+
provided_value: "CEO"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
placeholder: "contractor_company_name",
|
|
366
|
+
provided_value: "Centaur Info Systems",
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
placeholder: "mda_authority_name",
|
|
370
|
+
provided_value: "FGN",
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
placeholder: "rc_number",
|
|
374
|
+
provided_value: "343434",
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
placeholder: "lot_number",
|
|
378
|
+
provided_value: "343434",
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
placeholder: "lot_title",
|
|
382
|
+
provided_value: "Purchase of 50 CNG Buses",
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
clauseEntries: [],
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
constructor() { }
|
|
389
|
+
|
|
390
|
+
ngOnInit(): void {
|
|
391
|
+
this.ensureAffidavitWebComponentLoaded();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
private ensureAffidavitWebComponentLoaded(): Promise<void> {
|
|
395
|
+
try {
|
|
396
|
+
// Already registered
|
|
397
|
+
if (typeof window !== 'undefined' && window.customElements?.get('highcourt-affidavit')) {
|
|
398
|
+
return Promise.resolve();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Loader already injected
|
|
402
|
+
const existing = document.getElementById('highcourt-affidavit-loader');
|
|
403
|
+
if (existing) return Promise.resolve();
|
|
404
|
+
|
|
405
|
+
return new Promise<void>((resolve, reject) => {
|
|
406
|
+
const script = document.createElement('script');
|
|
407
|
+
script.id = 'highcourt-affidavit-loader';
|
|
408
|
+
script.src =
|
|
409
|
+
'https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.18/dist/affidavit-library/browser/loader.js';
|
|
410
|
+
script.async = true;
|
|
411
|
+
script.onload = () => resolve();
|
|
412
|
+
script.onerror = () => reject(new Error('Failed to load highcourt-affidavit web component loader'));
|
|
413
|
+
document.head.appendChild(script);
|
|
414
|
+
});
|
|
415
|
+
} catch {
|
|
416
|
+
// If we can't access DOM (edge case), just no-op.
|
|
417
|
+
return Promise.resolve();
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
ngOnDestroy(): void {
|
|
422
|
+
// Clean up any injected loader script so it can't leak global CSS/JS across routes.
|
|
423
|
+
try {
|
|
424
|
+
const loader = document.getElementById('highcourt-affidavit-loader');
|
|
425
|
+
loader?.remove();
|
|
426
|
+
} catch {
|
|
427
|
+
// no-op
|
|
428
|
+
}
|
|
429
|
+
}
|
|
331
430
|
|
|
332
|
-
|
|
431
|
+
// Highcourt Affidavit Component Event Handlers
|
|
432
|
+
handleAffidavitCallback(evt: any) {
|
|
433
|
+
const anyEvt = evt as any;
|
|
434
|
+
const detail = anyEvt?.detail ?? null;
|
|
333
435
|
|
|
334
|
-
|
|
436
|
+
console.log('[highcourt-affidavit] event received:', evt);
|
|
437
|
+
}
|
|
335
438
|
|
|
336
|
-
|
|
439
|
+
handleAffidavitPaymentSuccess(data: any) {
|
|
440
|
+
console.log('APP Affidavit Payment Success:', data);
|
|
337
441
|
|
|
338
|
-
|
|
442
|
+
// Handle payment success - e.g., update application status, show success message, etc.
|
|
443
|
+
}
|
|
339
444
|
|
|
340
|
-
|
|
445
|
+
handleAffidavitOverlayClose(data: boolean) {
|
|
446
|
+
console.log('APP Affidavit Overlay Closed:', data);
|
|
447
|
+
if (data) {
|
|
448
|
+
this.showAffidavitOverlay = false;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
341
451
|
|
|
342
|
-
|
|
452
|
+
}
|
|
453
|
+
```
|
|
343
454
|
|
|
344
|
-
|
|
455
|
+
---
|
|
345
456
|
|
|
346
|
-
|
|
347
|
-
2. Review the API documentation
|
|
348
|
-
3. Contact support at [tech@centuryinformationsystems.com](mailto:tech@centuryinformationsystems.com) or visit [Century Information Systems Contact](https://centuryinformationsystems.com/contact-us)
|
|
457
|
+
## 17. Security & Compliance
|
|
349
458
|
|
|
350
|
-
|
|
459
|
+
- Never expose live API keys
|
|
460
|
+
- Always validate payments server-side
|
|
461
|
+
- Enforce HTTPS
|
|
462
|
+
- Rotate credentials periodically
|
|
463
|
+
- Do not trust client-only callbacks
|
|
351
464
|
|
|
352
|
-
|
|
465
|
+
---
|
|
353
466
|
|
|
354
|
-
|
|
467
|
+
## 18. Support
|
|
355
468
|
|
|
356
|
-
|
|
469
|
+
📧 support@centuryinformationsystems.com
|
|
357
470
|
|
|
358
|
-
|
|
471
|
+
---
|
|
359
472
|
|
|
360
|
-
|
|
473
|
+
## 19. License
|
|
361
474
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
- Bulk affidavit creation
|
|
365
|
-
- Service-based integration
|
|
366
|
-
- Component-based integration
|
|
475
|
+
MIT License
|
|
476
|
+
© 2026 ECMS
|