github-actions
released this
06 Aug 12:41
·
27 commits
to main
since this release
Major Changes
- [ADDED] global state management with Pinia. This will allow you to keep your global state in a more organized way.
It shares the data about: - cart
- customer
- currency
- locale
This change will require you to refactor your composables to make use of the introduced state manager.
As this is only a state management, you will still need to use the composables to fetch the data and put it into the state.
Every part of global state can now be used as refs so reading and writing to them is more straightforward.
Example of usage:
<template>
<div>
<p>Cart total: {{ cart.total }}</p>
<p>Customer name: {{ customer.firstName }} {{ customer.lastName }}</p>
<p>Currency: {{ currency }}</p>
<p>Locale: {{ locale }}</p>
</div>
</template>
<script setup>
const { cart, customer, currency, currencies, locale, locales } = storeToRefs(
useSfState()
);
// updating the currency state
currency.value = "USD";
// updating the cart state
onMounted(async () => {
cart.value = await useSdk().unified.getCart();
});
</script>
- [BREAKING] [CHANGED] module configKey is changed from
vsf
toalokai
. Also, the support for thevsf
key in Runtime Envs has been changed toalokai
.
meta: {
name: "@vue-storefront/nuxt",
- configKey: "vsf",
+ configKey: "alokai",
compatibility: {
nuxt: "^3.0.0",
},
nuxt.options.runtimeConfig.public.alokai = defu(
- nuxt.options.runtimeConfig.public?.vsf as any,
+ nuxt.options.runtimeConfig.public?.alokai as any,
options
);
Patch Changes
- Updated dependencies:
- @vue-storefront/[email protected]