@scayle/storefront-nuxt 7.38.1 → 7.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/api/cacheAuth.d.ts +1 -1
  4. package/dist/runtime/composables/core/useRpc.d.ts +1 -1
  5. package/dist/runtime/composables/core/useRpc.mjs +1 -4
  6. package/dist/runtime/composables/core/useUser.d.ts +1 -1
  7. package/dist/runtime/composables/storefront/useBasket.d.ts +3 -2
  8. package/dist/runtime/composables/storefront/useBrand.d.ts +2 -2
  9. package/dist/runtime/composables/storefront/useBrands.d.ts +2 -2
  10. package/dist/runtime/composables/storefront/useCategories.d.ts +2 -2
  11. package/dist/runtime/composables/storefront/useFacet.d.ts +1 -1
  12. package/dist/runtime/composables/storefront/useFilters.d.ts +2 -2
  13. package/dist/runtime/composables/storefront/useNavigationTree.d.ts +2 -2
  14. package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +2 -2
  15. package/dist/runtime/composables/storefront/useOrder.d.ts +2 -2
  16. package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +2 -2
  17. package/dist/runtime/composables/storefront/useProductsCount.d.ts +2 -2
  18. package/dist/runtime/composables/storefront/useQueryFilterState.d.ts +1 -1
  19. package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +1 -1
  20. package/dist/runtime/composables/storefront/useUserAddresses.d.ts +1 -1
  21. package/dist/runtime/composables/storefront/useWishlist.d.ts +3 -3
  22. package/dist/runtime/context.d.ts +2 -2
  23. package/dist/runtime/context.mjs +1 -3
  24. package/dist/runtime/handler.d.ts +1 -1
  25. package/dist/runtime/handler.mjs +1 -3
  26. package/dist/runtime/server/middleware/bootstrap.d.ts +1 -1
  27. package/dist/runtime/server/middleware/bootstrap.mjs +1 -4
  28. package/dist/runtime/server/middleware/cache.d.ts +4 -3
  29. package/dist/runtime/server/middleware/oauth.d.ts +1 -1
  30. package/dist/runtime/server/middleware/redirects.d.ts +1 -1
  31. package/dist/runtime/server/middleware/redirects.mjs +5 -7
  32. package/dist/runtime/utils/error.d.ts +2 -2
  33. package/package.json +23 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.40.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update to Nuxt `v3.8.1` (See [Nuxt 3.8 Release Notes](https://github.com/nuxt/nuxt/releases/tag/v3.8.0) and [Nuxt 3.8.1 Release Notes](https://github.com/nuxt/nuxt/releases/tag/v3.8.1) for more details.)
8
+ - Refactored imports to be compatible with TypeScript `verbatimModuleSyntax` option (See [TypeScript 5.0 - verbatimModuleSyntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#--verbatimmodulesyntax) for more details.)
9
+ - Update to Vue `v3.3.8` (See [Vue 3.3.8 Release notes](https://github.com/vuejs/core/blob/main/CHANGELOG.md#338-2023-11-06) for more details.)
10
+
11
+ ## 7.39.0
12
+
13
+ ### Minor Changes
14
+
15
+ - Redirects should use the cache provider configured for the shop
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+ - @scayle/storefront-core@7.25.1
21
+
3
22
  ## 7.38.1
4
23
 
5
24
  ### Patch Changes
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.7.0"
6
6
  },
7
- "version": "7.38.0"
7
+ "version": "7.39.0"
8
8
  }
@@ -1,4 +1,4 @@
1
- import { EventHandler } from 'h3';
1
+ import type { EventHandler } from 'h3';
2
2
  /**
3
3
  * Wrap an event handler protected by the authentication specified in cache.auth
4
4
  * @param handler
@@ -1,5 +1,5 @@
1
1
  import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
2
- import { AsyncDataOptions, NuxtError } from 'nuxt/app';
2
+ import type { AsyncDataOptions, NuxtError } from 'nuxt/app';
3
3
  type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
4
4
  export type RpcAsyncDataOptions<TResult> = AsyncDataOptions<TResult, TResult, KeysOf<TResult>, TResult>;
5
5
  export interface RpcOptions {
@@ -1,7 +1,4 @@
1
- import {
2
- useNuxtApp,
3
- useState
4
- } from "nuxt/app";
1
+ import { useNuxtApp, useState } from "nuxt/app";
5
2
  import { useCoreLog } from "../useCoreLog.mjs";
6
3
  import { handleError } from "../../utils/error.mjs";
7
4
  import { useCurrentShop } from "./useCurrentShop.mjs";
@@ -1,4 +1,4 @@
1
- import { ShopUser, UpdatePasswordParams, UseUserParams } from '@scayle/storefront-core';
1
+ import type { ShopUser, UpdatePasswordParams, UseUserParams } from '@scayle/storefront-core';
2
2
  export type ExtendedUseUserParams = UseUserParams & {
3
3
  lazy?: boolean;
4
4
  };
@@ -1,5 +1,6 @@
1
- import { AddOrUpdateItemType, ExistingItemHandling, RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { AddOrUpdateItemType, RpcMethodParameters } from '@scayle/storefront-core';
2
+ import { ExistingItemHandling } from '@scayle/storefront-core';
3
+ import type { RpcOptions } from '../core/useRpc';
3
4
  import { type MaybeRefOrGetter } from '#imports';
4
5
  type UseBasketOptions = Partial<{
5
6
  params: MaybeRefOrGetter<RpcMethodParameters<'getBasket'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBrandById'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBrands'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getCategoriesByPath'>>;
@@ -1,4 +1,4 @@
1
- import { FilterParams, ProductWith } from '@scayle/storefront-core';
1
+ import type { FilterParams, ProductWith } from '@scayle/storefront-core';
2
2
  type FacetParams = Partial<{
3
3
  with: {
4
4
  product?: ProductWith;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getFilters'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeById'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'fetchAllNavigationTrees'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
@@ -1,5 +1,5 @@
1
- import { RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
3
  import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getProductsCount'>>;
@@ -1,4 +1,4 @@
1
- import { FilterParams, SortingValueKey, TransformedFilter, Filter } from '@scayle/storefront-core';
1
+ import type { FilterParams, SortingValueKey, TransformedFilter, Filter } from '@scayle/storefront-core';
2
2
  type Options = {
3
3
  defaultSort?: SortingValueKey;
4
4
  };
@@ -1,4 +1,4 @@
1
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcOptions } from '../core/useRpc';
2
2
  type Options = Partial<{
3
3
  options: RpcOptions;
4
4
  key: string;
@@ -1,4 +1,4 @@
1
- import { RpcOptions } from '../core/useRpc';
1
+ import type { RpcOptions } from '../core/useRpc';
2
2
  type Options = Partial<{
3
3
  options: RpcOptions;
4
4
  key: string;
@@ -1,6 +1,6 @@
1
- import { Product, WishlistItem, RpcMethodParameters } from '@scayle/storefront-core';
2
- import { RpcOptions } from '../core/useRpc';
3
- import { type MaybeRefOrGetter } from '#imports';
1
+ import type { Product, WishlistItem, RpcMethodParameters } from '@scayle/storefront-core';
2
+ import type { RpcOptions } from '../core/useRpc';
3
+ import type { MaybeRefOrGetter } from '#imports';
4
4
  type Options = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getWishlist'>>;
6
6
  options: RpcOptions;
@@ -1,7 +1,7 @@
1
- import { Log, RpcContext, Cache as CacheInterface } from '@scayle/storefront-core';
2
1
  import type { Session } from '@scayle/h3-session';
3
2
  import type { RuntimeConfig } from '@nuxt/schema';
4
- import { ShopConfig, StorefrontConfig } from '../module';
3
+ import type { Log, RpcContext, Cache as CacheInterface } from '@scayle/storefront-core';
4
+ import type { ShopConfig, StorefrontConfig } from '../module';
5
5
  export interface ContextBuilderOptions {
6
6
  $cache: CacheInterface;
7
7
  $shopConfig: ShopConfig;
@@ -1,6 +1,4 @@
1
- import {
2
- Cached
3
- } from "@scayle/storefront-core";
1
+ import { Cached } from "@scayle/storefront-core";
4
2
  import { init as initBapi } from "@scayle/storefront-core/dist/bapi/init";
5
3
  import {
6
4
  generateBasketKey,
@@ -1,4 +1,4 @@
1
- import { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
1
+ import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
2
2
  /**
3
3
  * Handler for RPC methods
4
4
  * @param method
@@ -1,6 +1,4 @@
1
- import {
2
- rpcMethods as coreRpcMethods
3
- } from "@scayle/storefront-core";
1
+ import { rpcMethods as coreRpcMethods } from "@scayle/storefront-core";
4
2
  import * as storefrontRpcMethods from "#rpcMethods";
5
3
  export const handler = async (method, payload, rpcContext) => {
6
4
  const rpcMethods = {
@@ -1,4 +1,4 @@
1
- import { RpcContext, Cache } from '@scayle/storefront-core';
1
+ import type { RpcContext, Cache } from '@scayle/storefront-core';
2
2
  import type { PublicShopConfig } from '../../../module';
3
3
  declare module 'h3' {
4
4
  interface H3EventContext {
@@ -5,10 +5,7 @@ import { randomUUID } from "uncrypto";
5
5
  import redisDriver from "unstorage/drivers/redis";
6
6
  import memoryDriver from "unstorage/drivers/memory";
7
7
  import { createStorage } from "unstorage";
8
- import {
9
- useSession,
10
- UnstorageSessionStore
11
- } from "@scayle/h3-session";
8
+ import { useSession, UnstorageSessionStore } from "@scayle/h3-session";
12
9
  import { buildContext } from "../../context.mjs";
13
10
  import createLog from "../../createLog.mjs";
14
11
  import {
@@ -1,5 +1,6 @@
1
- import { Cache as CacheInterface, Log } from '@scayle/storefront-core';
2
- import { RedisConfig, StorageProvider } from '../../../types/module';
1
+ import type { Log } from '@scayle/storefront-core';
2
+ import { UnstorageCache } from '@scayle/storefront-core/dist/cache/providers/unstorage';
3
+ import type { RedisConfig, StorageProvider } from '../../../types/module';
3
4
  /**
4
5
  * Create an unstorage-backed cache interface
5
6
  * @param provider
@@ -9,4 +10,4 @@ import { RedisConfig, StorageProvider } from '../../../types/module';
9
10
  */
10
11
  export declare function createCache(provider: StorageProvider, prefix: string, log: Log, options?: {
11
12
  redis?: RedisConfig;
12
- }): CacheInterface;
13
+ }): UnstorageCache;
@@ -1,3 +1,3 @@
1
1
  import { H3Event } from 'h3';
2
- import { JWTVerifyGetKey } from 'jose';
2
+ import type { JWTVerifyGetKey } from 'jose';
3
3
  export declare function useOauth(event: H3Event, jwks: JWTVerifyGetKey): Promise<void>;
@@ -1,2 +1,2 @@
1
- import { H3Event } from 'h3';
1
+ import type { H3Event } from 'h3';
2
2
  export declare function useRedirects(event: H3Event): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { sendRedirect, getRequestURL } from "h3";
2
+ import { UnstorageCache } from "@scayle/storefront-core/dist/cache/providers/unstorage";
2
3
  import { getRedirectLookupUrls, getTargetLocation } from "./redirects.utils.mjs";
3
- import { createCache } from "./cache.mjs";
4
4
  import { useRuntimeConfig } from "#imports";
5
5
  const REDIS_REDIRECT_PREFIX = ":REDIRECT";
6
6
  const REDIRECT_NOT_SET = "REDIRECT_NOT_SET";
@@ -46,13 +46,11 @@ export async function useRedirects(event) {
46
46
  xForwardedProto: true,
47
47
  xForwardedHost: true
48
48
  });
49
- const currentShop = event.context.$currentShop;
50
49
  const log = event.context.$rpcContext.log.space("sfc").space("redirects");
51
- const redirectCache = createCache(
52
- "redis",
53
- currentShop.shopId + REDIS_REDIRECT_PREFIX,
54
- log,
55
- { redis: $storefrontConfig.redis }
50
+ const shopCache = event.context.$cache;
51
+ const redirectCache = new UnstorageCache(
52
+ shopCache.storage,
53
+ shopCache.prefix + REDIS_REDIRECT_PREFIX
56
54
  );
57
55
  const bapiClient = event.context.$rpcContext.bapiClient;
58
56
  const queryParamWhitelist = new Set(options?.queryParamWhitelist ?? []);
@@ -1,5 +1,5 @@
1
- import { NuxtError } from 'nuxt/app';
2
- import { FetchError } from 'ofetch';
1
+ import type { NuxtError } from 'nuxt/app';
2
+ import type { FetchError } from 'ofetch';
3
3
  import { parseErrorData } from '../error/handler';
4
4
  declare const handleError: (error: FetchError | Error | unknown, additionalData?: unknown) => NuxtError;
5
5
  export { handleError, parseErrorData };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.38.1",
4
+ "version": "7.40.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -60,10 +60,10 @@
60
60
  "test:watch": "vitest watch"
61
61
  },
62
62
  "dependencies": {
63
- "@nuxt/kit": "3.7.4",
63
+ "@nuxt/kit": "3.8.1",
64
64
  "@scayle/h3-session": "0.3.4",
65
- "@scayle/storefront-core": "7.25.0",
66
- "@vueuse/core": "10.5.0",
65
+ "@scayle/storefront-core": "7.25.1",
66
+ "@vueuse/core": "10.6.1",
67
67
  "consola": "3.2.3",
68
68
  "core-js": "3.33.2",
69
69
  "defu": "6.1.3",
@@ -73,30 +73,42 @@
73
73
  "radash": "11.0.0",
74
74
  "uncrypto": "0.1.3",
75
75
  "vue-router": "4.2.5",
76
- "yn": "^5.0.0"
76
+ "yn": "5.0.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@nuxt/module-builder": "0.5.4",
80
- "@nuxt/schema": "3.7.4",
81
- "@nuxt/test-utils": "3.7.4",
80
+ "@nuxt/schema": "3.8.1",
81
+ "@nuxt/test-utils": "3.8.1",
82
82
  "@scayle/eslint-config-storefront": "3.2.5",
83
83
  "@scayle/prettier-config-storefront": "2.0.2",
84
84
  "@types/node": "20.9.0",
85
85
  "eslint": "8.53.0",
86
86
  "eslint-formatter-gitlab": "5.1.0",
87
87
  "node-mocks-http": "1.13.0",
88
- "nuxt": "3.7.4",
88
+ "nuxt": "3.8.1",
89
89
  "prettier": "3.0.0",
90
90
  "publint": "0.2.5",
91
- "unstorage": "1.9.0",
91
+ "unstorage": "1.10.1",
92
92
  "vitest": "0.34.6",
93
93
  "vue-tsc": "1.8.22"
94
94
  },
95
95
  "peerDependencies": {
96
- "nuxt": ">=3.7.3",
97
- "unstorage": ">= 1.9.0",
96
+ "nuxt": ">=3.8.1",
97
+ "unstorage": ">= 1.10.1",
98
98
  "vue": ">=3.3.0"
99
99
  },
100
+ "resolutions": {
101
+ "@vue/compiler-core": "3.3.8",
102
+ "@vue/shared": "3.3.8",
103
+ "@vue/compiler-dom": "3.3.8",
104
+ "@vue/compiler-sfc": "3.3.8",
105
+ "@vue/compiler-ssr": "3.3.8",
106
+ "@vue/reactivity-transform": "3.3.8",
107
+ "@vue/reactivity": "3.3.8",
108
+ "@vue/runtime-core": "3.3.8",
109
+ "@vue/runtime-dom": "3.3.8",
110
+ "@vue/server-renderer": "3.3.8"
111
+ },
100
112
  "volta": {
101
113
  "node": "20.9.0"
102
114
  }