@thefittingroom/shop-ui 1.1.7 → 1.1.8

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.
@@ -12,6 +12,7 @@ export declare class SizeRecComponent {
12
12
  private readonly onSignInClick;
13
13
  private readonly onSignOutClick;
14
14
  private _sku;
15
+ private isLoggedIn;
15
16
  private tfrSizeRecTitle;
16
17
  private tfrSizeRecSubtitle;
17
18
  private tfrSizeRecActionLogin;
@@ -30,7 +31,7 @@ export declare class SizeRecComponent {
30
31
  setLoading(isLoading: boolean): void;
31
32
  setGarmentLocations(locations: string[]): void;
32
33
  setRecommendedSize({ recommended, sizes }: RecommendedSize): void;
33
- setError(error: string): void;
34
+ setError(): void;
34
35
  private init;
35
36
  private setElements;
36
37
  private bindEvents;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.1.7 (2024-05-16T02:29:04.341Z)
2
+ * thefittingroom v1.1.8 (2024-05-16T03:17:08.880Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  function loadImageRecursive(imageURL, imageURLs) {
@@ -23504,7 +23504,7 @@ n(css$5,{});
23504
23504
  var css$4 = "@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}";
23505
23505
  n(css$4,{});
23506
23506
 
23507
- var css$3 = "#tfr-size-recommendations{border:1px solid hsla(0,0%,7%,.55);color:#121212;display:flex;padding:14px 20px;width:440px}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;width:100%}#tfr-size-rec-login-svg{display:none}#tfr-size-rec-title{align-items:center;display:flex;margin-bottom:8px}#tfr-size-rec-subtitle{margin-bottom:6px}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:16px;font-weight:700}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:2px}.tfr-size-rec-table-row{align-items:center;border-top:1px solid hsla(0,0%,7%,.55);display:flex;height:40px;justify-content:center}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{font-weight:700;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px}.tfr-size-rec-table-cell-right.perfect{color:#209da7}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:#a7a7a7;display:flex}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none}#tfr-size-rec-action{cursor:pointer;font-size:16px;margin-top:14px;text-decoration:underline}#tfr-size-rec-select{background-color:#878787;border-radius:8px;box-shadow:0 4px 4px 0 rgba(0,0,0,.3);color:#fff;display:none;font-size:14px;margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:35px;justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:hsla(0,0%,100%,.3);opacity:.7}.tfr-size-rec-select-button.active{background-color:#212121;height:45px}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:8px;border-top-left-radius:8px}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:8px;border-top-right-radius:8px}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}";
23507
+ var css$3 = "#tfr-size-recommendations{border:1px solid hsla(0,0%,7%,.55);color:#121212;display:flex;padding:14px 20px;width:440px}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;width:100%}#tfr-size-rec-login-svg{display:none}#tfr-size-rec-title{align-items:center;display:flex;margin-bottom:8px}#tfr-size-rec-subtitle{margin-bottom:6px}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:16px;font-weight:700}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:2px}.tfr-size-rec-table-row{align-items:center;border-top:1px solid hsla(0,0%,7%,.55);display:flex;height:40px;justify-content:center}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{font-weight:700;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px}.tfr-size-rec-table-cell-right.perfect{color:#209da7}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:#a7a7a7;display:flex}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none}#tfr-size-rec-action{cursor:pointer;font-size:16px;margin-top:14px;text-decoration:underline}#tfr-size-rec-select{background-color:#878787;border-radius:8px;box-shadow:0 4px 4px 0 rgba(0,0,0,.3);color:#fff;display:none;font-size:14px;margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:35px;justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:hsla(0,0%,100%,.3);opacity:.7}.tfr-size-rec-select-button.active{background-color:#212121;height:45px}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:8px;border-top-left-radius:8px}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:8px;border-top-right-radius:8px}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}";
23508
23508
  n(css$3,{});
23509
23509
 
23510
23510
  var css$2 = ".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}";
@@ -36439,6 +36439,7 @@ class SizeRecComponent {
36439
36439
  this.onSignInClick = onSignInClick;
36440
36440
  this.onSignOutClick = onSignOutClick;
36441
36441
  this._sku = '';
36442
+ this.isLoggedIn = false;
36442
36443
  this.redraw = null;
36443
36444
  this.init(sizeRecMainDivId);
36444
36445
  }
@@ -36449,9 +36450,12 @@ class SizeRecComponent {
36449
36450
  this._sku = sku;
36450
36451
  }
36451
36452
  setIsLoggedIn(isLoggedIn) {
36453
+ this.isLoggedIn = isLoggedIn;
36452
36454
  if (isLoggedIn) {
36453
36455
  this.tfrSizeRecActionLogin.style.display = 'none';
36454
36456
  this.tfrSizeRecActionLogout.style.display = 'block';
36457
+ this.tfrSizeRecTitle.style.display = 'block';
36458
+ this.tfrSizeRecSubtitle.style.display = 'block';
36455
36459
  }
36456
36460
  else {
36457
36461
  this.tfrSizeRecActionLogin.style.display = 'block';
@@ -36469,6 +36473,11 @@ class SizeRecComponent {
36469
36473
  }
36470
36474
  }
36471
36475
  setGarmentLocations(locations) {
36476
+ if (!locations || !locations.length) {
36477
+ this.tfrSizeRecTitle.style.display = 'none';
36478
+ this.tfrSizeRecSubtitle.style.display = 'none';
36479
+ return;
36480
+ }
36472
36481
  this.renderGarmentLocations(locations);
36473
36482
  this.tfrSizeRecSelect.style.display = 'none';
36474
36483
  }
@@ -36476,11 +36485,13 @@ class SizeRecComponent {
36476
36485
  this.renderSizeRec(recommended, sizes);
36477
36486
  this.tfrSizeRecSelect.style.display = 'flex';
36478
36487
  }
36479
- setError(error) {
36488
+ setError() {
36480
36489
  this.tfrSizeRecTitle.style.display = 'none';
36481
36490
  this.tfrSizeRecSubtitle.style.display = 'none';
36491
+ if (!this.isLoggedIn)
36492
+ return;
36482
36493
  this.tfrSizeRecommendationError.style.display = 'block';
36483
- this.tfrSizeRecommendationError.innerHTML = error;
36494
+ this.tfrSizeRecommendationError.innerHTML = 'No recommended size found.';
36484
36495
  }
36485
36496
  init(sizeRecMainDivId) {
36486
36497
  const sizeRecMainDiv = document.getElementById(sizeRecMainDivId);
@@ -36624,17 +36635,17 @@ class TfrSizeRec {
36624
36635
  async setGarmentLocations() {
36625
36636
  this.sizeRecComponent.setLoading(true);
36626
36637
  const locations = await this.getGarmentLocations();
36627
- if (!locations)
36628
- return this.sizeRecComponent.setLoading(false);
36629
- this.sizeRecComponent.setGarmentLocations(locations);
36638
+ console.debug('locations', locations);
36639
+ this.sizeRecComponent.setGarmentLocations(locations || []);
36630
36640
  this.sizeRecComponent.setLoading(false);
36631
36641
  }
36632
36642
  async setRecommendedSize() {
36633
36643
  this.sizeRecComponent.setLoading(true);
36634
36644
  const sizes = await this.getRecommenedSize();
36635
36645
  if (!sizes) {
36646
+ console.error('No sizes found for sku');
36636
36647
  this.sizeRecComponent.setLoading(false);
36637
- this.sizeRecComponent.setError('No recommended size found.');
36648
+ this.sizeRecComponent.setError();
36638
36649
  return;
36639
36650
  }
36640
36651
  this.sizeRecComponent.setRecommendedSize(sizes);
@@ -36646,7 +36657,8 @@ class TfrSizeRec {
36646
36657
  return locations;
36647
36658
  }
36648
36659
  catch (error) {
36649
- this.sizeRecComponent.setError(error.message || error.error);
36660
+ console.error(error);
36661
+ this.sizeRecComponent.setError();
36650
36662
  return null;
36651
36663
  }
36652
36664
  }
@@ -36657,7 +36669,8 @@ class TfrSizeRec {
36657
36669
  return sizes;
36658
36670
  }
36659
36671
  catch (error) {
36660
- this.sizeRecComponent.setError(error.message || error.error);
36672
+ console.error(error);
36673
+ this.sizeRecComponent.setError();
36661
36674
  return null;
36662
36675
  }
36663
36676
  }
@@ -36666,10 +36679,10 @@ class TfrSizeRec {
36666
36679
  if (!sizeRec)
36667
36680
  return null;
36668
36681
  return {
36669
- recommended: sizeRec.recommended_size.size_value.size,
36682
+ recommended: sizeRec.recommended_size.label,
36670
36683
  sizes: sizeRec.fits.map((fit) => {
36671
36684
  return {
36672
- size: sizeRec.available_sizes.find((size) => size.id === fit.size_id).size_value.size,
36685
+ size: sizeRec.available_sizes.find((size) => size.id === fit.size_id).label,
36673
36686
  locations: fit.measurement_location_fits.map((locationFit) => {
36674
36687
  return {
36675
36688
  fit: index.FitNames[locationFit.fit],