diff --git a/.changeset/deprecate-buyer-journey-intercept.md b/.changeset/deprecate-buyer-journey-intercept.md new file mode 100644 index 0000000000..afff582bdc --- /dev/null +++ b/.changeset/deprecate-buyer-journey-intercept.md @@ -0,0 +1,5 @@ +--- +'@shopify/ui-extensions': patch +--- + +Deprecate `useBuyerJourneyIntercept` and the `buyerJourney.intercept` API. Use a cart and checkout validation function instead. The buyer journey intercept will be removed in a future version of the API. diff --git a/packages/ui-extensions/docs/surfaces/checkout/generated/generated_docs_data_v2.json b/packages/ui-extensions/docs/surfaces/checkout/generated/generated_docs_data_v2.json index f1d916883d..77f9d3728c 100644 --- a/packages/ui-extensions/docs/surfaces/checkout/generated/generated_docs_data_v2.json +++ b/packages/ui-extensions/docs/surfaces/checkout/generated/generated_docs_data_v2.json @@ -1010,7 +1010,8 @@ "syntaxKind": "MethodSignature", "name": "intercept", "value": "(interceptor: Interceptor) => Promise<() => void>", - "description": "Installs a function for intercepting and preventing progress on checkout.\n\nThis returns a promise that resolves to a teardown function. Calling the teardown function removes the interceptor.\n\nTo block checkout progress, you must set the [block_progress](/docs/api/checkout-ui-extensions/{API_VERSION}/configuration#block-progress) capability in your extension's configuration.\n\nIf you do, then you're expected to inform the buyer why navigation was blocked, either by passing validation errors to the checkout UI or rendering the errors in your extension.\n\nIf the merchant hasn't allowed your extension to block checkout progress, show a warning in the [checkout editor](/docs/apps/build/checkout/test-checkout-ui-extensions#test-the-extension-in-the-checkout-editor)." + "description": "Installs a function for intercepting and preventing progress on checkout.\n\nThis returns a promise that resolves to a teardown function. Calling the teardown function removes the interceptor.\n\nTo block checkout progress, you must set the [block_progress](/docs/api/checkout-ui-extensions/{API_VERSION}/configuration#block-progress) capability in your extension's configuration.\n\nIf you do, then you're expected to inform the buyer why navigation was blocked, either by passing validation errors to the checkout UI or rendering the errors in your extension.\n\nIf the merchant hasn't allowed your extension to block checkout progress, show a warning in the [checkout editor](/docs/apps/build/checkout/test-checkout-ui-extensions#test-the-extension-in-the-checkout-editor).", + "deprecationMessage": "Use a cart and checkout validation function instead. The buyer\njourney intercept will be removed in a future version of the API." }, { "filePath": "src/surfaces/checkout/api/standard/standard.ts", @@ -1020,7 +1021,7 @@ "description": "All possible steps the buyer can take to complete checkout. These steps vary depending on whether the checkout is one-page or three-page, and on the shop's configuration." } ], - "value": "export interface BuyerJourney {\n /**\n * Installs a function for intercepting and preventing progress on checkout.\n *\n * This returns a promise that resolves to a teardown function. Calling the\n * teardown function removes the interceptor.\n *\n * To block checkout progress, you must set the [block_progress](/docs/api/checkout-ui-extensions/{API_VERSION}/configuration#block-progress)\n * capability in your extension's configuration.\n *\n * If you do, then you're expected to inform the buyer why navigation was blocked,\n * either by passing validation errors to the checkout UI or rendering the errors in your extension.\n *\n * If the merchant hasn't allowed your extension to block checkout progress, show a warning in the [checkout editor](/docs/apps/build/checkout/test-checkout-ui-extensions#test-the-extension-in-the-checkout-editor).\n */\n intercept(interceptor: Interceptor): Promise<() => void>;\n\n /**\n * Whether the buyer has completed submitting their order. When `true`, the buyer is on the order status page after submitting payment. When `false`, the buyer is still in the checkout flow.\n */\n completed: SubscribableSignalLike;\n /**\n * All possible steps the buyer can take to complete checkout. These steps vary depending on whether the checkout is one-page or three-page, and on the shop's configuration.\n */\n steps: SubscribableSignalLike;\n /**\n * The step of checkout the buyer is currently on. The value is `undefined` if the current step can't be determined.\n */\n activeStep: SubscribableSignalLike;\n}" + "value": "export interface BuyerJourney {\n /**\n * Installs a function for intercepting and preventing progress on checkout.\n *\n * This returns a promise that resolves to a teardown function. Calling the\n * teardown function removes the interceptor.\n *\n * To block checkout progress, you must set the [block_progress](/docs/api/checkout-ui-extensions/{API_VERSION}/configuration#block-progress)\n * capability in your extension's configuration.\n *\n * If you do, then you're expected to inform the buyer why navigation was blocked,\n * either by passing validation errors to the checkout UI or rendering the errors in your extension.\n *\n * If the merchant hasn't allowed your extension to block checkout progress, show a warning in the [checkout editor](/docs/apps/build/checkout/test-checkout-ui-extensions#test-the-extension-in-the-checkout-editor).\n *\n * @deprecated Use a cart and checkout validation function instead. The buyer\n * journey intercept will be removed in a future version of the API.\n */\n intercept(interceptor: Interceptor): Promise<() => void>;\n\n /**\n * Whether the buyer has completed submitting their order. When `true`, the buyer is on the order status page after submitting payment. When `false`, the buyer is still in the checkout flow.\n */\n completed: SubscribableSignalLike;\n /**\n * All possible steps the buyer can take to complete checkout. These steps vary depending on whether the checkout is one-page or three-page, and on the shop's configuration.\n */\n steps: SubscribableSignalLike;\n /**\n * The step of checkout the buyer is currently on. The value is `undefined` if the current step can't be determined.\n */\n activeStep: SubscribableSignalLike;\n}" } }, "SubscribableSignalLike": { diff --git a/packages/ui-extensions/src/surfaces/checkout/api/standard/standard.ts b/packages/ui-extensions/src/surfaces/checkout/api/standard/standard.ts index 288b701d5d..bf4875aefd 100644 --- a/packages/ui-extensions/src/surfaces/checkout/api/standard/standard.ts +++ b/packages/ui-extensions/src/surfaces/checkout/api/standard/standard.ts @@ -486,6 +486,9 @@ export interface BuyerJourney { * either by passing validation errors to the checkout UI or rendering the errors in your extension. * * If the merchant hasn't allowed your extension to block checkout progress, show a warning in the [checkout editor](https://shopify.dev/docs/apps/build/checkout/test-checkout-ui-extensions#test-the-extension-in-the-checkout-editor). + * + * @deprecated Use a cart and checkout validation function instead. The buyer + * journey intercept will be removed in a future version of the API. */ intercept(interceptor: Interceptor): Promise<() => void>; diff --git a/packages/ui-extensions/src/surfaces/checkout/preact/buyer-journey.ts b/packages/ui-extensions/src/surfaces/checkout/preact/buyer-journey.ts index f647633b57..a5179bdd09 100644 --- a/packages/ui-extensions/src/surfaces/checkout/preact/buyer-journey.ts +++ b/packages/ui-extensions/src/surfaces/checkout/preact/buyer-journey.ts @@ -50,6 +50,9 @@ export function useBuyerJourneyCompleted< * * It is good practice to show a warning in the checkout editor when the merchant has not given permission for your extension * to block checkout progress. + * + * @deprecated Use a cart and checkout validation function instead. The buyer + * journey intercept will be removed in a future version of the API. * @publicDocs */ export function useBuyerJourneyIntercept<