diff --git a/.changeset/pre.json b/.changeset/pre.json index f3c48003da..7dd471fb19 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -19,5 +19,8 @@ "@vue-storefront/sdk-axios-request-sender": "2.0.0", "@storefront/shared": "0.0.1" }, - "changesets": [] + "changesets": [ + "curly-years-help", + "giant-dogs-crash" + ] } diff --git a/.turbo/cache/2022d2f62c9cfb43-meta.json b/.turbo/cache/2022d2f62c9cfb43-meta.json new file mode 100644 index 0000000000..0937e2118c --- /dev/null +++ b/.turbo/cache/2022d2f62c9cfb43-meta.json @@ -0,0 +1 @@ +{"hash":"2022d2f62c9cfb43","duration":8798} \ No newline at end of file diff --git a/.turbo/cache/2022d2f62c9cfb43.tar.zst b/.turbo/cache/2022d2f62c9cfb43.tar.zst new file mode 100644 index 0000000000..7defe4ece6 Binary files /dev/null and b/.turbo/cache/2022d2f62c9cfb43.tar.zst differ diff --git a/.turbo/cache/23b28561290ffbf8-meta.json b/.turbo/cache/23b28561290ffbf8-meta.json new file mode 100644 index 0000000000..eaaa7be655 --- /dev/null +++ b/.turbo/cache/23b28561290ffbf8-meta.json @@ -0,0 +1 @@ +{"hash":"23b28561290ffbf8","duration":7274} \ No newline at end of file diff --git a/.turbo/cache/23b28561290ffbf8.tar.zst b/.turbo/cache/23b28561290ffbf8.tar.zst new file mode 100644 index 0000000000..1ff114a479 Binary files /dev/null and b/.turbo/cache/23b28561290ffbf8.tar.zst differ diff --git a/.turbo/cache/4a696e6ff26972f7-meta.json b/.turbo/cache/4a696e6ff26972f7-meta.json new file mode 100644 index 0000000000..808749d610 --- /dev/null +++ b/.turbo/cache/4a696e6ff26972f7-meta.json @@ -0,0 +1 @@ +{"hash":"4a696e6ff26972f7","duration":5312} \ No newline at end of file diff --git a/.turbo/cache/4a696e6ff26972f7.tar.zst b/.turbo/cache/4a696e6ff26972f7.tar.zst new file mode 100644 index 0000000000..fd0f927563 Binary files /dev/null and b/.turbo/cache/4a696e6ff26972f7.tar.zst differ diff --git a/.turbo/cache/5d3d0564d6cc9d20-meta.json b/.turbo/cache/5d3d0564d6cc9d20-meta.json new file mode 100644 index 0000000000..90eb4a9493 --- /dev/null +++ b/.turbo/cache/5d3d0564d6cc9d20-meta.json @@ -0,0 +1 @@ +{"hash":"5d3d0564d6cc9d20","duration":3521} \ No newline at end of file diff --git a/.turbo/cache/5d3d0564d6cc9d20.tar.zst b/.turbo/cache/5d3d0564d6cc9d20.tar.zst new file mode 100644 index 0000000000..c725ad3b29 Binary files /dev/null and b/.turbo/cache/5d3d0564d6cc9d20.tar.zst differ diff --git a/.turbo/cache/83197e266a69c9d7-meta.json b/.turbo/cache/83197e266a69c9d7-meta.json new file mode 100644 index 0000000000..4da5de3879 --- /dev/null +++ b/.turbo/cache/83197e266a69c9d7-meta.json @@ -0,0 +1 @@ +{"hash":"83197e266a69c9d7","duration":7007} \ No newline at end of file diff --git a/.turbo/cache/83197e266a69c9d7.tar.zst b/.turbo/cache/83197e266a69c9d7.tar.zst new file mode 100644 index 0000000000..a0a338ba9d Binary files /dev/null and b/.turbo/cache/83197e266a69c9d7.tar.zst differ diff --git a/.turbo/cache/8bb3a08cb588d77f-meta.json b/.turbo/cache/8bb3a08cb588d77f-meta.json new file mode 100644 index 0000000000..77ebf564d2 --- /dev/null +++ b/.turbo/cache/8bb3a08cb588d77f-meta.json @@ -0,0 +1 @@ +{"hash":"8bb3a08cb588d77f","duration":7083} \ No newline at end of file diff --git a/.turbo/cache/8bb3a08cb588d77f.tar.zst b/.turbo/cache/8bb3a08cb588d77f.tar.zst new file mode 100644 index 0000000000..8fac515ed7 Binary files /dev/null and b/.turbo/cache/8bb3a08cb588d77f.tar.zst differ diff --git a/.turbo/cache/dce1156da84f7f28-meta.json b/.turbo/cache/dce1156da84f7f28-meta.json new file mode 100644 index 0000000000..be7885ffb4 --- /dev/null +++ b/.turbo/cache/dce1156da84f7f28-meta.json @@ -0,0 +1 @@ +{"hash":"dce1156da84f7f28","duration":4812} \ No newline at end of file diff --git a/.turbo/cache/dce1156da84f7f28.tar.zst b/.turbo/cache/dce1156da84f7f28.tar.zst new file mode 100644 index 0000000000..47f6c59aca Binary files /dev/null and b/.turbo/cache/dce1156da84f7f28.tar.zst differ diff --git a/.turbo/cache/f34bd7ba2876e54e-meta.json b/.turbo/cache/f34bd7ba2876e54e-meta.json new file mode 100644 index 0000000000..b05489db15 --- /dev/null +++ b/.turbo/cache/f34bd7ba2876e54e-meta.json @@ -0,0 +1 @@ +{"hash":"f34bd7ba2876e54e","duration":7991} \ No newline at end of file diff --git a/.turbo/cache/f34bd7ba2876e54e.tar.zst b/.turbo/cache/f34bd7ba2876e54e.tar.zst new file mode 100644 index 0000000000..785cf3928e Binary files /dev/null and b/.turbo/cache/f34bd7ba2876e54e.tar.zst differ diff --git a/.turbo/cache/faf8b3d573392f42-meta.json b/.turbo/cache/faf8b3d573392f42-meta.json new file mode 100644 index 0000000000..480e77886b --- /dev/null +++ b/.turbo/cache/faf8b3d573392f42-meta.json @@ -0,0 +1 @@ +{"hash":"faf8b3d573392f42","duration":4924} \ No newline at end of file diff --git a/.turbo/cache/faf8b3d573392f42.tar.zst b/.turbo/cache/faf8b3d573392f42.tar.zst new file mode 100644 index 0000000000..0868c8ff24 Binary files /dev/null and b/.turbo/cache/faf8b3d573392f42.tar.zst differ diff --git a/engineering-toolkit/rollup-config/.turbo/turbo-build.log b/engineering-toolkit/rollup-config/.turbo/turbo-build.log new file mode 100644 index 0000000000..ab208b2e31 --- /dev/null +++ b/engineering-toolkit/rollup-config/.turbo/turbo-build.log @@ -0,0 +1,3 @@ +yarn run v1.22.22 +$ rimraf ./lib && tsc +Done in 4.51s. diff --git a/packages/changesets/.turbo/turbo-build.log b/packages/changesets/.turbo/turbo-build.log new file mode 100644 index 0000000000..9fa12c55a3 --- /dev/null +++ b/packages/changesets/.turbo/turbo-build.log @@ -0,0 +1,10 @@ +yarn run v1.22.22 +$ rimraf lib && rollup -c && yarn update-root-changelog + +src/index.ts → lib/index.cjs.js, lib/index.es.js... +(!) Entry module "src/index.ts" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "src/index.ts" to use named exports only. +https://rollupjs.org/guide/en/#outputexports +src/index.ts +created lib/index.cjs.js, lib/index.es.js in 5.4s +$ cp ./lib/index.cjs.js ../../.changeset/changelog.js +Done in 6.74s. diff --git a/packages/cli/.turbo/turbo-build.log b/packages/cli/.turbo/turbo-build.log new file mode 100644 index 0000000000..2d0812a2f5 --- /dev/null +++ b/packages/cli/.turbo/turbo-build.log @@ -0,0 +1,3 @@ +yarn run v1.22.22 +$ rimraf lib && tsc +Done in 7.77s. diff --git a/packages/middleware/.turbo/turbo-build.log b/packages/middleware/.turbo/turbo-build.log new file mode 100644 index 0000000000..6291c3ddb9 --- /dev/null +++ b/packages/middleware/.turbo/turbo-build.log @@ -0,0 +1,6 @@ +yarn run v1.22.22 +$ rimraf lib && rollup -c + +src/index.ts → lib/index.cjs.js, lib/index.es.js... +created lib/index.cjs.js, lib/index.es.js in 7.1s +Done in 8.54s. diff --git a/packages/multistore/.turbo/turbo-build.log b/packages/multistore/.turbo/turbo-build.log new file mode 100644 index 0000000000..388b3e2590 --- /dev/null +++ b/packages/multistore/.turbo/turbo-build.log @@ -0,0 +1,6 @@ +yarn run v1.22.22 +$ rimraf lib && rollup -c + +src/index.ts → lib/index.cjs.js, lib/index.es.js... +created lib/index.cjs.js, lib/index.es.js in 2.8s +Done in 3.37s. diff --git a/packages/next/.turbo/turbo-build.log b/packages/next/.turbo/turbo-build.log new file mode 100644 index 0000000000..2269214830 --- /dev/null +++ b/packages/next/.turbo/turbo-build.log @@ -0,0 +1,26 @@ +yarn run v1.22.22 +$ tsup +CLI Building entry: {"index":"src/index.ts","client":"src/client.ts"} +CLI Using tsconfig: tsconfig.json +CLI tsup v8.0.1 +CLI Using tsup config: /home/runner/work/vue-storefront/vue-storefront/packages/next/tsup.config.ts +CLI Target: es2015 +CJS Build start +ESM Build start +ESM dist/index.mjs 3.21 KB +ESM dist/client.mjs 4.08 KB +ESM dist/chunk-FUJQIYOF.mjs 1.30 KB +ESM ⚡️ Build success in 33ms +CJS dist/index.js 4.94 KB +CJS dist/client.js 7.03 KB +CJS ⚡️ Build success in 33ms +DTS Build start +"PropsWithChildren" is imported from external module "react" but never used in "src/state.tsx" and "src/sdk/types.ts". +DTS ⚡️ Build success in 4314ms +DTS dist/index.d.ts 3.38 KB +DTS dist/client.d.ts 1.27 KB +DTS dist/types-TuCCvExK.d.ts 6.30 KB +DTS dist/index.d.mts 3.38 KB +DTS dist/client.d.mts 1.27 KB +DTS dist/types-TuCCvExK.d.mts 6.30 KB +Done in 5.14s. diff --git a/packages/next/CHANGELOG.md b/packages/next/CHANGELOG.md index 7c2aa99e78..c2dc0a5642 100644 --- a/packages/next/CHANGELOG.md +++ b/packages/next/CHANGELOG.md @@ -1,5 +1,106 @@ # Change log +## 4.0.0-rc.0 + +### Major Changes + +- **[ADDED]** global state management with Zustand. 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 hooks to make use of the introduced state manager. +As this is only a state management, you will still need to use the hooks to fetch the data and put it into the state. + +To make use of the new state solution you will need to change the file `sdk/sdk-context.ts`. + +```ts +// before +"use client"; + +import { createSdkContext } from "@vue-storefront/next/client"; + +import type { Sdk } from "./sdk.server"; + +export const [SdkProvider, useSdk] = createSdkContext(); +``` + +```ts +// after +"use client"; + +import { createAlokaiContext } from "@vue-storefront/next/client"; +import type { SfContract } from "storefront-middleware/types"; + +import type { Sdk } from "./sdk.server"; + +export const { + AlokaiProvider, + useSdk, + useSfCartState, + useSfCurrenciesState, + useSfCurrencyState, + useSfCustomerState, + useSfLocaleState, + useSfLocalesState, +} = createAlokaiContext(); +``` + +The type `SfContract` is a type that represents the contract between the middleware and the state manager. +It is delivered out of the box. + +Example of usage: + +```tsx +import { useQuery } from "@tanstack/react-query"; +import { + useSdk, + useSfCartState, + useSfCustomerState, + useSfCurrencyState, + useSfLocaleState, +} from "@/sdk/alokai-context"; + +function Component() { + const sdk = useSdk(); + const [cart, setCart] = useSfCartState(); + const [customer] = useSfCustomerState(); + const [currency] = useSfCurrencyState(); + const [locale] = useSfLocaleState(); + + const result = useQuery({ + queryFn: () => sdk.unified.getCart(), + queryKey: ["cart", "main"], + }); + // updating the cart state + useEffect(() => { + setCart(result.data); + }, [result.data]); + + return ( +
+

Cart total: {cart.total}

+

+ Customer name: {customer.firstName} {customer.lastName} +

+

Currency: {currency}

+

Locale: {locale}

+
+ ); +} +``` + +- **[BREAKING]** [CHANGED] the function `createSdkContext` exported from the `client` is changed to `createAlokaiContext`. + Also, it no longer returns an array with two elements, but an object with multiple properties. + This change is related to the fact that now it not only provide SDK context but also global state management context and hooks for handling it. + +```diff +- import { createSdkContext } from '@vue-storefront/next/client'; ++ import { createAlokaiContext } from '@vue-storefront/next/client'; +``` + ## 3.0.1 ### Patch Changes diff --git a/packages/next/package.json b/packages/next/package.json index dcb9394db4..04d798235d 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -2,7 +2,7 @@ "name": "@vue-storefront/next", "description": "Vue Storefront dedicated features for Next.js", "license": "MIT", - "version": "3.0.1", + "version": "4.0.0-rc.0", "exports": { ".": { "import": "./dist/index.mjs", diff --git a/packages/nuxt/.turbo/turbo-build.log b/packages/nuxt/.turbo/turbo-build.log new file mode 100644 index 0000000000..bd54315329 --- /dev/null +++ b/packages/nuxt/.turbo/turbo-build.log @@ -0,0 +1,22 @@ +yarn run v1.22.22 +$ nuxt-module-build build +[info] Building nuxt +[info] Cleaning dist directory: `./dist` +[nuxt] Expected `@nuxt/kit` to be at least `3.12.2` but got `3.11.2`. This might lead to unexpected behavior. Check your package.json or refresh your lockfile. +[nuxt] Expected `@nuxt/schema` to be at least `3.12.2` but got `3.11.2`. This might lead to unexpected behavior. Check your package.json or refresh your lockfile. +[success] Build succeeded for nuxt +[log] dist/runtime (total size: 7.33 kB) + └─ dist/runtime/utils/composeMiddlewareUrl.d.ts (404 B) + └─ dist/runtime/defineSdkConfig.template (2.85 kB) + └─ dist/runtime/utils/composeMiddlewareUrl.js (862 B) + └─ dist/runtime/utils/defaults.js (487 B) + └─ dist/runtime/utils/defaults.d.ts (887 B) + └─ dist/runtime/plugin.template (302 B) + └─ dist/runtime/types.template (786 B) + └─ dist/runtime/useSdk.template (295 B) + └─ dist/runtime/useSfState.template (458 B) +[log] dist/module.mjs (total size: 2.93 kB, chunk size: 2.93 kB, exports: default) + +Σ Total dist size (byte size): 13.9 kB +[log] +Done in 7.12s. diff --git a/packages/nuxt/CHANGELOG.md b/packages/nuxt/CHANGELOG.md index 34f2f7e2ee..fdbc463e39 100644 --- a/packages/nuxt/CHANGELOG.md +++ b/packages/nuxt/CHANGELOG.md @@ -1,5 +1,68 @@ # Change log +## 5.0.0-rc.0 + +### 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: + +```vue + + + +``` + +- **[BREAKING]** [CHANGED] module configKey is changed from `vsf` to `alokai`. Also, the support for the `vsf` key in Runtime Envs has been changed to `alokai`. + +```diff + meta: { + name: "@vue-storefront/nuxt", +- configKey: "vsf", ++ configKey: "alokai", + compatibility: { + nuxt: "^3.0.0", + }, +``` + +```diff +nuxt.options.runtimeConfig.public.alokai = defu( +- nuxt.options.runtimeConfig.public?.vsf as any, ++ nuxt.options.runtimeConfig.public?.alokai as any, + options +); +``` + ## 4.1.1 ### Patch Changes diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index daef4e4384..222c6cf630 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/nuxt", - "version": "4.1.1", + "version": "5.0.0-rc.0", "description": "Vue Storefront dedicated features for Nuxt", "license": "MIT", "type": "module", diff --git a/packages/sdk-axios-request-sender/.turbo/turbo-build.log b/packages/sdk-axios-request-sender/.turbo/turbo-build.log new file mode 100644 index 0000000000..f85c91906b --- /dev/null +++ b/packages/sdk-axios-request-sender/.turbo/turbo-build.log @@ -0,0 +1,7 @@ +yarn run v1.22.22 +warning package.json: License should be a valid SPDX license expression +$ rimraf lib && rollup -c + +src/index.ts → lib/index.cjs.js, lib/index.es.js... +created lib/index.cjs.js, lib/index.es.js in 5.9s +Done in 6.78s. diff --git a/packages/sdk/.turbo/turbo-build.log b/packages/sdk/.turbo/turbo-build.log new file mode 100644 index 0000000000..c77e073f56 --- /dev/null +++ b/packages/sdk/.turbo/turbo-build.log @@ -0,0 +1,6 @@ +yarn run v1.22.22 +$ rimraf lib && rollup -c + +src/index.ts → lib/index.cjs.js, lib/index.es.js... +created lib/index.cjs.js, lib/index.es.js in 4.1s +Done in 4.78s.