@scayle/storefront-nuxt 7.85.7 → 7.85.9

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 (47) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/index.d.mts +5 -15
  3. package/dist/index.d.ts +5 -15
  4. package/dist/index.mjs +2 -16
  5. package/dist/module.d.mts +4 -4
  6. package/dist/module.d.ts +4 -4
  7. package/dist/module.mjs +5 -25
  8. package/dist/rpc.d.mts +1 -16
  9. package/dist/rpc.d.ts +1 -16
  10. package/dist/rpc.mjs +1 -20
  11. package/dist/runtime/api/rpcHandler.d.ts +55 -1
  12. package/dist/runtime/api/rpcHandler.mjs +1 -1
  13. package/dist/runtime/composables/core/useAvailableShops.d.ts +1 -1
  14. package/dist/runtime/composables/core/useRpc.d.ts +3 -3
  15. package/dist/runtime/composables/storefront/useFacet.d.ts +28 -24
  16. package/dist/runtime/composables/storefront/useOrder.d.ts +15 -14
  17. package/dist/runtime/composables/storefront/useOrder.mjs +4 -20
  18. package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +15 -14
  19. package/dist/runtime/composables/storefront/useOrderConfirmation.mjs +1 -19
  20. package/dist/runtime/composables/storefront/useSearch.d.ts +3 -3
  21. package/dist/runtime/composables/storefront/useStorefrontSearch.d.ts +2 -2
  22. package/dist/runtime/context.mjs +1 -1
  23. package/dist/runtime/error/handler.d.ts +1 -1
  24. package/dist/runtime/nitro/plugins/cacheRuntimeConfig.d.ts +1 -1
  25. package/dist/runtime/nitro/plugins/cacheRuntimeConfig.mjs +2 -1
  26. package/dist/runtime/nitro/plugins/configValidation.d.ts +8 -3
  27. package/dist/runtime/nitro/plugins/configValidation.mjs +7 -5
  28. package/dist/runtime/nitro/plugins/nitroLogger.d.ts +1 -1
  29. package/dist/runtime/nitro/plugins/nitroLogger.mjs +2 -1
  30. package/dist/runtime/nitro/plugins/nitroRuntimeStorageConfig.d.ts +1 -1
  31. package/dist/runtime/nitro/plugins/nitroRuntimeStorageConfig.mjs +7 -5
  32. package/dist/runtime/nitro/plugins/nitroSetXPoweredByHeader.d.ts +1 -1
  33. package/dist/runtime/nitro/plugins/nitroSetXPoweredByHeader.mjs +1 -1
  34. package/dist/runtime/server/middleware/bootstrap.mjs +1 -1
  35. package/dist/runtime/server/middleware/bootstrap.utils.d.ts +6 -2
  36. package/dist/runtime/server/middleware/bootstrap.utils.mjs +2 -2
  37. package/dist/runtime/server/tsconfig.json +1 -1
  38. package/dist/runtime/utils/zodSchema.d.ts +261 -153
  39. package/dist/runtime/utils/zodSchema.mjs +16 -7
  40. package/dist/shared/storefront-nuxt.77c99ba5.d.mts +102 -0
  41. package/dist/shared/storefront-nuxt.77c99ba5.d.ts +102 -0
  42. package/package.json +13 -13
  43. package/dist/module.json +0 -8
  44. package/dist/shared/storefront-nuxt.891170da.d.mts +0 -1205
  45. package/dist/shared/storefront-nuxt.891170da.d.ts +0 -1205
  46. package/dist/types.d.mts +0 -14
  47. package/dist/types.d.ts +0 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.85.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Update @nuxt/module-builder to 0.6.0
8
+
9
+ ## 7.85.8
10
+
11
+ ### Patch Changes
12
+
13
+ - Correct the types of `useOrder` and `useOrderConfirmation`
14
+ **Dependencies**
15
+
16
+ - Updated dependency to @scayle/storefront-core@7.65.4
17
+
3
18
  ## 7.85.7
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,23 +1,13 @@
1
- export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.891170da.mjs';
2
- export { rpcCall } from './rpc.mjs';
1
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.77c99ba5.mjs';
2
+ export { rpcCall } from './runtime/rpc/rpcCall.ts';
3
+ export { extendPromise } from './runtime/utils/promise.ts';
3
4
  export * from '@scayle/storefront-core';
4
5
  export { LogLevel } from '@scayle/storefront-core';
5
6
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
6
7
  import '@scayle/unstorage-compression-driver';
7
8
  import 'unstorage';
8
- import 'zod';
9
+ import './runtime/utils/zodSchema.ts';
9
10
  import '@nuxt/schema';
10
- import 'nuxt/app';
11
-
12
- /**
13
- * This function accepts a Promise which has the same interface as its resolved value.
14
- * It returns a new Promise which extends the original Promise and the original Promise's resolve value
15
- * with all the properties in source.
16
- * @param promise
17
- * @param source
18
- * @returns
19
- */
20
- declare function extendPromise<T extends object, U>(promise: T & Promise<T>, source: U): T & U & Promise<T & U>;
21
11
 
22
12
  interface RpcMethodsStorefront {
23
13
  }
@@ -26,4 +16,4 @@ declare module '@scayle/storefront-core' {
26
16
  }
27
17
  }
28
18
 
29
- export { type RpcMethodsStorefront, extendPromise };
19
+ export type { RpcMethodsStorefront };
package/dist/index.d.ts CHANGED
@@ -1,23 +1,13 @@
1
- export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.891170da.js';
2
- export { rpcCall } from './rpc.js';
1
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.77c99ba5.js';
2
+ export { rpcCall } from './runtime/rpc/rpcCall.ts';
3
+ export { extendPromise } from './runtime/utils/promise.ts';
3
4
  export * from '@scayle/storefront-core';
4
5
  export { LogLevel } from '@scayle/storefront-core';
5
6
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
6
7
  import '@scayle/unstorage-compression-driver';
7
8
  import 'unstorage';
8
- import 'zod';
9
+ import './runtime/utils/zodSchema.ts';
9
10
  import '@nuxt/schema';
10
- import 'nuxt/app';
11
-
12
- /**
13
- * This function accepts a Promise which has the same interface as its resolved value.
14
- * It returns a new Promise which extends the original Promise and the original Promise's resolve value
15
- * with all the properties in source.
16
- * @param promise
17
- * @param source
18
- * @returns
19
- */
20
- declare function extendPromise<T extends object, U>(promise: T & Promise<T>, source: U): T & U & Promise<T & U>;
21
11
 
22
12
  interface RpcMethodsStorefront {
23
13
  }
@@ -26,4 +16,4 @@ declare module '@scayle/storefront-core' {
26
16
  }
27
17
  }
28
18
 
29
- export { type RpcMethodsStorefront, extendPromise };
19
+ export type { RpcMethodsStorefront };
package/dist/index.mjs CHANGED
@@ -1,18 +1,4 @@
1
- export { rpcCall } from './rpc.mjs';
1
+ export { rpcCall } from './runtime/rpc/rpcCall';
2
+ export { extendPromise } from './runtime/utils/promise';
2
3
  export * from '@scayle/storefront-core';
3
4
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
4
-
5
- function extendPromise(promise, source) {
6
- const newPromise = promise.then(
7
- (result) => Object.assign(result, source)
8
- );
9
- const withoutPromise = Object.assign({}, promise);
10
- for (const key of Object.getOwnPropertyNames(
11
- Promise.prototype
12
- )) {
13
- delete withoutPromise[key];
14
- }
15
- return Object.assign(newPromise, Object.assign(withoutPromise, source));
16
- }
17
-
18
- export { extendPromise };
package/dist/module.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.891170da.mjs';
3
- export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.891170da.mjs';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.77c99ba5.mjs';
3
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.77c99ba5.mjs';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
7
- import 'zod';
7
+ import './runtime/utils/zodSchema.ts';
8
8
 
9
- declare const _default: _nuxt_schema.NuxtModule<Omit<ModuleBaseOptions, "sapi" | "bapi">>;
9
+ declare const _default: _nuxt_schema.NuxtModule<ModuleBaseOptions, ModuleBaseOptions, false>;
10
10
 
11
11
  export { ModuleBaseOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.891170da.js';
3
- export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.891170da.js';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.77c99ba5.js';
3
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.77c99ba5.js';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
7
- import 'zod';
7
+ import './runtime/utils/zodSchema.ts';
8
8
 
9
- declare const _default: _nuxt_schema.NuxtModule<Omit<ModuleBaseOptions, "sapi" | "bapi">>;
9
+ declare const _default: _nuxt_schema.NuxtModule<ModuleBaseOptions, ModuleBaseOptions, false>;
10
10
 
11
11
  export { ModuleBaseOptions, _default as default };
package/dist/module.mjs CHANGED
@@ -4,30 +4,7 @@ import { defu } from 'defu';
4
4
  import { genImport, genSafeVariableName } from 'knitwork';
5
5
  import { builtinDrivers } from 'unstorage';
6
6
  import { createConsola } from 'consola';
7
- import 'h3';
8
- import { joinURL } from 'ufo';
9
-
10
- const convertShopsToList = (shops) => {
11
- if (Array.isArray(shops)) {
12
- return shops;
13
- }
14
- return Object.values(shops);
15
- };
16
- function getApiBasePath(storefrontConfig, shop, baseUrl) {
17
- const path = Array.isArray(shop.path) ? shop.path[0] : shop.path;
18
- const apiPath = shop.apiBasePath || storefrontConfig.apiBasePath || "/api";
19
- if (storefrontConfig.shopSelector === "path") {
20
- const pathElements = [path, apiPath].filter(Boolean);
21
- return joinURL(baseUrl, ...pathElements);
22
- } else if (storefrontConfig.shopSelector === "path_or_default") {
23
- if (shop.isDefault) {
24
- return joinURL(baseUrl, apiPath);
25
- }
26
- const pathElements = [path, apiPath].filter(Boolean);
27
- return joinURL(baseUrl, ...pathElements);
28
- }
29
- return joinURL(baseUrl, apiPath);
30
- }
7
+ import { convertShopsToList, getApiBasePath } from './runtime/server/middleware/bootstrap.utils';
31
8
 
32
9
  function stringToBoolean(value, defaultValue = false) {
33
10
  return value ? value.toLowerCase() === "true" : defaultValue;
@@ -71,7 +48,7 @@ export default {
71
48
  }`;
72
49
  }
73
50
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
74
- const PACKAGE_VERSION = "7.85.7";
51
+ const PACKAGE_VERSION = "7.85.9";
75
52
  const logger = createConsola({
76
53
  fancy: true,
77
54
  formatOptions: {
@@ -81,6 +58,9 @@ const logger = createConsola({
81
58
  defaults: {
82
59
  tag: PACKAGE_NAME
83
60
  }
61
+ // At runtime consola/basic will be loaded which supports the fancy option
62
+ // However when typechecking it will resolve to consola/browser which does have the fancy option
63
+ // This assertion avoids the typescript error
84
64
  });
85
65
  const module = defineNuxtModule({
86
66
  meta: {
package/dist/rpc.d.mts CHANGED
@@ -1,16 +1 @@
1
- import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
- import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.891170da.mjs';
4
- import '@scayle/unstorage-compression-driver';
5
- import 'unstorage';
6
- import 'zod';
7
- import '@nuxt/schema';
8
-
9
- /**
10
- * rpcCall can be used to invoke an RPC method either on the client or server
11
- * It makes an HTTP request on the client and direct call on the server using $fetch
12
- * https://nuxt.com/docs/api/utils/dollarfetch
13
- */
14
- declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
15
-
16
- export { rpcCall };
1
+ export { rpcCall } from './runtime/rpc/rpcCall.ts';
package/dist/rpc.d.ts CHANGED
@@ -1,16 +1 @@
1
- import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
- import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.891170da.js';
4
- import '@scayle/unstorage-compression-driver';
5
- import 'unstorage';
6
- import 'zod';
7
- import '@nuxt/schema';
8
-
9
- /**
10
- * rpcCall can be used to invoke an RPC method either on the client or server
11
- * It makes an HTTP request on the client and direct call on the server using $fetch
12
- * https://nuxt.com/docs/api/utils/dollarfetch
13
- */
14
- declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
15
-
16
- export { rpcCall };
1
+ export { rpcCall } from './runtime/rpc/rpcCall.ts';
package/dist/rpc.mjs CHANGED
@@ -1,20 +1 @@
1
- import { unwrap } from '@scayle/storefront-core/dist/utils/response';
2
-
3
- const rpcCall = (nuxtApp, method, shop) => {
4
- const fetch = nuxtApp.ssrContext?.event.$fetch ?? $fetch;
5
- return async (params = void 0) => {
6
- const data = await fetch(`${shop.apiBasePath ?? "/api"}/rpc/${method}`, {
7
- // @ts-expect-error Type '"POST"' is not assignable to type 'AvailableRouterMethod<`${string}/rpc/${N}`> | Uppercase<AvailableRouterMethod<`${string}/rpc/${N}`>> | undefined'.ts(2322)
8
- method: "POST",
9
- body: {
10
- payload: params
11
- },
12
- headers: {
13
- "x-shop-id": shop.shopId.toString()
14
- }
15
- });
16
- return await unwrap(data);
17
- };
18
- };
19
-
20
- export { rpcCall };
1
+ export { rpcCall } from './runtime/rpc/rpcCall';
@@ -1,2 +1,56 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | string[] | import("@scayle/storefront-core").ShopUser | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant> | {
2
+ type: "failure";
3
+ statusCode: number;
4
+ basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
5
+ } | {
6
+ readonly type: "success";
7
+ readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
8
+ } | {
9
+ readonly type: "failure";
10
+ readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
11
+ readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
12
+ } | import("@scayle/storefront-api").BrandsEndpointResponseData | import("@scayle/storefront-api").Brand | {
13
+ categories: import("@scayle/storefront-api").Category[];
14
+ activeNode: undefined;
15
+ } | import("@scayle/storefront-api").Category | {
16
+ categories: import("@scayle/storefront-api").Category;
17
+ activeNode: import("@scayle/storefront-api").Category;
18
+ } | import("@scayle/storefront-core").Order | {
19
+ category: string | undefined;
20
+ categoryId: number | undefined;
21
+ } | import("@scayle/storefront-api").Product[] | {
22
+ count: number;
23
+ } | {
24
+ filters: import("@scayle/storefront-api").FiltersEndpointResponseData;
25
+ unfilteredCount: number;
26
+ } | {
27
+ products: import("@scayle/storefront-api").Product[];
28
+ pagination: {
29
+ current: number;
30
+ total: number;
31
+ perPage: number;
32
+ page: number;
33
+ first: number;
34
+ prev: number;
35
+ next: number;
36
+ last: number;
37
+ };
38
+ } | import("@scayle/storefront-api").TypeaheadSuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchEntity | import("@scayle/storefront-api").ShopConfiguration | {
39
+ user: import("@scayle/storefront-core").ShopUser | undefined;
40
+ } | import("@scayle/storefront-api").Wishlist | Response | import("@scayle/storefront-core").ShopUserAddress[] | {
41
+ accessToken: string;
42
+ checkoutJwt: string;
43
+ } | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | {
44
+ success: true;
45
+ } | {
46
+ success: false;
47
+ } | {
48
+ result: true;
49
+ } | {
50
+ result: false;
51
+ } | import("@scayle/storefront-api").PromotionsEndpointResponseData | {
52
+ [k: string]: string;
53
+ } | {
54
+ message: string;
55
+ } | null | undefined>>;
2
56
  export default _default;
@@ -3,7 +3,7 @@ import { purifySensitiveData } from "@scayle/storefront-core";
3
3
  import { trace, SpanStatusCode } from "@opentelemetry/api";
4
4
  import { handler } from "../handler.mjs";
5
5
  import { resolveError } from "../error/handler.mjs";
6
- import { useNitroApp } from "#imports";
6
+ import { useNitroApp } from "nitropack/runtime";
7
7
  const tracer = trace.getTracer(
8
8
  "storefront-nuxt",
9
9
  "__sfc_version"
@@ -1,2 +1,2 @@
1
1
  import type { PublicShopConfig } from '../../../module';
2
- export declare function useAvailableShops(): import("vue").Ref<PublicShopConfig[]>;
2
+ export declare function useAvailableShops(): import("vue").Ref<PublicShopConfig[], PublicShopConfig[]>;
@@ -13,11 +13,11 @@ export type NormalizedRpcResponse<N extends RpcMethodName> = Exclude<Awaited<Rpc
13
13
  /**
14
14
  * Extend AsyncDataOptions with autoFetch (deprecated) and lazy (unused)
15
15
  */
16
- export type UseRpcOptions<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = RpcOptions & AsyncDataOptions<NormalizedRpcResponse<N>, DataT, PickKeys, DefaultT>;
16
+ export type UseRpcOptions<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null, ResponseT = NormalizedRpcResponse<N>> = RpcOptions & AsyncDataOptions<ResponseT, DataT, PickKeys, DefaultT>;
17
17
  /**
18
18
  * The return type of a composable based on useRpc
19
19
  */
20
- export type UseRpcReturn<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = ExtendedAsyncData<NormalizedRpcResponse<N>, unknown, DataT, PickKeys, DefaultT>;
20
+ export type UseRpcReturn<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null, ResponseT = NormalizedRpcResponse<N>> = ExtendedAsyncData<ResponseT, unknown, DataT, PickKeys, DefaultT>;
21
21
  export type Status = 'idle' | 'pending' | 'success' | 'error';
22
22
  type AsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = ReturnType<typeof useAsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>>;
23
23
  type AwaitedAsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null> = Awaited<AsyncData<ResT, ErrorT, DataT, PickKeys, DefaultT>>;
@@ -50,5 +50,5 @@ export type ExtendedAsyncData<ResT, ErrorT = unknown, DataT = ResT, PickKeys ext
50
50
  * But anything passed here will take precedence.
51
51
  * @see {@link https://nuxt.com/docs/api/composables/use-async-data#params}
52
52
  */
53
- export declare function useRpc<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>(method: N, key: string, params?: MaybeRefOrGetter<RpcMethodParameters<N> extends RpcContext ? undefined : RpcMethodParameters<N>>, options?: UseRpcOptions<N, DataT, PickKeys, DefaultT>): ExtendedAsyncData<NormalizedRpcResponse<N>, unknown, DataT, PickKeys, DefaultT>;
53
+ export declare function useRpc<N extends RpcMethodName, DataT = NormalizedRpcResponse<N>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null, ResponseT = NormalizedRpcResponse<N>>(method: N, key: string, params?: MaybeRefOrGetter<RpcMethodParameters<N> extends RpcContext ? undefined : RpcMethodParameters<N>>, options?: UseRpcOptions<N, DataT, PickKeys, DefaultT, ResponseT>): ExtendedAsyncData<ResponseT, unknown, DataT, PickKeys, DefaultT>;
54
54
  export {};
@@ -16,17 +16,19 @@ type Options = Partial<{
16
16
  }>;
17
17
  export declare function useFacet({ key: optionsKey, params, }?: Options, _key?: string): {
18
18
  filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData | undefined>;
19
- filtersFetching: import("vue").Ref<boolean>;
19
+ filtersFetching: import("vue").Ref<boolean, boolean>;
20
20
  unfilteredCount: import("vue").ComputedRef<number | undefined>;
21
- filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
22
- filterError: import("vue").Ref<any>;
21
+ filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
22
+ filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
23
23
  productCountData: import("vue").Ref<{
24
24
  count: number;
25
+ } | null, {
26
+ count: number;
25
27
  } | null>;
26
28
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
27
- productCountFetching: import("vue").Ref<boolean>;
28
- productCountError: import("vue").Ref<any>;
29
- productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
29
+ productCountFetching: import("vue").Ref<boolean, boolean>;
30
+ productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
31
+ productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
30
32
  products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[] | undefined>;
31
33
  pagination: import("vue").ComputedRef<{
32
34
  current: number;
@@ -38,15 +40,15 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
38
40
  next: number;
39
41
  last: number;
40
42
  } | undefined>;
41
- productsFetching: import("vue").Ref<boolean>;
43
+ productsFetching: import("vue").Ref<boolean, boolean>;
42
44
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
43
- productError: import("vue").Ref<any>;
44
- productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
45
+ productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
46
+ productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
45
47
  categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[] | undefined>;
46
48
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
47
- categoriesFetching: import("vue").Ref<boolean>;
48
- categoriesError: import("vue").Ref<any>;
49
- categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
49
+ categoriesFetching: import("vue").Ref<boolean, boolean>;
50
+ categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
51
+ categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
50
52
  fetchProducts: ({ path, page, perPage, where, sort, pricePromotionKey, cache, orFiltersOperator, }: FilterParams & {
51
53
  path: string;
52
54
  pricePromotionKey?: string;
@@ -55,17 +57,19 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
55
57
  fetchPage: (pageToFetch: number) => Promise<void>;
56
58
  } & Promise<{
57
59
  filters: import("vue").ComputedRef<import("@scayle/storefront-api").FiltersEndpointResponseData | undefined>;
58
- filtersFetching: import("vue").Ref<boolean>;
60
+ filtersFetching: import("vue").Ref<boolean, boolean>;
59
61
  unfilteredCount: import("vue").ComputedRef<number | undefined>;
60
- filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
61
- filterError: import("vue").Ref<any>;
62
+ filterStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
63
+ filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
62
64
  productCountData: import("vue").Ref<{
63
65
  count: number;
66
+ } | null, {
67
+ count: number;
64
68
  } | null>;
65
69
  refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
66
- productCountFetching: import("vue").Ref<boolean>;
67
- productCountError: import("vue").Ref<any>;
68
- productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
70
+ productCountFetching: import("vue").Ref<boolean, boolean>;
71
+ productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
72
+ productCountStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
69
73
  products: import("vue").ComputedRef<import("@scayle/storefront-api").Product[] | undefined>;
70
74
  pagination: import("vue").ComputedRef<{
71
75
  current: number;
@@ -77,15 +81,15 @@ export declare function useFacet({ key: optionsKey, params, }?: Options, _key?:
77
81
  next: number;
78
82
  last: number;
79
83
  } | undefined>;
80
- productsFetching: import("vue").Ref<boolean>;
84
+ productsFetching: import("vue").Ref<boolean, boolean>;
81
85
  filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
82
- productError: import("vue").Ref<any>;
83
- productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
86
+ productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
87
+ productStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
84
88
  categories: import("vue").ComputedRef<import("@scayle/storefront-api").Category | import("@scayle/storefront-api").Category[] | undefined>;
85
89
  selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-api").Category | undefined>;
86
- categoriesFetching: import("vue").Ref<boolean>;
87
- categoriesError: import("vue").Ref<any>;
88
- categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
90
+ categoriesFetching: import("vue").Ref<boolean, boolean>;
91
+ categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null, import("nuxt/app").NuxtError<unknown> | null>;
92
+ categoriesStatus: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
89
93
  fetchProducts: ({ path, page, perPage, where, sort, pricePromotionKey, cache, orFiltersOperator, }: FilterParams & {
90
94
  path: string;
91
95
  pricePromotionKey?: string;
@@ -1,25 +1,26 @@
1
1
  import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
- import { type RpcOptions, type UseRpcReturn } from '../core/useRpc';
3
- import type { Ref, MaybeRefOrGetter } from 'vue';
4
- type Options = Partial<{
5
- params: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
6
- options: RpcOptions;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
- }>;
2
+ import type { AsyncDataOptions } from 'nuxt/app';
3
+ import { type RpcOptions, type KeysOf, type ExtendedAsyncData } from '../core/useRpc';
4
+ import type { MaybeRefOrGetter } from 'vue';
10
5
  type ItemsType = Exclude<Order['items'], undefined>;
11
6
  type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
12
7
  product: P;
13
8
  variant: V;
14
9
  };
15
- type UserOrderBaseReturn<P, V> = Pick<Awaited<UseRpcReturn<'getOrderById'>>, 'error' | 'status' | 'fetch' | 'fetching' | 'refresh'> & {
16
- data: Ref<Order & {
17
- items?: NewItemsType<P, V>[];
18
- }>;
19
- };
20
10
  export declare function useOrder<P = {
21
11
  [k: string]: unknown;
22
12
  }, V = {
23
13
  [k: string]: unknown;
24
- }>({ params, options, key: _key }?: Options, key?: string): UserOrderBaseReturn<P, V> & Promise<UserOrderBaseReturn<P, V>>;
14
+ }, DataT = Order & {
15
+ items?: NewItemsType<P, V>[];
16
+ }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key }?: {
17
+ params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
18
+ options?: RpcOptions & AsyncDataOptions<Order & {
19
+ items?: NewItemsType<P, V>[];
20
+ }, DataT, PickKeys, DefaultT>;
21
+ /** @deprecated use the second argument of the composable to define the key */
22
+ key?: string;
23
+ }, key?: string): ExtendedAsyncData<Order & {
24
+ items?: NewItemsType<P, V>[];
25
+ }, unknown, DataT, PickKeys, DefaultT>;
25
26
  export {};
@@ -1,27 +1,11 @@
1
- import { useRpc } from "../core/useRpc.mjs";
2
- import { extendPromise } from "../../utils/promise.mjs";
1
+ import {
2
+ useRpc
3
+ } from "../core/useRpc.mjs";
3
4
  export function useOrder({ params, options, key: _key } = {}, key) {
4
- const promise = useRpc(
5
+ return useRpc(
5
6
  "getOrderById",
6
7
  _key ?? key ?? "useOrder",
7
8
  params,
8
9
  options
9
10
  );
10
- const {
11
- data,
12
- fetch,
13
- fetching,
14
- error,
15
- refresh,
16
- status
17
- } = promise;
18
- const _data = data;
19
- return extendPromise(promise.then(() => ({})), {
20
- data: _data,
21
- fetch,
22
- fetching,
23
- error,
24
- refresh,
25
- status
26
- });
27
11
  }
@@ -1,25 +1,26 @@
1
1
  import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
- import type { RpcOptions, UseRpcReturn } from '../core/useRpc';
3
- import type { Ref, MaybeRefOrGetter } from 'vue';
4
- type Options = Partial<{
5
- params: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
6
- options: RpcOptions;
7
- /** @deprecated use the second argument of the composable to define the key */
8
- key: string;
9
- }>;
2
+ import type { AsyncDataOptions } from 'nuxt/app';
3
+ import type { RpcOptions, ExtendedAsyncData, KeysOf } from '../core/useRpc';
4
+ import type { MaybeRefOrGetter } from 'vue';
10
5
  type ItemsType = Exclude<Order['items'], undefined>;
11
6
  type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
12
7
  product: P;
13
8
  variant: V;
14
9
  };
15
- type UseOrderConfirmationBaseReturn<P, V> = Pick<Awaited<UseRpcReturn<'getOrderDataByCbd'>>, 'error' | 'status' | 'fetch' | 'fetching' | 'refresh'> & {
16
- data: Ref<Order & {
17
- items?: NewItemsType<P, V>[];
18
- }>;
19
- };
20
10
  export declare function useOrderConfirmation<P = {
21
11
  [k: string]: unknown;
22
12
  }, V = {
23
13
  [k: string]: unknown;
24
- }>({ params, options, key: _key }?: Options, key?: string): UseOrderConfirmationBaseReturn<P, V> & Promise<UseOrderConfirmationBaseReturn<P, V>>;
14
+ }, DataT = Order & {
15
+ items?: NewItemsType<P, V>[];
16
+ }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, key: _key }?: {
17
+ params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
18
+ options?: RpcOptions & AsyncDataOptions<Order & {
19
+ items?: NewItemsType<P, V>[];
20
+ }, DataT, PickKeys, DefaultT>;
21
+ /** @deprecated use the second argument of the composable to define the key */
22
+ key?: string;
23
+ }, key?: string): ExtendedAsyncData<Order & {
24
+ items?: NewItemsType<P, V>[];
25
+ }, unknown, DataT, PickKeys, DefaultT>;
25
26
  export {};
@@ -1,27 +1,9 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- import { extendPromise } from "../../utils/promise.mjs";
3
2
  export function useOrderConfirmation({ params, options, key: _key } = {}, key) {
4
- const promise = useRpc(
3
+ return useRpc(
5
4
  "getOrderDataByCbd",
6
5
  _key ?? key ?? "useOrderConfirmation",
7
6
  params,
8
7
  options
9
8
  );
10
- const {
11
- data,
12
- fetch,
13
- fetching,
14
- error,
15
- refresh,
16
- status
17
- } = promise;
18
- const _data = data;
19
- return extendPromise(promise.then(() => ({})), {
20
- fetch,
21
- fetching,
22
- error,
23
- refresh,
24
- status,
25
- data: _data
26
- });
27
9
  }
@@ -5,9 +5,9 @@ type Options = Partial<{
5
5
  }>;
6
6
  /** @deprecated `useSearch` is deprecated. Please, use `useSearchSuggestions` or `useSearchResolve` */
7
7
  export declare function useSearch({ params, key }?: Options): {
8
- data: import("vue").Ref<TypeaheadSuggestionsEndpointResponseData | undefined>;
9
- pending: import("vue").Ref<boolean>;
10
- searchQuery: import("vue").Ref<string>;
8
+ data: import("vue").Ref<TypeaheadSuggestionsEndpointResponseData | undefined, TypeaheadSuggestionsEndpointResponseData | undefined>;
9
+ pending: import("vue").Ref<boolean, boolean>;
10
+ searchQuery: import("vue").Ref<string, string>;
11
11
  resetSearch: () => void;
12
12
  search: ({ term, slug, productLimit }: SearchInput) => Promise<void>;
13
13
  };
@@ -8,8 +8,8 @@ export type SearchOptions = Partial<{
8
8
  key: string;
9
9
  }>;
10
10
  export declare function useStorefrontSearch(searchQuery: Ref<string>, { params, key }?: SearchOptions): {
11
- data: import("vue").Ref<SearchV2SuggestionsEndpointResponseData | undefined>;
12
- pending: import("vue").Ref<boolean>;
11
+ data: Ref<SearchV2SuggestionsEndpointResponseData | undefined, SearchV2SuggestionsEndpointResponseData | undefined>;
12
+ pending: Ref<boolean, boolean>;
13
13
  resetSearch: () => void;
14
14
  getSearchSuggestions: () => Promise<void>;
15
15
  resolveSearch: () => Promise<import("@scayle/storefront-api").SearchEntity | null | undefined>;