Skip to content

Commit

Permalink
Merge pull request #4410 from Shopify/customer-account-order-status
Browse files Browse the repository at this point in the history
Redirect order-status targets to customer account instead of checkout targets
  • Loading branch information
lihaokx authored Sep 4, 2024
2 parents 57fa9e1 + e34f232 commit 93fc48c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
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':
case 'customer-account': {
if (CUSTOMER_ACCOUNT_CHECKOUT_RENDERED_TARGETS.has(extensionPointTarget)) {
return 'checkout'
}

return 'customer-accounts'
}

Expand Down

0 comments on commit 93fc48c

Please sign in to comment.