@scayle/storefront-nuxt 7.36.3 → 7.37.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `runtimeConfiguration` property to the `RPCContext`
8
+ - Breaking: Remove re-exported `useEventListener` composable
9
+
10
+ Import the composable directly from @vueuse/core
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @scayle/storefront-core@7.23.0
16
+
3
17
  ## 7.36.3
4
18
 
5
19
  ### 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.36.2"
7
+ "version": "7.36.3"
8
8
  }
package/dist/module.mjs CHANGED
@@ -101,6 +101,7 @@ const module = defineNuxtModule({
101
101
  const template = addTypeTemplate({
102
102
  filename: "types/storefront-bootstrap.d.ts",
103
103
  getContents: () => `// Auto-generated
104
+ import type { RuntimeConfig } from '@nuxt/schema'
104
105
  import type { RpcContext, Cache } from '@scayle/storefront-core'
105
106
  import type { PublicShopConfig } from '@scayle/storefront-nuxt';
106
107
  declare module 'h3' {
@@ -111,6 +112,9 @@ const module = defineNuxtModule({
111
112
  $availableShops: PublicShopConfig[]
112
113
  }
113
114
  }
115
+ declare module '@scayle/storefront-core' {
116
+ export interface RuntimeConfiguration extends RuntimeConfig {}
117
+ }
114
118
  export {}`
115
119
  });
116
120
  nuxt.hook("prepare:types", ({ references }) => {
@@ -8,8 +8,8 @@ import {
8
8
  } from "@scayle/storefront-core";
9
9
  import { useNuxtApp } from "nuxt/app";
10
10
  import { computed } from "vue";
11
+ import { useEventListener } from "@vueuse/core";
11
12
  import { rpcCall } from "../../rpc/rpcCall.mjs";
12
- import useEventListener from "../core/useEventListener.mjs";
13
13
  import { useRpc } from "../core/useRpc.mjs";
14
14
  import { useCurrentShop } from "../core/useCurrentShop.mjs";
15
15
  import { toValue } from "#imports";
@@ -1,5 +1,6 @@
1
1
  import { Log, RpcContext, Cache as CacheInterface } from '@scayle/storefront-core';
2
2
  import type { Session } from '@scayle/h3-session';
3
+ import type { RuntimeConfig } from '@nuxt/schema';
3
4
  import { ShopConfig, StorefrontConfig } from '../module';
4
5
  export interface ContextBuilderOptions {
5
6
  $cache: CacheInterface;
@@ -8,5 +9,6 @@ export interface ContextBuilderOptions {
8
9
  $log: Log;
9
10
  sessionId: string;
10
11
  session: Session;
12
+ config: RuntimeConfig;
11
13
  }
12
14
  export declare const buildContext: (context: ContextBuilderOptions) => Promise<RpcContext>;
@@ -7,7 +7,7 @@ import {
7
7
  generateWishlistKey
8
8
  } from "@scayle/storefront-core/dist/utils/keys";
9
9
  export const buildContext = async (context) => {
10
- const { $cache, $shopConfig, $storefront, $log, session } = context;
10
+ const { $cache, $shopConfig, $storefront, $log, session, config } = context;
11
11
  const bapiConfig = $shopConfig.bapi ?? $storefront.bapi;
12
12
  const appKeys = $shopConfig.appKeys ?? $storefront.appKeys;
13
13
  return {
@@ -93,6 +93,7 @@ export const buildContext = async (context) => {
93
93
  updateTokens: async (tokens) => {
94
94
  Object.assign(session.data, tokens);
95
95
  await session.save();
96
- }
96
+ },
97
+ runtimeConfiguration: config
97
98
  };
98
99
  };
@@ -83,7 +83,7 @@ async function handleOauth(event, storefrontConfig, log) {
83
83
  });
84
84
  await useOauth(event, JWKS);
85
85
  }
86
- async function bootstrap(event, log, url, $shopConfig, $storefrontConfig, apiBasePath) {
86
+ async function bootstrap(event, log, url, $shopConfig, $storefrontConfig, apiBasePath, config) {
87
87
  const bootstrapLog = log.space("bootstrap");
88
88
  bootstrapLog.debug("Bootstrapping request: ", url.toString());
89
89
  const redisConfig = $shopConfig.redis ?? $storefrontConfig.redis;
@@ -136,8 +136,8 @@ async function bootstrap(event, log, url, $shopConfig, $storefrontConfig, apiBas
136
136
  $storefrontConfig.publicShopData
137
137
  );
138
138
  event.context.$availableShops = convertStoresToList($storefrontConfig.stores).filter((store) => store.isEnabled !== false).map(
139
- (config) => getPublicShopData(
140
- config,
139
+ (config2) => getPublicShopData(
140
+ config2,
141
141
  $shopConfig.shopId,
142
142
  apiBasePath,
143
143
  $storefrontConfig.publicShopData
@@ -151,7 +151,8 @@ async function bootstrap(event, log, url, $shopConfig, $storefrontConfig, apiBas
151
151
  $storefront: $storefrontConfig,
152
152
  $log: log,
153
153
  sessionId: event.context.sessionId,
154
- session: event.context.session
154
+ session: event.context.session,
155
+ config
155
156
  });
156
157
  }
157
158
  export default defineEventHandler(async (event) => {
@@ -175,7 +176,8 @@ export default defineEventHandler(async (event) => {
175
176
  url,
176
177
  $shopConfig,
177
178
  $storefrontConfig,
178
- apiBasePath
179
+ apiBasePath,
180
+ config
179
181
  );
180
182
  }
181
183
  if ($storefrontConfig.redirects?.enabled && !url.pathname.startsWith(apiBasePath)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.36.3",
4
+ "version": "7.37.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.7.4",
64
64
  "@scayle/h3-session": "0.3.4",
65
- "@scayle/storefront-core": "7.22.1",
65
+ "@scayle/storefront-core": "7.23.0",
66
66
  "@vueuse/core": "10.5.0",
67
67
  "consola": "3.2.3",
68
68
  "core-js": "3.33.2",
@@ -1,2 +0,0 @@
1
- import { useEventListener } from '@vueuse/core';
2
- export default useEventListener;
@@ -1,2 +0,0 @@
1
- import { useEventListener } from "@vueuse/core";
2
- export default useEventListener;