@thefittingroom/sdk 0.0.9 → 0.0.10
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/api/utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const testImage: (url: string) => Promise<boolean>;
|
|
@@ -11,7 +11,7 @@ export declare class FirebaseUser {
|
|
|
11
11
|
setUser(user: firebaseAuth.User): void;
|
|
12
12
|
getToken(): Promise<string>;
|
|
13
13
|
getUserProfile(): Promise<DocumentData>;
|
|
14
|
-
watchUserProfileForChanges(predicate: (data: QuerySnapshot<DocumentData>) => boolean
|
|
14
|
+
watchUserProfileForChanges(predicate: (data: QuerySnapshot<DocumentData>) => Promise<boolean>, timeout: number): Promise<DocumentData>;
|
|
15
15
|
login(username: string, password: string): Promise<void>;
|
|
16
16
|
logout(): Promise<void>;
|
|
17
17
|
sendPasswordResetEmail(email: string): Promise<void>;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.
|
|
2
|
+
* thefittingroom v0.0.10 (2023-07-31T23:26:47.153Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -22824,8 +22824,8 @@ class FirebaseUser {
|
|
|
22824
22824
|
const q = sl(Ta(this.firestore, 'users'), rl(Eh(), '==', this.id));
|
|
22825
22825
|
const cancel = setTimeout(() => unsub(), timeout);
|
|
22826
22826
|
return new Promise((resolve) => {
|
|
22827
|
-
unsub = jl(q, (snapshot) => {
|
|
22828
|
-
if (!predicate(snapshot))
|
|
22827
|
+
unsub = jl(q, async (snapshot) => {
|
|
22828
|
+
if (!(await predicate(snapshot)))
|
|
22829
22829
|
return;
|
|
22830
22830
|
clearTimeout(cancel);
|
|
22831
22831
|
unsub();
|
|
@@ -22941,7 +22941,7 @@ class Fetcher {
|
|
|
22941
22941
|
}
|
|
22942
22942
|
}
|
|
22943
22943
|
|
|
22944
|
-
const
|
|
22944
|
+
const testImage = (url) => {
|
|
22945
22945
|
const img = new Image();
|
|
22946
22946
|
img.src = url;
|
|
22947
22947
|
return new Promise((resolve) => {
|
|
@@ -23041,7 +23041,13 @@ class TfrShop {
|
|
|
23041
23041
|
var _a, _b, _c, _d;
|
|
23042
23042
|
if (!this.isLoggedIn)
|
|
23043
23043
|
throw new UserNotLoggedInError();
|
|
23044
|
-
const predicate = (data) => {
|
|
23044
|
+
const predicate = async (data) => {
|
|
23045
|
+
var _a, _b, _c, _d;
|
|
23046
|
+
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;
|
|
23047
|
+
if (!(frames === null || frames === void 0 ? void 0 : frames.length))
|
|
23048
|
+
return false;
|
|
23049
|
+
return testImage(frames[0]);
|
|
23050
|
+
};
|
|
23045
23051
|
const userProfile = (await this.user.watchUserProfileForChanges(predicate, TfrShop.vtoTimeout));
|
|
23046
23052
|
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))
|
|
23047
23053
|
throw new NoFramesFoundError();
|
|
@@ -23110,7 +23116,7 @@ class TfrShop {
|
|
|
23110
23116
|
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) || [];
|
|
23111
23117
|
if (!frames.length)
|
|
23112
23118
|
throw new NoFramesFoundError();
|
|
23113
|
-
const testedImage = await
|
|
23119
|
+
const testedImage = await testImage(frames[0]);
|
|
23114
23120
|
if (!testedImage)
|
|
23115
23121
|
throw new NoFramesFoundError();
|
|
23116
23122
|
return frames;
|