coveo.analytics 2.27.9 → 2.27.11

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.
@@ -728,7 +728,7 @@
728
728
  const v5 = v35('v5', 0x50, sha1);
729
729
  var uuidv5 = v5;
730
730
 
731
- var libVersion = "2.27.9" ;
731
+ var libVersion = "2.27.11" ;
732
732
 
733
733
  var getFormattedLocation = function (location) {
734
734
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -1486,11 +1486,16 @@
1486
1486
  production: 'https://analytics.cloud.coveo.com/rest/ua',
1487
1487
  hipaa: 'https://analyticshipaa.cloud.coveo.com/rest/ua',
1488
1488
  };
1489
- function buildBaseUrl(endpoint, apiVersion) {
1489
+ function buildBaseUrl(endpoint, apiVersion, isCustomEndpoint) {
1490
1490
  if (endpoint === void 0) { endpoint = Endpoints.default; }
1491
1491
  if (apiVersion === void 0) { apiVersion = Version; }
1492
- var endpointIsCoveoProxy = endpoint.indexOf('.cloud.coveo.com') !== -1;
1493
- return "".concat(endpoint).concat(endpointIsCoveoProxy ? '' : '/rest', "/").concat(apiVersion);
1492
+ if (isCustomEndpoint === void 0) { isCustomEndpoint = false; }
1493
+ endpoint = endpoint.replace(/\/$/, '');
1494
+ if (isCustomEndpoint) {
1495
+ return "".concat(endpoint, "/").concat(apiVersion);
1496
+ }
1497
+ var hasUARestEndpoint = endpoint.endsWith('/rest') || endpoint.endsWith('/rest/ua');
1498
+ return "".concat(endpoint).concat(hasUARestEndpoint ? '' : '/rest', "/").concat(apiVersion);
1494
1499
  }
1495
1500
  var COVEO_NAMESPACE = '38824e1f-37f5-42d3-8372-a4b8fa9df946';
1496
1501
  var CoveoAnalyticsClient = (function () {
@@ -1521,6 +1526,7 @@
1521
1526
  get: function () {
1522
1527
  return {
1523
1528
  endpoint: Endpoints.default,
1529
+ isCustomEndpoint: false,
1524
1530
  token: '',
1525
1531
  version: Version,
1526
1532
  beforeSendHooks: [],
@@ -2154,7 +2160,7 @@
2154
2160
  };
2155
2161
  Object.defineProperty(CoveoAnalyticsClient.prototype, "baseUrl", {
2156
2162
  get: function () {
2157
- return buildBaseUrl(this.options.endpoint, this.options.version);
2163
+ return buildBaseUrl(this.options.endpoint, this.options.version, this.options.isCustomEndpoint);
2158
2164
  },
2159
2165
  enumerable: false,
2160
2166
  configurable: true
@@ -2466,6 +2472,7 @@
2466
2472
  this.client = new CoveoAnalyticsClient({
2467
2473
  token: token,
2468
2474
  endpoint: this.getEndpoint(optionsOrEndpoint),
2475
+ isCustomEndpoint: this.getIsCustomEndpoint(optionsOrEndpoint),
2469
2476
  });
2470
2477
  }
2471
2478
  else if (this.isAnalyticsClient(token)) {
@@ -2502,7 +2509,17 @@
2502
2509
  }
2503
2510
  return Endpoints.default;
2504
2511
  };
2505
- CoveoUA.prototype.initForProxy = function (endpoint) {
2512
+ CoveoUA.prototype.getIsCustomEndpoint = function (optionsOrEndpoint) {
2513
+ if (typeof optionsOrEndpoint === 'string') {
2514
+ return false;
2515
+ }
2516
+ else if (optionsOrEndpoint === null || optionsOrEndpoint === void 0 ? void 0 : optionsOrEndpoint.isCustomEndpoint) {
2517
+ return optionsOrEndpoint.isCustomEndpoint;
2518
+ }
2519
+ return false;
2520
+ };
2521
+ CoveoUA.prototype.initForProxy = function (endpoint, isCustomEndpoint) {
2522
+ if (isCustomEndpoint === void 0) { isCustomEndpoint = false; }
2506
2523
  if (!endpoint) {
2507
2524
  throw new Error("You must pass your endpoint when you call 'initForProxy'");
2508
2525
  }
@@ -2511,6 +2528,7 @@
2511
2528
  }
2512
2529
  this.client = new CoveoAnalyticsClient({
2513
2530
  endpoint: endpoint,
2531
+ isCustomEndpoint: isCustomEndpoint,
2514
2532
  });
2515
2533
  };
2516
2534
  CoveoUA.prototype.set = function (keyOrObject, value) {