Skip to content

Commit

Permalink
feat(products): updating Product Configuration extension points to us…
Browse files Browse the repository at this point in the history
…e block extension api & components
  • Loading branch information
kmdavis committed Feb 14, 2025
1 parent 4835263 commit 2297f5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type {StandardApi} from '../standard/standard';
import type {BlockExtensionApi} from '../block/block';
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';
import type {Data} from '../shared';

/* @deprecated */
interface Product {
id: string;
title: string;
Expand All @@ -21,6 +23,7 @@ interface Product {
productComponents: ProductComponent[];
}

/* @deprecated */
export interface ProductComponent {
id: string;
title: string;
Expand All @@ -37,9 +40,12 @@ export interface ProductComponent {

export interface ProductDetailsConfigurationApi<
ExtensionTarget extends AnyExtensionTarget,
> extends StandardApi<ExtensionTarget> {
data: {
/* The product currently being viewed in the admin. */
> extends BlockExtensionApi<ExtensionTarget> {
data: Data & {
/*
@deprecated
The product currently being viewed in the admin.
*/
product: Product;
app: {
launchUrl: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {StandardApi} from '../standard/standard';
import type {BlockExtensionApi} from '../block/block';
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';

/* @deprecated */
interface ProductVariant {
id: string;
sku: string;
Expand All @@ -19,6 +20,7 @@ interface ProductVariant {
productVariantComponents: ProductVariantComponent[];
}

/* @deprecated */
export interface ProductVariantComponent {
id: string;
displayName: string;
Expand All @@ -38,9 +40,12 @@ export interface ProductVariantComponent {

export interface ProductVariantDetailsConfigurationApi<
ExtensionTarget extends AnyExtensionTarget,
> extends StandardApi<ExtensionTarget> {
data: {
/* The product variant currently being viewed in the admin. */
> extends BlockExtensionApi<ExtensionTarget> {
data: Data & {
/*
@deprecated
The product variant currently being viewed in the admin.
*/
variant: ProductVariant;
app: {
launchUrl: string;
Expand Down
20 changes: 2 additions & 18 deletions packages/ui-extensions/src/surfaces/admin/extension-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ type CustomerSegmentTemplateComponent = AnyComponentBuilder<
>
>;

type ProductConfigurationComponents = AnyComponentBuilder<
Pick<
Components,
| 'Box'
| 'InlineStack'
| 'BlockStack'
| 'Divider'
| 'HeadingGroup'
| 'Heading'
| 'Text'
| 'Link'
| 'Image'
| 'Icon'
>
>;

type OrderRoutingComponents = AnyComponentBuilder<
Pick<Components, 'InternalLocationList'>
>;
Expand Down Expand Up @@ -510,7 +494,7 @@ export interface ExtensionTargets {
*/
'admin.product-details.configuration.render': RenderExtension<
ProductDetailsConfigurationApi<'admin.product-details.configuration.render'>,
ProductConfigurationComponents
AllComponents
>;

/**
Expand All @@ -520,7 +504,7 @@ export interface ExtensionTargets {
*/
'admin.product-variant-details.configuration.render': RenderExtension<
ProductVariantDetailsConfigurationApi<'admin.product-variant-details.configuration.render'>,
ProductConfigurationComponents
AllComponents
>;

/**
Expand Down

0 comments on commit 2297f5c

Please sign in to comment.