Skip to main content
PriceOSProvider configures auth and backend settings for all PriceOS React hooks.
Set up backend handlers first with React integration guide.

Usage

import { PriceOSProvider } from "priceos/react";

export function AppProviders({ children }: { children: React.ReactNode }) {
  return (
    <PriceOSProvider>
      {children}
    </PriceOSProvider>
  );
}

Parameters

children
ReactNode
required
Your app tree that will use PriceOS hooks.
getBearerToken
function
Returns a bearer token that is sent as Authorization: Bearer ... to your backend handler routes. Type: () => Promise<string | null | undefined>. Use this when your backend requires authenticated requests.
backendUrl
string
Base URL for your PriceOS handler routes. Default: /api/priceos. Use this if your handlers are mounted somewhere else, for example https://api.yourapp.com/priceos.
logLevel
string
Controls SDK logging output in the browser. Allowed values: "none" | "error" | "warn" | "info" | "debug". Default: "error".

Full example

import { PriceOSProvider } from "priceos/react";

export function AppProviders({ children }: { children: React.ReactNode }) {
  return (
    <PriceOSProvider
      backendUrl="https://api.yourapp.com/priceos"
      getBearerToken={async () => authUser?.getIdToken()}
      logLevel="error"
    >
      {children}
    </PriceOSProvider>
  );
}