siarashield_workspace 0.0.31 → 0.0.32

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.
@@ -1,140 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { AfterViewInit, EventEmitter, ElementRef } from '@angular/core';
3
-
4
- interface ScriptLoadOptions {
5
- nonce?: string;
6
- }
7
-
8
- declare class SiaraShieldLoaderService {
9
- private readonly document;
10
- constructor(document: Document);
11
- loadScript(src: string, options?: ScriptLoadOptions): Promise<void>;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<SiaraShieldLoaderService, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<SiaraShieldLoaderService>;
14
- }
15
-
16
- interface SiaraShieldInitOptions {
17
- /** SiaraShield public key. Use "TEST-CYBERSIARA" for staging/development. */
18
- publicKey: string;
19
- /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */
20
- loadJQuery?: boolean;
21
- /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */
22
- cspNonce?: string;
23
- /** Set true only when actively debugging vendor/runtime internals in browser console. */
24
- allowVendorConsoleLogs?: boolean;
25
- }
26
- declare class SiaraShieldComponent implements AfterViewInit {
27
- private readonly host;
28
- private readonly loader;
29
- publicKey: string;
30
- loadJQuery: boolean;
31
- cspNonce?: string;
32
- allowVendorConsoleLogs: boolean;
33
- /**
34
- * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.
35
- */
36
- token: EventEmitter<string>;
37
- private initialized;
38
- constructor(host: ElementRef<HTMLElement>, loader: SiaraShieldLoaderService);
39
- ngAfterViewInit(): Promise<void>;
40
- init(options: SiaraShieldInitOptions): Promise<void>;
41
- /**
42
- * Detect preloaded jQuery from global object or an existing script tag.
43
- */
44
- private isJQueryAlreadyAvailable;
45
- private preventDuplicateValidationBootstrap;
46
- private waitForCheckCaptchaApi;
47
- /**
48
- * Calls the global `CheckCaptcha()` from SiaraShield script.
49
- * Returns true when captcha is valid; emits token if available.
50
- */
51
- checkCaptcha(): boolean;
52
- /**
53
- * Async-friendly captcha validation to avoid first-click timing issues.
54
- * Performs one validation call and waits for token propagation.
55
- */
56
- checkCaptchaAsync(options?: {
57
- timeoutMs?: number;
58
- pollIntervalMs?: number;
59
- beforeCheckDelayMs?: number;
60
- }): Promise<boolean>;
61
- static ɵfac: i0.ɵɵFactoryDeclaration<SiaraShieldComponent, never>;
62
- static ɵcmp: i0.ɵɵComponentDeclaration<SiaraShieldComponent, "siara-shield", never, { "publicKey": { "alias": "publicKey"; "required": true; }; "loadJQuery": { "alias": "loadJQuery"; "required": false; }; "cspNonce": { "alias": "cspNonce"; "required": false; }; "allowVendorConsoleLogs": { "alias": "allowVendorConsoleLogs"; "required": false; }; }, { "token": "token"; }, never, never, true, never>;
63
- }
64
-
65
- type InitCaptchaFn = (publicKey: string) => void;
66
- type CheckCaptchaFn = () => boolean;
67
- interface SiaraShieldGlobals {
68
- initCaptcha?: InitCaptchaFn;
69
- InitCaptcha?: InitCaptchaFn;
70
- CheckCaptcha?: CheckCaptchaFn;
71
- AppendValidationJS?: () => void;
72
- CyberSiaraToken?: string;
73
- jQuery?: unknown;
74
- $?: unknown;
75
- }
76
- declare function getSiaraShieldGlobals(): SiaraShieldGlobals;
77
- declare function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined;
78
-
79
- interface InitSiaraShieldOptions {
80
- /** SiaraShield public key. Use "TEST-CYBERSIARA" for staging/development. */
81
- publicKey: string;
82
- /**
83
- * Loads jQuery before SiaraShield script.
84
- * Default is true for easier integration.
85
- * Set to false only if your site/app already loads jQuery.
86
- */
87
- loadJQuery?: boolean;
88
- /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */
89
- cspNonce?: string;
90
- /** Set true only when actively debugging vendor/runtime internals in browser console. */
91
- allowVendorConsoleLogs?: boolean;
92
- }
93
- /**
94
- * Drop-in initializer for SiaraShield.
95
- * - Loads required scripts (optionally jQuery)
96
- * - Calls global `initCaptcha(publicKey)`
97
- *
98
- * Requirements in your HTML/template:
99
- * - You must render: `<div class="SiaraShield"></div>`
100
- */
101
- declare function initSiaraShield(options: InitSiaraShieldOptions): Promise<void>;
102
- /**
103
- * Calls global `CheckCaptcha()` and returns its boolean result.
104
- * If successful, returns `{ ok: true, token?: string }`.
105
- */
106
- declare function checkSiaraShieldCaptcha(options?: {
107
- allowVendorConsoleLogs?: boolean;
108
- }): {
109
- ok: boolean;
110
- token?: string;
111
- };
112
- /**
113
- * Async-friendly captcha check to handle delayed token population.
114
- */
115
- declare function checkSiaraShieldCaptchaAsync(options?: {
116
- timeoutMs?: number;
117
- pollIntervalMs?: number;
118
- beforeCheckDelayMs?: number;
119
- }): Promise<{
120
- ok: boolean;
121
- token?: string;
122
- }>;
123
-
124
- interface SiaraShieldCspOptions {
125
- /** Server-generated nonce value without the `'nonce-'` prefix. */
126
- nonce?: string;
127
- /** Optional if the customer still loads jQuery from Google's CDN. */
128
- includeGoogleApis?: boolean;
129
- /** Include `script-src 'unsafe-inline'` (not recommended for production). */
130
- includeUnsafeInlineScript?: boolean;
131
- /** Include `style-src 'unsafe-inline'` (not recommended for production). */
132
- includeUnsafeInlineStyle?: boolean;
133
- }
134
- type SiaraShieldCspDirectives = Record<string, string[]>;
135
- declare function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives;
136
- declare function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string;
137
- declare function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string;
138
-
139
- export { SiaraShieldComponent, SiaraShieldLoaderService, checkSiaraShieldCaptcha, checkSiaraShieldCaptchaAsync, getInitCaptchaFn, getSiaraShieldCspDirectives, getSiaraShieldCspPolicy, getSiaraShieldGlobals, initSiaraShield, mergeSiaraShieldCspPolicy };
140
- export type { CheckCaptchaFn, InitCaptchaFn, InitSiaraShieldOptions, SiaraShieldCspDirectives, SiaraShieldCspOptions, SiaraShieldGlobals, SiaraShieldInitOptions };