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

Add print targets #2065

Merged
merged 1 commit into from
Jun 12, 2024
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
6 changes: 6 additions & 0 deletions .changeset/tall-fireants-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/ui-extensions': minor
'@shopify/ui-extensions-react': minor
---

Add admin print action targets
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,35 @@ You register targets in your \`shopify.extension.toml\` and inside the Javascrip
},
],
},
{
type: 'GenericAccordion',
title: 'Admin print action locations',
anchorLink: 'print-locations',
sectionContent:
'Admin print action extensions appear on order and product pages in the admin.',
accordionContent: [
{
title: 'Order details',
description:
'This page shows information about a single order. The `admin.order-details.print-action.render` target is available on this page.',
},
{
title: 'Product details',
description:
'This page shows information about a single product. The `admin.product-details.print-action.render` target is available on this page.',
},
{
title: 'Order index selection',
description:
'This page shows a table of multiple orders. The `admin.order-index.selection-print-action.render` target is available on this page when multiple orders are selected.',
},
{
title: 'Product index selection',
description:
'This page shows a table of multiple products. The `admin.product-index.selection-print-action.render` target is available on this page when multiple products are selected.',
},
],
},
{
type: 'Markdown',
title: 'Customer segmentation locations',
Expand Down
1 change: 1 addition & 0 deletions packages/ui-extensions/src/surfaces/admin/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type {Navigation} from './api/block/block';
export type {CustomerSegmentTemplateApi} from './api/customer-segment-template/customer-segment-template';
export type {ActionExtensionApi} from './api/action/action';
export type {BlockExtensionApi} from './api/block/block';
export type {PrintActionExtensionApi} from './api/print-action/print-action';
export type {ProductDetailsConfigurationApi} from './api/product-configuration/product-details-configuration';
export type {ProductVariantDetailsConfigurationApi} from './api/product-configuration/product-variant-details-configuration';
export type {OrderRoutingRuleApi} from './api/order-routing-rule/order-routing-rule';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';

const data: ReferenceEntityTemplateSchema = {
name: 'Print Action Extension API',
description:
'This API is available to all print action extension types. Note that the [`AdminPrintAction`](/docs/api/admin-extensions/components/other/adminprintaction) component is required to build admin print action extensions.',
isVisualComponent: false,
type: 'API',
definitions: [
{
title: 'PrintActionExtensionApi',
description: '',
type: 'PrintActionExtensionApi',
},
],
category: 'API',
related: [],
};

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type {StandardApi} from '../standard/standard';
import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-targets';
import type {Data} from '../shared';

export interface PrintActionExtensionApi<
ExtensionTarget extends AnyExtensionTarget,
> extends StandardApi<ExtensionTarget> {
/**
* Information about the currently viewed or selected items.
*/
data: Data;
}
49 changes: 47 additions & 2 deletions packages/ui-extensions/src/surfaces/admin/extension-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
CustomerSegmentTemplateApi,
ActionExtensionApi,
BlockExtensionApi,
PrintActionExtensionApi,
ProductDetailsConfigurationApi,
ProductVariantDetailsConfigurationApi,
OrderRoutingRuleApi,
Expand Down Expand Up @@ -252,7 +253,7 @@ export interface ExtensionTargets {
>;

/**
* Renders an admin action extension in the abandonded checkout page. Open this extension from the "More Actions" menu.
* Renders an admin action extension in the abandoned checkout page. Open this extension from the "More Actions" menu.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
Expand Down Expand Up @@ -335,7 +336,7 @@ export interface ExtensionTargets {
>;

/**
* Renders an admin action extension in the customer index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime.
* Renders an admin action extension in the customer index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
Expand All @@ -354,6 +355,50 @@ export interface ExtensionTargets {
AllComponents
>;

// Print actions and bulk print actions

/**
* Renders an admin print action extension in the order index page when multiple resources are selected. Open this extension from the "Print" menu of the resource list. The resource ids are available to this extension at runtime.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
'admin.order-details.print-action.render': RenderExtension<
PrintActionExtensionApi<'admin.order-details.print-action.render'>,
AllComponents
>;

/**
* Renders an admin print action extension in the product index page when multiple resources are selected. Open this extension from the "Print" menu of the resource list. The resource ids are available to this extension at runtime.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
'admin.product-details.print-action.render': RenderExtension<
PrintActionExtensionApi<'admin.product-details.print-action.render'>,
AllComponents
>;

/**
* Renders an admin print action extension in the order index page when multiple resources are selected. Open this extension from the "Print" menu of the resource list. The resource ids are available to this extension at runtime.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
'admin.order-index.selection-print-action.render': RenderExtension<
PrintActionExtensionApi<'admin.order-index.selection-print-action.render'>,
AllComponents
>;

/**
* Renders an admin print action extension in the product index page when multiple resources are selected. Open this extension from the "Print" menu of the resource list. The resource ids are available to this extension at runtime.
*
* See the [list of available components](/docs/api/admin-extensions/components).
*/
'admin.product-index.selection-print-action.render': RenderExtension<
PrintActionExtensionApi<'admin.product-index.selection-print-action.render'>,
AllComponents
>;

// Other

/**
* Renders Product Configuration on product details and product variant details
*
Expand Down
Loading