@thefittingroom/shop-ui 1.1.6 → 1.1.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.
@@ -1,4 +1,3 @@
1
- import { TfrShop } from '@thefittingroom/sdk';
2
1
  export type RecommendedSize = {
3
2
  recommended: string;
4
3
  sizes: {
@@ -10,10 +9,11 @@ export type RecommendedSize = {
10
9
  }[];
11
10
  };
12
11
  export declare class SizeRecComponent {
13
- private readonly tfrShop;
14
12
  private readonly onSignInClick;
15
13
  private readonly onSignOutClick;
16
14
  private _sku;
15
+ private tfrSizeRecTitle;
16
+ private tfrSizeRecSubtitle;
17
17
  private tfrSizeRecActionLogin;
18
18
  private tfrSizeRecActionLogout;
19
19
  private tfrSizeRecLoading;
@@ -23,7 +23,7 @@ export declare class SizeRecComponent {
23
23
  private tfrSizeRecSize;
24
24
  private tfrSizeRecTable;
25
25
  private redraw;
26
- constructor(sizeRecMainDivId: string, tfrShop: TfrShop, onSignInClick: () => void, onSignOutClick: () => void);
26
+ constructor(sizeRecMainDivId: string, onSignInClick: () => void, onSignOutClick: () => void);
27
27
  get sku(): string;
28
28
  setSku(sku: string): void;
29
29
  setIsLoggedIn(isLoggedIn: boolean): void;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.1.6 (2024-04-05T19:16:24.483Z)
2
+ * thefittingroom v1.1.7 (2024-05-16T02:29:04.341Z)
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.3 (2024-04-05T19:13:45.167Z)
50
+ * thefittingroom v1.1.5 (2024-05-16T02:24:56.143Z)
51
51
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
52
52
  */
53
53
 
@@ -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}";
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}";
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%}";
@@ -36435,8 +36435,7 @@ class TfrModal {
36435
36435
  const loginIconSrc = 'https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg';
36436
36436
  const doorLogoSrc = 'https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg';
36437
36437
  class SizeRecComponent {
36438
- constructor(sizeRecMainDivId, tfrShop, onSignInClick, onSignOutClick) {
36439
- this.tfrShop = tfrShop;
36438
+ constructor(sizeRecMainDivId, onSignInClick, onSignOutClick) {
36440
36439
  this.onSignInClick = onSignInClick;
36441
36440
  this.onSignOutClick = onSignOutClick;
36442
36441
  this._sku = '';
@@ -36478,6 +36477,9 @@ class SizeRecComponent {
36478
36477
  this.tfrSizeRecSelect.style.display = 'flex';
36479
36478
  }
36480
36479
  setError(error) {
36480
+ this.tfrSizeRecTitle.style.display = 'none';
36481
+ this.tfrSizeRecSubtitle.style.display = 'none';
36482
+ this.tfrSizeRecommendationError.style.display = 'block';
36481
36483
  this.tfrSizeRecommendationError.innerHTML = error;
36482
36484
  }
36483
36485
  init(sizeRecMainDivId) {
@@ -36489,6 +36491,8 @@ class SizeRecComponent {
36489
36491
  this.bindEvents();
36490
36492
  }
36491
36493
  setElements() {
36494
+ this.tfrSizeRecTitle = document.getElementById('tfr-size-rec-title');
36495
+ this.tfrSizeRecSubtitle = document.getElementById('tfr-size-rec-subtitle');
36492
36496
  this.tfrSizeRecActionLogin = document.getElementById('tfr-size-rec-action-login');
36493
36497
  this.tfrSizeRecActionLogout = document.getElementById('tfr-size-rec-action-logout');
36494
36498
  this.tfrSizeRecTable = document.getElementById('tfr-size-rec-table');
@@ -36568,12 +36572,12 @@ class SizeRecComponent {
36568
36572
  </div>
36569
36573
  </div>
36570
36574
  <div id="tfr-size-recommendations-container">
36571
- <img id="tfr-size-rec-login-svg" src="{{ 'login-icon.svg' | asset_url }}" />
36575
+ <img id="tfr-size-rec-login-svg" src="${loginIconSrc}" />
36572
36576
  <div id="tfr-size-rec-title">
36573
36577
  Recommended Size:
36574
36578
  <div id="tfr-size-rec-size">
36575
36579
  <div class="tfr-size-rec-login-cta">
36576
- <img src="{{ 'login-icon.svg' | asset_url }}" /> Login to view
36580
+ <img src="${loginIconSrc}" /> Login to view
36577
36581
  </div>
36578
36582
  </div>
36579
36583
  </div>
@@ -36595,7 +36599,8 @@ class SizeRecComponent {
36595
36599
  <div class="tfr-powered-by-text-bold">The Fitting Room</div>
36596
36600
  </div>
36597
36601
  </div>
36598
- </div>`;
36602
+ </div>
36603
+ <div id="tfr-size-recommendation-error"></div>`;
36599
36604
  sizeRecMainDiv.innerHTML = body;
36600
36605
  }
36601
36606
  }
@@ -36605,7 +36610,7 @@ class TfrSizeRec {
36605
36610
  this.tfrShop = tfrShop;
36606
36611
  this.onSignInClick = onSignInClick;
36607
36612
  this.onSignOutClick = onSignOutClick;
36608
- this.sizeRecComponent = new SizeRecComponent(sizeRecMainDivId, this.tfrShop, this.onSignInClick, this.onSignOutClick);
36613
+ this.sizeRecComponent = new SizeRecComponent(sizeRecMainDivId, this.onSignInClick, this.onSignOutClick);
36609
36614
  }
36610
36615
  get sku() {
36611
36616
  return this.sizeRecComponent.sku;
@@ -36620,15 +36625,18 @@ class TfrSizeRec {
36620
36625
  this.sizeRecComponent.setLoading(true);
36621
36626
  const locations = await this.getGarmentLocations();
36622
36627
  if (!locations)
36623
- return;
36628
+ return this.sizeRecComponent.setLoading(false);
36624
36629
  this.sizeRecComponent.setGarmentLocations(locations);
36625
36630
  this.sizeRecComponent.setLoading(false);
36626
36631
  }
36627
36632
  async setRecommendedSize() {
36628
36633
  this.sizeRecComponent.setLoading(true);
36629
36634
  const sizes = await this.getRecommenedSize();
36630
- if (!sizes)
36635
+ if (!sizes) {
36636
+ this.sizeRecComponent.setLoading(false);
36637
+ this.sizeRecComponent.setError('No recommended size found.');
36631
36638
  return;
36639
+ }
36632
36640
  this.sizeRecComponent.setRecommendedSize(sizes);
36633
36641
  this.sizeRecComponent.setLoading(false);
36634
36642
  }
@@ -36638,7 +36646,7 @@ class TfrSizeRec {
36638
36646
  return locations;
36639
36647
  }
36640
36648
  catch (error) {
36641
- this.sizeRecComponent.setError(error.message);
36649
+ this.sizeRecComponent.setError(error.message || error.error);
36642
36650
  return null;
36643
36651
  }
36644
36652
  }
@@ -36649,7 +36657,7 @@ class TfrSizeRec {
36649
36657
  return sizes;
36650
36658
  }
36651
36659
  catch (error) {
36652
- this.sizeRecComponent.setError(error.message);
36660
+ this.sizeRecComponent.setError(error.message || error.error);
36653
36661
  return null;
36654
36662
  }
36655
36663
  }