@thefittingroom/shop-ui 4.3.2 → 4.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/dist/index.js CHANGED
@@ -20605,12 +20605,22 @@ class FittingRoomAPI {
20605
20605
  }
20606
20606
  console.debug("checking user for vto frames", colorwaySizeAssetSKU);
20607
20607
  const firestoreUser = data;
20608
- const frames2 = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20609
- if (!frames2?.length) {
20608
+ const colorwaySizeAssetEntry = firestoreUser.vto?.[this.BrandID]?.[colorwaySizeAssetSKU];
20609
+ if (!colorwaySizeAssetEntry) {
20610
+ console.debug("no vto entry for SKU, continue watching:", colorwaySizeAssetSKU);
20611
+ return false;
20612
+ }
20613
+ if (colorwaySizeAssetEntry.error) {
20614
+ console.error("VTO error found for SKU:", colorwaySizeAssetSKU, colorwaySizeAssetEntry.error);
20610
20615
  throw NoFramesFoundError;
20611
20616
  }
20612
- console.debug("testing first frame for SKU:", colorwaySizeAssetSKU, frames2[0]);
20613
- const tested = await testImage(frames2[0]);
20617
+ console.debug("cololrwaySizeAssetEntry", colorwaySizeAssetEntry);
20618
+ const frames = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20619
+ if (!frames?.length) {
20620
+ throw NoFramesFoundError;
20621
+ }
20622
+ console.debug("testing first frame for SKU:", colorwaySizeAssetSKU, frames[0]);
20623
+ const tested = await testImage(frames[0]);
20614
20624
  if (!tested) {
20615
20625
  console.error("image test failed for SKU:", colorwaySizeAssetSKU);
20616
20626
  throw NoFramesFoundError;
@@ -20641,12 +20651,12 @@ class FittingRoomAPI {
20641
20651
  console.error(`Error watching for try-on frames for SKU: ${colorwaySizeAssetSKU}`, error);
20642
20652
  throw error;
20643
20653
  }
20644
- const frames2 = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20645
- if (!frames2) {
20654
+ const frames = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20655
+ if (!frames) {
20646
20656
  console.error(`Frames not found on final user object for SKU: ${colorwaySizeAssetSKU}`, firestoreUser);
20647
20657
  throw NoFramesFoundError;
20648
20658
  }
20649
- return frames2;
20659
+ return frames;
20650
20660
  }
20651
20661
  async GetCachedOrRequestUserColorwaySizeAssetFrames(firestoreUserController, colorwaySizeAssetSKU, skipCache) {
20652
20662
  console.debug("GetCachedOrRequestUserColorwaySizeAssetFrames", colorwaySizeAssetSKU, "skipCache:", skipCache);
@@ -20683,7 +20693,6 @@ class FittingRoomAPI {
20683
20693
  framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20684
20694
  }
20685
20695
  this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20686
- console.debug("retrieved frames", frames);
20687
20696
  return await framesPromise;
20688
20697
  }
20689
20698
  }
@@ -21338,10 +21347,10 @@ class TFRModal {
21338
21347
  }
21339
21348
  toPasswordReset() {
21340
21349
  }
21341
- onTryOn(frames2) {
21350
+ onTryOn(frames) {
21342
21351
  this.manager.open(
21343
21352
  TryOnModal({
21344
- frames: frames2,
21353
+ frames,
21345
21354
  onClose: () => this.close(),
21346
21355
  onNavBack: () => this.navBack()
21347
21356
  })
@@ -21479,6 +21488,17 @@ class SizeRecComponent {
21479
21488
  this.tfrTryOnButton.classList.remove("loading");
21480
21489
  }
21481
21490
  }
21491
+ ShowSizeRecommendationError(message) {
21492
+ console.debug("ShowSizeRecommendationError", message);
21493
+ this.tfrSizeRecommendationError.innerHTML = message;
21494
+ this.tfrSizeRecommendationError.classList.remove("hide");
21495
+ this.tfrSizeRecommendationsContainer.classList.add("hide");
21496
+ }
21497
+ HideSizeRecommendationError() {
21498
+ console.debug("HideSizeRecommendationError");
21499
+ this.tfrSizeRecommendationError.classList.add("hide");
21500
+ this.tfrSizeRecommendationsContainer.classList.remove("hide");
21501
+ }
21482
21502
  SetStyleMeasurementLocations(garmentMeasurementLocations) {
21483
21503
  if (!garmentMeasurementLocations || !garmentMeasurementLocations.length) {
21484
21504
  this.tfrSizeRecTitle.classList.add("hide");
@@ -21502,6 +21522,9 @@ class SizeRecComponent {
21502
21522
  showTryOnButton() {
21503
21523
  this.tfrTryOnButton.classList.remove("hide");
21504
21524
  }
21525
+ hideTryOnButton() {
21526
+ this.tfrTryOnButton.classList.add("hide");
21527
+ }
21505
21528
  disableTryOnButton(message) {
21506
21529
  this.tfrTryOnButton.disabled = true;
21507
21530
  this.tfrTryOnButton.title = message;
@@ -21611,7 +21634,8 @@ class SizeRecComponent {
21611
21634
  }
21612
21635
  renderSizeRec(sizeMeasurementLocationFits) {
21613
21636
  const selectedSizeIndex = sizeMeasurementLocationFits.findIndex((size) => size.isRecommended);
21614
- const selectedSizeLabel = sizeMeasurementLocationFits[selectedSizeIndex].label;
21637
+ const selectedSize = sizeMeasurementLocationFits[selectedSizeIndex];
21638
+ const selectedSizeLabel = selectedSize.label || selectedSize.size_value?.name || selectedSize.id;
21615
21639
  this.tfrSizeRecSize.innerHTML = ` ${selectedSizeLabel}`;
21616
21640
  this.availableSizes = sizeMeasurementLocationFits;
21617
21641
  this.redraw = (index) => this.renderSizeRecTable(sizeMeasurementLocationFits, index);
@@ -21624,7 +21648,7 @@ class SizeRecComponent {
21624
21648
  }
21625
21649
  renderSizeRecSelect(sizeMeasurementLocationFits, index) {
21626
21650
  const html = sizeMeasurementLocationFits.map(
21627
- (size, i) => `<div class="tfr-size-rec-select-button ${i === index ? "active" : ""}" data-index="${i}">${size.label}</div>`
21651
+ (size, i) => `<div class="tfr-size-rec-select-button ${i === index ? "active" : ""}" data-index="${i}">${size.label || size.size_value?.name || size.id}</div>`
21628
21652
  ).join("");
21629
21653
  this.tfrSizeRecSelect.innerHTML = html;
21630
21654
  }
@@ -21793,7 +21817,7 @@ class SizeRecommendationController {
21793
21817
  );
21794
21818
  }
21795
21819
  setLoggedOutStyleMeasurementLocations(garmentMeasurementLocations = []) {
21796
- if (garmentMeasurementLocations.length == 0) {
21820
+ if (garmentMeasurementLocations.length === 0) {
21797
21821
  throw new Error("filteredLocations passed to setGarmentLocations is 0");
21798
21822
  }
21799
21823
  console.debug("filledLocations", garmentMeasurementLocations);
@@ -21810,7 +21834,14 @@ class SizeRecommendationController {
21810
21834
  try {
21811
21835
  this.Show();
21812
21836
  this.SetSizeRecommendationLoading(true);
21813
- const sizeFitRecommendation = await this.fittingRoomAPI.GetRecommendedSizes(styleId);
21837
+ this.sizeFitRecommendationPromise = this.fittingRoomAPI.GetRecommendedSizes(styleId);
21838
+ const sizeFitRecommendation = await this.sizeFitRecommendationPromise;
21839
+ if (!sizeFitRecommendation?.recommended_size) {
21840
+ this.sizeRecComponent.ShowLoggedIn();
21841
+ this.sizeRecComponent.Show();
21842
+ this.sizeRecComponent.ShowSizeRecommendationError("No sizes were recommended.");
21843
+ return;
21844
+ }
21814
21845
  const sizeMeasurementLocationFits = sizeFitRecommendation.available_sizes.map((size) => {
21815
21846
  const sizeMeasurementLocationFit = {
21816
21847
  isRecommended: size.id === sizeFitRecommendation.recommended_size.id,
@@ -21830,6 +21861,7 @@ class SizeRecommendationController {
21830
21861
  }).sort((a, b) => (a.size_value?.id || 0) - (b.size_value?.id || 0));
21831
21862
  this.sizeRecComponent.ShowLoggedIn();
21832
21863
  this.sizeRecComponent.Show();
21864
+ this.sizeRecComponent.HideSizeRecommendationError();
21833
21865
  this.sizeRecComponent.SetRecommendedSize(sizeMeasurementLocationFits);
21834
21866
  } catch (e) {
21835
21867
  console.error("error in get size recommendation", e);
@@ -21869,6 +21901,9 @@ class SizeRecommendationController {
21869
21901
  console.debug("SetVTOLoading", isLoading);
21870
21902
  this.sizeRecComponent.SetVTOLoading(isLoading);
21871
21903
  }
21904
+ CurrentSizeRecommendation() {
21905
+ return this.sizeFitRecommendationPromise;
21906
+ }
21872
21907
  setCssVariables(sizeRecMainDiv, cssVariables) {
21873
21908
  const toKebabCase = (str) => str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
21874
21909
  for (const [key, value] of Object.entries(cssVariables)) {
@@ -21917,21 +21952,21 @@ class VTOController {
21917
21952
  this.sliderElement = null;
21918
21953
  this.isShown = false;
21919
21954
  }
21920
- onNewFramesReady(frames2) {
21921
- console.debug("onNewFramesReady", frames2);
21955
+ onNewFramesReady(frames) {
21956
+ console.debug("onNewFramesReady", frames);
21922
21957
  if (!this.isShown) {
21923
21958
  this.show();
21924
21959
  }
21925
- if (Array.isArray(frames2) && frames2.length > 0) {
21926
- const boundedValue = Math.min(this.currentSliderValue, frames2.length - 1);
21927
- const e = this.slider.Load(frames2, boundedValue);
21960
+ if (Array.isArray(frames) && frames.length > 0) {
21961
+ const boundedValue = Math.min(this.currentSliderValue, frames.length - 1);
21962
+ const e = this.slider.Load(frames, boundedValue);
21928
21963
  if (e instanceof Error) {
21929
21964
  console.error(e);
21930
21965
  return;
21931
21966
  }
21932
- if (this.sliderElement && this.currentSliderValue < frames2.length) {
21967
+ if (this.sliderElement && this.currentSliderValue < frames.length) {
21933
21968
  this.sliderElement.value = this.currentSliderValue.toString();
21934
- this.tryOnImage.src = frames2[this.currentSliderValue];
21969
+ this.tryOnImage.src = frames[this.currentSliderValue];
21935
21970
  }
21936
21971
  }
21937
21972
  }
@@ -22044,14 +22079,25 @@ class FittingRoomController {
22044
22079
  }
22045
22080
  }
22046
22081
  async SetColorwaySizeAssetBySKU(activeSku, skipCache = false) {
22082
+ if (!this.style?.is_vto) {
22083
+ console.warn("skipping SetColorwaySizeAssetBySKU due to disabled vto");
22084
+ return;
22085
+ }
22047
22086
  if (this.cacheColorwaySizeAssetsPromise) {
22048
22087
  await this.cacheColorwaySizeAssetsPromise;
22049
22088
  }
22050
- console.debug("SetColorwaySizeAssetBySKU", activeSku, skipCache);
22051
- if (!this.style?.is_vto) {
22052
- console.warn("skipping SetColorwaySizeAssetBySKU due to disabled vto");
22089
+ const currentSizeRec = this.SizeRecommendationController.CurrentSizeRecommendation();
22090
+ if (!currentSizeRec) {
22091
+ console.warn("skipping SetColorwaySizeAssetBySKU due to no size recommendation promise");
22053
22092
  return;
22054
22093
  }
22094
+ const sizeFitRecommendation = await currentSizeRec;
22095
+ console.debug("SetColorwaySizeAssetBySKU: SizeFitRecommendation", sizeFitRecommendation);
22096
+ if (!sizeFitRecommendation?.recommended_size?.id) {
22097
+ console.warn("skipping SetColorwaySizeAssetBySKU due to no size recommendation");
22098
+ return;
22099
+ }
22100
+ console.debug("SetColorwaySizeAssetBySKU", activeSku, skipCache);
22055
22101
  try {
22056
22102
  this.selectedColorwaySizeAsset = await this.API.GetCachedColorwaySizeAssetFromSku(activeSku, skipCache);
22057
22103
  } catch (e) {
@@ -22185,7 +22231,7 @@ class FittingRoomController {
22185
22231
  case AvatarStatusPending:
22186
22232
  if (this.hooks?.onLoading) this.hooks.onLoading();
22187
22233
  console.log("calling DisableTryOnButton - avatar not ready");
22188
- this.SizeRecommendationController.HideTryOnButton("Your avatar is not ready yet");
22234
+ this.SizeRecommendationController.DisableTryOnButton("Your avatar is not ready yet");
22189
22235
  break;
22190
22236
  case AvatarStatusCreated:
22191
22237
  if (this.hooks?.onLoadingComplete) this.hooks.onLoadingComplete();
@@ -22194,7 +22240,7 @@ class FittingRoomController {
22194
22240
  break;
22195
22241
  default:
22196
22242
  console.log("calling DisableTryOnButton - fitting room unavailable");
22197
- this.SizeRecommendationController.HideTryOnButton("The Fitting Room is currently unavailable.");
22243
+ this.SizeRecommendationController.DisableTryOnButton("The Fitting Room is currently unavailable.");
22198
22244
  throw new Error("no avatar status");
22199
22245
  }
22200
22246
  }
@@ -20609,12 +20609,22 @@ This typically indicates that your device does not have a healthy Internet conne
20609
20609
  }
20610
20610
  console.debug("checking user for vto frames", colorwaySizeAssetSKU);
20611
20611
  const firestoreUser = data;
20612
- const frames2 = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20613
- if (!frames2?.length) {
20612
+ const colorwaySizeAssetEntry = firestoreUser.vto?.[this.BrandID]?.[colorwaySizeAssetSKU];
20613
+ if (!colorwaySizeAssetEntry) {
20614
+ console.debug("no vto entry for SKU, continue watching:", colorwaySizeAssetSKU);
20615
+ return false;
20616
+ }
20617
+ if (colorwaySizeAssetEntry.error) {
20618
+ console.error("VTO error found for SKU:", colorwaySizeAssetSKU, colorwaySizeAssetEntry.error);
20614
20619
  throw NoFramesFoundError;
20615
20620
  }
20616
- console.debug("testing first frame for SKU:", colorwaySizeAssetSKU, frames2[0]);
20617
- const tested = await testImage(frames2[0]);
20621
+ console.debug("cololrwaySizeAssetEntry", colorwaySizeAssetEntry);
20622
+ const frames = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20623
+ if (!frames?.length) {
20624
+ throw NoFramesFoundError;
20625
+ }
20626
+ console.debug("testing first frame for SKU:", colorwaySizeAssetSKU, frames[0]);
20627
+ const tested = await testImage(frames[0]);
20618
20628
  if (!tested) {
20619
20629
  console.error("image test failed for SKU:", colorwaySizeAssetSKU);
20620
20630
  throw NoFramesFoundError;
@@ -20645,12 +20655,12 @@ This typically indicates that your device does not have a healthy Internet conne
20645
20655
  console.error(`Error watching for try-on frames for SKU: ${colorwaySizeAssetSKU}`, error);
20646
20656
  throw error;
20647
20657
  }
20648
- const frames2 = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20649
- if (!frames2) {
20658
+ const frames = this.getVTOFramesFromUser(firestoreUser, colorwaySizeAssetSKU);
20659
+ if (!frames) {
20650
20660
  console.error(`Frames not found on final user object for SKU: ${colorwaySizeAssetSKU}`, firestoreUser);
20651
20661
  throw NoFramesFoundError;
20652
20662
  }
20653
- return frames2;
20663
+ return frames;
20654
20664
  }
20655
20665
  async GetCachedOrRequestUserColorwaySizeAssetFrames(firestoreUserController, colorwaySizeAssetSKU, skipCache) {
20656
20666
  console.debug("GetCachedOrRequestUserColorwaySizeAssetFrames", colorwaySizeAssetSKU, "skipCache:", skipCache);
@@ -20687,7 +20697,6 @@ This typically indicates that your device does not have a healthy Internet conne
20687
20697
  framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20688
20698
  }
20689
20699
  this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20690
- console.debug("retrieved frames", frames);
20691
20700
  return await framesPromise;
20692
20701
  }
20693
20702
  }
@@ -21342,10 +21351,10 @@ This typically indicates that your device does not have a healthy Internet conne
21342
21351
  }
21343
21352
  toPasswordReset() {
21344
21353
  }
21345
- onTryOn(frames2) {
21354
+ onTryOn(frames) {
21346
21355
  this.manager.open(
21347
21356
  TryOnModal({
21348
- frames: frames2,
21357
+ frames,
21349
21358
  onClose: () => this.close(),
21350
21359
  onNavBack: () => this.navBack()
21351
21360
  })
@@ -21483,6 +21492,17 @@ This typically indicates that your device does not have a healthy Internet conne
21483
21492
  this.tfrTryOnButton.classList.remove("loading");
21484
21493
  }
21485
21494
  }
21495
+ ShowSizeRecommendationError(message) {
21496
+ console.debug("ShowSizeRecommendationError", message);
21497
+ this.tfrSizeRecommendationError.innerHTML = message;
21498
+ this.tfrSizeRecommendationError.classList.remove("hide");
21499
+ this.tfrSizeRecommendationsContainer.classList.add("hide");
21500
+ }
21501
+ HideSizeRecommendationError() {
21502
+ console.debug("HideSizeRecommendationError");
21503
+ this.tfrSizeRecommendationError.classList.add("hide");
21504
+ this.tfrSizeRecommendationsContainer.classList.remove("hide");
21505
+ }
21486
21506
  SetStyleMeasurementLocations(garmentMeasurementLocations) {
21487
21507
  if (!garmentMeasurementLocations || !garmentMeasurementLocations.length) {
21488
21508
  this.tfrSizeRecTitle.classList.add("hide");
@@ -21506,6 +21526,9 @@ This typically indicates that your device does not have a healthy Internet conne
21506
21526
  showTryOnButton() {
21507
21527
  this.tfrTryOnButton.classList.remove("hide");
21508
21528
  }
21529
+ hideTryOnButton() {
21530
+ this.tfrTryOnButton.classList.add("hide");
21531
+ }
21509
21532
  disableTryOnButton(message) {
21510
21533
  this.tfrTryOnButton.disabled = true;
21511
21534
  this.tfrTryOnButton.title = message;
@@ -21615,7 +21638,8 @@ This typically indicates that your device does not have a healthy Internet conne
21615
21638
  }
21616
21639
  renderSizeRec(sizeMeasurementLocationFits) {
21617
21640
  const selectedSizeIndex = sizeMeasurementLocationFits.findIndex((size) => size.isRecommended);
21618
- const selectedSizeLabel = sizeMeasurementLocationFits[selectedSizeIndex].label;
21641
+ const selectedSize = sizeMeasurementLocationFits[selectedSizeIndex];
21642
+ const selectedSizeLabel = selectedSize.label || selectedSize.size_value?.name || selectedSize.id;
21619
21643
  this.tfrSizeRecSize.innerHTML = `&nbsp;${selectedSizeLabel}`;
21620
21644
  this.availableSizes = sizeMeasurementLocationFits;
21621
21645
  this.redraw = (index) => this.renderSizeRecTable(sizeMeasurementLocationFits, index);
@@ -21628,7 +21652,7 @@ This typically indicates that your device does not have a healthy Internet conne
21628
21652
  }
21629
21653
  renderSizeRecSelect(sizeMeasurementLocationFits, index) {
21630
21654
  const html = sizeMeasurementLocationFits.map(
21631
- (size, i) => `<div class="tfr-size-rec-select-button ${i === index ? "active" : ""}" data-index="${i}">${size.label}</div>`
21655
+ (size, i) => `<div class="tfr-size-rec-select-button ${i === index ? "active" : ""}" data-index="${i}">${size.label || size.size_value?.name || size.id}</div>`
21632
21656
  ).join("");
21633
21657
  this.tfrSizeRecSelect.innerHTML = html;
21634
21658
  }
@@ -21797,7 +21821,7 @@ This typically indicates that your device does not have a healthy Internet conne
21797
21821
  );
21798
21822
  }
21799
21823
  setLoggedOutStyleMeasurementLocations(garmentMeasurementLocations = []) {
21800
- if (garmentMeasurementLocations.length == 0) {
21824
+ if (garmentMeasurementLocations.length === 0) {
21801
21825
  throw new Error("filteredLocations passed to setGarmentLocations is 0");
21802
21826
  }
21803
21827
  console.debug("filledLocations", garmentMeasurementLocations);
@@ -21814,7 +21838,14 @@ This typically indicates that your device does not have a healthy Internet conne
21814
21838
  try {
21815
21839
  this.Show();
21816
21840
  this.SetSizeRecommendationLoading(true);
21817
- const sizeFitRecommendation = await this.fittingRoomAPI.GetRecommendedSizes(styleId);
21841
+ this.sizeFitRecommendationPromise = this.fittingRoomAPI.GetRecommendedSizes(styleId);
21842
+ const sizeFitRecommendation = await this.sizeFitRecommendationPromise;
21843
+ if (!sizeFitRecommendation?.recommended_size) {
21844
+ this.sizeRecComponent.ShowLoggedIn();
21845
+ this.sizeRecComponent.Show();
21846
+ this.sizeRecComponent.ShowSizeRecommendationError("No sizes were recommended.");
21847
+ return;
21848
+ }
21818
21849
  const sizeMeasurementLocationFits = sizeFitRecommendation.available_sizes.map((size) => {
21819
21850
  const sizeMeasurementLocationFit = {
21820
21851
  isRecommended: size.id === sizeFitRecommendation.recommended_size.id,
@@ -21834,6 +21865,7 @@ This typically indicates that your device does not have a healthy Internet conne
21834
21865
  }).sort((a, b) => (a.size_value?.id || 0) - (b.size_value?.id || 0));
21835
21866
  this.sizeRecComponent.ShowLoggedIn();
21836
21867
  this.sizeRecComponent.Show();
21868
+ this.sizeRecComponent.HideSizeRecommendationError();
21837
21869
  this.sizeRecComponent.SetRecommendedSize(sizeMeasurementLocationFits);
21838
21870
  } catch (e) {
21839
21871
  console.error("error in get size recommendation", e);
@@ -21873,6 +21905,9 @@ This typically indicates that your device does not have a healthy Internet conne
21873
21905
  console.debug("SetVTOLoading", isLoading);
21874
21906
  this.sizeRecComponent.SetVTOLoading(isLoading);
21875
21907
  }
21908
+ CurrentSizeRecommendation() {
21909
+ return this.sizeFitRecommendationPromise;
21910
+ }
21876
21911
  setCssVariables(sizeRecMainDiv, cssVariables) {
21877
21912
  const toKebabCase = (str) => str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
21878
21913
  for (const [key, value] of Object.entries(cssVariables)) {
@@ -21921,21 +21956,21 @@ This typically indicates that your device does not have a healthy Internet conne
21921
21956
  this.sliderElement = null;
21922
21957
  this.isShown = false;
21923
21958
  }
21924
- onNewFramesReady(frames2) {
21925
- console.debug("onNewFramesReady", frames2);
21959
+ onNewFramesReady(frames) {
21960
+ console.debug("onNewFramesReady", frames);
21926
21961
  if (!this.isShown) {
21927
21962
  this.show();
21928
21963
  }
21929
- if (Array.isArray(frames2) && frames2.length > 0) {
21930
- const boundedValue = Math.min(this.currentSliderValue, frames2.length - 1);
21931
- const e = this.slider.Load(frames2, boundedValue);
21964
+ if (Array.isArray(frames) && frames.length > 0) {
21965
+ const boundedValue = Math.min(this.currentSliderValue, frames.length - 1);
21966
+ const e = this.slider.Load(frames, boundedValue);
21932
21967
  if (e instanceof Error) {
21933
21968
  console.error(e);
21934
21969
  return;
21935
21970
  }
21936
- if (this.sliderElement && this.currentSliderValue < frames2.length) {
21971
+ if (this.sliderElement && this.currentSliderValue < frames.length) {
21937
21972
  this.sliderElement.value = this.currentSliderValue.toString();
21938
- this.tryOnImage.src = frames2[this.currentSliderValue];
21973
+ this.tryOnImage.src = frames[this.currentSliderValue];
21939
21974
  }
21940
21975
  }
21941
21976
  }
@@ -22048,14 +22083,25 @@ This typically indicates that your device does not have a healthy Internet conne
22048
22083
  }
22049
22084
  }
22050
22085
  async SetColorwaySizeAssetBySKU(activeSku, skipCache = false) {
22086
+ if (!this.style?.is_vto) {
22087
+ console.warn("skipping SetColorwaySizeAssetBySKU due to disabled vto");
22088
+ return;
22089
+ }
22051
22090
  if (this.cacheColorwaySizeAssetsPromise) {
22052
22091
  await this.cacheColorwaySizeAssetsPromise;
22053
22092
  }
22054
- console.debug("SetColorwaySizeAssetBySKU", activeSku, skipCache);
22055
- if (!this.style?.is_vto) {
22056
- console.warn("skipping SetColorwaySizeAssetBySKU due to disabled vto");
22093
+ const currentSizeRec = this.SizeRecommendationController.CurrentSizeRecommendation();
22094
+ if (!currentSizeRec) {
22095
+ console.warn("skipping SetColorwaySizeAssetBySKU due to no size recommendation promise");
22057
22096
  return;
22058
22097
  }
22098
+ const sizeFitRecommendation = await currentSizeRec;
22099
+ console.debug("SetColorwaySizeAssetBySKU: SizeFitRecommendation", sizeFitRecommendation);
22100
+ if (!sizeFitRecommendation?.recommended_size?.id) {
22101
+ console.warn("skipping SetColorwaySizeAssetBySKU due to no size recommendation");
22102
+ return;
22103
+ }
22104
+ console.debug("SetColorwaySizeAssetBySKU", activeSku, skipCache);
22059
22105
  try {
22060
22106
  this.selectedColorwaySizeAsset = await this.API.GetCachedColorwaySizeAssetFromSku(activeSku, skipCache);
22061
22107
  } catch (e) {
@@ -22189,7 +22235,7 @@ This typically indicates that your device does not have a healthy Internet conne
22189
22235
  case AvatarStatusPending:
22190
22236
  if (this.hooks?.onLoading) this.hooks.onLoading();
22191
22237
  console.log("calling DisableTryOnButton - avatar not ready");
22192
- this.SizeRecommendationController.HideTryOnButton("Your avatar is not ready yet");
22238
+ this.SizeRecommendationController.DisableTryOnButton("Your avatar is not ready yet");
22193
22239
  break;
22194
22240
  case AvatarStatusCreated:
22195
22241
  if (this.hooks?.onLoadingComplete) this.hooks.onLoadingComplete();
@@ -22198,7 +22244,7 @@ This typically indicates that your device does not have a healthy Internet conne
22198
22244
  break;
22199
22245
  default:
22200
22246
  console.log("calling DisableTryOnButton - fitting room unavailable");
22201
- this.SizeRecommendationController.HideTryOnButton("The Fitting Room is currently unavailable.");
22247
+ this.SizeRecommendationController.DisableTryOnButton("The Fitting Room is currently unavailable.");
22202
22248
  throw new Error("no avatar status");
22203
22249
  }
22204
22250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",