Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(products): updating Product Configuration extension points to use block extension api & components #2639

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tender-boxes-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': minor
---

Update Product Configuration extension points to use block extension api and data
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,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 ProductVariant {
id: string;
sku: string;
Expand All @@ -19,6 +21,7 @@ interface ProductVariant {
productVariantComponents: ProductVariantComponent[];
}

/* @deprecated */
export interface ProductVariantComponent {
id: string;
displayName: string;
Expand All @@ -38,9 +41,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