Files
klz-cables.com/.pnpm-store/v10/files/ed/7b9f800dd4536d822745b2a599947a227c8d2c9c3f3706451a792b87e23bb177b59829ccaaa96852be4c0b131df9b7a520e59d3cbeb0371c887221e8788da5
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
3.6 KiB
Plaintext

{"version":3,"file":"getVersionLabel.js","names":["getVersionLabel","currentLocale","currentlyPublishedVersion","latestDraftVersion","t","version","status","_status","publishedNewerThanDraft","updatedAt","name","label","pillStyle","isCurrentDraft","id","publishedInAnotherLocale","publishedLocale","isCurrentlyPublished"],"sources":["../../../../src/views/Version/VersionPillLabel/getVersionLabel.ts"],"sourcesContent":["import type { TFunction } from '@payloadcms/translations'\nimport type { Pill } from '@payloadcms/ui'\n\ntype Args = {\n currentLocale?: string\n currentlyPublishedVersion?: {\n id: number | string\n publishedLocale?: string\n updatedAt: string\n version: {\n updatedAt: string\n }\n }\n latestDraftVersion?: {\n id: number | string\n updatedAt: string\n }\n t: TFunction\n version: {\n id: number | string\n publishedLocale?: string\n version: { _status?: 'draft' | 'published'; updatedAt: string }\n }\n}\n\n/**\n * Gets the appropriate version label and version pill styling\n * given existing versions and the current version status.\n */\nexport function getVersionLabel({\n currentLocale,\n currentlyPublishedVersion,\n latestDraftVersion,\n t,\n version,\n}: Args): {\n label: string\n name: 'currentDraft' | 'currentlyPublished' | 'draft' | 'previouslyPublished' | 'published'\n pillStyle: Parameters<typeof Pill>[0]['pillStyle']\n} {\n const status = version.version._status\n\n if (status === 'draft') {\n const publishedNewerThanDraft =\n currentlyPublishedVersion?.updatedAt > latestDraftVersion?.updatedAt\n\n if (publishedNewerThanDraft) {\n return {\n name: 'draft',\n label: t('version:draft'),\n pillStyle: 'light',\n }\n }\n\n const isCurrentDraft = version.id === latestDraftVersion?.id\n\n return {\n name: isCurrentDraft ? 'currentDraft' : 'draft',\n label: isCurrentDraft ? t('version:currentDraft') : t('version:draft'),\n pillStyle: 'light',\n }\n }\n\n const publishedInAnotherLocale =\n status === 'published' && version.publishedLocale && currentLocale !== version.publishedLocale\n\n if (publishedInAnotherLocale) {\n return {\n name: 'currentDraft',\n label: t('version:currentDraft'),\n pillStyle: 'light',\n }\n }\n\n const isCurrentlyPublished =\n currentlyPublishedVersion && version.id === currentlyPublishedVersion.id\n\n return {\n name: isCurrentlyPublished ? 'currentlyPublished' : 'previouslyPublished',\n label: isCurrentlyPublished\n ? t('version:currentlyPublished')\n : t('version:previouslyPublished'),\n pillStyle: isCurrentlyPublished ? 'success' : 'light',\n }\n}\n"],"mappings":"AAyBA;;;GAIA,OAAO,SAASA,gBAAgB;EAC9BC,aAAa;EACbC,yBAAyB;EACzBC,kBAAkB;EAClBC,CAAC;EACDC;AAAO,CACF;EAKL,MAAMC,MAAA,GAASD,OAAA,CAAQA,OAAO,CAACE,OAAO;EAEtC,IAAID,MAAA,KAAW,SAAS;IACtB,MAAME,uBAAA,GACJN,yBAAA,EAA2BO,SAAA,GAAYN,kBAAA,EAAoBM,SAAA;IAE7D,IAAID,uBAAA,EAAyB;MAC3B,OAAO;QACLE,IAAA,EAAM;QACNC,KAAA,EAAOP,CAAA,CAAE;QACTQ,SAAA,EAAW;MACb;IACF;IAEA,MAAMC,cAAA,GAAiBR,OAAA,CAAQS,EAAE,KAAKX,kBAAA,EAAoBW,EAAA;IAE1D,OAAO;MACLJ,IAAA,EAAMG,cAAA,GAAiB,iBAAiB;MACxCF,KAAA,EAAOE,cAAA,GAAiBT,CAAA,CAAE,0BAA0BA,CAAA,CAAE;MACtDQ,SAAA,EAAW;IACb;EACF;EAEA,MAAMG,wBAAA,GACJT,MAAA,KAAW,eAAeD,OAAA,CAAQW,eAAe,IAAIf,aAAA,KAAkBI,OAAA,CAAQW,eAAe;EAEhG,IAAID,wBAAA,EAA0B;IAC5B,OAAO;MACLL,IAAA,EAAM;MACNC,KAAA,EAAOP,CAAA,CAAE;MACTQ,SAAA,EAAW;IACb;EACF;EAEA,MAAMK,oBAAA,GACJf,yBAAA,IAA6BG,OAAA,CAAQS,EAAE,KAAKZ,yBAAA,CAA0BY,EAAE;EAE1E,OAAO;IACLJ,IAAA,EAAMO,oBAAA,GAAuB,uBAAuB;IACpDN,KAAA,EAAOM,oBAAA,GACHb,CAAA,CAAE,gCACFA,CAAA,CAAE;IACNQ,SAAA,EAAWK,oBAAA,GAAuB,YAAY;EAChD;AACF","ignoreList":[]}