@@ -24,13 +24,9 @@ import {
2424import { useCurrentCustomer } from '@salesforce/retail-react-app/app/hooks/use-current-customer'
2525import { useCurrentBasket } from '@salesforce/retail-react-app/app/hooks/use-current-basket'
2626import { useToast } from '@salesforce/retail-react-app/app/hooks/use-toast'
27- import { Text , Button , Box } from '@salesforce/retail-react-app/app/components/shared/ui'
27+ import { Text } from '@salesforce/retail-react-app/app/components/shared/ui'
2828import { isPickupShipment } from '@salesforce/retail-react-app/app/utils/shipment-utils'
2929import { getConfig } from '@salesforce/pwa-kit-runtime/utils/ssr-config'
30- import { useSelectedStore } from '@salesforce/retail-react-app/app/hooks/use-selected-store'
31- import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation'
32- import usePickupShipment from '@salesforce/retail-react-app/app/hooks/use-pickup-shipment'
33- import { STORE_LOCATOR_IS_ENABLED } from '@salesforce/retail-react-app/app/constants'
3430
3531const submitButtonMessage = defineMessage ( {
3632 defaultMessage : 'Continue to Shipping Method' ,
@@ -68,11 +64,6 @@ export default function ShippingAddress() {
6864
6965 const hasMultipleDeliveryShipments = deliveryShipments . length > 1
7066
71- const storeLocatorEnabled = getConfig ( ) ?. app ?. storeLocatorEnabled ?? STORE_LOCATOR_IS_ENABLED
72- const { selectedStore} = useSelectedStore ( )
73- const { navigate} = useNavigation ( )
74- const { updatePickupShipment} = usePickupShipment ( basket )
75-
7667 // Prepare a shipping methods query we can manually refetch after address updates
7768 const shippingMethodsQuery = useShippingMethodsForShipment (
7869 {
@@ -86,29 +77,6 @@ export default function ShippingAddress() {
8677 }
8778 )
8879
89- const switchToPickup = async ( ) => {
90- try {
91- if ( ! selectedStore ?. inventoryId ) {
92- navigate ( '/store-locator' )
93- return
94- }
95- const refreshed = await currentBasketQuery . refetch ( )
96- const latestBasketId = refreshed ?. data ?. basketId || basket . basketId
97- await updatePickupShipment ( latestBasketId , selectedStore )
98- await currentBasketQuery . refetch ( )
99- goToStep ( STEPS . PICKUP_ADDRESS )
100- } catch ( _e ) {
101- toast ( {
102- title : formatMessage ( {
103- defaultMessage :
104- 'We could not switch to Store Pickup. Please try again or choose a different store.' ,
105- id : 'shipping_address.error.switch_to_pickup_failed'
106- } ) ,
107- status : 'error'
108- } )
109- }
110- }
111-
11280 const submitAndContinue = async ( address ) => {
11381 setIsLoading ( true )
11482 try {
@@ -314,24 +282,12 @@ export default function ShippingAddress() {
314282 onBackToSingle = { ( ) => setIsMultiShipping ( false ) }
315283 />
316284 ) : (
317- < >
318- { storeLocatorEnabled && (
319- < Box mb = { 3 } >
320- < Button variant = "link" onClick = { switchToPickup } >
321- { formatMessage ( {
322- defaultMessage : 'Pick up in store' ,
323- id : 'shipping_address.action.pickup_in_store'
324- } ) }
325- </ Button >
326- </ Box >
327- ) }
328- < ShippingAddressSelection
329- selectedAddress = { selectedShippingAddress }
330- submitButtonLabel = { submitButtonMessage }
331- onSubmit = { submitAndContinue }
332- formTitleAriaLabel = { shippingAddressAriaLabel }
333- />
334- </ >
285+ < ShippingAddressSelection
286+ selectedAddress = { selectedShippingAddress }
287+ submitButtonLabel = { submitButtonMessage }
288+ onSubmit = { submitAndContinue }
289+ formTitleAriaLabel = { shippingAddressAriaLabel }
290+ />
335291 ) }
336292 </ ToggleCardEdit >
337293 { ( hasMultipleDeliveryShipments || isAddressFilled ) && (
0 commit comments