Files
klz-cables.com/.pnpm-store/v10/files/cf/47307ae93d28727d5d87baa7fbed6ef354eee47f06202e1ae8f5a93079982cacb16906a98756e66c789371461f7f103e6299e1008949f356f09668da9cdeb8
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

71 lines
1.9 KiB
Plaintext

import { traverseFields } from './traverseFields.js';
const baseAuthFields = [{
name: 'password',
type: 'text',
required: true
}, {
name: 'confirm-password',
type: 'text',
required: true
}];
/**
* Flattens the config fields into a map of field schemas
*/
export const buildClientFieldSchemaMap = args => {
const {
collectionSlug,
config,
globalSlug,
i18n,
payload,
schemaMap
} = args;
const clientSchemaMap = new Map();
if (collectionSlug) {
const matchedCollection = config.collections.find(collection => collection.slug === collectionSlug);
if (matchedCollection) {
let fieldsToSet = matchedCollection?.fields || [];
if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {
;
baseAuthFields[0].label = i18n.t('general:password');
baseAuthFields[1].label = i18n.t('authentication:confirmPassword');
// Place these fields _last_ to ensure they do not disrupt field paths in the field schema map
fieldsToSet = fieldsToSet.concat(baseAuthFields);
}
clientSchemaMap.set(collectionSlug, {
fields: fieldsToSet
});
traverseFields({
clientSchemaMap,
config,
fields: fieldsToSet,
i18n,
parentIndexPath: '',
parentSchemaPath: collectionSlug,
payload,
schemaMap
});
}
} else if (globalSlug) {
const matchedGlobal = config.globals.find(global => global.slug === globalSlug);
if (matchedGlobal) {
clientSchemaMap.set(globalSlug, {
fields: matchedGlobal.fields
});
traverseFields({
clientSchemaMap,
config,
fields: matchedGlobal.fields,
i18n,
parentIndexPath: '',
parentSchemaPath: globalSlug,
payload,
schemaMap
});
}
}
return {
clientFieldSchemaMap: clientSchemaMap
};
};
//# sourceMappingURL=index.js.map