@getlupa/client 1.20.5 → 1.20.6

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.
@@ -46681,6 +46681,33 @@ and ensure you are accounting for this risk.
46681
46681
  }
46682
46682
  return true;
46683
46683
  };
46684
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
46685
+ let foundElement = null;
46686
+ if (typeof element === "string") {
46687
+ foundElement = document.querySelector(element);
46688
+ } else {
46689
+ foundElement = element;
46690
+ }
46691
+ if (foundElement) {
46692
+ return true;
46693
+ }
46694
+ if (retries >= maxRetries) {
46695
+ return false;
46696
+ }
46697
+ return new Promise((resolve2) => {
46698
+ setTimeout(() => {
46699
+ resolve2(
46700
+ waitForElementToBeVisible(
46701
+ element,
46702
+ retries + 1,
46703
+ maxRetries,
46704
+ Math.min(500, interval + Math.round(0.5 * interval))
46705
+ )
46706
+ );
46707
+ }, interval);
46708
+ });
46709
+ });
46710
+ const MAX_ELEMENT_MOUNT_RETRIES$1 = 25;
46684
46711
  const app = {
46685
46712
  box: {},
46686
46713
  results: {},
@@ -46741,7 +46768,7 @@ and ensure you are accounting for this risk.
46741
46768
  });
46742
46769
  return newOptions;
46743
46770
  };
46744
- const applySearchBox = (options, mountOptions) => {
46771
+ const applySearchBox = (options, mountOptions) => __async(null, null, function* () {
46745
46772
  const existingInstance = app.box[options.inputSelector];
46746
46773
  if (existingInstance) {
46747
46774
  existingInstance.props.searchBoxOptions = options;
@@ -46753,6 +46780,7 @@ and ensure you are accounting for this risk.
46753
46780
  }
46754
46781
  return;
46755
46782
  }
46783
+ yield waitForElementToBeVisible(options.inputSelector, 0, MAX_ELEMENT_MOUNT_RETRIES$1);
46756
46784
  const instance = createVue(
46757
46785
  options.inputSelector,
46758
46786
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
@@ -46764,7 +46792,7 @@ and ensure you are accounting for this risk.
46764
46792
  return;
46765
46793
  }
46766
46794
  app.box[options.inputSelector] = instance;
46767
- };
46795
+ });
46768
46796
  const searchBox = (options, mountOptions) => {
46769
46797
  var _a25;
46770
46798
  if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
@@ -47028,32 +47056,6 @@ and ensure you are accounting for this risk.
47028
47056
  } catch (e2) {
47029
47057
  }
47030
47058
  };
47031
- const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
47032
- let foundElement = null;
47033
- if (typeof element === "string") {
47034
- foundElement = document.querySelector(element);
47035
- } else {
47036
- foundElement = element;
47037
- }
47038
- if (foundElement) {
47039
- return true;
47040
- }
47041
- if (retries >= maxRetries) {
47042
- return false;
47043
- }
47044
- return new Promise((resolve2) => {
47045
- setTimeout(() => {
47046
- resolve2(
47047
- waitForElementToBeVisible(
47048
- element,
47049
- retries + 1,
47050
- maxRetries,
47051
- Math.min(500, interval + Math.round(0.5 * interval))
47052
- )
47053
- );
47054
- }, interval);
47055
- });
47056
- });
47057
47059
  const isObject = (item) => typeof item === "object" && !Array.isArray(item);
47058
47060
  const merge = (target2, source) => {
47059
47061
  const isDeep2 = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target2, prop) && isObject(target2[prop]);
@@ -46681,6 +46681,33 @@ const canMount = (allowedMountUrls) => {
46681
46681
  }
46682
46682
  return true;
46683
46683
  };
46684
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
46685
+ let foundElement = null;
46686
+ if (typeof element === "string") {
46687
+ foundElement = document.querySelector(element);
46688
+ } else {
46689
+ foundElement = element;
46690
+ }
46691
+ if (foundElement) {
46692
+ return true;
46693
+ }
46694
+ if (retries >= maxRetries) {
46695
+ return false;
46696
+ }
46697
+ return new Promise((resolve2) => {
46698
+ setTimeout(() => {
46699
+ resolve2(
46700
+ waitForElementToBeVisible(
46701
+ element,
46702
+ retries + 1,
46703
+ maxRetries,
46704
+ Math.min(500, interval + Math.round(0.5 * interval))
46705
+ )
46706
+ );
46707
+ }, interval);
46708
+ });
46709
+ });
46710
+ const MAX_ELEMENT_MOUNT_RETRIES$1 = 25;
46684
46711
  const app = {
46685
46712
  box: {},
46686
46713
  results: {},
@@ -46741,7 +46768,7 @@ const addSearchResultsDomPingIfConfigured = (options, mountOptions) => {
46741
46768
  });
46742
46769
  return newOptions;
46743
46770
  };
46744
- const applySearchBox = (options, mountOptions) => {
46771
+ const applySearchBox = (options, mountOptions) => __async(null, null, function* () {
46745
46772
  const existingInstance = app.box[options.inputSelector];
46746
46773
  if (existingInstance) {
46747
46774
  existingInstance.props.searchBoxOptions = options;
@@ -46753,6 +46780,7 @@ const applySearchBox = (options, mountOptions) => {
46753
46780
  }
46754
46781
  return;
46755
46782
  }
46783
+ yield waitForElementToBeVisible(options.inputSelector, 0, MAX_ELEMENT_MOUNT_RETRIES$1);
46756
46784
  const instance = createVue(
46757
46785
  options.inputSelector,
46758
46786
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
@@ -46764,7 +46792,7 @@ const applySearchBox = (options, mountOptions) => {
46764
46792
  return;
46765
46793
  }
46766
46794
  app.box[options.inputSelector] = instance;
46767
- };
46795
+ });
46768
46796
  const searchBox = (options, mountOptions) => {
46769
46797
  var _a25;
46770
46798
  if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
@@ -47028,32 +47056,6 @@ const clearChat = (selector) => {
47028
47056
  } catch (e2) {
47029
47057
  }
47030
47058
  };
47031
- const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
47032
- let foundElement = null;
47033
- if (typeof element === "string") {
47034
- foundElement = document.querySelector(element);
47035
- } else {
47036
- foundElement = element;
47037
- }
47038
- if (foundElement) {
47039
- return true;
47040
- }
47041
- if (retries >= maxRetries) {
47042
- return false;
47043
- }
47044
- return new Promise((resolve2) => {
47045
- setTimeout(() => {
47046
- resolve2(
47047
- waitForElementToBeVisible(
47048
- element,
47049
- retries + 1,
47050
- maxRetries,
47051
- Math.min(500, interval + Math.round(0.5 * interval))
47052
- )
47053
- );
47054
- }, interval);
47055
- });
47056
- });
47057
47059
  const isObject = (item) => typeof item === "object" && !Array.isArray(item);
47058
47060
  const merge = (target2, source) => {
47059
47061
  const isDeep2 = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target2, prop) && isObject(target2[prop]);
@@ -46679,6 +46679,33 @@ const canMount = (allowedMountUrls) => {
46679
46679
  }
46680
46680
  return true;
46681
46681
  };
46682
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
46683
+ let foundElement = null;
46684
+ if (typeof element === "string") {
46685
+ foundElement = document.querySelector(element);
46686
+ } else {
46687
+ foundElement = element;
46688
+ }
46689
+ if (foundElement) {
46690
+ return true;
46691
+ }
46692
+ if (retries >= maxRetries) {
46693
+ return false;
46694
+ }
46695
+ return new Promise((resolve2) => {
46696
+ setTimeout(() => {
46697
+ resolve2(
46698
+ waitForElementToBeVisible(
46699
+ element,
46700
+ retries + 1,
46701
+ maxRetries,
46702
+ Math.min(500, interval + Math.round(0.5 * interval))
46703
+ )
46704
+ );
46705
+ }, interval);
46706
+ });
46707
+ });
46708
+ const MAX_ELEMENT_MOUNT_RETRIES$1 = 25;
46682
46709
  const app = {
46683
46710
  box: {},
46684
46711
  results: {},
@@ -46739,7 +46766,7 @@ const addSearchResultsDomPingIfConfigured = (options, mountOptions) => {
46739
46766
  });
46740
46767
  return newOptions;
46741
46768
  };
46742
- const applySearchBox = (options, mountOptions) => {
46769
+ const applySearchBox = (options, mountOptions) => __async(null, null, function* () {
46743
46770
  const existingInstance = app.box[options.inputSelector];
46744
46771
  if (existingInstance) {
46745
46772
  existingInstance.props.searchBoxOptions = options;
@@ -46751,6 +46778,7 @@ const applySearchBox = (options, mountOptions) => {
46751
46778
  }
46752
46779
  return;
46753
46780
  }
46781
+ yield waitForElementToBeVisible(options.inputSelector, 0, MAX_ELEMENT_MOUNT_RETRIES$1);
46754
46782
  const instance = createVue(
46755
46783
  options.inputSelector,
46756
46784
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
@@ -46762,7 +46790,7 @@ const applySearchBox = (options, mountOptions) => {
46762
46790
  return;
46763
46791
  }
46764
46792
  app.box[options.inputSelector] = instance;
46765
- };
46793
+ });
46766
46794
  const searchBox = (options, mountOptions) => {
46767
46795
  var _a25;
46768
46796
  if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
@@ -47026,32 +47054,6 @@ const clearChat = (selector) => {
47026
47054
  } catch (e2) {
47027
47055
  }
47028
47056
  };
47029
- const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
47030
- let foundElement = null;
47031
- if (typeof element === "string") {
47032
- foundElement = document.querySelector(element);
47033
- } else {
47034
- foundElement = element;
47035
- }
47036
- if (foundElement) {
47037
- return true;
47038
- }
47039
- if (retries >= maxRetries) {
47040
- return false;
47041
- }
47042
- return new Promise((resolve2) => {
47043
- setTimeout(() => {
47044
- resolve2(
47045
- waitForElementToBeVisible(
47046
- element,
47047
- retries + 1,
47048
- maxRetries,
47049
- Math.min(500, interval + Math.round(0.5 * interval))
47050
- )
47051
- );
47052
- }, interval);
47053
- });
47054
- });
47055
47057
  const isObject = (item) => typeof item === "object" && !Array.isArray(item);
47056
47058
  const merge = (target2, source) => {
47057
47059
  const isDeep2 = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target2, prop) && isObject(target2[prop]);
@@ -46683,6 +46683,33 @@ and ensure you are accounting for this risk.
46683
46683
  }
46684
46684
  return true;
46685
46685
  };
46686
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
46687
+ let foundElement = null;
46688
+ if (typeof element === "string") {
46689
+ foundElement = document.querySelector(element);
46690
+ } else {
46691
+ foundElement = element;
46692
+ }
46693
+ if (foundElement) {
46694
+ return true;
46695
+ }
46696
+ if (retries >= maxRetries) {
46697
+ return false;
46698
+ }
46699
+ return new Promise((resolve2) => {
46700
+ setTimeout(() => {
46701
+ resolve2(
46702
+ waitForElementToBeVisible(
46703
+ element,
46704
+ retries + 1,
46705
+ maxRetries,
46706
+ Math.min(500, interval + Math.round(0.5 * interval))
46707
+ )
46708
+ );
46709
+ }, interval);
46710
+ });
46711
+ });
46712
+ const MAX_ELEMENT_MOUNT_RETRIES$1 = 25;
46686
46713
  const app = {
46687
46714
  box: {},
46688
46715
  results: {},
@@ -46743,7 +46770,7 @@ and ensure you are accounting for this risk.
46743
46770
  });
46744
46771
  return newOptions;
46745
46772
  };
46746
- const applySearchBox = (options, mountOptions) => {
46773
+ const applySearchBox = (options, mountOptions) => __async(null, null, function* () {
46747
46774
  const existingInstance = app.box[options.inputSelector];
46748
46775
  if (existingInstance) {
46749
46776
  existingInstance.props.searchBoxOptions = options;
@@ -46755,6 +46782,7 @@ and ensure you are accounting for this risk.
46755
46782
  }
46756
46783
  return;
46757
46784
  }
46785
+ yield waitForElementToBeVisible(options.inputSelector, 0, MAX_ELEMENT_MOUNT_RETRIES$1);
46758
46786
  const instance = createVue(
46759
46787
  options.inputSelector,
46760
46788
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
@@ -46766,7 +46794,7 @@ and ensure you are accounting for this risk.
46766
46794
  return;
46767
46795
  }
46768
46796
  app.box[options.inputSelector] = instance;
46769
- };
46797
+ });
46770
46798
  const searchBox = (options, mountOptions) => {
46771
46799
  var _a25;
46772
46800
  if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
@@ -47030,32 +47058,6 @@ and ensure you are accounting for this risk.
47030
47058
  } catch (e2) {
47031
47059
  }
47032
47060
  };
47033
- const waitForElementToBeVisible = (element, retries = 0, maxRetries = 30, interval = 10) => __async(null, null, function* () {
47034
- let foundElement = null;
47035
- if (typeof element === "string") {
47036
- foundElement = document.querySelector(element);
47037
- } else {
47038
- foundElement = element;
47039
- }
47040
- if (foundElement) {
47041
- return true;
47042
- }
47043
- if (retries >= maxRetries) {
47044
- return false;
47045
- }
47046
- return new Promise((resolve2) => {
47047
- setTimeout(() => {
47048
- resolve2(
47049
- waitForElementToBeVisible(
47050
- element,
47051
- retries + 1,
47052
- maxRetries,
47053
- Math.min(500, interval + Math.round(0.5 * interval))
47054
- )
47055
- );
47056
- }, interval);
47057
- });
47058
- });
47059
47061
  const isObject = (item) => typeof item === "object" && !Array.isArray(item);
47060
47062
  const merge = (target2, source) => {
47061
47063
  const isDeep2 = (prop) => isObject(source[prop]) && Object.prototype.hasOwnProperty.call(target2, prop) && isObject(target2[prop]);
@@ -10,7 +10,7 @@ type MountOptions = {
10
10
  count?: number;
11
11
  };
12
12
  };
13
- export declare const applySearchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
13
+ export declare const applySearchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => Promise<void>;
14
14
  export declare const searchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
15
15
  export declare const searchResults: (options: SearchResultsOptions, mountOptions?: MountOptions) => void;
16
16
  export declare const productList: (options: ProductListOptions, mountOptions?: MountOptions) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.20.5",
3
+ "version": "1.20.6",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/index.d.ts",