@thefittingroom/sdk 1.0.0 → 1.0.1

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.
@@ -1,3 +1,4 @@
1
+ import { Fit, MeasurementLocation } from '../types/measurement';
1
2
  export interface BodyMeasurement {
2
3
  id: number;
3
4
  position: number;
@@ -65,9 +66,18 @@ export interface SizeRecommendationIDs {
65
66
  recommended_size_id: number;
66
67
  available_size_ids: number[];
67
68
  }
69
+ export interface MeasurementLocationFits {
70
+ measurement_location: MeasurementLocation;
71
+ fit: Fit[];
72
+ }
73
+ export interface Fits {
74
+ size_id: number;
75
+ measurement_location_fits: MeasurementLocationFits[];
76
+ }
68
77
  export interface SizeRecommendation {
69
- recommended_sizes: Size;
78
+ recommended_size: Size;
70
79
  available_sizes: Size[];
80
+ fits: Fits[];
71
81
  }
72
82
  export interface GarmentMeasurement {
73
83
  id: number;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v0.0.14 (2024-02-15T22:20:33.087Z)
2
+ * thefittingroom v1.0.1 (2024-02-16T14:45:03.763Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  // Code generated by tygo. DO NOT EDIT.
@@ -8,8 +8,6 @@ var requests = /*#__PURE__*/Object.freeze({
8
8
  __proto__: null
9
9
  });
10
10
 
11
- // Code generated by tygo. DO NOT EDIT.
12
-
13
11
  var responses = /*#__PURE__*/Object.freeze({
14
12
  __proto__: null
15
13
  });
@@ -23181,6 +23179,25 @@ const Taxonomy = {
23181
23179
  ["tank_tops_and_camisoles" /* Subcategory.TANK_TOPS_AND_CAMISOLES */]: Classification.T_SHIRTS_AND_TANKS,
23182
23180
  },
23183
23181
  };
23182
+ var Fit;
23183
+ (function (Fit) {
23184
+ Fit["TOO_TIGHT"] = "too_tight";
23185
+ Fit["TIGHT"] = "tight";
23186
+ Fit["SLIGHTLY_TIGHT"] = "slightly_tight";
23187
+ Fit["PERFECT_FIT"] = "perfect_fit";
23188
+ Fit["SLIGHTLY_LOOSE"] = "slightly_loose";
23189
+ Fit["LOOSE"] = "loose";
23190
+ Fit["OVERSIZED"] = "oversized";
23191
+ })(Fit || (Fit = {}));
23192
+ ({
23193
+ [Fit.TOO_TIGHT]: 'Too Tight',
23194
+ [Fit.TIGHT]: 'Tight',
23195
+ [Fit.SLIGHTLY_TIGHT]: 'Slightly Tight',
23196
+ [Fit.PERFECT_FIT]: 'Perfect Fit',
23197
+ [Fit.SLIGHTLY_LOOSE]: 'Slightly Loose',
23198
+ [Fit.LOOSE]: 'Loose',
23199
+ [Fit.OVERSIZED]: 'Oversized',
23200
+ });
23184
23201
 
23185
23202
  class Fetcher {
23186
23203
  static get endpoint() {
@@ -23234,7 +23251,6 @@ class TfrShop {
23234
23251
  constructor(brandId, firebase) {
23235
23252
  this.brandId = brandId;
23236
23253
  this.firebase = firebase;
23237
- Config.getInstance().config;
23238
23254
  }
23239
23255
  get user() {
23240
23256
  return this.firebase.user;
@@ -23246,12 +23262,15 @@ class TfrShop {
23246
23262
  return this.firebase.onInit();
23247
23263
  }
23248
23264
  async getRecommendedSizes(styleId) {
23265
+ var _a, _b;
23249
23266
  if (!this.isLoggedIn)
23250
23267
  throw new UserNotLoggedInError();
23251
23268
  try {
23252
23269
  const res = await Fetcher.Get(this.user, `/styles/${styleId}/recommendation`);
23253
- const json = await res.json();
23254
- return json;
23270
+ const data = (await res.json());
23271
+ if (!((_a = data === null || data === void 0 ? void 0 : data.fits) === null || _a === void 0 ? void 0 : _a.length) || !((_b = data === null || data === void 0 ? void 0 : data.recommended_size) === null || _b === void 0 ? void 0 : _b.id))
23272
+ return null;
23273
+ return data;
23255
23274
  }
23256
23275
  catch (error) {
23257
23276
  if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)