Skip to main content

OMS

The @hv/oms package exposes a vendor-agnostic interface to vendor specific OMS integrations.

Integration Function​

The integration function creates an OMS instance, the vendor-agnostic interface to the OMS provider. It is intended to be used in server components or route handlers.

This Function is Server Only

Do not try to instantiate the OMS() function in client ("use client") components. Use the wrapping hooks provided in this package instead which expose these methods to the client.

Usage​

Example usage:

import { OMS } from '@hv/oms';

...

const { getOrder } = OMS({
locale: 'en-US',
});

const orderResult = await getOrder(orderID);

API​

The @hv/oms package contains an /api folder that exports code to stand-up Next.js Route Handlers.

These endpoints each correspond to a React hook from the @hv/oms/client export, and use OMS as the underlying implementation.

Together these are useful for fetching and mutating data in client components.

Endpoints​

Typically you would only call these endpoints via their corresponding use...() hook in a client component.

getAvailability​

Retrieve the availability of a product by its ID.

note

Allows for real-time product availability lookups by the front-end.

getOrder​

Retrieve an order by its ID.

getOrderHistory​

Retrieve the order history for the current user.

Hooks​

@hv/oms/client exports React hooks for fetching order and product availability objects.

useOrder()​

Provides functionality to fetch details of a specific order by order ID via API and update status in the UX.

useOrderHistory()​

Provides functionality to fetch the order history for the current user via API and update status in the UX.

useProductAvailability()​

Provides functionality to fetch the availability of a product by its ID via API and update status in the UX.

note

The High Velocity front-end app uses this hook to check real-time product availability on the PDP. For ex., low stock can show a message, while out of stock can disable adding to cart.

Reference​

For more documentation on the models available in this package, check out the reference section:

Reference