@stokelp/ui 2.118.0 → 2.119.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/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.d.ts +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +6 -6
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../text/Text.cjs"),t=require("../icon/Icon.cjs"),n=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/CheckCircleIcon.cjs"),r=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/XCircleIcon.cjs");let i=require("@stokelp/styled-system/jsx"),a=require("react/jsx-runtime");var o=5,s={title:`Note fournisseur`,insufficientData:`Non noté`,componentsTitle:`Détail de la note`,completionTitle:`Complétion du compte`,notAvailable:`—`,units:{minutes:`min`,hours:`h`,days:`j`},components:{responseRate:`Taux de réponse`,responseDelay:`Délai de réponse`,completion:`Complétion du compte`},completion:{profile:`Profil (photo et description)`,
|
|
1
|
+
"use client";const e=require("../text/Text.cjs"),t=require("../icon/Icon.cjs"),n=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/CheckCircleIcon.cjs"),r=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/XCircleIcon.cjs");let i=require("@stokelp/styled-system/jsx"),a=require("react/jsx-runtime");var o=5,s={title:`Note fournisseur`,insufficientData:`Non noté`,componentsTitle:`Détail de la note`,completionTitle:`Complétion du compte`,notAvailable:`—`,units:{minutes:`min`,hours:`h`,days:`j`},components:{responseRate:`Taux de réponse`,responseDelay:`Délai de réponse`,completion:`Complétion du compte`},completion:{profile:`Profil (photo et description)`,location:`Localisation`,contacts:`Contact`,legalBanking:`Coordonnées légales et bancaires`,sector:`Secteur d'activité`,certificate:`Certificat`}},c=[`profile`,`location`,`contacts`,`legalBanking`,`sector`,`certificate`];function l(e){return e.toFixed(1).replace(`.`,`,`)}function u(e,t){if(e<60)return`${Math.round(e)} ${t.minutes}`;let n=e/60;return n<48?`${Math.round(n)} ${t.hours}`:`${(n/24).toFixed(1).replace(`.`,`,`)} ${t.days}`}function d(e){let t=e/5;return t>=.7?`#3B6D11`:t>=.4?`#854F0B`:`#A32D2D`}function f(e){return e>=70?`#639922`:e>=40?`#BA7517`:`#E24B4A`}var p=({rating:o,responseRate:p,labels:m})=>{let h={...s,...m,units:{...s.units,...m?.units},components:{...s.components,...m?.components},completion:{...s.completion,...m?.completion}},g=p!=null,_=o.responseDelayMinutes!=null,v=o.responseDelayScore==null?null:Math.round(o.responseDelayScore*100),y=Math.round(o.completionScore*100),b=[{key:`responseRate`,value:g?`${Math.round(p)} %`:h.notAvailable,barPercent:g?Math.round(p):null,color:g?f(Math.round(p)):void 0},{key:`responseDelay`,value:_?u(o.responseDelayMinutes,h.units):h.notAvailable,barPercent:v,color:v==null?void 0:f(v)},{key:`completion`,value:`${y} %`,barPercent:y,color:f(y)}];return(0,a.jsxs)(i.Box,{bg:`white`,borderRadius:`radius-8`,p:`space-16`,minW:`240px`,maxW:`260px`,css:{"& *":{fontFamily:`inherit`}},children:[(0,a.jsxs)(i.HStack,{justify:`space-between`,alignItems:`baseline`,mb:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.md`,fontWeight:`bold`,children:h.title}),o.insufficientData||o.overall==null?(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,color:`grey.400`,children:h.insufficientData}):(0,a.jsxs)(e.Text,{as:`span`,fontSize:`body.lg`,fontWeight:`medium`,style:{color:d(o.overall)},children:[l(o.overall),` / `,5,` ★`]})]}),(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-8`,mb:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:h.componentsTitle}),b.map(t=>(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-2`,children:[(0,a.jsxs)(i.HStack,{justify:`space-between`,alignItems:`baseline`,gap:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:`grey.500`,children:h.components[t.key]}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,whiteSpace:`nowrap`,style:{color:t.color},color:t.color?void 0:`grey.300`,children:t.value})]}),(0,a.jsx)(i.Box,{h:`3px`,bg:`grey.100`,borderRadius:`full`,overflow:`hidden`,children:(0,a.jsx)(i.Box,{h:`100%`,borderRadius:`full`,style:{width:t.barPercent==null?`0%`:`${t.barPercent}%`,background:t.color??`transparent`}})})]},t.key))]}),(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-4`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:h.completionTitle}),c.map(s=>{let c=o.completion[s];return(0,a.jsxs)(i.HStack,{alignItems:`center`,gap:`space-8`,children:[(0,a.jsx)(t.Icon,{size:`sm`,color:c?`success.500`:`grey.300`,flexShrink:`0`,children:c?(0,a.jsx)(n.default,{}):(0,a.jsx)(r.default,{})}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:c?`grey.500`:`grey.400`,children:h.completion[s]})]},s)})]}),h.footer&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mt:`space-8`,mb:`space-8`}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`9px`,color:`grey.300`,style:{lineHeight:1},children:h.footer})]})]})};exports.DEFAULT_SUPPLIER_RATING_LABELS=s,exports.SUPPLIER_RATING_MAX=o,exports.SupplierRatingBreakdown=p,exports.formatOverall=l,exports.formatResponseDelay=u,exports.getHeadlineColor=d;
|
|
2
2
|
//# sourceMappingURL=SupplierRatingBreakdown.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupplierRatingBreakdown.cjs","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon, Text } from '~/components'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nexport type SupplierRatingComponentKey = 'responseRate' | 'responseDelay' | 'completion'\n\nexport type SupplierRatingCompletionKey =\n | 'profile'\n | 'locationContacts'\n | 'legalBanking'\n | 'sector'\n | 'certificate'\n | 'productInterest'\n\nexport type SupplierRatingCompletion = Record<SupplierRatingCompletionKey, boolean>\n\nexport type SupplierRating = {\n /** Overall note out of 5. Absent when insufficientData is true. */\n overall?: number\n /** Response-rate sub-score, 0..1 (note calc only). Absent when insufficientData is true. */\n responseRateScore?: number\n /** Response-delay sub-score, 0..1 (note calc + colours the delay row). Absent when insufficientData is true. */\n responseDelayScore?: number\n /** Average response delay in MINUTES, for display. Absent when insufficientData is true. */\n responseDelayMinutes?: number\n /** Account-completion sub-score, 0..1. Always present. */\n completionScore: number\n /** True when the supplier has too few interactions for a reliable note. */\n insufficientData: boolean\n /** Completion checklist shown in the breakdown. */\n completion: SupplierRatingCompletion\n}\n\nexport type SupplierRatingLabels = {\n title: string\n /** Neutral state shown instead of a note when data is insufficient. */\n insufficientData: string\n /** Section heading above the sub-scores. */\n componentsTitle: string\n /** Section heading above the completion checklist. */\n completionTitle: string\n /** Value shown when a component has no data yet (e.g. \"—\"). */\n notAvailable: string\n /** Unit suffixes for the average response-delay value. */\n units: { minutes: string; hours: string; days: string }\n components: Record<SupplierRatingComponentKey, string>\n completion: Record<SupplierRatingCompletionKey, string>\n footer?: string\n}\n\nexport const DEFAULT_SUPPLIER_RATING_LABELS: SupplierRatingLabels = {\n title: 'Note fournisseur',\n insufficientData: 'Non noté',\n componentsTitle: 'Détail de la note',\n completionTitle: 'Complétion du compte',\n notAvailable: '—',\n units: { minutes: 'min', hours: 'h', days: 'j' },\n components: {\n responseRate: 'Taux de réponse',\n responseDelay: 'Délai de réponse',\n completion: 'Complétion du compte',\n },\n completion: {\n profile: 'Profil (photo et description)',\n locationContacts: 'Localisation et contact',\n legalBanking: 'Coordonnées légales et bancaires',\n sector: \"Secteur d'activité\",\n certificate: 'Certificat',\n productInterest: 'Intérêt produit',\n },\n}\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'locationContacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n 'productInterest',\n]\n\nexport function formatOverall(overall: number): string {\n return overall.toFixed(1).replace('.', ',')\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units']): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${days.toFixed(1).replace('.', ',')} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const labels: SupplierRatingLabels = {\n ...DEFAULT_SUPPLIER_RATING_LABELS,\n ...labelsProp,\n units: { ...DEFAULT_SUPPLIER_RATING_LABELS.units, ...labelsProp?.units },\n components: { ...DEFAULT_SUPPLIER_RATING_LABELS.components, ...labelsProp?.components },\n completion: { ...DEFAULT_SUPPLIER_RATING_LABELS.completion, ...labelsProp?.completion },\n }\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units) : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":"4aAKA,IAAa,EAAsB,EAgDtB,EAAuD,CAClE,MAAO,mBACP,iBAAkB,WAClB,gBAAiB,oBACjB,gBAAiB,uBACjB,aAAc,IACd,MAAO,CAAE,QAAS,MAAO,MAAO,IAAK,KAAM,GAAI,EAC/C,WAAY,CACV,aAAc,kBACd,cAAe,mBACf,WAAY,sBACd,EACA,WAAY,CACV,QAAS,gCACT,iBAAkB,0BAClB,aAAc,mCACd,OAAQ,qBACR,YAAa,aACb,gBAAiB,iBACnB,CACF,EAEM,EAAkD,CACtD,UACA,mBACA,eACA,SACA,cACA,iBACF,EAEA,SAAgB,EAAc,EAAyB,CACrD,OAAO,EAAQ,QAAQ,CAAC,EAAE,QAAQ,IAAK,GAAG,CAC5C,CAGA,SAAgB,EAAoB,EAAiB,EAA8C,CACjG,GAAI,EAAU,GAAI,MAAO,GAAG,KAAK,MAAM,CAAO,EAAE,GAAG,EAAM,UACzD,IAAM,EAAQ,EAAU,GAGxB,OAFI,EAAQ,GAAW,GAAG,KAAK,MAAM,CAAK,EAAE,GAAG,EAAM,QAE9C,IADM,EAAQ,IACN,QAAQ,CAAC,EAAE,QAAQ,IAAK,GAAG,EAAE,GAAG,EAAM,MACvD,CAEA,SAAgB,EAAiB,EAAyB,CACxD,IAAM,EAAQ,EAAA,EAGd,OAFI,GAAS,GAAY,UACrB,GAAS,GAAY,UAClB,SACT,CAEA,SAAS,EAAY,EAA8B,CAGjD,OAFI,GAAgB,GAAW,UAC3B,GAAgB,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-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon, Text } from '~/components'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nexport type SupplierRatingComponentKey = 'responseRate' | 'responseDelay' | 'completion'\n\nexport type SupplierRatingCompletionKey =\n | 'profile'\n | 'location'\n | 'contacts'\n | 'legalBanking'\n | 'sector'\n | 'certificate'\n\nexport type SupplierRatingCompletion = Record<SupplierRatingCompletionKey, boolean>\n\nexport type SupplierRating = {\n /** Overall note out of 5. Absent when insufficientData is true. */\n overall?: number\n /** Response-rate sub-score, 0..1 (note calc only). Absent when insufficientData is true. */\n responseRateScore?: number\n /** Response-delay sub-score, 0..1 (note calc + colours the delay row). Absent when insufficientData is true. */\n responseDelayScore?: number\n /** Average response delay in MINUTES, for display. Absent when insufficientData is true. */\n responseDelayMinutes?: number\n /** Account-completion sub-score, 0..1. Always present. */\n completionScore: number\n /** True when the supplier has too few interactions for a reliable note. */\n insufficientData: boolean\n /** Completion checklist shown in the breakdown. */\n completion: SupplierRatingCompletion\n}\n\nexport type SupplierRatingLabels = {\n title: string\n /** Neutral state shown instead of a note when data is insufficient. */\n insufficientData: string\n /** Section heading above the sub-scores. */\n componentsTitle: string\n /** Section heading above the completion checklist. */\n completionTitle: string\n /** Value shown when a component has no data yet (e.g. \"—\"). */\n notAvailable: string\n /** Unit suffixes for the average response-delay value. */\n units: { minutes: string; hours: string; days: string }\n components: Record<SupplierRatingComponentKey, string>\n completion: Record<SupplierRatingCompletionKey, string>\n footer?: string\n}\n\nexport const DEFAULT_SUPPLIER_RATING_LABELS: SupplierRatingLabels = {\n title: 'Note fournisseur',\n insufficientData: 'Non noté',\n componentsTitle: 'Détail de la note',\n completionTitle: 'Complétion du compte',\n notAvailable: '—',\n units: { minutes: 'min', hours: 'h', days: 'j' },\n components: {\n responseRate: 'Taux de réponse',\n responseDelay: 'Délai de réponse',\n completion: 'Complétion du compte',\n },\n completion: {\n profile: 'Profil (photo et description)',\n location: 'Localisation',\n contacts: 'Contact',\n legalBanking: 'Coordonnées légales et bancaires',\n sector: \"Secteur d'activité\",\n certificate: 'Certificat',\n },\n}\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'location',\n 'contacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n]\n\nexport function formatOverall(overall: number): string {\n return overall.toFixed(1).replace('.', ',')\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units']): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${days.toFixed(1).replace('.', ',')} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const labels: SupplierRatingLabels = {\n ...DEFAULT_SUPPLIER_RATING_LABELS,\n ...labelsProp,\n units: { ...DEFAULT_SUPPLIER_RATING_LABELS.units, ...labelsProp?.units },\n components: { ...DEFAULT_SUPPLIER_RATING_LABELS.components, ...labelsProp?.components },\n completion: { ...DEFAULT_SUPPLIER_RATING_LABELS.completion, ...labelsProp?.completion },\n }\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units) : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":"4aAKA,IAAa,EAAsB,EAgDtB,EAAuD,CAClE,MAAO,mBACP,iBAAkB,WAClB,gBAAiB,oBACjB,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AAO,EAAO,WAAW,GAC/B,OACE,EAAA,EAAA,MAAC,EAAA,OAAD,CAAkB,WAAW,SAAS,IAAI,mBAA1C,EACE,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,KAAK,KAAK,MAAO,EAAO,cAAgB,WAAY,WAAW,aAClE,GAAO,EAAA,EAAA,KAAC,EAAA,QAAD,CAAkB,CAAA,GAAI,EAAA,EAAA,KAAC,EAAA,QAAD,CAAc,CAAA,CACxC,CAAA,GACN,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,GAAG,OAAO,SAAS,UAAU,MAAO,EAAO,WAAa,oBAC3D,EAAO,WAAW,EACf,CAAA,CACA,GAPK,CAOL,CAEZ,CAAC,CACK,IAEP,EAAO,SACN,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAA,IAAD,CAAK,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAW,CAAA,GACtD,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,GAAG,OAAO,SAAS,MAAM,MAAM,WAAW,MAAO,CAAE,WAAY,CAAE,WACpE,EAAO,MACJ,CAAA,CACN,CAAA,CAAA,CAED,GAET"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const SUPPLIER_RATING_MAX = 5;
|
|
2
2
|
export type SupplierRatingComponentKey = 'responseRate' | 'responseDelay' | 'completion';
|
|
3
|
-
export type SupplierRatingCompletionKey = 'profile' | '
|
|
3
|
+
export type SupplierRatingCompletionKey = 'profile' | 'location' | 'contacts' | 'legalBanking' | 'sector' | 'certificate';
|
|
4
4
|
export type SupplierRatingCompletion = Record<SupplierRatingCompletionKey, boolean>;
|
|
5
5
|
export type SupplierRating = {
|
|
6
6
|
/** Overall note out of 5. Absent when insufficientData is true. */
|
|
@@ -24,19 +24,19 @@ var u = 5, d = {
|
|
|
24
24
|
},
|
|
25
25
|
completion: {
|
|
26
26
|
profile: "Profil (photo et description)",
|
|
27
|
-
|
|
27
|
+
location: "Localisation",
|
|
28
|
+
contacts: "Contact",
|
|
28
29
|
legalBanking: "Coordonnées légales et bancaires",
|
|
29
30
|
sector: "Secteur d'activité",
|
|
30
|
-
certificate: "Certificat"
|
|
31
|
-
productInterest: "Intérêt produit"
|
|
31
|
+
certificate: "Certificat"
|
|
32
32
|
}
|
|
33
33
|
}, f = [
|
|
34
34
|
"profile",
|
|
35
|
-
"
|
|
35
|
+
"location",
|
|
36
|
+
"contacts",
|
|
36
37
|
"legalBanking",
|
|
37
38
|
"sector",
|
|
38
|
-
"certificate"
|
|
39
|
-
"productInterest"
|
|
39
|
+
"certificate"
|
|
40
40
|
];
|
|
41
41
|
function p(e) {
|
|
42
42
|
return e.toFixed(1).replace(".", ",");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupplierRatingBreakdown.js","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon, Text } from '~/components'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nexport type SupplierRatingComponentKey = 'responseRate' | 'responseDelay' | 'completion'\n\nexport type SupplierRatingCompletionKey =\n | 'profile'\n | 'locationContacts'\n | 'legalBanking'\n | 'sector'\n | 'certificate'\n | 'productInterest'\n\nexport type SupplierRatingCompletion = Record<SupplierRatingCompletionKey, boolean>\n\nexport type SupplierRating = {\n /** Overall note out of 5. Absent when insufficientData is true. */\n overall?: number\n /** Response-rate sub-score, 0..1 (note calc only). Absent when insufficientData is true. */\n responseRateScore?: number\n /** Response-delay sub-score, 0..1 (note calc + colours the delay row). Absent when insufficientData is true. */\n responseDelayScore?: number\n /** Average response delay in MINUTES, for display. Absent when insufficientData is true. */\n responseDelayMinutes?: number\n /** Account-completion sub-score, 0..1. Always present. */\n completionScore: number\n /** True when the supplier has too few interactions for a reliable note. */\n insufficientData: boolean\n /** Completion checklist shown in the breakdown. */\n completion: SupplierRatingCompletion\n}\n\nexport type SupplierRatingLabels = {\n title: string\n /** Neutral state shown instead of a note when data is insufficient. */\n insufficientData: string\n /** Section heading above the sub-scores. */\n componentsTitle: string\n /** Section heading above the completion checklist. */\n completionTitle: string\n /** Value shown when a component has no data yet (e.g. \"—\"). */\n notAvailable: string\n /** Unit suffixes for the average response-delay value. */\n units: { minutes: string; hours: string; days: string }\n components: Record<SupplierRatingComponentKey, string>\n completion: Record<SupplierRatingCompletionKey, string>\n footer?: string\n}\n\nexport const DEFAULT_SUPPLIER_RATING_LABELS: SupplierRatingLabels = {\n title: 'Note fournisseur',\n insufficientData: 'Non noté',\n componentsTitle: 'Détail de la note',\n completionTitle: 'Complétion du compte',\n notAvailable: '—',\n units: { minutes: 'min', hours: 'h', days: 'j' },\n components: {\n responseRate: 'Taux de réponse',\n responseDelay: 'Délai de réponse',\n completion: 'Complétion du compte',\n },\n completion: {\n profile: 'Profil (photo et description)',\n locationContacts: 'Localisation et contact',\n legalBanking: 'Coordonnées légales et bancaires',\n sector: \"Secteur d'activité\",\n certificate: 'Certificat',\n productInterest: 'Intérêt produit',\n },\n}\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'locationContacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n 'productInterest',\n]\n\nexport function formatOverall(overall: number): string {\n return overall.toFixed(1).replace('.', ',')\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units']): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${days.toFixed(1).replace('.', ',')} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const labels: SupplierRatingLabels = {\n ...DEFAULT_SUPPLIER_RATING_LABELS,\n ...labelsProp,\n units: { ...DEFAULT_SUPPLIER_RATING_LABELS.units, ...labelsProp?.units },\n components: { ...DEFAULT_SUPPLIER_RATING_LABELS.components, ...labelsProp?.components },\n completion: { ...DEFAULT_SUPPLIER_RATING_LABELS.completion, ...labelsProp?.completion },\n }\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units) : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;;;AAKA,IAAa,IAAsB,GAgDtB,IAAuD;CAClE,OAAO;CACP,kBAAkB;CAClB,iBAAiB;CACjB,iBAAiB;CACjB,cAAc;CACd,OAAO;EAAE,SAAS;EAAO,OAAO;EAAK,MAAM;CAAI;CAC/C,YAAY;EACV,cAAc;EACd,eAAe;EACf,YAAY;CACd;CACA,YAAY;EACV,SAAS;EACT,kBAAkB;EAClB,cAAc;EACd,QAAQ;EACR,aAAa;EACb,iBAAiB;CACnB;AACF,GAEM,IAAkD;CACtD;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,EAAc,GAAyB;CACrD,OAAO,EAAQ,QAAQ,CAAC,EAAE,QAAQ,KAAK,GAAG;AAC5C;AAGA,SAAgB,EAAoB,GAAiB,GAA8C;CACjG,IAAI,IAAU,IAAI,OAAO,GAAG,KAAK,MAAM,CAAO,EAAE,GAAG,EAAM;CACzD,IAAM,IAAQ,IAAU;CAGxB,OAFI,IAAQ,KAAW,GAAG,KAAK,MAAM,CAAK,EAAE,GAAG,EAAM,UAE9C,IADM,IAAQ,IACN,QAAQ,CAAC,EAAE,QAAQ,KAAK,GAAG,EAAE,GAAG,EAAM;AACvD;AA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AA,CACC;OA1BK,EAAI,GA0BT,CACT,CACK;;GAER,kBAAC,GAAD;IAAK,GAAE;IAAM,IAAG;IAAW,IAAG;GAAW,CAAA;GAEzC,kBAAC,GAAD;IAAQ,YAAW;IAAU,KAAI;cAAjC,CACE,kBAAC,GAAD;KAAM,IAAG;KAAO,UAAS;KAAU,YAAW;KAAO,OAAM;eACxD,EAAO;IACJ,CAAA,GACL,EAAiB,KAAI,MAAO;KAC3B,IAAM,IAAO,EAAO,WAAW;KAC/B,OACE,kBAAC,GAAD;MAAkB,YAAW;MAAS,KAAI;gBAA1C,CACE,kBAAC,GAAD;OAAM,MAAK;OAAK,OAAO,IAAO,gBAAgB;OAAY,YAAW;iBAC3D,EAAP,IAAQ,IAAsB,GAAvB,CAAkB,CAAkB;MACxC,CAAA,GACN,kBAAC,GAAD;OAAM,IAAG;OAAO,UAAS;OAAU,OAAO,IAAO,aAAa;iBAC3D,EAAO,WAAW;MACf,CAAA,CACA;QAPK,CAOL;IAEZ,CAAC,CACK;;GAEP,EAAO,UACN,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;IAAK,GAAE;IAAM,IAAG;IAAW,IAAG;IAAU,IAAG;GAAW,CAAA,GACtD,kBAAC,GAAD;IAAM,IAAG;IAAO,UAAS;IAAM,OAAM;IAAW,OAAO,EAAE,YAAY,EAAE;cACpE,EAAO;GACJ,CAAA,CACN,EAAA,CAAA;EAED;;AAET"}
|
|
1
|
+
{"version":3,"file":"SupplierRatingBreakdown.js","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon, Text } from '~/components'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nexport type SupplierRatingComponentKey = 'responseRate' | 'responseDelay' | 'completion'\n\nexport type SupplierRatingCompletionKey =\n | 'profile'\n | 'location'\n | 'contacts'\n | 'legalBanking'\n | 'sector'\n | 'certificate'\n\nexport type SupplierRatingCompletion = Record<SupplierRatingCompletionKey, boolean>\n\nexport type SupplierRating = {\n /** Overall note out of 5. Absent when insufficientData is true. */\n overall?: number\n /** Response-rate sub-score, 0..1 (note calc only). Absent when insufficientData is true. */\n responseRateScore?: number\n /** Response-delay sub-score, 0..1 (note calc + colours the delay row). Absent when insufficientData is true. */\n responseDelayScore?: number\n /** Average response delay in MINUTES, for display. Absent when insufficientData is true. */\n responseDelayMinutes?: number\n /** Account-completion sub-score, 0..1. Always present. */\n completionScore: number\n /** True when the supplier has too few interactions for a reliable note. */\n insufficientData: boolean\n /** Completion checklist shown in the breakdown. */\n completion: SupplierRatingCompletion\n}\n\nexport type SupplierRatingLabels = {\n title: string\n /** Neutral state shown instead of a note when data is insufficient. */\n insufficientData: string\n /** Section heading above the sub-scores. */\n componentsTitle: string\n /** Section heading above the completion checklist. */\n completionTitle: string\n /** Value shown when a component has no data yet (e.g. \"—\"). */\n notAvailable: string\n /** Unit suffixes for the average response-delay value. */\n units: { minutes: string; hours: string; days: string }\n components: Record<SupplierRatingComponentKey, string>\n completion: Record<SupplierRatingCompletionKey, string>\n footer?: string\n}\n\nexport const DEFAULT_SUPPLIER_RATING_LABELS: SupplierRatingLabels = {\n title: 'Note fournisseur',\n insufficientData: 'Non noté',\n componentsTitle: 'Détail de la note',\n completionTitle: 'Complétion du compte',\n notAvailable: '—',\n units: { minutes: 'min', hours: 'h', days: 'j' },\n components: {\n responseRate: 'Taux de réponse',\n responseDelay: 'Délai de réponse',\n completion: 'Complétion du compte',\n },\n completion: {\n profile: 'Profil (photo et description)',\n location: 'Localisation',\n contacts: 'Contact',\n legalBanking: 'Coordonnées légales et bancaires',\n sector: \"Secteur d'activité\",\n certificate: 'Certificat',\n },\n}\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'location',\n 'contacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n]\n\nexport function formatOverall(overall: number): string {\n return overall.toFixed(1).replace('.', ',')\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units']): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${days.toFixed(1).replace('.', ',')} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const labels: SupplierRatingLabels = {\n ...DEFAULT_SUPPLIER_RATING_LABELS,\n ...labelsProp,\n units: { ...DEFAULT_SUPPLIER_RATING_LABELS.units, ...labelsProp?.units },\n components: { ...DEFAULT_SUPPLIER_RATING_LABELS.components, ...labelsProp?.components },\n completion: { ...DEFAULT_SUPPLIER_RATING_LABELS.completion, ...labelsProp?.completion },\n }\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units) : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;;;AAKA,IAAa,IAAsB,GAgDtB,IAAuD;CAClE,OAAO;CACP,kBAAkB;CAClB,iBAAiB;CACjB,iBAAiB;CACjB,cAAc;CACd,OAAO;EAAE,SAAS;EAAO,OAAO;EAAK,MAAM;CAAI;CAC/C,YAAY;EACV,cAAc;EACd,eAAe;EACf,YAAY;CACd;CACA,YAAY;EACV,SAAS;EACT,UAAU;EACV,UAAU;EACV,cAAc;EACd,QAAQ;EACR,aAAa;CACf;AACF,GAEM,IAAkD;CACtD;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,EA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