@scayle/storefront-nuxt 8.11.11 → 8.12.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,17 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `OrderItem` and `Order` now accept generics: Both `OrderItem` and `Order` interfaces now accept generic type parameters for `Product` and `Variant`. Previously, these were implicitly typed as `Record<string, unknown>`. This change allows to strongly type the `product` and `variant` data within orders and order items, leading to better type checking and potentially fewer runtime errors. This allows for compile-time checks and autocompletion when working with `product` and `variant` properties of `OrderItem` and items property of `Order`.
8
+
9
+ ### Patch Changes
10
+
11
+ **Dependencies**
12
+
13
+ - Updated dependency to @scayle/storefront-core@8.14.0
14
+
3
15
  ## 8.11.11
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": "8.11.11",
3
+ "version": "8.12.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -53,7 +53,7 @@ export default {
53
53
  }`;
54
54
  }
55
55
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
56
- const PACKAGE_VERSION = "8.11.11";
56
+ const PACKAGE_VERSION = "8.12.0";
57
57
  const logger = createConsola({
58
58
  fancy: true,
59
59
  formatOptions: {
@@ -28,7 +28,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
28
28
  } | import("@scayle/storefront-api").Category | {
29
29
  categories: import("@scayle/storefront-api").Category;
30
30
  activeNode: import("@scayle/storefront-api").Category;
31
- } | import("@scayle/storefront-core").Order | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchEntity | import("@scayle/storefront-api").ShopConfiguration | {
31
+ } | import("@scayle/storefront-core").Order<Record<string, unknown>, Record<string, unknown>> | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchEntity | import("@scayle/storefront-api").ShopConfiguration | {
32
32
  user: import("@scayle/storefront-core").ShopUser | undefined;
33
33
  } | import("@scayle/storefront-core").ShopUserAddress[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | {
34
34
  success: true;
@@ -2,11 +2,6 @@ import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
2
  import type { AsyncDataOptions } from 'nuxt/app';
3
3
  import { type KeysOf, type ExtendedAsyncData } from '../core/useRpc.js';
4
4
  import type { MaybeRefOrGetter } from 'vue';
5
- type ItemsType = Exclude<Order['items'], undefined>;
6
- type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
7
- product: P;
8
- variant: V;
9
- };
10
5
  /**
11
6
  * Retrieves order data by ID using the `getOrderById` RPC method.
12
7
  *
@@ -19,7 +14,7 @@ type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
19
14
  *
20
15
  * @template P The type of the `product` property within the order items. Defaults to an object with any keys.
21
16
  * @template V The type of the `variant` property within the order items. Defaults to an object with any keys.
22
- * @template DataT The type of the transformed data. Defaults to `Order & { items?: NewItemsType<P, V>[] }`.
17
+ * @template DataT The type of the transformed data. Defaults to `Order<P, V>`.
23
18
  * @template PickKeys Keys of the `DataT` type that will be present. This defaults to all keys of DataT.
24
19
  * @template DefaultT The default return type. Useful for showing loading skeletons. Defaults to `null`.
25
20
  *
@@ -30,18 +25,7 @@ type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
30
25
  *
31
26
  * @returns An extended async data object containing the order data.
32
27
  */
33
- export declare function useOrder<P = {
34
- [k: string]: unknown;
35
- }, V = {
36
- [k: string]: unknown;
37
- }, DataT = Order & {
38
- items?: NewItemsType<P, V>[];
39
- }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options }?: {
28
+ export declare function useOrder<P = Record<string, unknown>, V = Record<string, unknown>, DataT = Order<P, V>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: {
40
29
  params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
41
- options?: AsyncDataOptions<Order & {
42
- items?: NewItemsType<P, V>[];
43
- }, DataT, PickKeys, DefaultT>;
44
- }, key?: string): ExtendedAsyncData<Order & {
45
- items?: NewItemsType<P, V>[];
46
- }, unknown, DataT, PickKeys, DefaultT>;
47
- export {};
30
+ options?: AsyncDataOptions<Order<P, V>, DataT, PickKeys, DefaultT>;
31
+ }, key?: string): ExtendedAsyncData<Order<P, V>, unknown, DataT, PickKeys, DefaultT>;
@@ -1,5 +1,8 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
- export function useOrder({ params, options } = {}, key = "useOrder") {
2
+ export function useOrder({
3
+ params,
4
+ options
5
+ } = {}, key = "useOrder") {
3
6
  return useRpc(
4
7
  "getOrderById",
5
8
  key,
@@ -2,11 +2,6 @@ import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
2
2
  import type { AsyncDataOptions } from 'nuxt/app';
3
3
  import type { ExtendedAsyncData, KeysOf } from '../core/useRpc.js';
4
4
  import type { MaybeRefOrGetter } from 'vue';
5
- type ItemsType = Exclude<Order['items'], undefined>;
6
- type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
7
- product: P;
8
- variant: V;
9
- };
10
5
  /**
11
6
  * Retrieves order data by ID using the `getOrderDataByCbd RPC method.
12
7
  *
@@ -17,7 +12,7 @@ type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
17
12
  *
18
13
  * @template P The type of the `product` property within the order items. Defaults to an object with any keys.
19
14
  * @template V The type of the `variant` property within the order items. Defaults to an object with any keys.
20
- * @template DataT The type of the transformed data. Defaults to `Order & { items?: NewItemsType<P, V>[] }`.
15
+ * @template DataT The type of the transformed data. Defaults to `Order<P, V>`.
21
16
  * @template PickKeys Keys of the `DataT` type that will be present. This defaults to all keys of DataT.
22
17
  * @template DefaultT The default return type. Useful for showing loading skeletons. Defaults to `null`.
23
18
  *
@@ -28,18 +23,7 @@ type NewItemsType<P, V> = Exclude<ItemsType[number], 'product' | 'variant'> & {
28
23
  *
29
24
  * @returns An extended async data object containing the order data.
30
25
  */
31
- export declare function useOrderConfirmation<P = {
32
- [k: string]: unknown;
33
- }, V = {
34
- [k: string]: unknown;
35
- }, DataT = Order & {
36
- items?: NewItemsType<P, V>[];
37
- }, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options }?: {
26
+ export declare function useOrderConfirmation<P = Record<string, unknown>, V = Record<string, unknown>, DataT = Order<P, V>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: {
38
27
  params?: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
39
- options?: AsyncDataOptions<Order & {
40
- items?: NewItemsType<P, V>[];
41
- }, DataT, PickKeys, DefaultT>;
42
- }, key?: string): ExtendedAsyncData<Order & {
43
- items?: NewItemsType<P, V>[];
44
- }, unknown, DataT, PickKeys, DefaultT>;
45
- export {};
28
+ options?: AsyncDataOptions<Order<P, V>, DataT, PickKeys, DefaultT>;
29
+ }, key?: string): ExtendedAsyncData<Order<P, V>, unknown, DataT, PickKeys, DefaultT>;
@@ -1,5 +1,8 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
- export function useOrderConfirmation({ params, options } = {}, key = "useOrderConfirmation") {
2
+ export function useOrderConfirmation({
3
+ params,
4
+ options
5
+ } = {}, key = "useOrderConfirmation") {
3
6
  return useRpc(
4
7
  "getOrderDataByCbd",
5
8
  key,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.11.11",
4
+ "version": "8.12.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -78,7 +78,7 @@
78
78
  "dependencies": {
79
79
  "@opentelemetry/api": "^1.9.0",
80
80
  "@scayle/h3-session": "0.6.0",
81
- "@scayle/storefront-core": "8.13.0",
81
+ "@scayle/storefront-core": "8.14.0",
82
82
  "@scayle/unstorage-compression-driver": "^0.2.4",
83
83
  "@vercel/nft": "0.29.2",
84
84
  "@vueuse/core": "13.0.0",