Behio Storefront SDK
React Hooks

Customer Hooks

React hooks for orders, profile, wishlist, and reviews

useOrders

const { data } = useOrders({ page: 1, limit: 10 });
// data: { items: OrderListItem[], total, page, totalPages }

useOrder

const { data: order } = useOrder('ORD-2026-0042');

useOrderTracking

Public tracking, no authentication required:

const { data: order } = useOrderTracking('tracking-token');

useCustomerProfile

const { data: profile } = useCustomerProfile();
// profile: { id, email, firstName, lastName, phone }

useB2bStatus, useApplyForB2b, useCompanyLookup

Partner (wholesale) account with merchant approval (SDK 2.40.0). The flow and every state are in B2B registration and approval.

// Seed with the server-resolved profile.b2b so the first render has no gap.
const { data: b2b } = useB2bStatus({ initialData: profile.b2b });
// b2b.status: NONE | PENDING | APPROVED | REJECTED | SUSPENDED

const apply = useApplyForB2b();
if (b2b?.canApply) {
  await apply.mutateAsync({ company: 'ACME s.r.o.', country: 'CZ' });
  // The cached status and profile now read PENDING.
}

// Prefill from a national register: CZ, SK, FR and NO only.
const lookup = useCompanyLookup();
const company = await lookup.mutateAsync({ country: 'CZ', registrationNo: '27074358' });

useCustomerAddresses

const { data: addresses } = useCustomerAddresses();
// addresses: { items: CustomerAddress[] }

useWishlist

const { data: wishlist } = useWishlist();

const addToWishlist = useAddToWishlist();
const removeFromWishlist = useRemoveFromWishlist();

// Toggle wishlist
const toggle = (productId: string, isInWishlist: boolean) => {
  if (isInWishlist) {
    removeFromWishlist.mutateAsync(productId);
  } else {
    addToWishlist.mutateAsync(productId);
  }
};

useProductReviews

// Fetch page one on the server and pass its result as initialData.
const { data: reviews } = useProductReviews('product-id', {page: 1, limit: 20, initialData});
// reviews: { items, averageRating, totalCount, ratingDistribution }

useSubmitReview

const submitReview = useSubmitReview();

await submitReview.mutateAsync({
  productId: 'product-id',
  rating: 5,
  title: 'Amazing!',
  content: 'Best purchase ever.',
  authorName: 'Jan',
});

useCourses

Enrolled online courses of the logged-in customer with progress (see Online Courses):

const { courses, isLoading } = useCourses();
// courses: CourseListItem[] with { courseId, name, slug, imageUrl,
//   totalLessons, completedLessons, enrolledAt, expiresAt, isExpired }

useCourse

Course player payload + lesson completion in one hook. Locked (drip) lessons carry no content until they unlock server-side:

const { course, completeLesson, isCompleting } = useCourse(courseId);
// course: CourseDetail: modules → lessons with isUnlocked/unlockAt/isCompleted

await completeLesson(lessonId); // idempotent, refreshes the course query

On this page