@scayle/storefront-nuxt 7.72.1 → 7.72.3

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,17 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.72.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Refactored composables to consistently use named exports rather than default exports and to use named functions instead of arrow functions
8
+
9
+ ## 7.72.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Add import alias `#storefront/composables` to package.json imports and explicitly added import alias to build transpilation to prevent potential build issues
14
+
3
15
  ## 7.72.1
4
16
 
5
17
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.72.0",
3
+ "version": "7.72.2",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -61,7 +61,7 @@ export default {
61
61
  }`;
62
62
  }
63
63
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
64
- const PACKAGE_VERSION = "7.72.0";
64
+ const PACKAGE_VERSION = "7.72.2";
65
65
  const logger = createConsola({
66
66
  fancy: true,
67
67
  formatOptions: {
@@ -149,7 +149,7 @@ const module = defineNuxtModule({
149
149
  for (const rpcMethodName of options.rpcMethodNames ?? []) {
150
150
  if (rpcMethodNames.has(rpcMethodName) && !overridenRPCMethodNames.has(rpcMethodName)) {
151
151
  logger.warn(`
152
- Overriding RPC method '${rpcMethodName}' from '@scayle/storefront-nuxt' with a local custom implementation.
152
+ Overriding RPC method '${rpcMethodName}' from '@scayle/storefront-nuxt' with a local custom implementation.
153
153
 
154
154
  Should this be done on purpose, please be aware that this can lead to unexpected issues since the '@scayle/storefront-nuxt' package also uses this RPC method internally.
155
155
  To silence this warning, you can add '${rpcMethodName}' to 'rpcMethodOverrides' in the '@scayle/storefront-nuxt' config.
@@ -293,6 +293,7 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
293
293
  nuxt.options.alias["#storefront/composables"] = resolve(
294
294
  "./runtime/composables"
295
295
  );
296
+ nuxt.options.build.transpile.push("#storefront/composables");
296
297
  addPlugin(resolve("./runtime/plugin/shop"));
297
298
  addPlugin({
298
299
  src: resolve("./runtime/plugin/log.client"),
@@ -1,2 +1,2 @@
1
1
  import type { PublicShopConfig } from '../../../module';
2
- export declare const useAvailableShops: () => import("vue").Ref<PublicShopConfig[]>;
2
+ export declare function useAvailableShops(): import("vue").Ref<PublicShopConfig[]>;
@@ -1,4 +1,4 @@
1
1
  import { useState } from "nuxt/app";
2
- export const useAvailableShops = () => {
2
+ export function useAvailableShops() {
3
3
  return useState("availableShops", () => []);
4
- };
4
+ }
@@ -8,7 +8,7 @@ type FormatCurrencyOptions = {
8
8
  currencyFractionDigits?: number;
9
9
  style: 'decimal';
10
10
  };
11
- export default function useFormatHelpers(): {
11
+ export declare function useFormatHelpers(): {
12
12
  formatCurrency: (value: number, options?: FormatCurrencyOptions) => string;
13
13
  };
14
14
  export {};
@@ -1,6 +1,6 @@
1
1
  import { getDefaultFractionDigits } from "@scayle/storefront-core";
2
2
  import { useCurrentShop } from "./useCurrentShop.mjs";
3
- export default function useFormatHelpers() {
3
+ export function useFormatHelpers() {
4
4
  const currentShop = useCurrentShop();
5
5
  const formatCurrency = (value, options) => {
6
6
  const locale = options?.locale ?? currentShop.value.locale;
@@ -1,6 +1,6 @@
1
1
  import { type MaybeRefOrGetter } from 'vue';
2
2
  import type { RpcMethodParameters } from '@scayle/storefront-core';
3
- export declare const useIDP: (params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>) => Promise<{
3
+ export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>): Promise<{
4
4
  data: import("vue").Ref<{
5
5
  [k: string]: string;
6
6
  } | undefined>;
@@ -3,7 +3,7 @@ import { useRpc } from "../core/useRpc.mjs";
3
3
  import { rpcCall } from "./../../rpc/rpcCall.mjs";
4
4
  import { useCurrentShop } from "./useCurrentShop.mjs";
5
5
  import { toValue } from "#imports";
6
- export const useIDP = async (params = {}) => {
6
+ export async function useIDP(params = {}) {
7
7
  const nuxtApp = useNuxtApp();
8
8
  const shop = useCurrentShop();
9
9
  const { data, fetching, fetch, error, status } = await useRpc(
@@ -25,4 +25,4 @@ export const useIDP = async (params = {}) => {
25
25
  // TODO: Deprecate the property here and remove it with the next major release
26
26
  handleIDPLoginCallback
27
27
  };
28
- };
28
+ }
@@ -1,5 +1,6 @@
1
1
  import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
2
2
  import type { AsyncDataOptions, NuxtError } from 'nuxt/app';
3
+ import { type MaybeRefOrGetter } from '#imports';
3
4
  type KeysOf<T> = Array<T extends T ? (keyof T extends string ? keyof T : never) : never>;
4
5
  export type RpcAsyncDataOptions<TResult> = AsyncDataOptions<TResult, TResult, KeysOf<TResult>, TResult>;
5
6
  export interface RpcOptions {
@@ -7,7 +8,7 @@ export interface RpcOptions {
7
8
  lazy?: boolean;
8
9
  }
9
10
  export type Status = 'idle' | 'pending' | 'success' | 'error';
10
- export declare const useRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: any, options?: RpcOptions) => Promise<{
11
+ export declare function useRpc<N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: MaybeRefOrGetter<TParams>, options?: RpcOptions): Promise<{
11
12
  data: import("vue").Ref<TResult | undefined>;
12
13
  fetching: import("vue").Ref<boolean>;
13
14
  fetch: () => Promise<void>;
@@ -15,7 +15,7 @@ const handleError = (error) => {
15
15
  const data = resolveError(error);
16
16
  return createError(data);
17
17
  };
18
- export const useRpc = async (method, key, params, options = { autoFetch: true, lazy: false }) => {
18
+ export async function useRpc(method, key, params, options = { autoFetch: true, lazy: false }) {
19
19
  const currentShop = useCurrentShop();
20
20
  const log = useCoreLog("rpc");
21
21
  const nuxtApp = useNuxtApp();
@@ -73,4 +73,4 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
73
73
  error,
74
74
  status
75
75
  };
76
- };
76
+ }
@@ -2,11 +2,11 @@ import type { FilterParams, SortingValueKey, TransformedFilter, Filter } from '@
2
2
  type Options = {
3
3
  defaultSort?: SortingValueKey;
4
4
  };
5
- declare const _default: (options?: Options) => {
5
+ export declare function useQueryFilterState(options?: Options): {
6
6
  activeFilters: import("vue").ComputedRef<Filter>;
7
7
  applyFilters: (filter?: Filter, scrollToTop?: boolean) => Promise<void>;
8
8
  isActiveFilter: (filter?: TransformedFilter) => any;
9
9
  resetFilterUrl: () => Promise<void>;
10
10
  productConditions: import("vue").ComputedRef<FilterParams>;
11
11
  };
12
- export default _default;
12
+ export {};
@@ -10,7 +10,7 @@ import { computed } from "vue";
10
10
  import { getCurrentPage } from "../../utils/route.mjs";
11
11
  import { useRoute, useRouter } from "#imports";
12
12
  const DEFAULT_QUERY_KEYS = ["page", "sort", "term"];
13
- export default (options = {}) => {
13
+ export function useQueryFilterState(options = {}) {
14
14
  const router = useRouter();
15
15
  const route = useRoute();
16
16
  const activeFilters = computed(() => {
@@ -63,4 +63,4 @@ export default (options = {}) => {
63
63
  resetFilterUrl,
64
64
  productConditions: computed(() => generateFilterParams())
65
65
  };
66
- };
66
+ }
@@ -4,7 +4,7 @@ type Options = Partial<{
4
4
  key: string;
5
5
  }>;
6
6
  /** @deprecated `useSearch` is deprecated. Please, use `useSearchSuggestions` or `useSearchResolve` */
7
- export declare const useSearch: ({ params, key }?: Options) => {
7
+ export declare function useSearch({ params, key }?: Options): {
8
8
  data: import("vue").Ref<TypeaheadSuggestionsEndpointResponseData | undefined>;
9
9
  pending: import("vue").Ref<boolean>;
10
10
  searchQuery: import("vue").Ref<string>;
@@ -2,7 +2,7 @@ import { useState } from "nuxt/app";
2
2
  import { rpcCall } from "../../rpc/rpcCall.mjs";
3
3
  import { useCurrentShop } from "../core/useCurrentShop.mjs";
4
4
  import { useNuxtApp, toValue } from "#imports";
5
- export const useSearch = ({ params, key = "search" } = {}) => {
5
+ export function useSearch({ params, key = "search" } = {}) {
6
6
  const data = useState(
7
7
  `${key}-data`,
8
8
  () => void 0
@@ -48,4 +48,4 @@ export const useSearch = ({ params, key = "search" } = {}) => {
48
48
  resetSearch,
49
49
  search
50
50
  };
51
- };
51
+ }
@@ -1,4 +1,5 @@
1
1
  import { type SearchV2SuggestionsEndpointResponseData, type SearchV2With } from '@scayle/storefront-core';
2
+ import { type Ref } from '#imports';
2
3
  export type SearchOptions = Partial<{
3
4
  params: Partial<{
4
5
  categoryId: number;
@@ -6,7 +7,7 @@ export type SearchOptions = Partial<{
6
7
  }>;
7
8
  key: string;
8
9
  }>;
9
- export declare const useStorefrontSearch: (searchQuery: Ref<string>, { params, key }?: SearchOptions) => {
10
+ export declare function useStorefrontSearch(searchQuery: Ref<string>, { params, key }?: SearchOptions): {
10
11
  data: import("vue").Ref<SearchV2SuggestionsEndpointResponseData | undefined>;
11
12
  pending: import("vue").Ref<boolean>;
12
13
  resetSearch: () => void;
@@ -2,7 +2,7 @@ import { useState } from "nuxt/app";
2
2
  import { rpcCall } from "../../rpc/rpcCall.mjs";
3
3
  import { useCurrentShop } from "../core/useCurrentShop.mjs";
4
4
  import { useNuxtApp, toValue } from "#imports";
5
- export const useStorefrontSearch = (searchQuery, { params, key = "search" } = {}) => {
5
+ export function useStorefrontSearch(searchQuery, { params, key = "search" } = {}) {
6
6
  const data = useState(
7
7
  `${key}-data`,
8
8
  () => void 0
@@ -61,4 +61,4 @@ export const useStorefrontSearch = (searchQuery, { params, key = "search" } = {}
61
61
  getSearchSuggestions,
62
62
  resolveSearch
63
63
  };
64
- };
64
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.72.1",
4
+ "version": "7.72.3",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -29,6 +29,9 @@
29
29
  "default": "./dist/index.mjs"
30
30
  }
31
31
  },
32
+ "imports": {
33
+ "#storefront/composables": "./dist/runtime/composables/index.mjs"
34
+ },
32
35
  "main": "./dist/index.mjs",
33
36
  "types": "./dist/index.d.ts",
34
37
  "files": [
@@ -72,7 +75,7 @@
72
75
  "unstorage": "1.10.2",
73
76
  "vue-router": "4.3.2",
74
77
  "yn": "5.0.0",
75
- "zod": "3.23.5"
78
+ "zod": "3.23.8"
76
79
  },
77
80
  "devDependencies": {
78
81
  "@nuxt/eslint": "0.3.13",