@mercurjs/dashboard-shared 2.2.0-canary.9 → 2.2.0-rc.1

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +412 -14
  2. package/dist/index.js +4338 -2625
  3. package/package.json +13 -13
package/dist/index.d.ts CHANGED
@@ -5,15 +5,16 @@ import * as React$1 from 'react';
5
5
  import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, Ref, RefCallback } from 'react';
6
6
  import { Tooltip, Heading, Text, DataTableColumnDef, DataTableFilter, DataTableCommand, DataTableEmptyStateProps, DataTableRowSelectionState, DataTableRow, Drawer, FocusModal, ProgressStatus } from '@medusajs/ui';
7
7
  import * as react_hook_form from 'react-hook-form';
8
- import { FieldValues, FieldPath, ControllerProps, UseFormReturn, Control } from 'react-hook-form';
9
- import { Label, Slot } from 'radix-ui';
8
+ import { FieldValues, FieldPath, ControllerProps, UseFormReturn, Control, UseFormProps } from 'react-hook-form';
9
+ import { Label } from 'radix-ui';
10
10
  import { Link, Path } from 'react-router-dom';
11
11
  import { UniqueIdentifier } from '@dnd-kit/core';
12
12
  import * as _tanstack_react_table from '@tanstack/react-table';
13
13
  import { CellContext, Row, ColumnDef, ColumnDefTemplate, HeaderContext, Table, RowSelectionState, OnChangeFn } from '@tanstack/react-table';
14
14
  import { TFunction } from 'i18next';
15
- import { z } from 'zod';
15
+ import { z, ZodObject } from 'zod';
16
16
  import { ClientError } from '@mercurjs/client';
17
+ import { CustomFieldsConfig, NavItemOverride, CustomFormField, CustomDisplayField, SectionAction, CustomListExtension } from '@mercurjs/dashboard-sdk';
17
18
 
18
19
  type TQueryKey<TKey, TListQuery = any, TDetailQuery = string> = {
19
20
  all: readonly [TKey];
@@ -33,16 +34,47 @@ type TQueryKey<TKey, TListQuery = any, TDetailQuery = string> = {
33
34
  type UseQueryOptionsWrapper<TQueryFn = unknown, E = Error, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFn, E, TQueryFn, TQueryKey>, "queryKey" | "queryFn">;
34
35
  declare const queryKeysFactory: <T, TListQueryType = any, TDetailQueryType = string>(globalKey: T) => TQueryKey<T, TListQueryType, TDetailQueryType>;
35
36
 
37
+ type ImageRef = {
38
+ url: string;
39
+ };
40
+ type MediaDiff = {
41
+ added: ImageRef[];
42
+ removed: ImageRef[];
43
+ };
36
44
  type FieldDiff = {
37
45
  field: string;
38
46
  previous: unknown;
39
47
  next: unknown;
40
48
  variant_id?: string;
41
49
  };
42
- type ProductChangePartition = {
43
- updated: FieldDiff[];
44
- added: ProductChangeActionDTO[];
45
- removed: ProductChangeActionDTO[];
50
+ type AttributeChangeKind = "added" | "removed" | "updated";
51
+ type AttributeChange = {
52
+ kind: AttributeChangeKind;
53
+ /** Set for existing (catalog) attributes referenced by id. */
54
+ attributeId?: string;
55
+ /** Set for inline attributes created in the same request (no id yet). */
56
+ inlineTitle?: string;
57
+ /** Value ids to associate / add (select types or shared axis subset). */
58
+ addValueIds: string[];
59
+ /** New value names to create (inline / exclusive axis). */
60
+ addValueNames: string[];
61
+ /** Value ids removed (updates only). */
62
+ removeValueIds: string[];
63
+ /** Free-form scalar for text / unit / toggle attributes. */
64
+ scalarValue?: string | number | boolean;
65
+ };
66
+ type VariantGroup = {
67
+ variantId: string;
68
+ fieldDiffs: FieldDiff[];
69
+ media: MediaDiff;
70
+ };
71
+ type ProductChangeView = {
72
+ productUpdated: FieldDiff[];
73
+ productMedia: MediaDiff;
74
+ attributes: AttributeChange[];
75
+ variantsAdded: ProductChangeActionDTO[];
76
+ variantsRemoved: ProductChangeActionDTO[];
77
+ variantGroups: VariantGroup[];
46
78
  deleteRequested: boolean;
47
79
  };
48
80
  type ReferenceField = "type_id" | "collection_id" | "categories" | "tags";
@@ -53,11 +85,13 @@ declare const isImageList: (value: unknown) => value is {
53
85
  }[];
54
86
  declare const extractReferenceIds: (field: ReferenceField, value: unknown) => string[];
55
87
  declare const humanizeFieldName: (field: string) => string;
56
- declare const formatFieldValue: (value: unknown, field?: string) => string;
57
- declare const partitionProductChangeActions: (actions: ProductChangeActionDTO[]) => ProductChangePartition;
58
- declare const describeProductChangeAction: (action: ProductChangeActionDTO, fallbacks: {
59
- variant: string;
60
- }) => string;
88
+ type BooleanLabels = {
89
+ true: string;
90
+ false: string;
91
+ };
92
+ declare const formatFieldValue: (value: unknown, field?: string, booleanLabels?: BooleanLabels) => string;
93
+ declare const buildProductChangeView: (actions: ProductChangeActionDTO[]) => ProductChangeView;
94
+ declare const productChangeViewHasContent: (view: ProductChangeView) => boolean;
61
95
 
62
96
  type Action = {
63
97
  icon: ReactNode;
@@ -251,7 +285,9 @@ declare const Form: (<TFieldValues extends FieldValues, TContext = any, TTransfo
251
285
  tooltip?: ReactNode;
252
286
  icon?: ReactNode;
253
287
  } & React__default.RefAttributes<HTMLLabelElement>>;
254
- Control: React__default.ForwardRefExoticComponent<Omit<Slot.SlotProps & React__default.RefAttributes<HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
288
+ Control: React__default.ForwardRefExoticComponent<Omit<React__default.HTMLAttributes<HTMLElement> & {
289
+ children?: React__default.ReactNode;
290
+ } & React__default.RefAttributes<HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
255
291
  Hint: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
256
292
  ErrorMessage: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
257
293
  Field: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
@@ -341,6 +377,57 @@ type MetadataSectionProps<TData extends object> = {
341
377
  };
342
378
  declare const MetadataSection: <TData extends object>({ data, href, }: MetadataSectionProps<TData>) => react_jsx_runtime.JSX.Element | null;
343
379
 
380
+ type WrappedAttributeValue = {
381
+ id: string;
382
+ name?: string | null;
383
+ };
384
+ type ProductChangeAttribute = {
385
+ id: string;
386
+ name?: string | null;
387
+ /** Values currently selected on the product (the "previous" side). */
388
+ values?: WrappedAttributeValue[] | null;
389
+ /** Every possible value of the attribute, used to resolve value ids. */
390
+ all_values?: WrappedAttributeValue[] | null;
391
+ };
392
+ type ProductChangeVariant = {
393
+ id: string;
394
+ title?: string | null;
395
+ sku?: string | null;
396
+ images?: {
397
+ url: string;
398
+ }[] | null;
399
+ };
400
+ type ProductChangeProduct = {
401
+ id: string;
402
+ title?: string | null;
403
+ thumbnail?: string | null;
404
+ variants?: (ProductChangeVariant | null)[] | null;
405
+ attributes?: ProductChangeAttribute[] | null;
406
+ };
407
+ type ResolvedAttribute = {
408
+ name: string;
409
+ values: {
410
+ id: string;
411
+ name: string;
412
+ }[];
413
+ };
414
+ type ProductChangeResolvers = {
415
+ getType: (id: string) => Promise<string | null | undefined>;
416
+ getCollection: (id: string) => Promise<string | null | undefined>;
417
+ getCategory: (id: string) => Promise<string | null | undefined>;
418
+ getTag: (id: string) => Promise<string | null | undefined>;
419
+ getAttribute: (id: string) => Promise<ResolvedAttribute | null | undefined>;
420
+ getVariant: (variantId: string) => Promise<ProductChangeVariant | null | undefined>;
421
+ };
422
+ type ProductChangePanelProps = {
423
+ product: ProductChangeProduct;
424
+ actions: ProductChangeActionDTO[];
425
+ resolvers: ProductChangeResolvers;
426
+ headerDescription?: ReactNode;
427
+ footer?: ReactNode;
428
+ };
429
+ declare const ProductChangePanel: ({ product, actions, resolvers, headerDescription, footer, }: ProductChangePanelProps) => react_jsx_runtime.JSX.Element | null;
430
+
344
431
  interface ProgressBarProps {
345
432
  /**
346
433
  * The duration of the animation in seconds.
@@ -787,6 +874,11 @@ type MetadataFormProps<TRes> = {
787
874
  };
788
875
  declare const MetadataForm: <TRes>(props: MetadataFormProps<TRes>) => react_jsx_runtime.JSX.Element;
789
876
 
877
+ type IconProps = React$1.SVGProps<SVGSVGElement> & {
878
+ color?: string;
879
+ };
880
+ declare const ListBadge: React$1.ForwardRefExoticComponent<Omit<IconProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
881
+
790
882
  interface PageProps<TData> {
791
883
  children: ReactNode;
792
884
  data?: TData;
@@ -934,6 +1026,8 @@ type TabbedFormProps<T extends FieldValues> = {
934
1026
  isLoading?: boolean;
935
1027
  footer?: (props: FooterRenderProps) => ReactNode;
936
1028
  transformTabs?: (tabs: TabDefinition<T>[]) => TabDefinition<T>[];
1029
+ model?: string;
1030
+ zone?: string;
937
1031
  };
938
1032
  declare function Root<T extends FieldValues>({ form, onSubmit, children, isLoading, footer, transformTabs, }: TabbedFormProps<T>): react_jsx_runtime.JSX.Element;
939
1033
  declare const TabbedForm: typeof Root & {
@@ -1175,4 +1269,308 @@ type QueryParams<T extends string> = {
1175
1269
  };
1176
1270
  declare function useQueryParams<T extends string>(keys: T[], prefix?: string): QueryParams<T>;
1177
1271
 
1178
- export { type Action, type ActionGroup, ActionMenu, AddressForm, BadgeListSummary, ChipGroup, CodeCell, CodeHeader, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, CreatedAtCell, CreatedAtHeader, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, EmailCell, EmailForm, EmailHeader, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, GeneralSectionSkeleton, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, LinkButton, ListSummary, Listicle, type ListicleProps, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, NoRecords, NoResults, type NoResultsProps, OrderBy, PlaceholderCell, type ProductChangePartition, ProgressBar, Query, REFERENCE_FIELDS, type ReferenceField, RouteDrawer, RouteFocusModal, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TwoColumnPage, TwoColumnPageSkeleton, type UseQueryOptionsWrapper, _DataTable, createDataGridHelper, createDataGridPriceColumns, describeProductChangeAction, extractReferenceIds, formatFieldValue, humanizeFieldName, isImageList, isReferenceField, partitionProductChangeActions, queryKeysFactory, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDocumentDirection, useQueryParams, useRouteModal, useStackedModal, useTabManagement, useTabbedForm };
1272
+ type WidgetPlacement = "before" | "after";
1273
+ type Widget = {
1274
+ Component: ComponentType<{
1275
+ data?: unknown;
1276
+ }>;
1277
+ zone: string[];
1278
+ widgetId: string;
1279
+ };
1280
+ type WidgetModule = {
1281
+ widgets?: Widget[];
1282
+ };
1283
+ type NavigationModule = {
1284
+ items?: NavItemOverride[];
1285
+ };
1286
+ type CustomFieldsModule = {
1287
+ configs?: CustomFieldsConfig[];
1288
+ };
1289
+ type ResolvedFormField = {
1290
+ name: string;
1291
+ field: CustomFormField;
1292
+ };
1293
+ type ResolvedDisplays = {
1294
+ fields: CustomDisplayField[];
1295
+ actions: SectionAction[];
1296
+ };
1297
+ type ResolvedWidget = {
1298
+ Component: Widget["Component"];
1299
+ widgetId: string;
1300
+ };
1301
+ type ZoneWidgets = {
1302
+ before: ResolvedWidget[];
1303
+ after: ResolvedWidget[];
1304
+ };
1305
+ /**
1306
+ * Per-panel singleton mirroring Medusa's `DashboardApp`. Built once at app root
1307
+ * from the aggregated `virtual:mercur/{widgets,navigation}` modules; the zone
1308
+ * hosts read from it via `useExtension()`.
1309
+ */
1310
+ declare class ExtensionRegistry {
1311
+ private widgets;
1312
+ private navOverrides;
1313
+ private customFields;
1314
+ constructor(input?: {
1315
+ widgets?: WidgetModule;
1316
+ navigation?: NavigationModule;
1317
+ customFields?: CustomFieldsModule;
1318
+ });
1319
+ private ensureSlot;
1320
+ private populateWidgets;
1321
+ getWidgets(slot: string): ZoneWidgets;
1322
+ getNavOverrides(): NavItemOverride[];
1323
+ private configsFor;
1324
+ /** Distinct module links declared across a model's configs. */
1325
+ getLinks(model: string): string[];
1326
+ /** Custom form fields for a model's form zone (and optional tab). */
1327
+ getFormFields(model: string, zone: string, tab?: string): ResolvedFormField[];
1328
+ /** All custom form fields for a model, keyed for schema/default building. */
1329
+ getAllFormFields(model: string): ResolvedFormField[];
1330
+ /** Section display contributions (field add/replace/remove + actions). */
1331
+ getDisplays(model: string, zone: string): ResolvedDisplays;
1332
+ /** Merged list-table extension for a model. */
1333
+ getListExtension(model: string): CustomListExtension;
1334
+ }
1335
+
1336
+ type ExtensionProviderProps = {
1337
+ widgets?: WidgetModule;
1338
+ navigation?: NavigationModule;
1339
+ customFields?: CustomFieldsModule;
1340
+ children: ReactNode;
1341
+ };
1342
+ /**
1343
+ * Reads the panel's extension registry outside React (e.g. in a react-router
1344
+ * `loader`, which can't call hooks). Returns null until `ExtensionProvider` has
1345
+ * mounted; callers should fall back to built-in behavior when null.
1346
+ */
1347
+ declare const getExtensionRegistry: () => ExtensionRegistry | null;
1348
+ declare const ExtensionProvider: ({ widgets, navigation, customFields, children, }: ExtensionProviderProps) => react_jsx_runtime.JSX.Element;
1349
+ /**
1350
+ * Reads the panel's extension registry. Returns an empty registry when no
1351
+ * provider is mounted so hosts render their built-in content untouched.
1352
+ */
1353
+ declare const useExtension: () => ExtensionRegistry;
1354
+
1355
+ type WidgetZoneProps = {
1356
+ /** Stable slot id, e.g. `product.list` or `product.detail`. Placement suffixes
1357
+ * (`before | after | replace`) are matched against it at render time. */
1358
+ id: string;
1359
+ /** Optional data passed to each widget component (e.g. the detail entity). */
1360
+ data?: unknown;
1361
+ /** The built-in content, rendered between `before` and `after` widgets. */
1362
+ children?: ReactNode;
1363
+ };
1364
+ /**
1365
+ * Injection-zone host. Renders `before` widgets → the built-in child →
1366
+ * `after` widgets. A zone that no page renders as a host can never be targeted.
1367
+ */
1368
+ declare const WidgetZone: ({ id, data, children }: WidgetZoneProps) => react_jsx_runtime.JSX.Element;
1369
+
1370
+ type CoreNavItem = {
1371
+ id: string;
1372
+ label: string;
1373
+ to: string;
1374
+ icon?: ReactNode;
1375
+ items?: CoreNavItem[];
1376
+ };
1377
+ /**
1378
+ * Applies host-owned `_navigation.ts` overrides to a panel's built-in core
1379
+ * routes: reorder (`rank`), hide (`hidden`), relabel (`label`/`icon`), and
1380
+ * re-parent (`nested`). Operates on the two-level `useCoreRoutes()` shape;
1381
+ * items without a matching override are preserved in their original order.
1382
+ */
1383
+ declare function applyNavOverrides(coreRoutes: CoreNavItem[], overrides?: NavItemOverride[]): CoreNavItem[];
1384
+
1385
+ type FormExtensionZoneProps = {
1386
+ model: string;
1387
+ zone: string;
1388
+ tab?: string;
1389
+ control: Control<any>;
1390
+ data?: unknown;
1391
+ };
1392
+ /**
1393
+ * Renders a model's custom form fields for a given zone/tab under the
1394
+ * `additional_data.<field>` RHF namespace (Medusa's convention), through the
1395
+ * mandated `Form.Field → Form.Item` primitive chain.
1396
+ */
1397
+ declare const FormExtensionZone: ({ model, zone, tab, control, data, }: FormExtensionZoneProps) => react_jsx_runtime.JSX.Element | null;
1398
+
1399
+ type DisplayExtensionZoneProps = {
1400
+ model: string;
1401
+ zone: string;
1402
+ data?: unknown;
1403
+ /**
1404
+ * Ids of the section's built-in fields — those are overridden inline by
1405
+ * `<DisplayField>`, so the zone skips them and only renders genuinely added
1406
+ * fields (unknown ids). Defaults to none.
1407
+ */
1408
+ builtInFieldIds?: string[];
1409
+ };
1410
+ /**
1411
+ * Renders a model's ADDED section fields (non-null component, id not a built-in
1412
+ * field) plus the section's custom `ActionMenu` contributions. Built-in fields
1413
+ * are overridden in place by `<DisplayField>` / `useDisplayFieldOverride`.
1414
+ */
1415
+ declare const DisplayExtensionZone: ({ model, zone, data, builtInFieldIds, }: DisplayExtensionZoneProps) => react_jsx_runtime.JSX.Element | null;
1416
+ type DisplayFieldProps = {
1417
+ model: string;
1418
+ zone: string;
1419
+ /** Stable id of this built-in field (e.g. `title`, `description`). */
1420
+ id: string;
1421
+ data?: unknown;
1422
+ /** The built-in default rendering, shown when there is no override. */
1423
+ children?: ReactNode;
1424
+ };
1425
+ /**
1426
+ * Wraps a single built-in detail field so a `displays[].fields` entry can
1427
+ * override its render (a different `component`) or remove it (`component: null`).
1428
+ * With no matching override, renders the built-in `children` unchanged. This is
1429
+ * the host the panel codegen scans to type `displayFieldIds`.
1430
+ */
1431
+ declare const DisplayField: ({ model, zone, id, data, children, }: DisplayFieldProps) => react_jsx_runtime.JSX.Element | null;
1432
+ type DisplaySectionField = {
1433
+ /** Stable id of the built-in field (matches a `displays[].fields[].id`). */
1434
+ id: string;
1435
+ /** The built-in default rendering (e.g. a `<SectionRow />`). */
1436
+ render: ReactNode;
1437
+ };
1438
+ type DisplaySectionProps = {
1439
+ model: string;
1440
+ zone: string;
1441
+ data?: unknown;
1442
+ /** Built-in fields of this section, each overridable/removable by id. */
1443
+ fields: DisplaySectionField[];
1444
+ };
1445
+ /**
1446
+ * One-line helper for a row-style detail section: renders each built-in field
1447
+ * through `<DisplayField>` (so `displays[].fields` can replace/remove it) and
1448
+ * appends the section's added fields + actions via `<DisplayExtensionZone>`,
1449
+ * deriving `builtInFieldIds` from `fields`.
1450
+ */
1451
+ declare const DisplaySection: ({ model, zone, data, fields, }: DisplaySectionProps) => react_jsx_runtime.JSX.Element;
1452
+ /**
1453
+ * For a built-in detail section to honor a `displays[].fields` override of one
1454
+ * of its own fields: returns `{ overridden, Component }`. `overridden && !
1455
+ * Component` means remove (render nothing); `Component` means replace.
1456
+ */
1457
+ declare function useDisplayFieldOverride(model: string, zone: string, id: string): {
1458
+ overridden: boolean;
1459
+ Component: ComponentType<{
1460
+ data?: unknown;
1461
+ }> | null;
1462
+ };
1463
+
1464
+ type UseExtendableTableProps<TData> = {
1465
+ /** Model whose custom-fields `list` block extends this table (e.g. `product`). */
1466
+ model: string;
1467
+ /** Base columns to extend. */
1468
+ columns: ColumnDef<TData, unknown>[];
1469
+ };
1470
+ type ExtendableTable<TData> = {
1471
+ /** Base columns with custom override/add/hide/order applied. */
1472
+ columns: ColumnDef<TData, unknown>[];
1473
+ /** Extra list filters contributed by custom-fields configs. */
1474
+ filters: unknown[];
1475
+ /** Extra multi-select bulk actions (rank-sorted). */
1476
+ bulkActions: SectionAction[];
1477
+ };
1478
+ /**
1479
+ * Applies a model's custom-fields `list` block to a table's base columns —
1480
+ * mirrors `useExtendableForm` for tables. A `columns[]` entry whose `id` matches
1481
+ * a base column **overrides** it (custom header/cell), an unknown `id` **adds** a
1482
+ * column, `viewDefaults.columnVisibility[id] === false` **hides** it, and
1483
+ * `viewDefaults.columnOrder` reorders. Also surfaces the config's `filters` and
1484
+ * `bulkActions` for the caller to render.
1485
+ */
1486
+ declare function useExtendableTable<TData>({ model, columns: baseColumns, }: UseExtendableTableProps<TData>): ExtendableTable<TData>;
1487
+
1488
+ /** Turn a model's `link` relations into `+link.*` merge tokens. */
1489
+ declare const linkFields: (links: string[]) => string;
1490
+ /**
1491
+ * Merge a model's custom-fields `link` relations into a curated fields string
1492
+ * using the `+` merge convention (`+link.*`), so linked-module data is fetched
1493
+ * alongside the entity without replacing the route's default fields. Returns the
1494
+ * base `fields` unchanged when there are no links.
1495
+ */
1496
+ declare const withLinkFields: (fields: string, links: string[]) => string;
1497
+ /**
1498
+ * Build a spreadable `{ fields }` query fragment that adds a model's custom-fields
1499
+ * `link` relations. Pass `base` to merge onto a curated field set (list/detail
1500
+ * queries); omit it to merge purely onto the route defaults (`+link.*` only), so
1501
+ * unprefixed base fields never replace the route defaults. Returns `{}` (or
1502
+ * `{ fields: base }`) when the model declares no links, leaving the fetch
1503
+ * unchanged. Non-hook variant for react-router loaders.
1504
+ */
1505
+ declare const getLinkQuery: (model: string, base?: string) => {
1506
+ fields?: string;
1507
+ };
1508
+ /** Hook variant of {@link getLinkQuery} for use inside components. */
1509
+ declare const useLinkQuery: (model: string, base?: string) => {
1510
+ fields?: string;
1511
+ };
1512
+
1513
+ /**
1514
+ * Zod-backed form surface (mirrors Medusa's `createFormHelper`, no `unstable_`).
1515
+ * Lives here rather than in `@mercurjs/dashboard-sdk` because the SDK is a
1516
+ * zod-free build-time package; re-exported from `@mercurjs/dashboard-sdk` for
1517
+ * authoring parity is a docs concern only.
1518
+ */
1519
+ declare function createFormHelper<TData>(): {
1520
+ define: (field: CustomFormField<TData>) => CustomFormField<TData>;
1521
+ string: () => z.ZodString;
1522
+ number: () => z.ZodNumber;
1523
+ boolean: () => z.ZodBoolean;
1524
+ date: () => z.ZodDate;
1525
+ array: <El extends z.ZodTypeAny>(schema: El, params?: z.RawCreateParams) => z.ZodArray<El>;
1526
+ object: <Shape extends z.ZodRawShape>(shape: Shape, params?: z.RawCreateParams) => z.ZodObject<Shape, "strip", z.ZodTypeAny, z.objectOutputType<Shape, z.ZodTypeAny, "strip">, z.objectInputType<Shape, z.ZodTypeAny, "strip">>;
1527
+ null: () => z.ZodNull;
1528
+ nullable: <Inner extends z.ZodTypeAny>(type: Inner, params?: z.RawCreateParams) => z.ZodNullable<Inner>;
1529
+ coerce: {
1530
+ string: (typeof z.ZodString)["create"];
1531
+ number: (typeof z.ZodNumber)["create"];
1532
+ boolean: (typeof z.ZodBoolean)["create"];
1533
+ bigint: (typeof z.ZodBigInt)["create"];
1534
+ date: (typeof z.ZodDate)["create"];
1535
+ };
1536
+ };
1537
+ /**
1538
+ * Build the `additional_data` zod object for a model's custom fields, to merge
1539
+ * into a form's base schema. Custom-field values live under `additional_data`
1540
+ * so the built-in create/edit validators never see them.
1541
+ */
1542
+ declare function buildAdditionalDataSchema(registry: ExtensionRegistry, model: string, zone?: string, tab?: string): z.ZodObject<Record<string, z.ZodTypeAny>>;
1543
+ /** Resolve default values for a model's custom fields from the loaded entity. */
1544
+ declare function buildAdditionalDataDefaults(registry: ExtensionRegistry, model: string, data?: unknown, zone?: string, tab?: string): Record<string, unknown>;
1545
+
1546
+ type WithAdditionalData<T> = T & {
1547
+ additional_data?: Record<string, unknown>;
1548
+ };
1549
+ interface UseExtendableFormProps<TSchema extends ZodObject<Record<string, z.ZodTypeAny>>, TContext = unknown, TData = unknown> extends Omit<UseFormProps<z.infer<TSchema>, TContext>, "resolver" | "defaultValues"> {
1550
+ /** Base schema for the built-in fields. */
1551
+ schema: TSchema;
1552
+ /** Base default values for the built-in fields. */
1553
+ defaultValues: z.infer<TSchema>;
1554
+ /** Custom-field model whose fields extend this form (e.g. `"product"`). */
1555
+ model: string;
1556
+ /** Loaded entity, used to resolve custom-field default values. */
1557
+ data?: TData;
1558
+ /**
1559
+ * Form zone (and optional tab) this form renders. When set, only custom
1560
+ * fields registered for that zone extend the schema/defaults — so a required
1561
+ * field defined for another zone (e.g. onboarding) doesn't block this form.
1562
+ * Omit to include every field for the model (legacy behaviour).
1563
+ */
1564
+ zone?: string;
1565
+ tab?: string;
1566
+ }
1567
+ /**
1568
+ * `useForm` that merges a model's registered custom fields into the base
1569
+ * schema and defaults under an `additional_data` key — mirrors Medusa's
1570
+ * `useExtendableForm`. Custom-field values live under `additional_data` so the
1571
+ * built-in validators never see them; the extension registry provides the
1572
+ * per-field zod validation and default values.
1573
+ */
1574
+ declare const useExtendableForm: <TSchema extends ZodObject<Record<string, z.ZodTypeAny>>, TContext = unknown, TTransformedValues extends FieldValues | undefined = undefined>({ schema: baseSchema, defaultValues: baseDefaultValues, model, data, zone, tab, ...props }: UseExtendableFormProps<TSchema, TContext>) => react_hook_form.UseFormReturn<WithAdditionalData<z.TypeOf<TSchema>>, TContext, TTransformedValues>;
1575
+
1576
+ export { type Action, type ActionGroup, ActionMenu, AddressForm, type AttributeChange, type AttributeChangeKind, BadgeListSummary, ChipGroup, CodeCell, CodeHeader, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CreatedAtCell, CreatedAtHeader, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, EmailCell, EmailForm, EmailHeader, type ExtendableTable, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, GeneralSectionSkeleton, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavigationModule, NoRecords, NoResults, type NoResultsProps, OrderBy, PlaceholderCell, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, Query, REFERENCE_FIELDS, type ReferenceField, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RouteDrawer, RouteFocusModal, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, type Widget, type WidgetModule, type WidgetPlacement, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildProductChangeView, createDataGridHelper, createDataGridPriceColumns, createFormHelper, extractReferenceIds, formatFieldValue, getExtensionRegistry, getLinkQuery, humanizeFieldName, isImageList, isReferenceField, linkFields, productChangeViewHasContent, queryKeysFactory, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExtendableForm, useExtendableTable, useExtension, useLinkQuery, useQueryParams, useRouteModal, useStackedModal, useTabManagement, useTabbedForm, withLinkFields };