highcourt-affidavit-elements 0.2.18 → 0.2.19

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 (2) hide show
  1. package/README.md +350 -221
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,315 +1,444 @@
1
- # Federal High Court Affidavit Library for Angular
1
+ # Federal High Court Affidavit Library
2
+ ## Angular Library & Web Components – Complete Integration Guide
2
3
 
3
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
5
+ ![Angular](https://img.shields.io/badge/Angular-16%2B-red.svg)
6
+ ![Web Components](https://img.shields.io/badge/Web%20Components-3-success)
7
+ ![Elements Version](https://img.shields.io/badge/Elements-0.2.19-orange)
4
8
 
5
- ## Introduction
9
+ ---
6
10
 
7
- This library simplifies the integration of the Federal High Court's Affidavit Library into your Angular applications. It provides a user-friendly Angular component (`highcourt-affidavit`) that can be easily customized and integrated to manage the creation of affidavits.
11
+ ## 1. Overview
8
12
 
9
- ## Features
13
+ The **Federal High Court Affidavit Library** is delivered in **two complementary integration models**:
10
14
 
11
- - **Effortless Integration:** Seamlessly integrate affidavit creation into your Angular application with minimal setup.
12
- - **Customizable Component:** Tailor the `highcourt-affidavit` component to match your specific requirements and workflows.
13
- - **Clear Documentation:** Comprehensive documentation and examples to guide you through the library's usage.
14
- - **Error Handling:** Built-in error handling mechanisms to address potential issues during affidavit creation.
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
15
20
 
16
- ## Web Component Distribution (Angular Elements)
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
17
26
 
18
- The project also ships a framework-agnostic web component build under `dist/affidavit-library/browser`. It contains:
27
+ This document provides **complete documentation** for **both the Angular library and all Web Components**, including **all callback events**.
19
28
 
20
- - Bundled scripts: `polyfills.js` (module), `scripts.js` (deferred), `main.js` (module)
21
- - Stylesheet: `styles.css`
22
- - Static assets: `assets/` and `media/`
23
- - Optional single-tag loader: `loader.js`
29
+ ---
24
30
 
25
- ### Build the bundle
31
+ # PART A — ANGULAR LIBRARY (`highcourt-affidavit`)
32
+
33
+ ## 2. Installation
26
34
 
27
35
  ```bash
28
- npm run build:elements
29
- # outputs dist/affidavit-library/browser
36
+ npm install highcourt-affidavit
37
+ # or
38
+ yarn add highcourt-affidavit
30
39
  ```
31
40
 
32
- ### Host on your CDN
41
+ ---
33
42
 
34
- Upload the `browser` directory to `https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2.3/` (versioned path recommended) and share this snippet:
43
+ ## 3. Module Setup
35
44
 
36
- ```html
37
- <link rel="stylesheet" href="https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2.3/styles.css" />
38
- <script src="https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2.3/polyfills.js" type="module"></script>
39
- <script src="https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2.3/scripts.js" defer></script>
40
- <script src="https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2.3/main.js" type="module"></script>
41
-
42
- <highcourt-affidavit token="PARTNER_TOKEN" mode="live"></highcourt-affidavit>
43
-
44
- <script>
45
- const el = document.querySelector("highcourt-affidavit");
46
- el.addEventListener("callBack", (event) => {
47
- console.log("Affidavit event payload:", event.detail);
48
- });
49
- </script>
45
+ ```ts
46
+ import { NgModule } from "@angular/core";
47
+ import { HighcourtAffidavitModule } from "highcourt-affidavit";
48
+ import { environment } from "../environments/environment";
49
+
50
+ @NgModule({
51
+ imports: [
52
+ HighcourtAffidavitModule.forRoot(
53
+ environment.affidavit_api_secret_key,
54
+ environment.mode
55
+ ),
56
+ ],
57
+ })
58
+ export class AppModule {}
50
59
  ```
51
60
 
52
- **Loader option:** host `loader.js` alongside the bundle and offer a single tag embed:
61
+ > Ensure `affidavit_api_secret_key` and `affidavit_api_public_key` are defined in your environment files.
62
+
63
+ ---
64
+
65
+ ## 4. Angular Components
66
+
67
+ ### 4.1 `<highcourt-affidavit>` – Single Affidavit
53
68
 
54
69
  ```html
55
- <script src="https://cdn.your-domain.com/highcourt-affidavit-elements/v0.2./loader.js" data-token="PARTNER_TOKEN" data-mode="live"></script>
56
- <highcourt-affidavit></highcourt-affidavit>
70
+ <highcourt-affidavit [templateId]="template_id"
71
+ (callBack)="onAffidavitCallback($event)">
72
+ </highcourt-affidavit>
57
73
  ```
58
74
 
59
- ### Consume directly from npm-backed CDNs
75
+ **Events**
76
+ - `callBack` – affidavit application completed
77
+ - `paymentSuccess` – payment completed (if applicable)
78
+ - `overlayClose` – overlay closed by user/system
60
79
 
61
- After publishing (see “NPM Publishing” below), partners can reference the bundle from jsDelivr or UNPKG:
80
+ ---
81
+
82
+ ### 4.2 `<e-affidavit-bulk-create-applications>` – Bulk Affidavits
62
83
 
63
84
  ```html
64
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.4/dist/affidavit-library/browser/styles.css" />
65
- <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.4/dist/affidavit-library/browser/polyfills.js" type="module"></script>
66
- <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.4/dist/affidavit-library/browser/scripts.js" defer></script>
67
- <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.4/dist/affidavit-library/browser/main.js" type="module"></script>
85
+ <e-affidavit-bulk-create-applications
86
+ [payload]="bulkPayload"
87
+ [affidavitTemplateId]="templateId"
88
+ [client_ref]="clientRef"
89
+ (callBack)="onBulkCallback($event)">
90
+ </e-affidavit-bulk-create-applications>
68
91
  ```
69
92
 
70
- ## Using the Web Component from npm
93
+ **Events**
94
+ - `callBack` – bulk workflow completed
95
+ - `overlayClose` – bulk workspace closed
71
96
 
72
- Once published to npm as `highcourt-affidavit-elements`, the build can be consumed in any project—Angular, React, Vue, or plain HTML—because it ships as native custom elements.
97
+ ---
73
98
 
74
- ### 1. Install and register (Node-based projects)
99
+ ## 5. Angular Services
75
100
 
76
- ```bash
77
- npm install highcourt-affidavit-elements
78
- # or: yarn add / pnpm add
101
+ ### `HighcourtAffidavitLibraryService`
102
+
103
+ ```ts
104
+ this.affidavitService.create(data).subscribe(...)
105
+ this.affidavitService.createBulk(data).subscribe(...)
106
+ ...
79
107
  ```
80
108
 
81
- In your application entry point, register the custom elements with the supplied loader:
109
+ Used for **headless / backend-driven** affidavit creation.
82
110
 
83
- ```ts
84
- // main.ts / index.ts / bootstrap.js
85
- import { defineCustomElements } from "highcourt-affidavit-elements/loader";
111
+ ---
86
112
 
87
- defineCustomElements(window);
113
+ ## 6. Angular Callback Contract
114
+
115
+ ```ts
116
+ interface AngularAffidavitCallback {
117
+ status: "success" | "failed";
118
+ reference?: string;
119
+ data: any;
120
+ }
88
121
  ```
89
122
 
90
- After `defineCustomElements(window)` runs, you can drop the elements anywhere in your templates:
123
+ ---
91
124
 
92
- ```html
93
- <highcourt-affidavit-app token="FHC_sk_xxxxxx" mode="test" app-id="AFF-12345" template-id="TEMPLATE-01"></highcourt-affidavit-app>
94
- ```
125
+ # PART B — WEB COMPONENTS (`highcourt-affidavit-elements`)
95
126
 
96
- Framework notes:
127
+ ## 7. What Are the Web Components?
97
128
 
98
- - **Angular** add `CUSTOM_ELEMENTS_SCHEMA` to the consuming module to silence template warnings.
99
- - **React** – use the tag directly (`<highcourt-affidavit-app ... />`). Augment `JSX.IntrinsicElements` if you want TypeScript hints.
100
- - **Vue / Svelte / others** – no special treatment; just ensure the loader runs before mounting.
129
+ Web Components are **native browser custom elements** built with Angular Elements.
130
+ They encapsulate:
131
+ - UI & validation
132
+ - Workflow orchestration
133
+ - Payment initiation
134
+ - Secure API calls
135
+ - Event emission
101
136
 
102
- ### 2. Use directly in a plain HTML project
137
+ They **do not require Angular/React/Vuejs** in the consuming app.
103
138
 
104
- You do not need a build system. Either install locally (and serve from `node_modules`) or reference a CDN.
139
+ ---
105
140
 
106
- **Local install**
141
+ ## 8. Available Web Components
107
142
 
108
- ```html
109
- <!DOCTYPE html>
110
- <html lang="en">
111
- <head>
112
- <meta charset="utf-8" />
113
- <title>Affidavit Demo</title>
114
- <script type="module">
115
- import { defineCustomElements } from "/node_modules/highcourt-affidavit-elements/dist/affidavit-library/browser/loader.js";
116
- defineCustomElements(window);
117
- </script>
118
- </head>
119
- <body>
120
- <highcourt-affidavit-app token="FHC_sk_xxxxxx" mode="test" app-id="AFF-12345" template-id="TEMPLATE-01"></highcourt-affidavit-app>
121
- </body>
122
- </html>
123
- ```
143
+ | Component | Tag | Purpose |
144
+ |--------|-----|--------|
145
+ | Affidavit Application | `<highcourt-affidavit>` | Create & submit affidavits |
146
+ | Payment | `<pay-affidavit>` | Pay for an existing affidavit |
147
+ | Bulk Workspace | `<bulk-create-applications>` | Manage multiple affidavits |
148
+
149
+ ---
150
+
151
+ ## 9. Distribution (CDN – Recommended)
124
152
 
125
- Serve the file via any static server (for example `npx http-server .`) so the browser can reach `/node_modules/...`.
153
+ ```html
154
+ <link rel="stylesheet"
155
+ href="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/styles.css" />
126
156
 
127
- **CDN snippet**
157
+ <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/polyfills.js" type="module"></script>
158
+ <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/scripts.js" defer></script>
159
+ <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/main.js" type="module"></script>
160
+ ```
128
161
 
162
+ ### Alternatively
129
163
  ```html
130
- <!DOCTYPE html>
131
- <html lang="en">
132
- <head>
133
- <meta charset="utf-8" />
134
- <title>Affidavit CDN Demo</title>
135
- <script type="module">
136
- import { defineCustomElements } from "https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.3/dist/affidavit-library/browser/loader.js";
137
- defineCustomElements(window);
138
- </script>
139
- </head>
140
- <body>
141
- <highcourt-affidavit-app token="FHC_sk_xxxxxx" mode="test" app-id="AFF-12345" template-id="TEMPLATE-01"></highcourt-affidavit-app>
142
- </body>
143
- </html>
164
+ <script src="https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.x.x/dist/affidavit-library/browser/loader.js" ></script>
165
+
144
166
  ```
167
+ ---
145
168
 
146
- Update the version number in the URL to pin a specific release. Because the loader uses ES modules, the file still needs to be served over HTTP/HTTPS.
169
+ ## 10. `<highcourt-affidavit>` Web Component
147
170
 
148
- ### 3. Attributes and events
171
+ ### Attributes
149
172
 
150
- - **Attributes / properties** pass whatever configuration the component expects (e.g. `token`, `mode`, `app-id`, `template-id`, etc.).
151
- - **Events** – listen for custom events on the element: `element.addEventListener('callBack', (event) => { /* handle */ });`.
173
+ | Attribute | Required | Description |
174
+ |--------|----------|-------------|
175
+ | `token` | ❌ | API key |
176
+ | `mode` | ❌ | `development` or `production` |
177
+ | `template-id` | ❌ | Affidavit template |
178
+ | `templateId` | ❌ | Affidavit template |
179
+ | `client-ref` | ❌ | Client reference |
180
+ | `clientRef` | ❌ | Client reference |
181
+ | `payload` | ❌ | Prefilled data (JSON) |
152
182
 
153
- Document required fields for your integrators in this README and keep the package version current so they can reference it from npm/CDNs confidently.
183
+ ### Callbacks
154
184
 
155
- ### NPM Publishing
185
+ | Event | Description |
186
+ |-----|------------|
187
+ | `callBack` | Application submitted |
188
+ | `on-payment-success` / `paymentSuccess` | Payment completed |
189
+ | `overlay-close` / `overlayClose` | Overlay closed |
156
190
 
157
- 1. Ensure the bundle is up to date:
158
- ```bash
159
- npm install
160
- npm run build:elements
161
- ```
162
- 2. (Optional) inspect the package contents:
163
- ```bash
164
- npm pack
165
- tar -tf highcourt-affidavit-elements-0.2.3.tgz
166
- ```
167
- 3. Publish a new version:
168
- ```bash
169
- npm login
170
- npm version patch # or minor / major
171
- npm publish --access public
172
- ```
173
- 4. Tag the release in git:
174
- ```bash
175
- git tag v0.2.3
176
- git push origin v0.2.3
177
- ```
191
+ ---
178
192
 
179
- Keep version numbers in URLs/snippets to avoid breaking integrators. Provide updated tokens/modes per partner, and remind them to serve the assets over HTTPS (not `file://`).
193
+ ## 11. `<pay-affidavit>` Web Component
180
194
 
181
- ### Publish the Angular library separately
195
+ ### Attributes
182
196
 
183
- To ship the original Angular module (`HighcourtAffidavitModule`) as its own package:
197
+ | Attribute | Required | Description |
198
+ |--------|----------|-------------|
199
+ | `token` | ✅ | API key |
200
+ | `app-no` | ✅ | Application number |
201
+ | `should-display-details` | ❌ | Show payment breakdown |
184
202
 
185
- ```bash
186
- ng build highcourt-affidavit
187
- cd dist/highcourt-affidavit
188
- npm publish --access public
203
+ ### Callbacks
204
+
205
+ | Event | Description |
206
+ |-----|------------|
207
+ | `handlePayment` | Payment processed (success/failure) |
208
+ | `overlayClose` | Payment overlay closed |
209
+
210
+ ```js
211
+ payElement.addEventListener("handlePayment", (e) => {
212
+ console.log("Payment status:", e.detail.status);
213
+ });
189
214
  ```
190
215
 
191
- This uses the `projects/highcourt-affidavit/package.json` name (`highcourt-affidavit`), which stays independent from the web component package (`highcourt-affidavit-elements`).
216
+ ---
217
+
218
+ ## 12. `<bulk-create-applications>` – Web Component
192
219
 
193
- ## Installation
220
+ ### Attributes
194
221
 
195
- 1. **Install using npm:**
222
+ | Attribute | Required | Description |
223
+ |--------|----------|-------------|
224
+ | `token` | ❌ | API key |
225
+ | `mode` | ❌ | Environment |
226
+ | `affidavit-template-id` | ✅ | Template ID |
227
+ | `client-ref` | ❌ | Bulk session reference |
228
+ | `page` | ❌ | new | review | details | summary |
196
229
 
197
- ```bash
198
- npm install highcourt-affidavit
199
- ```
230
+ ### Callbacks
200
231
 
201
- ## 2. Import the module
232
+ | Event | Description |
233
+ |-----|------------|
234
+ | `callBack` | Bulk submission completed |
235
+ | `overlayClose` | Workspace closed |
236
+ | `error` | Bulk workflow error |
202
237
 
203
- In your Angular app, import the HighcourtAffidavitModule in your app module or any other relevant module where you want to use the affidavit functionality. Pass your API keys from the environment configuration:
238
+ ---
239
+
240
+ ## 13. Unified Web Component Callback Contract
204
241
 
205
242
  ```ts
206
- import { NgModule } from '@angular/core';
243
+ interface WebComponentCallback {
244
+ component: "highcourt-affidavit" | "pay-affidavit" | "bulk-create-applications";
245
+ action:
246
+ | "application_submitted"
247
+ | "payment_completed"
248
+ | "bulk_completed"
249
+ | "overlay_closed"
250
+ status: "success" | "pending" | "failed" | "cancelled";
251
+ reference?: string;
252
+ data: any;
253
+ timestamp: string;
254
+ }
255
+ ```
207
256
 
208
- import { HighcourtAffidavitModule } from "highcourt-affidavit";
209
- ...
257
+ ---
210
258
 
211
- @NgModule({
212
- imports: [
213
- HighcourtAffidavitModule.forRoot(environment.affidavit_api_secret_key, environment.mode), //both token and mode arguments are optional
214
- ],
215
- // ...
216
- })
217
- export class AppModule {}
218
- // make sure to set the affidavit_api_secret_key and also affidavit_api_public_key in your environment files
259
+ ## 14. Global Callback Listener
260
+
261
+ ```js
262
+ document.addEventListener("callBack", (event) => {
263
+ console.log("Global callback:", event.detail);
264
+ });
219
265
  ```
220
266
 
221
- ## 3. Two methods of Integrations
267
+ ---
222
268
 
223
- You can integrate the affidavit functionality either through the component-based approach or the service-based approach.
269
+ ## 15. Using Web Components in Angular Apps
224
270
 
225
- ### Option 1. Component-based Integration
271
+ ```ts
272
+ import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
226
273
 
227
- Integrate the `highcourt-affidavit` component into your HTML template, optionally configuring it with `token` and `mode` properties. Capture its output using the event callback for further processing.
274
+ @NgModule({
275
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
276
+ })
277
+ export class AppModule {}
278
+ ```
228
279
 
229
280
  ```html
230
- <highcourt-affidavit (callBack)="getApp($event)" [token]="'FHC_sk_xxxxxxxx-xxxxxx'" [mode]="'production'"> </highcourt-affidavit>
281
+ <div class="mb-4" *ngIf="showAffidavitOverlay">
282
+ <h4>📝 Affidavit Application Component</h4>
283
+ <highcourt-affidavit [appNo]="appNo" [templateId]="templateId"
284
+ [payload]="payload" [appNo]="appNo"
285
+ (callBack)="onAffidavitCallback($event)" [clientRef]="clientRef"
286
+ (overlayClose)="onAffidavitOverlayClose($event)"
287
+ (paymentSuccess)="onAffidavitPaymentSuccess($event)">
288
+ </highcourt-affidavit>
289
+ </div>
231
290
  ```
232
291
 
233
292
  ```ts
293
+ import { Component, OnInit } from '@angular/core';
234
294
 
235
- getApp(data: any) {
236
- console.log('Application', data);
295
+
296
+ @Component({
297
+ selector: 'app-root',
298
+ templateUrl: './app.component.html',
299
+ styleUrl: './app.component.scss',
300
+ standalone: false
301
+ })
302
+ export class AppComponent implements OnInit {
303
+ // Configuration
304
+ token = 'FHC-INTEG-pk_f0a01636119a45d218c2016758e368be';
305
+ mode = 'test';
306
+ templateId = 96;
307
+ appNo = 'APP-1768501941-0004';
308
+ clientRef = 'APP-SESSION-01';
309
+ showAffidavitOverlay = true;
310
+
311
+ // Payload data for pre-filling the affidavit form
312
+ payload = {
313
+ affidavit_type_name: 'Affidavit of Ownership',
314
+ deponent_name: 'Ahmad Ibrahim',
315
+ deponent_nin: 12345678912,
316
+ town_native: 'Gusau',
317
+ town_resident: 'Gusau',
318
+ occupation: 'Software Developer',
319
+ gender: 'Male',
320
+ religion: 'Islam',
321
+ applicant_email: 'applicant@mail.com',
322
+ applicant_phone: '07066666666',
323
+ adult_minor: 'adult',
324
+ affidavit_template_id: 96,
325
+ state_id: 1,
326
+ court_id: 1,
327
+ formEntries: [
328
+ {
329
+ placeholder: "deponent_company_position",
330
+ provided_value: "CEO"
331
+ },
332
+ {
333
+ placeholder: "contractor_company_name",
334
+ provided_value: "Centaur info Systems",
335
+ },
336
+ {
337
+ placeholder: "mda_authority_name",
338
+ provided_value: "FGN",
339
+ },
340
+ {
341
+ placeholder: "rc_number",
342
+ provided_value: "343434",
343
+ },
344
+ {
345
+ placeholder: "lot_number",
346
+ provided_value: "343434",
347
+ },
348
+ {
349
+ placeholder: "lot_title",
350
+ provided_value: "Purchase of 50 CNG Buses",
351
+ },
352
+ ],
353
+ clauseEntries: [],
354
+ };
355
+
356
+ constructor() { }
357
+
358
+ ngOnInit(): void {
359
+ this.ensureAffidavitWebComponentLoaded();
237
360
  }
238
- ```
239
361
 
240
- ### Option 2. Service-based Integration
362
+ private ensureAffidavitWebComponentLoaded(): Promise<void> {
363
+ try {
364
+ // Already registered
365
+ if (typeof window !== 'undefined' && window.customElements?.get('highcourt-affidavit')) {
366
+ return Promise.resolve();
367
+ }
368
+
369
+ // Loader already injected
370
+ const existing = document.getElementById('highcourt-affidavit-loader');
371
+ if (existing) return Promise.resolve();
372
+
373
+ return new Promise<void>((resolve, reject) => {
374
+ const script = document.createElement('script');
375
+ script.id = 'highcourt-affidavit-loader';
376
+ script.src =
377
+ 'https://cdn.jsdelivr.net/npm/highcourt-affidavit-elements@0.2.18/dist/affidavit-library/browser/loader.js';
378
+ script.async = true;
379
+ script.onload = () => resolve();
380
+ script.onerror = () => reject(new Error('Failed to load highcourt-affidavit web component loader'));
381
+ document.head.appendChild(script);
382
+ });
383
+ } catch {
384
+ // If we can't access DOM (edge case), just no-op.
385
+ return Promise.resolve();
386
+ }
387
+ }
241
388
 
242
- If you prefer a programmatic approach, use the HighcourtAffidavitLibraryService to create affidavits via a service call:
389
+ ngOnDestroy(): void {
390
+ // Clean up any injected loader script so it can't leak global CSS/JS across routes.
391
+ try {
392
+ const loader = document.getElementById('highcourt-affidavit-loader');
393
+ loader?.remove();
394
+ } catch {
395
+ // no-op
396
+ }
397
+ }
243
398
 
244
- ```ts
245
- import { Component } from '@angular/core';
246
- import { HighcourtAffidavitLibraryService } from 'highcourt-affidavit';
247
- ...
399
+ // Highcourt Affidavit Component Event Handlers
400
+ onAffidavitCallback(evt: any) {
401
+ const anyEvt = evt as any;
402
+ const detail = anyEvt?.detail ?? null;
248
403
 
249
- @Component({
250
- selector: 'app-create-affidavit',
251
- templateUrl: './create-affidavit.component.html',
252
- })
253
- export class CreateAffidavitComponent {
254
- constructor(private affidavitService: HighcourtAffidavitLibraryService) {}
255
-
256
- createAffidavit() {
257
- const affidavitData = {
258
- affidavit_type_name: 'Affidavit of Ownership',
259
- deponent_name: 'Ahmad Ibrahim',
260
- deponent_nin: 12345678912,
261
- town_native: 'Gusau',
262
- town_resident: 'Gusau',
263
- occupation: 'Software Developer',
264
- gender: 'Male',
265
- religion: 'Islam',
266
- signature_file: 'signature.png', //should be provided in binary
267
- passport_photo_file: 'passport.jpg', //should be provided in binary
268
- identity_photo_file: 'id-card.jpeg', //should be provided in binary
269
- applicant_email: 'applicant@mail.com',
270
- applicant_phone: '07066666666',
271
- adult_minor: 'adult',
272
- affidavit_template_id: 1,
273
- lga_id: 1,
274
- court_id: 1,
275
- formEntries: [
276
- { placeholder: 'fullName', label: 'Full Name', provided_value: 'Ahmad Ibrahim' },
277
- ],
278
- clauseEntries: [{ entry: 'Affidavit Clause' }],
279
- };
280
-
281
- this.affidavitService.create(affidavitData).subscribe({
282
- next: (response) => console.log('Affidavit Created:', response),
283
- error: (error) => console.error('Affidavit Creation Failed:', error),
284
- });
404
+ console.log('[highcourt-affidavit] event received:', evt);
405
+ }
406
+
407
+ onAffidavitPaymentSuccess(data: any) {
408
+ console.log('APP Affidavit Payment Success:', data);
409
+
410
+ // Handle payment success - e.g., update application status, show success message, etc.
285
411
  }
286
- }
287
412
 
413
+ onAffidavitOverlayClose(data: boolean) {
414
+ console.log('APP Affidavit Overlay Closed:', data);
415
+ if (data) {
416
+ this.showAffidavitOverlay = false;
417
+ }
418
+ }
288
419
 
289
- // make sure to set the affidavit_api_secret_key and also affidavit_api_public_key in your environment files
420
+ }
290
421
  ```
291
422
 
292
- ## 4. Add styles
423
+ ---
293
424
 
294
- To ensure your application uses the correct styles for PrimeNG components and the affidavit library, import the following styles in your global styles.scss file:
425
+ ## 16. Security & Compliance
295
426
 
296
- ```scss
297
- @import "~primeng/resources/primeng.min.css";
298
- @import "~primeflex/primeflex.scss";
299
- @import "~primeicons/primeicons.css";
300
- @import "~highcourt-affidavit/src/lib/styles.scss";
301
- @import url("https://fonts.googleapis.com/css?family=Comfortaa");
302
- ```
427
+ - Never expose live API keys
428
+ - Always validate payments server-side
429
+ - Enforce HTTPS
430
+ - Rotate credentials periodically
431
+ - Do not trust client-only callbacks
303
432
 
304
- ## 5. Environment Configuration
433
+ ---
305
434
 
306
- Ensure you have set your API keys in the environment files. These keys are required for the affidavit service to function correctly:
435
+ ## 17. Support
307
436
 
308
- ```ts
309
- export const environment = {
310
- production: false,
311
- affidavit_api_secret_key: "your_secret_key",
312
- affidavit_api_public_key: "your_public_key",
313
- mode: "test", // it can either be ('production' | 'test')
314
- };
315
- ```
437
+ 📧 support@centuryinformationsystems.com
438
+
439
+ ---
440
+
441
+ ## 18. License
442
+
443
+ MIT License
444
+ © 2026 ECMS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "highcourt-affidavit-elements",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "start": "ng serve",