@scayle/storefront-nuxt 8.44.2 → 8.45.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 +89 -2
- package/README.md +2 -2
- package/dist/module.d.mts +11 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +63 -39
- package/dist/runtime/campaignKey.d.ts +1 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.d.ts +1 -1
- package/dist/runtime/composables/core/useSession.d.ts +2 -2
- package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +1 -1
- package/dist/runtime/composables/storefront/useWishlist.d.ts +1 -1
- package/dist/runtime/context.d.ts +4 -3
- package/dist/runtime/context.js +2 -1
- package/dist/runtime/server/middleware/bootstrap-utils.d.ts +5 -4
- package/dist/runtime/server/middleware/bootstrap.js +3 -2
- package/dist/runtime/server/middleware/redirects.d.ts +2 -2
- package/dist/runtime/types/module.d.ts +16 -98
- package/dist/runtime/utils/zodSchema.d.ts +440 -29
- package/dist/runtime/utils/zodSchema.js +69 -18
- package/dist/test/factories.d.mts +20 -3
- package/dist/test/factories.mjs +10 -2
- package/package.json +7 -7
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { HashAlgorithm, ShopUser,
|
|
1
|
+
import type { HashAlgorithm, ShopUser, StorefrontHooks, RpcMethodName, RpcContext } from '@scayle/storefront-core';
|
|
2
2
|
import type { CompressionEncodings } from '@scayle/unstorage-compression-driver';
|
|
3
3
|
import type { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
|
|
4
|
-
import type { CheckoutShopConfigType, SessionType, StorageType, SapiConfigType, ShopConfigType,
|
|
4
|
+
import type { CheckoutShopConfigType, SessionType, StorageType, SapiConfigType, ShopConfigType, StorefrontRuntimeConfigType, StorefrontPublicRuntimeConfigType, IdpType, ModuleOptionType } from '../utils/zodSchema.js';
|
|
5
5
|
import type { HookResult } from '@nuxt/schema';
|
|
6
6
|
export type { LogLevel } from '@scayle/storefront-core';
|
|
7
7
|
/**
|
|
8
8
|
* Represents shop-specific configuration relating to the SCAYLE Checkout.
|
|
9
9
|
*
|
|
10
|
-
* @see https://scayle.dev/en/checkout-guide/authentication-accounts/
|
|
10
|
+
* @see https://scayle.dev/en/core-documentation/checkout-guide/authentication-accounts/authetication/headless/authenticate#creating-api-clients
|
|
11
11
|
*/
|
|
12
12
|
export type CheckoutShopConfig = CheckoutShopConfigType;
|
|
13
13
|
/**
|
|
14
14
|
* Representation of options to configure how the storefront core manages sessions
|
|
15
15
|
*
|
|
16
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
16
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/sessions#session-configuration
|
|
17
17
|
*/
|
|
18
18
|
export type SessionConfig = SessionType;
|
|
19
19
|
/**
|
|
@@ -30,7 +30,7 @@ type CustomDriverName = string & {
|
|
|
30
30
|
* @template Driver The storage driver.
|
|
31
31
|
* @template DriverOptions The driver options.
|
|
32
32
|
*
|
|
33
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
33
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/storage#configuration-of-storage-mounts
|
|
34
34
|
*/
|
|
35
35
|
export type StorageEntity<Driver extends SupportedDriverName | CustomDriverName | unknown = unknown, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : unknown> = {
|
|
36
36
|
driver: Driver;
|
|
@@ -41,7 +41,7 @@ export type StorageEntity<Driver extends SupportedDriverName | CustomDriverName
|
|
|
41
41
|
* Storefront Core utilizes pre-configured and reusable mount points built on top of Unstorage
|
|
42
42
|
* and the Nitro Storage Layer, providing various caching capabilities.
|
|
43
43
|
*
|
|
44
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
44
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/storage
|
|
45
45
|
*/
|
|
46
46
|
export interface StorageConfig {
|
|
47
47
|
/**
|
|
@@ -50,7 +50,7 @@ export interface StorageConfig {
|
|
|
50
50
|
* Should no dedicated `StorageType` / `StorageEntity` be configured,
|
|
51
51
|
* Storefront Core will use an In-Memory driver as default for this storage mountpoints.
|
|
52
52
|
*
|
|
53
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
53
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/storage#configuration-of-storage-mounts
|
|
54
54
|
*/
|
|
55
55
|
cache?: StorageType;
|
|
56
56
|
/**
|
|
@@ -59,7 +59,7 @@ export interface StorageConfig {
|
|
|
59
59
|
* Should no dedicated `StorageType` / `StorageEntity` be configured,
|
|
60
60
|
* Storefront Core will use an In-Memory driver as default for this storage mountpoints.
|
|
61
61
|
*
|
|
62
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
62
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/storage#configuration-of-storage-mounts
|
|
63
63
|
*/
|
|
64
64
|
session?: StorageType;
|
|
65
65
|
}
|
|
@@ -67,14 +67,14 @@ export interface StorageConfig {
|
|
|
67
67
|
* Represents the Storefront API configuration used authenticate with it.
|
|
68
68
|
*
|
|
69
69
|
* @see https://scayle.dev/en/api-guides/storefront-api/getting-started/authentication
|
|
70
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
70
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/configuration#storefront-api
|
|
71
71
|
*/
|
|
72
72
|
export type SapiConfig = SapiConfigType;
|
|
73
73
|
/**
|
|
74
74
|
* Representation of Application-specific keys,
|
|
75
75
|
* defining how keys are generated for baskets and wishlists.
|
|
76
76
|
*
|
|
77
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
77
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/sessions#app-keys-for-baskets-and-wishlists
|
|
78
78
|
*/
|
|
79
79
|
export interface AppKeys {
|
|
80
80
|
/** The wishlist key used as prefix to generate user-specific wishlist identifier. */
|
|
@@ -89,7 +89,7 @@ export interface AppKeys {
|
|
|
89
89
|
* Extending this interface allows to add custom metadata to each shop's settings
|
|
90
90
|
* in a Storefront application.
|
|
91
91
|
*
|
|
92
|
-
* @see https://scayle.dev/en/storefront-guide/
|
|
92
|
+
* @see https://scayle.dev/en/core-documentation/storefront-guide/storefront-application/technical-foundation/configuration#additional-shop-data
|
|
93
93
|
*/
|
|
94
94
|
export interface AdditionalShopConfig {
|
|
95
95
|
}
|
|
@@ -117,97 +117,15 @@ export interface PublicShopConfig extends Pick<ShopConfig, 'shopId' | 'domain' |
|
|
|
117
117
|
/**
|
|
118
118
|
* Storefront configuration.
|
|
119
119
|
*/
|
|
120
|
-
export type StorefrontConfig = StorefrontConfigType & {
|
|
121
|
-
/**
|
|
122
|
-
* Default "with" parameters for Storefront API requests. These are used as defaults
|
|
123
|
-
* within composables like `useWishlist` and can be overridden if needed. Some
|
|
124
|
-
* composables also enforce minimum "with" parameters.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* // Default `with` parameters for product listings.
|
|
128
|
-
* withParams: {
|
|
129
|
-
* items: {
|
|
130
|
-
* product: {
|
|
131
|
-
* attributes: "all",
|
|
132
|
-
* advancedAttributes: "all",
|
|
133
|
-
* variants: {
|
|
134
|
-
* attributes: "all",
|
|
135
|
-
* advancedAttributes: "all",
|
|
136
|
-
* },
|
|
137
|
-
* images: "all",
|
|
138
|
-
* categories: {
|
|
139
|
-
* properties: "all"
|
|
140
|
-
* },
|
|
141
|
-
* priceRange: boolean
|
|
142
|
-
* },
|
|
143
|
-
* variant: {
|
|
144
|
-
* attributes: "all",
|
|
145
|
-
* },
|
|
146
|
-
* },
|
|
147
|
-
* }
|
|
148
|
-
* @see https://scayle.dev/en/storefront-guide/support-and-resources/upgrade-guides/nuxt-3/storefront-core-changes#withparameters
|
|
149
|
-
*/
|
|
150
|
-
withParams?: WithParams;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Nuxt module options.
|
|
154
|
-
*/
|
|
155
|
-
type ModuleOption = {
|
|
156
|
-
/**
|
|
157
|
-
* Shop selector.
|
|
158
|
-
*
|
|
159
|
-
* This determines how the application identifies and switches between different shops.
|
|
160
|
-
* It influences how the `domain` and `path` properties are used within the `shops` configuration.
|
|
161
|
-
*
|
|
162
|
-
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#path-and-domain
|
|
163
|
-
*/
|
|
164
|
-
shopSelector: ShopSelectorType;
|
|
165
|
-
/**
|
|
166
|
-
* Redirects configuration.
|
|
167
|
-
*
|
|
168
|
-
* This controls how the application handles URL redirects by leveraging the Storefront API,
|
|
169
|
-
* which is synchronized with the SCAYLE Panel. When enabled,
|
|
170
|
-
* the Storefront Core intercepts requests and checks for potential
|
|
171
|
-
* redirects via the Storefront API. If a match is found, a 30x HTTP response
|
|
172
|
-
* is returned with the target in the `Location` header and the appropriate
|
|
173
|
-
* status code.
|
|
174
|
-
*
|
|
175
|
-
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/redirects
|
|
176
|
-
*/
|
|
177
|
-
redirects?: RedirectType;
|
|
178
|
-
/**
|
|
179
|
-
* Shops configuration indexed by shop ID.
|
|
180
|
-
*
|
|
181
|
-
* Storefront applications typically support multiple shops for different regions or languages.
|
|
182
|
-
* This configuration specifies the shops to use from your SCAYLE tenant space.
|
|
183
|
-
*
|
|
184
|
-
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#shops
|
|
185
|
-
*/
|
|
186
|
-
shops: ShopConfigIndexed;
|
|
187
|
-
};
|
|
188
120
|
export type SupportedDriverName = BuiltinDriverName | 'scayleKv';
|
|
189
121
|
/**
|
|
190
122
|
* Module base options. Extends `StorefrontConfig` and `ModuleOption`.
|
|
191
123
|
*/
|
|
192
|
-
export type
|
|
193
|
-
/**
|
|
194
|
-
* The RPC directory where the custom application RPCs are defined.
|
|
195
|
-
* The directory should have an `index.ts` file where all RPCs are exported using their name.
|
|
196
|
-
* By default this will be `./rpcMethods`.
|
|
197
|
-
*/
|
|
198
|
-
rpcDir?: string;
|
|
199
|
-
/**
|
|
200
|
-
* The RPC method names which are exported from the `rpcDir`.
|
|
201
|
-
* Usually this can just be `Object.keys(rpcMethodsDir)`.
|
|
202
|
-
*/
|
|
203
|
-
rpcMethodNames?: string[];
|
|
204
|
-
/** Specify explicitly overridden RPC methods that are provided by the Storefront Core package. */
|
|
205
|
-
rpcMethodOverrides?: Array<keyof typeof rpcMethods>;
|
|
206
|
-
};
|
|
124
|
+
export type ModuleOptions = ModuleOptionType;
|
|
207
125
|
/**
|
|
208
126
|
* Checkout event used for tracking with Google Tag Manager.
|
|
209
127
|
*
|
|
210
|
-
* @see https://scayle.dev/en/checkout-guide/
|
|
128
|
+
* @see https://scayle.dev/en/core-documentation/storefront/checkout-guide/implementation/webcomponent#tracking
|
|
211
129
|
*/
|
|
212
130
|
export interface CheckoutEvent {
|
|
213
131
|
/** Action. */
|
|
@@ -228,7 +146,7 @@ export interface CheckoutEvent {
|
|
|
228
146
|
* This field is optional and is only used when tracking specific actions
|
|
229
147
|
* like `add_to_cart` or `remove_from_cart`.
|
|
230
148
|
*
|
|
231
|
-
* @see https://scayle.dev/en/checkout-guide/
|
|
149
|
+
* @see https://scayle.dev/en/core-documentation/storefront/checkout-guide/tracking
|
|
232
150
|
*/
|
|
233
151
|
event?: {
|
|
234
152
|
/** Event name. */
|
|
@@ -237,11 +155,11 @@ export interface CheckoutEvent {
|
|
|
237
155
|
status: 'successful' | 'error';
|
|
238
156
|
};
|
|
239
157
|
}
|
|
240
|
-
export interface ModulePublicRuntimeConfig extends
|
|
158
|
+
export interface ModulePublicRuntimeConfig extends StorefrontPublicRuntimeConfigType {
|
|
241
159
|
}
|
|
242
160
|
declare module '@nuxt/schema' {
|
|
243
161
|
interface RuntimeConfig {
|
|
244
|
-
storefront:
|
|
162
|
+
storefront: StorefrontRuntimeConfigType;
|
|
245
163
|
}
|
|
246
164
|
interface PublicRuntimeConfig {
|
|
247
165
|
storefront: ModulePublicRuntimeConfig;
|