@thefittingroom/shop-ui 3.0.0-alpha-6 → 3.0.0-alpha-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.
@@ -11,6 +11,7 @@ declare var L: {
11
11
  EnterPhoneNumber: string;
12
12
  FailedToLoadLocale: string;
13
13
  ForgotPasswordWithSymbol: string;
14
+ GetVirtualTryOnFramesErrorText: string;
14
15
  HaveAcc: string;
15
16
  Loading: string;
16
17
  LoadingAvatar: string;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v3.0.0-alpha-6 (2025-04-18T16:48:31.249Z)
2
+ * thefittingroom v3.0.0-alpha-7 (2025-04-18T19:07:37.264Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  function loadImageRecursive(imageURL, imageURLs) {
@@ -26651,6 +26651,7 @@ var L = {
26651
26651
  EnterPhoneNumber: 'Enter your number for download link',
26652
26652
  FailedToLoadLocale: 'Something went wrong when fetching another language.',
26653
26653
  ForgotPasswordWithSymbol: 'Forgot password?',
26654
+ GetVirtualTryOnFramesErrorText: 'The try-on request timed out. Please try again!',
26654
26655
  HaveAcc: 'Have an account? Sign in',
26655
26656
  Loading: 'Loading...',
26656
26657
  LoadingAvatar: 'Your avatar is loading...',
@@ -28118,14 +28119,26 @@ class FittingRoom {
28118
28119
  async onTryOnClick(styleId, sizeId, shouldDisplay = true) {
28119
28120
  if (!this.vtoComponent)
28120
28121
  return console.error('VtoComponent is not initialized');
28121
- const frames = await this.shop.tryOn(styleId, sizeId);
28122
- if (shouldDisplay) {
28123
- try {
28124
- this.vtoComponent.init();
28125
- this.vtoComponent.onNewFramesReady(frames);
28122
+ try {
28123
+ const frames = await this.shop.tryOn(styleId, sizeId);
28124
+ if (shouldDisplay) {
28125
+ try {
28126
+ this.vtoComponent.init();
28127
+ this.vtoComponent.onNewFramesReady(frames);
28128
+ }
28129
+ catch (e) {
28130
+ console.error('Error initializing VTO:', e);
28131
+ this.tfrModal.onError(L.SomethingWentWrong);
28132
+ }
28126
28133
  }
28127
- catch (e) {
28128
- console.error(e);
28134
+ }
28135
+ catch (error) {
28136
+ console.error('Error during try-on:', error);
28137
+ if (error instanceof Error && error.name === 'TimeoutError') {
28138
+ this.tfrModal.onError(L.GetVirtualTryOnFramesErrorText);
28139
+ }
28140
+ else {
28141
+ this.tfrModal.onError(L.SomethingWentWrong);
28129
28142
  }
28130
28143
  }
28131
28144
  }