@thefittingroom/shop-ui 4.3.4 → 4.3.5

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
@@ -20531,15 +20531,6 @@ class FittingRoomAPI {
20531
20531
  throw error;
20532
20532
  }
20533
20533
  }
20534
- const copyOfCache = /* @__PURE__ */ new Map();
20535
- for (const sku of skus) {
20536
- const asset = this.cachedColorwaySizeAssets.get(sku);
20537
- if (asset) {
20538
- copyOfCache.set(sku, asset);
20539
- } else {
20540
- console.error(`no colorway asset found for SKU: ${sku}`);
20541
- }
20542
- }
20543
20534
  return this.cachedColorwaySizeAssets;
20544
20535
  }
20545
20536
  async GetStyleGarmentCategory(styleId) {
@@ -20607,6 +20598,10 @@ class FittingRoomAPI {
20607
20598
  const firestoreUser = data;
20608
20599
  const colorwaySizeAssetEntry = firestoreUser.vto?.[this.BrandID]?.[colorwaySizeAssetSKU];
20609
20600
  if (!colorwaySizeAssetEntry) {
20601
+ if (!skipFullSnapshot) {
20602
+ console.debug("no vto entry for full snapshot");
20603
+ throw NoFramesFoundError;
20604
+ }
20610
20605
  console.debug("no vto entry for SKU, continue watching:", colorwaySizeAssetSKU);
20611
20606
  return false;
20612
20607
  }
@@ -20666,6 +20661,7 @@ class FittingRoomAPI {
20666
20661
  console.debug("returning cached frames", colorwaySizeAssetSKU);
20667
20662
  return await cached;
20668
20663
  }
20664
+ console.debug("no local cache for colorwaySizeAssetSKU", colorwaySizeAssetSKU);
20669
20665
  }
20670
20666
  const colorwaySizeAsset = this.cachedColorwaySizeAssets.get(colorwaySizeAssetSKU);
20671
20667
  if (!colorwaySizeAsset) {
@@ -20675,25 +20671,27 @@ class FittingRoomAPI {
20675
20671
  const colorwaySizeAssetID = colorwaySizeAsset.id;
20676
20672
  let framesPromise;
20677
20673
  try {
20678
- let skipFullSnapshot = false;
20679
- if (skipCache) {
20680
- console.debug("skipping cache, requesting fresh frames");
20681
- await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20682
- skipFullSnapshot = true;
20674
+ if (!skipCache) {
20675
+ framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, false);
20676
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20677
+ return await framesPromise;
20683
20678
  }
20684
- framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, skipFullSnapshot);
20685
- await framesPromise;
20679
+ console.debug("no remote cache, requesting fresh frames", colorwaySizeAssetSKU);
20680
+ await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20681
+ framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20682
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20683
+ return await framesPromise;
20686
20684
  } catch (error) {
20687
20685
  if (error != NoFramesFoundError) {
20688
20686
  throw error;
20689
20687
  }
20690
- console.debug(`No frames found for SKU: ${colorwaySizeAssetSKU}, attempting to request fresh frames`);
20688
+ console.debug(`catch: no frames found for SKU: ${colorwaySizeAssetSKU}, attempting to request fresh frames`);
20691
20689
  await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20692
- console.debug("waiting for new vto after refresh request");
20690
+ console.debug("catch: waiting for new vto after refresh request");
20693
20691
  framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20692
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20693
+ return await framesPromise;
20694
20694
  }
20695
- this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20696
- return await framesPromise;
20697
20695
  }
20698
20696
  }
20699
20697
  const AvatarStatusNotCreated = "NOT_CREATED";
@@ -22047,6 +22045,7 @@ class FittingRoomController {
22047
22045
  this.cacheColorwaySizeAssetsPromise = this.API.FetchColorwaySizeAssetsFromStyleId(style.id);
22048
22046
  console.debug("is_published", this.style.is_published);
22049
22047
  if (!this.style.is_published) {
22048
+ console.warn("hiding unpublished style");
22050
22049
  this.SizeRecommendationController.Hide();
22051
22050
  }
22052
22051
  this.styleMeasurementLocations = this.styleToGarmentMeasurementLocations(this.style);
@@ -22177,7 +22176,8 @@ class FittingRoomController {
22177
22176
  await this.cacheColorwaySizeAssetsPromise;
22178
22177
  }
22179
22178
  this.SizeRecommendationController.SetVTOLoading(true);
22180
- console.log("tryOnCallback", selectedSizeID, availableSizeIDs);
22179
+ console.debug("tryOnCallback", selectedSizeID, availableSizeIDs, "sizeRecSelect");
22180
+ console.debug("forceFreshVTO", this.hasInitializedTryOn, this.noCacheOnRetry, fromSizeRecSelect);
22181
22181
  this.forceFreshVTO = !fromSizeRecSelect && this.hasInitializedTryOn && this.noCacheOnRetry;
22182
22182
  const allCachedAssets = this.API.GetCachedColorwaySizeAssets();
22183
22183
  const selectedAsset = allCachedAssets.find(
@@ -20535,15 +20535,6 @@ This typically indicates that your device does not have a healthy Internet conne
20535
20535
  throw error;
20536
20536
  }
20537
20537
  }
20538
- const copyOfCache = /* @__PURE__ */ new Map();
20539
- for (const sku of skus) {
20540
- const asset = this.cachedColorwaySizeAssets.get(sku);
20541
- if (asset) {
20542
- copyOfCache.set(sku, asset);
20543
- } else {
20544
- console.error(`no colorway asset found for SKU: ${sku}`);
20545
- }
20546
- }
20547
20538
  return this.cachedColorwaySizeAssets;
20548
20539
  }
20549
20540
  async GetStyleGarmentCategory(styleId) {
@@ -20611,6 +20602,10 @@ This typically indicates that your device does not have a healthy Internet conne
20611
20602
  const firestoreUser = data;
20612
20603
  const colorwaySizeAssetEntry = firestoreUser.vto?.[this.BrandID]?.[colorwaySizeAssetSKU];
20613
20604
  if (!colorwaySizeAssetEntry) {
20605
+ if (!skipFullSnapshot) {
20606
+ console.debug("no vto entry for full snapshot");
20607
+ throw NoFramesFoundError;
20608
+ }
20614
20609
  console.debug("no vto entry for SKU, continue watching:", colorwaySizeAssetSKU);
20615
20610
  return false;
20616
20611
  }
@@ -20670,6 +20665,7 @@ This typically indicates that your device does not have a healthy Internet conne
20670
20665
  console.debug("returning cached frames", colorwaySizeAssetSKU);
20671
20666
  return await cached;
20672
20667
  }
20668
+ console.debug("no local cache for colorwaySizeAssetSKU", colorwaySizeAssetSKU);
20673
20669
  }
20674
20670
  const colorwaySizeAsset = this.cachedColorwaySizeAssets.get(colorwaySizeAssetSKU);
20675
20671
  if (!colorwaySizeAsset) {
@@ -20679,25 +20675,27 @@ This typically indicates that your device does not have a healthy Internet conne
20679
20675
  const colorwaySizeAssetID = colorwaySizeAsset.id;
20680
20676
  let framesPromise;
20681
20677
  try {
20682
- let skipFullSnapshot = false;
20683
- if (skipCache) {
20684
- console.debug("skipping cache, requesting fresh frames");
20685
- await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20686
- skipFullSnapshot = true;
20678
+ if (!skipCache) {
20679
+ framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, false);
20680
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20681
+ return await framesPromise;
20687
20682
  }
20688
- framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, skipFullSnapshot);
20689
- await framesPromise;
20683
+ console.debug("no remote cache, requesting fresh frames", colorwaySizeAssetSKU);
20684
+ await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20685
+ framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20686
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20687
+ return await framesPromise;
20690
20688
  } catch (error) {
20691
20689
  if (error != NoFramesFoundError) {
20692
20690
  throw error;
20693
20691
  }
20694
- console.debug(`No frames found for SKU: ${colorwaySizeAssetSKU}, attempting to request fresh frames`);
20692
+ console.debug(`catch: no frames found for SKU: ${colorwaySizeAssetSKU}, attempting to request fresh frames`);
20695
20693
  await this.requestColorwaySizeAssetFramesByID(colorwaySizeAssetID);
20696
- console.debug("waiting for new vto after refresh request");
20694
+ console.debug("catch: waiting for new vto after refresh request");
20697
20695
  framesPromise = this.watchForTryOnFrames(firestoreUserController, colorwaySizeAssetSKU, true);
20696
+ this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20697
+ return await framesPromise;
20698
20698
  }
20699
- this.vtoFramesPromiseCache.set(colorwaySizeAssetSKU, framesPromise);
20700
- return await framesPromise;
20701
20699
  }
20702
20700
  }
20703
20701
  const AvatarStatusNotCreated = "NOT_CREATED";
@@ -22051,6 +22049,7 @@ This typically indicates that your device does not have a healthy Internet conne
22051
22049
  this.cacheColorwaySizeAssetsPromise = this.API.FetchColorwaySizeAssetsFromStyleId(style.id);
22052
22050
  console.debug("is_published", this.style.is_published);
22053
22051
  if (!this.style.is_published) {
22052
+ console.warn("hiding unpublished style");
22054
22053
  this.SizeRecommendationController.Hide();
22055
22054
  }
22056
22055
  this.styleMeasurementLocations = this.styleToGarmentMeasurementLocations(this.style);
@@ -22181,7 +22180,8 @@ This typically indicates that your device does not have a healthy Internet conne
22181
22180
  await this.cacheColorwaySizeAssetsPromise;
22182
22181
  }
22183
22182
  this.SizeRecommendationController.SetVTOLoading(true);
22184
- console.log("tryOnCallback", selectedSizeID, availableSizeIDs);
22183
+ console.debug("tryOnCallback", selectedSizeID, availableSizeIDs, "sizeRecSelect");
22184
+ console.debug("forceFreshVTO", this.hasInitializedTryOn, this.noCacheOnRetry, fromSizeRecSelect);
22185
22185
  this.forceFreshVTO = !fromSizeRecSelect && this.hasInitializedTryOn && this.noCacheOnRetry;
22186
22186
  const allCachedAssets = this.API.GetCachedColorwaySizeAssets();
22187
22187
  const selectedAsset = allCachedAssets.find(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",