@scayle/storefront-nuxt 7.65.1 → 7.66.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,47 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.66.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Fix variable used before initialization in `useBasket`
|
|
8
|
+
|
|
9
|
+
Breaking: This change removes the `useEventListener` call from `useBasket`. This code was specific to the checkout page and it has been moved to that page in the Storefront Boilerplate (v1.0.0-rc.9). To make the necessary change in your own project, add the following code to `checkout.vue`.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
import type { CheckoutEvent } from '@scayle/storefront-nuxt'
|
|
13
|
+
const { fetching, fetch } = await useBasket()
|
|
14
|
+
|
|
15
|
+
const onCheckoutUpdate = async (
|
|
16
|
+
event: MessageEvent<CheckoutEvent>,
|
|
17
|
+
fetching: Boolean,
|
|
18
|
+
fetchCallback: () => Promise<void>,
|
|
19
|
+
) => {
|
|
20
|
+
if (fetching) {
|
|
21
|
+
return
|
|
22
|
+
} // prevent multiple fetches
|
|
23
|
+
if (event?.data?.type === 'tracking') {
|
|
24
|
+
const actionType = event.data.event?.event
|
|
25
|
+
|
|
26
|
+
if (actionType === 'add_to_cart' || actionType === 'remove_from_cart') {
|
|
27
|
+
await fetchCallback()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Refresh basket if the user changes quantity or removes an item at checkout
|
|
33
|
+
useEventListener(
|
|
34
|
+
'message',
|
|
35
|
+
(event) => onCheckoutUpdate(event, fetching.value, fetch),
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Fixes an issue where the `refreshToken` was not exposed on the `RPCContext` even if the user is logged in.
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @scayle/storefront-core@7.48.2
|
|
44
|
+
|
|
3
45
|
## 7.65.1
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -8,31 +8,15 @@ import {
|
|
|
8
8
|
} from "@scayle/storefront-core";
|
|
9
9
|
import { useNuxtApp, useAsyncData } from "nuxt/app";
|
|
10
10
|
import { computed } from "vue";
|
|
11
|
-
import { useEventListener } from "@vueuse/core";
|
|
12
11
|
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
13
12
|
import { useCurrentShop } from "../core/useCurrentShop.mjs";
|
|
14
13
|
import { toValue, toRef } from "#imports";
|
|
15
|
-
const onCheckoutUpdate = async (event, fetching, fetchCallback) => {
|
|
16
|
-
if (fetching) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (event?.data?.type === "tracking") {
|
|
20
|
-
const actionType = event.data.event?.event;
|
|
21
|
-
if (actionType === "add_to_cart" || actionType === "remove_from_cart") {
|
|
22
|
-
await fetchCallback();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
14
|
export async function useBasket({
|
|
27
15
|
params,
|
|
28
16
|
key = "useBasket"
|
|
29
17
|
} = {}) {
|
|
30
18
|
const nuxtApp = useNuxtApp();
|
|
31
19
|
const shop = useCurrentShop();
|
|
32
|
-
useEventListener(
|
|
33
|
-
"message",
|
|
34
|
-
(event) => onCheckoutUpdate(event, fetching.value, fetch)
|
|
35
|
-
);
|
|
36
20
|
const {
|
|
37
21
|
data,
|
|
38
22
|
pending: fetching,
|
package/dist/runtime/context.mjs
CHANGED
|
@@ -37,6 +37,9 @@ async function sessionProperties(context) {
|
|
|
37
37
|
get accessToken() {
|
|
38
38
|
return session.data?.accessToken ?? void 0;
|
|
39
39
|
},
|
|
40
|
+
get refreshToken() {
|
|
41
|
+
return session.data?.refreshToken ?? void 0;
|
|
42
|
+
},
|
|
40
43
|
destroySession: async () => {
|
|
41
44
|
await session.destroy();
|
|
42
45
|
},
|
|
@@ -63,6 +66,7 @@ async function sessionProperties(context) {
|
|
|
63
66
|
sessionId: void 0,
|
|
64
67
|
user: void 0,
|
|
65
68
|
accessToken: void 0,
|
|
69
|
+
refreshToken: void 0,
|
|
66
70
|
destroySession: void 0,
|
|
67
71
|
createUserBoundSession: void 0,
|
|
68
72
|
updateUser: void 0,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.66.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@nuxt/kit": "3.11.1",
|
|
64
64
|
"@opentelemetry/api": "1.8.0",
|
|
65
65
|
"@scayle/h3-session": "0.3.6",
|
|
66
|
-
"@scayle/storefront-core": "7.48.
|
|
66
|
+
"@scayle/storefront-core": "7.48.2",
|
|
67
67
|
"@scayle/unstorage-compression-driver": "0.1.3",
|
|
68
68
|
"@vueuse/core": "10.9.0",
|
|
69
69
|
"consola": "3.2.3",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"node-mocks-http": "1.14.1",
|
|
94
94
|
"nuxt": "3.11.1",
|
|
95
95
|
"publint": "0.2.7",
|
|
96
|
-
"vitest": "1.
|
|
97
|
-
"vue-tsc": "2.0.
|
|
96
|
+
"vitest": "1.5.0",
|
|
97
|
+
"vue-tsc": "2.0.13"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"h3": "^1.10.0",
|
|
@@ -109,6 +109,6 @@
|
|
|
109
109
|
"@nuxt/schema": "3.11.1"
|
|
110
110
|
},
|
|
111
111
|
"volta": {
|
|
112
|
-
"node": "20.12.
|
|
112
|
+
"node": "20.12.2"
|
|
113
113
|
}
|
|
114
114
|
}
|