Alokai Changelog
0.1.0
Minor Changes
- ADDED Alokai ecosystem versioning: Each release of a core package now includes a version bump for the entire ecosystem, simplifying tracking of changes and ensuring compatibility between packages. Core packages include:
@vue-storefront/middleware@vue-storefront/multistore@vue-storefront/unified-data-model@vue-storefront/sdk@vue-storefront/nuxt@vue-storefront/nextCompatibility matrix for the entire ecosystem is available here.
- CHANGED
@vue-storefront/nuxtversion updated tov7.0.0. - CHANGED from now on
getSdkis available instead ofsdkproperty on globalNuxtApp.$alokaiobject. - CHANGED You should now ensure that environment variables
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL(for Next.js apps) andNUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL(for Nuxt apps) are set in your file both locally and in your deployed application.
Patch Changes
- FIXED Nuxt App -
useLazyProductcomposable merged product data wrongly. - FIXED Nuxt App - localization plugin need to set locale cookie directly in the plugin initialization.
- FIXED Next App - the initial page load with a locale in the URL, different from the previously set one, now correctly fetches data in the right language from the server.
Migration guide (Next.js)
The changes below are only relevant for Next apps. If you are using Nuxt, you can skip this section.
- Set the
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable in your.envfile.
+ NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL=http://localhost:4000
- Set the
NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable tohttp://additional-app-middleware:4000in your deployed application. - Use
cookiesfromnext/headersin yourgetSdkfunction to fix the issue with the initial page load with a locale in the URL, different from the previously set one.
import {
headers,
+ cookies,
} from 'next/headers;
import { getSdk } from './sdk.server';
// ...
getSdk({
- getRequestHeaders: () => headers
+ getRequestHeaders: () => ({
+ headers: headers(),
+ cookies: cookies(),
+ }),
});
Migration guide (Nuxt)
The changes below are only relevant for Nuxt apps. If you are using Next.js, you can skip this section.
- Set the
NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable in your.envfile.
+ NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL=http://localhost:4000
- Set the
NUXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URLenvironment variable tohttp://additional-app-middleware:4000in your deployed application. - Modify localization plugin to set locale cookie directly in the plugin initialization.
apps/storefront-unified-nuxt/plugins/localization.ts
+ import type { Composer } from '#i18n';
// ...
- nuxtApp.hook('vue:setup', () => {
- const { locale: i18nLocale, locales: i18nLocales } = useI18n();
+ const { locale: i18nLocale, locales: i18nLocales } = (nuxtApp as unknown as { $i18n: Composer }).$i18n;
// ...
- });
- Update
@vue-storefront/nuxtpackage tov7.0.0.
- "@vue-storefront/nuxt": "6.x.x",
+ "@vue-storefront/nuxt": "7.0.0",
- Update the way you get the SDK instance.
// get sdk instance
- const { sdk } = useNuxtApp().$alokai;
+ const sdk = useNuxtApp().$alokai.getSdk();
// fetch some data
sdk.unified.getProducts();