@koredev/kore-web-sdk 11.18.0-rc.7b2f801 → 11.18.0-rc.eb6fcd0

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.
@@ -33,6 +33,7 @@ declare class KoreMultiFileUploaderPlugin {
33
33
  bindEvents(): void;
34
34
  bytesToMB(bytes: any): number;
35
35
  onHostCreate(): void;
36
+ isSafariIOS(): boolean;
36
37
  convertFiles(selectedFile: any, customFileName: undefined): void;
37
38
  getFileToken(_recState: any, _file: any): void;
38
39
  getUID(pattern: string | undefined): string;
@@ -24,8 +24,6 @@ declare class ProactiveWebCampaignPlugin {
24
24
  static readonly MAX_FLATTEN_DEPTH = 10;
25
25
  private static readonly ACTIVE_CAMPAIGN_SELECTOR;
26
26
  private static readonly CHAT_CONTAINER_SELECTOR;
27
- private static readonly MAX_API_RETRIES;
28
- private static readonly RETRY_DELAY_MS;
29
27
  isPendingSendAPIEvent: boolean;
30
28
  coolDownTime: number;
31
29
  cooldownState: {
@@ -33,6 +31,9 @@ declare class ProactiveWebCampaignPlugin {
33
31
  startTime: number;
34
32
  expiryTime: number;
35
33
  };
34
+ isVisitorAlreadyChatting: boolean;
35
+ private chatSessionInfo;
36
+ private static readonly CHAT_SESSION_STORAGE_KEY;
36
37
  constructor(config: any);
37
38
  /**
38
39
  * Generates a unique browser session ID for the campaign trigger session
@@ -131,6 +132,7 @@ declare class ProactiveWebCampaignPlugin {
131
132
  * @param campaigns - Array of campaign data
132
133
  */
133
134
  extractCustomColumns(campaigns: any[]): void;
135
+ sendPWCStartEvent(): void;
134
136
  installPWCTemplates(): void;
135
137
  /**
136
138
  * Creates targeted timers for timeSpent conditions instead of polling every second
@@ -284,48 +286,11 @@ declare class ProactiveWebCampaignPlugin {
284
286
  * @returns Location name or null if not found
285
287
  */
286
288
  findLocationByType(response: any[], targetType: string): string | null;
287
- /**
288
- * Sends API event with retry logic
289
- * @param payload - Event payload
290
- * @param route - API route
291
- * @param retryCount - Number of retries remaining (default: MAX_API_RETRIES)
292
- * @returns Promise with API response
293
- */
294
- sendApiEvent(payload: any, route: string, retryCount?: number): Promise<any>;
295
- /**
296
- * Determines if an HTTP status code should trigger a retry
297
- * Retries: 429 (Rate Limit), 5xx (Server Errors)
298
- * Does NOT retry: 4xx (Client Errors, except 429)
299
- * @param statusCode - HTTP status code
300
- * @returns Boolean indicating if retry should happen
301
- */
302
- private shouldRetryStatusCode;
303
- /**
304
- * Initializes PWC campaigns by calling the pwe_verify API
305
- */
306
- initializePWCCampaigns(): Promise<void>;
307
- /**
308
- * Restores PWC state from sessionStorage for multi-page apps
309
- * Called when pwe_data exists but in-memory state is lost (page navigation)
310
- * Reconstructs campInfo from stored data to avoid redundant API calls
311
- * @returns Boolean indicating if restoration was successful
312
- */
313
- restorePWCStateFromStorage(): boolean;
314
- /**
315
- * Handles the pwe_verify API response
316
- * Processes campaign configuration and initializes PWC system
317
- * @param responseData - API response data
318
- */
319
- handlePweVerifyResponse(responseData: any): Promise<void>;
320
- /**
321
- * Handles the pwe_event API response and renders campaign templates
322
- * @param responseData - API response data
323
- */
324
- handlePweEventResponse(responseData: any): void;
289
+ sendApiEvent(payload: string, route: string, campInstanceId?: string): Promise<void>;
325
290
  /**
326
291
  * Constructs the pwe_data object based on the new campaign structure
327
292
  * Extracts custom column configurations and initializes custom data
328
- * @param campaignData - Campaign data received from API
293
+ * @param campaignData - Campaign data received from socket
329
294
  * @returns Constructed pwe_data object
330
295
  */
331
296
  constructPweData(campaignData: any): any;
@@ -371,7 +336,7 @@ declare class ProactiveWebCampaignPlugin {
371
336
  setupHoverListenerForCondition(condition: any, campInstanceId: string, group: any, groupIndex: number, conditionIndex: number, type: string): void;
372
337
  /**
373
338
  * Constructs rules/exclusions structure with proper grouping and condition tracking
374
- * Reads 'globalType' from API response but stores as 'groupType' internally
339
+ * Reads 'globalType' from socket message but stores as 'groupType' internally
375
340
  * @param rulesConfig - Rules or exclusions configuration
376
341
  * @returns Structured rules object
377
342
  */
@@ -382,12 +347,6 @@ declare class ProactiveWebCampaignPlugin {
382
347
  * @returns Object with conditions grouped by column
383
348
  */
384
349
  groupConditionsByColumn(conditions: any[]): any;
385
- /**
386
- * Reconstructs RAW rules format from PROCESSED format stored in pwe_data
387
- * @param processedRules - Processed rules structure from pwe_data.expected
388
- * @returns RAW rules structure matching original API format
389
- */
390
- reconstructRawRulesFromProcessed(processedRules: any): any;
391
350
  /**
392
351
  * Checks if a campaign has a specific condition type configured in RULES
393
352
  * @param campaign - Campaign object
@@ -626,11 +585,11 @@ declare class ProactiveWebCampaignPlugin {
626
585
  */
627
586
  updateSatisfactionFlags(campInstanceId: string): void;
628
587
  /**
629
- * Triggers campaign event using API and handles response
588
+ * Triggers campaign event using existing API logic
630
589
  * @param campInstanceId - Campaign instance ID
631
590
  * @param campId - Campaign ID
632
591
  */
633
- triggerCampaignEvent(campInstanceId: string, campId: string, campaignData: any): Promise<void>;
592
+ triggerCampaignEvent(campInstanceId: string, campId: string): void;
634
593
  /**
635
594
  * Checks if any campaign template is active
636
595
  * @returns Boolean indicating if any campaign template is active
@@ -667,11 +626,22 @@ declare class ProactiveWebCampaignPlugin {
667
626
  * Only called during page load/refresh - has error handling fallback
668
627
  */
669
628
  restoreCooldownState(): void;
629
+ /**
630
+ * Initialize chat session state from sessionStorage
631
+ */
632
+ initializeChatSessionState(): void;
670
633
  /**
671
634
  * Check if chat window is currently open
672
635
  * Note: When minimize class is present, chat window is actually OPEN
673
636
  * @returns true if chat window is open, false if closed/minimized
674
637
  */
675
638
  isChatWindowOpen(): boolean;
639
+ /**
640
+ * Update chat session state based on received events
641
+ * Handles Session_Start, Session_End, and Bot_Active events
642
+ * @param eventType - Type of event received
643
+ * @param data - Event data
644
+ */
645
+ updateChatSessionState(eventType: 'Session_Start' | 'Session_End' | 'Bot_Active', data: any): void;
676
646
  }
677
647
  export default ProactiveWebCampaignPlugin;