@thefittingroom/sdk 1.0.0 → 1.0.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.
@@ -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.2 (2024-02-16T14:48:59.401Z)
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
  });
@@ -23091,6 +23089,89 @@ const ClassificationLocations = {
23091
23089
  MeasurementLocation.HIGH_HIP
23092
23090
  ],
23093
23091
  };
23092
+ const CategoryNames = {
23093
+ ["activewear" /* Category.ACTIVEWEAR */]: 'Active Wear',
23094
+ ["dresses" /* Category.DRESSES */]: 'Dresses',
23095
+ ["jackets_and_coats" /* Category.JACKETS_AND_COATS */]: 'Jackets and Coats',
23096
+ ["jeans" /* Category.JEANS */]: 'Jeans',
23097
+ ["jumpsuits_and_rompers" /* Category.JUMPSUITS_AND_ROMPERS */]: 'Jumpsuits and Rompers',
23098
+ ["pants_and_shorts" /* Category.PANTS_AND_SHORTS */]: 'Pants and Shorts',
23099
+ ["skirts" /* Category.SKIRTS */]: 'Skirts',
23100
+ ["suits_and_tailoring" /* Category.SUITS_AND_TAILORING */]: 'Suits and Tailoring',
23101
+ ["sweaters" /* Category.SWEATERS */]: 'Sweaters',
23102
+ ["tops" /* Category.TOPS */]: 'Tops',
23103
+ };
23104
+ const Categories = [
23105
+ "activewear" /* Category.ACTIVEWEAR */,
23106
+ "dresses" /* Category.DRESSES */,
23107
+ "jackets_and_coats" /* Category.JACKETS_AND_COATS */,
23108
+ "jeans" /* Category.JEANS */,
23109
+ "jumpsuits_and_rompers" /* Category.JUMPSUITS_AND_ROMPERS */,
23110
+ "pants_and_shorts" /* Category.PANTS_AND_SHORTS */,
23111
+ "skirts" /* Category.SKIRTS */,
23112
+ "suits_and_tailoring" /* Category.SUITS_AND_TAILORING */,
23113
+ "sweaters" /* Category.SWEATERS */,
23114
+ "tops" /* Category.TOPS */,
23115
+ ];
23116
+ const SubcategoryNames = {
23117
+ ["a_line" /* Subcategory.A_LINE */]: 'A Line',
23118
+ ["a_line_flared" /* Subcategory.A_LINE_FLARED */]: 'A Line Flared',
23119
+ ["blazers" /* Subcategory.BLAZERS */]: 'Blazers',
23120
+ ["bodycon" /* Subcategory.BODYCON */]: 'Bodycon',
23121
+ ["bodysuits" /* Subcategory.BODYSUITS */]: 'Bodysuits',
23122
+ ["boiler_suits" /* Subcategory.BOILER_SUITS */]: 'Boiler Suits',
23123
+ ["bootcut" /* Subcategory.BOOTCUT */]: 'Bootcut',
23124
+ ["cardigans" /* Subcategory.CARDIGANS */]: 'Cardigans',
23125
+ ["cigarette" /* Subcategory.CIGARETTE */]: 'Cigarette',
23126
+ ["corsets_and_bustiers" /* Subcategory.CORSETS_AND_BUSTIERS */]: 'Corsets and Bustiers',
23127
+ ["crewnecks" /* Subcategory.CREWNECKS */]: 'Crewnecks',
23128
+ ["culottes" /* Subcategory.CULOTTES */]: 'Culottes',
23129
+ ["denim" /* Subcategory.DENIM */]: 'Denim',
23130
+ ["denim_jackets" /* Subcategory.DENIM_JACKETS */]: 'Denim Jackets',
23131
+ ["denim_shorts" /* Subcategory.DENIM_SHORTS */]: 'Denim Shorts',
23132
+ ["fit_and_flare" /* Subcategory.FIT_AND_FLARE */]: 'Fit and Flare',
23133
+ ["flared" /* Subcategory.FLARED */]: 'Flared',
23134
+ ["hoodies_and_zipups" /* Subcategory.HOODIES_AND_ZIPUPS */]: 'Hoodies and Zipups',
23135
+ ["joggers" /* Subcategory.JOGGERS */]: 'Joggers',
23136
+ ["jumpsuits" /* Subcategory.JUMPSUITS */]: 'Jumpsuits',
23137
+ ["knit" /* Subcategory.KNIT */]: 'Knit',
23138
+ ["leggings" /* Subcategory.LEGGINGS */]: 'Leggings',
23139
+ ["mom" /* Subcategory.MOM */]: 'Mom',
23140
+ ["overalls" /* Subcategory.OVERALLS */]: 'Overalls',
23141
+ ["parkas" /* Subcategory.PARKAS */]: 'Parkas',
23142
+ ["peacoats" /* Subcategory.PEACOATS */]: 'Peacoats',
23143
+ ["pencil" /* Subcategory.PENCIL */]: 'Pencil',
23144
+ ["pleated" /* Subcategory.PLEATED */]: 'Pleated',
23145
+ ["polos" /* Subcategory.POLOS */]: 'Polos',
23146
+ ["puffer_jackets" /* Subcategory.PUFFER_JACKETS */]: 'Puffer Jackets',
23147
+ ["raincoats" /* Subcategory.RAINCOATS */]: 'Raincoats',
23148
+ ["relaxed" /* Subcategory.RELAXED */]: 'Relaxed',
23149
+ ["rompers" /* Subcategory.ROMPERS */]: 'Rompers',
23150
+ ["shackets" /* Subcategory.SHACKETS */]: 'Shackets',
23151
+ ["shirt" /* Subcategory.SHIRT */]: 'Shirt',
23152
+ ["shirts_and_blouses" /* Subcategory.SHIRTS_AND_BLOUSES */]: 'Shirts and Blouses',
23153
+ ["skater" /* Subcategory.SKATER */]: 'Skater',
23154
+ ["skinny" /* Subcategory.SKINNY */]: 'Skinny',
23155
+ ["slim" /* Subcategory.SLIM */]: 'Slim',
23156
+ ["slip" /* Subcategory.SLIP */]: 'Slip',
23157
+ ["sports_bras" /* Subcategory.SPORTS_BRAS */]: 'Sports Bras',
23158
+ ["straight" /* Subcategory.STRAIGHT */]: 'Straight',
23159
+ ["suit_jackets" /* Subcategory.SUIT_JACKETS */]: 'Suit Jackets',
23160
+ ["suit_skirts" /* Subcategory.SUIT_SKIRTS */]: 'Suit Skirts',
23161
+ ["suit_trousers" /* Subcategory.SUIT_TROUSERS */]: 'Suit Trousers',
23162
+ ["suit_vests" /* Subcategory.SUIT_VESTS */]: 'Suit Vests',
23163
+ ["sweatshirts" /* Subcategory.SWEATSHIRTS */]: 'Sweatshirts',
23164
+ ["t_shirts" /* Subcategory.T_SHIRTS */]: 'T-Shirts',
23165
+ ["tank_tops_and_camisoles" /* Subcategory.TANK_TOPS_AND_CAMISOLES */]: 'Tank Tops and Camisoles',
23166
+ ["tapered" /* Subcategory.TAPERED */]: 'Tapered',
23167
+ ["trench_coats" /* Subcategory.TRENCH_COATS */]: 'Trench Coats',
23168
+ ["trousers" /* Subcategory.TROUSERS */]: 'Trousers',
23169
+ ["turtlenecks" /* Subcategory.TURTLENECKS */]: 'Turtleneck',
23170
+ ["unitards" /* Subcategory.UNITARDS */]: 'Unitards',
23171
+ ["v_necks" /* Subcategory.V_NECKS */]: 'V-Necks',
23172
+ ["wide_leg" /* Subcategory.WIDE_LEG */]: 'Wide Leg',
23173
+ ["wrap" /* Subcategory.WRAP */]: 'Wrap',
23174
+ };
23094
23175
  const Taxonomy = {
23095
23176
  ["activewear" /* Category.ACTIVEWEAR */]: {
23096
23177
  ["leggings" /* Subcategory.LEGGINGS */]: Classification.PANTS,
@@ -23181,6 +23262,25 @@ const Taxonomy = {
23181
23262
  ["tank_tops_and_camisoles" /* Subcategory.TANK_TOPS_AND_CAMISOLES */]: Classification.T_SHIRTS_AND_TANKS,
23182
23263
  },
23183
23264
  };
23265
+ var Fit;
23266
+ (function (Fit) {
23267
+ Fit["TOO_TIGHT"] = "too_tight";
23268
+ Fit["TIGHT"] = "tight";
23269
+ Fit["SLIGHTLY_TIGHT"] = "slightly_tight";
23270
+ Fit["PERFECT_FIT"] = "perfect_fit";
23271
+ Fit["SLIGHTLY_LOOSE"] = "slightly_loose";
23272
+ Fit["LOOSE"] = "loose";
23273
+ Fit["OVERSIZED"] = "oversized";
23274
+ })(Fit || (Fit = {}));
23275
+ const FitNames = {
23276
+ [Fit.TOO_TIGHT]: 'Too Tight',
23277
+ [Fit.TIGHT]: 'Tight',
23278
+ [Fit.SLIGHTLY_TIGHT]: 'Slightly Tight',
23279
+ [Fit.PERFECT_FIT]: 'Perfect Fit',
23280
+ [Fit.SLIGHTLY_LOOSE]: 'Slightly Loose',
23281
+ [Fit.LOOSE]: 'Loose',
23282
+ [Fit.OVERSIZED]: 'Oversized',
23283
+ };
23184
23284
 
23185
23285
  class Fetcher {
23186
23286
  static get endpoint() {
@@ -23234,7 +23334,6 @@ class TfrShop {
23234
23334
  constructor(brandId, firebase) {
23235
23335
  this.brandId = brandId;
23236
23336
  this.firebase = firebase;
23237
- Config.getInstance().config;
23238
23337
  }
23239
23338
  get user() {
23240
23339
  return this.firebase.user;
@@ -23246,12 +23345,15 @@ class TfrShop {
23246
23345
  return this.firebase.onInit();
23247
23346
  }
23248
23347
  async getRecommendedSizes(styleId) {
23348
+ var _a, _b;
23249
23349
  if (!this.isLoggedIn)
23250
23350
  throw new UserNotLoggedInError();
23251
23351
  try {
23252
23352
  const res = await Fetcher.Get(this.user, `/styles/${styleId}/recommendation`);
23253
- const json = await res.json();
23254
- return json;
23353
+ const data = (await res.json());
23354
+ 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))
23355
+ return null;
23356
+ return data;
23255
23357
  }
23256
23358
  catch (error) {
23257
23359
  if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)
@@ -23324,7 +23426,17 @@ var AvatarState;
23324
23426
 
23325
23427
  var index = /*#__PURE__*/Object.freeze({
23326
23428
  __proto__: null,
23327
- get AvatarState () { return AvatarState; }
23429
+ get AvatarState () { return AvatarState; },
23430
+ get MeasurementLocation () { return MeasurementLocation; },
23431
+ MeasurementLocationName: MeasurementLocationName,
23432
+ get Classification () { return Classification; },
23433
+ ClassificationLocations: ClassificationLocations,
23434
+ CategoryNames: CategoryNames,
23435
+ Categories: Categories,
23436
+ SubcategoryNames: SubcategoryNames,
23437
+ Taxonomy: Taxonomy,
23438
+ get Fit () { return Fit; },
23439
+ FitNames: FitNames
23328
23440
  });
23329
23441
 
23330
23442
  export { errors as Errors, initShop, requests, responses, index as types };