@thefittingroom/shop-ui 0.0.5 → 0.0.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.
- package/dist/esm/index.js +34 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -3
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.
|
|
2
|
+
* thefittingroom v0.0.7 (2023-07-19T19:26:21.510Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
6
|
-
* thefittingroom v0.0.
|
|
6
|
+
* thefittingroom v0.0.8 (2023-07-19T17:34:22.852Z)
|
|
7
7
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -22728,6 +22728,12 @@ function getAuth(app = getApp()) {
|
|
|
22728
22728
|
}
|
|
22729
22729
|
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
22730
22730
|
|
|
22731
|
+
class AvatarNotCreatedError extends Error {
|
|
22732
|
+
constructor() {
|
|
22733
|
+
super('Avatar not created');
|
|
22734
|
+
this.name = 'AvatarNotCreatedError';
|
|
22735
|
+
}
|
|
22736
|
+
}
|
|
22731
22737
|
class NoFramesFoundError extends Error {
|
|
22732
22738
|
constructor() {
|
|
22733
22739
|
super('no frames found');
|
|
@@ -22766,15 +22772,19 @@ class RecommendedAvailableSizesError extends Error {
|
|
|
22766
22772
|
this.available_sizes = available_sizes;
|
|
22767
22773
|
}
|
|
22768
22774
|
}
|
|
22775
|
+
// Backend responses
|
|
22776
|
+
const AvatarNotCreated = 'avatar not created';
|
|
22769
22777
|
|
|
22770
22778
|
var errors = /*#__PURE__*/Object.freeze({
|
|
22771
22779
|
__proto__: null,
|
|
22780
|
+
AvatarNotCreatedError: AvatarNotCreatedError,
|
|
22772
22781
|
NoFramesFoundError: NoFramesFoundError,
|
|
22773
22782
|
RequestTimeoutError: RequestTimeoutError,
|
|
22774
22783
|
UserNotLoggedInError: UserNotLoggedInError,
|
|
22775
22784
|
NoColorwaySizeAssetsFoundError: NoColorwaySizeAssetsFoundError,
|
|
22776
22785
|
NoStylesFoundError: NoStylesFoundError,
|
|
22777
|
-
RecommendedAvailableSizesError: RecommendedAvailableSizesError
|
|
22786
|
+
RecommendedAvailableSizesError: RecommendedAvailableSizesError,
|
|
22787
|
+
AvatarNotCreated: AvatarNotCreated
|
|
22778
22788
|
});
|
|
22779
22789
|
|
|
22780
22790
|
class FirebaseUser {
|
|
@@ -22990,9 +23000,16 @@ class TfrShop {
|
|
|
22990
23000
|
async getRecommendedSizes(brandStyleId) {
|
|
22991
23001
|
if (!this.isLoggedIn)
|
|
22992
23002
|
throw new UserNotLoggedInError();
|
|
22993
|
-
|
|
22994
|
-
|
|
22995
|
-
|
|
23003
|
+
try {
|
|
23004
|
+
const res = await Fetcher.Get(this.user, `/styles/${brandStyleId}/recommendation`);
|
|
23005
|
+
const json = await res.json();
|
|
23006
|
+
return json;
|
|
23007
|
+
}
|
|
23008
|
+
catch (error) {
|
|
23009
|
+
if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)
|
|
23010
|
+
throw new AvatarNotCreatedError();
|
|
23011
|
+
throw error;
|
|
23012
|
+
}
|
|
22996
23013
|
}
|
|
22997
23014
|
async getStyles(ids, skus) {
|
|
22998
23015
|
const constraints = [rl('brand_id', '==', this.brandId)];
|
|
@@ -23038,6 +23055,8 @@ class TfrShop {
|
|
|
23038
23055
|
return this.awaitColorwaySizeAssetFrames(colorwaySizeAssetSku);
|
|
23039
23056
|
}
|
|
23040
23057
|
catch (error) {
|
|
23058
|
+
if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)
|
|
23059
|
+
throw new AvatarNotCreatedError();
|
|
23041
23060
|
if (!error.recommended_size_id)
|
|
23042
23061
|
throw new Error(error);
|
|
23043
23062
|
const errorOutsideRecommended = error;
|
|
@@ -36212,9 +36231,15 @@ class FittingRoom {
|
|
|
36212
36231
|
return validationError(L.EmailError);
|
|
36213
36232
|
if (!validatePassword(password))
|
|
36214
36233
|
return validationError(L.PasswordError);
|
|
36215
|
-
|
|
36234
|
+
try {
|
|
36235
|
+
await this.tfrShop.user.login(username, password);
|
|
36236
|
+
}
|
|
36237
|
+
catch (e) {
|
|
36238
|
+
return validationError(L.UsernameOrPasswordIncorrect);
|
|
36239
|
+
}
|
|
36216
36240
|
if (this.hooks.onLogin)
|
|
36217
36241
|
this.hooks.onLogin();
|
|
36242
|
+
this.nav.close();
|
|
36218
36243
|
try {
|
|
36219
36244
|
const userProfile = await this.tfrShop.user.getUserProfile();
|
|
36220
36245
|
switch (userProfile.avatar_status) {
|
|
@@ -36265,6 +36290,8 @@ class FittingRoom {
|
|
|
36265
36290
|
this.hooks.onAvatarReady(frames);
|
|
36266
36291
|
}
|
|
36267
36292
|
catch (error) {
|
|
36293
|
+
if (error instanceof errors.AvatarNotCreatedError)
|
|
36294
|
+
return this.nav.onError(L.DontHaveAvatar);
|
|
36268
36295
|
if (error instanceof errors.RecommendedAvailableSizesError)
|
|
36269
36296
|
return this.nav.onSizeError(error.recommended_size, error.available_sizes);
|
|
36270
36297
|
if (error instanceof errors.UserNotLoggedInError)
|