@scayle/storefront-nuxt 7.85.7 → 7.85.8

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,14 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.85.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Correct the types of `useOrder` and `useOrderConfirmation`
8
+ **Dependencies**
9
+
10
+ - Updated dependency to @scayle/storefront-core@7.65.4
11
+
3
12
  ## 7.85.7
4
13
 
5
14
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.85.7",
3
+ "version": "7.85.8",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -71,7 +71,7 @@ export default {
71
71
  }`;
72
72
  }
73
73
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
74
- const PACKAGE_VERSION = "7.85.7";
74
+ const PACKAGE_VERSION = "7.85.8";
75
75
  const logger = createConsola({
76
76
  fancy: true,
77
77
  formatOptions: {
@@ -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 {};
@@ -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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.85.7",
4
+ "version": "7.85.8",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "@nuxt/kit": "^3.12.2",
62
62
  "@opentelemetry/api": "^1.9.0",
63
63
  "@scayle/h3-session": "^0.4.0",
64
- "@scayle/storefront-core": "7.65.3",
64
+ "@scayle/storefront-core": "7.65.4",
65
65
  "@scayle/unstorage-compression-driver": "^0.1.3",
66
66
  "@vueuse/core": "11.1.0",
67
67
  "consola": "^3.2.3",
@@ -85,9 +85,9 @@
85
85
  "@nuxt/test-utils": "3.14.2",
86
86
  "@scayle/eslint-config-storefront": "4.3.0",
87
87
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
88
- "@types/node": "20.16.5",
88
+ "@types/node": "20.16.6",
89
89
  "dprint": "0.47.2",
90
- "eslint": "9.10.0",
90
+ "eslint": "9.11.1",
91
91
  "eslint-formatter-gitlab": "5.1.0",
92
92
  "fishery": "2.2.2",
93
93
  "h3": "1.12.0",