import react__default from 'react'; import { HttpTypes } from '@medusajs/types'; import { TFunction } from 'i18next'; export { T as TableAdapter, c as createTableAdapter } from './table-adapters-t63Kp7Hx.mjs'; import { FieldValues, UseFormReturn, FieldPath } from 'react-hook-form'; import { z } from 'zod'; import '@medusajs/ui'; type CellRenderer = (value: any, row: TData, column: HttpTypes.AdminColumn, t: TFunction) => react__default.ReactNode; type CellAlignment = "left" | "center" | "right"; /** * Render modes that ship with a built-in cell renderer. */ type BuiltInRenderMode = "text" | "handle" | "count" | "status" | "badges" | "date" | "datetime" | "timestamp" | "currency" | "number" | "boolean" | "id" | "email" | "phone" | "url" | "image" | "json" | "product_info" | "collection" | "variants" | "name" | "address" | "country_code" | "display_id" | "quantity"; /** * A render mode key. Built-in modes are suggested for autocomplete, but any * custom string is accepted. */ type RenderMode = BuiltInRenderMode | (string & {}); /** * A cell renderer plus the alignment it renders best at. */ type CellRendererDefinition = { render: CellRenderer; align?: CellAlignment; /** * Whether the data table shows a hover tooltip with the full value when this * cell's content is truncated. Set `false` for renderers that manage their * own overflow (e.g. they already wrap content in a tooltip). Defaults to * `true`. A column can override this via `metadata.truncate_tooltip`. */ truncateTooltip?: boolean; }; /** * Register a cell renderer for a render mode in the global registry. */ declare function defineCellRenderer(type: RenderMode, def: CellRendererDefinition): void; type DynamicSearchResultItem = { id: string; title: string; subtitle?: string; to: string; thumbnail?: string; value: string; }; type Platform = "Mac" | "Windows" | "Linux"; type Keys = { [key in Platform]?: string[]; }; type SearchEntityTransform = (item: TItem) => DynamicSearchResultItem; /** * The `t` signature handed to `groupLabel` functions. Intentionally wider than * i18next's `TFunction`: custom entities translate with keys the dashboard's * typed resources don't know about. */ type SearchLabelTranslator = (key: string, options?: Record) => string; /** * A "Jump to" entry for a search entity: a key sequence bound by the admin * shell that also appears in the search palette's navigation group. */ type SearchEntityShortcut = { keys: Keys; /** * Label for the "Jump to" entry. Falls back to the entity's group label. */ label?: string | ((t: SearchLabelTranslator) => string); /** * Whether the entry is grouped with the page or the settings shortcuts. * Defaults to `pageShortcut`. */ type?: "pageShortcut" | "settingShortcut"; to: string; }; type SearchEntityDefinition = { /** * Group heading shown in the search palette. * - omitted → `t("app.search.groups.")`, falling back to the entity name * - string → used as-is (plain label) * - function → called with the i18n `t` function */ groupLabel?: string | ((t: SearchLabelTranslator) => string); /** * Optional "Jump to" navigation entry for the entity's list page. Omit it * for entities that have no page of their own (e.g. nested entities). */ shortcut?: SearchEntityShortcut; /** * Maps a result from `/admin/search` to a palette item. Omit it for entries * that only contribute a `shortcut`, i.e. pages that are navigable but hold * nothing worth matching on (e.g. reservations). Such entries are skipped * when the palette decides what to query and which areas to offer. */ transform?: SearchEntityTransform; }; /** * Registers (or replaces) a searchable entity for the admin global search. * * Apps and plugins can call this from `src/admin/search-entities.tsx` to add * custom entities or override built-in transforms. Use {@link clearSearchEntities} * first when replacing the default commerce set entirely. * * @example * ```tsx * import { defineSearchEntity } from "@medusajs/dashboard/lib" * * defineSearchEntity("organization", { * groupLabel: "Organizations", * shortcut: { * keys: { Mac: ["G", "Z"] }, * label: "Go to Organizations", * to: "/organizations", * }, * transform: (org) => ({ * id: org.id, * title: org.name, * subtitle: org.billing_email, * to: `/organizations/${org.id}`, * value: `organization:${org.id}`, * }), * }) * ``` */ declare function defineSearchEntity(name: string, definition: SearchEntityDefinition): void; /** * Removes every registered search entity, including the built-in commerce set. * Call before re-registering a custom set when the default entities should not * appear in admin search. */ declare function clearSearchEntities(): void; declare function getSearchEntity(name: string): SearchEntityDefinition | undefined; /** * The entities that can actually be searched, in registration order. * Shortcut-only entries are left out — there is nothing to query for them. */ declare function getSearchEntityNames(): string[]; /** * Whether `name` is registered as a searchable entity. False for shortcut-only * entries. */ declare function hasSearchEntity(name: string): boolean; /** This file is auto-generated. Do not modify it manually. */ type CurrencyInfo = { code: string; name: string; symbol_native: string; decimal_digits: number; }; declare const currencies: Record; declare function getCurrencySymbol(code: string): string; declare function getCurrencyDecimalDigits(code: string): number; declare const getDecimalDigits: (currency: string) => number; /** * Returns a formatted amount based on the currency code using the browser's locale * @param amount - The amount to format * @param currencyCode - The currency code to format the amount in * @returns - The formatted amount * * @example * getFormattedAmount(10, "usd") // '$10.00' if the browser's locale is en-US * getFormattedAmount(10, "usd") // '10,00 $' if the browser's locale is fr-FR */ declare const getLocaleAmount: (amount: number, currencyCode: string) => string; declare const getNativeSymbol: (currencyCode: string) => string; /** * In some cases we want to display the amount with the currency code and symbol, * in the format of "symbol amount currencyCode". This breaks from the * user's locale and is only used in cases where we want to display the * currency code and symbol explicitly, e.g. for totals. */ declare const getStylizedAmount: (amount: number, currencyCode: string) => string; declare const formatCurrency: (amount: number, currency: string) => string; /** * Helper function to cast a z.union([z.number(), z.string()]) to a number */ declare const castNumber: (number: number | string) => number; /** * Validates that an optional value is an integer. */ declare const optionalInt: z.ZodOptional>; /** * Validates that an optional value is an number. */ declare const optionalFloat: z.ZodOptional>; /** * Schema for metadata form. */ declare const metadataFormSchema: z.ZodArray; isDeleted: z.ZodOptional; isIgnored: z.ZodOptional; }, z.core.$strip>>; /** * Validate subset of form fields * @param form * @param fields * @param schema */ declare function partialFormValidation(form: UseFormReturn, fields: FieldPath[], schema: z.ZodSchema): boolean; declare const AddressSchema: z.ZodObject<{ first_name: z.ZodString; last_name: z.ZodString; company: z.ZodOptional; address_1: z.ZodString; address_2: z.ZodOptional; city: z.ZodString; postal_code: z.ZodString; province: z.ZodOptional; country_code: z.ZodString; phone: z.ZodOptional; }, z.core.$strip>; declare const EmailSchema: z.ZodObject<{ email: z.ZodString; }, z.core.$strip>; declare const isSameAddress: (a?: HttpTypes.AdminOrderAddress | null, b?: HttpTypes.AdminOrderAddress | null) => boolean; declare const getFormattedAddress: ({ address, }: { address?: HttpTypes.AdminOrderAddress | null; }) => string[]; declare const getFormattedCountry: (countryCode: string | null | undefined) => string; export { AddressSchema, EmailSchema, castNumber, clearSearchEntities, currencies, defineCellRenderer, defineSearchEntity, formatCurrency, getCurrencyDecimalDigits, getCurrencySymbol, getDecimalDigits, getFormattedAddress, getFormattedCountry, getLocaleAmount, getNativeSymbol, getSearchEntity, getSearchEntityNames, getStylizedAmount, hasSearchEntity, isSameAddress, metadataFormSchema, optionalFloat, optionalInt, partialFormValidation }; export type { BuiltInRenderMode, CellAlignment, CellRenderer, CellRendererDefinition, CurrencyInfo, Keys, RenderMode, SearchEntityDefinition, SearchEntityShortcut, SearchEntityTransform, SearchLabelTranslator };