@scayle/storefront-nuxt 7.75.1 → 7.76.1

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.76.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `useRpc` will watch now `params` if it is a getter or ref, whereas previously it would only watch for refs
8
+
9
+ ## 7.76.0
10
+
11
+ ### Minor Changes
12
+
13
+ - `useOrder` `useOrderConfirmation` and `useIDP` are now optionally awaitable
14
+
3
15
  ## 7.75.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.75.0",
3
+ "version": "7.76.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -64,7 +64,7 @@ export default {
64
64
  }`;
65
65
  }
66
66
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
67
- const PACKAGE_VERSION = "7.75.0";
67
+ const PACKAGE_VERSION = "7.76.0";
68
68
  const logger = createConsola({
69
69
  fancy: true,
70
70
  formatOptions: {
@@ -1,13 +1,22 @@
1
1
  import { type MaybeRefOrGetter } from 'vue';
2
2
  import type { RpcMethodParameters } from '@scayle/storefront-core';
3
- export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>, key?: string): Promise<{
4
- data: import("vue").Ref<{
5
- [k: string]: string;
3
+ export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<{
4
+ [k: string]: string;
5
+ }, import("nuxt/app").NuxtError<unknown> | null> & {
6
+ fetching: import("vue").Ref<boolean>;
7
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
8
+ } & {
9
+ handleIDPLoginCallback: (params: string | {
10
+ code: string;
11
+ }) => Promise<{
12
+ message: string;
6
13
  }>;
14
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<{
15
+ [k: string]: string;
16
+ }, import("nuxt/app").NuxtError<unknown> | null> & {
7
17
  fetching: import("vue").Ref<boolean>;
8
18
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
9
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
10
- status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
19
+ } & {
11
20
  handleIDPLoginCallback: (params: string | {
12
21
  code: string;
13
22
  }) => Promise<{
@@ -1,12 +1,13 @@
1
1
  import { useNuxtApp } from "nuxt/app";
2
2
  import { useRpc } from "../core/useRpc.mjs";
3
+ import { extendPromise } from "../../utils/promise.mjs";
3
4
  import { rpcCall } from "./../../rpc/rpcCall.mjs";
4
5
  import { useCurrentShop } from "./useCurrentShop.mjs";
5
6
  import { toValue } from "#imports";
6
- export async function useIDP(params = {}, key) {
7
+ export function useIDP(params = {}, key) {
7
8
  const nuxtApp = useNuxtApp();
8
9
  const shop = useCurrentShop();
9
- const { data, fetching, fetch, error, status } = await useRpc(
10
+ const useRpcPromise = useRpc(
10
11
  "getExternalIdpRedirect",
11
12
  key ?? "useIDP",
12
13
  params
@@ -16,13 +17,8 @@ export async function useIDP(params = {}, key) {
16
17
  "handleIDPLoginCallback",
17
18
  toValue(shop)
18
19
  );
19
- return {
20
- data,
21
- fetching,
22
- fetch,
23
- error,
24
- status,
20
+ return extendPromise(useRpcPromise, {
25
21
  // TODO: Deprecate the property here and remove it with the next major release
26
22
  handleIDPLoginCallback
27
- };
23
+ });
28
24
  }
@@ -43,7 +43,8 @@ export function useRpc(method, key, params, options) {
43
43
  );
44
44
  },
45
45
  {
46
- ...isRef(params) ? { watch: [params] } : {},
46
+ // Both refs and getter functions are valid watch sources
47
+ ...isRef(params) || typeof params === "function" ? { watch: [params] } : {},
47
48
  ...options
48
49
  }
49
50
  );
@@ -11,7 +11,10 @@ export declare function useOrder<P = {
11
11
  [k: string]: unknown;
12
12
  }, V = {
13
13
  [k: string]: unknown;
14
- }>({ params, options, key: _key }?: Options, key?: string): Promise<{
14
+ }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, import("nuxt/app").NuxtError<unknown> | null> & {
15
+ fetching: import("vue").Ref<boolean>;
16
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
17
+ } & {
15
18
  data: Ref<Order & {
16
19
  items?: ({
17
20
  id?: number | undefined;
@@ -82,9 +85,79 @@ export declare function useOrder<P = {
82
85
  variant: V;
83
86
  })[] | undefined;
84
87
  }>;
88
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, import("nuxt/app").NuxtError<unknown> | null> & {
85
89
  fetching: import("vue").Ref<boolean>;
86
90
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
87
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
88
- status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
91
+ } & {
92
+ data: Ref<Order & {
93
+ items?: ({
94
+ id?: number | undefined;
95
+ availableQuantity?: number | undefined;
96
+ currency?: string | undefined;
97
+ customData?: {
98
+ [k: string]: unknown;
99
+ } | undefined;
100
+ deliveryForecast?: import("@scayle/storefront-core").DeliveryForecastFromWarehouse | undefined;
101
+ isManuallyReturnedByCci?: boolean | undefined;
102
+ itemGroup?: {
103
+ id: string;
104
+ isMainItem: boolean;
105
+ isRequired: boolean;
106
+ } | null | undefined;
107
+ key: string;
108
+ lowestPriorPrice?: {
109
+ relativeDifferenceToPrice: number;
110
+ withTax: number;
111
+ } | null | undefined;
112
+ merchant?: {
113
+ [k: string]: unknown;
114
+ id: number;
115
+ } | undefined;
116
+ packageId: number;
117
+ price: {
118
+ appliedReductions?: {
119
+ amount: {
120
+ absoluteWithTax: number;
121
+ relative: number;
122
+ };
123
+ category: "voucher" | "sale" | "campaign";
124
+ code?: string | undefined;
125
+ type: "relative" | "absolute";
126
+ }[] | undefined;
127
+ overrideWithoutTax?: number | undefined;
128
+ overrideWithTax?: number | undefined;
129
+ reference?: {
130
+ size?: string | undefined;
131
+ unit?: string | undefined;
132
+ withTax?: number | undefined;
133
+ } | undefined;
134
+ tax: {
135
+ [k: string]: {
136
+ amount: number;
137
+ rate: number;
138
+ };
139
+ };
140
+ undiscountedWithOutTax?: number | undefined;
141
+ undiscountedWithTax?: number | undefined;
142
+ withoutTax: number;
143
+ withTax: number;
144
+ };
145
+ product: {
146
+ [k: string]: unknown;
147
+ };
148
+ reservationKey?: string | undefined;
149
+ status: "available" | "unavailable" | "cancelled" | "delivered" | "returned";
150
+ variant: {
151
+ [k: string]: unknown;
152
+ };
153
+ warehouseId?: import("@scayle/storefront-core").PickingWarehouseId | undefined;
154
+ warehousePackageGroupId?: import("@scayle/storefront-core").WarehousePackageReference | undefined;
155
+ createdAt: string;
156
+ updatedAt: string;
157
+ } & {
158
+ product: P;
159
+ variant: V;
160
+ })[] | undefined;
161
+ }>;
89
162
  }>;
90
163
  export {};
@@ -1,17 +1,14 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useOrder({ params, options, key: _key } = {}, key) {
3
- const { data, fetching, fetch, error, status } = await useRpc(
2
+ import { extendPromise } from "../../utils/promise.mjs";
3
+ export function useOrder({ params, options, key: _key } = {}, key) {
4
+ const promise = useRpc(
4
5
  "getOrderById",
5
6
  _key ?? key ?? "useOrder",
6
7
  params,
7
8
  options
8
9
  );
9
- const _data = data;
10
- return {
11
- data: _data,
12
- fetching,
13
- fetch,
14
- error,
15
- status
16
- };
10
+ const _data = promise.data;
11
+ return extendPromise(promise, {
12
+ data: _data
13
+ });
17
14
  }
@@ -11,7 +11,10 @@ export declare function useOrderConfirmation<P = {
11
11
  [k: string]: unknown;
12
12
  }, V = {
13
13
  [k: string]: unknown;
14
- }>({ params, options, key: _key }?: Options, key?: string): Promise<{
14
+ }>({ params, options, key: _key }?: Options, key?: string): import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, import("nuxt/app").NuxtError<unknown> | null> & {
15
+ fetching: import("vue").Ref<boolean>;
16
+ fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
17
+ } & {
15
18
  data: Ref<Order & {
16
19
  items?: ({
17
20
  id?: number | undefined;
@@ -82,9 +85,79 @@ export declare function useOrderConfirmation<P = {
82
85
  variant: V;
83
86
  })[] | undefined;
84
87
  }>;
88
+ } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order | undefined, import("nuxt/app").NuxtError<unknown> | null> & {
85
89
  fetching: import("vue").Ref<boolean>;
86
90
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions | undefined) => Promise<void>;
87
- error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | null>;
88
- status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
91
+ } & {
92
+ data: Ref<Order & {
93
+ items?: ({
94
+ id?: number | undefined;
95
+ availableQuantity?: number | undefined;
96
+ currency?: string | undefined;
97
+ customData?: {
98
+ [k: string]: unknown;
99
+ } | undefined;
100
+ deliveryForecast?: import("@scayle/storefront-core").DeliveryForecastFromWarehouse | undefined;
101
+ isManuallyReturnedByCci?: boolean | undefined;
102
+ itemGroup?: {
103
+ id: string;
104
+ isMainItem: boolean;
105
+ isRequired: boolean;
106
+ } | null | undefined;
107
+ key: string;
108
+ lowestPriorPrice?: {
109
+ relativeDifferenceToPrice: number;
110
+ withTax: number;
111
+ } | null | undefined;
112
+ merchant?: {
113
+ [k: string]: unknown;
114
+ id: number;
115
+ } | undefined;
116
+ packageId: number;
117
+ price: {
118
+ appliedReductions?: {
119
+ amount: {
120
+ absoluteWithTax: number;
121
+ relative: number;
122
+ };
123
+ category: "voucher" | "sale" | "campaign";
124
+ code?: string | undefined;
125
+ type: "relative" | "absolute";
126
+ }[] | undefined;
127
+ overrideWithoutTax?: number | undefined;
128
+ overrideWithTax?: number | undefined;
129
+ reference?: {
130
+ size?: string | undefined;
131
+ unit?: string | undefined;
132
+ withTax?: number | undefined;
133
+ } | undefined;
134
+ tax: {
135
+ [k: string]: {
136
+ amount: number;
137
+ rate: number;
138
+ };
139
+ };
140
+ undiscountedWithOutTax?: number | undefined;
141
+ undiscountedWithTax?: number | undefined;
142
+ withoutTax: number;
143
+ withTax: number;
144
+ };
145
+ product: {
146
+ [k: string]: unknown;
147
+ };
148
+ reservationKey?: string | undefined;
149
+ status: "available" | "unavailable" | "cancelled" | "delivered" | "returned";
150
+ variant: {
151
+ [k: string]: unknown;
152
+ };
153
+ warehouseId?: import("@scayle/storefront-core").PickingWarehouseId | undefined;
154
+ warehousePackageGroupId?: import("@scayle/storefront-core").WarehousePackageReference | undefined;
155
+ createdAt: string;
156
+ updatedAt: string;
157
+ } & {
158
+ product: P;
159
+ variant: V;
160
+ })[] | undefined;
161
+ }>;
89
162
  }>;
90
163
  export {};
@@ -1,17 +1,14 @@
1
1
  import { useRpc } from "../core/useRpc.mjs";
2
- export async function useOrderConfirmation({ params, options, key: _key } = {}, key) {
3
- const { data, fetching, fetch, error, status } = await useRpc(
2
+ import { extendPromise } from "../../utils/promise.mjs";
3
+ export function useOrderConfirmation({ params, options, key: _key } = {}, key) {
4
+ const promise = useRpc(
4
5
  "getOrderDataByCbd",
5
6
  _key ?? key ?? "useOrderConfirmation",
6
7
  params,
7
8
  options
8
9
  );
9
- const _data = data;
10
- return {
11
- data: _data,
12
- fetching,
13
- fetch,
14
- error,
15
- status
16
- };
10
+ const _data = promise.data;
11
+ return extendPromise(promise, {
12
+ data: _data
13
+ });
17
14
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.75.1",
4
+ "version": "7.76.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -58,11 +58,11 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@nuxt/kit": "3.11.1",
61
- "@opentelemetry/api": "1.8.0",
61
+ "@opentelemetry/api": "1.9.0",
62
62
  "@scayle/h3-session": "0.4.0",
63
63
  "@scayle/storefront-core": "7.55.0",
64
64
  "@scayle/unstorage-compression-driver": "0.1.3",
65
- "@vueuse/core": "10.10.0",
65
+ "@vueuse/core": "10.10.1",
66
66
  "consola": "3.2.3",
67
67
  "core-js": "3.37.1",
68
68
  "defu": "6.1.4",
@@ -74,7 +74,7 @@
74
74
  "ufo": "1.5.3",
75
75
  "uncrypto": "0.1.3",
76
76
  "unstorage": "1.10.2",
77
- "vue-router": "4.3.2",
77
+ "vue-router": "4.3.3",
78
78
  "yn": "5.0.0",
79
79
  "zod": "3.23.8"
80
80
  },
@@ -86,7 +86,7 @@
86
86
  "@scayle/eslint-config-storefront": "4.2.0",
87
87
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
88
88
  "@types/node": "20.14.2",
89
- "dprint": "0.46.1",
89
+ "dprint": "0.46.2",
90
90
  "eslint": "9.4.0",
91
91
  "eslint-formatter-gitlab": "5.1.0",
92
92
  "fishery": "2.2.2",
@@ -96,7 +96,7 @@
96
96
  "nuxt": "3.11.1",
97
97
  "publint": "0.2.8",
98
98
  "vitest": "1.6.0",
99
- "vue-tsc": "2.0.19"
99
+ "vue-tsc": "2.0.21"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "h3": "^1.10.0",