@homefile/components-v2 2.24.25 → 2.24.26
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/helpers/receipts/Receipts.helper.js +6 -5
- package/dist/stories/receipts/receipt/ReceiptDetails.stories.d.ts +1 -0
- package/dist/stories/receipts/receipt/ReceiptDetails.stories.js +1 -0
- package/package.json +1 -1
- package/src/helpers/receipts/Receipts.helper.ts +7 -5
- package/src/stories/receipts/receipt/ReceiptDetails.stories.tsx +1 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { HomeDepot, Lowes, Walmart, DefaultReceipt } from '../../assets/images';
|
|
2
2
|
export const receiptOrigins = {
|
|
3
|
-
|
|
4
|
-
HomeDepot: HomeDepot,
|
|
3
|
+
homedepot: HomeDepot,
|
|
5
4
|
lowes: Lowes,
|
|
6
|
-
Lowes: Lowes,
|
|
7
5
|
walmart: Walmart,
|
|
8
|
-
Walmart: Walmart,
|
|
9
6
|
"": DefaultReceipt
|
|
10
7
|
};
|
|
8
|
+
function normalize(input) {
|
|
9
|
+
return input.trim().toLowerCase().replace(/['\s]+/g, '');
|
|
10
|
+
}
|
|
11
11
|
export const getReceiptOrigin = (key) => {
|
|
12
12
|
var _a;
|
|
13
|
-
|
|
13
|
+
const normalizedKey = normalize(key);
|
|
14
|
+
return (_a = receiptOrigins[normalizedKey]) !== null && _a !== void 0 ? _a : DefaultReceipt;
|
|
14
15
|
};
|
|
15
16
|
export const receipts = [
|
|
16
17
|
{
|
package/package.json
CHANGED
|
@@ -2,17 +2,19 @@ import { ReceiptCardItemI } from '@/interfaces'
|
|
|
2
2
|
import { HomeDepot, Lowes, Walmart, DefaultReceipt } from '@/assets/images'
|
|
3
3
|
|
|
4
4
|
export const receiptOrigins: Record<string, string> = {
|
|
5
|
-
|
|
6
|
-
HomeDepot: HomeDepot,
|
|
5
|
+
homedepot: HomeDepot,
|
|
7
6
|
lowes: Lowes,
|
|
8
|
-
Lowes: Lowes,
|
|
9
7
|
walmart: Walmart,
|
|
10
|
-
Walmart: Walmart,
|
|
11
8
|
"" : DefaultReceipt
|
|
12
9
|
}
|
|
13
10
|
|
|
11
|
+
function normalize(input: string) {
|
|
12
|
+
return input.trim().toLowerCase().replace(/['\s]+/g, '');
|
|
13
|
+
}
|
|
14
|
+
|
|
14
15
|
export const getReceiptOrigin = (key: string): string => {
|
|
15
|
-
|
|
16
|
+
const normalizedKey = normalize(key)
|
|
17
|
+
return receiptOrigins[normalizedKey] ?? DefaultReceipt;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export const receipts: ReceiptCardItemI[] = [
|