UNPKG

@shopify/shop-minis-react

Version:

React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)

45 lines (44 loc) 1.21 kB
function u(e) { return e >= 1e6 ? `${Math.floor(e / 1e5) / 10}M` : e >= 1e3 ? `${Math.floor(e / 1e3)}K` : e.toString(); } function m(e) { return Math.round(e * 10) / 10; } function l(e) { if (!e) return { type: "default", backgroundColor: "white" }; if (e.headerTheme) { const o = e.headerTheme.coverImage?.url ?? e.headerTheme.thumbnailImage?.url, r = e.headerTheme.coverImage?.thumbhash ?? e.headerTheme.thumbnailImage?.thumbhash ?? void 0, a = e.colors?.coverDominant; if (o && a) return { type: "coverImage", coverImageUrl: o, coverImageThumbhash: r, backgroundColor: a }; } return e.colors?.primary ? { type: "brandColor", backgroundColor: e.colors.primary } : e.colors?.logoDominant ? { type: "logoColor", backgroundColor: e.colors.logoDominant } : { type: "default", backgroundColor: "white" }; } function t(e, o = 4) { const r = e?.featuredImages.slice(0, o); return r ? r.length === 3 ? e?.featuredImages.slice(0, 2) : r : []; } export { l as extractBrandTheme, u as formatReviewCount, t as getFeaturedImages, m as normalizeRating }; //# sourceMappingURL=merchant-card.js.map