@thefittingroom/shop-ui 0.0.14 → 0.0.15
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 +19 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -3
- package/index.html +1 -1
- 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.15 (2023-07-31T23:30:09.543Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
6
|
-
* thefittingroom v0.0.
|
|
6
|
+
* thefittingroom v0.0.10 (2023-07-31T23:26:47.153Z)
|
|
7
7
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -22828,8 +22828,8 @@ class FirebaseUser {
|
|
|
22828
22828
|
const q = sl(Ta(this.firestore, 'users'), rl(Eh(), '==', this.id));
|
|
22829
22829
|
const cancel = setTimeout(() => unsub(), timeout);
|
|
22830
22830
|
return new Promise((resolve) => {
|
|
22831
|
-
unsub = jl(q, (snapshot) => {
|
|
22832
|
-
if (!predicate(snapshot))
|
|
22831
|
+
unsub = jl(q, async (snapshot) => {
|
|
22832
|
+
if (!(await predicate(snapshot)))
|
|
22833
22833
|
return;
|
|
22834
22834
|
clearTimeout(cancel);
|
|
22835
22835
|
unsub();
|
|
@@ -22945,7 +22945,7 @@ class Fetcher {
|
|
|
22945
22945
|
}
|
|
22946
22946
|
}
|
|
22947
22947
|
|
|
22948
|
-
const
|
|
22948
|
+
const testImage = (url) => {
|
|
22949
22949
|
const img = new Image();
|
|
22950
22950
|
img.src = url;
|
|
22951
22951
|
return new Promise((resolve) => {
|
|
@@ -23045,7 +23045,13 @@ class TfrShop {
|
|
|
23045
23045
|
var _a, _b, _c, _d;
|
|
23046
23046
|
if (!this.isLoggedIn)
|
|
23047
23047
|
throw new UserNotLoggedInError();
|
|
23048
|
-
const predicate = (data) => {
|
|
23048
|
+
const predicate = async (data) => {
|
|
23049
|
+
var _a, _b, _c, _d;
|
|
23050
|
+
const frames = (_d = (_c = (_b = (_a = data.docs[0].data()) === null || _a === void 0 ? void 0 : _a.vto) === null || _b === void 0 ? void 0 : _b[this.brandId]) === null || _c === void 0 ? void 0 : _c[colorwaySizeAssetSKU]) === null || _d === void 0 ? void 0 : _d.frames;
|
|
23051
|
+
if (!(frames === null || frames === void 0 ? void 0 : frames.length))
|
|
23052
|
+
return false;
|
|
23053
|
+
return testImage(frames[0]);
|
|
23054
|
+
};
|
|
23049
23055
|
const userProfile = (await this.user.watchUserProfileForChanges(predicate, TfrShop.vtoTimeout));
|
|
23050
23056
|
if (!((_d = (_c = (_b = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.vto) === null || _a === void 0 ? void 0 : _a[this.brandId]) === null || _b === void 0 ? void 0 : _b[colorwaySizeAssetSKU]) === null || _c === void 0 ? void 0 : _c.frames) === null || _d === void 0 ? void 0 : _d.length))
|
|
23051
23057
|
throw new NoFramesFoundError();
|
|
@@ -23114,7 +23120,7 @@ class TfrShop {
|
|
|
23114
23120
|
const frames = ((_c = (_b = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.vto) === null || _a === void 0 ? void 0 : _a[this.brandId]) === null || _b === void 0 ? void 0 : _b[colorwaySizeAssetSKU]) === null || _c === void 0 ? void 0 : _c.frames) || [];
|
|
23115
23121
|
if (!frames.length)
|
|
23116
23122
|
throw new NoFramesFoundError();
|
|
23117
|
-
const testedImage = await
|
|
23123
|
+
const testedImage = await testImage(frames[0]);
|
|
23118
23124
|
if (!testedImage)
|
|
23119
23125
|
throw new NoFramesFoundError();
|
|
23120
23126
|
return frames;
|
|
@@ -36302,6 +36308,8 @@ class FittingRoom {
|
|
|
36302
36308
|
return `${trySizes}. ${L.WeRecommendSize} ${recommendedSizeLabel}.`;
|
|
36303
36309
|
}
|
|
36304
36310
|
async tryOn() {
|
|
36311
|
+
if (!this.shop.isLoggedIn)
|
|
36312
|
+
return this.nav.toScan();
|
|
36305
36313
|
try {
|
|
36306
36314
|
if (this.hooks.onLoading)
|
|
36307
36315
|
this.hooks.onLoading();
|
|
@@ -36315,8 +36323,11 @@ class FittingRoom {
|
|
|
36315
36323
|
return this.nav.onError(L.DontHaveAvatar);
|
|
36316
36324
|
if (error instanceof errors.RecommendedAvailableSizesError)
|
|
36317
36325
|
return this.nav.onSizeError(error.recommended_size, error.available_sizes);
|
|
36318
|
-
if (error instanceof errors.UserNotLoggedInError)
|
|
36326
|
+
if (error instanceof errors.UserNotLoggedInError) {
|
|
36327
|
+
if (this.hooks.onLoadingComplete)
|
|
36328
|
+
this.hooks.onLoadingComplete();
|
|
36319
36329
|
return this.nav.toScan();
|
|
36330
|
+
}
|
|
36320
36331
|
console.error(error.message);
|
|
36321
36332
|
this.nav.onError(L.SomethingWentWrong);
|
|
36322
36333
|
}
|