diff --git a/apps/admin-component-tests/src/__tests__/__snapshots__/exports.spec.ts.snap b/apps/admin-component-tests/src/__tests__/__snapshots__/exports.spec.ts.snap index 58ae8c58..e5783313 100644 --- a/apps/admin-component-tests/src/__tests__/__snapshots__/exports.spec.ts.snap +++ b/apps/admin-component-tests/src/__tests__/__snapshots__/exports.spec.ts.snap @@ -84,6 +84,7 @@ exports[`exports > exports from index.ts 1`] = ` "modalSubmitFormAction", "openOrPrintPdf", "optionalAdminActionContainerComponentNames", + "optionalAdminComponentNames", "optionalAdminPlainWrapperComponentNames", "orderExportAction", "orderExportToShipmentsAction", diff --git a/apps/admin-js/src/__tests__/__snapshots__/exports.spec.ts.snap b/apps/admin-js/src/__tests__/__snapshots__/exports.spec.ts.snap index f3fc04a0..a9f1483a 100644 --- a/apps/admin-js/src/__tests__/__snapshots__/exports.spec.ts.snap +++ b/apps/admin-js/src/__tests__/__snapshots__/exports.spec.ts.snap @@ -81,6 +81,7 @@ exports[`exports > exports from index.ts 1`] = ` "modalSubmitFormAction", "openOrPrintPdf", "optionalAdminActionContainerComponentNames", + "optionalAdminComponentNames", "optionalAdminPlainWrapperComponentNames", "orderExportAction", "orderExportToShipmentsAction", diff --git a/apps/admin/src/__tests__/__snapshots__/exports.spec.ts.snap b/apps/admin/src/__tests__/__snapshots__/exports.spec.ts.snap index f3fc04a0..a9f1483a 100644 --- a/apps/admin/src/__tests__/__snapshots__/exports.spec.ts.snap +++ b/apps/admin/src/__tests__/__snapshots__/exports.spec.ts.snap @@ -81,6 +81,7 @@ exports[`exports > exports from index.ts 1`] = ` "modalSubmitFormAction", "openOrPrintPdf", "optionalAdminActionContainerComponentNames", + "optionalAdminComponentNames", "optionalAdminPlainWrapperComponentNames", "orderExportAction", "orderExportToShipmentsAction", diff --git a/apps/admin/src/data/components.ts b/apps/admin/src/data/components.ts index 39ef0117..15eb0c3d 100644 --- a/apps/admin/src/data/components.ts +++ b/apps/admin/src/data/components.ts @@ -66,7 +66,6 @@ export const requiredAdminComponentNames = [ AdminComponent.RadioInput, AdminComponent.Row, AdminComponent.SelectInput, - AdminComponent.ShippingMethodsInput, AdminComponent.TabNavButton, AdminComponent.Table, AdminComponent.TextArea, @@ -76,6 +75,8 @@ export const requiredAdminComponentNames = [ AdminComponent.TriStateInput, ] as const; +export const optionalAdminComponentNames = [AdminComponent.ShippingMethodsInput] as const; + export const optionalAdminPlainWrapperComponentNames = [ AdminComponent.Badge, AdminComponent.ButtonGroup, @@ -94,6 +95,7 @@ export const optionalAdminActionContainerComponentNames = [ export const allAdminComponentNames = [ ...requiredAdminComponentNames, + ...optionalAdminComponentNames, ...optionalAdminPlainWrapperComponentNames, ...optionalAdminActionContainerComponentNames, ] as const; diff --git a/apps/admin/src/index.ts b/apps/admin/src/index.ts index 8cb786c7..379f8c73 100644 --- a/apps/admin/src/index.ts +++ b/apps/admin/src/index.ts @@ -49,9 +49,8 @@ export { NotificationCategory, allAdminComponentNames, optionalAdminActionContainerComponentNames, + optionalAdminComponentNames, optionalAdminPlainWrapperComponentNames, - - /** @deprecated use TriState */ requiredAdminComponentNames, } from './data'; diff --git a/apps/admin/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts b/apps/admin/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts index 185fd8a2..2920097b 100644 --- a/apps/admin/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts +++ b/apps/admin/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts @@ -6,6 +6,7 @@ import {type AdminComponentMap, type PrefixedAdminComponent} from '../../../type import { AdminComponent, optionalAdminActionContainerComponentNames, + optionalAdminComponentNames, optionalAdminPlainWrapperComponentNames, requiredAdminComponentNames, } from '../../../data'; @@ -27,6 +28,7 @@ const getOptionalComponents = (app: App): Record ({ - ...acc, - [name]: null, - }), - {}, - ), + ...requiredAdminComponentNames.reduce((acc, name) => ({...acc, [name]: null}), {}), ...componentsFromConfig, }; diff --git a/apps/admin/src/types/admin.types.ts b/apps/admin/src/types/admin.types.ts index 688c428f..94d3457a 100644 --- a/apps/admin/src/types/admin.types.ts +++ b/apps/admin/src/types/admin.types.ts @@ -5,6 +5,7 @@ import { type AdminComponent, type AdminView, type optionalAdminActionContainerComponentNames, + type optionalAdminComponentNames, type optionalAdminPlainWrapperComponentNames, type requiredAdminComponentNames, } from '../data'; @@ -14,6 +15,7 @@ import {type AdminConfiguration} from './configuration.types'; export type RequiredAdminComponentName = (typeof requiredAdminComponentNames)[number]; export type OptionalAdminComponentName = + | (typeof optionalAdminComponentNames)[number] | (typeof optionalAdminPlainWrapperComponentNames)[number] | (typeof optionalAdminActionContainerComponentNames)[number];