@koredev/kore-web-sdk 11.18.0-rc.fbcaa35 → 11.19.0-rc.40c1509

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.
@@ -39,6 +39,10 @@ declare class Korei18nPlugin {
39
39
  today: string;
40
40
  yesterday: string;
41
41
  clickToCall: string;
42
+ read: string;
43
+ delivered: string;
44
+ sent: string;
45
+ you: string;
42
46
  };
43
47
  ja: {
44
48
  message: string;
@@ -75,6 +79,10 @@ declare class Korei18nPlugin {
75
79
  today: string;
76
80
  yesterday: string;
77
81
  clickToCall: string;
82
+ read: string;
83
+ delivered: string;
84
+ sent: string;
85
+ you: string;
78
86
  };
79
87
  ko: {
80
88
  message: string;
@@ -111,6 +119,10 @@ declare class Korei18nPlugin {
111
119
  today: string;
112
120
  yesterday: string;
113
121
  clickToCall: string;
122
+ read: string;
123
+ delivered: string;
124
+ sent: string;
125
+ you: string;
114
126
  };
115
127
  zh: {
116
128
  message: string;
@@ -147,6 +159,10 @@ declare class Korei18nPlugin {
147
159
  today: string;
148
160
  yesterday: string;
149
161
  clickToCall: string;
162
+ read: string;
163
+ delivered: string;
164
+ sent: string;
165
+ you: string;
150
166
  };
151
167
  de: {
152
168
  message: string;
@@ -183,6 +199,10 @@ declare class Korei18nPlugin {
183
199
  today: string;
184
200
  yesterday: string;
185
201
  clickToCall: string;
202
+ read: string;
203
+ delivered: string;
204
+ sent: string;
205
+ you: string;
186
206
  };
187
207
  };
188
208
  };
@@ -24,16 +24,18 @@ 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
+ private static readonly TEMPLATE_PERSIST_DURATION;
27
30
  isPendingSendAPIEvent: boolean;
31
+ private currentPersistedTemplate;
32
+ private isTemplateRestored;
28
33
  coolDownTime: number;
29
34
  cooldownState: {
30
35
  isActive: boolean;
31
36
  startTime: number;
32
37
  expiryTime: number;
33
38
  };
34
- isVisitorAlreadyChatting: boolean;
35
- private chatSessionInfo;
36
- private static readonly CHAT_SESSION_STORAGE_KEY;
37
39
  constructor(config: any);
38
40
  /**
39
41
  * Generates a unique browser session ID for the campaign trigger session
@@ -42,6 +44,11 @@ declare class ProactiveWebCampaignPlugin {
42
44
  generateBrowserSessionId(): string;
43
45
  onHostCreate(): void;
44
46
  onInit(): void;
47
+ /**
48
+ * Called when view is initialized (DOM ready)
49
+ * Attempts template restoration for chat templates that need DOM access
50
+ */
51
+ onViewInit(): void;
45
52
  onUrlChange(callback: () => void): void;
46
53
  onTitleChange(callback: (newTitle: string) => void): void;
47
54
  /**
@@ -132,7 +139,6 @@ declare class ProactiveWebCampaignPlugin {
132
139
  * @param campaigns - Array of campaign data
133
140
  */
134
141
  extractCustomColumns(campaigns: any[]): void;
135
- sendPWCStartEvent(): void;
136
142
  installPWCTemplates(): void;
137
143
  /**
138
144
  * Creates targeted timers for timeSpent conditions instead of polling every second
@@ -286,11 +292,74 @@ declare class ProactiveWebCampaignPlugin {
286
292
  * @returns Location name or null if not found
287
293
  */
288
294
  findLocationByType(response: any[], targetType: string): string | null;
289
- sendApiEvent(payload: string, route: string, campInstanceId?: string): Promise<void>;
295
+ /**
296
+ * Sends API event with retry logic
297
+ * @param payload - Event payload
298
+ * @param route - API route
299
+ * @param retryCount - Number of retries remaining (default: MAX_API_RETRIES)
300
+ * @returns Promise with API response
301
+ */
302
+ sendApiEvent(payload: any, route: string, retryCount?: number): Promise<any>;
303
+ /**
304
+ * Determines if an HTTP status code should trigger a retry
305
+ * Retries: 429 (Rate Limit), 5xx (Server Errors)
306
+ * Does NOT retry: 4xx (Client Errors, except 429)
307
+ * @param statusCode - HTTP status code
308
+ * @returns Boolean indicating if retry should happen
309
+ */
310
+ private shouldRetryStatusCode;
311
+ /**
312
+ * Initializes PWC campaigns by calling the pwe_verify API
313
+ */
314
+ initializePWCCampaigns(): Promise<void>;
315
+ /**
316
+ * Restores PWC state from sessionStorage for multi-page apps
317
+ * Called when pwe_data exists but in-memory state is lost (page navigation)
318
+ * Reconstructs campInfo from stored data to avoid redundant API calls
319
+ * @returns Boolean indicating if restoration was successful
320
+ */
321
+ restorePWCStateFromStorage(): boolean;
322
+ /**
323
+ * Handles the pwe_verify API response
324
+ * Processes campaign configuration and initializes PWC system
325
+ * @param responseData - API response data
326
+ */
327
+ handlePweVerifyResponse(responseData: any): Promise<void>;
328
+ /**
329
+ * Handles the pwe_event API response and renders campaign templates
330
+ * @param responseData - API response data
331
+ */
332
+ handlePweEventResponse(responseData: any): void;
333
+ /**
334
+ * Persists template data to sessionStorage for multi-page persistence
335
+ * @param templateData - Template data to persist
336
+ */
337
+ private persistTemplate;
338
+ /**
339
+ * Public method for templates to call when closing
340
+ * Clears persisted template from both memory and sessionStorage
341
+ */
342
+ clearPersistedTemplateFromStorage(): void;
343
+ /**
344
+ * Checks if a persisted template has expired
345
+ * @param template - Persisted template to check
346
+ * @returns Boolean indicating if template has expired
347
+ */
348
+ private isTemplateExpired;
349
+ /**
350
+ * Restores persisted template from sessionStorage if valid
351
+ * Called during onInit after PWC state restoration
352
+ */
353
+ private restorePersistedTemplate;
354
+ /**
355
+ * Re-renders a persisted template in the DOM
356
+ * @param template - Persisted template to render
357
+ */
358
+ private renderPersistedTemplate;
290
359
  /**
291
360
  * Constructs the pwe_data object based on the new campaign structure
292
361
  * Extracts custom column configurations and initializes custom data
293
- * @param campaignData - Campaign data received from socket
362
+ * @param campaignData - Campaign data received from API
294
363
  * @returns Constructed pwe_data object
295
364
  */
296
365
  constructPweData(campaignData: any): any;
@@ -336,7 +405,7 @@ declare class ProactiveWebCampaignPlugin {
336
405
  setupHoverListenerForCondition(condition: any, campInstanceId: string, group: any, groupIndex: number, conditionIndex: number, type: string): void;
337
406
  /**
338
407
  * Constructs rules/exclusions structure with proper grouping and condition tracking
339
- * Reads 'globalType' from socket message but stores as 'groupType' internally
408
+ * Reads 'globalType' from API response but stores as 'groupType' internally
340
409
  * @param rulesConfig - Rules or exclusions configuration
341
410
  * @returns Structured rules object
342
411
  */
@@ -347,6 +416,12 @@ declare class ProactiveWebCampaignPlugin {
347
416
  * @returns Object with conditions grouped by column
348
417
  */
349
418
  groupConditionsByColumn(conditions: any[]): any;
419
+ /**
420
+ * Reconstructs RAW rules format from PROCESSED format stored in pwe_data
421
+ * @param processedRules - Processed rules structure from pwe_data.expected
422
+ * @returns RAW rules structure matching original API format
423
+ */
424
+ reconstructRawRulesFromProcessed(processedRules: any): any;
350
425
  /**
351
426
  * Checks if a campaign has a specific condition type configured in RULES
352
427
  * @param campaign - Campaign object
@@ -585,11 +660,11 @@ declare class ProactiveWebCampaignPlugin {
585
660
  */
586
661
  updateSatisfactionFlags(campInstanceId: string): void;
587
662
  /**
588
- * Triggers campaign event using existing API logic
663
+ * Triggers campaign event using API and handles response
589
664
  * @param campInstanceId - Campaign instance ID
590
665
  * @param campId - Campaign ID
591
666
  */
592
- triggerCampaignEvent(campInstanceId: string, campId: string): void;
667
+ triggerCampaignEvent(campInstanceId: string, campId: string, campaignData: any): Promise<void>;
593
668
  /**
594
669
  * Checks if any campaign template is active
595
670
  * @returns Boolean indicating if any campaign template is active
@@ -626,22 +701,11 @@ declare class ProactiveWebCampaignPlugin {
626
701
  * Only called during page load/refresh - has error handling fallback
627
702
  */
628
703
  restoreCooldownState(): void;
629
- /**
630
- * Initialize chat session state from sessionStorage
631
- */
632
- initializeChatSessionState(): void;
633
704
  /**
634
705
  * Check if chat window is currently open
635
706
  * Note: When minimize class is present, chat window is actually OPEN
636
707
  * @returns true if chat window is open, false if closed/minimized
637
708
  */
638
709
  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;
646
710
  }
647
711
  export default ProactiveWebCampaignPlugin;
@@ -1,6 +1,7 @@
1
1
  import BaseChatTemplate from '../baseChatTemplate';
2
2
  import './clockPicker.scss';
3
3
  import { h } from 'preact';
4
+ export declare function ClockPickerInline(props: any): h.JSX.Element;
4
5
  export declare function ClockPicker(props: any): h.JSX.Element | undefined;
5
6
  declare class TemplateClockPicker extends BaseChatTemplate {
6
7
  hostInstance: any;
@@ -2,6 +2,7 @@ import BaseChatTemplate from '../baseChatTemplate';
2
2
  import './datePicker.scss';
3
3
  import { h } from 'preact';
4
4
  export declare function DatePickerExt(props: any): h.JSX.Element;
5
+ export declare function DatePickerInline(props: any): h.JSX.Element;
5
6
  export declare function DatePicker(props: any): h.JSX.Element | undefined;
6
7
  declare class TemplateDatePicker extends BaseChatTemplate {
7
8
  hostInstance: any;
@@ -2,6 +2,7 @@ import BaseChatTemplate from '../baseChatTemplate';
2
2
  import './dateRange.scss';
3
3
  import { h } from 'preact';
4
4
  export declare function DateRangeExt(props: any): h.JSX.Element;
5
+ export declare function DateRangeInline(props: any): h.JSX.Element;
5
6
  export declare function DateRange(props: any): h.JSX.Element | undefined;
6
7
  declare class TemplateDatePicker extends BaseChatTemplate {
7
8
  hostInstance: any;