frontend-plugin-api: refactor extension "at" option to "attachTo"
Co-authored-by: Camila Belo <camilaibs@gmail.com> Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: Vincenzo Scamporlino <vincenzos@spotify.com> Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -58,7 +58,7 @@ describe('createSearchResultListItemExtension', () => {
|
||||
const TechDocsSearchResultItemExtension =
|
||||
createSearchResultListItemExtension({
|
||||
id: 'techdocs',
|
||||
at: 'plugin.search.page/items',
|
||||
attachTo: { id: 'plugin.search.page', input: 'items' },
|
||||
configSchema: createSchemaFromZod(z =>
|
||||
z.object({
|
||||
noTrack: z.boolean().default(true),
|
||||
@@ -79,7 +79,7 @@ describe('createSearchResultListItemExtension', () => {
|
||||
const ExploreSearchResultItemExtension =
|
||||
createSearchResultListItemExtension({
|
||||
id: 'explore',
|
||||
at: 'plugin.search.page/items',
|
||||
attachTo: { id: 'plugin.search.page', input: 'items' },
|
||||
predicate: result => result.type === 'explore',
|
||||
component: async () => ExploreSearchResultItemComponent,
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ export type SearchResultItemExtensionOptions<
|
||||
/**
|
||||
* The extension attachment point (e.g., search modal or page).
|
||||
*/
|
||||
at?: string;
|
||||
attachTo?: { id: string; input: string };
|
||||
/**
|
||||
* Optional extension config schema.
|
||||
*/
|
||||
@@ -97,7 +97,7 @@ export function createSearchResultListItemExtension<
|
||||
) as PortableSchema<TConfig>);
|
||||
return createExtension({
|
||||
id: `plugin.search.result.item.${options.id}`,
|
||||
at: options.at ?? 'plugin.search.page/items',
|
||||
attachTo: options.attachTo ?? { id: 'plugin.search.page', input: 'items' },
|
||||
configSchema,
|
||||
output: {
|
||||
item: searchResultItemExtensionData,
|
||||
|
||||
Reference in New Issue
Block a user