Skip to content
Draft
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
420 changes: 249 additions & 171 deletions packages/ui-extensions/docs/surfaces/admin/build-docs.mjs

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions packages/ui-extensions/docs/surfaces/build-doc-shared.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,30 @@ export const generateFiles = async ({
}),
);

const generatedFiles = [path.join(outputDir, generatedDocsDataFile)];
const generatedFiles = [];
if (generatedDocsDataFile) {
generatedFiles.push(path.join(outputDir, generatedDocsDataFile));
}
if (generatedStaticPagesFile) {
generatedFiles.push(path.join(outputDir, generatedStaticPagesFile));
}
const existingGeneratedFiles = generatedFiles.filter((f) => existsSync(f));

// Make sure https://shopify.dev URLs are relative so they work in Spin.
// See https://github.com/Shopify/generate-docs/issues/181
await replaceFileContent({
filePaths: generatedFiles,
searchValue: 'https://shopify.dev',
replaceValue: '',
});
if (existingGeneratedFiles.length > 0) {
await replaceFileContent({
filePaths: existingGeneratedFiles,
searchValue: 'https://shopify.dev',
replaceValue: '',
});
}

if (transformJson) {
await transformJson(path.join(outputDir, generatedDocsDataFile));
if (transformJson && generatedDocsDataFile) {
const docsDataPath = path.join(outputDir, generatedDocsDataFile);
if (existsSync(docsDataPath)) {
await transformJson(docsDataPath);
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions packages/ui-extensions/docs/surfaces/checkout/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fi

# Make sure https://shopify.dev URLs are relative.
# See https://github.com/Shopify/generate-docs/issues/181
run_sed 's/https:\/\/shopify.dev//gi' ./$DOCS_PATH/generated/generated_docs_data.json
run_sed 's/https:\/\/shopify.dev//gi' ./$DOCS_PATH/generated/generated_docs_data_v2.json
sed_exit=$?
if [ $sed_exit -ne 0 ]; then
fail_and_exit $sed_exit
Expand All @@ -111,7 +111,7 @@ if [ -d $SHOPIFY_DEV_PATH ]; then
cp ./$DOCS_PATH/generated/* $SHOPIFY_DEV_PATH/areas/platforms/shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION

# Replace 'latest' with the exact API version in relative doc links
for file in generated_docs_data.json generated_static_pages.json; do
for file in generated_docs_data_v2.json generated_static_pages.json; do
run_sed \
"s/\/docs\/api\/checkout-ui-extensions\/latest/\/docs\/api\/checkout-ui-extensions\/$API_VERSION/gi" \
"$SHOPIFY_DEV_PATH/areas/platforms/shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION/$file"
Expand Down
176,377 changes: 176,377 additions & 0 deletions packages/ui-extensions/docs/surfaces/checkout/generated/generated_docs_data_v2.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions packages/ui-extensions/docs/surfaces/point-of-sale/build-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,13 @@ const shopifyDevDBPath = path.join(
'areas/platforms/shopify-dev/db/data/docs/templated_apis',
);

const generatedDocsDataFile = 'generated_docs_data.json';
const generatedStaticPagesFile = 'generated_static_pages.json';

const componentDefs = path.join(srcPath, 'components.d.ts');
const tempComponentDefs = path.join(srcPath, 'components.ts');

const tsconfig = 'tsconfig.docs.json';

const transformJson = async (filePath) => {
let jsonData = JSON.parse((await fs.readFile(filePath, 'utf8')).toString());

jsonData = jsonData.filter(Boolean);
await fs.writeFile(filePath, JSON.stringify(jsonData, null, 2));
};

const cleanup = async () => {
try {
// Clean up temporary component definitions file
Expand Down Expand Up @@ -129,16 +121,7 @@ const generateExtensionsDocs = async () => {
scripts,
outputDir,
rootPath,
generatedDocsDataFile,
generatedStaticPagesFile,
transformJson,
});

// Update API version in relative doc links
await replaceFileContent({
filePaths: path.join(outputDir, generatedDocsDataFile),
searchValue: '/docs/api/pos-ui-extensions/[^/]*/',
replaceValue: `/docs/api/pos-ui-extensions/${EXTENSIONS_API_VERSION}/`,
});

await fs.cp(
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
],
"devDependencies": {
"@remote-ui/async-subscription": "^2.1.16",
"@shopify/generate-docs": "https://registry.npmjs.org/@shopify/generate-docs/-/generate-docs-0.19.8.tgz",
"@shopify/generate-docs": "1.0.0",
"@quilted/react-testing": "^0.6.11",
"typescript": "^4.9.0",
"@faker-js/faker": "^8.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type {Data} from '../shared';

/**
* The `ActionExtensionApi` object provides methods for action extensions that render in modal overlays. Access the following properties on the `ActionExtensionApi` object to interact with the current context, control the modal, and display picker dialogs.
*
* @publicDocs
*/
export interface ActionExtensionApi<ExtensionTarget extends AnyExtensionTarget>
extends StandardRenderingExtensionApi<ExtensionTarget> {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-extensions/src/surfaces/admin/api/block/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface Navigation {

/**
* The `BlockExtensionApi` object provides methods for block extensions that render inline content on admin pages. Access the following properties on the `BlockExtensionApi` object to interact with the current context, navigate to other extensions, and display picker dialogs.
*
* @publicDocs
*/
export interface BlockExtensionApi<ExtensionTarget extends AnyExtensionTarget>
extends StandardRenderingExtensionApi<ExtensionTarget> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ interface ShopifyFunction {

/**
* The `data` object exposed to validation settings extensions in the `admin.settings.validation.render` target. Use this to access the current validation configuration and populate your settings interface with existing values.
*
* @publicDocs
*/
export interface ValidationData {
/** The validation configuration containing the validation ID and metafields. Present when editing an existing validation, absent when creating a new validation. Use the presence of this value to determine if you're in create or edit mode. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ type MetafieldChangeResult =

/**
* A function that applies metafield changes to validation settings. Call this function with an update or removal operation, then await the Promise to receive a result indicating success or failure. Use the result to provide feedback or handle errors in your settings interface.
*
* @publicDocs
*/
export type ApplyMetafieldChange = (
change: MetafieldChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type {ExtensionTarget as AnyExtensionTarget} from '../../extension-target

/**
* The `CustomerSegmentTemplateApi` object provides methods for creating customer segment templates. Access the following properties on the `CustomerSegmentTemplateApi` object to build templates with translated content.
*
* @publicDocs
*/
export interface CustomerSegmentTemplateApi<
ExtensionTarget extends AnyExtensionTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type DiscountMethod = 'automatic' | 'code';

/**
* The `data` object exposed to discount function settings extensions in the `admin.discount-details.function-settings.render` target. Use this to access the current discount configuration and populate your settings interface with existing values.
*
* @publicDocs
*/
export interface DiscountFunctionSettingsData {
/** The discount's unique global identifier (GID) in the [GraphQL Admin API](/docs/api/admin-graphql) format (for example, `gid://shopify/DiscountAutomaticApp/123`). Use this ID to associate settings with the correct discount or query discount data. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ type MetafieldChangeResult =

/**
* A function that applies metafield changes to discount function settings. Call this function with an update or removal operation, then await the Promise to receive a result indicating success or failure. Use the result to provide feedback or handle errors in your settings interface.
*
* @publicDocs
*/
export type ApplyMetafieldChange = (
change: MetafieldChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export interface ErrorIntentResponse {

/**
* The result of an intent workflow. Check the `code` property to determine the outcome: `'ok'` for success, `'error'` for failure, or `'closed'` if the merchant cancelled.
*
* @publicDocs
*/
export type IntentResponse =
| SuccessIntentResponse
Expand All @@ -55,11 +57,13 @@ export interface IntentActivity {

/**
* The type of operation to perform: creating a new resource or editing an existing one.
* @publicDocs
*/
export type IntentAction = 'create' | 'edit';

/**
* The types of Shopify resources that support intent-based creation and editing workflows.
* @publicDocs
*/
export type IntentType =
| 'shopify/Article'
Expand All @@ -78,6 +82,7 @@ export type IntentType =

/**
* Additional parameters for intent invocation when using the string query format. Use these options to provide resource IDs for editing or pass required context data for resource creation.
* @publicDocs
*/
export interface IntentQueryOptions {
/**
Expand Down Expand Up @@ -127,6 +132,8 @@ export interface IntentQuery extends IntentQueryOptions {
* });
* const response = await activity.complete;
* ```
*
* @publicDocs
*/
export interface IntentInvokeApi {
(query: IntentQuery): Promise<IntentActivity>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {Data} from './data';

/**
* The `OrderRoutingRuleApi` object provides methods for configuring order routing rules. Access the following properties on the `OrderRoutingRuleApi` object to manage rule settings and metafields.
*
* @publicDocs
*/
export interface OrderRoutingRuleApi<ExtensionTarget extends AnyExtensionTarget>
extends StandardRenderingExtensionApi<ExtensionTarget> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,7 @@ interface Item {

/**
* The `picker` function opens a custom selection dialog with your app-specific data. It accepts configuration options to define the picker's heading, items, headers, and selection behavior. It returns a Promise that resolves to a `Picker` object with a `selected` property for accessing the merchant's selection.
*
* @publicDocs
*/
export type PickerApi = (options: PickerOptions) => Promise<Picker>;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type {Data} from '../shared';

/**
* The `PrintActionExtensionApi` object provides methods for print action extensions that generate custom printable documents. Access the following properties on the `PrintActionExtensionApi` object to access selected resources and display picker dialogs for print configuration.
*
* @publicDocs
*/
export interface PrintActionExtensionApi<
ExtensionTarget extends AnyExtensionTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export interface ProductComponent {

/**
* The `ProductDetailsConfigurationApi` object provides methods for configuring product bundles and relationships. Access the following properties on the `ProductDetailsConfigurationApi` object to build product configuration interfaces.
*
* @publicDocs
*/
export interface ProductDetailsConfigurationApi<
ExtensionTarget extends AnyExtensionTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export interface ProductVariantComponent {

/**
* The `ProductVariantDetailsConfigurationApi` object provides methods for configuring product variant bundles and relationships. Access the following properties on the `ProductVariantDetailsConfigurationApi` object to build variant configuration interfaces.
*
* @publicDocs
*/
export interface ProductVariantDetailsConfigurationApi<
ExtensionTarget extends AnyExtensionTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type {ExtensionTarget as AnyExtensionTarget} from '../extension-targets';

/**
* The `PurchaseOptionsCardConfigurationApi` object provides methods for action extensions that interact with purchase options and selling plans. Access the following properties on the `PurchaseOptionsCardConfigurationApi` object to work with selected products and their associated subscription configurations.
*
* @publicDocs
*/
export interface PurchaseOptionsCardConfigurationApi<
ExtensionTarget extends AnyExtensionTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ type WithSelection<T> = T & {

/**
* The payload returned when resources are selected from the picker.
*
* @publicDocs
*/
type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<
export type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<
ResourceSelection<Type>[]
>;

Expand Down Expand Up @@ -360,6 +362,8 @@ interface Filters {

/**
* The `ResourcePickerOptions` object defines how the resource picker behaves, including which resource type to display, selection limits, filters, and preselected items. Access the following properties on the `ResourcePickerOptions` object to configure the resource picker's appearance and functionality.
*
* @publicDocs
*/
export interface ResourcePickerOptions {
/**
Expand Down Expand Up @@ -394,6 +398,8 @@ export interface ResourcePickerOptions {

/**
* Opens the resource picker modal for selecting products, variants, or collections. Returns the selected resources when the user confirms their selection, or undefined if they cancel.
*
* @publicDocs
*/
export type ResourcePickerApi = (
options: ResourcePickerOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export interface ShouldRenderOutput {

/**
* The `ShouldRenderApi` object provides methods for controlling action extension visibility. Access the following properties on the `ShouldRenderApi` object to determine whether an associated action should appear based on the current context.
*
* @publicDocs
*/
export interface ShouldRenderApi<ExtensionTarget extends AnyExtensionTarget>
extends StandardApi<ExtensionTarget> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ interface Auth {

/**
* The `StandardApi` object provides core methods available to all extension targets. Access the following properties on the `StandardApi` object to authenticate users, query the [GraphQL Admin API](/docs/api/admin-graphql), translate content, handle intents, and persist data.
*
* @publicDocs
*/
export interface StandardApi<ExtensionTarget extends AnyExtensionTarget> {
/**
Expand Down
Loading
Loading