@mercurjs/dashboard-sdk 2.3.4 → 2.3.5

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { B as BuiltMercurConfig, M as MercurConfig, O as OPERATION_IMPLICATIONS, P as Permission, a as PermissionOperation, b as PermissionRequirement, c as PermissionResource, d as PermissionsContextValue, e as PermissionsRequirementsContextValue, R as RouteConfig, f as RouteHandle, U as UserPolicy, g as buildPermission, p as parsePermission } from './types-CTuDKgPc.cjs';
2
- import { ComponentType } from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
 
4
4
  /**
5
5
  * Open registry interfaces. Each panel package ships a generated
@@ -157,10 +157,32 @@ type CustomListExtension = {
157
157
  columnOrder?: string[];
158
158
  };
159
159
  };
160
+ /**
161
+ * Action ids a plugin can lock per model. `order` narrows to the RMA and payment
162
+ * actions the order detail sections guard; other models accept any string.
163
+ */
164
+ interface CustomFieldActionRegistry {
165
+ order: "edit" | "return" | "exchange" | "claim" | "fulfill" | "capture" | "refund";
166
+ }
167
+ type CustomFieldAction<TModel> = TModel extends keyof CustomFieldActionRegistry ? CustomFieldActionRegistry[TModel] : string;
168
+ type ActivityEntry = {
169
+ title: ReactNode;
170
+ timestamp: string | Date;
171
+ children?: ReactNode;
172
+ };
160
173
  interface CustomFieldsConfig<TModel extends CustomFieldModel = CustomFieldModel> {
161
174
  model: TModel;
162
175
  /** Module link(s) fetched alongside the entity (e.g. `brand`). */
163
176
  link?: string | string[];
177
+ /**
178
+ * Reasons an action on this entity is unavailable, keyed by action id. A
179
+ * returned string disables the action and becomes its tooltip; `undefined`
180
+ * leaves it alone. Evaluated on render with the entity as fetched, including
181
+ * `link` data.
182
+ */
183
+ actionLocks?: Partial<Record<CustomFieldAction<TModel>, (entity: unknown) => string | undefined>>;
184
+ /** Extra timeline entries for the entity, merged and sorted with the built-ins. */
185
+ activity?: (entity: unknown) => ActivityEntry[];
164
186
  list?: CustomListExtension;
165
187
  forms?: CustomFormEntry<TModel>[];
166
188
  displays?: CustomDisplayEntry<TModel>[];
@@ -170,4 +192,4 @@ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
170
192
  declare function defineNavigationConfig(config: NavigationConfig): NavigationConfig;
171
193
  declare function defineCustomFieldsConfig<TModel extends CustomFieldModel>(config: CustomFieldsConfig<TModel>): CustomFieldsConfig<TModel>;
172
194
 
173
- export { type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
195
+ export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { B as BuiltMercurConfig, M as MercurConfig, O as OPERATION_IMPLICATIONS, P as Permission, a as PermissionOperation, b as PermissionRequirement, c as PermissionResource, d as PermissionsContextValue, e as PermissionsRequirementsContextValue, R as RouteConfig, f as RouteHandle, U as UserPolicy, g as buildPermission, p as parsePermission } from './types-CTuDKgPc.js';
2
- import { ComponentType } from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
 
4
4
  /**
5
5
  * Open registry interfaces. Each panel package ships a generated
@@ -157,10 +157,32 @@ type CustomListExtension = {
157
157
  columnOrder?: string[];
158
158
  };
159
159
  };
160
+ /**
161
+ * Action ids a plugin can lock per model. `order` narrows to the RMA and payment
162
+ * actions the order detail sections guard; other models accept any string.
163
+ */
164
+ interface CustomFieldActionRegistry {
165
+ order: "edit" | "return" | "exchange" | "claim" | "fulfill" | "capture" | "refund";
166
+ }
167
+ type CustomFieldAction<TModel> = TModel extends keyof CustomFieldActionRegistry ? CustomFieldActionRegistry[TModel] : string;
168
+ type ActivityEntry = {
169
+ title: ReactNode;
170
+ timestamp: string | Date;
171
+ children?: ReactNode;
172
+ };
160
173
  interface CustomFieldsConfig<TModel extends CustomFieldModel = CustomFieldModel> {
161
174
  model: TModel;
162
175
  /** Module link(s) fetched alongside the entity (e.g. `brand`). */
163
176
  link?: string | string[];
177
+ /**
178
+ * Reasons an action on this entity is unavailable, keyed by action id. A
179
+ * returned string disables the action and becomes its tooltip; `undefined`
180
+ * leaves it alone. Evaluated on render with the entity as fetched, including
181
+ * `link` data.
182
+ */
183
+ actionLocks?: Partial<Record<CustomFieldAction<TModel>, (entity: unknown) => string | undefined>>;
184
+ /** Extra timeline entries for the entity, merged and sorted with the built-ins. */
185
+ activity?: (entity: unknown) => ActivityEntry[];
164
186
  list?: CustomListExtension;
165
187
  forms?: CustomFormEntry<TModel>[];
166
188
  displays?: CustomDisplayEntry<TModel>[];
@@ -170,4 +192,4 @@ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
170
192
  declare function defineNavigationConfig(config: NavigationConfig): NavigationConfig;
171
193
  declare function defineCustomFieldsConfig<TModel extends CustomFieldModel>(config: CustomFieldsConfig<TModel>): CustomFieldsConfig<TModel>;
172
194
 
173
- export { type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
195
+ export { type ActivityEntry, type CustomColumn, type CustomDisplayEntry, type CustomDisplayField, type CustomFieldAction, type CustomFieldActionRegistry, type CustomFieldModel, type CustomFieldsConfig, type CustomFieldsRegistry, type CustomFormEntry, type CustomFormField, type CustomFormTab, type CustomFormZone, type CustomListExtension, type FieldValidation, type NavItemId, type NavItemOverride, type NavItemRegistry, type NavParentId, type NavParentRegistry, type NavigationConfig, type SectionAction, type WidgetConfig, type WidgetZoneId, type WidgetZoneRegistry, defineCustomFieldsConfig, defineNavigationConfig, defineWidgetConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/dashboard-sdk",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",