@thefittingroom/shop-ui 1.2.1 → 1.2.3

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.2.1 (2024-06-18T16:26:11.166Z)
2
+ * thefittingroom v1.2.3 (2024-06-20T18:12:34.387Z)
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.1.7 (2024-05-16T23:59:30.970Z)
50
+ * thefittingroom v1.1.10 (2024-06-20T18:11:48.643Z)
51
51
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
52
52
  */
53
53
 
@@ -22999,7 +22999,7 @@ class TfrShop {
22999
22999
  const asset = await this.getColorwaySizeAssetFromSku(sku);
23000
23000
  if (!asset)
23001
23001
  throw new Error('No colorway size asset found for sku');
23002
- const styleCategory = await this.getStyleCategory(asset.style_id);
23002
+ const styleCategory = await this.getStyle(asset.style_id);
23003
23003
  if (!styleCategory)
23004
23004
  throw new Error('Style category not found for style id');
23005
23005
  const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);
@@ -23009,6 +23009,15 @@ class TfrShop {
23009
23009
  return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
23010
23010
  });
23011
23011
  }
23012
+ async getStyleByBrandStyleId(brandStyleId) {
23013
+ try {
23014
+ const querySnapshot = await this.firebase.getDocs('styles', [rl('brand_style_id', '==', brandStyleId)]);
23015
+ return querySnapshot.docs[0].data();
23016
+ }
23017
+ catch (error) {
23018
+ return getFirebaseError(error);
23019
+ }
23020
+ }
23012
23021
  async getColorwaySizeAssets(styleId, skus) {
23013
23022
  const constraints = [rl('brand_id', '==', this.brandId)];
23014
23023
  if (styleId)
@@ -23028,7 +23037,7 @@ class TfrShop {
23028
23037
  return getFirebaseError(error);
23029
23038
  }
23030
23039
  }
23031
- async getStyleCategory(styleId) {
23040
+ async getStyle(styleId) {
23032
23041
  try {
23033
23042
  const doc = await this.firebase.getDoc('styles', String(styleId));
23034
23043
  return doc;
@@ -36704,7 +36713,8 @@ class TfrSizeRec {
36704
36713
  }
36705
36714
  catch (error) {
36706
36715
  try {
36707
- const sizes = await this.getRecommendedSizes(String(this.sku));
36716
+ const style = await this.tfrShop.getStyleByBrandStyleId(this.sku);
36717
+ const sizes = await this.getRecommendedSizes(String(style.id));
36708
36718
  return sizes;
36709
36719
  }
36710
36720
  catch (error) {
@@ -36765,6 +36775,10 @@ class FittingRoom {
36765
36775
  get sku() {
36766
36776
  return this.tfrSizeRec.sku;
36767
36777
  }
36778
+ async checkIfPublished(brandStyleId) {
36779
+ const style = await this.tfrShop.getStyleByBrandStyleId(brandStyleId);
36780
+ return style.is_published;
36781
+ }
36768
36782
  setSku(sku) {
36769
36783
  this.tfrSizeRec.setSku(sku);
36770
36784
  if (this.isLoggedIn)