@xapp/chat-widget 1.105.6 → 1.106.0
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/index.css +1 -1
- package/dist/index.es.js +30 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/chatAgentDiscovery.d.ts +0 -0
- package/dist/utils/fingerprint.d.ts +0 -0
- package/dist/xapp/MCPChat.d.ts +0 -0
- package/dist/xapp-chat-widget.css +1 -1
- package/dist/xapp-chat-widget.js +5 -5
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3490,17 +3490,24 @@ var CLICK_ID_PARAMETERS = [
|
|
|
3490
3490
|
"fbclid"
|
|
3491
3491
|
];
|
|
3492
3492
|
var ATTRIBUTION_PARAMETERS = __spreadArray(__spreadArray([], UTM_PARAMETERS, true), CLICK_ID_PARAMETERS);
|
|
3493
|
+
/**
|
|
3494
|
+
* Params AI surfaces put on the links they send people to: Google AI Overviews
|
|
3495
|
+
* (`st_source=ai_overview`), Google's `srsltid` click id, and the generic `ref` / `source`
|
|
3496
|
+
* that ChatGPT, Perplexity and others use. Read only by the widget `load` event, never stored and
|
|
3497
|
+
* never sent with chat messages.
|
|
3498
|
+
*/
|
|
3499
|
+
var AI_REFERRAL_PARAMETERS = ["st_source", "srsltid", "ref", "source"];
|
|
3493
3500
|
var STORAGE_KEY_PREFIX = "xa_tracking_";
|
|
3494
3501
|
/** Matches the 30 day window the form widget already uses. */
|
|
3495
3502
|
var DEFAULT_PERSISTENCE_DAYS = 30;
|
|
3496
|
-
var MAX_VALUE_LENGTH = 255;
|
|
3503
|
+
var MAX_VALUE_LENGTH$1 = 255;
|
|
3497
3504
|
/**
|
|
3498
3505
|
* Values land in a request body and, downstream, in a CRM. Cap the length and
|
|
3499
3506
|
* reject anything carrying markup or control characters.
|
|
3500
3507
|
*/
|
|
3501
|
-
function isValidValue(value) {
|
|
3508
|
+
function isValidValue$1(value) {
|
|
3502
3509
|
// eslint-disable-next-line no-control-regex
|
|
3503
|
-
return value.length <= MAX_VALUE_LENGTH && !/[<>"'\x00-\x1f]/.test(value);
|
|
3510
|
+
return value.length <= MAX_VALUE_LENGTH$1 && !/[<>"'\x00-\x1f]/.test(value);
|
|
3504
3511
|
}
|
|
3505
3512
|
/**
|
|
3506
3513
|
* Reads the attribution parameters present on a URL. Never throws — a URL we
|
|
@@ -3517,7 +3524,7 @@ function extractAttributionFromUrl(url) {
|
|
|
3517
3524
|
var attribution = {};
|
|
3518
3525
|
ATTRIBUTION_PARAMETERS.forEach(function (parameter) {
|
|
3519
3526
|
var value = parsed.searchParams.get(parameter);
|
|
3520
|
-
if (value && isValidValue(value)) {
|
|
3527
|
+
if (value && isValidValue$1(value)) {
|
|
3521
3528
|
attribution[parameter] = value;
|
|
3522
3529
|
}
|
|
3523
3530
|
});
|
|
@@ -3610,6 +3617,9 @@ function stripQueryString(url) {
|
|
|
3610
3617
|
}
|
|
3611
3618
|
}
|
|
3612
3619
|
|
|
3620
|
+
/** Page params whose VALUES the load event may send, each as its own metadata field. */
|
|
3621
|
+
__spreadArray(__spreadArray([], ATTRIBUTION_PARAMETERS, true), AI_REFERRAL_PARAMETERS);
|
|
3622
|
+
|
|
3613
3623
|
/**
|
|
3614
3624
|
* Stop the host page scrolling behind an open overlay.
|
|
3615
3625
|
*
|
|
@@ -15623,11 +15633,26 @@ var ModalContent = function (_a) {
|
|
|
15623
15633
|
/**
|
|
15624
15634
|
* Id the visitor (cookies, browser fingerprint, etc)
|
|
15625
15635
|
*
|
|
15636
|
+
* Kept in localStorage so the widget's load event, which fires before the chat store exists,
|
|
15637
|
+
* reports the same id the store goes on to adopt for a first-time visitor.
|
|
15638
|
+
*
|
|
15626
15639
|
* @export
|
|
15627
15640
|
* @returns {string}
|
|
15628
15641
|
*/
|
|
15642
|
+
var VISITOR_ID_KEY = "xapp_chat_visitorId";
|
|
15629
15643
|
function visitorFingerprint() {
|
|
15630
|
-
|
|
15644
|
+
try {
|
|
15645
|
+
var stored = localStorage.getItem(VISITOR_ID_KEY);
|
|
15646
|
+
if (stored) {
|
|
15647
|
+
return stored;
|
|
15648
|
+
}
|
|
15649
|
+
var id = uuid_1();
|
|
15650
|
+
localStorage.setItem(VISITOR_ID_KEY, id);
|
|
15651
|
+
return id;
|
|
15652
|
+
}
|
|
15653
|
+
catch (_a) {
|
|
15654
|
+
return uuid_1();
|
|
15655
|
+
}
|
|
15631
15656
|
}
|
|
15632
15657
|
|
|
15633
15658
|
var DEFAULT_VISITOR = {
|