@thefittingroom/shop-ui 1.3.1 → 1.3.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/README.md CHANGED
@@ -122,7 +122,7 @@ tfr.setBrandUserId(brandUserId)
122
122
  --tfr-cta-font: var(--tfr-main-font);
123
123
 
124
124
  /* Size Selector */
125
- --tfr-size-selector-text-color: var(--white);
125
+ --tfr-size-selector-text-color: var(--tfr-white);
126
126
  --tfr-size-selector-bg-color: var(--tfr-grey);
127
127
  --tfr-size-selector-bg-color-hover: var(--tfr-light-grey);
128
128
  --tfr-size-selector-bg-color-active: var(--tfr-dark);
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.3.1 (2024-06-25T18:11:10.708Z)
2
+ * thefittingroom v1.3.3 (2024-06-27T17:08:50.710Z)
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.12 (2024-06-20T18:22:43.617Z)
50
+ * thefittingroom v1.2.0 (2024-06-27T17:07:39.802Z)
51
51
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
52
52
  */
53
53
 
@@ -22995,7 +22995,7 @@ class TfrShop {
22995
22995
  throw new NoColorwaySizeAssetsFoundError();
22996
22996
  return Array.from(assets.values())[0];
22997
22997
  }
22998
- async getMeasurementLocationsFromSku(sku) {
22998
+ async getMeasurementLocationsFromSku(sku, filledLocations = []) {
22999
22999
  const asset = await this.getColorwaySizeAssetFromSku(sku);
23000
23000
  if (!asset)
23001
23001
  throw new Error('No colorway size asset found for sku');
@@ -23005,7 +23005,10 @@ class TfrShop {
23005
23005
  const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);
23006
23006
  if (!taxonomy)
23007
23007
  throw new Error('Taxonomy not found for style garment category id');
23008
- return taxonomy.garment_measurement_locations.female.map((location) => {
23008
+ const filteredLocations = !filledLocations.length
23009
+ ? taxonomy.garment_measurement_locations.female
23010
+ : taxonomy.garment_measurement_locations.female.filter((location) => !filledLocations.includes(location));
23011
+ return filteredLocations.map((location) => {
23009
23012
  return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
23010
23013
  });
23011
23014
  }
@@ -23561,7 +23564,7 @@ n(css$2,{});
23561
23564
  var css$1 = ".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}";
23562
23565
  n(css$1,{});
23563
23566
 
23564
- var css = ":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#f5f5f5;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--white);--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-light-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark)}";
23567
+ var css = ":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#f5f5f5;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-light-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark)}";
23565
23568
  n(css,{});
23566
23569
 
23567
23570
  const ErrorModal = (props) => {
@@ -36682,10 +36685,11 @@ class TfrSizeRec {
36682
36685
  setIsLoggedIn(isLoggedIn) {
36683
36686
  this.sizeRecComponent.setIsLoggedIn(isLoggedIn);
36684
36687
  }
36685
- async setGarmentLocations() {
36688
+ async setGarmentLocations(filledLocations = []) {
36686
36689
  this.sizeRecComponent.setLoading(true);
36687
- const locations = await this.getGarmentLocations();
36690
+ const locations = await this.getGarmentLocations(filledLocations);
36688
36691
  console.debug('locations', locations);
36692
+ console.debug('filledLocations', filledLocations);
36689
36693
  this.sizeRecComponent.setGarmentLocations(locations || []);
36690
36694
  this.sizeRecComponent.setLoading(false);
36691
36695
  }
@@ -36701,9 +36705,9 @@ class TfrSizeRec {
36701
36705
  this.sizeRecComponent.setRecommendedSize(sizes);
36702
36706
  this.sizeRecComponent.setLoading(false);
36703
36707
  }
36704
- async getGarmentLocations() {
36708
+ async getGarmentLocations(filledLocations) {
36705
36709
  try {
36706
- const locations = await this.tfrShop.getMeasurementLocationsFromSku(this.sku);
36710
+ const locations = await this.tfrShop.getMeasurementLocationsFromSku(this.sku, filledLocations);
36707
36711
  return locations;
36708
36712
  }
36709
36713
  catch (error) {
@@ -36834,22 +36838,15 @@ class FittingRoom {
36834
36838
  return this.tfrSizeRec.sku;
36835
36839
  }
36836
36840
  async checkIfPublished(brandStyleIdOrSku) {
36837
- try {
36838
- const colorwaySizeAsset = await this.tfrShop.getColorwaySizeAssetFromSku(brandStyleIdOrSku);
36839
- const style = await this.tfrShop.getStyle(colorwaySizeAsset.style_id);
36840
- return Boolean(style === null || style === void 0 ? void 0 : style.is_published);
36841
- }
36842
- catch (_a) {
36843
- const style = await this.tfrShop.getStyleByBrandStyleId(brandStyleIdOrSku);
36844
- return Boolean(style === null || style === void 0 ? void 0 : style.is_published);
36845
- }
36841
+ const style = await this.getStyle(brandStyleIdOrSku);
36842
+ return Boolean(style === null || style === void 0 ? void 0 : style.is_published);
36846
36843
  }
36847
36844
  setSku(sku) {
36848
36845
  this.tfrSizeRec.setSku(sku);
36849
36846
  if (this.isLoggedIn)
36850
36847
  this.tfrSizeRec.setRecommendedSize();
36851
36848
  else
36852
- this.tfrSizeRec.setGarmentLocations();
36849
+ this.setGarmentLocations();
36853
36850
  }
36854
36851
  async onInit() {
36855
36852
  var _a, _b;
@@ -36877,7 +36874,7 @@ class FittingRoom {
36877
36874
  this.hooks.onLogout();
36878
36875
  this.isLoggedIn = false;
36879
36876
  this.tfrSizeRec.setIsLoggedIn(false);
36880
- this.tfrSizeRec.setGarmentLocations();
36877
+ this.setGarmentLocations();
36881
36878
  this.unsubscribeFromProfileChanges();
36882
36879
  }
36883
36880
  async signIn(username, password, validationError) {
@@ -36962,6 +36959,29 @@ class FittingRoom {
36962
36959
  this.unsub();
36963
36960
  this.unsub = null;
36964
36961
  }
36962
+ async setGarmentLocations() {
36963
+ var _a, _b;
36964
+ const style = await this.getStyle(this.sku);
36965
+ const filledLocations = ((_b = (_a = style === null || style === void 0 ? void 0 : style.sizes) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.garment_measurements.map((measurement) => measurement.garment_measurement_location)) ||
36966
+ [];
36967
+ this.tfrSizeRec.setGarmentLocations(filledLocations);
36968
+ }
36969
+ async getStyle(brandStyleIdOrSku) {
36970
+ try {
36971
+ const colorwaySizeAsset = await this.tfrShop.getColorwaySizeAssetFromSku(brandStyleIdOrSku);
36972
+ const style = await this.tfrShop.getStyle(colorwaySizeAsset.style_id);
36973
+ return style;
36974
+ }
36975
+ catch (_a) {
36976
+ try {
36977
+ const style = await this.tfrShop.getStyleByBrandStyleId(brandStyleIdOrSku);
36978
+ return style;
36979
+ }
36980
+ catch (_b) {
36981
+ return null;
36982
+ }
36983
+ }
36984
+ }
36965
36985
  }
36966
36986
 
36967
36987
  const initFittingRoom = async (shopId, modalDivId, sizeRecMainDivId, hooks = {}, cssVariables = {}, env = 'dev') => {