@koredev/kore-web-sdk 11.15.1-rc.4cd37be → 11.15.1-rc.d45d9f0
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/dist/esm/kore-web-sdk-chat.min.js +1 -1
- package/dist/esm/plugins/answers-template.js +1 -1
- package/dist/esm/plugins/kore-graph-templates-plugin.js +1 -1
- package/dist/esm/plugins/kore-picker-plugin.js +1 -1
- package/dist/esm/plugins/kore-solutions-plugin.js +1 -1
- package/dist/esm/plugins/proactive-web-campaign.js +1 -1
- package/dist/esm/plugins/v2-plugin.js +1 -1
- package/dist/plugins/proactiveWebCampaign/proactiveWebCampaign.d.ts +554 -6
- package/dist/umd/kore-web-sdk-umd-chat.min.js +1 -1
- package/dist/umd/plugins/answers-template.js +1 -1
- package/dist/umd/plugins/kore-graph-templates-plugin-umd.js +1 -1
- package/dist/umd/plugins/kore-picker-plugin-umd.js +1 -1
- package/dist/umd/plugins/kore-solutions-plugin-umd.js +1 -1
- package/dist/umd/plugins/proactive-web-campaign.js +1 -1
- package/dist/umd/plugins/v2-plugin.js +1 -1
- package/package.json +1 -1
|
@@ -8,22 +8,570 @@ declare class ProactiveWebCampaignPlugin {
|
|
|
8
8
|
visible: boolean;
|
|
9
9
|
authInfo: any;
|
|
10
10
|
timeSpent: any;
|
|
11
|
-
isCityCountryRule: any;
|
|
12
|
-
cityCountryData: any;
|
|
13
11
|
elementHoverDuration: number;
|
|
12
|
+
timeSpentTimers: any;
|
|
13
|
+
activeTimerIds: any;
|
|
14
|
+
pageChangeDebounceTimer: any;
|
|
15
|
+
customDataObject: any;
|
|
16
|
+
isInitialPageLoaded: boolean;
|
|
17
|
+
flattenedCustomData: any;
|
|
18
|
+
previousFlattenedCustomData: any;
|
|
19
|
+
customColumnConfig: Set<string>;
|
|
20
|
+
customDataDebounceTimer: any;
|
|
21
|
+
customDataChangeMap: any;
|
|
22
|
+
static readonly CUSTOM_OPERATORS: string[];
|
|
23
|
+
static readonly MAX_FLATTEN_DEPTH = 10;
|
|
14
24
|
constructor(config: any);
|
|
15
25
|
onHostCreate(): void;
|
|
16
26
|
onInit(): void;
|
|
27
|
+
onUrlChange(callback: () => void): void;
|
|
28
|
+
onTitleChange(callback: (newTitle: string) => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* - Custom Data Listener, listens to pwcCustomData event and processes the data
|
|
31
|
+
* - 1-second debouncing for performance
|
|
32
|
+
*/
|
|
33
|
+
customDataListener(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Processes custom data update with flattening and change detection
|
|
36
|
+
* persists flattened data to sessionStorage with merge strategy
|
|
37
|
+
* @param rawData - Raw nested JSON data from pwcCustomData event
|
|
38
|
+
*/
|
|
39
|
+
processCustomDataUpdate(rawData: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* Recursively flattens nested JSON object into dot-notation keys with array support
|
|
42
|
+
* @param obj - Object to flatten
|
|
43
|
+
* @param prefix - Current prefix for nested keys
|
|
44
|
+
* @param maxDepth - Maximum nesting depth (default 10)
|
|
45
|
+
* @param currentDepth - Current recursion depth
|
|
46
|
+
* @returns Flattened object with dot-notation keys
|
|
47
|
+
*
|
|
48
|
+
* Examples:
|
|
49
|
+
* {user: {profile: {age: 25}}} → {"user.profile.age": 25}
|
|
50
|
+
* {skills: ["sit", "stand"]} → {"skills[0]": "sit", "skills[1]": "stand"}
|
|
51
|
+
* {users: [{name: "John", tags: ["admin"]}]} → {"users[0].name": "John", "users[0].tags[0]": "admin"}
|
|
52
|
+
*/
|
|
53
|
+
flattenObject(obj: any, prefix?: string, maxDepth?: number, currentDepth?: number): any;
|
|
54
|
+
/**
|
|
55
|
+
* Detects changes between old and new flattened custom data
|
|
56
|
+
* Returns only the changed keys for performance optimization
|
|
57
|
+
* @param newFlattenedData - New flattened data
|
|
58
|
+
* @returns Object containing only changed keys with change metadata
|
|
59
|
+
*/
|
|
60
|
+
detectCustomDataChanges(newFlattenedData: any): any;
|
|
61
|
+
/**
|
|
62
|
+
* Handles custom data changes by updating relevant campaigns
|
|
63
|
+
* Only processes campaigns that have custom conditions matching the changed keys
|
|
64
|
+
* @param changes - Object containing changed keys with metadata
|
|
65
|
+
*/
|
|
66
|
+
handleCustomDataChanges(changes: any): void;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves persisted custom data from sessionStorage
|
|
69
|
+
* @returns Object containing flattened custom data or empty object if none exists
|
|
70
|
+
*/
|
|
71
|
+
getPersistedCustomData(): any;
|
|
72
|
+
/**
|
|
73
|
+
* Merges existing custom data with new custom data
|
|
74
|
+
* New data takes precedence over existing data for same keys
|
|
75
|
+
* @param existingData - Existing flattened custom data
|
|
76
|
+
* @param newData - New flattened custom data
|
|
77
|
+
* @returns Merged custom data object
|
|
78
|
+
*/
|
|
79
|
+
mergeCustomData(existingData: any, newData: any): any;
|
|
80
|
+
/**
|
|
81
|
+
* Persists custom data to sessionStorage with error handling
|
|
82
|
+
* @param customData - Flattened custom data to persist
|
|
83
|
+
*/
|
|
84
|
+
persistCustomDataToSession(customData: any): void;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if a campaign has custom conditions that match the changed keys
|
|
87
|
+
* @param campaign - Campaign object
|
|
88
|
+
* @param changedKeys - Array of changed custom data keys
|
|
89
|
+
* @returns Boolean indicating if campaign is affected by the changes
|
|
90
|
+
*/
|
|
91
|
+
campaignHasCustomConditionsForKeys(campaign: any, changedKeys: string[]): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if a rules/exclusions section has custom conditions matching changed keys
|
|
94
|
+
* @param groups - Array of groups to check
|
|
95
|
+
* @param changedKeys - Array of changed custom data keys
|
|
96
|
+
* @returns Boolean indicating if section is affected
|
|
97
|
+
*/
|
|
98
|
+
checkCustomConditionsInSection(groups: any[], changedKeys: string[]): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Checks if a campaign has a custom condition for a specific key
|
|
101
|
+
* @param campaign - Campaign object
|
|
102
|
+
* @param key - Custom data key to check
|
|
103
|
+
* @returns Boolean indicating if campaign has condition for this key
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* Updates or populates actual.rules OR actual.exclusions with custom actual values based on where condition is configured
|
|
107
|
+
* @param campInstanceId - Campaign instance ID
|
|
108
|
+
* @param changes - Object containing changed custom data
|
|
109
|
+
*/
|
|
110
|
+
updateCustomActualValues(campInstanceId: string, changes: any): void;
|
|
111
|
+
/**
|
|
112
|
+
* Extracts custom column configurations from campaigns during pwe_verify
|
|
113
|
+
* Creates a whitelist of custom data keys that campaigns actually use
|
|
114
|
+
* @param campaigns - Array of campaign data
|
|
115
|
+
*/
|
|
116
|
+
extractCustomColumns(campaigns: any[]): void;
|
|
17
117
|
sendPWCStartEvent(): void;
|
|
18
118
|
installPWCTemplates(): void;
|
|
19
|
-
|
|
20
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Creates targeted timers for timeSpent conditions instead of polling every second
|
|
121
|
+
* IMPORTANT: Only sets up timers for campaigns that match the current page
|
|
122
|
+
*/
|
|
123
|
+
setupTimeSpentTimers(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Handles isNot: true timeSpent conditions by immediately updating actual value and evaluating
|
|
126
|
+
* @param campInstanceId - Campaign instance ID
|
|
127
|
+
* @param groupId - Group ID containing the condition
|
|
128
|
+
* @param conditionId - Condition ID
|
|
129
|
+
* @param thresholdSeconds - Threshold value in seconds
|
|
130
|
+
*/
|
|
131
|
+
handleIsNotTimeSpentCondition(campInstanceId: string, groupId: string, conditionId: string, thresholdSeconds: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* Creates an individual timer for a specific timeSpent condition
|
|
134
|
+
* For regular conditions: timer fires when condition becomes satisfied
|
|
135
|
+
* For isNot conditions: timer fires when condition becomes NOT satisfied
|
|
136
|
+
* @param campInstanceId - Campaign instance ID
|
|
137
|
+
* @param groupId - Group ID containing the condition
|
|
138
|
+
* @param conditionId - Condition ID
|
|
139
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
140
|
+
*/
|
|
141
|
+
createTimeSpentTimer(campInstanceId: string, groupId: string, conditionId: string, timeoutMs: number): void;
|
|
142
|
+
/**
|
|
143
|
+
* Handles when a timeSpent condition timer fires
|
|
144
|
+
* For regular conditions: condition becomes satisfied (timeSpent >= threshold)
|
|
145
|
+
* For isNot conditions: condition becomes NOT satisfied (timeSpent >= threshold, so isNot becomes false)
|
|
146
|
+
* @param campInstanceId - Campaign instance ID
|
|
147
|
+
* @param groupId - Group ID
|
|
148
|
+
* @param conditionId - Condition ID
|
|
149
|
+
* @param timeSpentSeconds - Time spent in seconds
|
|
150
|
+
*/
|
|
151
|
+
handleTimeSpentConditionMet(campInstanceId: string, groupId: string, conditionId: string, timeSpentSeconds: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Updates timeSpent actual value for a campaign
|
|
154
|
+
* CORRECTED: Only populates actual.rules OR actual.exclusions based on where condition is configured
|
|
155
|
+
* CRITICAL: Triggers re-evaluation since exclusions can flip based on timeSpent changes
|
|
156
|
+
* @param campInstanceId - Campaign instance ID
|
|
157
|
+
* @param timeSpentSeconds - Time spent in seconds
|
|
158
|
+
*/
|
|
159
|
+
updateTimeSpentActualValue(campInstanceId: string, timeSpentSeconds: number): void;
|
|
160
|
+
/**
|
|
161
|
+
* Re-evaluates exclusions when timeSpent changes (dynamic exclusion behavior)
|
|
162
|
+
* This allows exclusions to flip from satisfied ↔ not satisfied as time progresses
|
|
163
|
+
* @param campInstanceId - Campaign instance ID
|
|
164
|
+
*/
|
|
165
|
+
reevaluateExclusionsForTimeSpentChange(campInstanceId: string): void;
|
|
166
|
+
/**
|
|
167
|
+
* Evaluates rules for a specific campaign (more efficient than evaluating all)
|
|
168
|
+
* @param campInstanceId - Campaign instance ID
|
|
169
|
+
* @param triggerType - What triggered this evaluation
|
|
170
|
+
*/
|
|
171
|
+
evaluateSpecificCampaign(campInstanceId: string, triggerType: string): void;
|
|
172
|
+
/**
|
|
173
|
+
* Clears a specific timeSpent timer
|
|
174
|
+
* @param timerKey - Timer key to clear
|
|
175
|
+
*/
|
|
176
|
+
clearTimeSpentTimer(timerKey: string): void;
|
|
177
|
+
/**
|
|
178
|
+
* Clears all timeSpent timers (useful for cleanup)
|
|
179
|
+
*/
|
|
180
|
+
clearAllTimeSpentTimers(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Restarts timers when URL changes (more efficient than continuous polling)
|
|
183
|
+
* Now includes hoverOn reset and hover listener management
|
|
184
|
+
* Now retrieves custom data from sessionStorage to handle navigation
|
|
185
|
+
*/
|
|
186
|
+
handlePageChange(): void;
|
|
187
|
+
/**
|
|
188
|
+
* Resets all hoverOn values to false while keeping the key structure
|
|
189
|
+
* This maintains performance by avoiding recreation of keys
|
|
190
|
+
*/
|
|
191
|
+
resetHoverOnValues(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Clears all hover listeners to prevent memory leaks
|
|
194
|
+
* Note: This is a placeholder for future implementation of listener tracking
|
|
195
|
+
*/
|
|
196
|
+
clearHoverListeners(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Resets timeSpent values for active campaigns when URL/page changes
|
|
199
|
+
* @param currentUrl - Current page URL
|
|
200
|
+
* @param currentPageTitle - Current page title
|
|
201
|
+
*/
|
|
202
|
+
resetTimeSpentForActiveCampaigns(currentUrl: string, currentPageTitle: string): void;
|
|
203
|
+
/**
|
|
204
|
+
* Updates page visit counts for campaigns that have pageVisitCount conditions
|
|
205
|
+
* Only populates actual.rules OR actual.exclusions based on where condition is configured
|
|
206
|
+
* NOTE: This method only updates the counts, evaluation happens in sendEvent()
|
|
207
|
+
*/
|
|
208
|
+
updatePageVisitCounts(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Lightweight initialization - replaces the heavy eventLoop
|
|
211
|
+
* Only sets up initial tracking and timers
|
|
212
|
+
*/
|
|
213
|
+
initializePWCTracking(): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Checks if the journey is valid based on the page visit array and website array
|
|
216
|
+
* implements reverse-order matching (checks last N entries only)
|
|
217
|
+
* @param pageVisitArray - The page visit array (pageVisitHistory) from sessionStorage
|
|
218
|
+
* @param websiteArray - The website array configured in the campaign
|
|
219
|
+
* @returns true if the recent journey matches the required sequence, false otherwise
|
|
220
|
+
*/
|
|
21
221
|
isJourneyValid(pageVisitArray: any, websiteArray: any): boolean;
|
|
22
|
-
sendEvent(pageObject: any, type: any): void;
|
|
23
222
|
checkEngagementHours(engHours: any): boolean;
|
|
24
223
|
createTimeSpentObjs(): void;
|
|
25
|
-
calculateTimeSpent(pageObj: any, type: any): void;
|
|
26
224
|
getLocationDetails(): void;
|
|
225
|
+
/**
|
|
226
|
+
* Detects and stores device type using hybrid detection approach
|
|
227
|
+
* HYBRID METHOD: Combines screen size, touch detection, and user agent for 95%+ accuracy
|
|
228
|
+
* CACHED: Detects once per session for optimal performance
|
|
229
|
+
*/
|
|
230
|
+
getDeviceDetails(): void;
|
|
231
|
+
/**
|
|
232
|
+
* Hybrid device detection algorithm
|
|
233
|
+
* Combines multiple signals for maximum accuracy across all devices and edge cases
|
|
234
|
+
* @returns Device type: 'mobile', 'tablet', or 'laptop'
|
|
235
|
+
*/
|
|
236
|
+
detectDeviceType(): string;
|
|
237
|
+
/**
|
|
238
|
+
* Calls the location API with coordinates and handles retry logic
|
|
239
|
+
* @param coordinates - Object containing latitude and longitude
|
|
240
|
+
*/
|
|
241
|
+
callLocationAPI(coordinates: any): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Sends the actual API request to the location endpoint
|
|
244
|
+
* @param payload - Request payload with latitude and longitude
|
|
245
|
+
* @returns Promise with API response
|
|
246
|
+
*/
|
|
247
|
+
sendLocationAPIRequest(payload: any): Promise<any>;
|
|
248
|
+
/**
|
|
249
|
+
* Schedules a retry of the location API call after 1 minute
|
|
250
|
+
* @param coordinates - Original coordinates for retry
|
|
251
|
+
*/
|
|
252
|
+
scheduleLocationAPIRetry(coordinates: any): void;
|
|
253
|
+
/**
|
|
254
|
+
* Parses API response and saves location data to sessionStorage
|
|
255
|
+
* @param apiResponse - Array response from location API
|
|
256
|
+
* @param coordinates - Original coordinates
|
|
257
|
+
*/
|
|
258
|
+
parseAndSaveLocationData(apiResponse: any[], coordinates: any): void;
|
|
259
|
+
/**
|
|
260
|
+
* Finds location data by type from API response
|
|
261
|
+
* @param response - API response array
|
|
262
|
+
* @param targetType - Type to search for (country, locality, administrative_area_level_1)
|
|
263
|
+
* @returns Location name or null if not found
|
|
264
|
+
*/
|
|
265
|
+
findLocationByType(response: any[], targetType: string): string | null;
|
|
27
266
|
sendApiEvent(payload: string, route: string, campInstanceId?: string): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Constructs the pwe_data object based on the new campaign structure
|
|
269
|
+
* Extracts custom column configurations and initializes custom data
|
|
270
|
+
* @param campaignData - Campaign data received from socket
|
|
271
|
+
* @returns Constructed pwe_data object
|
|
272
|
+
*/
|
|
273
|
+
constructPweData(campaignData: any): any;
|
|
274
|
+
/**
|
|
275
|
+
* Initializes custom data for all campaigns based on current flattened custom data
|
|
276
|
+
* This ensures campaigns have initial custom data values if pwcCustomData was received earlier
|
|
277
|
+
*/
|
|
278
|
+
initializeCustomDataForCampaigns(campaigns: any[]): void;
|
|
279
|
+
/**
|
|
280
|
+
* Initializes custom actual values for a specific campaign
|
|
281
|
+
* Retrieves custom data from sessionStorage for initialization
|
|
282
|
+
* @param campInstanceId - Campaign instance ID
|
|
283
|
+
* @param campaign - Campaign configuration
|
|
284
|
+
* @param campaignData - Campaign data structure to populate
|
|
285
|
+
*/
|
|
286
|
+
initializeCustomActualValuesForCampaign(campInstanceId: string, campaign: any, campaignData: any): void;
|
|
287
|
+
/**
|
|
288
|
+
* Sets up hover event listeners for campaigns with hoverOn rules
|
|
289
|
+
* Only sets up listeners for campaigns that match current page (website-aware)
|
|
290
|
+
*/
|
|
291
|
+
setupHoverListeners(): void;
|
|
292
|
+
/**
|
|
293
|
+
* Initializes hoverOn structure for a campaign (only for active campaigns)
|
|
294
|
+
* Smart key creation - only create keys that don't exist
|
|
295
|
+
* @param campaign - Campaign object
|
|
296
|
+
*/
|
|
297
|
+
initializeHoverOnForCampaign(campaign: any): void;
|
|
298
|
+
/**
|
|
299
|
+
* Sets up hover listeners for a specific campaign
|
|
300
|
+
* @param campaign - Campaign object
|
|
301
|
+
*/
|
|
302
|
+
setupHoverListenersForCampaign(campaign: any): void;
|
|
303
|
+
/**
|
|
304
|
+
* Sets up hover listener for a specific hoverOn condition
|
|
305
|
+
* ENHANCED: Now uses key-based structure and supports both rules and exclusions
|
|
306
|
+
* @param condition - The hoverOn condition configuration
|
|
307
|
+
* @param campInstanceId - Campaign instance ID
|
|
308
|
+
* @param group - Group object
|
|
309
|
+
* @param groupIndex - Group index (fallback for missing group.id)
|
|
310
|
+
* @param conditionIndex - Condition index (fallback for missing condition.id)
|
|
311
|
+
* @param type - 'rules' or 'exclusions'
|
|
312
|
+
*/
|
|
313
|
+
setupHoverListenerForCondition(condition: any, campInstanceId: string, group: any, groupIndex: number, conditionIndex: number, type: string): void;
|
|
314
|
+
/**
|
|
315
|
+
* Constructs rules/exclusions structure with proper grouping and condition tracking
|
|
316
|
+
* Reads 'globalType' from socket message but stores as 'groupType' internally
|
|
317
|
+
* @param rulesConfig - Rules or exclusions configuration
|
|
318
|
+
* @returns Structured rules object
|
|
319
|
+
*/
|
|
320
|
+
constructRulesStructure(rulesConfig: any): any;
|
|
321
|
+
/**
|
|
322
|
+
* Groups conditions by column type for easier evaluation
|
|
323
|
+
* @param conditions - Array of conditions
|
|
324
|
+
* @returns Object with conditions grouped by column
|
|
325
|
+
*/
|
|
326
|
+
groupConditionsByColumn(conditions: any[]): any;
|
|
327
|
+
/**
|
|
328
|
+
* Checks if a campaign has a specific condition type configured in RULES
|
|
329
|
+
* @param campaign - Campaign object
|
|
330
|
+
* @param conditionType - Type of condition to check for (e.g., 'pageVisitCount', 'timeSpent', 'user', etc.)
|
|
331
|
+
* @returns Boolean indicating if campaign has the condition type in rules
|
|
332
|
+
*/
|
|
333
|
+
campaignHasConditionType(campaign: any, conditionType: string): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Checks if a campaign has a specific condition type configured in EXCLUSIONS
|
|
336
|
+
* @param campaign - Campaign object
|
|
337
|
+
* @param conditionType - Type of condition to check for (e.g., 'pageVisitCount', 'timeSpent', 'user', etc.)
|
|
338
|
+
* @returns Boolean indicating if campaign has the condition type in exclusions
|
|
339
|
+
*/
|
|
340
|
+
campaignHasExclusionConditionType(campaign: any, conditionType: string): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Gets active campaigns based on current URL and page title
|
|
343
|
+
* @param currentUrl - Current page URL
|
|
344
|
+
* @param currentPageTitle - Current page title
|
|
345
|
+
* @returns Array of active campaigns
|
|
346
|
+
*/
|
|
347
|
+
getActiveCampaigns(currentUrl: string, currentPageTitle: string): any[];
|
|
348
|
+
/**
|
|
349
|
+
* Checks if website configuration matches current page
|
|
350
|
+
* @param websiteConfig - Website configuration array
|
|
351
|
+
* @param currentUrl - Current page URL
|
|
352
|
+
* @param currentPageTitle - Current page title
|
|
353
|
+
* @returns Boolean indicating if website matches
|
|
354
|
+
*/
|
|
355
|
+
checkWebsiteMatching(websiteConfig: any[], currentUrl: string, currentPageTitle: string): boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Checks journey matching for 'then' operator
|
|
358
|
+
* @param websiteConfig - Website configuration array
|
|
359
|
+
* @returns Boolean indicating if journey matches
|
|
360
|
+
*/
|
|
361
|
+
checkJourneyMatching(websiteConfig: any[]): boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Evaluates active campaigns with OPTIMIZED FLOW: check Exclusions as blockers First, Only evaluate Rules if not blocked
|
|
364
|
+
* @param activeCampaigns - Array of active campaigns
|
|
365
|
+
* @param currentUrl - Current page URL
|
|
366
|
+
* @param currentPageTitle - Current page title
|
|
367
|
+
* @param eventType - Type of event triggering evaluation
|
|
368
|
+
*/
|
|
369
|
+
evaluateActiveCampaigns(activeCampaigns: any[], currentUrl: string, currentPageTitle: string, eventType: string): void;
|
|
370
|
+
/**
|
|
371
|
+
* Updates actual values in pwe_data based on current user behavior
|
|
372
|
+
* ENHANCED: Now handles custom conditionType with customData event type
|
|
373
|
+
* CRITICAL: Updates BOTH rules AND exclusions with the same behavioral data
|
|
374
|
+
* ONLY updates values for condition types that are configured in the campaign
|
|
375
|
+
* @param campInstanceId - Campaign instance ID
|
|
376
|
+
* @param currentUrl - Current page URL
|
|
377
|
+
* @param currentPageTitle - Current page title
|
|
378
|
+
* @param eventType - Type of event triggering update
|
|
379
|
+
*/
|
|
380
|
+
updateActualValues(campInstanceId: string, currentUrl: string, currentPageTitle: string, eventType: string): void;
|
|
381
|
+
/**
|
|
382
|
+
* Checks if a campaign has any custom conditions in rules or exclusions
|
|
383
|
+
* @param campaign - Campaign object
|
|
384
|
+
* @returns Boolean indicating if campaign has custom conditions
|
|
385
|
+
*/
|
|
386
|
+
campaignHasCustomConditions(campaign: any): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Ensures custom data is up-to-date for a campaign based on current flattened custom data
|
|
389
|
+
* Now retrieves custom data from sessionStorage to handle navigation
|
|
390
|
+
* @param campInstanceId - Campaign instance ID
|
|
391
|
+
* @param campaign - Campaign configuration
|
|
392
|
+
* @param campaignData - Campaign data structure to update
|
|
393
|
+
*/
|
|
394
|
+
ensureCustomDataUpToDate(campInstanceId: string, campaign: any, campaignData: any): void;
|
|
395
|
+
/**
|
|
396
|
+
* Updates time spent data
|
|
397
|
+
* Only populates actual.rules OR actual.exclusions based on where condition is configured
|
|
398
|
+
* @param campaignData - Campaign data object
|
|
399
|
+
* @param campInstanceId - Campaign instance ID
|
|
400
|
+
*/
|
|
401
|
+
updateTimeSpentData(campaignData: any, campInstanceId: string): void;
|
|
402
|
+
/**
|
|
403
|
+
* Updates general data like user type, country, city
|
|
404
|
+
* Only populates actual.rules OR actual.exclusions based on where condition is configured
|
|
405
|
+
* @param campaignData - Campaign data object
|
|
406
|
+
* @param campInstanceId - Campaign instance ID
|
|
407
|
+
*/
|
|
408
|
+
updateGeneralData(campaignData: any, campInstanceId: string): void;
|
|
409
|
+
/**
|
|
410
|
+
* Re-evaluates campaigns that have location-based conditions when location data becomes available
|
|
411
|
+
* Called when geolocation API completes to handle location-based campaigns
|
|
412
|
+
*/
|
|
413
|
+
reevaluateLocationBasedCampaigns(): void;
|
|
414
|
+
/**
|
|
415
|
+
* Evaluates rules for a campaign and updates satisfaction status
|
|
416
|
+
* @param campInstanceId - Campaign instance ID
|
|
417
|
+
*/
|
|
418
|
+
evaluateRulesForCampaign(campInstanceId: string): void;
|
|
419
|
+
/**
|
|
420
|
+
* Evaluates exclusions for a campaign and updates satisfaction status
|
|
421
|
+
* Supports dynamic exclusion evaluation (can flip satisfied ↔ not satisfied)
|
|
422
|
+
* @param campInstanceId - Campaign instance ID
|
|
423
|
+
*/
|
|
424
|
+
evaluateExclusionsForCampaign(campInstanceId: string): void;
|
|
425
|
+
/**
|
|
426
|
+
* Evaluates conditions within a group
|
|
427
|
+
* Implements persistence for pageVisitCount conditions (once satisfied, stays satisfied)
|
|
428
|
+
* @param groupConditions - Group conditions object
|
|
429
|
+
* @param actualValues - Actual values to compare against
|
|
430
|
+
* @returns Boolean indicating if group conditions are satisfied
|
|
431
|
+
*/
|
|
432
|
+
evaluateGroupConditions(groupConditions: any, actualValues: any): boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Updates individual condition satisfaction states with different persistence logic for rules vs exclusions
|
|
435
|
+
* RULES: Selective persistence (pageVisitCount, country, city persist; user, timeSpent, hoverOn dynamic)
|
|
436
|
+
* EXCLUSIONS: Always dynamic re-evaluation (no persistence for any condition type)
|
|
437
|
+
* @param groupConditions - Group conditions object
|
|
438
|
+
* @param actualValues - Actual values to compare against
|
|
439
|
+
* @param isExclusions - Whether these are exclusion conditions (determines persistence behavior)
|
|
440
|
+
* @param groupId - Group ID for hoverOn condition evaluation
|
|
441
|
+
*/
|
|
442
|
+
updateIndividualConditionStates(groupConditions: any, actualValues: any, isExclusions?: boolean, groupId?: string): void;
|
|
443
|
+
/**
|
|
444
|
+
* Evaluates a single condition with support for custom conditionType operators
|
|
445
|
+
* ENHANCED: Now supports 10 custom operators for custom conditionType
|
|
446
|
+
* @param condition - Condition object
|
|
447
|
+
* @param actualValue - Actual value to compare
|
|
448
|
+
* @returns Boolean indicating if condition is satisfied
|
|
449
|
+
*/
|
|
450
|
+
evaluateCondition(condition: any, actualValue: any): boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Evaluates hoverOn conditions with new key-based structure:
|
|
453
|
+
* - actualValue is an object: { "group1_co-1": true, "group2_co-3": false }
|
|
454
|
+
* - Looks up the specific key for this condition
|
|
455
|
+
* - Returns boolean result (no type mismatch issues)
|
|
456
|
+
*/
|
|
457
|
+
evaluateHoverOnCondition(condition: any, actualValue: any): boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Evaluates hoverOn conditions with group context for precise key matching
|
|
460
|
+
* @param condition - The hoverOn condition
|
|
461
|
+
* @param actualValue - The hoverOn object
|
|
462
|
+
* @param groupId - The group ID for key construction
|
|
463
|
+
* @returns Boolean result
|
|
464
|
+
*/
|
|
465
|
+
evaluateHoverOnConditionWithContext(condition: any, actualValue: any, groupId: string): boolean;
|
|
466
|
+
/**
|
|
467
|
+
* Evaluates url and pageName conditions with case-sensitive string operations:
|
|
468
|
+
* URL operators: contains, ends_with
|
|
469
|
+
* PageName operators: is, contains
|
|
470
|
+
*
|
|
471
|
+
* @param condition - The condition configuration
|
|
472
|
+
* @param actualValue - Current URL or page name from actual data
|
|
473
|
+
* @param expectedValue - Expected value from condition configuration
|
|
474
|
+
* @returns Boolean evaluation result
|
|
475
|
+
*/
|
|
476
|
+
evaluateUrlPageNameCondition(condition: any, actualValue: any, expectedValue: any): boolean;
|
|
477
|
+
/**
|
|
478
|
+
* Evaluates device conditions with simple "is" operator comparison:
|
|
479
|
+
* - Supports: Mobile, Tablet, Laptop
|
|
480
|
+
* - Case-sensitive string matching
|
|
481
|
+
* - Works with isNot flag for exclusions
|
|
482
|
+
*
|
|
483
|
+
* @param condition - The condition configuration
|
|
484
|
+
* @param actualValue - Current device type from actual data
|
|
485
|
+
* @param expectedValue - Expected device type from condition configuration
|
|
486
|
+
* @returns Boolean evaluation result
|
|
487
|
+
*/
|
|
488
|
+
evaluateDeviceCondition(condition: any, actualValue: any, expectedValue: any): boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Evaluates custom conditions with all 10 supported operators:
|
|
491
|
+
* - equals: Case-sensitive exact match
|
|
492
|
+
* - in: Array membership check
|
|
493
|
+
* - gt, ge, lt, le: Numeric comparisons (greater/less than/equal)
|
|
494
|
+
* - between: Inclusive range check {start, end}
|
|
495
|
+
* - begins_with, ends_with, contains: String operations
|
|
496
|
+
*/
|
|
497
|
+
evaluateCustomCondition(condition: any, actualValue: any, expectedValue: any): boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Evaluates equals operator (case-sensitive)
|
|
500
|
+
*/
|
|
501
|
+
evaluateEquals(actualValue: any, expectedValue: any): boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Evaluates in operator (array membership)
|
|
504
|
+
*/
|
|
505
|
+
evaluateIn(actualValue: any, expectedValue: any): boolean;
|
|
506
|
+
/**
|
|
507
|
+
* Evaluates greater than operator
|
|
508
|
+
*/
|
|
509
|
+
evaluateGreaterThan(actualValue: any, expectedValue: any): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Evaluates greater than or equal operator
|
|
512
|
+
*/
|
|
513
|
+
evaluateGreaterEqual(actualValue: any, expectedValue: any): boolean;
|
|
514
|
+
/**
|
|
515
|
+
* Evaluates less than operator
|
|
516
|
+
*/
|
|
517
|
+
evaluateLessThan(actualValue: any, expectedValue: any): boolean;
|
|
518
|
+
/**
|
|
519
|
+
* Evaluates less than or equal operator
|
|
520
|
+
*/
|
|
521
|
+
evaluateLessEqual(actualValue: any, expectedValue: any): boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Evaluates between operator (inclusive range)
|
|
524
|
+
* 'between' operator requires numeric start and end values
|
|
525
|
+
*/
|
|
526
|
+
evaluateBetween(actualValue: any, expectedValue: any): boolean;
|
|
527
|
+
/**
|
|
528
|
+
* Evaluates begins_with operator (string prefix)
|
|
529
|
+
*/
|
|
530
|
+
evaluateBeginsWith(actualValue: any, expectedValue: any): boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Evaluates ends_with operator (string suffix)
|
|
533
|
+
*/
|
|
534
|
+
evaluateEndsWith(actualValue: any, expectedValue: any): boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Evaluates contains operator (string substring)
|
|
537
|
+
*/
|
|
538
|
+
evaluateContains(actualValue: any, expectedValue: any): boolean;
|
|
539
|
+
/**
|
|
540
|
+
* Converts value to number, returns null if conversion fails
|
|
541
|
+
* @param value - Value to convert
|
|
542
|
+
* @returns Number or null if conversion fails
|
|
543
|
+
*/
|
|
544
|
+
convertToNumber(value: any): number | null;
|
|
545
|
+
/**
|
|
546
|
+
* Evaluates overall satisfaction of groups based on groupType
|
|
547
|
+
* @param groups - Array of groups
|
|
548
|
+
* @param groupType - Type of group logic (AND/OR)
|
|
549
|
+
* @returns Boolean indicating if groups are satisfied
|
|
550
|
+
*/
|
|
551
|
+
evaluateGroupsSatisfaction(groups: any[], groupType: string): boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Checks if campaign should be triggered based on rules and exclusions
|
|
554
|
+
* @param campInstanceId - Campaign instance ID
|
|
555
|
+
* @param campId - Campaign ID
|
|
556
|
+
*/
|
|
557
|
+
checkCampaignTrigger(campInstanceId: string, campId: string): void;
|
|
558
|
+
/**
|
|
559
|
+
* Updates isSatisfied flags for rules and exclusions based on current evaluation
|
|
560
|
+
* This method should be called whenever a campaign is triggered to ensure flags are consistent
|
|
561
|
+
* @param campInstanceId - Campaign instance ID
|
|
562
|
+
*/
|
|
563
|
+
updateSatisfactionFlags(campInstanceId: string): void;
|
|
564
|
+
/**
|
|
565
|
+
* Triggers campaign event using existing API logic
|
|
566
|
+
* @param campInstanceId - Campaign instance ID
|
|
567
|
+
* @param campId - Campaign ID
|
|
568
|
+
*/
|
|
569
|
+
triggerCampaignEvent(campInstanceId: string, campId: string): void;
|
|
570
|
+
/**
|
|
571
|
+
* Enhanced sendEvent method to work with new campaign structure
|
|
572
|
+
* @param pageObject - Page object with url and pageName
|
|
573
|
+
* @param type - Event type
|
|
574
|
+
*/
|
|
575
|
+
sendEvent(pageObject: any, type: any): void;
|
|
28
576
|
}
|
|
29
577
|
export default ProactiveWebCampaignPlugin;
|