@thefittingroom/shop-ui 4.3.3 → 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
@@ -20423,7 +20423,7 @@ class FittingRoomAPI {
20423
20423
  return cachedAsset;
20424
20424
  }
20425
20425
  }
20426
- console.debug("using firestore colorwaySizeAsset for sku:", colorwaySizeAssetSku);
20426
+ console.debug("colorwaySizeAsset sku not found in cache:", colorwaySizeAssetSku, Array.from(this.cachedColorwaySizeAssets.keys()));
20427
20427
  const constraints = [
20428
20428
  where("brand_id", "==", this.BrandID),
20429
20429
  where("sku", "==", colorwaySizeAssetSku)
@@ -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";
@@ -21887,7 +21885,7 @@ class SizeRecommendationController {
21887
21885
  ShowTryOnButton() {
21888
21886
  this.sizeRecComponent.showTryOnButton();
21889
21887
  }
21890
- HideTryOnButton(message) {
21888
+ DisableTryOnButton(message) {
21891
21889
  this.sizeRecComponent.disableTryOnButton(message);
21892
21890
  }
21893
21891
  EnableTryOnButton() {
@@ -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);
@@ -22104,6 +22103,7 @@ class FittingRoomController {
22104
22103
  this.SizeRecommendationController.Hide();
22105
22104
  throw e;
22106
22105
  }
22106
+ this.SizeRecommendationController.Show();
22107
22107
  this.SizeRecommendationController.ShowTryOnButton();
22108
22108
  }
22109
22109
  close() {
@@ -22176,7 +22176,8 @@ class FittingRoomController {
22176
22176
  await this.cacheColorwaySizeAssetsPromise;
22177
22177
  }
22178
22178
  this.SizeRecommendationController.SetVTOLoading(true);
22179
- console.log("tryOnCallback", selectedSizeID, availableSizeIDs);
22179
+ console.debug("tryOnCallback", selectedSizeID, availableSizeIDs, "sizeRecSelect");
22180
+ console.debug("forceFreshVTO", this.hasInitializedTryOn, this.noCacheOnRetry, fromSizeRecSelect);
22180
22181
  this.forceFreshVTO = !fromSizeRecSelect && this.hasInitializedTryOn && this.noCacheOnRetry;
22181
22182
  const allCachedAssets = this.API.GetCachedColorwaySizeAssets();
22182
22183
  const selectedAsset = allCachedAssets.find(
@@ -22189,6 +22190,7 @@ class FittingRoomController {
22189
22190
  const availableAssets = allCachedAssets.filter(
22190
22191
  (asset) => availableSizeIDs.includes(asset.size_id) && asset.colorway_id === this.selectedColorwaySizeAsset.colorway_id
22191
22192
  );
22193
+ console.debug("availableAssets", availableAssets);
22192
22194
  const availableColorwaySizeAssetSKUs = availableAssets.map((asset) => asset.sku);
22193
22195
  const batchResult = await this.API.PriorityTryOnWithMultiRequestCache(
22194
22196
  this.firestoreUserController,
@@ -20427,7 +20427,7 @@ This typically indicates that your device does not have a healthy Internet conne
20427
20427
  return cachedAsset;
20428
20428
  }
20429
20429
  }
20430
- console.debug("using firestore colorwaySizeAsset for sku:", colorwaySizeAssetSku);
20430
+ console.debug("colorwaySizeAsset sku not found in cache:", colorwaySizeAssetSku, Array.from(this.cachedColorwaySizeAssets.keys()));
20431
20431
  const constraints = [
20432
20432
  where("brand_id", "==", this.BrandID),
20433
20433
  where("sku", "==", colorwaySizeAssetSku)
@@ -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";
@@ -21891,7 +21889,7 @@ This typically indicates that your device does not have a healthy Internet conne
21891
21889
  ShowTryOnButton() {
21892
21890
  this.sizeRecComponent.showTryOnButton();
21893
21891
  }
21894
- HideTryOnButton(message) {
21892
+ DisableTryOnButton(message) {
21895
21893
  this.sizeRecComponent.disableTryOnButton(message);
21896
21894
  }
21897
21895
  EnableTryOnButton() {
@@ -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);
@@ -22108,6 +22107,7 @@ This typically indicates that your device does not have a healthy Internet conne
22108
22107
  this.SizeRecommendationController.Hide();
22109
22108
  throw e;
22110
22109
  }
22110
+ this.SizeRecommendationController.Show();
22111
22111
  this.SizeRecommendationController.ShowTryOnButton();
22112
22112
  }
22113
22113
  close() {
@@ -22180,7 +22180,8 @@ This typically indicates that your device does not have a healthy Internet conne
22180
22180
  await this.cacheColorwaySizeAssetsPromise;
22181
22181
  }
22182
22182
  this.SizeRecommendationController.SetVTOLoading(true);
22183
- console.log("tryOnCallback", selectedSizeID, availableSizeIDs);
22183
+ console.debug("tryOnCallback", selectedSizeID, availableSizeIDs, "sizeRecSelect");
22184
+ console.debug("forceFreshVTO", this.hasInitializedTryOn, this.noCacheOnRetry, fromSizeRecSelect);
22184
22185
  this.forceFreshVTO = !fromSizeRecSelect && this.hasInitializedTryOn && this.noCacheOnRetry;
22185
22186
  const allCachedAssets = this.API.GetCachedColorwaySizeAssets();
22186
22187
  const selectedAsset = allCachedAssets.find(
@@ -22193,6 +22194,7 @@ This typically indicates that your device does not have a healthy Internet conne
22193
22194
  const availableAssets = allCachedAssets.filter(
22194
22195
  (asset) => availableSizeIDs.includes(asset.size_id) && asset.colorway_id === this.selectedColorwaySizeAsset.colorway_id
22195
22196
  );
22197
+ console.debug("availableAssets", availableAssets);
22196
22198
  const availableColorwaySizeAssetSKUs = availableAssets.map((asset) => asset.sku);
22197
22199
  const batchResult = await this.API.PriorityTryOnWithMultiRequestCache(
22198
22200
  this.firestoreUserController,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",