Alokai
Change log

@vue-storefront/next

9.0.0

Minor Changes

  • ADDED @vue-storefront/next/instrumentation export with a ready-to-use register hook. Wire it up from your app's root instrumentation.ts (export { register } from "@vue-storefront/next/instrumentation";) to re-emit Next.js' raw, multi-line console.error/warn dumps - which log collectors (GCP, Datadog, Elasticsearch) cannot parse - as single structured GCP JSON entries matching the middleware log format. register installs a console→logger bridge that normalizes every server console.error/warn (rendering Errors with their stack) and drops empty spacing lines. Active only in production Node runtime; local dev output is unchanged.

  • ADDED The storefront logger now emits a one-time warning in a production Node server when instrumentation.ts did not wire the Alokai register hook, so a missing setup is surfaced instead of silently skipping SSR log normalization.

Patch Changes

  • Updated dependencies:
    • @alokai/connect@2.4.0

8.0.2

Patch Changes

  • Updated dependencies:
    • @alokai/connect@2.3.2

8.0.1

Patch Changes

  • Updated dependencies:
    • @alokai/connect@2.3.1

8.0.0

Minor Changes

  • ADDED createImageOptimizer factory, exported from @vue-storefront/next. It returns a Next.js custom image loader (for images.loaderFile) and a GET route handler for app/img-proxy/[host]/[...path]/route.ts, which together let an image CDN in front of the storefront (the Alokai Image Optimizer) optimize media-host images. Supports multiple media hosts (host key derives the env variable name, e.g. ct -> NEXT_PUBLIC_CT_MEDIA_HOST), a sapcc variant for the ?context= query parameter, per-host cacheControl, and per-host loader/encodePath/buildUpstreamUrl overrides for hosts with their own image CDN or unsupported URL schemes. Compared to the hand-written store implementations it replaces, a missing SAP CC context parameter now passes the URL through instead of emitting a null segment, and upstream network errors return a deterministic 502 instead of crashing the handler.

  • ADDED Environment variable toggle to enable or disable the image optimizer at runtime. Set NEXT_PUBLIC_IMAGE_OPTIMIZER_ENABLED=true (Next.js) or NUXT_PUBLIC_IMAGE_OPTIMIZER_ENABLED=true (Nuxt) to activate the optimizer; when unset or set to any other value, image URLs are passed through unchanged and the optimizer route returns 404.

  • ADDED createStorefrontEvents factory, exported from @vue-storefront/next/client — a typed, client-side pub/sub for storefront domain events. The app declares its own event map and creates the bound emitStorefrontEvent / subscribeStorefrontEvent / useStorefrontEvent / StorefrontEventEmitter helpers once; modules (analytics, personalization, search) emit and subscribe without the core knowing who listens. useStorefrontEvent reads the handler through a ref so an inline handler doesn't re-subscribe every render; StorefrontEventEmitter emits once per mount (Strict-Mode-safe) for server-rendered pages.

  • ADDED getCurrentPath helper, exported from @vue-storefront/next/server — returns the current request path (pathname + search) inside an App-Router Server Component, reading the headers set by createAlokaiMiddleware so the underlying header names stay an implementation detail. It lives in a dedicated server entry (not the main one) because it imports next/headers, which is unavailable in the client / Pages Router bundles that also import the package.

  • ADDED Generic storefront extension points (seams) in the Next.js storefront for listing/search composition: a pluggable listing data source (default: unified searchProducts), module-contributed providers / root components / facet renderers, a search-results slot (default: popular searches), a search-form seam (default: submit navigates to the search page), a client-hydration provider, and the storefront event bus. All default to native behaviour when no module is installed, so a store that never installs a search module is unaffected.

  • CHANGED The search modal composes a search-form seam (input + submit) above the search-results-slot. The form seam owns submit and reports the live query via onQueryChange, so a submit-intercepting module (compass — classify the query, open the AI chat) and an as-you-type module (coveo — instant results) plug into the same input independently. Compass now overlays the search-form seam instead of the base search.tsx component.

Patch Changes

  • FIXED env('NEXT_PUBLIC_*') now returns the correct value on the client during the first render and inside initial useEffect calls. Previously, runtime env vars were undefined until shortly after hydration, which could break integrations that read them eagerly — for example, the SAP CDC module's getCdcConfig() returned no API key on first render and failed to load the Gigya SDK.
  • FIXED AlokaiInstrumentation now reliably captures the initial page view and any navigation that happens during page load. Previously, the history-trace script started running after hydration, so the very first page view and any router navigation triggered before that point were not reported.
  • FIXED The image optimizer proxy route no longer follows upstream redirects (fetch is called with redirect: "manual"), preventing SSRF via an open redirect on a configured media host (e.g. to internal cloud metadata endpoints). An upstream 3xx is now treated as a 502 upstream error instead of being forwarded without its Location header.
  • CHANGED Node engines tightened to ^20.10.0 || >=22.14.0 to match the runtime support range for JSON ESM imports with with { type: "json" }.
  • Updated dependencies:
    • @alokai/connect@2.3.0
    • @alokai/instrumentation-next-component@1.0.4

7.0.2

Patch Changes

  • FIXED env('NEXT_PUBLIC_*') now returns the correct value on the client during the first render and inside initial useEffect calls. Previously, runtime env vars were undefined until shortly after hydration, which could break integrations that read them eagerly — for example, the SAP CDC module's getCdcConfig() returned no API key on first render and failed to load the Gigya SDK.
  • FIXED AlokaiInstrumentation now reliably captures the initial page view and any navigation that happens during page load. Previously, the history-trace script started running after hydration, so the very first page view and any router navigation triggered before that point were not reported.
  • Updated dependencies:
    • @alokai/instrumentation-next-component@1.0.3

7.0.1

Patch Changes

  • CHANGED Improve application performance
  • Updated dependencies:
    • @alokai/instrumentation-next-component@1.0.2

7.0.0

Major Changes

  • CHANGEDBREAKING Requires Next@15 - please make sure to update your Next.js version. Now getRequestHeaders accepts headers as Headers Node type (as per new next/headers typings).
  • CHANGEDBREAKING Update peer dependencies to Next@15 and React@19.
  • CHANGEDBREAKING Update package API typings.

Minor Changes

  • ADDED Runtime environment variable support via env() function in @vue-storefront/next. This replaces the next-runtime-env package with a built-in solution that automatically injects NEXT_PUBLIC_* environment variables into the client-side for runtime access. The new solution provides a unified env() function that works on both server and client, automatic injection of NEXT_PUBLIC_* variables via AlokaiProvider, no additional configuration or props needed, and supports runtime environment changes (e.g., in Alokai Console).

Migration Guide

If you're currently using next-runtime-env, follow these steps:

  1. Update imports

Replace next-runtime-env imports with @vue-storefront/next:

- import { env } from "next-runtime-env";
+ import { env } from "@vue-storefront/next";

Files to update:

  • sdk/options.ts
  • config/image-loaders/cloudinary/cloudinary.ts
  • Any other files using next-runtime-env
  1. Add missing imports in next.config.mjs

If you're using env() in your next.config.mjs, add the import:

+ import { env } from "@vue-storefront/next";
  import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from 'next/constants.js';

  const nextConfig = {
    images: env('NEXT_PUBLIC_IMAGE_LOADER_FETCH_URL') ? cloudinaryConfig : defaultImageConfig,
  };
  1. Remove useEnvContext and PublicEnvScript

Remove any usage of useEnvContext() hook:

- import { useEnvContext } from "next-runtime-env";
+ import { env } from "@vue-storefront/next";

  export function MyComponent() {
-   const env = useEnvContext();
-   const apiUrl = env.NEXT_PUBLIC_API_URL;
+   const apiUrl = env("NEXT_PUBLIC_API_URL");
  }

Remove <PublicEnvScript /> from your layout:

- import { PublicEnvScript } from "next-runtime-env";

  export default function RootLayout({ children }) {
    return (
      <html>
        <head>
-         <PublicEnvScript />
        </head>
      </html>
    );
  }
  1. Remove next-runtime-env package from apps/storefront-unified-nextjs/package.json

Patch Changes

  • FIXED Next.js security fixes
  • FIXED Standardize type usage to always reference API type packages across integrations and SDKs.
  • Updated dependencies:
    • @alokai/connect@2.0.0
    • @alokai/instrumentation-next-component@1.0.1

6.1.0

Minor Changes

Introduced Alokai instrumentation support

Patch Changes

  • Updated dependencies:
    • @alokai/instrumentation-next-component@1.0.0

6.0.0

Major Changes

  • CHANGED Guarantee compatibility with @alokai/connect package.
  • CHANGED Updated the package for compatibility with Node.js 22.

Key Updates:

  • Upgraded to the latest version of Node.js 22
  • Updated CI pipelines to use Node.js 22 for consistency.
  • Updated .nvmrc or .node-version files to specify Node.js version 22.14.
  • Upgraded @types/node to version ^22.13.17 for compatibility with the latest Node.js features.

Recommendations:

  • Use Node.js version 22.14.0 or higher for optimal performance, security, and compatibility.
  • While Node.js 20 is technically supported, it is not recommended as it may cause compatibility issues with certain packages and has not been thoroughly tested. CHANGED Replaced core dependencies with a new @alokai/connect package. @vue-storefront/middleware, @vue-storefront/sdk, vue-storefront/logger, vue-storefront/unified-data-model, @vue-storefront/multistore were replaced with @alokai/connect. The replacement preserves the same functionality and interface as the original packages. To read more about the @alokai/connect package, please refer to the documentation.

Minor Changes

  • ADDED createAlokaiMiddleware to @vue-storefront/next - a wrapper for a Next.js middleware which registers the Alokai-specific logic.

Example usage

// apps/storefront-unified-nextjs/middleware.ts
import { createAlokaiMiddleware } from "@vue-storefront/next";

export default createAlokaiMiddleware(async (request) => {
  // your middleware logic
});
  • ADDED to @vue-storefront/next getPathnameFromRequestHeaders function which allows getting pathname from the request headers during the server side rendering. It requires createAlokaiMiddleware to be used in the middleware.ts file.

  • ADDED getSdk method has a new configuration option: getLocale. It allows you to pass a function that resolves with locale code which will be used in the next HTTP request:

    const { getSdk } = createSdk(sdkOptions, getSdkConfig());
    const locale = useLocale();
    
    getSdk({ getLocale: () => locale });
  • ADDED - every requests now contains additional "x-alokai-locale" header.

  • ADDED The x-search is now appended to NextJS request object inside the createAlokaiMiddleware function.

  • ADDED The library now re-exports defineGetConfigSwitcherHeader from @alokai/connect/sdk;

  • REMOVED The getPathnameFromRequestHeaders function has been removed from the library.

  • ADDED Module-based SDK configuration with defineSdkModule and enhanced defineSdkConfig. This new approach allows for better code organization and reusability of SDK modules. For more details, see the SDK documentation.

Before (all modules inline in the config file)

apps/storefront-unified-nextjs/sdk/config.ts

const config = defineSdkConfig(
  ({ buildModule, middlewareModule, config, getRequestHeaders }) => ({
    unified: buildModule(middlewareModule<UnifiedEndpoints>, {
      apiUrl: `${config.apiUrl}/commerce/unified`,
      ssrApiUrl: `${config.ssrApiUrl}/commerce/unified`,
      cdnCacheBustingId: config.cdnCacheBustingId,
      defaultRequestConfig: {
        getConfigSwitcherHeader,
        headers: getRequestHeaders(),
      },
      methodsRequestConfig:
        config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
    }),
  }),
);

After (modules extracted to separate files)

apps/storefront-unified-nextjs/sdk/modules/unified.ts

// Define reusable module
const unified = defineSdkModule(
  ({ buildModule, config, getRequestHeaders, middlewareModule }) =>
    buildModule(middlewareModule<UnifiedEndpoints>, {
      apiUrl: `${config.apiUrl}/commerce/unified`,
      ssrApiUrl: `${config.ssrApiUrl}/commerce/unified`,
      cdnCacheBustingId: config.cdnCacheBustingId,
      defaultRequestConfig: {
        getConfigSwitcherHeader,
        headers: getRequestHeaders(),
      },
      methodsRequestConfig:
        config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
    }),
);

apps/storefront-unified-nextjs/sdk/modules/index.ts

export * from "./unified";

apps/storefront-unified-nextjs/sdk/config.ts

import * as modules from "./modules";

const config = defineSdkConfig(modules);

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0

6.0.0-rc.5

Minor Changes

  • ADDED The x-search is now appended to NextJS request object inside the createAlokaiMiddleware function.
  • ADDED The library now re-exports defineGetConfigSwitcherHeader from @alokai/connect/sdk;
  • REMOVED The getPathnameFromRequestHeaders function has been removed from the library.
  • ADDED Module-based SDK configuration with defineSdkModule and enhanced defineSdkConfig. This new approach allows for better code organization and reusability of SDK modules. For more details, see the SDK documentation.

Before

const config = defineSdkConfig(
  ({ buildModule, middlewareModule, config, getRequestHeaders }) => ({
    unified: buildModule(middlewareModule<UnifiedEndpoints>, {
      apiUrl: `${config.apiUrl}/commerce/unified`,
      ssrApiUrl: `${config.ssrApiUrl}/commerce/unified`,
      cdnCacheBustingId: config.cdnCacheBustingId,
      defaultRequestConfig: {
        getConfigSwitcherHeader,
        headers: getRequestHeaders(),
      },
      methodsRequestConfig:
        config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
    }),
  }),
);

After

// Define reusable module
const unified = defineSdkModule(
  ({ buildModule, config, getRequestHeaders, middlewareModule }) =>
    buildModule(middlewareModule<UnifiedEndpoints>, {
      apiUrl: `${config.apiUrl}/commerce/unified`,
      ssrApiUrl: `${config.ssrApiUrl}/commerce/unified`,
      cdnCacheBustingId: config.cdnCacheBustingId,
      defaultRequestConfig: {
        getConfigSwitcherHeader,
        headers: getRequestHeaders(),
      },
      methodsRequestConfig:
        config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
    }),
);

// Use module in config
const config = defineSdkConfig({
  unified,
});

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0-rc.4

6.0.0-rc.4

Major Changes

  • CHANGED Updated the package for compatibility with Node.js 22.

Key Updates:

  • Upgraded to the latest version of Node.js 22
  • Updated CI pipelines to use Node.js 22 for consistency.
  • Updated .nvmrc or .node-version files to specify Node.js version 22.14.
  • Upgraded @types/node to version ^22.13.17 for compatibility with the latest Node.js features.

Recommendations:

  • Use Node.js version 22.14.0 or higher for optimal performance, security, and compatibility.
  • While Node.js 20 is technically supported, it is not recommended as it may cause compatibility issues with certain packages and has not been thoroughly tested.

Minor Changes

  • ADDED createAlokaiMiddleware to @vue-storefront/next - a wrapper for a Next.js middleware which registers the Alokai-specific logic.

Example usage

// apps/storefront-unified-nextjs/middleware.ts
import { createAlokaiMiddleware } from "@vue-storefront/next";

export default createAlokaiMiddleware(async (request) => {
  // your middleware logic
});
  • ADDED to @vue-storefront/next getPathnameFromRequestHeaders function which allows getting pathname from the request headers during the server side rendering. It requires createAlokaiMiddleware to be used in the middleware.ts file.

  • ADDED getSdk method has a new configuration option: getLocale. It allows you to pass a function that resolves with locale code which will be used in the next HTTP request:

    const { getSdk } = createSdk(sdkOptions, getSdkConfig());
    const locale = useLocale();
    
    getSdk({ getLocale: () => locale });
  • ADDED - every requests now contains additional "x-alokai-locale" header.

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0-rc.3

6.0.0-rc.3

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0-rc.2

6.0.0-rc.2

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0-rc.1

6.0.0-rc.1

Major Changes

Update packages to work with connect rc version

Patch Changes

  • Updated dependencies:
    • @alokai/connect@1.0.0-rc.0

6.0.0-rc.0

Major Changes

Replace legacy packages with a connect package

5.1.0

Minor Changes

  • CHANGED changed metatags content to fit new company name

5.0.0

Major Changes

  • CHANGED The config parameter available in the callback passed to defineSdkConfig() no longer contains computed middlewareUrl property. It now exposes apiUrl and ssrApiUrl that should be used instead.
  • CHANGED The middleware.ssrApiUrl parameter is now required in the resolveSdkOptions() method.

Migration guide

  1. Update environment variables

In the apps/storefront-unified-nextjs/sdk/options.ts file, verify the NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL environment variable exists:

const ssrApiUrl = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL');

+ if (!ssrApiUrl) {
+   throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL is required to run the app');
+ }

See our guide on initializing the SDK for a complete version of the file.

  1. Update SDK configuration file

Update your SDK configuration file (apps/storefront-unified-nextjs/sdk/config.ts) so that registered modules use apiUrl and ssrApiUrl properties instead of middlewareUrl.

import { defineSdkConfig } from '@vue-storefront/next';

export function getSdkConfig() {
  return defineSdkConfig(({ buildModule, config, getRequestHeaders, middlewareModule }) => ({
    commerce: buildModule(middlewareModule, {
-     apiUrl: `${config.middlewareUrl}/commerce`,
+     apiUrl: `${config.apiUrl}/commerce`,
+     ssrApiUrl: `${config.ssrApiUrl}/commerce`,
    }),
  }));
}

4.3.2

Patch Changes

  • CHANGED getSdk' getRequestHeaders configuration property now allows you to pass in method returning both headers and cookies of your next application.

4.3.1

Patch Changes

  • CHANGED Update JSDoc for createAlokaiContext method.

4.3.0

Minor Changes

ADDED support for the logger utility and createLogger function to initialize the logger on the storefront layer

4.2.0

Minor Changes

  • CHANGED defaultMethodsRequestConfig, so the getCategory, and getPage methods will use GET request as a default.

4.1.1

Patch Changes

  • CHANGED the package @vue-storefront/sdk is now a peer dependency instead of dependency

4.1.0

Minor Changes

  • [CHANGE]: Added the resolveSdkOptions helper that automatically setup proper SSR & SPA URLs for middleware when multistore option is enabled. To use it, change your SDK configuration:
-import type { CreateSdkOptions } from '@vue-storefront/next';
+import { resolveSdkOptions } from '@vue-storefront/next';

-const options: CreateSdkOptions = {
+const options = resolveSdkOptions({
  middleware: {
    apiUrl,
    cdnCacheBustingId,
    ssrApiUrl,
  },
  multistore: {
    enabled: isMultiStoreEnabled,
  },
});

4.0.0

  • ADDED Global State Management with Zustand to improve state organization and sharing across your application.

    • Hooks Available:
      • useSfCartState: Access and update cart state.
      • useSfCustomerState: Manage customer information.
      • useSfCurrencyState and useSfCurrenciesState: Handle currency data.
      • useSfLocaleState and useSfLocalesState: Manage locale settings.
    • State Ready to be Shared with Storefront Modules: Share state seamlessly between Storefront applications and Storefront Modules.

    Example Usage:

    import { useSfCartState, useSfCustomerState } from "@/sdk/alokai-context";
    
    export default function MyComponent() {
      const [cart] = useSfCartState();
      const [customer] = useSfCustomerState();
    
      return (
        <div>
          <p>Cart: {JSON.stringify(cart)}</p>
          <p>Customer: {JSON.stringify(customer)}</p>
        </div>
      );
    }
  • CHANGED createSdkContext to createAlokaiContext. It now returns an object with multiple properties instead of an array. The new structure supports both SDK context and the global state management context.

    Before:

    import { createSdkContext } from "@vue-storefront/next/client";
    
    const [SdkProvider, useSdk] = createSdkContext();

    After:

    import { createAlokaiContext } from "@vue-storefront/next/client";
    
    const { AlokaiProvider, useSdk } = createAlokaiContext();
  • REMOVED SdkProvider component. State management and SDK context are now handled by the AlokaiProvider component. Replace SdkProvider with AlokaiProvider as shown in the Migration Guide.

Patch Changes

  • Updated dependencies:
    • @vue-storefront/sdk@3.2.0

Migration Guide

To upgrade to version 4.0.0, follow these steps:

1. Replace createSdkContext with createAlokaiContext

Update your imports and change how the context is created.

Before:

import { createSdkContext } from "@vue-storefront/next/client";

const [SdkProvider, useSdk] = createSdkContext();

After:

import { createAlokaiContext } from "@vue-storefront/next/client";

const { AlokaiProvider, useSdk } = createAlokaiContext();

2. Replace SdkProvider with AlokaiProvider

Wrap your application with the AlokaiProvider component.

Before:

<SdkProvider sdk={getSdk()}>{children}</SdkProvider>

After:

<AlokaiProvider
  initialData={{
    currencies: initialCurrency.currencies,
    currency: initialCurrency.currentCurrency,
    locale: locale as SfLocale,
    locales: locales as SfLocale[],
  }}
  sdk={getSdk()}
>
  {children}
</AlokaiProvider>
);

For the App Router you can use the root layout to wrap the application with the AlokaiProvider component and for the Pages Router you can use the Custom App file. You can remove the SdkProvider component. Tip: You can get the initialCurrency by calling sdk.unified.getCurrencies().

3. Remove the sdk-context.tsx file

Replace your custom SDK context file with a new context file using createAlokaiContext.

New alokai-context.tsx:

"use client";

import { createAlokaiContext } from "@vue-storefront/next/client";
import type { Sdk } from "./sdk.server";
import type { SfContract } from "storefront-middleware/types";

export const {
  AlokaiProvider,
  useSdk,
  useSfCartState,
  useSfCustomerState,
  useSfCurrencyState,
  useSfLocaleState,
  useSfLocalesState,
} = createAlokaiContext<Sdk, SfContract>();

4. Replace useSdk Hook

Update your imports to use the useSdk hook from alokai-context.

Before:

import { useSdk } from "@/sdk/sdk-context";

After:

import { useSdk } from "@/sdk/alokai-context";

5. Add StateObserver Component

Synchronize query client state with the global state management. Example:

Example:

import { QueryObserver, useQueryClient } from "@tanstack/react-query";
import type { GetCart, GetCustomer } from "@vsf-enterprise/unified-api-sapcc";
import { type PropsWithChildren, useEffect } from "react";

import { useCustomerKey } from "@/hooks";
import {
  useSdk,
  useSfCartState,
  useSfCustomerState,
  useSfCurrencyState,
} from "@/sdk/alokai-context";

export default function StateObserver({ children }: PropsWithChildren) {
  const sdk = useSdk();
  const [, setCustomer] = useSfCustomerState();
  const [, setCart] = useSfCartState();
  const [, setCurrency] = useSfCurrencyState();
  const queryClient = useQueryClient();
  const cartObserver = new QueryObserver<Awaited<ReturnType<GetCart>>>(
    queryClient,
    {
      queryFn: () => sdk.unified.getCart(),
      queryKey: ["cart", "main"],
    },
  );
  const customerObserver = new QueryObserver<Awaited<ReturnType<GetCustomer>>>(
    queryClient,
    {
      queryFn: () => sdk.unified.getCustomer(),
      queryKey: useCustomerKey,
    },
  );
  const currencyObserver = new QueryObserver<
    Awaited<ReturnType<GetCurrencies>>
  >(queryClient, {
    queryFn: () => sdk.unified.getCurrencies(),
    queryKey: ["settings", "currencies"],
  });

  useEffect(() => {
    const unsubscribeCart = cartObserver.subscribe(({ data }) => {
      setCart(data);
    });
    const unsubscribeCustomer = customerObserver.subscribe(({ data }) => {
      setCustomer(data?.customer);
    });
    const unsubscribeCurrency = currencyObserver.subscribe(({ data }) => {
      setCurrency(data);
    });

    return () => {
      unsubscribeCart();
      unsubscribeCustomer();
      unsubscribeCurrency();
    };
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);

  return children;
}

Place the StateObserver below the AlokaiProvider.

6. Update Locale Management

Whenever the locale changes, update it in the global state using the useSfLocaleState hook.

Example:

import { useSfLocaleState } from "@/sdk/alokai-context";

function updateLocale(newLocale) {
  const [, setLocale] = useSfLocaleState();
  setLocale(newLocale);
}

3.0.1

Patch Changes

FIXED: Added getCurrencies unified endpoint to be fetch by HTTP GET. This change enable caching this endpoint on CDN.

3.0.0

Major Changes

[BREAKING CHANGE]: Now the SDK is separately initialized on the server and client. We recommend splitting configuration files for SDK Options and Configuration to re-use them between instances. Introduce the defineSdkConfig helper function. Changed the SdkProvider interface, taking only type and no arguments. The SDK instance is passed to the Provider in the place where it's used.

Minor Changes

ADDED Value of Busting ID for CDN Cache. You can access it via config.cdnCacheBustingId. CHANGED Deprecated middlewareUrl in defineSdkConfig context. Use config.middlewareUrl instead. CHANGED Deprecated defaults in defineSdkConfig context. Use config.defaultMethodsRequestConfig instead.

2.1.0

Minor Changes

  • ADDED Added .config parameter in createSdk callback

Patch Changes

  • Updated dependencies:
    • @vue-storefront/sdk@3.1.0

2.0.1

Patch Changes

  • Updated dependencies:
    • @vue-storefront/sdk@3.0.0

2.0.0

  • CHANGED Updated the @vue-storefront/sdk dependency to version 2.0.0.
  • ADDED defaults property to the injected context

1.1.1

  • FIXED "The inferred type of 'SdkProvider' cannot be named without a reference to (...)" error when calling createSdkContext.

1.1.0

  • ADDED middlewareModule to createSdk params.
- import { UnifiedApiExtension } from "storefront-middleware/types"
+ import { UnifiedEndpoints } from "storefront-middleware/types"

export const { getSdk } = createSdk(
  options,
-  ({ buildModule, middlewareUrl, getRequestHeaders }) => ({
-    commerce: buildModule(unifiedModule<UnifiedApiExtension>, {
-      apiUrl: `${middlewareUrl}/commerce`,
-      requestOptions: {
-        headers: getRequestHeaders,
+  ({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }) => ({
+    commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
+      apiUrl: `${middlewareUrl}/commerce`,
+      defaultRequestConfig: {
+        headers: getRequestHeaders(),
      },
    }),
  })
);

1.0.2

  • FIXED Multi-store URL calculation, now working correctly in the browser.

1.0.1

  • CHANGED Set @vue-storefront/sdk as a dependency instead of a peer dependency

1.0.0

  • Initialized the package

On this page