@thefittingroom/sdk 0.0.7 → 0.0.8

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.
@@ -6,6 +6,9 @@ export interface ErrorOutsideRecommendedSizes {
6
6
  recommended_size_id: number;
7
7
  available_size_ids: number[];
8
8
  }
9
+ export declare class AvatarNotCreatedError extends Error {
10
+ constructor();
11
+ }
9
12
  export declare class NoFramesFoundError extends Error {
10
13
  constructor();
11
14
  }
@@ -26,3 +29,4 @@ export declare class RecommendedAvailableSizesError extends Error {
26
29
  available_sizes: string[];
27
30
  constructor(recommended_size: string, available_sizes: string[]);
28
31
  }
32
+ export declare const AvatarNotCreated = "avatar not created";
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v0.0.7 (2023-07-19T15:29:31.094Z)
2
+ * thefittingroom v0.0.8 (2023-07-19T17:34:22.852Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  /**
@@ -22724,6 +22724,12 @@ function getAuth(app = getApp()) {
22724
22724
  }
22725
22725
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
22726
22726
 
22727
+ class AvatarNotCreatedError extends Error {
22728
+ constructor() {
22729
+ super('Avatar not created');
22730
+ this.name = 'AvatarNotCreatedError';
22731
+ }
22732
+ }
22727
22733
  class NoFramesFoundError extends Error {
22728
22734
  constructor() {
22729
22735
  super('no frames found');
@@ -22762,15 +22768,19 @@ class RecommendedAvailableSizesError extends Error {
22762
22768
  this.available_sizes = available_sizes;
22763
22769
  }
22764
22770
  }
22771
+ // Backend responses
22772
+ const AvatarNotCreated = 'avatar not created';
22765
22773
 
22766
22774
  var errors = /*#__PURE__*/Object.freeze({
22767
22775
  __proto__: null,
22776
+ AvatarNotCreatedError: AvatarNotCreatedError,
22768
22777
  NoFramesFoundError: NoFramesFoundError,
22769
22778
  RequestTimeoutError: RequestTimeoutError,
22770
22779
  UserNotLoggedInError: UserNotLoggedInError,
22771
22780
  NoColorwaySizeAssetsFoundError: NoColorwaySizeAssetsFoundError,
22772
22781
  NoStylesFoundError: NoStylesFoundError,
22773
- RecommendedAvailableSizesError: RecommendedAvailableSizesError
22782
+ RecommendedAvailableSizesError: RecommendedAvailableSizesError,
22783
+ AvatarNotCreated: AvatarNotCreated
22774
22784
  });
22775
22785
 
22776
22786
  class FirebaseUser {
@@ -22986,9 +22996,16 @@ class TfrShop {
22986
22996
  async getRecommendedSizes(brandStyleId) {
22987
22997
  if (!this.isLoggedIn)
22988
22998
  throw new UserNotLoggedInError();
22989
- const res = await Fetcher.Get(this.user, `/styles/${brandStyleId}/recommendation`);
22990
- const json = await res.json();
22991
- return json;
22999
+ try {
23000
+ const res = await Fetcher.Get(this.user, `/styles/${brandStyleId}/recommendation`);
23001
+ const json = await res.json();
23002
+ return json;
23003
+ }
23004
+ catch (error) {
23005
+ if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)
23006
+ throw new AvatarNotCreatedError();
23007
+ throw error;
23008
+ }
22992
23009
  }
22993
23010
  async getStyles(ids, skus) {
22994
23011
  const constraints = [rl('brand_id', '==', this.brandId)];
@@ -23034,6 +23051,8 @@ class TfrShop {
23034
23051
  return this.awaitColorwaySizeAssetFrames(colorwaySizeAssetSku);
23035
23052
  }
23036
23053
  catch (error) {
23054
+ if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)
23055
+ throw new AvatarNotCreatedError();
23037
23056
  if (!error.recommended_size_id)
23038
23057
  throw new Error(error);
23039
23058
  const errorOutsideRecommended = error;