@scayle/storefront-nuxt 7.82.0 → 7.82.2
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 +45 -27
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/module.d.mts +3 -3
- package/dist/module.d.ts +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -5
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/runtime/campaignKey.d.ts +1 -1
- package/dist/runtime/campaignKey.mjs +2 -2
- package/dist/runtime/composables/core/useIDP.d.ts +16 -10
- package/dist/runtime/composables/core/useIDP.mjs +15 -1
- package/dist/runtime/composables/storefront/useBasket.d.ts +6 -8
- package/dist/runtime/composables/storefront/useBasket.mjs +7 -5
- package/dist/runtime/composables/storefront/useCategories.d.ts +24 -18
- package/dist/runtime/composables/storefront/useCategories.mjs +15 -1
- package/dist/runtime/composables/storefront/useOrder.d.ts +12 -8
- package/dist/runtime/composables/storefront/useOrder.mjs +16 -3
- package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +11 -7
- package/dist/runtime/composables/storefront/useOrderConfirmation.mjs +15 -2
- package/dist/runtime/context.d.ts +6 -0
- package/dist/runtime/context.mjs +7 -6
- package/dist/runtime/server/middleware/redirects.mjs +11 -11
- package/dist/runtime/utils/zodSchema.d.ts +863 -731
- package/dist/runtime/utils/zodSchema.mjs +25 -19
- package/dist/shared/{storefront-nuxt.ed010583.d.mts → storefront-nuxt.87331293.d.mts} +78 -26
- package/dist/shared/{storefront-nuxt.ed010583.d.ts → storefront-nuxt.87331293.d.ts} +78 -26
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.82.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix types of `useBasket` composable
|
|
8
|
+
- Fix types for more composables
|
|
9
|
+
- Migrate from using `RpcContext.bapiClient` to using `RpcContext.sapiClient`
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @scayle/storefront-core@7.62.0
|
|
12
|
+
|
|
13
|
+
## 7.82.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Fix types of `useBasket` composable
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @scayle/storefront-core@7.61.0
|
|
20
|
+
|
|
3
21
|
## 7.82.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -69,27 +87,27 @@
|
|
|
69
87
|
Hooks can be registered by adding a nitro plugin inside ´server/plugins/´:
|
|
70
88
|
|
|
71
89
|
```ts
|
|
72
|
-
import { defineNitroPlugin } from
|
|
90
|
+
import { defineNitroPlugin } from '#imports'
|
|
73
91
|
|
|
74
92
|
export default defineNitroPlugin((nitroApp) => {
|
|
75
|
-
nitroApp.hooks.hook(
|
|
76
|
-
rpcContext.log.debug(`Before: ${rpcName}`)
|
|
77
|
-
})
|
|
93
|
+
nitroApp.hooks.hook('storefront:rpc:before', (rpcName, rpcContext) => {
|
|
94
|
+
rpcContext.log.debug(`Before: ${rpcName}`)
|
|
95
|
+
})
|
|
78
96
|
|
|
79
97
|
nitroApp.hooks.hook(
|
|
80
|
-
|
|
98
|
+
'storefront:rpc:after',
|
|
81
99
|
(rpcName, rpcContext, result) => {
|
|
82
|
-
rpcContext.log.debug(`After: ${rpcName} returned ${result}`)
|
|
83
|
-
}
|
|
84
|
-
)
|
|
100
|
+
rpcContext.log.debug(`After: ${rpcName} returned ${result}`)
|
|
101
|
+
},
|
|
102
|
+
)
|
|
85
103
|
|
|
86
104
|
nitroApp.hooks.hook(
|
|
87
|
-
|
|
105
|
+
'storefront:rpc:error',
|
|
88
106
|
(rpcName, rpcContext, error) => {
|
|
89
|
-
rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`)
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
})
|
|
107
|
+
rpcContext.log.error(`ERROR: ${rpcName} did throw ${error}`)
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
})
|
|
93
111
|
```
|
|
94
112
|
|
|
95
113
|
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 +375,20 @@
|
|
|
357
375
|
- It is now also possible to extend the RPCContext using the `storefront:context:created` nitro runtime hook.
|
|
358
376
|
|
|
359
377
|
```ts
|
|
360
|
-
import { defineNitroPlugin } from
|
|
378
|
+
import { defineNitroPlugin } from 'nitropack/runtime/plugin'
|
|
361
379
|
// Augment RpxContext type
|
|
362
|
-
declare module
|
|
380
|
+
declare module '@scayle/storefront-nuxt' {
|
|
363
381
|
interface AdditionalRpcContext {
|
|
364
|
-
myNewProp: string
|
|
382
|
+
myNewProp: string
|
|
365
383
|
}
|
|
366
384
|
}
|
|
367
385
|
|
|
368
386
|
// Set new value on rpcContext
|
|
369
387
|
export default defineNitroPlugin((nitroApp) => {
|
|
370
|
-
nitroApp.hooks.hook(
|
|
371
|
-
rpcContext.myNewProp =
|
|
372
|
-
})
|
|
373
|
-
})
|
|
388
|
+
nitroApp.hooks.hook('storefront:context:created', (rpcContext) => {
|
|
389
|
+
rpcContext.myNewProp = 'My campaign key'
|
|
390
|
+
})
|
|
391
|
+
})
|
|
374
392
|
```
|
|
375
393
|
|
|
376
394
|
### Patch Changes
|
|
@@ -573,8 +591,8 @@
|
|
|
573
591
|
|
|
574
592
|
```ts
|
|
575
593
|
const { data: externalIDPRedirects } = await useIDP({
|
|
576
|
-
queryParams: { redirectTo:
|
|
577
|
-
})
|
|
594
|
+
queryParams: { redirectTo: '/account' },
|
|
595
|
+
})
|
|
578
596
|
```
|
|
579
597
|
|
|
580
598
|
Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
|
|
@@ -993,16 +1011,16 @@ There is an `unwrap` function exported by this package (>=7.55.0) that can be us
|
|
|
993
1011
|
Before:
|
|
994
1012
|
|
|
995
1013
|
```typescript
|
|
996
|
-
toCurrency(100, { currency:
|
|
997
|
-
formatPrice(100, { currencyFractionDigits: 2 })
|
|
1014
|
+
toCurrency(100, { currency: 'EUR' })
|
|
1015
|
+
formatPrice(100, { currencyFractionDigits: 2 })
|
|
998
1016
|
```
|
|
999
1017
|
|
|
1000
1018
|
After:
|
|
1001
1019
|
|
|
1002
1020
|
```typescript
|
|
1003
|
-
const { formatCurrency } = useFormatHelpers()
|
|
1004
|
-
formatCurrency(100, { currency:
|
|
1005
|
-
formatCurrency(100, { style:
|
|
1021
|
+
const { formatCurrency } = useFormatHelpers()
|
|
1022
|
+
formatCurrency(100, { currency: 'EUR' })
|
|
1023
|
+
formatCurrency(100, { style: 'decimal', currencyFractionDigits: 2 })
|
|
1006
1024
|
```
|
|
1007
1025
|
|
|
1008
1026
|
## 7.44.1
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.87331293.mjs';
|
|
2
2
|
export { rpcCall } from './rpc.mjs';
|
|
3
3
|
export * from '@scayle/storefront-core';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.87331293.js';
|
|
2
2
|
export { rpcCall } from './rpc.js';
|
|
3
3
|
export * from '@scayle/storefront-core';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
package/dist/module.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export {
|
|
2
|
+
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.87331293.mjs';
|
|
3
|
+
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.87331293.mjs';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleBaseOptions
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<Omit<ModuleBaseOptions, "sapi" | "bapi">>;
|
|
10
10
|
|
|
11
11
|
export { ModuleBaseOptions, _default as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export {
|
|
2
|
+
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.87331293.js';
|
|
3
|
+
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.87331293.js';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleBaseOptions
|
|
9
|
+
declare const _default: _nuxt_schema.NuxtModule<Omit<ModuleBaseOptions, "sapi" | "bapi">>;
|
|
10
10
|
|
|
11
11
|
export { ModuleBaseOptions, _default as default };
|
package/dist/module.json
CHANGED
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.
|
|
68
|
+
const PACKAGE_VERSION = "7.82.2";
|
|
69
69
|
const logger = createConsola({
|
|
70
70
|
fancy: true,
|
|
71
71
|
formatOptions: {
|
|
@@ -98,10 +98,6 @@ const module = defineNuxtModule({
|
|
|
98
98
|
// if we set maxAge explicitly to undefined `useRuntimeConfig` will set it default to '' which leads to no sessions not being saved
|
|
99
99
|
// maxAge: undefined,
|
|
100
100
|
},
|
|
101
|
-
bapi: {
|
|
102
|
-
host: "",
|
|
103
|
-
token: ""
|
|
104
|
-
},
|
|
105
101
|
shopSelector: "domain",
|
|
106
102
|
stores: {},
|
|
107
103
|
oauth: {
|
package/dist/rpc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
|
|
2
2
|
import { NuxtApp } from 'nuxt/app';
|
|
3
|
-
import { P as PublicShopConfig } from './shared/storefront-nuxt.
|
|
3
|
+
import { P as PublicShopConfig } from './shared/storefront-nuxt.87331293.mjs';
|
|
4
4
|
import '@scayle/unstorage-compression-driver';
|
|
5
5
|
import 'unstorage';
|
|
6
6
|
import 'zod';
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
|
|
2
2
|
import { NuxtApp } from 'nuxt/app';
|
|
3
|
-
import { P as PublicShopConfig } from './shared/storefront-nuxt.
|
|
3
|
+
import { P as PublicShopConfig } from './shared/storefront-nuxt.87331293.js';
|
|
4
4
|
import '@scayle/unstorage-compression-driver';
|
|
5
5
|
import 'unstorage';
|
|
6
6
|
import 'zod';
|
|
@@ -3,4 +3,4 @@ export declare const isCampaignActive: (campaign?: Campaign) => boolean;
|
|
|
3
3
|
export declare const campaignHasNotEnded: (campaign: Campaign) => boolean;
|
|
4
4
|
export declare const campaignKeyMatchesKeyword: (campaign: Campaign, keyword?: string) => boolean;
|
|
5
5
|
export declare const sortCampaignsByDateAscending: (a: Campaign, b: Campaign) => number;
|
|
6
|
-
export declare const fetchCampaignKey: (
|
|
6
|
+
export declare const fetchCampaignKey: (sapiClient: StorefrontAPIClient, cached: CachedType, storeCampaignKeyword: string | undefined, log: Log) => Promise<string | undefined>;
|
|
@@ -21,10 +21,10 @@ export const campaignKeyMatchesKeyword = (campaign, keyword) => {
|
|
|
21
21
|
export const sortCampaignsByDateAscending = (a, b) => {
|
|
22
22
|
return new Date(a.start_at).getTime() - new Date(b.start_at).getTime();
|
|
23
23
|
};
|
|
24
|
-
export const fetchCampaignKey = async (
|
|
24
|
+
export const fetchCampaignKey = async (sapiClient, cached, storeCampaignKeyword, log) => {
|
|
25
25
|
try {
|
|
26
26
|
const { campaigns } = await cached(async () => {
|
|
27
|
-
const { entities } = await
|
|
27
|
+
const { entities } = await sapiClient.campaigns.get();
|
|
28
28
|
return {
|
|
29
29
|
campaigns: entities.filter((campaign) => {
|
|
30
30
|
return campaignHasNotEnded(campaign) && campaignKeyMatchesKeyword(campaign, storeCampaignKeyword);
|
|
@@ -1,22 +1,28 @@
|
|
|
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):
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare function useIDP(params?: MaybeRefOrGetter<RpcMethodParameters<'getExternalIdpRedirect'>>, key?: string): {
|
|
4
|
+
data: import("vue").Ref<{
|
|
5
|
+
[k: string]: string;
|
|
6
|
+
}>;
|
|
7
7
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
8
|
-
|
|
8
|
+
fetching: import("vue").Ref<boolean>;
|
|
9
|
+
error: import("vue").Ref<any>;
|
|
10
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
11
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
9
12
|
handleIDPLoginCallback: (params: string | {
|
|
10
13
|
code: string;
|
|
11
14
|
}) => Promise<{
|
|
12
15
|
message: string;
|
|
13
16
|
}>;
|
|
14
|
-
} & Promise<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
} & Promise<{
|
|
18
|
+
data: import("vue").Ref<{
|
|
19
|
+
[k: string]: string;
|
|
20
|
+
}>;
|
|
18
21
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
19
|
-
|
|
22
|
+
fetching: import("vue").Ref<boolean>;
|
|
23
|
+
error: import("vue").Ref<any>;
|
|
24
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
25
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
20
26
|
handleIDPLoginCallback: (params: string | {
|
|
21
27
|
code: string;
|
|
22
28
|
}) => Promise<{
|
|
@@ -12,12 +12,26 @@ export function useIDP(params = {}, key) {
|
|
|
12
12
|
key ?? "useIDP",
|
|
13
13
|
params
|
|
14
14
|
);
|
|
15
|
+
const {
|
|
16
|
+
data,
|
|
17
|
+
fetch,
|
|
18
|
+
fetching,
|
|
19
|
+
error,
|
|
20
|
+
refresh,
|
|
21
|
+
status
|
|
22
|
+
} = useRpcPromise;
|
|
15
23
|
const handleIDPLoginCallback = rpcCall(
|
|
16
24
|
nuxtApp,
|
|
17
25
|
"handleIDPLoginCallback",
|
|
18
26
|
toValue(shop)
|
|
19
27
|
);
|
|
20
|
-
return extendPromise(useRpcPromise, {
|
|
28
|
+
return extendPromise(useRpcPromise.then(() => ({})), {
|
|
29
|
+
data,
|
|
30
|
+
fetch,
|
|
31
|
+
fetching,
|
|
32
|
+
error,
|
|
33
|
+
refresh,
|
|
34
|
+
status,
|
|
21
35
|
// TODO: Deprecate the property here and remove it with the next major release
|
|
22
36
|
handleIDPLoginCallback
|
|
23
37
|
});
|
|
@@ -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):
|
|
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<
|
|
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
|
|
33
|
+
pending,
|
|
34
34
|
error,
|
|
35
|
-
refresh
|
|
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
|
-
|
|
170
|
+
fetching: pending,
|
|
171
|
+
pending,
|
|
172
|
+
fetch: refresh,
|
|
173
|
+
refresh,
|
|
172
174
|
count,
|
|
173
175
|
countWithoutSoldOutItems,
|
|
174
176
|
addItem,
|
|
@@ -7,27 +7,33 @@ type Options = Partial<{
|
|
|
7
7
|
/** @deprecated use the second argument of the composable to define the key */
|
|
8
8
|
key: string;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function useCategories({ params, options, key: _key, }?: Options, key?: string):
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export declare function useCategories({ params, options, key: _key, }?: Options, key?: string): {
|
|
11
|
+
data: import("vue").Ref<{
|
|
12
|
+
categories: import("@scayle/storefront-api").Category[];
|
|
13
|
+
activeNode: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
categories: import("@scayle/storefront-api").Category;
|
|
16
|
+
activeNode: import("@scayle/storefront-api").Category;
|
|
17
|
+
}>;
|
|
18
|
+
error: import("vue").Ref<any>;
|
|
19
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
18
20
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
19
|
-
} & {
|
|
20
|
-
getCategoryById: (id: number, includeHidden?: true) => Promise<import("@scayle/storefront-api").Category>;
|
|
21
|
-
} & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<{
|
|
22
|
-
categories: import("@scayle/storefront-api").Category[];
|
|
23
|
-
activeNode: undefined;
|
|
24
|
-
} | {
|
|
25
|
-
categories: import("@scayle/storefront-api").Category;
|
|
26
|
-
activeNode: import("@scayle/storefront-api").Category;
|
|
27
|
-
}, any> & {
|
|
28
21
|
fetching: import("vue").Ref<boolean>;
|
|
22
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
23
|
+
getCategoryById: (id: number, includeHidden?: true) => Promise<import("@scayle/storefront-api").Category>;
|
|
24
|
+
} & Promise<{
|
|
25
|
+
data: import("vue").Ref<{
|
|
26
|
+
categories: import("@scayle/storefront-api").Category[];
|
|
27
|
+
activeNode: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
categories: import("@scayle/storefront-api").Category;
|
|
30
|
+
activeNode: import("@scayle/storefront-api").Category;
|
|
31
|
+
}>;
|
|
32
|
+
error: import("vue").Ref<any>;
|
|
33
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
29
34
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
30
|
-
|
|
35
|
+
fetching: import("vue").Ref<boolean>;
|
|
36
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
31
37
|
getCategoryById: (id: number, includeHidden?: true) => Promise<import("@scayle/storefront-api").Category>;
|
|
32
38
|
}>;
|
|
33
39
|
export {};
|
|
@@ -21,7 +21,21 @@ export function useCategories({
|
|
|
21
21
|
"getCategoryById",
|
|
22
22
|
currentShop.value ?? void 0
|
|
23
23
|
);
|
|
24
|
-
|
|
24
|
+
const {
|
|
25
|
+
data,
|
|
26
|
+
error,
|
|
27
|
+
status,
|
|
28
|
+
fetch,
|
|
29
|
+
fetching,
|
|
30
|
+
refresh
|
|
31
|
+
} = useRpcPromise;
|
|
32
|
+
return extendPromise(useRpcPromise.then(() => ({})), {
|
|
33
|
+
data,
|
|
34
|
+
error,
|
|
35
|
+
status,
|
|
36
|
+
fetch,
|
|
37
|
+
fetching,
|
|
38
|
+
refresh,
|
|
25
39
|
getCategoryById: (id, includeHidden) => getCategoryById({ id, includeHidden })
|
|
26
40
|
});
|
|
27
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
|
|
2
2
|
import type { RpcOptions } from '../core/useRpc';
|
|
3
|
-
import type { MaybeRefOrGetter } from '
|
|
3
|
+
import type { Ref, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
type Options = Partial<{
|
|
5
5
|
params: MaybeRefOrGetter<RpcMethodParameters<'getOrderById'>>;
|
|
6
6
|
options: RpcOptions;
|
|
@@ -11,10 +11,7 @@ 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):
|
|
15
|
-
fetching: import("vue").Ref<boolean>;
|
|
16
|
-
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
17
|
-
} & {
|
|
14
|
+
}>({ params, options, key: _key }?: Options, key?: string): {
|
|
18
15
|
data: Ref<Order & {
|
|
19
16
|
items?: ({
|
|
20
17
|
id?: import("@scayle/storefront-core").UniqueNumericIdentifierOfTheItem;
|
|
@@ -85,10 +82,12 @@ export declare function useOrder<P = {
|
|
|
85
82
|
variant: V;
|
|
86
83
|
})[];
|
|
87
84
|
}>;
|
|
88
|
-
} & Promise<import("nuxt/dist/app/composables/asyncData")._AsyncData<Order, any> & {
|
|
89
|
-
fetching: import("vue").Ref<boolean>;
|
|
90
85
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
91
|
-
|
|
86
|
+
fetching: Ref<boolean>;
|
|
87
|
+
error: Ref<any>;
|
|
88
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
89
|
+
status: Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
90
|
+
} & Promise<{
|
|
92
91
|
data: Ref<Order & {
|
|
93
92
|
items?: ({
|
|
94
93
|
id?: import("@scayle/storefront-core").UniqueNumericIdentifierOfTheItem;
|
|
@@ -159,5 +158,10 @@ export declare function useOrder<P = {
|
|
|
159
158
|
variant: V;
|
|
160
159
|
})[];
|
|
161
160
|
}>;
|
|
161
|
+
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
162
|
+
fetching: Ref<boolean>;
|
|
163
|
+
error: Ref<any>;
|
|
164
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
165
|
+
status: Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
162
166
|
}>;
|
|
163
167
|
export {};
|
|
@@ -7,8 +7,21 @@ export function useOrder({ params, options, key: _key } = {}, key) {
|
|
|
7
7
|
params,
|
|
8
8
|
options
|
|
9
9
|
);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
13
26
|
});
|
|
14
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
|
|
2
2
|
import type { RpcOptions } from '../core/useRpc';
|
|
3
|
-
import type { MaybeRefOrGetter } from '
|
|
3
|
+
import type { Ref, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
type Options = Partial<{
|
|
5
5
|
params: MaybeRefOrGetter<RpcMethodParameters<'getOrderDataByCbd'>>;
|
|
6
6
|
options: RpcOptions;
|
|
@@ -11,10 +11,12 @@ 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):
|
|
15
|
-
fetching: import("vue").Ref<boolean>;
|
|
14
|
+
}>({ params, options, key: _key }?: Options, key?: string): {
|
|
16
15
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
17
|
-
|
|
16
|
+
fetching: Ref<boolean>;
|
|
17
|
+
error: Ref<any>;
|
|
18
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
19
|
+
status: Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
18
20
|
data: Ref<Order & {
|
|
19
21
|
items?: ({
|
|
20
22
|
id?: import("@scayle/storefront-core").UniqueNumericIdentifierOfTheItem;
|
|
@@ -85,10 +87,12 @@ export declare function useOrderConfirmation<P = {
|
|
|
85
87
|
variant: V;
|
|
86
88
|
})[];
|
|
87
89
|
}>;
|
|
88
|
-
} & Promise<
|
|
89
|
-
fetching: import("vue").Ref<boolean>;
|
|
90
|
+
} & Promise<{
|
|
90
91
|
fetch: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
91
|
-
|
|
92
|
+
fetching: Ref<boolean>;
|
|
93
|
+
error: Ref<any>;
|
|
94
|
+
refresh: (opts?: import("nuxt/dist/app/composables/asyncData").AsyncDataExecuteOptions) => Promise<void>;
|
|
95
|
+
status: Ref<import("nuxt/app").AsyncDataRequestStatus>;
|
|
92
96
|
data: Ref<Order & {
|
|
93
97
|
items?: ({
|
|
94
98
|
id?: import("@scayle/storefront-core").UniqueNumericIdentifierOfTheItem;
|
|
@@ -7,8 +7,21 @@ export function useOrderConfirmation({ params, options, key: _key } = {}, key) {
|
|
|
7
7
|
params,
|
|
8
8
|
options
|
|
9
9
|
);
|
|
10
|
-
const
|
|
11
|
-
|
|
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,
|
|
12
25
|
data: _data
|
|
13
26
|
});
|
|
14
27
|
}
|
|
@@ -2,6 +2,7 @@ import type { Session } from '@scayle/h3-session';
|
|
|
2
2
|
import type { RuntimeConfig } from '@nuxt/schema';
|
|
3
3
|
import { type H3Event } from 'h3';
|
|
4
4
|
import type { Log, RpcContext, Cache as CacheInterface } from '@scayle/storefront-core';
|
|
5
|
+
import { StorefrontAPIClient } from '@scayle/storefront-core';
|
|
5
6
|
import type { ShopConfig, StorefrontConfig } from '../module';
|
|
6
7
|
export interface ContextBuilderOptions {
|
|
7
8
|
$cache: CacheInterface;
|
|
@@ -14,3 +15,8 @@ export interface ContextBuilderOptions {
|
|
|
14
15
|
event: H3Event;
|
|
15
16
|
}
|
|
16
17
|
export declare const buildContext: (context: ContextBuilderOptions) => Promise<RpcContext>;
|
|
18
|
+
declare module '@scayle/storefront-core' {
|
|
19
|
+
interface AdditionalRpcContext {
|
|
20
|
+
sapiClient: StorefrontAPIClient;
|
|
21
|
+
}
|
|
22
|
+
}
|