@thefittingroom/shop-ui 1.3.4 → 1.3.7

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/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.3.4 (2024-06-27T17:23:20.328Z)
2
+ * thefittingroom v1.3.7 (2024-07-02T15:31:28.697Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  function loadImageRecursive(imageURL, imageURLs) {
@@ -47,7 +47,7 @@ const InitImageSlider = (sliderID, onChange) => {
47
47
  };
48
48
 
49
49
  /*!
50
- * thefittingroom v1.2.1 (2024-06-27T17:22:36.881Z)
50
+ * thefittingroom v1.2.2 (2024-07-02T15:28:01.417Z)
51
51
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
52
52
  */
53
53
 
@@ -22995,6 +22995,12 @@ class TfrShop {
22995
22995
  throw new NoColorwaySizeAssetsFoundError();
22996
22996
  return Array.from(assets.values())[0];
22997
22997
  }
22998
+ async getColorwaySizeAssetFromBrandStyleId(brandStyleId) {
22999
+ const assets = await this.getColorwaySizeAssets(brandStyleId);
23000
+ if (!(assets === null || assets === void 0 ? void 0 : assets.size))
23001
+ throw new NoColorwaySizeAssetsFoundError();
23002
+ return Array.from(assets.values())[0];
23003
+ }
22998
23004
  async getMeasurementLocationsFromSku(sku, filledLocations = []) {
22999
23005
  const asset = await this.getColorwaySizeAssetFromSku(sku);
23000
23006
  if (!asset)
@@ -23012,6 +23018,23 @@ class TfrShop {
23012
23018
  return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
23013
23019
  });
23014
23020
  }
23021
+ async getMeasurementLocationsFromBrandStyleId(brandStyleId, filledLocations = []) {
23022
+ const asset = await this.getColorwaySizeAssetFromBrandStyleId(brandStyleId);
23023
+ if (!asset)
23024
+ throw new Error('No colorway size asset found for brand style id');
23025
+ const styleCategory = await this.getStyle(asset.style_id);
23026
+ if (!styleCategory)
23027
+ throw new Error('Style category not found for style id');
23028
+ const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);
23029
+ if (!taxonomy)
23030
+ throw new Error('Taxonomy not found for style garment category id');
23031
+ const filteredLocations = !filledLocations.length
23032
+ ? taxonomy.garment_measurement_locations.female
23033
+ : taxonomy.garment_measurement_locations.female.filter((location) => filledLocations.includes(location));
23034
+ return filteredLocations.map((location) => {
23035
+ return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
23036
+ });
23037
+ }
23015
23038
  async getStyleByBrandStyleId(brandStyleId) {
23016
23039
  var _a, _b;
23017
23040
  try {
@@ -36711,9 +36734,16 @@ class TfrSizeRec {
36711
36734
  return locations;
36712
36735
  }
36713
36736
  catch (error) {
36714
- console.error(error);
36715
- this.sizeRecComponent.setError();
36716
- return null;
36737
+ try {
36738
+ const style = await this.tfrShop.getStyleByBrandStyleId(this.sku);
36739
+ const locations = await this.tfrShop.getMeasurementLocationsFromBrandStyleId(style.id, filledLocations);
36740
+ return locations;
36741
+ }
36742
+ catch (error) {
36743
+ console.error(error);
36744
+ this.sizeRecComponent.setError();
36745
+ return null;
36746
+ }
36717
36747
  }
36718
36748
  }
36719
36749
  async getRecommenedSize() {