@thefittingroom/shop-ui 1.4.40 → 1.5.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.
- package/dist/esm/index.js +27 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +84 -84
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.
|
|
2
|
+
* thefittingroom v1.5.1 (2024-09-01T17:00:41.740Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function loadImageRecursive(imageURL, imageURLs) {
|
|
@@ -47,7 +47,7 @@ const InitImageSlider = (sliderID, onChange) => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
/*!
|
|
50
|
-
* thefittingroom v1.
|
|
50
|
+
* thefittingroom v1.5.0 (2024-09-01T16:52:25.366Z)
|
|
51
51
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
52
52
|
*/
|
|
53
53
|
|
|
@@ -25459,9 +25459,14 @@ class TfrShop {
|
|
|
25459
25459
|
const filteredLocations = !filledLocations.length
|
|
25460
25460
|
? taxonomy.measurement_locations.female
|
|
25461
25461
|
: taxonomy.measurement_locations.female.filter((location) => filledLocations.includes(location));
|
|
25462
|
-
|
|
25463
|
-
return this.measurementLocations.has(location)
|
|
25462
|
+
const locationsWithSortOrder = filteredLocations.map((location) => {
|
|
25463
|
+
return this.measurementLocations.has(location)
|
|
25464
|
+
? this.measurementLocations.get(location)
|
|
25465
|
+
: { name: location, sort_order: Infinity };
|
|
25464
25466
|
});
|
|
25467
|
+
return locationsWithSortOrder
|
|
25468
|
+
.sort((a, b) => (a.sort_order < b.sort_order ? -1 : 0))
|
|
25469
|
+
.map((location) => location.name);
|
|
25465
25470
|
}
|
|
25466
25471
|
async getMeasurementLocationsFromBrandStyleId(brandStyleId, filledLocations = []) {
|
|
25467
25472
|
const asset = await this.getColorwaySizeAssetFromBrandStyleId(brandStyleId);
|
|
@@ -25476,9 +25481,14 @@ class TfrShop {
|
|
|
25476
25481
|
const filteredLocations = !filledLocations.length
|
|
25477
25482
|
? taxonomy.measurement_locations.female
|
|
25478
25483
|
: taxonomy.measurement_locations.female.filter((location) => filledLocations.includes(location));
|
|
25479
|
-
|
|
25480
|
-
return this.measurementLocations.has(location)
|
|
25484
|
+
const locationsWithSortOrder = filteredLocations.map((location) => {
|
|
25485
|
+
return this.measurementLocations.has(location)
|
|
25486
|
+
? this.measurementLocations.get(location)
|
|
25487
|
+
: { name: location, sort_order: Infinity };
|
|
25481
25488
|
});
|
|
25489
|
+
return locationsWithSortOrder
|
|
25490
|
+
.sort((a, b) => (a.sort_order < b.sort_order ? -1 : 0))
|
|
25491
|
+
.map((location) => location.name);
|
|
25482
25492
|
}
|
|
25483
25493
|
async getStyleByBrandStyleId(brandStyleId) {
|
|
25484
25494
|
var _a, _b;
|
|
@@ -25521,7 +25531,10 @@ class TfrShop {
|
|
|
25521
25531
|
}
|
|
25522
25532
|
}
|
|
25523
25533
|
getMeasurementLocationName(location) {
|
|
25524
|
-
return this.measurementLocations.has(location) ? this.measurementLocations.get(location) : location;
|
|
25534
|
+
return this.measurementLocations.has(location) ? this.measurementLocations.get(location).name : location;
|
|
25535
|
+
}
|
|
25536
|
+
getMeasurementLocationSortOrder(location) {
|
|
25537
|
+
return this.measurementLocations.has(location) ? this.measurementLocations.get(location).sort_order : Infinity;
|
|
25525
25538
|
}
|
|
25526
25539
|
async getGetTaxonomy(styleId) {
|
|
25527
25540
|
try {
|
|
@@ -25535,7 +25548,7 @@ class TfrShop {
|
|
|
25535
25548
|
async getMeasurementLocations() {
|
|
25536
25549
|
const locations = await this.fetchMeasurementLocations();
|
|
25537
25550
|
locations.forEach((location) => {
|
|
25538
|
-
this.measurementLocations.set(location.name, location.garment_label);
|
|
25551
|
+
this.measurementLocations.set(location.name, { name: location.garment_label, sort_order: location.sort_order });
|
|
25539
25552
|
});
|
|
25540
25553
|
}
|
|
25541
25554
|
async fetchMeasurementLocations() {
|
|
@@ -26752,7 +26765,6 @@ class SizeRecComponent {
|
|
|
26752
26765
|
renderSizeRecTable(sizes, index) {
|
|
26753
26766
|
const { locations } = sizes[index];
|
|
26754
26767
|
const html = locations
|
|
26755
|
-
.sort(({ location: a }, { location: b }) => (a < b ? -1 : 1))
|
|
26756
26768
|
.map(({ location, fit, isPerfect }) => this.renderSizeRecTableRow(location, fit, isPerfect))
|
|
26757
26769
|
.join('');
|
|
26758
26770
|
this.tfrSizeRecTable.innerHTML = html;
|
|
@@ -26776,10 +26788,7 @@ class SizeRecComponent {
|
|
|
26776
26788
|
return `<div class="tfr-size-rec-login-cta"><img src="${loginIconSrc}" /> Sign up or login to view</div>`;
|
|
26777
26789
|
}
|
|
26778
26790
|
renderGarmentLocations(locations) {
|
|
26779
|
-
const html = locations
|
|
26780
|
-
.sort()
|
|
26781
|
-
.map((location) => this.renderSizeRecTableRow(location, this.renderLoginCta()))
|
|
26782
|
-
.join('');
|
|
26791
|
+
const html = locations.map((location) => this.renderSizeRecTableRow(location, this.renderLoginCta())).join('');
|
|
26783
26792
|
this.tfrSizeRecTable.innerHTML = html;
|
|
26784
26793
|
this.tfrSizeRecSize.innerHTML = this.renderLoginCta();
|
|
26785
26794
|
}
|
|
@@ -26930,13 +26939,16 @@ class TfrSizeRec {
|
|
|
26930
26939
|
sizes: sizeRec.fits.map((fit) => {
|
|
26931
26940
|
return {
|
|
26932
26941
|
size: sizeRec.available_sizes.find((size) => size.id === fit.size_id).label,
|
|
26933
|
-
locations: fit.measurement_location_fits
|
|
26942
|
+
locations: fit.measurement_location_fits
|
|
26943
|
+
.map((locationFit) => {
|
|
26934
26944
|
return {
|
|
26935
26945
|
fit: index.FitNames[locationFit.fit],
|
|
26936
26946
|
isPerfect: this.perfectFits.includes(locationFit.fit),
|
|
26937
26947
|
location: this.tfrShop.getMeasurementLocationName(locationFit.measurement_location),
|
|
26948
|
+
sortOrder: this.tfrShop.getMeasurementLocationSortOrder(locationFit.measurement_location),
|
|
26938
26949
|
};
|
|
26939
|
-
})
|
|
26950
|
+
})
|
|
26951
|
+
.sort((a, b) => (a.sortOrder < b.sortOrder ? -1 : 1)),
|
|
26940
26952
|
};
|
|
26941
26953
|
}),
|
|
26942
26954
|
};
|