import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { ZohoAsapLoaderService } from './zoho-asap-loader.service'; import * as i0 from "@angular/core"; export declare class ZohoAsapWidgetComponent implements OnInit, OnChanges, OnDestroy { private loader; appId: string; orgId: string; enabled: boolean; prefillFields?: { [key: string]: any; }; departmentId?: string; layoutId?: string; hideLauncher: boolean; nonce?: string; jwtToken?: string; widgetClosed: EventEmitter; private destroyed; private reloadInProgress; private scriptLoaded; private listenersAttached; private isWidgetReady; private pendingPrefillOperation; private currentJwtToken?; private authOperationInProgress; private lastLoadedPrefillFields?; private loggedOutResolver?; private loggedInResolver?; constructor(loader: ZohoAsapLoaderService); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** * ✅ PUBLIC METHOD: Open widget programmatically (for table row actions) * @param prefillData Optional prefill data to apply before opening */ openWidget(prefillData?: { [key: string]: any; }): void; /** * ✅ PUBLIC METHOD: Close/hide the widget */ closeWidget(): void; /** * Public refresh: destroy + re-inject the Zoho widget so the next open * starts fresh. Required to recover from Zoho's iframe SPA caching the * conversation/ticket detail view across tab switches. Triggers a fresh * JWT re-login (~2 s visible delay). */ refresh(): void; /** * Open widget with prefill data and navigate to ticket form */ private openWidgetWithPrefill; /** * ✅ Load script once * ✅ Set ZohoHCAsapSettings prefill BEFORE load */ private ensureWidgetLoaded; /** * ✅ Apply all settings BEFORE script load (prefill, hide launcher, etc.) */ private applySettingsBeforeLoad; /** * ✅ Inject CSS to hide launcher button immediately (before script loads) */ private injectHideLauncherStyles; /** * \u2705 Show the widget window (open it) */ private showWidget; /** * \u2705 Hide the widget window (close it) */ private hideWidget; /** * ✅ Attach Zoho events once * We will wait for these events to safely switch users. */ private attachListenersOnce; /** * Apply prefill using Zoho ASAP 2.0 API (after widget ready) * Requires departmentId and layoutId in format "departmentId&&&layoutId" */ private applyPrefillAfterReady; /** * ✅ JWT token change detection and authentication * - Detect user switch via JWT token comparison * - Login/logout as needed */ private runAuthSequence; private waitForLogout; private waitForLogin; /** * ✅ Logout and WAIT for onAfterUserLoggedOut */ private safeLogout; /** * ✅ Login and WAIT for onAfterUserLoggedIn */ private safeLogin; /** * Hard reload: destroy + re-inject the Zoho script and start a fresh login. * Used to defeat Zoho's iframe SPA cache; also called when the wrapper is * configured with `reloadOnClose` so the next open is always fresh. */ private reloadWidget; /** * ✅ STANDALONE: Clear ALL Zoho ASAP session data * This library should NOT require app-level storage clearing * All cleanup is handled internally here */ private clearZohoStorage; /** * Clear Zoho-related cookies * Must try multiple domain/path combinations because we don't know exact cookie settings */ private clearZohoCookies; /** * ✅ Extract user identity from JWT token * Returns unique identifier (oid, sub, or email) to detect user changes * This allows distinguishing token refresh (same user) from user switch (different user) */ private extractUserIdFromToken; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }