@getlupa/client 1.14.9 → 1.14.13

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.
@@ -38822,6 +38822,13 @@ and ensure you are accounting for this risk.
38822
38822
  }
38823
38823
  return { mountedApp, mountedComponent, props, app: app2, mountElement };
38824
38824
  };
38825
+ const canMount = (allowedMountUrls) => {
38826
+ if (allowedMountUrls && Array.isArray(allowedMountUrls) && allowedMountUrls.length) {
38827
+ const currentUrl = window.location.href;
38828
+ return allowedMountUrls == null ? void 0 : allowedMountUrls.some((url) => currentUrl.includes(url));
38829
+ }
38830
+ return true;
38831
+ };
38825
38832
  const app = {
38826
38833
  box: {},
38827
38834
  results: {},
@@ -38856,12 +38863,18 @@ and ensure you are accounting for this risk.
38856
38863
  };
38857
38864
  const searchBox = (options, mountOptions) => {
38858
38865
  var _a;
38866
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38867
+ return;
38868
+ }
38859
38869
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
38860
38870
  for (const input2 of inputs) {
38861
38871
  applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
38862
38872
  }
38863
38873
  };
38864
38874
  const searchResults = (options, mountOptions) => {
38875
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38876
+ return;
38877
+ }
38865
38878
  const existingInstance = app.results[options.containerSelector];
38866
38879
  if (existingInstance) {
38867
38880
  existingInstance.props.searchResultsOptions = options;
@@ -38887,6 +38900,9 @@ and ensure you are accounting for this risk.
38887
38900
  app.results[options.containerSelector] = instance;
38888
38901
  };
38889
38902
  const productList = (options, mountOptions) => {
38903
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38904
+ return;
38905
+ }
38890
38906
  const existingInstance = app.productList[options.containerSelector];
38891
38907
  if (existingInstance) {
38892
38908
  existingInstance.props.productListOptions = options;
@@ -38913,6 +38929,9 @@ and ensure you are accounting for this risk.
38913
38929
  };
38914
38930
  const searchContainer = (options, mountOptions) => {
38915
38931
  var _a, _b, _c, _d, _e, _f;
38932
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38933
+ return;
38934
+ }
38916
38935
  const existingInstance = app.searchContainer[options.trigger];
38917
38936
  if (existingInstance) {
38918
38937
  existingInstance.props.searchContainerOptions = options;
@@ -38944,6 +38963,9 @@ and ensure you are accounting for this risk.
38944
38963
  app.searchContainer[options.trigger] = instance;
38945
38964
  };
38946
38965
  const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
38966
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38967
+ return;
38968
+ }
38947
38969
  const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
38948
38970
  preconfiguredSearchContainerOptions
38949
38971
  );
@@ -38961,6 +38983,9 @@ and ensure you are accounting for this risk.
38961
38983
  );
38962
38984
  };
38963
38985
  const recommendations = (options, mountOptions) => {
38986
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38987
+ return;
38988
+ }
38964
38989
  const existingInstance = app.recommendations[options.containerSelector];
38965
38990
  if (existingInstance) {
38966
38991
  existingInstance.props.recommendationOptions = options;
@@ -38986,6 +39011,9 @@ and ensure you are accounting for this risk.
38986
39011
  app.recommendations[options.containerSelector] = instance;
38987
39012
  };
38988
39013
  const chat = (options, mountOptions) => {
39014
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39015
+ return;
39016
+ }
38989
39017
  const existingInstance = app.chat[options.displayOptions.containerSelector];
38990
39018
  if (existingInstance) {
38991
39019
  existingInstance.props.options = options;
@@ -39250,6 +39278,7 @@ and ensure you are accounting for this risk.
39250
39278
  return;
39251
39279
  }
39252
39280
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
39281
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39253
39282
  const visible = yield waitForElementToBeVisible(
39254
39283
  resolvedConfiguration.inputSelector,
39255
39284
  0,
@@ -39261,13 +39290,14 @@ and ensure you are accounting for this risk.
39261
39290
  );
39262
39291
  return;
39263
39292
  }
39264
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39293
+ searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39265
39294
  });
39266
39295
  const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39267
39296
  if (!configuration.searchResults) {
39268
39297
  return;
39269
39298
  }
39270
39299
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
39300
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39271
39301
  const visible = yield waitForElementToBeVisible(
39272
39302
  resolvedConfiguration.containerSelector,
39273
39303
  0,
@@ -39279,7 +39309,7 @@ and ensure you are accounting for this risk.
39279
39309
  );
39280
39310
  return;
39281
39311
  }
39282
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39312
+ searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39283
39313
  });
39284
39314
  const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39285
39315
  if (!configuration.productList) {
@@ -39289,6 +39319,7 @@ and ensure you are accounting for this risk.
39289
39319
  configuration.searchResults
39290
39320
  );
39291
39321
  const resolvedConfiguration = JSON.parse(configuration.productList);
39322
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39292
39323
  const visible = yield waitForElementToBeVisible(
39293
39324
  resolvedConfiguration.containerSelector,
39294
39325
  0,
@@ -39302,7 +39333,7 @@ and ensure you are accounting for this risk.
39302
39333
  }
39303
39334
  productList(
39304
39335
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39305
- { fetch: fetch2 }
39336
+ { fetch: fetch2, allowedMountUrls }
39306
39337
  );
39307
39338
  });
39308
39339
  const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39315,6 +39346,7 @@ and ensure you are accounting for this risk.
39315
39346
  const resolvedConfiguration = JSON.parse(
39316
39347
  configuration.recommendations
39317
39348
  );
39349
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39318
39350
  const visible = yield waitForElementToBeVisible(
39319
39351
  resolvedConfiguration.containerSelector,
39320
39352
  0,
@@ -39328,7 +39360,7 @@ and ensure you are accounting for this risk.
39328
39360
  }
39329
39361
  recommendations(
39330
39362
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39331
- { fetch: fetch2 }
39363
+ { fetch: fetch2, allowedMountUrls }
39332
39364
  );
39333
39365
  });
39334
39366
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39339,6 +39371,7 @@ and ensure you are accounting for this risk.
39339
39371
  configuration.searchResults
39340
39372
  );
39341
39373
  const resolvedConfiguration = JSON.parse(configuration.genAiChat);
39374
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39342
39375
  const visible = yield waitForElementToBeVisible(
39343
39376
  resolvedConfiguration.containerSelector,
39344
39377
  0,
@@ -39350,7 +39383,10 @@ and ensure you are accounting for this risk.
39350
39383
  );
39351
39384
  return;
39352
39385
  }
39353
- chat(__spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch: fetch2 });
39386
+ chat(
39387
+ __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39388
+ { fetch: fetch2, allowedMountUrls }
39389
+ );
39354
39390
  });
39355
39391
  const mount = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39356
39392
  yield applyStyles(configuration);
@@ -38822,6 +38822,13 @@ const createVue = (selector, mountingBehavior = "replace", rootComponent, option
38822
38822
  }
38823
38823
  return { mountedApp, mountedComponent, props, app: app2, mountElement };
38824
38824
  };
38825
+ const canMount = (allowedMountUrls) => {
38826
+ if (allowedMountUrls && Array.isArray(allowedMountUrls) && allowedMountUrls.length) {
38827
+ const currentUrl = window.location.href;
38828
+ return allowedMountUrls == null ? void 0 : allowedMountUrls.some((url) => currentUrl.includes(url));
38829
+ }
38830
+ return true;
38831
+ };
38825
38832
  const app = {
38826
38833
  box: {},
38827
38834
  results: {},
@@ -38856,12 +38863,18 @@ const applySearchBox = (options, mountOptions) => {
38856
38863
  };
38857
38864
  const searchBox = (options, mountOptions) => {
38858
38865
  var _a;
38866
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38867
+ return;
38868
+ }
38859
38869
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
38860
38870
  for (const input2 of inputs) {
38861
38871
  applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
38862
38872
  }
38863
38873
  };
38864
38874
  const searchResults = (options, mountOptions) => {
38875
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38876
+ return;
38877
+ }
38865
38878
  const existingInstance = app.results[options.containerSelector];
38866
38879
  if (existingInstance) {
38867
38880
  existingInstance.props.searchResultsOptions = options;
@@ -38887,6 +38900,9 @@ const searchResults = (options, mountOptions) => {
38887
38900
  app.results[options.containerSelector] = instance;
38888
38901
  };
38889
38902
  const productList = (options, mountOptions) => {
38903
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38904
+ return;
38905
+ }
38890
38906
  const existingInstance = app.productList[options.containerSelector];
38891
38907
  if (existingInstance) {
38892
38908
  existingInstance.props.productListOptions = options;
@@ -38913,6 +38929,9 @@ const productList = (options, mountOptions) => {
38913
38929
  };
38914
38930
  const searchContainer = (options, mountOptions) => {
38915
38931
  var _a, _b, _c, _d, _e, _f;
38932
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38933
+ return;
38934
+ }
38916
38935
  const existingInstance = app.searchContainer[options.trigger];
38917
38936
  if (existingInstance) {
38918
38937
  existingInstance.props.searchContainerOptions = options;
@@ -38944,6 +38963,9 @@ const searchContainer = (options, mountOptions) => {
38944
38963
  app.searchContainer[options.trigger] = instance;
38945
38964
  };
38946
38965
  const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
38966
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38967
+ return;
38968
+ }
38947
38969
  const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
38948
38970
  preconfiguredSearchContainerOptions
38949
38971
  );
@@ -38961,6 +38983,9 @@ const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mount
38961
38983
  );
38962
38984
  };
38963
38985
  const recommendations = (options, mountOptions) => {
38986
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38987
+ return;
38988
+ }
38964
38989
  const existingInstance = app.recommendations[options.containerSelector];
38965
38990
  if (existingInstance) {
38966
38991
  existingInstance.props.recommendationOptions = options;
@@ -38986,6 +39011,9 @@ const recommendations = (options, mountOptions) => {
38986
39011
  app.recommendations[options.containerSelector] = instance;
38987
39012
  };
38988
39013
  const chat = (options, mountOptions) => {
39014
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39015
+ return;
39016
+ }
38989
39017
  const existingInstance = app.chat[options.displayOptions.containerSelector];
38990
39018
  if (existingInstance) {
38991
39019
  existingInstance.props.options = options;
@@ -39250,6 +39278,7 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
39250
39278
  return;
39251
39279
  }
39252
39280
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
39281
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39253
39282
  const visible = yield waitForElementToBeVisible(
39254
39283
  resolvedConfiguration.inputSelector,
39255
39284
  0,
@@ -39261,13 +39290,14 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
39261
39290
  );
39262
39291
  return;
39263
39292
  }
39264
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39293
+ searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39265
39294
  });
39266
39295
  const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
39267
39296
  if (!configuration.searchResults) {
39268
39297
  return;
39269
39298
  }
39270
39299
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
39300
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39271
39301
  const visible = yield waitForElementToBeVisible(
39272
39302
  resolvedConfiguration.containerSelector,
39273
39303
  0,
@@ -39279,7 +39309,7 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
39279
39309
  );
39280
39310
  return;
39281
39311
  }
39282
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39312
+ searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39283
39313
  });
39284
39314
  const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
39285
39315
  if (!configuration.productList) {
@@ -39289,6 +39319,7 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
39289
39319
  configuration.searchResults
39290
39320
  );
39291
39321
  const resolvedConfiguration = JSON.parse(configuration.productList);
39322
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39292
39323
  const visible = yield waitForElementToBeVisible(
39293
39324
  resolvedConfiguration.containerSelector,
39294
39325
  0,
@@ -39302,7 +39333,7 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
39302
39333
  }
39303
39334
  productList(
39304
39335
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39305
- { fetch: fetch2 }
39336
+ { fetch: fetch2, allowedMountUrls }
39306
39337
  );
39307
39338
  });
39308
39339
  const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
@@ -39315,6 +39346,7 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
39315
39346
  const resolvedConfiguration = JSON.parse(
39316
39347
  configuration.recommendations
39317
39348
  );
39349
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39318
39350
  const visible = yield waitForElementToBeVisible(
39319
39351
  resolvedConfiguration.containerSelector,
39320
39352
  0,
@@ -39328,7 +39360,7 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
39328
39360
  }
39329
39361
  recommendations(
39330
39362
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39331
- { fetch: fetch2 }
39363
+ { fetch: fetch2, allowedMountUrls }
39332
39364
  );
39333
39365
  });
39334
39366
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
@@ -39339,6 +39371,7 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39339
39371
  configuration.searchResults
39340
39372
  );
39341
39373
  const resolvedConfiguration = JSON.parse(configuration.genAiChat);
39374
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39342
39375
  const visible = yield waitForElementToBeVisible(
39343
39376
  resolvedConfiguration.containerSelector,
39344
39377
  0,
@@ -39350,7 +39383,10 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39350
39383
  );
39351
39384
  return;
39352
39385
  }
39353
- chat(__spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch: fetch2 });
39386
+ chat(
39387
+ __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39388
+ { fetch: fetch2, allowedMountUrls }
39389
+ );
39354
39390
  });
39355
39391
  const mount = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
39356
39392
  yield applyStyles(configuration);
@@ -38820,6 +38820,13 @@ const createVue = (selector, mountingBehavior = "replace", rootComponent, option
38820
38820
  }
38821
38821
  return { mountedApp, mountedComponent, props, app: app2, mountElement };
38822
38822
  };
38823
+ const canMount = (allowedMountUrls) => {
38824
+ if (allowedMountUrls && Array.isArray(allowedMountUrls) && allowedMountUrls.length) {
38825
+ const currentUrl = window.location.href;
38826
+ return allowedMountUrls == null ? void 0 : allowedMountUrls.some((url) => currentUrl.includes(url));
38827
+ }
38828
+ return true;
38829
+ };
38823
38830
  const app = {
38824
38831
  box: {},
38825
38832
  results: {},
@@ -38854,12 +38861,18 @@ const applySearchBox = (options, mountOptions) => {
38854
38861
  };
38855
38862
  const searchBox = (options, mountOptions) => {
38856
38863
  var _a;
38864
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38865
+ return;
38866
+ }
38857
38867
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
38858
38868
  for (const input2 of inputs) {
38859
38869
  applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
38860
38870
  }
38861
38871
  };
38862
38872
  const searchResults = (options, mountOptions) => {
38873
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38874
+ return;
38875
+ }
38863
38876
  const existingInstance = app.results[options.containerSelector];
38864
38877
  if (existingInstance) {
38865
38878
  existingInstance.props.searchResultsOptions = options;
@@ -38885,6 +38898,9 @@ const searchResults = (options, mountOptions) => {
38885
38898
  app.results[options.containerSelector] = instance;
38886
38899
  };
38887
38900
  const productList = (options, mountOptions) => {
38901
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38902
+ return;
38903
+ }
38888
38904
  const existingInstance = app.productList[options.containerSelector];
38889
38905
  if (existingInstance) {
38890
38906
  existingInstance.props.productListOptions = options;
@@ -38911,6 +38927,9 @@ const productList = (options, mountOptions) => {
38911
38927
  };
38912
38928
  const searchContainer = (options, mountOptions) => {
38913
38929
  var _a, _b, _c, _d, _e, _f;
38930
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38931
+ return;
38932
+ }
38914
38933
  const existingInstance = app.searchContainer[options.trigger];
38915
38934
  if (existingInstance) {
38916
38935
  existingInstance.props.searchContainerOptions = options;
@@ -38942,6 +38961,9 @@ const searchContainer = (options, mountOptions) => {
38942
38961
  app.searchContainer[options.trigger] = instance;
38943
38962
  };
38944
38963
  const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
38964
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38965
+ return;
38966
+ }
38945
38967
  const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
38946
38968
  preconfiguredSearchContainerOptions
38947
38969
  );
@@ -38959,6 +38981,9 @@ const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mount
38959
38981
  );
38960
38982
  };
38961
38983
  const recommendations = (options, mountOptions) => {
38984
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38985
+ return;
38986
+ }
38962
38987
  const existingInstance = app.recommendations[options.containerSelector];
38963
38988
  if (existingInstance) {
38964
38989
  existingInstance.props.recommendationOptions = options;
@@ -38984,6 +39009,9 @@ const recommendations = (options, mountOptions) => {
38984
39009
  app.recommendations[options.containerSelector] = instance;
38985
39010
  };
38986
39011
  const chat = (options, mountOptions) => {
39012
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39013
+ return;
39014
+ }
38987
39015
  const existingInstance = app.chat[options.displayOptions.containerSelector];
38988
39016
  if (existingInstance) {
38989
39017
  existingInstance.props.options = options;
@@ -39248,6 +39276,7 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
39248
39276
  return;
39249
39277
  }
39250
39278
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
39279
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39251
39280
  const visible = yield waitForElementToBeVisible(
39252
39281
  resolvedConfiguration.inputSelector,
39253
39282
  0,
@@ -39259,13 +39288,14 @@ const mountSearchBox = (configuration, options, fetch2 = true, remount = false)
39259
39288
  );
39260
39289
  return;
39261
39290
  }
39262
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39291
+ searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39263
39292
  });
39264
39293
  const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39265
39294
  if (!configuration.searchResults) {
39266
39295
  return;
39267
39296
  }
39268
39297
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
39298
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39269
39299
  const visible = yield waitForElementToBeVisible(
39270
39300
  resolvedConfiguration.containerSelector,
39271
39301
  0,
@@ -39277,7 +39307,7 @@ const mountSearchResults = (configuration, options, fetch2 = true, remount = fal
39277
39307
  );
39278
39308
  return;
39279
39309
  }
39280
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39310
+ searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39281
39311
  });
39282
39312
  const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39283
39313
  if (!configuration.productList) {
@@ -39287,6 +39317,7 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
39287
39317
  configuration.searchResults
39288
39318
  );
39289
39319
  const resolvedConfiguration = JSON.parse(configuration.productList);
39320
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39290
39321
  const visible = yield waitForElementToBeVisible(
39291
39322
  resolvedConfiguration.containerSelector,
39292
39323
  0,
@@ -39300,7 +39331,7 @@ const mountProductList = (configuration, options, fetch2 = true, remount = false
39300
39331
  }
39301
39332
  productList(
39302
39333
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39303
- { fetch: fetch2 }
39334
+ { fetch: fetch2, allowedMountUrls }
39304
39335
  );
39305
39336
  });
39306
39337
  const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
@@ -39313,6 +39344,7 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
39313
39344
  const resolvedConfiguration = JSON.parse(
39314
39345
  configuration.recommendations
39315
39346
  );
39347
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39316
39348
  const visible = yield waitForElementToBeVisible(
39317
39349
  resolvedConfiguration.containerSelector,
39318
39350
  0,
@@ -39326,7 +39358,7 @@ const mountRecommendations = (configuration, options, fetch2 = true, remount = f
39326
39358
  }
39327
39359
  recommendations(
39328
39360
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39329
- { fetch: fetch2 }
39361
+ { fetch: fetch2, allowedMountUrls }
39330
39362
  );
39331
39363
  });
39332
39364
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
@@ -39337,6 +39369,7 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39337
39369
  configuration.searchResults
39338
39370
  );
39339
39371
  const resolvedConfiguration = JSON.parse(configuration.genAiChat);
39372
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39340
39373
  const visible = yield waitForElementToBeVisible(
39341
39374
  resolvedConfiguration.containerSelector,
39342
39375
  0,
@@ -39348,7 +39381,10 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39348
39381
  );
39349
39382
  return;
39350
39383
  }
39351
- chat(__spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch: fetch2 });
39384
+ chat(
39385
+ __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39386
+ { fetch: fetch2, allowedMountUrls }
39387
+ );
39352
39388
  });
39353
39389
  const mount = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
39354
39390
  yield applyStyles(configuration);
@@ -38824,6 +38824,13 @@ and ensure you are accounting for this risk.
38824
38824
  }
38825
38825
  return { mountedApp, mountedComponent, props, app: app2, mountElement };
38826
38826
  };
38827
+ const canMount = (allowedMountUrls) => {
38828
+ if (allowedMountUrls && Array.isArray(allowedMountUrls) && allowedMountUrls.length) {
38829
+ const currentUrl = window.location.href;
38830
+ return allowedMountUrls == null ? void 0 : allowedMountUrls.some((url) => currentUrl.includes(url));
38831
+ }
38832
+ return true;
38833
+ };
38827
38834
  const app = {
38828
38835
  box: {},
38829
38836
  results: {},
@@ -38858,12 +38865,18 @@ and ensure you are accounting for this risk.
38858
38865
  };
38859
38866
  const searchBox = (options, mountOptions) => {
38860
38867
  var _a;
38868
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38869
+ return;
38870
+ }
38861
38871
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
38862
38872
  for (const input2 of inputs) {
38863
38873
  applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
38864
38874
  }
38865
38875
  };
38866
38876
  const searchResults = (options, mountOptions) => {
38877
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38878
+ return;
38879
+ }
38867
38880
  const existingInstance = app.results[options.containerSelector];
38868
38881
  if (existingInstance) {
38869
38882
  existingInstance.props.searchResultsOptions = options;
@@ -38889,6 +38902,9 @@ and ensure you are accounting for this risk.
38889
38902
  app.results[options.containerSelector] = instance;
38890
38903
  };
38891
38904
  const productList = (options, mountOptions) => {
38905
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38906
+ return;
38907
+ }
38892
38908
  const existingInstance = app.productList[options.containerSelector];
38893
38909
  if (existingInstance) {
38894
38910
  existingInstance.props.productListOptions = options;
@@ -38915,6 +38931,9 @@ and ensure you are accounting for this risk.
38915
38931
  };
38916
38932
  const searchContainer = (options, mountOptions) => {
38917
38933
  var _a, _b, _c, _d, _e, _f;
38934
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38935
+ return;
38936
+ }
38918
38937
  const existingInstance = app.searchContainer[options.trigger];
38919
38938
  if (existingInstance) {
38920
38939
  existingInstance.props.searchContainerOptions = options;
@@ -38946,6 +38965,9 @@ and ensure you are accounting for this risk.
38946
38965
  app.searchContainer[options.trigger] = instance;
38947
38966
  };
38948
38967
  const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
38968
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38969
+ return;
38970
+ }
38949
38971
  const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
38950
38972
  preconfiguredSearchContainerOptions
38951
38973
  );
@@ -38963,6 +38985,9 @@ and ensure you are accounting for this risk.
38963
38985
  );
38964
38986
  };
38965
38987
  const recommendations = (options, mountOptions) => {
38988
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38989
+ return;
38990
+ }
38966
38991
  const existingInstance = app.recommendations[options.containerSelector];
38967
38992
  if (existingInstance) {
38968
38993
  existingInstance.props.recommendationOptions = options;
@@ -38988,6 +39013,9 @@ and ensure you are accounting for this risk.
38988
39013
  app.recommendations[options.containerSelector] = instance;
38989
39014
  };
38990
39015
  const chat = (options, mountOptions) => {
39016
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39017
+ return;
39018
+ }
38991
39019
  const existingInstance = app.chat[options.displayOptions.containerSelector];
38992
39020
  if (existingInstance) {
38993
39021
  existingInstance.props.options = options;
@@ -39252,6 +39280,7 @@ and ensure you are accounting for this risk.
39252
39280
  return;
39253
39281
  }
39254
39282
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
39283
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39255
39284
  const visible = yield waitForElementToBeVisible(
39256
39285
  resolvedConfiguration.inputSelector,
39257
39286
  0,
@@ -39263,13 +39292,14 @@ and ensure you are accounting for this risk.
39263
39292
  );
39264
39293
  return;
39265
39294
  }
39266
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39295
+ searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39267
39296
  });
39268
39297
  const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39269
39298
  if (!configuration.searchResults) {
39270
39299
  return;
39271
39300
  }
39272
39301
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
39302
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39273
39303
  const visible = yield waitForElementToBeVisible(
39274
39304
  resolvedConfiguration.containerSelector,
39275
39305
  0,
@@ -39281,7 +39311,7 @@ and ensure you are accounting for this risk.
39281
39311
  );
39282
39312
  return;
39283
39313
  }
39284
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39314
+ searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39285
39315
  });
39286
39316
  const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39287
39317
  if (!configuration.productList) {
@@ -39291,6 +39321,7 @@ and ensure you are accounting for this risk.
39291
39321
  configuration.searchResults
39292
39322
  );
39293
39323
  const resolvedConfiguration = JSON.parse(configuration.productList);
39324
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39294
39325
  const visible = yield waitForElementToBeVisible(
39295
39326
  resolvedConfiguration.containerSelector,
39296
39327
  0,
@@ -39304,7 +39335,7 @@ and ensure you are accounting for this risk.
39304
39335
  }
39305
39336
  productList(
39306
39337
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39307
- { fetch: fetch2 }
39338
+ { fetch: fetch2, allowedMountUrls }
39308
39339
  );
39309
39340
  });
39310
39341
  const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39317,6 +39348,7 @@ and ensure you are accounting for this risk.
39317
39348
  const resolvedConfiguration = JSON.parse(
39318
39349
  configuration.recommendations
39319
39350
  );
39351
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39320
39352
  const visible = yield waitForElementToBeVisible(
39321
39353
  resolvedConfiguration.containerSelector,
39322
39354
  0,
@@ -39330,7 +39362,7 @@ and ensure you are accounting for this risk.
39330
39362
  }
39331
39363
  recommendations(
39332
39364
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39333
- { fetch: fetch2 }
39365
+ { fetch: fetch2, allowedMountUrls }
39334
39366
  );
39335
39367
  });
39336
39368
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39341,6 +39373,7 @@ and ensure you are accounting for this risk.
39341
39373
  configuration.searchResults
39342
39374
  );
39343
39375
  const resolvedConfiguration = JSON.parse(configuration.genAiChat);
39376
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39344
39377
  const visible = yield waitForElementToBeVisible(
39345
39378
  resolvedConfiguration.containerSelector,
39346
39379
  0,
@@ -39352,7 +39385,10 @@ and ensure you are accounting for this risk.
39352
39385
  );
39353
39386
  return;
39354
39387
  }
39355
- chat(__spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch: fetch2 });
39388
+ chat(
39389
+ __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39390
+ { fetch: fetch2, allowedMountUrls }
39391
+ );
39356
39392
  });
39357
39393
  const mount = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39358
39394
  yield applyStyles(configuration);
@@ -10,23 +10,28 @@ declare const lupaSearch: {
10
10
  searchBox: (options: SearchBoxOptions, mountOptions?: {
11
11
  fetch?: boolean;
12
12
  mountingBehavior?: "replace" | "append" | "prepend";
13
+ allowedMountUrls?: string[];
13
14
  }) => void;
14
15
  searchResults: (options: SearchResultsOptions, mountOptions?: {
15
16
  fetch?: boolean;
16
17
  mountingBehavior?: "replace" | "append" | "prepend";
18
+ allowedMountUrls?: string[];
17
19
  }) => void;
18
20
  tracking: (options: TrackingOptions) => void;
19
21
  productList: (options: ProductListOptions, mountOptions?: {
20
22
  fetch?: boolean;
21
23
  mountingBehavior?: "replace" | "append" | "prepend";
24
+ allowedMountUrls?: string[];
22
25
  }) => void;
23
26
  searchContainer: (options: SearchContainerOptions, mountOptions?: {
24
27
  fetch?: boolean;
25
28
  mountingBehavior?: "replace" | "append" | "prepend";
29
+ allowedMountUrls?: string[];
26
30
  }) => void;
27
31
  recommendations: (options: ProductRecommendationOptions, mountOptions?: {
28
32
  fetch?: boolean;
29
33
  mountingBehavior?: "replace" | "append" | "prepend";
34
+ allowedMountUrls?: string[];
30
35
  }) => void;
31
36
  clearSearchBox: (selector?: string) => void;
32
37
  clearSearchResults: (selector?: string) => void;
@@ -36,11 +41,13 @@ declare const lupaSearch: {
36
41
  chat: (options: ChatOptions, mountOptions?: {
37
42
  fetch?: boolean;
38
43
  mountingBehavior?: "replace" | "append" | "prepend";
44
+ allowedMountUrls?: string[];
39
45
  }) => void;
40
46
  clearChat: (selector?: string) => void;
41
47
  preconfiguredSearchContainer: (preconfiguredSearchContainerOptions: PreconfiguredSearchContainerOptions, mountOptions?: {
42
48
  fetch?: boolean;
43
49
  mountingBehavior?: "replace" | "append" | "prepend";
50
+ allowedMountUrls?: string[];
44
51
  }) => void;
45
52
  getSearchBoxComponent: ({ searchBoxOptions, labels, panelOptions, redirections, placeholderImage }: PreconfiguredSearchContainerOptions) => SearchBoxOptions;
46
53
  getSearchResultsComponent: ({ searchResultOptions, labels, redirections, placeholderImage, configuratorOverrides, callbacks, additionalFields }: PreconfiguredSearchContainerOptions) => SearchResultsOptions;
@@ -4,6 +4,7 @@ import { PreconfiguredSearchContainerOptions } from './types/PreconfiguredSearch
4
4
  type MountOptions = {
5
5
  fetch?: boolean;
6
6
  mountingBehavior?: 'replace' | 'append' | 'prepend';
7
+ allowedMountUrls?: string[];
7
8
  };
8
9
  export declare const applySearchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
9
10
  export declare const searchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
@@ -0,0 +1,13 @@
1
+ import { ProductListOptions, ProductRecommendationOptions, SearchBoxOptions, SearchResultsOptions } from '@getlupa/vue';
2
+ export type ResolvedSearchBoxOptions = SearchBoxOptions & {
3
+ allowedMountUrls?: string[];
4
+ };
5
+ export type ResolvedSearchResultOptions = SearchResultsOptions & {
6
+ allowedMountUrls?: string[];
7
+ };
8
+ export type ResolvedProductListOptions = ProductListOptions & {
9
+ allowedMountUrls?: string[];
10
+ };
11
+ export type ResolvedProductRecommendationOptions = ProductRecommendationOptions & {
12
+ allowedMountUrls?: string[];
13
+ };
@@ -8,3 +8,4 @@ export declare const createVue: (selector: string | Element, mountingBehavior: s
8
8
  app: import("vue").App<Element>;
9
9
  mountElement: Element;
10
10
  };
11
+ export declare const canMount: (allowedMountUrls?: string[]) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.14.9",
3
+ "version": "1.14.13",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",