# payload-fields — Agent usage Configure a coding agent for @nexload-sdk/payload-fields. **Topic:** agents **Package:** `@nexload-sdk/payload-fields` v4.1.0 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/payload-fields/agents/ ## Install matching skills Install the skills whose triggers match the task. ### payload-fields-core [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/core/SKILL.md) ```text Use when integrating or reviewing the overall @nexload-sdk/payload-fields factory architecture, including options-object compatibility, protected field names/types/components, safe overrides, hook composition, Payload Import Map subpaths, server versus Admin client boundaries, plugin registration decisions, major-version migration, or package-wide validation. Use a specialized sibling for one slug, Jalali, or money contract. ``` ```bash npx skills add gecut/nexload-sdk --skill payload-fields-core ``` ### payload-fields-slug [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/slug/SKILL.md) ```text Use when adding, debugging, migrating, or reviewing @nexload-sdk/payload-fields managed slugs, including the slug/lock tuple and spread usage, Unicode/Persian normalization, lock and localization synchronization, nested source paths, regeneration on source changes, source clearing and manual edits, protected Admin wiring, or registered server-side generator authentication, access, input validation, and final normalization. ``` ```bash npx skills add gecut/nexload-sdk --skill payload-fields-slug ``` ### payload-fields-jalali-date [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/jalali-date/SKILL.md) ```text Use when adding, migrating, debugging, or reviewing @nexload-sdk/payload-fields Jalali date behavior, including native ISO persistence, Persian presentation, display timezone boundaries, dayOnly/dayAndTime/timeOnly/monthOnly picker modes, canonical local noon, Jalali month normalization, null/clear behavior, virtual Jalali timestamps, Admin UI limitations, or date-focused tests. ``` ```bash npx skills add gecut/nexload-sdk --skill payload-fields-jalali-date ``` ### payload-fields-money [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/money/SKILL.md) ```text Use when adding, migrating, debugging, or reviewing @nexload-sdk/payload-fields money behavior, including integer minor-unit persistence and APIs, explicit major-unit parsing, IRR/IRT or custom currency fraction digits, Persian/Arabic numeric input, safe integers and precision, negative policy, min/max bounds, display formatting, consumer validation order, Admin behavior, or money data migration. ``` ```bash npx skills add gecut/nexload-sdk --skill payload-fields-money ``` ### payload-fields-iranian-fields [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/iranian-fields/SKILL.md) ```text Use when adding or reviewing the Iranian contact, identity, bank, address, search-key, LTR text, or sort-order factories of @nexload-sdk/payload-fields in a Payload collection - iranMobileField, iranLandlineField, nationalCodeField, legalIdField, postalCodeField, bankCardField, shebaField, iranAddressField, searchKeyField, ltrTextField, sortOrderField - including stored canonical values, default field names, storage format choice, uniqueness, Persian search queries, and backfill. Use a sibling skill for slug, Jalali date, or money fields, and the persian skill for the validators themselves outside Payload. ``` ```bash npx skills add gecut/nexload-sdk --skill payload-fields-iranian-fields ``` ## Project AGENTS.md ```markdown For @nexload-sdk/payload-fields, load payload-fields-core when its trigger matches. Read the package bundle and check public exports against the installed version before editing. ``` ## Package context [Scoped Markdown bundle](/nexload-sdk/packages/payload-fields/llms.txt). ## Prompts ```text Edit Jalali dates, slugs and prices in Payload Admin. Use @nexload-sdk/payload-fields and payload-fields-core. Inspect the installed version and show a minimal typed example for my project. ``` ```text Review my @nexload-sdk/payload-fields integration against the optimization page. Identify the relevant source for each finding and one test for the highest-risk behavior. ``` --- # API Reference & Compatibility Public API symbol reference, factory function signatures, and compatibility matrix for Payload Fields. **Topic:** api **Package:** `@nexload-sdk/payload-fields` v4.1.0 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/payload-fields/api/ The complete public API symbol inventory is generated automatically from package source exports: ## Functions ### `bankCardField` ```ts bankCardField(options?: BankCardFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/bank/index.ts#L16) ### `formatJalaliDate` ```ts formatJalaliDate(value: JalaliDateValue, options?: JalaliDateDisplayOptions) => string | null ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/format-date.ts#L11) ### `formatMoney` ```ts formatMoney(value: number | null | undefined, currency: MoneyCurrency, display?: MoneyDisplayOptions) => string | null ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L82) ### `iranAddressField` ```ts iranAddressField(options?: IranAddressFieldOptions) => GroupField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/address/index.ts#L17) ### `iranLandlineField` ```ts iranLandlineField(options?: IranLandlineFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/contact/index.ts#L32) ### `iranMobileField` ```ts iranMobileField(options?: IranMobileFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/contact/index.ts#L14) ### `jalaliDateField` ```ts jalaliDateField(options: JalaliDateFieldOptions) => DateField ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L67) ### `jalaliDateRangeField` ```ts jalaliDateRangeField(options?: { start?: string; end?: string; pickerAppearance?: JalaliPickerAppearance; timeZone?: string; required?: boolean; labels?: { start?: { fa: string; en: string; }; end?: { fa: string; en: string; }; }; }) => RowField ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L142) ### `legalIdField` ```ts legalIdField(options?: LegalIdFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L34) ### `ltrTextField` ```ts ltrTextField(options: LtrTextFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/common/index.ts#L28) ### `moneyField` ```ts moneyField(options: MoneyFieldOptions) => NumberField ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L98) ### `nationalCodeField` ```ts nationalCodeField(options?: NationalCodeFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L18) ### `parseMoneyToMinorUnits` ```ts parseMoneyToMinorUnits(input: string, currency: MoneyCurrency) => number ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L56) ### `payloadFieldsPlugin` ```ts payloadFieldsPlugin(options?: PayloadFieldsPluginOptions) => Plugin ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L132) ### `postalCodeField` ```ts postalCodeField(options?: PostalCodeFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L50) ### `resolveCurrency` ```ts resolveCurrency(currency: MoneyCurrency) => MoneyCurrencyDefinition ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L38) ### `searchKeyField` ```ts searchKeyField(o: SearchKeyFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/search` Hidden, read-only, indexed text field that maintains a normalized Persian search key from the given source fields on every create/update. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/search/index.ts#L15) ### `shebaField` ```ts shebaField(options?: ShebaFieldOptions) => TextField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/bank/index.ts#L32) ### `slugField` ```ts slugField(options?: SlugFieldOptions) => SlugFieldResult ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/index.ts#L20) ### `sortOrderField` ```ts sortOrderField(options?: SortOrderFieldOptions) => NumberField ``` **Exported from:** `@nexload-sdk/payload-fields` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/common/index.ts#L63) ### `toStoredJalaliInstant` ```ts toStoredJalaliInstant(picked: { year: number; month: number; day: number; hour?: number; minute?: number; }, appearance: JalaliPickerAppearance, timeZone?: string) => string ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L33) ### `withJalaliTimestamps` ```ts withJalaliTimestamps(fields: T, options?: JalaliTimestampsOptions) => Field[] ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public function exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L178) ## Constants ### `FormattedCell` ```ts FormattedCell({ kind, ...props }: DefaultCellComponentProps & { kind: ValidatedTextKind; }) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/formatted-cell` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/formatted-cell.tsx#L12) ### `IRR` ```ts IRR: Readonly ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L35) ### `IRT` ```ts IRT: Readonly ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L36) ### `JalaliDateCell` ```ts JalaliDateCell({ display, ...props }: DefaultCellComponentProps & { display?: JalaliDateDisplayOptions; }) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/jalali-date-cell` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/jalali-date-cell.tsx#L9) ### `JalaliDateFieldComponent` ```ts JalaliDateFieldComponent({ field, path: providedPath, appearance, display, timeZone, readOnly, }: DateFieldClientProps & Props) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/jalali-date-field` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/jalali-date-field.tsx#L61) ### `MoneyCell` ```ts MoneyCell({ currency, display, displayCurrency, ...props }: DefaultCellComponentProps & Props) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/money-cell` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/money-cell.tsx#L12) ### `MoneyFieldComponent` ```ts MoneyFieldComponent({ field, path, currency, display, displayCurrency, readOnly }: NumberFieldClientProps & Props) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/money-field` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/money-field.tsx#L13) ### `PAYLOAD_FIELDS_PLUGIN_ORDER` ```ts PAYLOAD_FIELDS_PLUGIN_ORDER: 900 ``` **Exported from:** `@nexload-sdk/payload-fields` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L130) ### `SlugFieldComponent` ```ts SlugFieldComponent({ field, path, source, lockName, generator, readOnly, }: TextFieldClientProps & Props) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/slug-field` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/slug-field.tsx#L14) ### `ValidatedTextFieldComponent` ```ts ValidatedTextFieldComponent({ field, path, readOnly, kind, }: TextFieldClientProps & { kind: ValidatedTextKind; }) => JSX.Element ``` **Exported from:** `@nexload-sdk/payload-fields/admin/validated-text-field` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/admin/validated-text-field.tsx#L10) ### `formatSlug` ```ts formatSlug(value: string) => string ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/format-slug.ts#L37) ### `formatSlugHook` ```ts formatSlugHook(options: SlugHookOptions) => FieldHook ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/format-slug.ts#L39) ### `schemaFields` ```ts schemaFields: SchemaFields ``` **Exported from:** `@nexload-sdk/payload-fields/schema` Public constant exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/schema/index.ts#L139) ## Types ### `BankCardFieldOptions` ```ts type BankCardFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/bank/index.ts#L14) ### `FieldOptions` ```ts type FieldOptions = { name?: string; label?: { fa: string; en: string }; required?: boolean; unique?: boolean; overrides?: Partial; }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/common/index.ts#L9) ### `IranAddressFieldOptions` ```ts type IranAddressFieldOptions = { name?: string; label?: { fa: string; en: string }; required?: boolean; recipient?: boolean; overrides?: Partial; }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/address/index.ts#L9) ### `IranLandlineFieldOptions` ```ts type IranLandlineFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/contact/index.ts#L30) ### `IranMobileFieldOptions` ```ts type IranMobileFieldOptions = FieldOptions & { storage?: "national" | "e164"; }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/contact/index.ts#L10) ### `JalaliDateDisplayOptions` ```ts type JalaliDateDisplayOptions = { dateStyle?: "short" | "medium" | "long" | "full" timeStyle?: "short" | "medium" digits?: "persian" | "latin" timeZone?: string }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/format-date.ts#L4) ### `JalaliDateFieldOptions` ```ts type JalaliDateFieldOptions = { name: string pickerAppearance?: JalaliPickerAppearance display?: JalaliDateDisplayOptions timeZone?: string min?: string max?: string label?: { fa: string, en: string } required?: boolean overrides?: Partial }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L15) ### `JalaliDateValue` ```ts type JalaliDateValue = Date | string | number | null | undefined; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/format-date.ts#L3) ### `JalaliPickerAppearance` ```ts type JalaliPickerAppearance = | "dayOnly" | "dayAndTime" | "timeOnly" | "monthOnly"; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/picker-types.ts#L1) ### `JalaliTimestampsOptions` ```ts type JalaliTimestampsOptions = { createdAt?: boolean updatedAt?: boolean display?: JalaliDateDisplayOptions overrides?: { createdAt?: Partial, updatedAt?: Partial } }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/date` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/date/index.ts#L26) ### `LegalIdFieldOptions` ```ts type LegalIdFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L32) ### `LtrTextFieldOptions` ```ts type LtrTextFieldOptions = { name: string; label?: { fa: string; en: string }; required?: boolean; unique?: boolean; monospace?: boolean; minLength?: number; maxLength?: number; overrides?: Partial; }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/common/index.ts#L17) ### `MoneyCurrency` ```ts type MoneyCurrency = "IRR" | "IRT" | MoneyCurrencyDefinition; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L15) ### `MoneyCurrencyDefinition` ```ts type MoneyCurrencyDefinition = { code: string label: string fractionDigits: number }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L10) ### `MoneyDisplayOptions` ```ts type MoneyDisplayOptions = { locale?: string digits?: "persian" | "latin" grouping?: boolean showCurrency?: boolean }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L16) ### `MoneyFieldOptions` ```ts type MoneyFieldOptions = { name: string currency: MoneyCurrency minMinorUnits?: number maxMinorUnits?: number allowNegative?: boolean display?: MoneyDisplayOptions displayCurrency?: "IRR" | "IRT" label?: { fa: string, en: string } required?: boolean overrides?: Partial }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/money` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/money/index.ts#L22) ### `NationalCodeFieldOptions` ```ts type NationalCodeFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L16) ### `PayloadFieldsPluginOptions` ```ts type PayloadFieldsPluginOptions = { slugGenerators?: Record, generateSlugAccess?: SlugGenerationAccess }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L12) ### `PostalCodeFieldOptions` ```ts type PostalCodeFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/identity/index.ts#L48) ### `SearchKeyFieldOptions` ```ts type SearchKeyFieldOptions = { name: string; sources: string[]; localized?: boolean; }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/search` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/search/index.ts#L5) ### `ShebaFieldOptions` ```ts type ShebaFieldOptions = FieldOptions; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/bank/index.ts#L30) ### `SlugFieldOptions` ```ts type SlugFieldOptions = { unique?: boolean name?: string lockName?: string source?: string generator?: string regenerateOnSourceChange?: boolean overrides?: { slug?: Partial, lock?: Partial } }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/index.ts#L8) ### `SlugFieldResult` ```ts type SlugFieldResult = readonly [TextField, CheckboxField]; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/index.ts#L18) ### `SlugGenerationAccess` ```ts type SlugGenerationAccess = (context: SlugGeneratorContext) => boolean | Promise; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L11) ### `SlugGenerator` ```ts type SlugGenerator = (input: SlugGeneratorInput, context: SlugGeneratorContext) => Promise; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L10) ### `SlugGeneratorContext` ```ts type SlugGeneratorContext = { req: PayloadRequest }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L9) ### `SlugGeneratorInput` ```ts type SlugGeneratorInput = { sourceValue: string, currentSlug?: string }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/plugin.ts#L8) ### `SlugHookOptions` ```ts type SlugHookOptions = { name: string lockName: string source: string regenerateOnSourceChange: boolean }; ``` **Exported from:** `@nexload-sdk/payload-fields`, `@nexload-sdk/payload-fields/slug` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/slug/format-slug.ts#L5) ### `SortOrderFieldOptions` ```ts type SortOrderFieldOptions = { name?: string; label?: { fa: string; en: string }; overrides?: Partial; }; ``` **Exported from:** `@nexload-sdk/payload-fields` Public type exported by @nexload-sdk/payload-fields. [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/common/index.ts#L57) *** ## Exported Factories Summary | Function | Output | Description | |---|---|---| | `slugField(options)` | `[TextField, CheckboxField]` | Returns `[slug, slugLock]` fields with Unicode slugifier, collision suffixing (`-2`, `-3`), and sync logic. | | `jalaliDateField(options)` | `DateField` | Returns a Payload `date` field configured with the Jalali solar calendar Admin component and timezone stability. | | `jalaliDateRangeField(options)` | `RowField` | Returns a paired row containing `startsAt` and `endsAt` Jalali date fields with order validation. | | `withJalaliTimestamps(fields, options)` | `Field[]` | Appends virtual read-only `createdAtJalali` and `updatedAtJalali` fields to an existing field array. | | `moneyField(options)` | `NumberField` | Returns an integer `number` field configured with formatted currency Admin component and cell. | | `iranMobileField(options)` | `TextField` | Returns a `text` field validating Iranian mobile numbers (`09XXXXXXXXX` or `+989...`). | | `iranLandlineField(options)` | `TextField` | Returns a `text` field validating Iranian landlines with province area codes. | | `nationalCodeField(options)` | `TextField` | Returns a `text` field with Iranian national code checksum validation. | | `legalIdField(options)` | `TextField` | Returns a `text` field with Iranian legal entity ID checksum validation. | | `postalCodeField(options)` | `TextField` | Returns a `text` field validating 10-digit Iranian postal codes. | | `bankCardField(options)` | `TextField` | Returns a `text` field with 16-digit bank card Luhn checksum validation. | | `shebaField(options)` | `TextField` | Returns a `text` field with Iranian IBAN (Sheba) ISO 7064 checksum validation. | | `ltrTextField(options)` | `TextField` | Returns a `text` field with forced LTR direction and optional monospace styling. | | `sortOrderField(options)` | `NumberField` | Returns an indexed non-negative integer `number` field in the sidebar for sorting. | | `iranAddressField(options)` | `GroupField` | Returns a `group` field containing province (31 Iranian provinces), city, line, postal code, and optional recipient. | | `payloadFieldsPlugin(options)` | `Plugin` | Registers server slug generator endpoints and `beforeOperation` string money normalization. | *** ## Schema Adapter (`@nexload-sdk/payload-fields/schema`) `schemaFields` wraps field factories into `field.native(...)` definitions for `@nexload-sdk/payload-schema`: | Method | Target Factory | Zod Schema | |---|---|---| | `schemaFields.iranMobile(options)` | `iranMobileField` | `iranMobileSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.iranLandline(options)` | `iranLandlineField` | `iranLandlineSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.nationalCode(options)` | `nationalCodeField` | `nationalCodeSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.legalId(options)` | `legalIdField` | `legalIdSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.postalCode(options)` | `postalCodeField` | `postalCodeSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.bankCard(options)` | `bankCardField` | `cardNumberSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.sheba(options)` | `shebaField` | `shebaSchema` from `@nexload-sdk/persian/zod` | | `schemaFields.ltrText(options)` | `ltrTextField` | `z.string()` with optional min/max lengths | | `schemaFields.sortOrder(options)` | `sortOrderField` | `z.number().int().nonnegative()` | | `schemaFields.money(options)` | `moneyField` | `z.number().int().safe()` (non-negative by default) | | `schemaFields.jalaliDate(options)` | `jalaliDateField` | `z.iso.datetime({ offset: true })` | | `schemaFields.slug(options)` | `slugField` | `{ slug: z.string(), slugLock: z.boolean() }` | > Note: `iranAddressField` and `jalaliDateRangeField` are not included in `./schema` in 4.0. *** ## Compatibility Helpers | Helper | Type | Description | |---|---|---| | `formatSlug` | `(value: string) => string` | Canonical slugifier alias of `slugify` from `@nexload-sdk/persian/text`. | | `formatJalaliDate` | `(value, options) => string \| null` | Formats an ISO datetime or Date into a Jalali string. | | `toStoredJalaliInstant` | `(picked, appearance, timeZone?) => string` | Converts picked Jalali components to an ISO instant (noon for date-only modes). | | `formatMoney` | `(value, currency, display?) => string \| null` | Formats integer minor units into currency strings. | | `parseMoneyToMinorUnits` | `(input, currency) => number` | Parses string or major-unit text into safe integer minor units. | | `IRR` | `MoneyCurrencyDefinition` | Iranian Rial currency definition. | | `IRT` | `MoneyCurrencyDefinition` | Iranian Toman currency definition. | | `resolveCurrency` | `(currency: MoneyCurrency) => MoneyCurrencyDefinition` | Resolves string or object currency to canonical definition. | *** ## Runtime Compatibility Matrix | Runtime / Engine | Version Requirement | Verification Status | |---|---|---| | **Node.js** | `>=20.9.0` | Verified on Node 20 & 22 | | **Payload CMS** | `>=3.85.0 <4.0.0` | Verified on Payload 3.86.0 | | **React / React-DOM** | `^19.0.0` | Required for Payload 3 Admin UI | | **Module Format** | ESM only | Server and Admin Import Map safe | | **Side Effects** | `false` | Fully tree-shakeable | --- # Production Guides & Recipes Deep recipes for managed Unicode slugs, Jalali date ranges, integer money fields, Iranian contact & identity, addresses, and schema integration. **Topic:** guides **Package:** `@nexload-sdk/payload-fields` v4.1.0 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/payload-fields/guides/ ## Managed Unicode Slugs The `slugField` factory generates clean, URL-friendly slugs while preserving non-Latin scripts (such as Persian and Arabic): ```ts import { slugField } from "@nexload-sdk/payload-fields"; const fields = [ { name: "title", type: "text", required: true }, ...slugField({ source: "title", overrides: { slug: { admin: { position: "sidebar", description: "Auto-generated from title. Unlock to manually edit.", }, }, }, }), ]; ``` ### Uniqueness & Collision Suffixing * Slugs are unique by default (`unique: true`). When creating a document whose generated slug already exists, the factory automatically searches for non-colliding suffixes (`-2`, `-3`, up to `-50`). * **Top-level only:** Uniqueness collision queries apply only to top-level fields. Slugs placed inside nested arrays or groups receive character normalization only. * If migrating an existing database with duplicate slug values, resolve duplicates before creating unique indexes or pass `unique: false`. ### Slug Locking Mechanism * When a document is created, `slugLock` defaults to `true`. * Editing the source field updates `slug` while locked. * Once locked documents are published, unlocking allows manual editing. While unlocked, source edits never change the slug. A locked slug follows source edits unless you pass `regenerateOnSourceChange: false`. *** ## Jalali (Persian Solar) Datepicker & Date Ranges Store standard ISO datetimes while providing a rich Persian Solar calendar widget in Payload Admin: ```ts import { jalaliDateField, jalaliDateRangeField, withJalaliTimestamps } from "@nexload-sdk/payload-fields"; const fields = [ jalaliDateField({ name: "eventDate", pickerAppearance: "dayAndTime", // Options: "dayOnly" | "dayAndTime" | "monthOnly" | "timeOnly" timeZone: "Asia/Tehran", // Default timezone }), jalaliDateRangeField({ start: "registrationStart", end: "registrationEnd", }), ]; // Adds virtual read-only createdAtJalali and updatedAtJalali fields export const collectionFields = withJalaliTimestamps(fields); ``` ### Date Storage Guarantees * The database always stores standard UTC ISO 8601 strings (e.g. `2026-07-24T08:30:00.000Z`). * For `dayOnly` and `monthOnly`, dates store canonical noon (`12:00:00`) in `timeZone` (default `Asia/Tehran`). This prevents date shifts when users view or edit entries from different browser timezones. * In `jalaliDateRangeField`, the end field includes server-side validation ensuring that the end date falls on or after the start date. *** ## Safe-Integer Money Fields Prevent floating point inaccuracies by storing currency in integer minor units: ```ts import { moneyField } from "@nexload-sdk/payload-fields"; const fields = [ moneyField({ name: "unitPrice", currency: "IRT", // Stored in Tomans minMinorUnits: 0, maxMinorUnits: 10_000_000_000, }), moneyField({ name: "rialPrice", currency: "IRR", // Stored in Rials displayCurrency: "IRT", // Displayed as Tomans in Admin UI and list cell }), ]; ``` ### API Strings & Plugin Requirement * In the Admin UI, users type numbers with Persian or Latin digits and thousands grouping. * In REST, GraphQL, and Local API calls, values are stored as integers. * **Critical Requirement:** `payloadFieldsPlugin()` is **REQUIRED** if money values are sent as strings through REST or Local API (e.g. `"۱۲۳٬۴۵۶"` or `"123456"`). Payload's core runs `parseFloat()` on number fields before field hooks run, which corrupts Persian digits. The plugin registers a `beforeOperation` hook that normalizes string values to safe integers before Payload processes them. *** ## Iranian Contact & Identity Fields Standardize phone numbers, national identification, postal codes, and banking fields: ```ts import { bankCardField, iranLandlineField, iranMobileField, legalIdField, nationalCodeField, postalCodeField, shebaField, } from "@nexload-sdk/payload-fields"; const fields = [ // Mobile: normalized to national 09XXXXXXXXX or E.164 +989XXXXXXXXX iranMobileField({ name: "mobile", storage: "national" }), // Landline: normalized with province area code iranLandlineField({ name: "phone" }), // National Code: 10 digits with checksum validation nationalCodeField({ name: "nationalCode" }), // Legal Entity ID: 11 digits with checksum validation legalIdField({ name: "companyId" }), // Postal Code: 10 digits postalCodeField({ name: "postalCode" }), // Bank Card: 16 digits with Luhn algorithm validation bankCardField({ name: "cardNumber" }), // Sheba (IBAN): 26 characters (IR...) with ISO 7064 validation shebaField({ name: "sheba" }), ]; ``` ### Validation & Localization * Values written through any API are normalized server-side in `beforeValidate` (Persian digits converted, dashes/spaces removed). * Validation errors are localized: admin sessions in `fa` (e.g. `fa-IR`) see Persian error messages; other languages see English error messages. * Admin list views automatically display formatted strings via `FormattedCell` (e.g. `۰۹۱۲ ۳۴۵ ۶۷۸۹`, `۶۰۳۷-۹۹۱۲-۳۴۵۶-۷۸۹۰`). *** ## Iranian Address Group Use `iranAddressField` to create a structured address group: ```ts import { iranAddressField } from "@nexload-sdk/payload-fields"; const fields = [ iranAddressField({ name: "shippingAddress", required: true, recipient: true, // Includes recipientName and recipientMobile fields }), ]; ``` * Province selection contains all 31 Iranian provinces with localized Persian and English labels. * Includes city, address line (textarea), and validated postal code. *** ## Search Key Field Use `searchKeyField` to maintain a hidden, read-only, indexed text field populated with `toSearchIndexText` from one or more source fields on create and update: ```ts import { searchKeyField } from "@nexload-sdk/payload-fields"; const fields = [ { name: "title", type: "text", required: true }, searchKeyField({ name: "searchKey", sources: ["title"], localized: true, }), ]; ``` *** ## Schema Adapter (`@nexload-sdk/payload-fields/schema`) When using `@nexload-sdk/payload-schema` to share validation contracts with frontend forms or RPC endpoints: ```ts import { defineEntity } from "@nexload-sdk/payload-schema"; import { schemaFields } from "@nexload-sdk/payload-fields/schema"; export const customerEntity = defineEntity({ name: "Customer", fields: { mobile: schemaFields.iranMobile(), nationalCode: schemaFields.nationalCode(), price: schemaFields.money({ currency: "IRT" }), birthDate: schemaFields.jalaliDate({ nullable: true }), ...schemaFields.slug({ source: "title" }), }, }); ``` > **Note:** `iranAddressField` and `jalaliDateRangeField` are not included in `./schema` in 4.0 because compound fields (groups and rows) require entity-level schema composition. *** ## Troubleshooting & Common Pitfalls ### 1. Custom Admin Controls Fallback to Plain Inputs If Payload Admin displays plain number or text inputs instead of the Jalali datepicker or formatted money input: * Regenerate Payload's Import Map by running: ```bash pnpm payload generate:importmap ``` * Ensure `@payloadcms/ui` and `payload` are `>=3.85.0 <4.0.0` and React is `^19.0.0`. ### 2. Money Strings Rejected by REST or Local API If sending string values like `"150000"` or `"۱۵۰٬۰۰۰"` fails validation or gets parsed as `NaN`: * Ensure `payloadFieldsPlugin()` is registered in your `payload.config.ts` plugins array. * The plugin interceptively normalizes string money values in `beforeOperation` before Payload's core `parseFloat()` runs. ### 3. Duplicate Slug Migration Errors If adding `slugField` to an existing collection throws a unique constraint database error: * Deduplicate existing documents before deploying the schema change, or temporarily configure `slugField({ unique: false })`. --- # Overview & Quick Start Semantic Payload field factories for Unicode slugs, Jalali dates, integer money, Iranian contact & identity fields, and addresses. **Topic:** overview **Package:** `@nexload-sdk/payload-fields` v4.1.0 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/payload-fields/ **Package:** `@nexload-sdk/payload-fields` **Workspace version:** `4.1.0` Production-grade semantic field factories and Admin integrations for Payload CMS. [npm](https://www.npmjs.com/package/@nexload-sdk/payload-fields) · [Source](https://github.com/gecut/nexload-sdk/tree/main/packages/payload-fields) `@nexload-sdk/payload-fields` provides production-hardened semantic field factories, Admin UI integrations, and validation for Payload CMS 3: 1. **Managed Unicode Slugs**: Collision-resistant (`-2`, `-3`), multi-lingual slug generation with an automatic lock toggle. 2. **Jalali Solar Dates & Ranges**: ISO datetime storage with interactive Persian Solar calendar datepickers and list cells (`Asia/Tehran` noon storage for date-only modes). 3. **Safe-Integer Money Fields**: Floating-point-free financial storage in integer minor units (Rials, Tomans) with formatted Admin UI inputs and currency conversion. 4. **Iranian Identity & Contact**: Checksum-validated national codes, legal IDs, postal codes, landlines, and mobile numbers (national or E.164 format). 5. **Banking & Utility Fields**: Bank card numbers with Luhn validation, Sheba IBANs, forced LTR inputs, and non-negative sort ordering. 6. **Iranian Address Group**: Comprehensive address group with 31 provinces, postal code normalization, and optional recipient details. 7. **Schema Adapter (`./schema`)**: Wrap fields as `field.native()` definitions for `@nexload-sdk/payload-schema`. *** ## 10-Second Code Snippet ```ts import { iranAddressField, iranMobileField, jalaliDateField, jalaliDateRangeField, moneyField, nationalCodeField, slugField, } from "@nexload-sdk/payload-fields"; import type { CollectionConfig } from "payload"; export const Customers: CollectionConfig = { slug: "customers", fields: [ { name: "name", type: "text", required: true }, // Spreads slug and slugLock fields ...slugField({ source: "name" }), // Persian solar calendar datepicker jalaliDateField({ name: "birthDate", pickerAppearance: "dayOnly" }), // Paired date range with start/end order validation jalaliDateRangeField({ start: "startsAt", end: "endsAt" }), // Stored as integer minor units (e.g. 150000) moneyField({ name: "credit", currency: "IRT", minMinorUnits: 0 }), // Normalized to national format (09123456789) iranMobileField({ name: "mobile", required: true }), // Validated 10-digit national code nationalCodeField({ name: "nationalCode" }), // Address group with province dropdown and postal code iranAddressField({ recipient: false }), ], }; ``` *** ## Installation & Peer Dependencies ```bash pnpm add @nexload-sdk/payload-fields payload react react-dom ``` If using the optional `./schema` adapter with `@nexload-sdk/payload-schema` and `zod`: ```bash pnpm add @nexload-sdk/payload-schema zod ``` ### Compatibility Requirements | Runtime / Dependency | Supported Range | Notes | |---|---|---| | **Node.js** | `>=20.9.0` | Required for Payload 3 server | | **Payload CMS** | `>=3.85.0 <4.0.0` | Core headless CMS | | **React / React-DOM** | `^19.0.1 \|\| ^19.1.2 \|\| ^19.2.1` | Matches Payload 3 Admin UI runtime | | **Module Format** | ESM only | Server & Admin Import Map safe | | **Optional Peers** | `@nexload-sdk/payload-schema` `>=2.0.0 <4.0.0`, `zod` `>=4.1.0 <5.0.0` | Only needed when importing `./schema` | *** ## Storage & Contract Rules ### 1. Slugs & SlugLock `slugField({ source: "title" })` returns an array of two Payload fields: `[slug, slugLock]`. * Slugs are unique by default (`unique: true`). Top-level slug collisions automatically receive numeric suffixes (`-2`, `-3`) in the active locale. * **Scope note:** Slug uniqueness collision resolution only applies to top-level slug fields. Slugs placed inside arrays or groups receive character formatting only. * `slugLock` defaults to `true`. When locked, changing the source field will not mutate an existing slug, protecting indexed URLs. ### 2. Jalali Dates & Ranges Dates are stored in the database as **standard ISO 8601 UTC strings** (e.g. `"2026-07-24T08:30:00.000Z"`). * For `dayOnly` and `monthOnly` appearances, dates store canonical local noon (`12:00:00`) in `timeZone` (default `Asia/Tehran`), preventing date shifting across client timezones. * `jalaliDateRangeField` groups two dates and validates that `endsAt >= startsAt`. ### 3. Money Values & Plugin Requirement Money values are stored strictly as **integer minor units** (e.g. `100,000 Tomans` is stored as `100000`). * **REST / Local API String Inputs:** `payloadFieldsPlugin()` is **REQUIRED** if money values are sent as strings (e.g. `"۱۲۳٬۴۵۶"` or `"123456"`). Payload core parses number-field strings with `parseFloat()` before field hooks run, corrupting Persian digits and thousands separators. The plugin's `beforeOperation` hook converts string values to safe integers before Payload parses them. Raw numbers work without the plugin. ### 4. Bilingual Validation Messages Validation messages follow the active admin language (`req.i18n.language` or `useTranslation()`): * Locales starting with `fa` (e.g. `fa`, `fa-IR`) receive Persian error messages. * All other locales receive English error messages (v3 was always Persian). ### 5. Schema Adapter Scope The `./schema` subpath exposes `schemaFields` for `@nexload-sdk/payload-schema`. In 4.0, `iranAddressField` and `jalaliDateRangeField` are not included in `./schema` (compound group/row schemas require entity-level composition). *** ## Quick Start: Adding Plugin for Slug Generators & String Money Register `payloadFieldsPlugin` in your Payload config: ```ts import { payloadFieldsPlugin, slugField } from "@nexload-sdk/payload-fields"; import { buildConfig } from "payload"; export default buildConfig({ collections: [ { slug: "products", fields: [ { name: "title", type: "text", required: true }, ...slugField({ source: "title", generator: "product" }), ], }, ], plugins: [ payloadFieldsPlugin({ slugGenerators: { product: async ({ sourceValue }) => { return `sku-${sourceValue.toLowerCase().replace(/\s+/g, "-")}`; }, }, }), ], }); ``` *** ## Next Steps * Explore [Production Guides & Recipes](./guides/) for advanced recipes on contact fields, address groups, and troubleshooting. * Check the [API Reference & Compatibility](./api/) for complete factory options and signatures. The field factories use [Persian utilities](/nexload-sdk/packages/persian/) for shared normalization and validation. ## Next steps [Optimization](./optimization/) [Agent usage](./agents/) --- # payload-fields — Optimization Production choices for @nexload-sdk/payload-fields. **Topic:** optimization **Package:** `@nexload-sdk/payload-fields` v4.1.0 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/payload-fields/optimization/ ## Normalize strings before field hooks Install payloadFieldsPlugin() when REST or Local API callers send money values as strings. It normalizes Persian digits and separators before Payload parses number fields. ## Send integers from numeric clients Pass minor-unit integers when the client already owns numeric conversion. ## Handle nested slug uniqueness Automatic collision suffixes apply only to top-level slugs. For slugs inside arrays, groups, or named tabs, use `unique: false` to avoid relying on suffixing. ## Order field plugins deliberately The plugin sees collections and globals present when it runs. Place plugins adding money fields before it, respecting its order of 900. ## Sources [Package guidance](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/README.md) · [Implementation](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-fields/src/index.ts). · [Matching skill](https://github.com/gecut/nexload-sdk/blob/main/skills/payload-fields/core/SKILL.md).