@faststore/components 3.80.0 → 3.84.0
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/molecules/ProductCard/ProductCardContent.d.ts +8 -0
- package/dist/cjs/molecules/ProductCard/ProductCardContent.d.ts.map +1 -1
- package/dist/cjs/molecules/ProductCard/ProductCardContent.js +2 -1
- package/dist/cjs/molecules/ProductCard/ProductCardContent.js.map +1 -1
- package/dist/esm/molecules/ProductCard/ProductCardContent.d.ts +8 -0
- package/dist/esm/molecules/ProductCard/ProductCardContent.d.ts.map +1 -1
- package/dist/esm/molecules/ProductCard/ProductCardContent.js +2 -1
- package/dist/esm/molecules/ProductCard/ProductCardContent.js.map +1 -1
- package/package.json +2 -2
- package/src/molecules/ProductCard/ProductCardContent.tsx +25 -0
|
@@ -2,6 +2,10 @@ import type { HTMLAttributes } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { PriceDefinition } from '../../typings/PriceDefinition';
|
|
4
4
|
import { type LinkElementType, type LinkProps } from '../../';
|
|
5
|
+
type DeliveryPromiseBadge = {
|
|
6
|
+
label: string;
|
|
7
|
+
availability: boolean;
|
|
8
|
+
};
|
|
5
9
|
export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
6
10
|
/**
|
|
7
11
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
@@ -59,6 +63,10 @@ export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
|
59
63
|
* Specifies the sponsored label, if advertisement is applicable.
|
|
60
64
|
*/
|
|
61
65
|
sponsoredLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* List delivery badges, if enabled and available.
|
|
68
|
+
*/
|
|
69
|
+
deliveryPromiseBadges?: DeliveryPromiseBadge[];
|
|
62
70
|
}
|
|
63
71
|
declare const ProductCardContent: React.ForwardRefExoticComponent<ProductCardContentProps & React.RefAttributes<HTMLElement>>;
|
|
64
72
|
export default ProductCardContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCardContent.d.ts","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,SAAS,EAGf,MAAM,QAAQ,CAAA;AAEf,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC1E;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAA;IAC/C;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"ProductCardContent.d.ts","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names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kB,CAAA"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const __1 = require("../../");
|
|
6
|
-
const ProductCardContent = (0, react_1.forwardRef)(function CardContent({ testId = 'fs-product-card-content', title, linkProps, price, outOfStock, outOfStockLabel = 'Out of stock', ratingValue, showDiscountBadge, buttonLabel = 'Add', onButtonClick, children, includeTaxes = false, includeTaxesLabel = 'Tax included', sponsored = false, sponsoredLabel = 'Sponsored', ...otherProps }, ref) {
|
|
6
|
+
const ProductCardContent = (0, react_1.forwardRef)(function CardContent({ testId = 'fs-product-card-content', title, linkProps, price, outOfStock, outOfStockLabel = 'Out of stock', ratingValue, showDiscountBadge, buttonLabel = 'Add', onButtonClick, children, includeTaxes = false, includeTaxesLabel = 'Tax included', sponsored = false, sponsoredLabel = 'Sponsored', deliveryPromiseBadges, ...otherProps }, ref) {
|
|
7
7
|
const listingPrice = price?.listPrice ? price.listPrice : 0;
|
|
8
8
|
const sellingPrice = price?.value ? price.value : 0;
|
|
9
9
|
return (react_1.default.createElement("section", { ref: ref, "data-fs-product-card-content": true, "data-fs-product-card-badge": showDiscountBadge, "data-testid": testId, ...otherProps },
|
|
@@ -17,6 +17,7 @@ const ProductCardContent = (0, react_1.forwardRef)(function CardContent({ testId
|
|
|
17
17
|
ratingValue && (react_1.default.createElement(__1.Rating, { value: ratingValue, icon: react_1.default.createElement(__1.Icon, { name: "Star" }) }))),
|
|
18
18
|
showDiscountBadge && !outOfStock && (react_1.default.createElement(__1.DiscountBadge, { listPrice: listingPrice, spotPrice: sellingPrice })),
|
|
19
19
|
outOfStock && react_1.default.createElement(__1.Badge, null, outOfStockLabel),
|
|
20
|
+
deliveryPromiseBadges && (react_1.default.createElement("div", { "data-fs-product-card-delivery-promise-badges": true }, deliveryPromiseBadges.map((badge) => (react_1.default.createElement("span", { "data-fs-product-card-delivery-promise-badge": true, "data-fs-product-card-delivery-promise-badge-availability": badge.availability, key: badge.label }, badge.label))))),
|
|
20
21
|
onButtonClick && !outOfStock && (react_1.default.createElement("div", { "data-fs-product-card-actions": true },
|
|
21
22
|
react_1.default.createElement(__1.Button, { variant: "primary", icon: react_1.default.createElement(__1.Icon, { name: "ShoppingCart" }), iconPosition: "left", size: "small", onClick: onButtonClick }, buttonLabel)))));
|
|
22
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":";;;AACA,uDAAyC;AAIzC,8BAWe;
|
|
1
|
+
{"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":";;;AACA,uDAAyC;AAIzC,8BAWe;AAqEf,MAAM,kBAAkB,GAAG,IAAA,kBAAU,EACnC,SAAS,WAAW,CAClB,EACE,MAAM,GAAG,yBAAyB,EAClC,KAAK,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,eAAe,GAAG,cAAc,EAChC,WAAW,EACX,iBAAiB,EACjB,WAAW,GAAG,KAAK,EACnB,aAAa,EACb,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,iBAAiB,GAAG,cAAc,EAClC,SAAS,GAAG,KAAK,EACjB,cAAc,GAAG,WAAW,EAC5B,qBAAqB,EACrB,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,YAAY,GAAG,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,MAAM,YAAY,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAEnD,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,sEAEoB,iBAAiB,iBAChC,MAAM,KACf,UAAU;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|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { PriceDefinition } from '../../typings/PriceDefinition';
|
|
4
4
|
import { type LinkElementType, type LinkProps } from '../../';
|
|
5
|
+
type DeliveryPromiseBadge = {
|
|
6
|
+
label: string;
|
|
7
|
+
availability: boolean;
|
|
8
|
+
};
|
|
5
9
|
export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
6
10
|
/**
|
|
7
11
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
@@ -59,6 +63,10 @@ export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
|
59
63
|
* Specifies the sponsored label, if advertisement is applicable.
|
|
60
64
|
*/
|
|
61
65
|
sponsoredLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* List delivery badges, if enabled and available.
|
|
68
|
+
*/
|
|
69
|
+
deliveryPromiseBadges?: DeliveryPromiseBadge[];
|
|
62
70
|
}
|
|
63
71
|
declare const ProductCardContent: React.ForwardRefExoticComponent<ProductCardContentProps & React.RefAttributes<HTMLElement>>;
|
|
64
72
|
export default ProductCardContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCardContent.d.ts","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,SAAS,EAGf,MAAM,QAAQ,CAAA;AAEf,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC1E;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAA;IAC/C;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"ProductCardContent.d.ts","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,SAAS,EAGf,MAAM,QAAQ,CAAA;AAEf,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AACD,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC1E;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAA;IAC/C;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAC/C;AAED,QAAA,MAAM,kBAAkB,6FA8FvB,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Badge, Button, DiscountBadge, Icon, Label, Link, ProductPrice, Rating, } from '../../';
|
|
3
|
-
const ProductCardContent = forwardRef(function CardContent({ testId = 'fs-product-card-content', title, linkProps, price, outOfStock, outOfStockLabel = 'Out of stock', ratingValue, showDiscountBadge, buttonLabel = 'Add', onButtonClick, children, includeTaxes = false, includeTaxesLabel = 'Tax included', sponsored = false, sponsoredLabel = 'Sponsored', ...otherProps }, ref) {
|
|
3
|
+
const ProductCardContent = forwardRef(function CardContent({ testId = 'fs-product-card-content', title, linkProps, price, outOfStock, outOfStockLabel = 'Out of stock', ratingValue, showDiscountBadge, buttonLabel = 'Add', onButtonClick, children, includeTaxes = false, includeTaxesLabel = 'Tax included', sponsored = false, sponsoredLabel = 'Sponsored', deliveryPromiseBadges, ...otherProps }, ref) {
|
|
4
4
|
const listingPrice = price?.listPrice ? price.listPrice : 0;
|
|
5
5
|
const sellingPrice = price?.value ? price.value : 0;
|
|
6
6
|
return (React.createElement("section", { ref: ref, "data-fs-product-card-content": true, "data-fs-product-card-badge": showDiscountBadge, "data-testid": testId, ...otherProps },
|
|
@@ -14,6 +14,7 @@ const ProductCardContent = forwardRef(function CardContent({ testId = 'fs-produc
|
|
|
14
14
|
ratingValue && (React.createElement(Rating, { value: ratingValue, icon: React.createElement(Icon, { name: "Star" }) }))),
|
|
15
15
|
showDiscountBadge && !outOfStock && (React.createElement(DiscountBadge, { listPrice: listingPrice, spotPrice: sellingPrice })),
|
|
16
16
|
outOfStock && React.createElement(Badge, null, outOfStockLabel),
|
|
17
|
+
deliveryPromiseBadges && (React.createElement("div", { "data-fs-product-card-delivery-promise-badges": true }, deliveryPromiseBadges.map((badge) => (React.createElement("span", { "data-fs-product-card-delivery-promise-badge": true, "data-fs-product-card-delivery-promise-badge-availability": badge.availability, key: badge.label }, badge.label))))),
|
|
17
18
|
onButtonClick && !outOfStock && (React.createElement("div", { "data-fs-product-card-actions": true },
|
|
18
19
|
React.createElement(Button, { variant: "primary", icon: React.createElement(Icon, { name: "ShoppingCart" }), iconPosition: "left", size: "small", onClick: onButtonClick }, buttonLabel)))));
|
|
19
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,EACL,KAAK,EACL,MAAM,EACN,aAAa,EACb,IAAI,EACJ,KAAK,EACL,IAAI,EAGJ,YAAY,EACZ,MAAM,GACP,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"ProductCardContent.js","sourceRoot":"","sources":["../../../../src/molecules/ProductCard/ProductCardContent.tsx"],"names":[],"m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W,IAAI,CACd,oBAAC,MAAM,IAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GAAI,CAC3D,CACG;QACL,iBAAiB,IAAI,CAAC,UAAU,IAAI,CACnC,oBAAC,aAAa,IAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAI,CACpE;QACA,UAAU,IAAI,oBAAC,KAAK,QAAE,eAAe,CAAS;QAC9C,qBAAqB,IAAI,CACxB,qFACG,qBAAqB,CAAC,GAAG,CAAC,CAAC,KAA2B,EAAE,EAAE,CAAC,CAC1D,+IAGI,KAAK,CAAC,YAAY,EAEpB,GAAG,EAAE,KAAK,CAAC,KAAK,IAEf,KAAK,CAAC,KAAK,CACP,CACR,CAAC,CACE,CACP;QAEA,aAAa,IAAI,CAAC,UAAU,IAAI,CAC/B;YACE,oBAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAE,oBAAC,IAAI,IAAC,IAAI,EAAC,cAAc,GAAG,EAClC,YAAY,EAAC,MAAM,EACnB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,aAAa,IAErB,WAAW,CACL,CACL,CACP,CACO,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.84.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"typings": "dist/esm/index.d.ts",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"volta": {
|
|
57
57
|
"extends": "../../package.json"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "6fa29e5b0a01dab3971a688484c8ec73e1a40aad"
|
|
60
60
|
}
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
Rating,
|
|
17
17
|
} from '../../'
|
|
18
18
|
|
|
19
|
+
type DeliveryPromiseBadge = {
|
|
20
|
+
label: string
|
|
21
|
+
availability: boolean
|
|
22
|
+
}
|
|
19
23
|
export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
20
24
|
/**
|
|
21
25
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
@@ -73,6 +77,10 @@ export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
|
73
77
|
* Specifies the sponsored label, if advertisement is applicable.
|
|
74
78
|
*/
|
|
75
79
|
sponsoredLabel?: string
|
|
80
|
+
/**
|
|
81
|
+
* List delivery badges, if enabled and available.
|
|
82
|
+
*/
|
|
83
|
+
deliveryPromiseBadges?: DeliveryPromiseBadge[]
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
|
|
@@ -93,6 +101,7 @@ const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
|
|
|
93
101
|
includeTaxesLabel = 'Tax included',
|
|
94
102
|
sponsored = false,
|
|
95
103
|
sponsoredLabel = 'Sponsored',
|
|
104
|
+
deliveryPromiseBadges,
|
|
96
105
|
...otherProps
|
|
97
106
|
},
|
|
98
107
|
ref
|
|
@@ -136,6 +145,22 @@ const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
|
|
|
136
145
|
<DiscountBadge listPrice={listingPrice} spotPrice={sellingPrice} />
|
|
137
146
|
)}
|
|
138
147
|
{outOfStock && <Badge>{outOfStockLabel}</Badge>}
|
|
148
|
+
{deliveryPromiseBadges && (
|
|
149
|
+
<div data-fs-product-card-delivery-promise-badges>
|
|
150
|
+
{deliveryPromiseBadges.map((badge: DeliveryPromiseBadge) => (
|
|
151
|
+
<span
|
|
152
|
+
data-fs-product-card-delivery-promise-badge
|
|
153
|
+
data-fs-product-card-delivery-promise-badge-availability={
|
|
154
|
+
badge.availability
|
|
155
|
+
}
|
|
156
|
+
key={badge.label}
|
|
157
|
+
>
|
|
158
|
+
{badge.label}
|
|
159
|
+
</span>
|
|
160
|
+
))}
|
|
161
|
+
</div>
|
|
162
|
+
)}
|
|
163
|
+
|
|
139
164
|
{onButtonClick && !outOfStock && (
|
|
140
165
|
<div data-fs-product-card-actions>
|
|
141
166
|
<Button
|