Skip to content

Commit 54c26b2

Browse files
committed
add InternalMetaobjectField component
1 parent b3e2bcf commit 54c26b2

File tree

5 files changed

+41
-2
lines changed

5 files changed

+41
-2
lines changed

packages/ui-extensions-react/src/surfaces/admin/components.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ export {URLField} from './components/URLField/URLField';
8383
export type {URLFieldProps} from './components/URLField/URLField';
8484
export {InternalLocationList} from './components/InternalLocationList/InternalLocationList';
8585
export type {InternalLocationListProps} from './components/InternalLocationList/InternalLocationList';
86+
export {InternalMetaobjectField} from './components/InternalMetaobjectField/InternalMetaobjectField';
87+
export type {InternalMetaobjectFieldProps} from './components/InternalMetaobjectField/InternalMetaobjectField';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {InternalMetaobjectField as BaseInternalMetaobjectField} from '@shopify/ui-extensions/admin';
2+
import {createRemoteReactComponent} from '@remote-ui/react';
3+
4+
export const InternalMetaobjectField = createRemoteReactComponent(
5+
BaseInternalMetaobjectField,
6+
);
7+
export type {InternalMetaobjectFieldProps} from '@shopify/ui-extensions/admin';

packages/ui-extensions/src/surfaces/admin/components.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ export {URLField} from './components/URLField/URLField';
8787
export type {URLFieldProps} from './components/URLField/URLField';
8888
export {InternalLocationList} from './components/InternalLocationList/InternalLocationList';
8989
export type {InternalLocationListProps} from './components/InternalLocationList/InternalLocationList';
90+
export {InternalMetaobjectField} from './components/InternalMetaobjectField/InternalMetaobjectField';
91+
export type {InternalMetaobjectFieldProps} from './components/InternalMetaobjectField/InternalMetaobjectField';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {createRemoteComponent} from '@remote-ui/core';
2+
3+
export interface InternalMetaobjectFieldProps {
4+
/**
5+
* The id of the metaobject.
6+
*/
7+
id: string;
8+
9+
/**
10+
* The definition type of the metaobject.
11+
*/
12+
definitionType: string;
13+
14+
/**
15+
* The key of the metaobject field.
16+
*/
17+
fieldKey: string;
18+
}
19+
20+
export const InternalMetaobjectField = createRemoteComponent<
21+
'InternalMetaobjectField',
22+
InternalMetaobjectFieldProps
23+
>('InternalMetaobjectField');

packages/ui-extensions/src/surfaces/admin/extension-targets.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ type OrderRoutingComponents = AnyComponentBuilder<
4747
Pick<Components, 'InternalLocationList'>
4848
>;
4949

50+
type CustomDataComponents = AnyComponentBuilder<
51+
Pick<Components, 'InternalMetaobjectField'>
52+
>;
53+
5054
/**
5155
* See the [list of available components](/docs/api/admin-extensions/components).
5256
*/
@@ -56,6 +60,7 @@ type AllComponents = AnyComponentBuilder<
5660
| 'CustomerSegmentTemplate'
5761
| 'InternalCustomerSegmentTemplate'
5862
| 'InternalLocationList'
63+
| 'InternalMetaobjectField'
5964
>
6065
>;
6166

@@ -181,7 +186,7 @@ export interface ExtensionTargets {
181186
*/
182187
'admin.metaobject-details.block.render': RenderExtension<
183188
BlockExtensionApi<'admin.metaobject-details.block.render'>,
184-
AllComponents
189+
AllComponents | CustomDataComponents
185190
>;
186191

187192
/**
@@ -292,7 +297,7 @@ export interface ExtensionTargets {
292297
*/
293298
'admin.metaobject-details.action.render': RenderExtension<
294299
ActionExtensionApi<'admin.metaobject-details.action.render'>,
295-
AllComponents
300+
AllComponents | CustomDataComponents
296301
>;
297302

298303
/**

0 commit comments

Comments
 (0)