@ppg_pl/tinting 0.0.2 → 0.0.4
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/cjs/modal-header_9.cjs.entry.js +15 -9
- package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
- package/dist/collection/components/api/services.js +12 -1
- package/dist/collection/components/api/services.js.map +1 -1
- package/dist/collection/components/modal/index.js +3 -8
- package/dist/collection/components/modal/index.js.map +1 -1
- package/dist/components/index10.js +3 -8
- package/dist/components/index10.js.map +1 -1
- package/dist/components/index2.js +12 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/esm/modal-header_9.entry.js +15 -9
- package/dist/esm/modal-header_9.entry.js.map +1 -1
- package/dist/tinting/p-d9e19fea.entry.js +15 -0
- package/dist/tinting/p-d9e19fea.entry.js.map +1 -0
- package/dist/tinting/tinting.esm.js +1 -1
- package/dist/types/components/api/services.d.ts +1 -1
- package/package.json +1 -1
- package/www/build/p-d9e19fea.entry.js +15 -0
- package/www/build/p-d9e19fea.entry.js.map +1 -0
- package/www/build/tinting.esm.js +1 -1
- package/dist/tinting/p-cd431d43.entry.js +0 -15
- package/dist/tinting/p-cd431d43.entry.js.map +0 -1
- package/www/build/p-cd431d43.entry.js +0 -15
- package/www/build/p-cd431d43.entry.js.map +0 -1
|
@@ -2545,10 +2545,21 @@ const fetchColors = async (filters) => {
|
|
|
2545
2545
|
return [];
|
|
2546
2546
|
}
|
|
2547
2547
|
};
|
|
2548
|
+
const getSampleSortForProduct = (sample, productId) => {
|
|
2549
|
+
var _a, _b;
|
|
2550
|
+
const link = (_a = sample === null || sample === void 0 ? void 0 : sample.Products) === null || _a === void 0 ? void 0 : _a.find((p) => p.Product_id === productId);
|
|
2551
|
+
// put null/undefined at the end
|
|
2552
|
+
return (_b = link === null || link === void 0 ? void 0 : link.sort) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;
|
|
2553
|
+
};
|
|
2548
2554
|
const fetchSamplesColors = async (filters) => {
|
|
2549
2555
|
try {
|
|
2556
|
+
// you already include Products.* in the query
|
|
2557
|
+
const { id: productId } = filters;
|
|
2550
2558
|
const response = await ApiService.getData(`items/Sample?${fetchColorsQuery(Object.assign({}, filters))}`);
|
|
2551
|
-
|
|
2559
|
+
const data = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2560
|
+
// order by junction sort
|
|
2561
|
+
const ordered = [...data].sort((a, b) => getSampleSortForProduct(a, productId) - getSampleSortForProduct(b, productId));
|
|
2562
|
+
return ordered;
|
|
2552
2563
|
}
|
|
2553
2564
|
catch (error) {
|
|
2554
2565
|
console.error('Error fetching samples colors:', error);
|