import { useApi } from './api.mjs';
import { useSubscription } from './subscription.mjs';

/**
 * Returns the delivery group list the extension is attached to. This hook can only be used by extensions in the following
 * extension targets:
 * - purchase.checkout.shipping-option-list.render-before
 * - purchase.checkout.shipping-option-list.render-after
 */
function useDeliveryGroupListTarget() {
  const api = useApi();
  return useSubscription(api.target);
}

export { useDeliveryGroupListTarget };
