algolia-experiences 1.4.3 → 1.5.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.
@@ -10095,7 +10095,7 @@
10095
10095
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
10096
10096
  return arr2;
10097
10097
  }
10098
- var ALGOLIA_INSIGHTS_VERSION = '2.15.0';
10098
+ var ALGOLIA_INSIGHTS_VERSION = '2.17.2';
10099
10099
  var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
10100
10100
  function createInsightsMiddleware() {
10101
10101
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -12821,7 +12821,7 @@
12821
12821
  };
12822
12822
  }
12823
12823
 
12824
- var version$1 = '4.75.4';
12824
+ var version$1 = '4.75.5';
12825
12825
 
12826
12826
  function _typeof$j(obj) {
12827
12827
  "@babel/helpers - typeof";
@@ -13565,25 +13565,32 @@
13565
13565
  return experience;
13566
13566
  });
13567
13567
  }
13568
- var API_BASE = 'https://experiences-beta.algolia.com/1';
13568
+ var API_BASE = {
13569
+ local: 'http://localhost:3000/1',
13570
+ beta: 'https://experiences-beta.algolia.com/1',
13571
+ prod: 'https://experiences.algolia.com/1'
13572
+ };
13569
13573
  function getExperience(_ref2) {
13570
13574
  var id = _ref2.id,
13571
13575
  appId = _ref2.appId,
13572
- apiKey = _ref2.apiKey;
13576
+ apiKey = _ref2.apiKey,
13577
+ environment = _ref2.environment;
13573
13578
  return buildRequest({
13574
13579
  appId: appId,
13575
13580
  apiKey: apiKey,
13581
+ environment: environment,
13576
13582
  endpoint: "experiences/".concat(id)
13577
13583
  });
13578
13584
  }
13579
13585
  function buildRequest(_ref5) {
13580
13586
  var appId = _ref5.appId,
13581
13587
  apiKey = _ref5.apiKey,
13588
+ environment = _ref5.environment,
13582
13589
  endpoint = _ref5.endpoint,
13583
13590
  _ref5$method = _ref5.method,
13584
13591
  method = _ref5$method === void 0 ? 'GET' : _ref5$method,
13585
13592
  data = _ref5.data;
13586
- return fetch("".concat(API_BASE, "/").concat(endpoint), {
13593
+ return fetch("".concat(API_BASE[environment], "/").concat(endpoint), {
13587
13594
  method: method,
13588
13595
  headers: {
13589
13596
  'X-Algolia-Application-ID': appId,
@@ -13605,15 +13612,18 @@
13605
13612
  if (!metaConfiguration || !metaConfiguration.content) {
13606
13613
  throw new Error('No meta tag found');
13607
13614
  }
13608
- var _JSON$parse = JSON.parse(metaConfiguration.content),
13609
- appId = _JSON$parse.appId,
13610
- apiKey = _JSON$parse.apiKey;
13615
+ var _ref = JSON.parse(metaConfiguration.content),
13616
+ appId = _ref.appId,
13617
+ apiKey = _ref.apiKey,
13618
+ _ref$environment = _ref.environment,
13619
+ environment = _ref$environment === void 0 ? 'prod' : _ref$environment;
13611
13620
  if (!appId || !apiKey) {
13612
13621
  throw new Error('Missing appId or apiKey in the meta tag');
13613
13622
  }
13614
13623
  return {
13615
13624
  appId: appId,
13616
- apiKey: apiKey
13625
+ apiKey: apiKey,
13626
+ environment: environment
13617
13627
  };
13618
13628
  }
13619
13629