siarashield_workspace 0.0.10 → 0.0.11

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 +30 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -41,17 +41,36 @@ import { initSiaraShield, checkSiaraShieldCaptchaAsync } from 'siarashield_works
41
41
  5. Initialize captcha and validate on submit:
42
42
 
43
43
  ```ts
44
+ import { OnInit } from '@angular/core';
44
45
  import { environment } from '../environments/environment';
45
-
46
- await initSiaraShield({
47
- publicKey: environment.siaraShieldPublicKey, // or your .env mapped value
48
- loadJQuery: true,
49
- });
50
-
51
- const result = await checkSiaraShieldCaptchaAsync();
52
- if (result.ok) {
53
- console.log(result.token);
54
- // Please write your submit button click event function here //
46
+ import { checkSiaraShieldCaptcha, initSiaraShield } from 'siarashield_workspace';
47
+
48
+ export class LoginComponent implements OnInit {
49
+ ngOnInit() {
50
+ this.initializeCaptcha();
51
+ }
52
+
53
+ initializeCaptcha() {
54
+ initSiaraShield({
55
+ publicKey: environment.siaraShield.publicKey,
56
+ loadJQuery: true,
57
+ })
58
+ .then(() => {
59
+ console.log('SiaraShield Initialized ✅');
60
+ })
61
+ .catch((err: any) => {
62
+ console.error('Initialization Error:', err);
63
+ });
64
+ }
65
+
66
+ onSubmit() {
67
+ const result = checkSiaraShieldCaptcha();
68
+ if (result.ok) {
69
+ console.log(result.token);
70
+ // API call here
71
+ alert('Login Successful ✅');
72
+ }
73
+ }
55
74
  }
56
75
  ```
57
76
 
@@ -59,7 +78,7 @@ Note: Please put your submit button code inside `if (result.ok)`.
59
78
  Add `CaptchaSubmit` class in your submit button:
60
79
 
61
80
  ```html
62
- <button class="CaptchaSubmit"></button>
81
+ <button class="CaptchaSubmit" (click)="onSubmit()">Login</button>
63
82
  ```
64
83
 
65
84
  ## jQuery loading behavior
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siarashield_workspace",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Angular wrapper for CyberSiara SiaraShield captcha embed.",
5
5
  "keywords": [
6
6
  "cybersiara",