siarashield_workspace 0.0.28 → 0.0.30

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 CHANGED
@@ -16,20 +16,23 @@ Angular integration for CyberSiara **SiaraShield** captcha.
16
16
  npm i siarashield_workspace
17
17
  ```
18
18
 
19
- ## Quick setup (6 steps)
19
+ ## Quick setup (clear path)
20
20
 
21
- Use these steps for a fast Angular setup (function API flow).
21
+ Choose one integration style only:
22
22
 
23
- 1. Install package: `npm i siarashield_workspace`.
24
- 2. Add HTML in your form template:
25
- - `<div class="SiaraShield"></div>`
26
- - `<button type="submit" class="CaptchaSubmit" (click)="onSubmit()">Submit</button>`
27
- 3. Put public key in Angular environment (never expose private key in frontend).
28
- 4. Initialize captcha in component with `initSiaraShield({ publicKey, cspNonce })`.
29
- 5. On submit, call `checkSiaraShieldCaptcha()` first.
30
- 6. Call your API only when captcha is successful (`result.ok === true`).
23
+ - **Recommended:** Angular component (`<siara-shield ...>`).
24
+ - **Alternative:** function API (`initSiaraShield(...)` + `checkSiaraShieldCaptcha...`).
25
+
26
+ Do not mix both styles on the same page.
31
27
 
32
- If you prefer Angular component usage, see **Recommended: use the Angular component (easiest)** below.
28
+ 1. Install package: `npm i siarashield_workspace`.
29
+ 2. Put only the **public key** in Angular environment.
30
+ 3. Keep the **private key** on backend only (`.env` or secret store).
31
+ 4. Render captcha container (component tag or `<div class="SiaraShield"></div>` for function API).
32
+ 5. Keep submit button class: `class="CaptchaSubmit"`.
33
+ 6. Initialize captcha once per page load.
34
+ 7. On submit, run captcha check before API call.
35
+ 8. Call API only when captcha returns success (`result.ok === true` or `ok === true`).
33
36
 
34
37
  ## Get your keys
35
38
 
@@ -88,6 +91,7 @@ export class FormComponent {
88
91
 
89
92
  // Recommended: set from server (see CSP section)
90
93
  protected readonly cspNonce = (window as any).__cspNonce as string | undefined;
94
+ private isSubmitting = false;
91
95
 
92
96
  @ViewChild(SiaraShieldComponent) private readonly captcha?: SiaraShieldComponent;
93
97
 
@@ -97,14 +101,22 @@ export class FormComponent {
97
101
  }
98
102
 
99
103
  async onSubmit() {
100
- const ok = await this.captcha?.checkCaptchaAsync();
101
- if (!ok) {
102
- console.log('Captcha not completed yet');
103
- return;
104
+ if (this.isSubmitting) return;
105
+ this.isSubmitting = true;
106
+
107
+ try {
108
+ const ok = await this.captcha?.checkCaptchaAsync();
109
+ if (!ok) {
110
+ console.log('Captcha not completed yet');
111
+ return;
112
+ }
113
+
114
+ // When ok=true, token is available in global state and from (token) output.
115
+ alert('Form submitted successfully');
116
+ } finally {
117
+ // Allow next user attempt if captcha or API flow was not completed.
118
+ this.isSubmitting = false;
104
119
  }
105
-
106
- // When ok=true, token is available in global state and from (token) output.
107
- alert('Form submitted successfully');
108
120
  }
109
121
  }
110
122
  ```
@@ -280,7 +292,7 @@ The package still works in environments without CSP or with relaxed policies. If
280
292
  - `https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js`
281
293
  - jQuery and the captcha bootstrap process may create script elements dynamically (including via HTML strings / DOM fragments).
282
294
  - When `cspNonce` is provided, dynamically inserted `<script>` elements are assigned that nonce (including scripts inserted indirectly through DOM manipulation).
283
- - The plugin includes a built-in guard that suppresses rapid duplicate synthetic clicks on `.CaptchaSubmit` triggered by vendor runtime.
295
+ - The plugin includes a built-in guard that blocks vendor synthetic clicks on `.CaptchaSubmit` and suppresses rapid duplicate user clicks.
284
296
  - No application code changes are required for this guard.
285
297
  - This is required for compatibility with strict nonce-based CSP policies.
286
298
  - If a valid CSP nonce is required but not passed, browsers will block those script loads and the captcha will fail to initialize.
@@ -298,6 +310,10 @@ The package still works in environments without CSP or with relaxed policies. If
298
310
  - Ensure CSP allows the required hosts and the correct nonce is used.
299
311
  - CSP error in console:
300
312
  - Confirm the same **server-generated nonce** is present in CSP header, bootstrapping `<script>` tag, and initialization (`cspNonce`).
313
+ - A CSP warning/error on captcha popup close can still appear with current upstream vendor runtime on strict policies; if captcha flow still works, this is non-blocking. Use the compatibility policy (`includeUnsafeInlineScript: true`) when customer policy allows it.
314
+ - `Identifier 'currentLangCode' has already been declared`:
315
+ - This is a known vendor duplicate-inline-script issue during re-entry/navigation.
316
+ - The package now blocks duplicate insertion for that vendor snippet; upgrade to the latest build.
301
317
  - Token empty -> check browser console and network calls after clicking submit.
302
318
 
303
319
  ## Final checklist (customer handover)
@@ -10,6 +10,7 @@ function getInitCaptchaFn(g) {
10
10
  }
11
11
 
12
12
  const CONSOLE_PATCH_STATE_KEY = '__siaraShieldConsolePatchState__';
13
+ const VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY = '__siaraShieldVendorRuntimeErrorPatchState__';
13
14
  const DEFAULT_SUPPRESS_WINDOW_MS = 2000;
14
15
  function getConsolePatchState() {
15
16
  const globalState = globalThis;
@@ -20,6 +21,7 @@ function getConsolePatchState() {
20
21
  originalInfo: console.info.bind(console),
21
22
  originalWarn: console.warn.bind(console),
22
23
  originalDebug: console.debug.bind(console),
24
+ originalError: console.error.bind(console),
23
25
  };
24
26
  }
25
27
  return globalState[CONSOLE_PATCH_STATE_KEY];
@@ -33,6 +35,20 @@ function muteConsole() {
33
35
  console.info = () => undefined;
34
36
  console.warn = () => undefined;
35
37
  console.debug = () => undefined;
38
+ console.error = (...args) => {
39
+ const normalized = args
40
+ .map((arg) => (typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : ''))
41
+ .join(' ')
42
+ .toLowerCase();
43
+ // Known noisy upstream vendor runtime error path from CaptchaResources.js bootstrap.
44
+ if (normalized.includes('an errorevent with no error occurred') ||
45
+ normalized.includes('script error') ||
46
+ normalized.includes('captcharesources.js') ||
47
+ normalized.includes('getcybersiara')) {
48
+ return;
49
+ }
50
+ patchState.originalError(...args);
51
+ };
36
52
  }
37
53
  function unmuteConsole() {
38
54
  const patchState = getConsolePatchState();
@@ -45,6 +61,7 @@ function unmuteConsole() {
45
61
  console.info = patchState.originalInfo;
46
62
  console.warn = patchState.originalWarn;
47
63
  console.debug = patchState.originalDebug;
64
+ console.error = patchState.originalError;
48
65
  }
49
66
  function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS) {
50
67
  muteConsole();
@@ -52,6 +69,44 @@ function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS) {
52
69
  unmuteConsole();
53
70
  }, windowMs);
54
71
  }
72
+ function getVendorRuntimeErrorPatchState() {
73
+ const globalState = globalThis;
74
+ if (!globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY]) {
75
+ globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY] = {
76
+ installed: false,
77
+ originalOnError: globalThis.onerror ?? null,
78
+ };
79
+ }
80
+ return globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY];
81
+ }
82
+ function isLikelyVendorScriptRuntimeError(message, source) {
83
+ const normalizedMessage = String(message ?? '').trim().toLowerCase();
84
+ const normalizedSource = String(source ?? '').trim().toLowerCase();
85
+ const fromSiaraHost = normalizedSource.includes('embed.mycybersiara.com') || normalizedSource.includes('embedcdn.mycybersiara.com');
86
+ if (fromSiaraHost)
87
+ return true;
88
+ return normalizedMessage === 'script error.' || normalizedMessage === 'script error';
89
+ }
90
+ /**
91
+ * Suppresses noisy cross-origin vendor runtime script errors so Angular does not
92
+ * surface them as unhandled `ErrorEvent` crashes in the console.
93
+ */
94
+ function installVendorRuntimeErrorSuppression() {
95
+ const patchState = getVendorRuntimeErrorPatchState();
96
+ if (patchState.installed)
97
+ return;
98
+ const previousOnError = patchState.originalOnError;
99
+ globalThis.onerror = (message, source, lineno, colno, error) => {
100
+ if (isLikelyVendorScriptRuntimeError(message, source)) {
101
+ return true;
102
+ }
103
+ if (typeof previousOnError === 'function') {
104
+ return previousOnError.call(globalThis, message, source, lineno, colno, error);
105
+ }
106
+ return false;
107
+ };
108
+ patchState.installed = true;
109
+ }
55
110
 
56
111
  const SCRIPT_STATUS_BY_DOCUMENT = new WeakMap();
57
112
  const SCRIPT_PENDING_BY_DOCUMENT = new WeakMap();
@@ -78,6 +133,7 @@ function getDynamicScriptNoncePatchState() {
78
133
  globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {
79
134
  nonceByDocument: new WeakMap(),
80
135
  observerByDocument: new WeakMap(),
136
+ inlineCaptchaScriptByDocument: new WeakMap(),
81
137
  patched: false,
82
138
  };
83
139
  }
@@ -109,6 +165,34 @@ function applyTrackedNonce(node) {
109
165
  const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);
110
166
  applyScriptNonce(node, nonce);
111
167
  }
168
+ function getTrackedInlineCaptchaScripts(documentRef) {
169
+ const patchState = getDynamicScriptNoncePatchState();
170
+ let trackedScripts = patchState.inlineCaptchaScriptByDocument.get(documentRef);
171
+ if (!trackedScripts) {
172
+ trackedScripts = new Set();
173
+ patchState.inlineCaptchaScriptByDocument.set(documentRef, trackedScripts);
174
+ }
175
+ return trackedScripts;
176
+ }
177
+ function shouldSkipDuplicateInlineCaptchaScript(node) {
178
+ if (!isScriptElement(node) || Boolean(node.src)) {
179
+ return false;
180
+ }
181
+ const scriptBody = (node.textContent ?? '').trim();
182
+ if (!scriptBody || !scriptBody.includes('currentLangCode')) {
183
+ return false;
184
+ }
185
+ const documentRef = node.ownerDocument;
186
+ if (!documentRef) {
187
+ return false;
188
+ }
189
+ const trackedScripts = getTrackedInlineCaptchaScripts(documentRef);
190
+ if (trackedScripts.has(scriptBody)) {
191
+ return true;
192
+ }
193
+ trackedScripts.add(scriptBody);
194
+ return false;
195
+ }
112
196
  function walkAndApplyNonce(root, nonce) {
113
197
  if (!nonce)
114
198
  return;
@@ -162,10 +246,17 @@ function patchDynamicScriptInsertion() {
162
246
  const originalInsertBefore = Node.prototype.insertBefore;
163
247
  const originalReplaceChild = Node.prototype.replaceChild;
164
248
  Node.prototype.appendChild = function (node) {
249
+ // Vendor captcha injects an inline snippet with `currentLangCode` that crashes when appended twice.
250
+ if (shouldSkipDuplicateInlineCaptchaScript(node)) {
251
+ return node;
252
+ }
165
253
  applyTrackedNonce(node);
166
254
  return originalAppendChild.call(this, node);
167
255
  };
168
256
  Node.prototype.insertBefore = function (node, child) {
257
+ if (shouldSkipDuplicateInlineCaptchaScript(node)) {
258
+ return node;
259
+ }
169
260
  applyTrackedNonce(node);
170
261
  return originalInsertBefore.call(this, node, child);
171
262
  };
@@ -242,12 +333,12 @@ function loadScript(documentRef, src, options) {
242
333
  }
243
334
 
244
335
  const SUBMIT_GUARD_STATE_KEY = '__siaraShieldSubmitGuardInstalled__';
245
- const SYNTHETIC_CLICK_GUARD_WINDOW_MS = 1200;
336
+ const TRUSTED_CLICK_GUARD_WINDOW_MS = 1000;
246
337
  function installCaptchaSubmitGuard() {
247
338
  const globalState = globalThis;
248
339
  if (globalState[SUBMIT_GUARD_STATE_KEY])
249
340
  return;
250
- const lastSyntheticClickByButton = new WeakMap();
341
+ const lastTrustedClickByButton = new WeakMap();
251
342
  document.addEventListener('click', (event) => {
252
343
  const target = event.target;
253
344
  if (!(target instanceof Element))
@@ -255,18 +346,21 @@ function installCaptchaSubmitGuard() {
255
346
  const submitButton = target.closest('.CaptchaSubmit');
256
347
  if (!submitButton)
257
348
  return;
258
- // Vendor runtime may trigger multiple synthetic clicks.
259
- // Allow the first synthetic click and suppress rapid duplicates.
349
+ // Vendor runtime can emit synthetic clicks on .CaptchaSubmit.
350
+ // Always block synthetic clicks so a real user click maps to one app handler call.
260
351
  if (!event.isTrusted) {
261
- const now = Date.now();
262
- const last = lastSyntheticClickByButton.get(submitButton) ?? 0;
263
- if (now - last < SYNTHETIC_CLICK_GUARD_WINDOW_MS) {
264
- event.preventDefault();
265
- event.stopImmediatePropagation();
266
- return;
267
- }
268
- lastSyntheticClickByButton.set(submitButton, now);
352
+ event.preventDefault();
353
+ event.stopImmediatePropagation();
354
+ return;
269
355
  }
356
+ const now = Date.now();
357
+ const lastTrustedClickAt = lastTrustedClickByButton.get(submitButton) ?? 0;
358
+ if (now - lastTrustedClickAt < TRUSTED_CLICK_GUARD_WINDOW_MS) {
359
+ event.preventDefault();
360
+ event.stopImmediatePropagation();
361
+ return;
362
+ }
363
+ lastTrustedClickByButton.set(submitButton, now);
270
364
  }, true);
271
365
  globalState[SUBMIT_GUARD_STATE_KEY] = true;
272
366
  }
@@ -310,6 +404,14 @@ function ensureAccessibilityPopupAliases$1() {
310
404
  g[name] = stableFn;
311
405
  }
312
406
  }
407
+ function runInRootZone$1(fn) {
408
+ const g = globalThis;
409
+ const zoneRootRun = g.Zone?.root?.run;
410
+ if (typeof zoneRootRun === 'function') {
411
+ return zoneRootRun(fn);
412
+ }
413
+ return fn();
414
+ }
313
415
  class SiaraShieldComponent {
314
416
  host;
315
417
  loader;
@@ -362,8 +464,9 @@ class SiaraShieldComponent {
362
464
  }
363
465
  if (!options.allowVendorConsoleLogs) {
364
466
  suppressVendorConsoleWindow();
467
+ installVendorRuntimeErrorSuppression();
365
468
  }
366
- initCaptchaFn(options.publicKey);
469
+ runInRootZone$1(() => initCaptchaFn(options.publicKey));
367
470
  await this.waitForCheckCaptchaApi();
368
471
  this.initialized = true;
369
472
  }
@@ -421,22 +524,30 @@ class SiaraShieldComponent {
421
524
  }
422
525
  /**
423
526
  * Async-friendly captcha validation to avoid first-click timing issues.
424
- * Retries briefly until token/check API settles.
527
+ * Performs one validation call and waits for token propagation.
425
528
  */
426
529
  async checkCaptchaAsync(options) {
427
530
  const timeoutMs = options?.timeoutMs ?? 2000;
428
531
  const pollIntervalMs = options?.pollIntervalMs ?? 120;
429
- const startedAt = Date.now();
430
- if (this.checkCaptcha()) {
532
+ const beforeCheckDelayMs = options?.beforeCheckDelayMs ?? 140;
533
+ await new Promise((resolve) => setTimeout(resolve, beforeCheckDelayMs));
534
+ const ok = this.checkCaptcha();
535
+ if (!ok)
536
+ return false;
537
+ const g = getSiaraShieldGlobals();
538
+ if (typeof g.CyberSiaraToken === 'string' && g.CyberSiaraToken.length > 0) {
431
539
  return true;
432
540
  }
541
+ const startedAt = Date.now();
433
542
  while (Date.now() - startedAt < timeoutMs) {
434
543
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
435
- if (this.checkCaptcha()) {
544
+ const token = getSiaraShieldGlobals().CyberSiaraToken;
545
+ if (typeof token === 'string' && token.length > 0) {
546
+ this.token.emit(token);
436
547
  return true;
437
548
  }
438
549
  }
439
- return false;
550
+ return true;
440
551
  }
441
552
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SiaraShieldComponent, deps: [{ token: i0.ElementRef }, { token: SiaraShieldLoaderService }], target: i0.ɵɵFactoryTarget.Component });
442
553
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: SiaraShieldComponent, isStandalone: true, selector: "siara-shield", inputs: { publicKey: "publicKey", loadJQuery: "loadJQuery", cspNonce: "cspNonce", allowVendorConsoleLogs: "allowVendorConsoleLogs" }, outputs: { token: "token" }, ngImport: i0, template: `<div class="SiaraShield"></div>`, isInline: true, encapsulation: i0.ViewEncapsulation.None });
@@ -492,6 +603,14 @@ function isJQueryAlreadyAvailable() {
492
603
  const existingJqueryScript = document.querySelector('script[src*="jquery"]');
493
604
  return Boolean(existingJqueryScript);
494
605
  }
606
+ function runInRootZone(fn) {
607
+ const g = globalThis;
608
+ const zoneRootRun = g.Zone?.root?.run;
609
+ if (typeof zoneRootRun === 'function') {
610
+ return zoneRootRun(fn);
611
+ }
612
+ return fn();
613
+ }
495
614
  function preventDuplicateValidationBootstrap(g) {
496
615
  const originalAppendValidation = g.AppendValidationJS;
497
616
  if (typeof originalAppendValidation !== 'function') {
@@ -552,8 +671,9 @@ async function initSiaraShield(options) {
552
671
  }
553
672
  if (!options.allowVendorConsoleLogs) {
554
673
  suppressVendorConsoleWindow();
674
+ installVendorRuntimeErrorSuppression();
555
675
  }
556
- initCaptchaFn(options.publicKey);
676
+ runInRootZone(() => initCaptchaFn(options.publicKey));
557
677
  await waitForCheckCaptchaApi();
558
678
  initialized = true;
559
679
  })();
@@ -586,6 +706,8 @@ function checkSiaraShieldCaptcha(options) {
586
706
  async function checkSiaraShieldCaptchaAsync(options) {
587
707
  const timeoutMs = options?.timeoutMs ?? 1200;
588
708
  const pollIntervalMs = options?.pollIntervalMs ?? 120;
709
+ const beforeCheckDelayMs = options?.beforeCheckDelayMs ?? 140;
710
+ await new Promise((resolve) => setTimeout(resolve, beforeCheckDelayMs));
589
711
  const firstCheck = checkSiaraShieldCaptcha(); // one API call only
590
712
  if (!firstCheck.ok)
591
713
  return firstCheck;
@@ -1 +1 @@
1
- {"version":3,"file":"siarashield_workspace.mjs","sources":["../../../projects/siarashield-workspace/src/lib/siara-shield.globals.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-log-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-script-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-submit-guard.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","interface ConsolePatchState {\r\n depth: number;\r\n originalLog: Console['log'];\r\n originalInfo: Console['info'];\r\n originalWarn: Console['warn'];\r\n originalDebug: Console['debug'];\r\n}\r\n\r\nconst CONSOLE_PATCH_STATE_KEY = '__siaraShieldConsolePatchState__';\r\nconst DEFAULT_SUPPRESS_WINDOW_MS = 2000;\r\n\r\nfunction getConsolePatchState(): ConsolePatchState {\r\n const globalState = globalThis as typeof globalThis & {\r\n [CONSOLE_PATCH_STATE_KEY]?: ConsolePatchState;\r\n };\r\n\r\n if (!globalState[CONSOLE_PATCH_STATE_KEY]) {\r\n globalState[CONSOLE_PATCH_STATE_KEY] = {\r\n depth: 0,\r\n originalLog: console.log.bind(console),\r\n originalInfo: console.info.bind(console),\r\n originalWarn: console.warn.bind(console),\r\n originalDebug: console.debug.bind(console),\r\n };\r\n }\r\n\r\n return globalState[CONSOLE_PATCH_STATE_KEY];\r\n}\r\n\r\nfunction muteConsole(): void {\r\n const patchState = getConsolePatchState();\r\n patchState.depth += 1;\r\n if (patchState.depth > 1) return;\r\n\r\n console.log = () => undefined;\r\n console.info = () => undefined;\r\n console.warn = () => undefined;\r\n console.debug = () => undefined;\r\n}\r\n\r\nfunction unmuteConsole(): void {\r\n const patchState = getConsolePatchState();\r\n if (patchState.depth === 0) return;\r\n patchState.depth -= 1;\r\n if (patchState.depth > 0) return;\r\n\r\n console.log = patchState.originalLog;\r\n console.info = patchState.originalInfo;\r\n console.warn = patchState.originalWarn;\r\n console.debug = patchState.originalDebug;\r\n}\r\n\r\nexport function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS): void {\r\n muteConsole();\r\n setTimeout(() => {\r\n unmuteConsole();\r\n }, windowMs);\r\n}\r\n\r\n","type ScriptStatus = 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\ninterface DynamicScriptNoncePatchState {\n nonceByDocument: WeakMap<Document, string>;\n observerByDocument: WeakMap<Document, MutationObserver>;\n patched: boolean;\n}\n\nconst SCRIPT_STATUS_BY_DOCUMENT = new WeakMap<Document, Map<string, ScriptStatus>>();\nconst SCRIPT_PENDING_BY_DOCUMENT = new WeakMap<Document, Map<string, Promise<void>>>();\nconst DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';\n\nfunction getStatusBySrc(documentRef: Document): Map<string, ScriptStatus> {\n let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);\n if (!statusBySrc) {\n statusBySrc = new Map<string, ScriptStatus>();\n SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);\n }\n\n return statusBySrc;\n}\n\nfunction getPendingBySrc(documentRef: Document): Map<string, Promise<void>> {\n let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);\n if (!pendingBySrc) {\n pendingBySrc = new Map<string, Promise<void>>();\n SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);\n }\n\n return pendingBySrc;\n}\n\nfunction getDynamicScriptNoncePatchState(): DynamicScriptNoncePatchState {\n const globalState = globalThis as typeof globalThis & {\n [DYNAMIC_SCRIPT_NONCE_STATE_KEY]?: DynamicScriptNoncePatchState;\n };\n\n if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {\n globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {\n nonceByDocument: new WeakMap<Document, string>(),\n observerByDocument: new WeakMap<Document, MutationObserver>(),\n patched: false,\n };\n }\n\n return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];\n}\n\nfunction normalizeNonce(nonce?: string | null): string | undefined {\n const trimmed = nonce?.trim();\n return trimmed ? trimmed : undefined;\n}\n\nfunction isScriptElement(node: Node): node is HTMLScriptElement {\n return node instanceof Element && node.tagName.toLowerCase() === 'script';\n}\n\nexport function applyScriptNonce(script: HTMLScriptElement, nonce?: string): void {\n const resolvedNonce = normalizeNonce(nonce);\n if (!resolvedNonce) {\n return;\n }\n\n script.setAttribute('nonce', resolvedNonce);\n script.nonce = resolvedNonce;\n}\n\nfunction applyTrackedNonce(node: Node): void {\n if (!isScriptElement(node)) {\n return;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return;\n }\n\n const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);\n applyScriptNonce(node, nonce);\n}\n\nfunction walkAndApplyNonce(root: Node, nonce?: string): void {\n if (!nonce) return;\n\n // Fast path: root itself is a script.\n if (isScriptElement(root)) {\n applyScriptNonce(root, nonce);\n return;\n }\n\n // Common path for jQuery: append DocumentFragment containing scripts created via HTML parsing.\n if (root instanceof Element || root instanceof DocumentFragment) {\n const scripts = root.querySelectorAll?.('script') ?? [];\n for (const script of scripts) {\n applyScriptNonce(script as HTMLScriptElement, nonce);\n }\n }\n}\n\nfunction ensureNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.observerByDocument.get(documentRef)) {\n return;\n }\n\n const observer = new MutationObserver((records) => {\n const nonce = patchState.nonceByDocument.get(documentRef);\n if (!nonce) return;\n\n for (const record of records) {\n for (const node of record.addedNodes) {\n walkAndApplyNonce(node, nonce);\n }\n }\n });\n\n // Observe the full document because scripts can be injected into body/head by vendor/jQuery.\n const root = documentRef.documentElement ?? documentRef;\n observer.observe(root, { childList: true, subtree: true });\n patchState.observerByDocument.set(documentRef, observer);\n}\n\nfunction teardownNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n const observer = patchState.observerByDocument.get(documentRef);\n if (!observer) return;\n observer.disconnect();\n patchState.observerByDocument.delete(documentRef);\n}\n\nfunction patchDynamicScriptInsertion(): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.patched) {\n return;\n }\n\n const originalAppendChild = Node.prototype.appendChild;\n const originalInsertBefore = Node.prototype.insertBefore;\n const originalReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.appendChild = function <T extends Node>(node: T): T {\n applyTrackedNonce(node);\n return originalAppendChild.call(this, node) as T;\n };\n\n Node.prototype.insertBefore = function <T extends Node>(node: T, child: Node | null): T {\n applyTrackedNonce(node);\n return originalInsertBefore.call(this, node, child) as T;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(node: Node, child: T): T {\n applyTrackedNonce(node);\n return originalReplaceChild.call(this, node, child) as T;\n };\n\n patchState.patched = true;\n}\n\nexport function resolveCspNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedExplicitNonce = normalizeNonce(explicitNonce);\n if (resolvedExplicitNonce) {\n return resolvedExplicitNonce;\n }\n\n const scriptWithNonce = documentRef.querySelector<HTMLScriptElement>('script[nonce]');\n const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);\n if (nonceFromScript) {\n return nonceFromScript;\n }\n\n const nonceMeta = documentRef.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return normalizeNonce(nonceMeta?.content);\n}\n\nexport function prepareScriptNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);\n const patchState = getDynamicScriptNoncePatchState();\n\n patchDynamicScriptInsertion();\n\n if (resolvedNonce) {\n patchState.nonceByDocument.set(documentRef, resolvedNonce);\n ensureNonceMutationObserver(documentRef);\n } else {\n patchState.nonceByDocument.delete(documentRef);\n teardownNonceMutationObserver(documentRef);\n }\n\n return resolvedNonce;\n}\n\nexport function loadScript(documentRef: Document, src: string, options?: ScriptLoadOptions): Promise<void> {\n const nonce = prepareScriptNonce(documentRef, options?.nonce);\n const statusBySrc = getStatusBySrc(documentRef);\n const pendingBySrc = getPendingBySrc(documentRef);\n const existing = documentRef.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n\n if (existing) {\n applyScriptNonce(existing, nonce);\n const status = statusBySrc.get(src);\n if (status === 'loaded') {\n return Promise.resolve();\n }\n\n const pending = pendingBySrc.get(src);\n if (pending) {\n return pending;\n }\n\n return Promise.resolve();\n }\n\n statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = documentRef.createElement('script');\n script.src = src;\n script.async = true;\n applyScriptNonce(script, nonce);\n script.onload = () => {\n statusBySrc.set(src, 'loaded');\n pendingBySrc.delete(src);\n resolve();\n };\n script.onerror = () => {\n statusBySrc.set(src, 'error');\n pendingBySrc.delete(src);\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n documentRef.head.appendChild(script);\n });\n\n pendingBySrc.set(src, pending);\n return pending;\n}\n","const SUBMIT_GUARD_STATE_KEY = '__siaraShieldSubmitGuardInstalled__';\r\nconst SYNTHETIC_CLICK_GUARD_WINDOW_MS = 1200;\r\n\r\nexport function installCaptchaSubmitGuard(): void {\r\n const globalState = globalThis as typeof globalThis & {\r\n [SUBMIT_GUARD_STATE_KEY]?: boolean;\r\n };\r\n\r\n if (globalState[SUBMIT_GUARD_STATE_KEY]) return;\r\n\r\n const lastSyntheticClickByButton = new WeakMap<EventTarget, number>();\r\n\r\n document.addEventListener(\r\n 'click',\r\n (event) => {\r\n const target = event.target;\r\n if (!(target instanceof Element)) return;\r\n\r\n const submitButton = target.closest('.CaptchaSubmit');\r\n if (!submitButton) return;\r\n\r\n // Vendor runtime may trigger multiple synthetic clicks.\r\n // Allow the first synthetic click and suppress rapid duplicates.\r\n if (!event.isTrusted) {\r\n const now = Date.now();\r\n const last = lastSyntheticClickByButton.get(submitButton) ?? 0;\r\n if (now - last < SYNTHETIC_CLICK_GUARD_WINDOW_MS) {\r\n event.preventDefault();\r\n event.stopImmediatePropagation();\r\n return;\r\n }\r\n lastSyntheticClickByButton.set(submitButton, now);\r\n }\r\n },\r\n true,\r\n );\r\n\r\n globalState[SUBMIT_GUARD_STATE_KEY] = true;\r\n}\r\n\r\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { loadScript, type ScriptLoadOptions } from './siara-shield-script-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n return loadScript(this.document, src, options);\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\r\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\r\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\nimport { suppressVendorConsoleWindow } from './siara-shield-log-utils';\r\nimport { prepareScriptNonce } from './siara-shield-script-utils';\r\nimport { installCaptchaSubmitGuard } from './siara-shield-submit-guard';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\r\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\r\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\r\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\r\n\r\nfunction ensureAccessibilityPopupAliases(): void {\r\n const g = globalThis as typeof globalThis & Record<string, unknown>;\r\n const aliasNames = [\r\n 'RemoveAccesibilityPopup',\r\n '_RemoveAccesibilityPopup',\r\n 'RemoveAccesiblityPopup',\r\n '_RemoveAccesiblityPopup',\r\n ] as const;\r\n\r\n const existing = aliasNames\r\n .map((name) => g[name])\r\n .find((value): value is () => void => typeof value === 'function');\r\n\r\n const stableFn = existing ?? (() => undefined);\r\n for (const name of aliasNames) {\r\n g[name] = stableFn;\r\n }\r\n}\r\n\r\nexport interface SiaraShieldInitOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\r\n loadJQuery?: boolean;\r\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\r\n cspNonce?: string;\r\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\r\n allowVendorConsoleLogs?: boolean;\r\n}\r\n\r\n@Component({\r\n selector: 'siara-shield',\r\n standalone: true,\r\n template: `<div class=\"SiaraShield\"></div>`,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class SiaraShieldComponent implements AfterViewInit {\r\n @Input({ required: true }) publicKey!: string;\r\n @Input() loadJQuery = true;\r\n @Input() cspNonce?: string;\r\n @Input() allowVendorConsoleLogs = false;\r\n\r\n /**\r\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\r\n */\r\n @Output() token = new EventEmitter<string>();\r\n\r\n private initialized = false;\r\n\r\n constructor(\r\n private readonly host: ElementRef<HTMLElement>,\r\n private readonly loader: SiaraShieldLoaderService,\r\n ) {}\r\n\r\n async ngAfterViewInit(): Promise<void> {\r\n await this.init({\r\n publicKey: this.publicKey,\r\n loadJQuery: this.loadJQuery,\r\n cspNonce: this.cspNonce,\r\n allowVendorConsoleLogs: this.allowVendorConsoleLogs,\r\n });\r\n }\r\n\r\n async init(options: SiaraShieldInitOptions): Promise<void> {\r\n if (this.initialized) return;\r\n\r\n // Ensure the host element is in DOM before scripts run.\r\n void this.host.nativeElement;\r\n installCaptchaSubmitGuard();\r\n\r\n if (!options.publicKey) {\r\n throw new Error('SiaraShieldComponent: publicKey is required.');\r\n }\r\n const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);\r\n\r\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\r\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\r\n }\r\n\r\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n\r\n const g = getSiaraShieldGlobals();\r\n ensureAccessibilityPopupAliases();\r\n this.preventDuplicateValidationBootstrap(g);\r\n const initCaptchaFn = getInitCaptchaFn(g);\r\n if (!initCaptchaFn) {\r\n throw new Error(\r\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\r\n );\r\n }\r\n\r\n if (!options.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n initCaptchaFn(options.publicKey);\r\n await this.waitForCheckCaptchaApi();\r\n this.initialized = true;\r\n }\r\n\r\n /**\r\n * Detect preloaded jQuery from global object or an existing script tag.\r\n */\r\n private isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n 'script[src*=\"jquery\"]',\r\n );\r\n return Boolean(existingJqueryScript);\r\n }\r\n\r\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\r\n const originalAppendValidation = g.AppendValidationJS;\r\n if (typeof originalAppendValidation !== 'function') {\r\n return;\r\n }\r\n\r\n g.AppendValidationJS = () => {\r\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\r\n );\r\n if (existing) {\r\n return;\r\n }\r\n\r\n originalAppendValidation();\r\n };\r\n }\r\n\r\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\r\n }\r\n\r\n /**\r\n * Calls the global `CheckCaptcha()` from SiaraShield script.\r\n * Returns true when captcha is valid; emits token if available.\r\n */\r\n checkCaptcha(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (!g.CheckCaptcha) {\r\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\r\n }\r\n\r\n if (!this.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n const ok = g.CheckCaptcha();\r\n if (ok && typeof g.CyberSiaraToken === 'string') {\r\n this.token.emit(g.CyberSiaraToken);\r\n }\r\n return ok;\r\n }\r\n\r\n /**\r\n * Async-friendly captcha validation to avoid first-click timing issues.\r\n * Retries briefly until token/check API settles.\r\n */\r\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number }): Promise<boolean> {\r\n const timeoutMs = options?.timeoutMs ?? 2000;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const startedAt = Date.now();\r\n\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\nimport { suppressVendorConsoleWindow } from './siara-shield-log-utils';\r\nimport { loadScript, prepareScriptNonce } from './siara-shield-script-utils';\r\nimport { installCaptchaSubmitGuard } from './siara-shield-submit-guard';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\r\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\r\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\r\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\r\n\r\nexport interface InitSiaraShieldOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /**\r\n * Loads jQuery before SiaraShield script.\r\n * Default is true for easier integration.\r\n * Set to false only if your site/app already loads jQuery.\r\n */\r\n loadJQuery?: boolean;\r\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\r\n cspNonce?: string;\r\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\r\n allowVendorConsoleLogs?: boolean;\r\n}\r\n\r\nlet pending: Promise<void> | null = null;\r\nlet initialized = false;\r\n\r\nfunction ensureAccessibilityPopupAliases(): void {\r\n const g = globalThis as typeof globalThis & Record<string, unknown>;\r\n const aliasNames = [\r\n 'RemoveAccesibilityPopup',\r\n '_RemoveAccesibilityPopup',\r\n 'RemoveAccesiblityPopup',\r\n '_RemoveAccesiblityPopup',\r\n ] as const;\r\n\r\n const existing = aliasNames\r\n .map((name) => g[name])\r\n .find((value): value is () => void => typeof value === 'function');\r\n\r\n const stableFn = existing ?? (() => undefined);\r\n for (const name of aliasNames) {\r\n g[name] = stableFn;\r\n }\r\n}\r\n\r\nfunction isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\r\n return Boolean(existingJqueryScript);\r\n}\r\n\r\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\r\n const originalAppendValidation = g.AppendValidationJS;\r\n if (typeof originalAppendValidation !== 'function') {\r\n return;\r\n }\r\n\r\n g.AppendValidationJS = () => {\r\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\r\n if (existing) {\r\n return;\r\n }\r\n\r\n originalAppendValidation();\r\n };\r\n}\r\n\r\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\r\n}\r\n\r\n/**\r\n * Drop-in initializer for SiaraShield.\r\n * - Loads required scripts (optionally jQuery)\r\n * - Calls global `initCaptcha(publicKey)`\r\n *\r\n * Requirements in your HTML/template:\r\n * - You must render: `<div class=\"SiaraShield\"></div>`\r\n */\r\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\r\n if (initialized) return;\r\n if (pending) return pending;\r\n\r\n if (!options?.publicKey) {\r\n throw new Error('initSiaraShield: publicKey is required.');\r\n }\r\n\r\n pending = (async () => {\r\n installCaptchaSubmitGuard();\r\n const cspNonce = prepareScriptNonce(document, options.cspNonce);\r\n\r\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\r\n await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });\r\n }\r\n\r\n await loadScript(document, CAPTCHA_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n await loadScript(document, VALIDATION_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n\r\n const g = getSiaraShieldGlobals();\r\n ensureAccessibilityPopupAliases();\r\n preventDuplicateValidationBootstrap(g);\r\n const initCaptchaFn = getInitCaptchaFn(g);\r\n if (!initCaptchaFn) {\r\n throw new Error(\r\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\r\n );\r\n }\r\n\r\n if (!options.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n initCaptchaFn(options.publicKey);\r\n await waitForCheckCaptchaApi();\r\n initialized = true;\r\n })();\r\n\r\n try {\r\n await pending;\r\n } finally {\r\n // keep `pending` cached for subsequent callers\r\n }\r\n}\r\n\r\n/**\r\n * Calls global `CheckCaptcha()` and returns its boolean result.\r\n * If successful, returns `{ ok: true, token?: string }`.\r\n */\r\nexport function checkSiaraShieldCaptcha(options?: { allowVendorConsoleLogs?: boolean }): { ok: boolean; token?: string } {\r\n const g = getSiaraShieldGlobals();\r\n if (!g.CheckCaptcha) {\r\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\r\n }\r\n\r\n if (!options?.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n const ok = g.CheckCaptcha();\r\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\r\n return ok ? { ok: true, token } : { ok: false };\r\n}\r\n\r\n/**\r\n * Async-friendly captcha check to handle delayed token population.\r\n */\r\nexport async function checkSiaraShieldCaptchaAsync(options?: {\r\n timeoutMs?: number;\r\n pollIntervalMs?: number;\r\n}): Promise<{ ok: boolean; token?: string }> {\r\n const timeoutMs = options?.timeoutMs ?? 1200;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\r\n if (!firstCheck.ok) return firstCheck;\r\n if (firstCheck.token) return firstCheck;\r\n\r\n const startedAt = Date.now();\r\n // Token can be assigned slightly after successful verification.\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n const token = getSiaraShieldGlobals().CyberSiaraToken;\r\n if (typeof token === 'string' && token.length > 0) {\r\n return { ok: true, token };\r\n }\r\n }\r\n\r\n return { ok: true };\r\n}\r\n\r\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Include `script-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineScript?: boolean;\n /** Include `style-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'] as const;\nconst STYLE_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://mycybersiara.com',\n 'https://fonts.googleapis.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst FONT_HOSTS = [\n 'https://fonts.gstatic.com',\n 'https://mycybersiara.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst IMG_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://embedcdn.mycybersiara.com',\n 'https://mycybersiara.com',\n] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n // Default to strict/safe CSP. Customers can explicitly opt-in if they accept the risk.\n const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? false;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? false;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'default-src': unique([SELF]),\n 'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),\n 'font-src': unique([SELF, ...FONT_HOSTS, DATA]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","ensureAccessibilityPopupAliases","i1.SiaraShieldLoaderService"],"mappings":";;;;SAagB,qBAAqB,GAAA;AACnC,IAAA,OAAQ,UAAwE;AAClF;AAEM,S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,IAAA,MAAM,WAAW,GAAG,2BAA2B,CAAC,OAAO,CAAC;AAExD,IAAA,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACxD,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAC5E;AAEA,IAAA,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE;AAC5B,SAAA,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC;AACf;;AC1GA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"siarashield_workspace.mjs","sources":["../../../projects/siarashield-workspace/src/lib/siara-shield.globals.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-log-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-script-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-submit-guard.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","interface ConsolePatchState {\n depth: number;\n originalLog: Console['log'];\n originalInfo: Console['info'];\n originalWarn: Console['warn'];\n originalDebug: Console['debug'];\n originalError: Console['error'];\n}\n\ninterface VendorRuntimeErrorPatchState {\n installed: boolean;\n originalOnError: OnErrorEventHandler | null;\n}\n\nconst CONSOLE_PATCH_STATE_KEY = '__siaraShieldConsolePatchState__';\nconst VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY = '__siaraShieldVendorRuntimeErrorPatchState__';\nconst DEFAULT_SUPPRESS_WINDOW_MS = 2000;\n\nfunction getConsolePatchState(): ConsolePatchState {\n const globalState = globalThis as typeof globalThis & {\n [CONSOLE_PATCH_STATE_KEY]?: ConsolePatchState;\n };\n\n if (!globalState[CONSOLE_PATCH_STATE_KEY]) {\n globalState[CONSOLE_PATCH_STATE_KEY] = {\n depth: 0,\n originalLog: console.log.bind(console),\n originalInfo: console.info.bind(console),\n originalWarn: console.warn.bind(console),\n originalDebug: console.debug.bind(console),\n originalError: console.error.bind(console),\n };\n }\n\n return globalState[CONSOLE_PATCH_STATE_KEY];\n}\n\nfunction muteConsole(): void {\n const patchState = getConsolePatchState();\n patchState.depth += 1;\n if (patchState.depth > 1) return;\n\n console.log = () => undefined;\n console.info = () => undefined;\n console.warn = () => undefined;\n console.debug = () => undefined;\n console.error = (...args: unknown[]) => {\n const normalized = args\n .map((arg) => (typeof arg === 'string' ? arg : arg instanceof Error ? arg.message : ''))\n .join(' ')\n .toLowerCase();\n\n // Known noisy upstream vendor runtime error path from CaptchaResources.js bootstrap.\n if (\n normalized.includes('an errorevent with no error occurred') ||\n normalized.includes('script error') ||\n normalized.includes('captcharesources.js') ||\n normalized.includes('getcybersiara')\n ) {\n return;\n }\n\n patchState.originalError(...args);\n };\n}\n\nfunction unmuteConsole(): void {\n const patchState = getConsolePatchState();\n if (patchState.depth === 0) return;\n patchState.depth -= 1;\n if (patchState.depth > 0) return;\n\n console.log = patchState.originalLog;\n console.info = patchState.originalInfo;\n console.warn = patchState.originalWarn;\n console.debug = patchState.originalDebug;\n console.error = patchState.originalError;\n}\n\nexport function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS): void {\n muteConsole();\n setTimeout(() => {\n unmuteConsole();\n }, windowMs);\n}\n\nfunction getVendorRuntimeErrorPatchState(): VendorRuntimeErrorPatchState {\n const globalState = globalThis as typeof globalThis & {\n [VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY]?: VendorRuntimeErrorPatchState;\n };\n\n if (!globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY]) {\n globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY] = {\n installed: false,\n originalOnError: globalThis.onerror ?? null,\n };\n }\n\n return globalState[VENDOR_RUNTIME_ERROR_PATCH_STATE_KEY];\n}\n\nfunction isLikelyVendorScriptRuntimeError(message: unknown, source: unknown): boolean {\n const normalizedMessage = String(message ?? '').trim().toLowerCase();\n const normalizedSource = String(source ?? '').trim().toLowerCase();\n const fromSiaraHost =\n normalizedSource.includes('embed.mycybersiara.com') || normalizedSource.includes('embedcdn.mycybersiara.com');\n\n if (fromSiaraHost) return true;\n return normalizedMessage === 'script error.' || normalizedMessage === 'script error';\n}\n\n/**\n * Suppresses noisy cross-origin vendor runtime script errors so Angular does not\n * surface them as unhandled `ErrorEvent` crashes in the console.\n */\nexport function installVendorRuntimeErrorSuppression(): void {\n const patchState = getVendorRuntimeErrorPatchState();\n if (patchState.installed) return;\n\n const previousOnError = patchState.originalOnError;\n globalThis.onerror = (message, source, lineno, colno, error) => {\n if (isLikelyVendorScriptRuntimeError(message, source)) {\n return true;\n }\n\n if (typeof previousOnError === 'function') {\n return previousOnError.call(globalThis, message, source, lineno, colno, error);\n }\n\n return false;\n };\n\n patchState.installed = true;\n}\n\n","type ScriptStatus = 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\ninterface DynamicScriptNoncePatchState {\n nonceByDocument: WeakMap<Document, string>;\n observerByDocument: WeakMap<Document, MutationObserver>;\n inlineCaptchaScriptByDocument: WeakMap<Document, Set<string>>;\n patched: boolean;\n}\n\nconst SCRIPT_STATUS_BY_DOCUMENT = new WeakMap<Document, Map<string, ScriptStatus>>();\nconst SCRIPT_PENDING_BY_DOCUMENT = new WeakMap<Document, Map<string, Promise<void>>>();\nconst DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';\n\nfunction getStatusBySrc(documentRef: Document): Map<string, ScriptStatus> {\n let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);\n if (!statusBySrc) {\n statusBySrc = new Map<string, ScriptStatus>();\n SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);\n }\n\n return statusBySrc;\n}\n\nfunction getPendingBySrc(documentRef: Document): Map<string, Promise<void>> {\n let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);\n if (!pendingBySrc) {\n pendingBySrc = new Map<string, Promise<void>>();\n SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);\n }\n\n return pendingBySrc;\n}\n\nfunction getDynamicScriptNoncePatchState(): DynamicScriptNoncePatchState {\n const globalState = globalThis as typeof globalThis & {\n [DYNAMIC_SCRIPT_NONCE_STATE_KEY]?: DynamicScriptNoncePatchState;\n };\n\n if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {\n globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {\n nonceByDocument: new WeakMap<Document, string>(),\n observerByDocument: new WeakMap<Document, MutationObserver>(),\n inlineCaptchaScriptByDocument: new WeakMap<Document, Set<string>>(),\n patched: false,\n };\n }\n\n return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];\n}\n\nfunction normalizeNonce(nonce?: string | null): string | undefined {\n const trimmed = nonce?.trim();\n return trimmed ? trimmed : undefined;\n}\n\nfunction isScriptElement(node: Node): node is HTMLScriptElement {\n return node instanceof Element && node.tagName.toLowerCase() === 'script';\n}\n\nexport function applyScriptNonce(script: HTMLScriptElement, nonce?: string): void {\n const resolvedNonce = normalizeNonce(nonce);\n if (!resolvedNonce) {\n return;\n }\n\n script.setAttribute('nonce', resolvedNonce);\n script.nonce = resolvedNonce;\n}\n\nfunction applyTrackedNonce(node: Node): void {\n if (!isScriptElement(node)) {\n return;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return;\n }\n\n const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);\n applyScriptNonce(node, nonce);\n}\n\nfunction getTrackedInlineCaptchaScripts(documentRef: Document): Set<string> {\n const patchState = getDynamicScriptNoncePatchState();\n let trackedScripts = patchState.inlineCaptchaScriptByDocument.get(documentRef);\n if (!trackedScripts) {\n trackedScripts = new Set<string>();\n patchState.inlineCaptchaScriptByDocument.set(documentRef, trackedScripts);\n }\n\n return trackedScripts;\n}\n\nfunction shouldSkipDuplicateInlineCaptchaScript(node: Node): boolean {\n if (!isScriptElement(node) || Boolean(node.src)) {\n return false;\n }\n\n const scriptBody = (node.textContent ?? '').trim();\n if (!scriptBody || !scriptBody.includes('currentLangCode')) {\n return false;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return false;\n }\n\n const trackedScripts = getTrackedInlineCaptchaScripts(documentRef);\n if (trackedScripts.has(scriptBody)) {\n return true;\n }\n\n trackedScripts.add(scriptBody);\n return false;\n}\n\nfunction walkAndApplyNonce(root: Node, nonce?: string): void {\n if (!nonce) return;\n\n // Fast path: root itself is a script.\n if (isScriptElement(root)) {\n applyScriptNonce(root, nonce);\n return;\n }\n\n // Common path for jQuery: append DocumentFragment containing scripts created via HTML parsing.\n if (root instanceof Element || root instanceof DocumentFragment) {\n const scripts = root.querySelectorAll?.('script') ?? [];\n for (const script of scripts) {\n applyScriptNonce(script as HTMLScriptElement, nonce);\n }\n }\n}\n\nfunction ensureNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.observerByDocument.get(documentRef)) {\n return;\n }\n\n const observer = new MutationObserver((records) => {\n const nonce = patchState.nonceByDocument.get(documentRef);\n if (!nonce) return;\n\n for (const record of records) {\n for (const node of record.addedNodes) {\n walkAndApplyNonce(node, nonce);\n }\n }\n });\n\n // Observe the full document because scripts can be injected into body/head by vendor/jQuery.\n const root = documentRef.documentElement ?? documentRef;\n observer.observe(root, { childList: true, subtree: true });\n patchState.observerByDocument.set(documentRef, observer);\n}\n\nfunction teardownNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n const observer = patchState.observerByDocument.get(documentRef);\n if (!observer) return;\n observer.disconnect();\n patchState.observerByDocument.delete(documentRef);\n}\n\nfunction patchDynamicScriptInsertion(): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.patched) {\n return;\n }\n\n const originalAppendChild = Node.prototype.appendChild;\n const originalInsertBefore = Node.prototype.insertBefore;\n const originalReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.appendChild = function <T extends Node>(node: T): T {\n // Vendor captcha injects an inline snippet with `currentLangCode` that crashes when appended twice.\n if (shouldSkipDuplicateInlineCaptchaScript(node)) {\n return node;\n }\n applyTrackedNonce(node);\n return originalAppendChild.call(this, node) as T;\n };\n\n Node.prototype.insertBefore = function <T extends Node>(node: T, child: Node | null): T {\n if (shouldSkipDuplicateInlineCaptchaScript(node)) {\n return node;\n }\n applyTrackedNonce(node);\n return originalInsertBefore.call(this, node, child) as T;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(node: Node, child: T): T {\n applyTrackedNonce(node);\n return originalReplaceChild.call(this, node, child) as T;\n };\n\n patchState.patched = true;\n}\n\nexport function resolveCspNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedExplicitNonce = normalizeNonce(explicitNonce);\n if (resolvedExplicitNonce) {\n return resolvedExplicitNonce;\n }\n\n const scriptWithNonce = documentRef.querySelector<HTMLScriptElement>('script[nonce]');\n const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);\n if (nonceFromScript) {\n return nonceFromScript;\n }\n\n const nonceMeta = documentRef.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return normalizeNonce(nonceMeta?.content);\n}\n\nexport function prepareScriptNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);\n const patchState = getDynamicScriptNoncePatchState();\n\n patchDynamicScriptInsertion();\n\n if (resolvedNonce) {\n patchState.nonceByDocument.set(documentRef, resolvedNonce);\n ensureNonceMutationObserver(documentRef);\n } else {\n patchState.nonceByDocument.delete(documentRef);\n teardownNonceMutationObserver(documentRef);\n }\n\n return resolvedNonce;\n}\n\nexport function loadScript(documentRef: Document, src: string, options?: ScriptLoadOptions): Promise<void> {\n const nonce = prepareScriptNonce(documentRef, options?.nonce);\n const statusBySrc = getStatusBySrc(documentRef);\n const pendingBySrc = getPendingBySrc(documentRef);\n const existing = documentRef.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n\n if (existing) {\n applyScriptNonce(existing, nonce);\n const status = statusBySrc.get(src);\n if (status === 'loaded') {\n return Promise.resolve();\n }\n\n const pending = pendingBySrc.get(src);\n if (pending) {\n return pending;\n }\n\n return Promise.resolve();\n }\n\n statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = documentRef.createElement('script');\n script.src = src;\n script.async = true;\n applyScriptNonce(script, nonce);\n script.onload = () => {\n statusBySrc.set(src, 'loaded');\n pendingBySrc.delete(src);\n resolve();\n };\n script.onerror = () => {\n statusBySrc.set(src, 'error');\n pendingBySrc.delete(src);\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n documentRef.head.appendChild(script);\n });\n\n pendingBySrc.set(src, pending);\n return pending;\n}\n","const SUBMIT_GUARD_STATE_KEY = '__siaraShieldSubmitGuardInstalled__';\r\nconst TRUSTED_CLICK_GUARD_WINDOW_MS = 1000;\r\n\r\nexport function installCaptchaSubmitGuard(): void {\r\n const globalState = globalThis as typeof globalThis & {\r\n [SUBMIT_GUARD_STATE_KEY]?: boolean;\r\n };\r\n\r\n if (globalState[SUBMIT_GUARD_STATE_KEY]) return;\r\n\r\n const lastTrustedClickByButton = new WeakMap<EventTarget, number>();\r\n\r\n document.addEventListener(\r\n 'click',\r\n (event) => {\r\n const target = event.target;\r\n if (!(target instanceof Element)) return;\r\n\r\n const submitButton = target.closest('.CaptchaSubmit');\r\n if (!submitButton) return;\r\n\r\n // Vendor runtime can emit synthetic clicks on .CaptchaSubmit.\r\n // Always block synthetic clicks so a real user click maps to one app handler call.\r\n if (!event.isTrusted) {\r\n event.preventDefault();\r\n event.stopImmediatePropagation();\r\n return;\r\n }\r\n\r\n const now = Date.now();\r\n const lastTrustedClickAt = lastTrustedClickByButton.get(submitButton) ?? 0;\r\n if (now - lastTrustedClickAt < TRUSTED_CLICK_GUARD_WINDOW_MS) {\r\n event.preventDefault();\r\n event.stopImmediatePropagation();\r\n return;\r\n }\r\n lastTrustedClickByButton.set(submitButton, now);\r\n },\r\n true,\r\n );\r\n\r\n globalState[SUBMIT_GUARD_STATE_KEY] = true;\r\n}\r\n\r\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { loadScript, type ScriptLoadOptions } from './siara-shield-script-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n return loadScript(this.document, src, options);\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { installVendorRuntimeErrorSuppression, suppressVendorConsoleWindow } from './siara-shield-log-utils';\nimport { prepareScriptNonce } from './siara-shield-script-utils';\nimport { installCaptchaSubmitGuard } from './siara-shield-submit-guard';\n\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\nfunction ensureAccessibilityPopupAliases(): void {\n const g = globalThis as typeof globalThis & Record<string, unknown>;\n const aliasNames = [\n 'RemoveAccesibilityPopup',\n '_RemoveAccesibilityPopup',\n 'RemoveAccesiblityPopup',\n '_RemoveAccesiblityPopup',\n ] as const;\n\n const existing = aliasNames\n .map((name) => g[name])\n .find((value): value is () => void => typeof value === 'function');\n\n const stableFn = existing ?? (() => undefined);\n for (const name of aliasNames) {\n g[name] = stableFn;\n }\n}\n\nfunction runInRootZone<T>(fn: () => T): T {\n const g = globalThis as typeof globalThis & { Zone?: { root?: { run?: <U>(cb: () => U) => U } } };\n const zoneRootRun = g.Zone?.root?.run;\n if (typeof zoneRootRun === 'function') {\n return zoneRootRun(fn);\n }\n return fn();\n}\n\nexport interface SiaraShieldInitOptions {\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\n publicKey: string;\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\n allowVendorConsoleLogs?: boolean;\n}\n\n@Component({\n selector: 'siara-shield',\n standalone: true,\n template: `<div class=\"SiaraShield\"></div>`,\n encapsulation: ViewEncapsulation.None,\n})\nexport class SiaraShieldComponent implements AfterViewInit {\n @Input({ required: true }) publicKey!: string;\n @Input() loadJQuery = true;\n @Input() cspNonce?: string;\n @Input() allowVendorConsoleLogs = false;\n\n /**\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\n */\n @Output() token = new EventEmitter<string>();\n\n private initialized = false;\n\n constructor(\n private readonly host: ElementRef<HTMLElement>,\n private readonly loader: SiaraShieldLoaderService,\n ) {}\n\n async ngAfterViewInit(): Promise<void> {\n await this.init({\n publicKey: this.publicKey,\n loadJQuery: this.loadJQuery,\n cspNonce: this.cspNonce,\n allowVendorConsoleLogs: this.allowVendorConsoleLogs,\n });\n }\n\n async init(options: SiaraShieldInitOptions): Promise<void> {\n if (this.initialized) return;\n\n // Ensure the host element is in DOM before scripts run.\n void this.host.nativeElement;\n installCaptchaSubmitGuard();\n\n if (!options.publicKey) {\n throw new Error('SiaraShieldComponent: publicKey is required.');\n }\n const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n ensureAccessibilityPopupAliases();\n this.preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\n if (!options.allowVendorConsoleLogs) {\n suppressVendorConsoleWindow();\n installVendorRuntimeErrorSuppression();\n }\n runInRootZone(() => initCaptchaFn(options.publicKey));\n await this.waitForCheckCaptchaApi();\n this.initialized = true;\n }\n\n /**\n * Detect preloaded jQuery from global object or an existing script tag.\n */\n private isJQueryAlreadyAvailable(): boolean {\n const g = getSiaraShieldGlobals();\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\n return true;\n }\n\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\n 'script[src*=\"jquery\"]',\n );\n return Boolean(existingJqueryScript);\n }\n\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\n );\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n }\n\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n if (getSiaraShieldGlobals().CheckCaptcha) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n }\n\n /**\n * Calls the global `CheckCaptcha()` from SiaraShield script.\n * Returns true when captcha is valid; emits token if available.\n */\n checkCaptcha(): boolean {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\n }\n\n if (!this.allowVendorConsoleLogs) {\n suppressVendorConsoleWindow();\n }\n const ok = g.CheckCaptcha();\n if (ok && typeof g.CyberSiaraToken === 'string') {\n this.token.emit(g.CyberSiaraToken);\n }\n return ok;\n }\n\n /**\n * Async-friendly captcha validation to avoid first-click timing issues.\n * Performs one validation call and waits for token propagation.\n */\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number; beforeCheckDelayMs?: number }): Promise<boolean> {\n const timeoutMs = options?.timeoutMs ?? 2000;\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\n const beforeCheckDelayMs = options?.beforeCheckDelayMs ?? 140;\n await new Promise((resolve) => setTimeout(resolve, beforeCheckDelayMs));\n const ok = this.checkCaptcha();\n if (!ok) return false;\n\n const g = getSiaraShieldGlobals();\n if (typeof g.CyberSiaraToken === 'string' && g.CyberSiaraToken.length > 0) {\n return true;\n }\n\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n const token = getSiaraShieldGlobals().CyberSiaraToken;\n if (typeof token === 'string' && token.length > 0) {\n this.token.emit(token);\n return true;\n }\n }\n\n return true;\n }\n}\n\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { installVendorRuntimeErrorSuppression, suppressVendorConsoleWindow } from './siara-shield-log-utils';\nimport { loadScript, prepareScriptNonce } from './siara-shield-script-utils';\nimport { installCaptchaSubmitGuard } from './siara-shield-submit-guard';\n\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\nexport interface InitSiaraShieldOptions {\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\n publicKey: string;\n /**\n * Loads jQuery before SiaraShield script.\n * Default is true for easier integration.\n * Set to false only if your site/app already loads jQuery.\n */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\n allowVendorConsoleLogs?: boolean;\n}\n\nlet pending: Promise<void> | null = null;\nlet initialized = false;\n\nfunction ensureAccessibilityPopupAliases(): void {\n const g = globalThis as typeof globalThis & Record<string, unknown>;\n const aliasNames = [\n 'RemoveAccesibilityPopup',\n '_RemoveAccesibilityPopup',\n 'RemoveAccesiblityPopup',\n '_RemoveAccesiblityPopup',\n ] as const;\n\n const existing = aliasNames\n .map((name) => g[name])\n .find((value): value is () => void => typeof value === 'function');\n\n const stableFn = existing ?? (() => undefined);\n for (const name of aliasNames) {\n g[name] = stableFn;\n }\n}\n\nfunction isJQueryAlreadyAvailable(): boolean {\n const g = getSiaraShieldGlobals();\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\n return true;\n }\n\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\n return Boolean(existingJqueryScript);\n}\n\nfunction runInRootZone<T>(fn: () => T): T {\n const g = globalThis as typeof globalThis & { Zone?: { root?: { run?: <U>(cb: () => U) => U } } };\n const zoneRootRun = g.Zone?.root?.run;\n if (typeof zoneRootRun === 'function') {\n return zoneRootRun(fn);\n }\n return fn();\n}\n\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n}\n\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n if (getSiaraShieldGlobals().CheckCaptcha) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n}\n\n/**\n * Drop-in initializer for SiaraShield.\n * - Loads required scripts (optionally jQuery)\n * - Calls global `initCaptcha(publicKey)`\n *\n * Requirements in your HTML/template:\n * - You must render: `<div class=\"SiaraShield\"></div>`\n */\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\n if (initialized) return;\n if (pending) return pending;\n\n if (!options?.publicKey) {\n throw new Error('initSiaraShield: publicKey is required.');\n }\n\n pending = (async () => {\n installCaptchaSubmitGuard();\n const cspNonce = prepareScriptNonce(document, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\n await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await loadScript(document, CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await loadScript(document, VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n ensureAccessibilityPopupAliases();\n preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\n if (!options.allowVendorConsoleLogs) {\n suppressVendorConsoleWindow();\n installVendorRuntimeErrorSuppression();\n }\n runInRootZone(() => initCaptchaFn(options.publicKey));\n await waitForCheckCaptchaApi();\n initialized = true;\n })();\n\n try {\n await pending;\n } finally {\n // keep `pending` cached for subsequent callers\n }\n}\n\n/**\n * Calls global `CheckCaptcha()` and returns its boolean result.\n * If successful, returns `{ ok: true, token?: string }`.\n */\nexport function checkSiaraShieldCaptcha(options?: { allowVendorConsoleLogs?: boolean }): { ok: boolean; token?: string } {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\n }\n\n if (!options?.allowVendorConsoleLogs) {\n suppressVendorConsoleWindow();\n }\n const ok = g.CheckCaptcha();\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\n return ok ? { ok: true, token } : { ok: false };\n}\n\n/**\n * Async-friendly captcha check to handle delayed token population.\n */\nexport async function checkSiaraShieldCaptchaAsync(options?: {\n timeoutMs?: number;\n pollIntervalMs?: number;\n beforeCheckDelayMs?: number;\n}): Promise<{ ok: boolean; token?: string }> {\n const timeoutMs = options?.timeoutMs ?? 1200;\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\n const beforeCheckDelayMs = options?.beforeCheckDelayMs ?? 140;\n await new Promise((resolve) => setTimeout(resolve, beforeCheckDelayMs));\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\n if (!firstCheck.ok) return firstCheck;\n if (firstCheck.token) return firstCheck;\n\n const startedAt = Date.now();\n // Token can be assigned slightly after successful verification.\n while (Date.now() - startedAt < timeoutMs) {\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n const token = getSiaraShieldGlobals().CyberSiaraToken;\n if (typeof token === 'string' && token.length > 0) {\n return { ok: true, token };\n }\n }\n\n return { ok: true };\n}\n\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Include `script-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineScript?: boolean;\n /** Include `style-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'] as const;\nconst STYLE_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://mycybersiara.com',\n 'https://fonts.googleapis.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst FONT_HOSTS = [\n 'https://fonts.gstatic.com',\n 'https://mycybersiara.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst IMG_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://embedcdn.mycybersiara.com',\n 'https://mycybersiara.com',\n] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n // Default to strict/safe CSP. Customers can explicitly opt-in if they accept the risk.\n const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? false;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? false;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'default-src': unique([SELF]),\n 'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),\n 'font-src': unique([SELF, ...FONT_HOSTS, DATA]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","ensureAccessibilityPopupAliases","runInRootZone","i1.SiaraShieldLoaderService"],"mappings":";;;;SAagB,qBAAqB,GAAA;AACnC,IAAA,OAAQ,UAAwE;AAClF;AAEM,SAAU,gBAAgB,CAAC,CAAqB,EAAA;AACpD,IAAA,OAAO,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW;AACvC;;ACLA,MAAM,uBAAuB,GAAG,kCAAkC;AAClE,MAAM,oCAAoC,GAAG,6CAA6C;AAC1F,MAAM,0BAA0B,GAAG,IAAI;AAEvC,SAAS,oBAAoB,GAAA;IAC3B,MAAM,WAAW,GAAG,UAEnB;AAED,IAAA,IAAI,CAAC,WAAW,CAAC,uBAA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ACxD,IAAI,CAAC,IAAI,CAAC;AACf;;AC1GA;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siarashield_workspace",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Angular wrapper for CyberSiara SiaraShield captcha embed.",
5
5
  "keywords": [
6
6
  "cybersiara",
Binary file
@@ -51,11 +51,12 @@ declare class SiaraShieldComponent implements AfterViewInit {
51
51
  checkCaptcha(): boolean;
52
52
  /**
53
53
  * Async-friendly captcha validation to avoid first-click timing issues.
54
- * Retries briefly until token/check API settles.
54
+ * Performs one validation call and waits for token propagation.
55
55
  */
56
56
  checkCaptchaAsync(options?: {
57
57
  timeoutMs?: number;
58
58
  pollIntervalMs?: number;
59
+ beforeCheckDelayMs?: number;
59
60
  }): Promise<boolean>;
60
61
  static ɵfac: i0.ɵɵFactoryDeclaration<SiaraShieldComponent, never>;
61
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>;
@@ -114,6 +115,7 @@ declare function checkSiaraShieldCaptcha(options?: {
114
115
  declare function checkSiaraShieldCaptchaAsync(options?: {
115
116
  timeoutMs?: number;
116
117
  pollIntervalMs?: number;
118
+ beforeCheckDelayMs?: number;
117
119
  }): Promise<{
118
120
  ok: boolean;
119
121
  token?: string;