@thefittingroom/sdk 1.2.1 → 1.2.2
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/shop.d.ts +2 -0
- package/dist/esm/index.js +24 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +37 -37
- package/dist/esm/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/api/shop.d.ts
CHANGED
|
@@ -12,7 +12,9 @@ export declare class TfrShop {
|
|
|
12
12
|
getRecommendedSizes(styleId: string): Promise<SizeRecommendation>;
|
|
13
13
|
submitTelephoneNumber(tel: string): Promise<void>;
|
|
14
14
|
getColorwaySizeAssetFromSku(colorwaySizeAssetSku: string): Promise<types.FirestoreColorwaySizeAsset>;
|
|
15
|
+
getColorwaySizeAssetFromBrandStyleId(brandStyleId: number): Promise<types.FirestoreColorwaySizeAsset>;
|
|
15
16
|
getMeasurementLocationsFromSku(sku: string, filledLocations?: string[]): Promise<string[]>;
|
|
17
|
+
getMeasurementLocationsFromBrandStyleId(brandStyleId: number, filledLocations?: string[]): Promise<string[]>;
|
|
16
18
|
getStyleByBrandStyleId(brandStyleId: string): Promise<types.FirestoreStyleCategory>;
|
|
17
19
|
private getColorwaySizeAssets;
|
|
18
20
|
getStyle(styleId: number): Promise<types.FirestoreStyleCategory>;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.2.
|
|
2
|
+
* thefittingroom v1.2.2 (2024-07-02T15:28:01.417Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
// Code generated by tygo. DO NOT EDIT.
|
|
@@ -22964,6 +22964,12 @@ class TfrShop {
|
|
|
22964
22964
|
throw new NoColorwaySizeAssetsFoundError();
|
|
22965
22965
|
return Array.from(assets.values())[0];
|
|
22966
22966
|
}
|
|
22967
|
+
async getColorwaySizeAssetFromBrandStyleId(brandStyleId) {
|
|
22968
|
+
const assets = await this.getColorwaySizeAssets(brandStyleId);
|
|
22969
|
+
if (!(assets === null || assets === void 0 ? void 0 : assets.size))
|
|
22970
|
+
throw new NoColorwaySizeAssetsFoundError();
|
|
22971
|
+
return Array.from(assets.values())[0];
|
|
22972
|
+
}
|
|
22967
22973
|
async getMeasurementLocationsFromSku(sku, filledLocations = []) {
|
|
22968
22974
|
const asset = await this.getColorwaySizeAssetFromSku(sku);
|
|
22969
22975
|
if (!asset)
|
|
@@ -22981,6 +22987,23 @@ class TfrShop {
|
|
|
22981
22987
|
return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
|
|
22982
22988
|
});
|
|
22983
22989
|
}
|
|
22990
|
+
async getMeasurementLocationsFromBrandStyleId(brandStyleId, filledLocations = []) {
|
|
22991
|
+
const asset = await this.getColorwaySizeAssetFromBrandStyleId(brandStyleId);
|
|
22992
|
+
if (!asset)
|
|
22993
|
+
throw new Error('No colorway size asset found for brand style id');
|
|
22994
|
+
const styleCategory = await this.getStyle(asset.style_id);
|
|
22995
|
+
if (!styleCategory)
|
|
22996
|
+
throw new Error('Style category not found for style id');
|
|
22997
|
+
const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);
|
|
22998
|
+
if (!taxonomy)
|
|
22999
|
+
throw new Error('Taxonomy not found for style garment category id');
|
|
23000
|
+
const filteredLocations = !filledLocations.length
|
|
23001
|
+
? taxonomy.garment_measurement_locations.female
|
|
23002
|
+
: taxonomy.garment_measurement_locations.female.filter((location) => filledLocations.includes(location));
|
|
23003
|
+
return filteredLocations.map((location) => {
|
|
23004
|
+
return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
|
|
23005
|
+
});
|
|
23006
|
+
}
|
|
22984
23007
|
async getStyleByBrandStyleId(brandStyleId) {
|
|
22985
23008
|
var _a, _b;
|
|
22986
23009
|
try {
|