@scayle/storefront-nuxt 7.82.0 → 7.82.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,13 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.82.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix types of `useBasket` composable
8
+ - Updated dependencies
9
+ - @scayle/storefront-core@7.61.0
10
+
3
11
  ## 7.82.0
4
12
 
5
13
  ### Minor Changes
@@ -69,27 +77,27 @@
69
77
  Hooks can be registered by adding a nitro plugin inside ´server/plugins/´:
70
78
 
71
79
  ```ts
72
- import { defineNitroPlugin } from "#imports";
80
+ import { defineNitroPlugin } from '#imports'
73
81
 
74
82
  export default defineNitroPlugin((nitroApp) => {
75
- nitroApp.hooks.hook("storefront:rpc:before", (rpcName, rpcContext) => {
76
- rpcContext.log.debug(`Before: ${rpcName}`);
77
- });
83
+ nitroApp.hooks.hook('storefront:rpc:before', (rpcName, rpcContext) => {
84
+ rpcContext.log.debug(`Before: ${rpcName}`)
85
+ })
78
86
 
79
87
  nitroApp.hooks.hook(
80
- "storefront:rpc:after",
88
+ 'storefront:rpc:after',
81
89
  (rpcName, rpcContext, result) => {
82
- rpcContext.log.debug(`After: ${rpcName} returned ${result}`);
83
- }
84
- );
90
+ rpcContext.log.debug(`After: ${rpcName} returned ${result}`)
91
+ },
92
+ )
85
93
 
86
94
  nitroApp.hooks.hook(
87
- "storefront:rpc:error",
95
+ 'storefront:rpc:error',
88
96
  (rpcName, rpcContext, error) => {
89
- rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`);
90
- }
91
- );
92
- });
97
+ rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`)
98
+ },
99
+ )
100
+ })
93
101
  ```
94
102
 
95
103
  Added [`callHook`](https://github.com/unjs/hookable?tab=readme-ov-file#async-callhook-name-args), `callHookParallel` and [`callHookWith`](https://github.com/unjs/hookable?tab=readme-ov-file#callhookwith-name-callerfn) to `RpcContext` to allow triggering hooks within RPCs
@@ -357,20 +365,20 @@
357
365
  - It is now also possible to extend the RPCContext using the `storefront:context:created` nitro runtime hook.
358
366
 
359
367
  ```ts
360
- import { defineNitroPlugin } from "nitropack/runtime/plugin";
368
+ import { defineNitroPlugin } from 'nitropack/runtime/plugin'
361
369
  // Augment RpxContext type
362
- declare module "@scayle/storefront-nuxt" {
370
+ declare module '@scayle/storefront-nuxt' {
363
371
  interface AdditionalRpcContext {
364
- myNewProp: string;
372
+ myNewProp: string
365
373
  }
366
374
  }
367
375
 
368
376
  // Set new value on rpcContext
369
377
  export default defineNitroPlugin((nitroApp) => {
370
- nitroApp.hooks.hook("storefront:context:created", (rpcContext) => {
371
- rpcContext.myNewProp = "My campaign key";
372
- });
373
- });
378
+ nitroApp.hooks.hook('storefront:context:created', (rpcContext) => {
379
+ rpcContext.myNewProp = 'My campaign key'
380
+ })
381
+ })
374
382
  ```
375
383
 
376
384
  ### Patch Changes
@@ -573,8 +581,8 @@
573
581
 
574
582
  ```ts
575
583
  const { data: externalIDPRedirects } = await useIDP({
576
- queryParams: { redirectTo: "/account" },
577
- });
584
+ queryParams: { redirectTo: '/account' },
585
+ })
578
586
  ```
579
587
 
580
588
  Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
@@ -993,16 +1001,16 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
993
1001
  Before:
994
1002
 
995
1003
  ```typescript
996
- toCurrency(100, { currency: "EUR" });
997
- formatPrice(100, { currencyFractionDigits: 2 });
1004
+ toCurrency(100, { currency: 'EUR' })
1005
+ formatPrice(100, { currencyFractionDigits: 2 })
998
1006
  ```
999
1007
 
1000
1008
  After:
1001
1009
 
1002
1010
  ```typescript
1003
- const { formatCurrency } = useFormatHelpers();
1004
- formatCurrency(100, { currency: "EUR" });
1005
- formatCurrency(100, { style: "decimal", currencyFractionDigits: 2 });
1011
+ const { formatCurrency } = useFormatHelpers()
1012
+ formatCurrency(100, { currency: 'EUR' })
1013
+ formatCurrency(100, { style: 'decimal', currencyFractionDigits: 2 })
1006
1014
  ```
1007
1015
 
1008
1016
  ## 7.44.1
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.81.0",
3
+ "version": "7.82.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -65,7 +65,7 @@ export default {
65
65
  }`;
66
66
  }
67
67
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
68
- const PACKAGE_VERSION = "7.81.0";
68
+ const PACKAGE_VERSION = "7.82.1";
69
69
  const logger = createConsola({
70
70
  fancy: true,
71
71
  formatOptions: {
@@ -5,10 +5,7 @@ type UseBasketOptions = Partial<{
5
5
  params: MaybeRefOrGetter<RpcMethodParameters<'getBasket'>>;
6
6
  key: string;
7
7
  }>;
8
- export declare function useBasket({ params, key, }?: UseBasketOptions): import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, any> & {
9
- fetching: import("vue").Ref<boolean>;
10
- fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
11
- } & {
8
+ export declare function useBasket({ params, key, }?: UseBasketOptions): {
12
9
  data: import("vue").Ref<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>>;
13
10
  items: import("vue").ComputedRef<import("@scayle/storefront-api").BasketItem<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>[]>;
14
11
  cost: import("vue").ComputedRef<import("@scayle/storefront-api").BasketTotalPrice>;
@@ -17,7 +14,9 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): import("
17
14
  shippingDates: import("vue").ComputedRef<(string | null)[] | undefined>;
18
15
  isEmpty: import("vue").ComputedRef<boolean>;
19
16
  fetching: import("vue").Ref<boolean>;
17
+ pending: import("vue").Ref<boolean>;
20
18
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
19
+ refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
21
20
  count: import("vue").ComputedRef<number>;
22
21
  countWithoutSoldOutItems: import("vue").ComputedRef<number>;
23
22
  addItem: ({ variantId, promotionId, quantity, existingItemHandling, displayData, customData, itemGroup, }: AddOrUpdateItemType & {
@@ -63,10 +62,7 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): import("
63
62
  } | undefined>;
64
63
  error: import("vue").Ref<any>;
65
64
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
66
- } & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>, any> & {
67
- fetching: import("vue").Ref<boolean>;
68
- fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
69
- } & {
65
+ } & Promise<{
70
66
  data: import("vue").Ref<BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>>;
71
67
  items: import("vue").ComputedRef<import("@scayle/storefront-api").BasketItem<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>[]>;
72
68
  cost: import("vue").ComputedRef<import("@scayle/storefront-api").BasketTotalPrice>;
@@ -75,7 +71,9 @@ export declare function useBasket({ params, key, }?: UseBasketOptions): import("
75
71
  shippingDates: import("vue").ComputedRef<(string | null)[] | undefined>;
76
72
  isEmpty: import("vue").ComputedRef<boolean>;
77
73
  fetching: import("vue").Ref<boolean>;
74
+ pending: import("vue").Ref<boolean>;
78
75
  fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
76
+ refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
79
77
  count: import("vue").ComputedRef<number>;
80
78
  countWithoutSoldOutItems: import("vue").ComputedRef<number>;
81
79
  addItem: ({ variantId, promotionId, quantity, existingItemHandling, displayData, customData, itemGroup, }: AddOrUpdateItemType & {
@@ -30,9 +30,9 @@ export function useBasket({
30
30
  });
31
31
  const {
32
32
  data,
33
- pending: fetching,
33
+ pending,
34
34
  error,
35
- refresh: fetch,
35
+ refresh,
36
36
  status
37
37
  } = asyncData;
38
38
  const addItem = async ({
@@ -159,7 +159,7 @@ export function useBasket({
159
159
  const shippingDates = computed(
160
160
  () => packages.value ? getShippingDates(packages.value) : void 0
161
161
  );
162
- return extendPromise(asyncData, {
162
+ return extendPromise(asyncData.then(() => ({})), {
163
163
  data,
164
164
  items,
165
165
  cost,
@@ -167,8 +167,10 @@ export function useBasket({
167
167
  packages,
168
168
  shippingDates,
169
169
  isEmpty,
170
- fetching,
171
- fetch,
170
+ fetching: pending,
171
+ pending,
172
+ fetch: refresh,
173
+ refresh,
172
174
  count,
173
175
  countWithoutSoldOutItems,
174
176
  addItem,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.82.0",
4
+ "version": "7.82.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "@nuxt/kit": "^3.12.2",
61
61
  "@opentelemetry/api": "^1.9.0",
62
62
  "@scayle/h3-session": "^0.4.0",
63
- "@scayle/storefront-core": "^7.59.1",
63
+ "@scayle/storefront-core": "^7.61.0",
64
64
  "@scayle/unstorage-compression-driver": "^0.1.3",
65
65
  "@vueuse/core": "^10.11.0",
66
66
  "consola": "^3.2.3",
@@ -82,22 +82,22 @@
82
82
  "devDependencies": {
83
83
  "@nuxt/eslint": "0.3.13",
84
84
  "@nuxt/module-builder": "0.5.5",
85
- "@nuxt/schema": "3.12.3",
85
+ "@nuxt/schema": "3.12.4",
86
86
  "@nuxt/test-utils": "3.13.1",
87
87
  "@scayle/eslint-config-storefront": "4.2.0",
88
88
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
89
- "@types/node": "20.14.10",
89
+ "@types/node": "20.14.11",
90
90
  "dprint": "0.47.2",
91
- "eslint": "9.6.0",
91
+ "eslint": "9.7.0",
92
92
  "eslint-formatter-gitlab": "5.1.0",
93
93
  "fishery": "2.2.2",
94
94
  "h3": "1.12.0",
95
95
  "node-mocks-http": "1.15.0",
96
96
  "nuxi": "3.12.0",
97
- "nuxt": "3.12.3",
98
- "publint": "0.2.8",
99
- "vitest": "2.0.2",
100
- "vue-tsc": "2.0.26"
97
+ "nuxt": "3.12.4",
98
+ "publint": "0.2.9",
99
+ "vitest": "2.0.4",
100
+ "vue-tsc": "2.0.28"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "h3": "^1.10.0",
@@ -107,9 +107,9 @@
107
107
  },
108
108
  "resolutions": {
109
109
  "h3": "1.12.0",
110
- "vue": "3.4.31",
111
- "@nuxt/kit": "3.12.3",
112
- "@nuxt/schema": "3.12.3"
110
+ "vue": "3.4.32",
111
+ "@nuxt/kit": "3.12.4",
112
+ "@nuxt/schema": "3.12.4"
113
113
  },
114
114
  "volta": {
115
115
  "node": "20.15.1"