@thefittingroom/shop-ui 0.0.8 → 0.0.9
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 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +28 -28
- package/dist/esm/tfr.d.ts +1 -0
- 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.9 (2023-07-26T23:20:29.878Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
6
|
-
* thefittingroom v0.0.
|
|
6
|
+
* thefittingroom v0.0.9 (2023-07-26T23:07:17.052Z)
|
|
7
7
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -22997,11 +22997,11 @@ class TfrShop {
|
|
|
22997
22997
|
const userProfile = snapshot.docs[0].data();
|
|
22998
22998
|
return userProfile.avatar_status === 'CREATED';
|
|
22999
22999
|
}
|
|
23000
|
-
async getRecommendedSizes(
|
|
23000
|
+
async getRecommendedSizes(styleId) {
|
|
23001
23001
|
if (!this.isLoggedIn)
|
|
23002
23002
|
throw new UserNotLoggedInError();
|
|
23003
23003
|
try {
|
|
23004
|
-
const res = await Fetcher.Get(this.user, `/styles/${
|
|
23004
|
+
const res = await Fetcher.Get(this.user, `/styles/${styleId}/recommendation`);
|
|
23005
23005
|
const json = await res.json();
|
|
23006
23006
|
return json;
|
|
23007
23007
|
}
|
|
@@ -23011,6 +23011,12 @@ class TfrShop {
|
|
|
23011
23011
|
throw error;
|
|
23012
23012
|
}
|
|
23013
23013
|
}
|
|
23014
|
+
async getRecommendedSizesLabels(styleId) {
|
|
23015
|
+
const sizeRecommendation = await this.getRecommendedSizes(styleId);
|
|
23016
|
+
const recommendedSizeLabel = sizeRecommendation.recommended_sizes.label || sizeRecommendation.recommended_sizes.size_value.size;
|
|
23017
|
+
const availableSizeLabels = sizeRecommendation.available_sizes.map((size) => size.label || size.size_value.size);
|
|
23018
|
+
return { recommendedSizeLabel, availableSizeLabels };
|
|
23019
|
+
}
|
|
23014
23020
|
async getStyles(ids, skus) {
|
|
23015
23021
|
const constraints = [rl('brand_id', '==', this.brandId)];
|
|
23016
23022
|
if ((ids === null || ids === void 0 ? void 0 : ids.length) > 0)
|
|
@@ -36280,6 +36286,15 @@ class FittingRoom {
|
|
|
36280
36286
|
await this.tfrShop.user.confirmPasswordReset(code, newPassword);
|
|
36281
36287
|
this.nav.toPasswordReset();
|
|
36282
36288
|
}
|
|
36289
|
+
async getRecommendedSizeString(styleId) {
|
|
36290
|
+
const res = await this.tfrShop.getRecommendedSizesLabels(styleId);
|
|
36291
|
+
const { availableSizeLabels, recommendedSizeLabel } = res;
|
|
36292
|
+
const firstSizes = availableSizeLabels.slice(0, -1);
|
|
36293
|
+
const lastSize = availableSizeLabels.slice(-1);
|
|
36294
|
+
const tryFirstSizes = `${L.TrySize} ${firstSizes.join(', ')}`;
|
|
36295
|
+
const trySizes = availableSizeLabels.length > 1 ? `${tryFirstSizes} ${L.Or} ${lastSize}` : tryFirstSizes;
|
|
36296
|
+
return `${trySizes} ${L.WeRecommendSize} ${recommendedSizeLabel}`;
|
|
36297
|
+
}
|
|
36283
36298
|
async tryOn() {
|
|
36284
36299
|
try {
|
|
36285
36300
|
if (this.hooks.onLoading)
|