Gatsby

IntelligemsGatsbyProvider

interface IgUserContext {
  id?: string;
  isPreview?: boolean;
  isIntegration?: boolean;
  isPreviewAllTraffic?: boolean;
  originalSlug?: string;
  exps?: Record<string, string>;
  ign?: Record<string, string>;
}

interface IgConfig extends Nullable<IgUserContext> {
  config: PluginConfigType | null; // Internal Type
}

export type ActiveCurrency = string | (() => string);
type PriceFormat = 'dollars' | 'cents';

interface IntelligemsGatsbyProvider {
  ig: IgConfig;
  organizationId: string; // required
  activeCurrencyCode?: ActiveCurrency;
  storefrontApiToken: string;
  debug?: boolean;
  priceFormat?: PriceFormat;
  version?: '12' | '13';
  children?: ReactNode;
}

export default function MyApp({ Component, pageProps }: AppProps) {
  return (
      <IntelligemsNextProvider
          storefrontApiToken={process.env.GATSBY_STOREFRONT_ACCESS_TOKEN}
          antiFlicker={true}
          organizationId={process.env.GATSBY_INTELLIGEMS_ORG_ID!}
      >
        ...
      </IntelligemsNextProvider>
  )
}

Modifying State Directly

The following options are availble to change the Intelligems Context directly:

Last updated