@thefittingroom/sdk 0.0.13 → 0.0.14

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.
@@ -18,9 +18,9 @@ export declare class TfrShop {
18
18
  availableSizeLabels: string[];
19
19
  }>;
20
20
  getStyles(ids: number[], skus: string[]): Promise<Map<number, types.FirestoreStyle>>;
21
+ getMeasurementLocationsByStyleId(styleId: number): Promise<any[]>;
21
22
  submitTelephoneNumber(tel: string): Promise<void>;
22
23
  getColorwaySizeAssetFromSku(colorwaySizeAssetSku: string): Promise<types.FirestoreColorwaySizeAsset>;
23
- _getColorwaySizeAssetFromSku(colorwaySizeAssetSku: string): Promise<types.FirestoreColorwaySizeAsset[]>;
24
24
  private awaitColorwaySizeAssetFrames;
25
25
  private requestThenGetColorwaySizeAssetFrames;
26
26
  private getColorwaySizeAssets;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v0.0.11 (2023-11-21T18:22:57.333Z)
2
+ * thefittingroom v0.0.14 (2024-02-15T17:46:47.656Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  /**
@@ -22904,6 +22904,96 @@ const getFirebaseError = (e) => {
22904
22904
 
22905
22905
  const asyncTry = (promise) => promise.then((data) => [null, data]).catch((error) => [error]);
22906
22906
 
22907
+ var MeasurementLocation;
22908
+ (function (MeasurementLocation) {
22909
+ MeasurementLocation["ACROSS_BACK"] = "across_back";
22910
+ MeasurementLocation["ACROSS_FRONT"] = "across_front";
22911
+ MeasurementLocation["ACROSS_SHOULDER"] = "across_shoulder";
22912
+ MeasurementLocation["ANKLE"] = "ankle";
22913
+ MeasurementLocation["ARMEYE"] = "arm_eye";
22914
+ MeasurementLocation["ARM_LENGTH_FROM_SHOULDER"] = "arm_length_from_shoulder";
22915
+ MeasurementLocation["BACK_CROTCH_LENGTH"] = "back_crotch_length";
22916
+ MeasurementLocation["BACK_NECK_TO_EBLOW"] = "back_neck_to_elbow";
22917
+ MeasurementLocation["BELOW_KNEE"] = "below_knee";
22918
+ MeasurementLocation["BICEP"] = "bicep";
22919
+ MeasurementLocation["BUST"] = "bust";
22920
+ MeasurementLocation["BUST_POINT_TO_BUST_POINT"] = "bust_point_to_bust_point";
22921
+ MeasurementLocation["CALF"] = "calf";
22922
+ MeasurementLocation["CB_NECK_TO_WAIST"] = "cb_neck_to_waist";
22923
+ MeasurementLocation["CB_NECK_TO_WRIST"] = "cb_neck_to_wrist";
22924
+ MeasurementLocation["CF_NECK_TO_WAIST"] = "cf_neck_to_waist";
22925
+ MeasurementLocation["ELBOW"] = "elbow";
22926
+ MeasurementLocation["FOREARM"] = "forearm";
22927
+ MeasurementLocation["FRONT_CROTCH_LENGTH"] = "front_crotch_length";
22928
+ MeasurementLocation["HIGH_HIP_PLACEMENT_FROM_WAIST"] = "high_hip_placement";
22929
+ MeasurementLocation["HIGH_HIP"] = "high_hip";
22930
+ MeasurementLocation["HSP_TO_ACROSS_BACK"] = "hsp_to_across_back";
22931
+ MeasurementLocation["HSP_TO_ACROSS_FRONT"] = "hsp_to_across_front";
22932
+ MeasurementLocation["HSP_TO_BUST_POINT"] = "hsp_to_bust_point";
22933
+ MeasurementLocation["HSP_TO_LOW_HIP_POSITION"] = "hsp_to_low_hip_position";
22934
+ MeasurementLocation["HSP_TO_WAIST_POSITION"] = "hsp_to_waist_position";
22935
+ MeasurementLocation["INSEAM"] = "inseam";
22936
+ MeasurementLocation["KNEE"] = "knee";
22937
+ MeasurementLocation["LOW_HIP"] = "low_hip";
22938
+ MeasurementLocation["LOW_HIP_PLACEMENT_FROM_WAIST"] = "low_hip_placement";
22939
+ MeasurementLocation["MID_NECK"] = "mid_neck";
22940
+ MeasurementLocation["NECK_AT_BASE"] = "neck_base";
22941
+ MeasurementLocation["SHOULDER_DROP"] = "shoulder_drop";
22942
+ MeasurementLocation["SHOULDER_TO_SHOULDER"] = "shoulder_to_shoulder";
22943
+ MeasurementLocation["SIDE_WAIST_TO_FLOOR"] = "side_waist_to_floor";
22944
+ MeasurementLocation["SIDE_WAIST_TO_KNEE"] = "side_waist_to_knee";
22945
+ MeasurementLocation["THIGH"] = "thigh";
22946
+ MeasurementLocation["TOTAL_RISE_LENGTH"] = "total_rise_length";
22947
+ MeasurementLocation["UNDER_BUST"] = "under_bust";
22948
+ MeasurementLocation["VERTICAL_TRUNK"] = "vertical_trunk";
22949
+ MeasurementLocation["WAIST"] = "waist";
22950
+ MeasurementLocation["WRIST"] = "wrist";
22951
+ })(MeasurementLocation || (MeasurementLocation = {}));
22952
+ const MeasurementLocationName = {
22953
+ [MeasurementLocation.ACROSS_BACK]: 'Across back',
22954
+ [MeasurementLocation.ACROSS_FRONT]: 'Across front',
22955
+ [MeasurementLocation.ACROSS_SHOULDER]: 'Across shoulder',
22956
+ [MeasurementLocation.ANKLE]: 'Ankle',
22957
+ [MeasurementLocation.ARMEYE]: 'Armeye',
22958
+ [MeasurementLocation.ARM_LENGTH_FROM_SHOULDER]: 'Arm length from shoulder',
22959
+ [MeasurementLocation.BACK_CROTCH_LENGTH]: 'Back crotch length',
22960
+ [MeasurementLocation.BACK_NECK_TO_EBLOW]: 'Back neck to eblow',
22961
+ [MeasurementLocation.BELOW_KNEE]: 'Below knee',
22962
+ [MeasurementLocation.BICEP]: 'Bicep',
22963
+ [MeasurementLocation.BUST]: 'Chest/Bust',
22964
+ [MeasurementLocation.BUST_POINT_TO_BUST_POINT]: 'Bust point to bust point',
22965
+ [MeasurementLocation.CALF]: 'Calf',
22966
+ [MeasurementLocation.CB_NECK_TO_WAIST]: 'Cb neck to waist',
22967
+ [MeasurementLocation.CB_NECK_TO_WRIST]: 'Cb neck to wrist',
22968
+ [MeasurementLocation.CF_NECK_TO_WAIST]: 'Cf neck to waist',
22969
+ [MeasurementLocation.ELBOW]: 'Elbow',
22970
+ [MeasurementLocation.FOREARM]: 'Forearm',
22971
+ [MeasurementLocation.FRONT_CROTCH_LENGTH]: 'Front crotch length',
22972
+ [MeasurementLocation.HIGH_HIP_PLACEMENT_FROM_WAIST]: 'High hip placement from waist',
22973
+ [MeasurementLocation.HIGH_HIP]: 'High hip',
22974
+ [MeasurementLocation.HSP_TO_ACROSS_BACK]: 'Hsp to across back',
22975
+ [MeasurementLocation.HSP_TO_ACROSS_FRONT]: 'Hsp to across front',
22976
+ [MeasurementLocation.HSP_TO_BUST_POINT]: 'Hsp to bust point',
22977
+ [MeasurementLocation.HSP_TO_LOW_HIP_POSITION]: 'Hsp to low hip position',
22978
+ [MeasurementLocation.HSP_TO_WAIST_POSITION]: 'Hsp to waist position',
22979
+ [MeasurementLocation.INSEAM]: 'Inseam',
22980
+ [MeasurementLocation.KNEE]: 'Knee',
22981
+ [MeasurementLocation.LOW_HIP]: 'Low hip',
22982
+ [MeasurementLocation.LOW_HIP_PLACEMENT_FROM_WAIST]: 'Low hip placement from waist',
22983
+ [MeasurementLocation.MID_NECK]: 'Mid neck',
22984
+ [MeasurementLocation.NECK_AT_BASE]: 'Neck at base',
22985
+ [MeasurementLocation.SHOULDER_DROP]: 'Shoulder drop',
22986
+ [MeasurementLocation.SHOULDER_TO_SHOULDER]: 'Shoulder to shoulder',
22987
+ [MeasurementLocation.SIDE_WAIST_TO_FLOOR]: 'Side waist to floor',
22988
+ [MeasurementLocation.SIDE_WAIST_TO_KNEE]: 'Side waist to knee',
22989
+ [MeasurementLocation.THIGH]: 'Thigh',
22990
+ [MeasurementLocation.TOTAL_RISE_LENGTH]: 'Total rise length',
22991
+ [MeasurementLocation.UNDER_BUST]: 'Under bust',
22992
+ [MeasurementLocation.VERTICAL_TRUNK]: 'Vertical trunk',
22993
+ [MeasurementLocation.WAIST]: 'Waist',
22994
+ [MeasurementLocation.WRIST]: 'Wrist',
22995
+ };
22996
+
22907
22997
  class Fetcher {
22908
22998
  static get endpoint() {
22909
22999
  const api = Config.getInstance().api;
@@ -23043,6 +23133,13 @@ class TfrShop {
23043
23133
  return getFirebaseError(error);
23044
23134
  }
23045
23135
  }
23136
+ async getMeasurementLocationsByStyleId(styleId) {
23137
+ const styles = await this.getStyles([styleId], []);
23138
+ const style = styles.get(styleId);
23139
+ if (!(style === null || style === void 0 ? void 0 : style.sizes.length))
23140
+ return [];
23141
+ return style.sizes[0].garment_measurements.map((measurement) => MeasurementLocationName[measurement.garment_measurement_location]);
23142
+ }
23046
23143
  async submitTelephoneNumber(tel) {
23047
23144
  const sanitizedTel = tel.replace(/[^\+0-9]/g, '');
23048
23145
  const res = await Fetcher.Post(this.user, '/ios-app-link', { phone_number: sanitizedTel }, false);
@@ -23054,12 +23151,6 @@ class TfrShop {
23054
23151
  throw new NoColorwaySizeAssetsFoundError();
23055
23152
  return Array.from(assets.values())[0];
23056
23153
  }
23057
- async _getColorwaySizeAssetFromSku(colorwaySizeAssetSku) {
23058
- const assets = await this.getColorwaySizeAssets(null, [colorwaySizeAssetSku]);
23059
- if (!(assets === null || assets === void 0 ? void 0 : assets.size))
23060
- throw new NoColorwaySizeAssetsFoundError();
23061
- return Array.from(assets.values());
23062
- }
23063
23154
  async awaitColorwaySizeAssetFrames(colorwaySizeAssetSKU) {
23064
23155
  var _a, _b, _c, _d;
23065
23156
  if (!this.isLoggedIn)