@scayle/storefront-nuxt 8.10.1 → 8.10.3

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/module.d.mts +32 -2
  5. package/dist/module.d.ts +32 -2
  6. package/dist/module.json +1 -1
  7. package/dist/module.mjs +6 -1
  8. package/dist/runtime/campaignKey.d.ts +1 -4
  9. package/dist/runtime/campaignKey.js +5 -17
  10. package/dist/runtime/context.js +1 -1
  11. package/dist/runtime/error/handler.d.ts +7 -0
  12. package/dist/runtime/nitro/plugins/cacheRuntimeConfig.d.ts +12 -0
  13. package/dist/runtime/nitro/plugins/configValidation.d.ts +39 -0
  14. package/dist/runtime/nitro/plugins/nitroLogger.d.ts +8 -0
  15. package/dist/runtime/nitro/plugins/nitroRuntimeStorageConfig.d.ts +10 -0
  16. package/dist/runtime/nitro/plugins/nitroSetXPoweredByHeader.d.ts +7 -0
  17. package/dist/runtime/plugin/log.client.d.ts +12 -0
  18. package/dist/runtime/plugin/log.server.d.ts +12 -0
  19. package/dist/runtime/plugin/shop.d.ts +15 -0
  20. package/dist/runtime/server/middleware/bootstrap-utils.d.ts +62 -0
  21. package/dist/runtime/server/middleware/bootstrap.d.ts +33 -0
  22. package/dist/runtime/server/middleware/redirects.d.ts +13 -0
  23. package/dist/runtime/server/middleware/redirects.utils.d.ts +19 -9
  24. package/dist/runtime/server/utils/cacheStorage.d.ts +14 -8
  25. package/dist/runtime/utils/seo.d.ts +11 -0
  26. package/dist/shared/storefront-nuxt.b72fefd0.d.mts +267 -0
  27. package/dist/shared/storefront-nuxt.b72fefd0.d.ts +267 -0
  28. package/dist/test/factories.d.mts +1 -1
  29. package/dist/test/factories.d.ts +1 -1
  30. package/package.json +4 -4
  31. package/dist/shared/storefront-nuxt.a816664e.d.mts +0 -81
  32. package/dist/shared/storefront-nuxt.a816664e.d.ts +0 -81
@@ -0,0 +1,267 @@
1
+ import { StorefrontHooks, RpcContext, RpcMethodName, HashAlgorithm, WithParams, rpcMethods, ShopUser } from '@scayle/storefront-core';
2
+ import { CompressionEncodings } from '@scayle/unstorage-compression-driver';
3
+ import { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
4
+ import { CheckoutShopConfigType, SessionType, StorageType, SapiConfigType, ShopConfigType, IdpType, StorefrontConfigType, ModulePublicRuntimeConfigType, ShopSelectorType, RedirectType } from '../../dist/runtime/utils/zodSchema.js';
5
+ import { HookResult } from '@nuxt/schema';
6
+
7
+ /**
8
+ * Represents shop-specific configuration relating to the SCAYLE Checkout.
9
+ *
10
+ * @see https://scayle.dev/en/checkout-guide/authentication-accounts/general#create-api-client
11
+ */
12
+ type CheckoutShopConfig = CheckoutShopConfigType;
13
+ /**
14
+ * Representation of options to configure how the storefront core manages sessions
15
+ *
16
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/sessions#configuration
17
+ */
18
+ type SessionConfig = SessionType;
19
+ /**
20
+ * Representation of a custom [Unstorage](https://unstorage.unjs.io/) driver name.
21
+ *
22
+ * @see https://unstorage.unjs.io/guide/custom-driver
23
+ */
24
+ type CustomDriverName = string & {
25
+ _custom?: unknown;
26
+ };
27
+ /**
28
+ * Representation of an [Unstorage](https://unstorage.unjs.io/) storage entity.
29
+ *
30
+ * @template Driver The storage driver.
31
+ * @template DriverOptions The driver options.
32
+ *
33
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
34
+ */
35
+ type StorageEntity<Driver extends BuiltinDriverName | CustomDriverName | unknown = unknown, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : unknown> = {
36
+ driver: Driver;
37
+ compression?: CompressionEncodings;
38
+ } & DriverOptions;
39
+ /**
40
+ * Represents the storage configuration for [Unstorage](https://unstorage.unjs.io/), leveraging the Nitro caching system.
41
+ * Storefront Core utilizes pre-configured and reusable mount points built on top of Unstorage
42
+ * and the Nitro Storage Layer, providing various caching capabilities.
43
+ *
44
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#storage
45
+ */
46
+ interface StorageConfig {
47
+ /**
48
+ * The cache storage configuration.
49
+ *
50
+ * Should no dedicated `StorageType` / `StorageEntity` be configured,
51
+ * Storefront Core will use an In-Memory driver as default for this storage mountpoints.
52
+ *
53
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
54
+ */
55
+ cache?: StorageType;
56
+ /**
57
+ * The session storage configuration.
58
+ *
59
+ * Should no dedicated `StorageType` / `StorageEntity` be configured,
60
+ * Storefront Core will use an In-Memory driver as default for this storage mountpoints.
61
+ *
62
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
63
+ */
64
+ session?: StorageType;
65
+ }
66
+ /**
67
+ * Represents the Storefront API configuration used authenticate with it.
68
+ *
69
+ * @see https://scayle.dev/en/api-guides/storefront-api/getting-started/authentication
70
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#storefront-api
71
+ */
72
+ type SapiConfig = SapiConfigType;
73
+ /**
74
+ * Representation of Application-specific keys,
75
+ * defining how keys are generated for baskets and wishlists.
76
+ *
77
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/authentication#app-keys-for-baskets-and-wishlists
78
+ */
79
+ interface AppKeys {
80
+ /** The wishlist key used as prefix to generate user-specific wishlist identifier. */
81
+ wishlistKey: string;
82
+ /** The basket key used as prefix to generate user-specific basket identifier. */
83
+ basketKey: string;
84
+ /** The hash algorithm used to generate user-specific basket and wishlist identifier. */
85
+ hashAlgorithm: HashAlgorithm;
86
+ }
87
+ /**
88
+ * Provides a structure for additional shop configuration.
89
+ * Extending this interface allows to add custom metadata to each shop's settings
90
+ * in a Storefront application.
91
+ *
92
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#additional-shop-data
93
+ */
94
+ interface AdditionalShopConfig {
95
+ }
96
+ /**
97
+ * Shop configuration.
98
+ */
99
+ type ShopConfig = ShopConfigType & AdditionalShopConfig;
100
+ /**
101
+ * Shop configuration indexed by shop ID.
102
+ */
103
+ type ShopConfigIndexed = Record<string, ShopConfig>;
104
+ /**
105
+ * Public shop configuration. This configuration is accessible on the client-side.
106
+ */
107
+ interface PublicShopConfig extends Pick<ShopConfig, 'shopId' | 'domain' | 'locale' | 'currency' | 'currencyFractionDigits'> {
108
+ /** Checkout configuration. */
109
+ checkout: Pick<CheckoutShopConfig, 'host'>;
110
+ /** API base path. */
111
+ apiBasePath: string;
112
+ /** IDP configuration. */
113
+ idp?: IdpType;
114
+ /** Path. */
115
+ path?: string;
116
+ }
117
+ /**
118
+ * Storefront configuration.
119
+ */
120
+ 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
+ /**
189
+ * Module base options. Extends `StorefrontConfig` and `ModuleOption`.
190
+ */
191
+ type ModuleBaseOptions = StorefrontConfig & ModuleOption & {
192
+ /**
193
+ * The RPC directory where the custom application RPCs are defined.
194
+ * The directory should have an `index.ts` file where all RPCs are exported using their name.
195
+ * By default this will be `./rpcMethods`.
196
+ */
197
+ rpcDir?: string;
198
+ /**
199
+ * The RPC method names which are exported from the `rpcDir`.
200
+ * Usually this can just be `Object.keys(rpcMethodsDir)`.
201
+ */
202
+ rpcMethodNames?: string[];
203
+ /** Specify explicitly overridden RPC methods that are provided by the Storefront Core package. */
204
+ rpcMethodOverrides?: Array<keyof typeof rpcMethods>;
205
+ };
206
+ /**
207
+ * Checkout event used for tracking with Google Tag Manager.
208
+ *
209
+ * @see https://scayle.dev/en/checkout-guide/integration/webcomponent#tracking
210
+ */
211
+ interface CheckoutEvent {
212
+ /** Action. */
213
+ action?: 'authenticated';
214
+ /** Type. */
215
+ type?: 'tracking';
216
+ /** User. */
217
+ user: ShopUser;
218
+ /**
219
+ * The OAuth 2.0 access token for the authenticated user.
220
+ * This token can be used to access protected resources on behalf of the user.
221
+ *
222
+ * @see https://www.rfc-editor.org/rfc/rfc6749
223
+ */
224
+ accessToken: string;
225
+ /**
226
+ * Details about a specific event within the checkout process.
227
+ * This field is optional and is only used when tracking specific actions
228
+ * like `add_to_cart` or `remove_from_cart`.
229
+ *
230
+ * @see https://scayle.dev/en/checkout-guide/integration/tracking#application-integration
231
+ */
232
+ event?: {
233
+ /** Event name. */
234
+ event: 'login' | 'add_to_cart' | 'remove_from_cart';
235
+ /** Event status. */
236
+ status: 'successful' | 'error';
237
+ };
238
+ }
239
+ interface ModulePublicRuntimeConfig extends ModulePublicRuntimeConfigType {
240
+ }
241
+ declare module '@nuxt/schema' {
242
+ interface RuntimeConfig {
243
+ storefront: ModuleBaseOptions;
244
+ }
245
+ interface PublicRuntimeConfig {
246
+ storefront: ModulePublicRuntimeConfig;
247
+ }
248
+ }
249
+ declare module 'nitropack' {
250
+ /**
251
+ * Nitro runtime hooks.
252
+ *
253
+ * @see https://nitro.build/guide/plugins#nitro-runtime-hooks
254
+ */
255
+ interface NitroRuntimeHooks extends StorefrontHooks {
256
+ /** Storefront hook called after the RPC context created . */
257
+ 'storefront:context:created': (context: RpcContext) => HookResult;
258
+ /** Storefront hook called before the RPC method is executed. */
259
+ 'storefront:rpc:before': (rpcName: RpcMethodName, context: RpcContext, payload: unknown) => HookResult;
260
+ /** Storefront hook called after the RPC method is executed. */
261
+ 'storefront:rpc:after': (rpcName: RpcMethodName, context: RpcContext, result: unknown) => HookResult;
262
+ /** Storefront hook called if an error occurs during RPC method execution. */
263
+ 'storefront:rpc:error': (rpcName: RpcMethodName, context: RpcContext, error: unknown) => HookResult;
264
+ }
265
+ }
266
+
267
+ export type { AppKeys as A, CheckoutShopConfig as C, ModuleBaseOptions as M, PublicShopConfig as P, SessionConfig as S, StorageEntity as a, StorageConfig as b, SapiConfig as c, AdditionalShopConfig as d, ShopConfig as e, ShopConfigIndexed as f, StorefrontConfig as g, CheckoutEvent as h, ModulePublicRuntimeConfig as i };
@@ -0,0 +1,267 @@
1
+ import { StorefrontHooks, RpcContext, RpcMethodName, HashAlgorithm, WithParams, rpcMethods, ShopUser } from '@scayle/storefront-core';
2
+ import { CompressionEncodings } from '@scayle/unstorage-compression-driver';
3
+ import { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
4
+ import { CheckoutShopConfigType, SessionType, StorageType, SapiConfigType, ShopConfigType, IdpType, StorefrontConfigType, ModulePublicRuntimeConfigType, ShopSelectorType, RedirectType } from '../../dist/runtime/utils/zodSchema.js';
5
+ import { HookResult } from '@nuxt/schema';
6
+
7
+ /**
8
+ * Represents shop-specific configuration relating to the SCAYLE Checkout.
9
+ *
10
+ * @see https://scayle.dev/en/checkout-guide/authentication-accounts/general#create-api-client
11
+ */
12
+ type CheckoutShopConfig = CheckoutShopConfigType;
13
+ /**
14
+ * Representation of options to configure how the storefront core manages sessions
15
+ *
16
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/sessions#configuration
17
+ */
18
+ type SessionConfig = SessionType;
19
+ /**
20
+ * Representation of a custom [Unstorage](https://unstorage.unjs.io/) driver name.
21
+ *
22
+ * @see https://unstorage.unjs.io/guide/custom-driver
23
+ */
24
+ type CustomDriverName = string & {
25
+ _custom?: unknown;
26
+ };
27
+ /**
28
+ * Representation of an [Unstorage](https://unstorage.unjs.io/) storage entity.
29
+ *
30
+ * @template Driver The storage driver.
31
+ * @template DriverOptions The driver options.
32
+ *
33
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
34
+ */
35
+ type StorageEntity<Driver extends BuiltinDriverName | CustomDriverName | unknown = unknown, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : unknown> = {
36
+ driver: Driver;
37
+ compression?: CompressionEncodings;
38
+ } & DriverOptions;
39
+ /**
40
+ * Represents the storage configuration for [Unstorage](https://unstorage.unjs.io/), leveraging the Nitro caching system.
41
+ * Storefront Core utilizes pre-configured and reusable mount points built on top of Unstorage
42
+ * and the Nitro Storage Layer, providing various caching capabilities.
43
+ *
44
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#storage
45
+ */
46
+ interface StorageConfig {
47
+ /**
48
+ * The cache storage configuration.
49
+ *
50
+ * Should no dedicated `StorageType` / `StorageEntity` be configured,
51
+ * Storefront Core will use an In-Memory driver as default for this storage mountpoints.
52
+ *
53
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
54
+ */
55
+ cache?: StorageType;
56
+ /**
57
+ * The session storage configuration.
58
+ *
59
+ * Should no dedicated `StorageType` / `StorageEntity` be configured,
60
+ * Storefront Core will use an In-Memory driver as default for this storage mountpoints.
61
+ *
62
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/caching#storefront-storage-cache-configuration
63
+ */
64
+ session?: StorageType;
65
+ }
66
+ /**
67
+ * Represents the Storefront API configuration used authenticate with it.
68
+ *
69
+ * @see https://scayle.dev/en/api-guides/storefront-api/getting-started/authentication
70
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#storefront-api
71
+ */
72
+ type SapiConfig = SapiConfigType;
73
+ /**
74
+ * Representation of Application-specific keys,
75
+ * defining how keys are generated for baskets and wishlists.
76
+ *
77
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/authentication#app-keys-for-baskets-and-wishlists
78
+ */
79
+ interface AppKeys {
80
+ /** The wishlist key used as prefix to generate user-specific wishlist identifier. */
81
+ wishlistKey: string;
82
+ /** The basket key used as prefix to generate user-specific basket identifier. */
83
+ basketKey: string;
84
+ /** The hash algorithm used to generate user-specific basket and wishlist identifier. */
85
+ hashAlgorithm: HashAlgorithm;
86
+ }
87
+ /**
88
+ * Provides a structure for additional shop configuration.
89
+ * Extending this interface allows to add custom metadata to each shop's settings
90
+ * in a Storefront application.
91
+ *
92
+ * @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#additional-shop-data
93
+ */
94
+ interface AdditionalShopConfig {
95
+ }
96
+ /**
97
+ * Shop configuration.
98
+ */
99
+ type ShopConfig = ShopConfigType & AdditionalShopConfig;
100
+ /**
101
+ * Shop configuration indexed by shop ID.
102
+ */
103
+ type ShopConfigIndexed = Record<string, ShopConfig>;
104
+ /**
105
+ * Public shop configuration. This configuration is accessible on the client-side.
106
+ */
107
+ interface PublicShopConfig extends Pick<ShopConfig, 'shopId' | 'domain' | 'locale' | 'currency' | 'currencyFractionDigits'> {
108
+ /** Checkout configuration. */
109
+ checkout: Pick<CheckoutShopConfig, 'host'>;
110
+ /** API base path. */
111
+ apiBasePath: string;
112
+ /** IDP configuration. */
113
+ idp?: IdpType;
114
+ /** Path. */
115
+ path?: string;
116
+ }
117
+ /**
118
+ * Storefront configuration.
119
+ */
120
+ 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
+ /**
189
+ * Module base options. Extends `StorefrontConfig` and `ModuleOption`.
190
+ */
191
+ type ModuleBaseOptions = StorefrontConfig & ModuleOption & {
192
+ /**
193
+ * The RPC directory where the custom application RPCs are defined.
194
+ * The directory should have an `index.ts` file where all RPCs are exported using their name.
195
+ * By default this will be `./rpcMethods`.
196
+ */
197
+ rpcDir?: string;
198
+ /**
199
+ * The RPC method names which are exported from the `rpcDir`.
200
+ * Usually this can just be `Object.keys(rpcMethodsDir)`.
201
+ */
202
+ rpcMethodNames?: string[];
203
+ /** Specify explicitly overridden RPC methods that are provided by the Storefront Core package. */
204
+ rpcMethodOverrides?: Array<keyof typeof rpcMethods>;
205
+ };
206
+ /**
207
+ * Checkout event used for tracking with Google Tag Manager.
208
+ *
209
+ * @see https://scayle.dev/en/checkout-guide/integration/webcomponent#tracking
210
+ */
211
+ interface CheckoutEvent {
212
+ /** Action. */
213
+ action?: 'authenticated';
214
+ /** Type. */
215
+ type?: 'tracking';
216
+ /** User. */
217
+ user: ShopUser;
218
+ /**
219
+ * The OAuth 2.0 access token for the authenticated user.
220
+ * This token can be used to access protected resources on behalf of the user.
221
+ *
222
+ * @see https://www.rfc-editor.org/rfc/rfc6749
223
+ */
224
+ accessToken: string;
225
+ /**
226
+ * Details about a specific event within the checkout process.
227
+ * This field is optional and is only used when tracking specific actions
228
+ * like `add_to_cart` or `remove_from_cart`.
229
+ *
230
+ * @see https://scayle.dev/en/checkout-guide/integration/tracking#application-integration
231
+ */
232
+ event?: {
233
+ /** Event name. */
234
+ event: 'login' | 'add_to_cart' | 'remove_from_cart';
235
+ /** Event status. */
236
+ status: 'successful' | 'error';
237
+ };
238
+ }
239
+ interface ModulePublicRuntimeConfig extends ModulePublicRuntimeConfigType {
240
+ }
241
+ declare module '@nuxt/schema' {
242
+ interface RuntimeConfig {
243
+ storefront: ModuleBaseOptions;
244
+ }
245
+ interface PublicRuntimeConfig {
246
+ storefront: ModulePublicRuntimeConfig;
247
+ }
248
+ }
249
+ declare module 'nitropack' {
250
+ /**
251
+ * Nitro runtime hooks.
252
+ *
253
+ * @see https://nitro.build/guide/plugins#nitro-runtime-hooks
254
+ */
255
+ interface NitroRuntimeHooks extends StorefrontHooks {
256
+ /** Storefront hook called after the RPC context created . */
257
+ 'storefront:context:created': (context: RpcContext) => HookResult;
258
+ /** Storefront hook called before the RPC method is executed. */
259
+ 'storefront:rpc:before': (rpcName: RpcMethodName, context: RpcContext, payload: unknown) => HookResult;
260
+ /** Storefront hook called after the RPC method is executed. */
261
+ 'storefront:rpc:after': (rpcName: RpcMethodName, context: RpcContext, result: unknown) => HookResult;
262
+ /** Storefront hook called if an error occurs during RPC method execution. */
263
+ 'storefront:rpc:error': (rpcName: RpcMethodName, context: RpcContext, error: unknown) => HookResult;
264
+ }
265
+ }
266
+
267
+ export type { AppKeys as A, CheckoutShopConfig as C, ModuleBaseOptions as M, PublicShopConfig as P, SessionConfig as S, StorageEntity as a, StorageConfig as b, SapiConfig as c, AdditionalShopConfig as d, ShopConfig as e, ShopConfigIndexed as f, StorefrontConfig as g, CheckoutEvent as h, ModulePublicRuntimeConfig as i };
@@ -1,5 +1,5 @@
1
1
  import { Factory } from 'fishery';
2
- import { M as ModuleBaseOptions, e as ShopConfig } from '../shared/storefront-nuxt.a816664e.mjs';
2
+ import { M as ModuleBaseOptions, e as ShopConfig } from '../shared/storefront-nuxt.b72fefd0.mjs';
3
3
  import { RpcContext } from '@scayle/storefront-core';
4
4
  import { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
5
5
  export * from '@scayle/storefront-core/dist/test/factories';
@@ -1,5 +1,5 @@
1
1
  import { Factory } from 'fishery';
2
- import { M as ModuleBaseOptions, e as ShopConfig } from '../shared/storefront-nuxt.a816664e.js';
2
+ import { M as ModuleBaseOptions, e as ShopConfig } from '../shared/storefront-nuxt.b72fefd0.js';
3
3
  import { RpcContext } from '@scayle/storefront-core';
4
4
  import { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
5
5
  export * from '@scayle/storefront-core/dist/test/factories';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.10.1",
4
+ "version": "8.10.3",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -72,7 +72,7 @@
72
72
  "dependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
74
74
  "@scayle/h3-session": "0.6.0",
75
- "@scayle/storefront-core": "8.7.0",
75
+ "@scayle/storefront-core": "8.8.0",
76
76
  "@scayle/unstorage-compression-driver": "^0.2.3",
77
77
  "@vercel/nft": "0.29.1",
78
78
  "@vueuse/core": "12.7.0",
@@ -91,7 +91,7 @@
91
91
  "schema-dts": "1.1.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@nuxt/eslint": "1.0.1",
94
+ "@nuxt/eslint": "1.1.0",
95
95
  "@nuxt/kit": "3.14.1592",
96
96
  "@nuxt/module-builder": "0.8.4",
97
97
  "@nuxt/schema": "3.14.1592",
@@ -106,7 +106,7 @@
106
106
  "h3": "1.15.0",
107
107
  "nitropack": "2.9.7",
108
108
  "node-mocks-http": "1.16.2",
109
- "nuxi": "3.21.1",
109
+ "nuxi": "3.22.2",
110
110
  "nuxt": "3.14.1592",
111
111
  "publint": "0.2.12",
112
112
  "typescript": "5.7.3",
@@ -1,81 +0,0 @@
1
- import { StorefrontHooks, RpcContext, RpcMethodName, HashAlgorithm, WithParams, rpcMethods, ShopUser } from '@scayle/storefront-core';
2
- import { CompressionEncodings } from '@scayle/unstorage-compression-driver';
3
- import { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
4
- import { CheckoutShopConfigType, SessionType, StorageType, SapiConfigType, ShopConfigType, IdpType, StorefrontConfigType, ModulePublicRuntimeConfigType, ShopSelectorType, RedirectType } from '../../dist/runtime/utils/zodSchema.js';
5
- import { HookResult } from '@nuxt/schema';
6
-
7
- type CheckoutShopConfig = CheckoutShopConfigType;
8
- /**
9
- * Options to configure how the storefront core manages sessions
10
- */
11
- type SessionConfig = SessionType;
12
- type CustomDriverName = string & {
13
- _custom?: unknown;
14
- };
15
- type StorageEntity<Driver extends BuiltinDriverName | CustomDriverName | unknown = unknown, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : unknown> = {
16
- driver: Driver;
17
- compression?: CompressionEncodings;
18
- } & DriverOptions;
19
- interface StorageConfig {
20
- cache?: StorageType;
21
- session?: StorageType;
22
- }
23
- type SapiConfig = SapiConfigType;
24
- interface AppKeys {
25
- wishlistKey: string;
26
- basketKey: string;
27
- hashAlgorithm: HashAlgorithm;
28
- }
29
- interface AdditionalShopConfig {
30
- }
31
- type ShopConfig = ShopConfigType & AdditionalShopConfig;
32
- type ShopConfigIndexed = Record<string, ShopConfig>;
33
- interface PublicShopConfig extends Pick<ShopConfig, 'shopId' | 'domain' | 'locale' | 'currency' | 'currencyFractionDigits'> {
34
- checkout: Pick<CheckoutShopConfig, 'host'>;
35
- apiBasePath: string;
36
- idp?: IdpType;
37
- path?: string;
38
- }
39
- type StorefrontConfig = StorefrontConfigType & {
40
- withParams?: WithParams;
41
- };
42
- type ModuleOption = {
43
- shopSelector: ShopSelectorType;
44
- redirects?: RedirectType;
45
- shops: ShopConfigIndexed;
46
- };
47
- type ModuleBaseOptions = StorefrontConfig & ModuleOption & {
48
- rpcDir?: string;
49
- rpcMethodNames?: string[];
50
- rpcMethodOverrides?: Array<keyof typeof rpcMethods>;
51
- };
52
- interface CheckoutEvent {
53
- action?: 'authenticated';
54
- type?: 'tracking';
55
- user: ShopUser;
56
- accessToken: string;
57
- event?: {
58
- event: 'login' | 'add_to_cart' | 'remove_from_cart';
59
- status: 'successful' | 'error';
60
- };
61
- }
62
- interface ModulePublicRuntimeConfig extends ModulePublicRuntimeConfigType {
63
- }
64
- declare module '@nuxt/schema' {
65
- interface RuntimeConfig {
66
- storefront: ModuleBaseOptions;
67
- }
68
- interface PublicRuntimeConfig {
69
- storefront: ModulePublicRuntimeConfig;
70
- }
71
- }
72
- declare module 'nitropack' {
73
- interface NitroRuntimeHooks extends StorefrontHooks {
74
- 'storefront:context:created': (context: RpcContext) => HookResult;
75
- 'storefront:rpc:before': (rpcName: RpcMethodName, context: RpcContext, payload: unknown) => HookResult;
76
- 'storefront:rpc:after': (rpcName: RpcMethodName, context: RpcContext, result: unknown) => HookResult;
77
- 'storefront:rpc:error': (rpcName: RpcMethodName, context: RpcContext, error: unknown) => HookResult;
78
- }
79
- }
80
-
81
- export type { AppKeys as A, CheckoutShopConfig as C, ModuleBaseOptions as M, PublicShopConfig as P, SessionConfig as S, StorageEntity as a, StorageConfig as b, SapiConfig as c, AdditionalShopConfig as d, ShopConfig as e, ShopConfigIndexed as f, StorefrontConfig as g, CheckoutEvent as h, ModulePublicRuntimeConfig as i };