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

Redirect order-status targets to customer account instead of checkout targets #4410

Merged
merged 1 commit into from
Sep 4, 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
19 changes: 10 additions & 9 deletions packages/app/src/cli/services/dev/extension/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ describe('getExtensionPointTargetSurface()', () => {
expect(getExtensionPointTargetSurface('purchase.thank-you.cart-line-list.render-after')).toBe('checkout')
})

test('returns "checkout" for a checkout UI extension target that starts with customer-account', async () => {
expect(getExtensionPointTargetSurface('customer-account.order-status.block.render')).toBe('checkout')
expect(getExtensionPointTargetSurface('customer-account.order-status.customer-information.render-after')).toBe(
'checkout',
)
expect(getExtensionPointTargetSurface('customer-account.order-status.cart-line-item.render-after')).toBe('checkout')
expect(getExtensionPointTargetSurface('customer-account.order-status.cart-line-list.render-after')).toBe('checkout')
})

test('returns "customer-accounts" for a Customer Account UI extension', async () => {
expect(getExtensionPointTargetSurface('customer-account.dynamic.render')).toBe('customer-accounts')
expect(getExtensionPointTargetSurface('customer-account.order-status.block.render')).toBe('customer-accounts')
expect(getExtensionPointTargetSurface('customer-account.order-status.customer-information.render-after')).toBe(
'customer-accounts',
)
expect(getExtensionPointTargetSurface('customer-account.order-status.cart-line-item.render-after')).toBe(
'customer-accounts',
)
expect(getExtensionPointTargetSurface('customer-account.order-status.cart-line-list.render-after')).toBe(
'customer-accounts',
)
})

test('returns "post_purchase" for a Post Purchase UI extension', async () => {
Expand Down
12 changes: 0 additions & 12 deletions packages/app/src/cli/services/dev/extension/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import {ExtensionInstance} from '../../../models/extensions/extension-instance.j

import {fetchProductVariant} from '../../../utilities/extensions/fetch-product-variant.js'

const CUSTOMER_ACCOUNT_CHECKOUT_RENDERED_TARGETS = new Set([
'customer-account.order-status.cart-line-item.render-after',
'customer-account.order-status.cart-line-list.render-after',
'customer-account.order-status.customer-information.render-after',
'customer-account.order-status.block.render',
])

/**
* To prepare UI Extensions targeting Checkout for dev'ing we need to retrieve a valid product variant ID
* @param extensions - The UI Extensions to dev
Expand Down Expand Up @@ -41,12 +34,7 @@ export function getExtensionPointTargetSurface(extensionPointTarget: string) {
}

// Covers Customer Accounts UI extensions (future)
case 'customeraccount':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from the legacy customer account targets, which are not used anymore

case 'customer-account': {
if (CUSTOMER_ACCOUNT_CHECKOUT_RENDERED_TARGETS.has(extensionPointTarget)) {
return 'checkout'
}

return 'customer-accounts'
}

Expand Down
Loading