@neowhale/storefront 0.2.39 → 0.2.41

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.
@@ -1,117 +0,0 @@
1
- import { F as WhaleStorefrontConfig, W as WhaleClient, r as Product } from '../client-CUKv5fMM.cjs';
2
- import { NextRequest, NextResponse } from 'next/server';
3
-
4
- /**
5
- * Security headers for Next.js storefronts.
6
- */
7
- declare const securityHeaders: {
8
- key: string;
9
- value: string;
10
- }[];
11
- /**
12
- * Returns a Next.js `headers()` config with security headers applied to all routes.
13
- * Use in next.config.ts:
14
- *
15
- * ```ts
16
- * import { withSecurityHeaders } from '@neowhale/storefront/next'
17
- * export default { headers: withSecurityHeaders() }
18
- * ```
19
- */
20
- declare function withSecurityHeaders(extra?: {
21
- key: string;
22
- value: string;
23
- }[]): () => Promise<{
24
- source: string;
25
- headers: {
26
- key: string;
27
- value: string;
28
- }[];
29
- }[]>;
30
-
31
- /**
32
- * Gateway rewrite rule for Next.js.
33
- * Proxies client-side /api/gw/* requests to whale-gateway to avoid CORS.
34
- *
35
- * Usage in next.config.ts:
36
- * ```ts
37
- * import { whaleGatewayRewrite } from '@neowhale/storefront/next'
38
- * export default {
39
- * async rewrites() {
40
- * return [whaleGatewayRewrite()]
41
- * }
42
- * }
43
- * ```
44
- */
45
- declare function whaleGatewayRewrite(gatewayUrl?: string, proxyPath?: string): {
46
- source: string;
47
- destination: string;
48
- };
49
-
50
- /**
51
- * Creates a server-side WhaleClient.
52
- * Reads from env vars by default — override with explicit config.
53
- */
54
- declare function createServerClient(config?: Partial<WhaleStorefrontConfig>): WhaleClient;
55
- /**
56
- * Server-side: fetch all published products with ISR caching.
57
- * Drop-in replacement for Flora's `getAllProducts()`.
58
- */
59
- declare function getAllProducts(options?: {
60
- /** Revalidate interval in seconds. Defaults to 60. */
61
- revalidate?: number;
62
- /** Filter function to exclude products (e.g. hidden categories, out of stock) */
63
- filter?: (product: Product) => boolean;
64
- /** Override client config */
65
- client?: WhaleClient;
66
- }): Promise<Product[]>;
67
-
68
- interface ImageLoaderParams {
69
- src: string;
70
- width: number;
71
- quality?: number;
72
- }
73
- /**
74
- * Creates a Next.js custom image loader that proxies Supabase images through gateway.
75
- *
76
- * Usage in a loader file (e.g. src/lib/image-loader.ts):
77
- * ```ts
78
- * import { createImageLoader } from '@neowhale/storefront/next'
79
- * export default createImageLoader({
80
- * storeId: process.env.NEXT_PUBLIC_STORE_ID!,
81
- * gatewayUrl: 'https://whale-gateway.fly.dev',
82
- * supabaseHost: 'your-project.supabase.co',
83
- * signingSecret: process.env.NEXT_PUBLIC_MEDIA_SIGNING_SECRET!,
84
- * })
85
- * ```
86
- */
87
- declare function createImageLoader(config: {
88
- storeId: string;
89
- gatewayUrl: string;
90
- supabaseHost: string;
91
- signingSecret: string;
92
- }): (params: ImageLoaderParams) => string;
93
-
94
- /**
95
- * Creates a Next.js middleware that protects routes requiring authentication.
96
- *
97
- * Checks for a session token cookie or localStorage indicator.
98
- * Since middleware runs on the edge and can't access localStorage,
99
- * this checks for a cookie-based token instead.
100
- *
101
- * Usage in middleware.ts:
102
- * ```ts
103
- * import { createAuthMiddleware } from '@neowhale/storefront/next'
104
- * export const middleware = createAuthMiddleware({
105
- * protectedPaths: ['/account'],
106
- * loginPath: '/account',
107
- * })
108
- * export const config = { matcher: ['/account/:path*'] }
109
- * ```
110
- */
111
- declare function createAuthMiddleware(options: {
112
- protectedPaths: string[];
113
- loginPath: string;
114
- cookieName?: string;
115
- }): (request: NextRequest) => NextResponse<unknown>;
116
-
117
- export { createAuthMiddleware, createImageLoader, createServerClient, getAllProducts, securityHeaders, whaleGatewayRewrite, withSecurityHeaders };
@@ -1,117 +0,0 @@
1
- import { F as WhaleStorefrontConfig, W as WhaleClient, r as Product } from '../client-CUKv5fMM.js';
2
- import { NextRequest, NextResponse } from 'next/server';
3
-
4
- /**
5
- * Security headers for Next.js storefronts.
6
- */
7
- declare const securityHeaders: {
8
- key: string;
9
- value: string;
10
- }[];
11
- /**
12
- * Returns a Next.js `headers()` config with security headers applied to all routes.
13
- * Use in next.config.ts:
14
- *
15
- * ```ts
16
- * import { withSecurityHeaders } from '@neowhale/storefront/next'
17
- * export default { headers: withSecurityHeaders() }
18
- * ```
19
- */
20
- declare function withSecurityHeaders(extra?: {
21
- key: string;
22
- value: string;
23
- }[]): () => Promise<{
24
- source: string;
25
- headers: {
26
- key: string;
27
- value: string;
28
- }[];
29
- }[]>;
30
-
31
- /**
32
- * Gateway rewrite rule for Next.js.
33
- * Proxies client-side /api/gw/* requests to whale-gateway to avoid CORS.
34
- *
35
- * Usage in next.config.ts:
36
- * ```ts
37
- * import { whaleGatewayRewrite } from '@neowhale/storefront/next'
38
- * export default {
39
- * async rewrites() {
40
- * return [whaleGatewayRewrite()]
41
- * }
42
- * }
43
- * ```
44
- */
45
- declare function whaleGatewayRewrite(gatewayUrl?: string, proxyPath?: string): {
46
- source: string;
47
- destination: string;
48
- };
49
-
50
- /**
51
- * Creates a server-side WhaleClient.
52
- * Reads from env vars by default — override with explicit config.
53
- */
54
- declare function createServerClient(config?: Partial<WhaleStorefrontConfig>): WhaleClient;
55
- /**
56
- * Server-side: fetch all published products with ISR caching.
57
- * Drop-in replacement for Flora's `getAllProducts()`.
58
- */
59
- declare function getAllProducts(options?: {
60
- /** Revalidate interval in seconds. Defaults to 60. */
61
- revalidate?: number;
62
- /** Filter function to exclude products (e.g. hidden categories, out of stock) */
63
- filter?: (product: Product) => boolean;
64
- /** Override client config */
65
- client?: WhaleClient;
66
- }): Promise<Product[]>;
67
-
68
- interface ImageLoaderParams {
69
- src: string;
70
- width: number;
71
- quality?: number;
72
- }
73
- /**
74
- * Creates a Next.js custom image loader that proxies Supabase images through gateway.
75
- *
76
- * Usage in a loader file (e.g. src/lib/image-loader.ts):
77
- * ```ts
78
- * import { createImageLoader } from '@neowhale/storefront/next'
79
- * export default createImageLoader({
80
- * storeId: process.env.NEXT_PUBLIC_STORE_ID!,
81
- * gatewayUrl: 'https://whale-gateway.fly.dev',
82
- * supabaseHost: 'your-project.supabase.co',
83
- * signingSecret: process.env.NEXT_PUBLIC_MEDIA_SIGNING_SECRET!,
84
- * })
85
- * ```
86
- */
87
- declare function createImageLoader(config: {
88
- storeId: string;
89
- gatewayUrl: string;
90
- supabaseHost: string;
91
- signingSecret: string;
92
- }): (params: ImageLoaderParams) => string;
93
-
94
- /**
95
- * Creates a Next.js middleware that protects routes requiring authentication.
96
- *
97
- * Checks for a session token cookie or localStorage indicator.
98
- * Since middleware runs on the edge and can't access localStorage,
99
- * this checks for a cookie-based token instead.
100
- *
101
- * Usage in middleware.ts:
102
- * ```ts
103
- * import { createAuthMiddleware } from '@neowhale/storefront/next'
104
- * export const middleware = createAuthMiddleware({
105
- * protectedPaths: ['/account'],
106
- * loginPath: '/account',
107
- * })
108
- * export const config = { matcher: ['/account/:path*'] }
109
- * ```
110
- */
111
- declare function createAuthMiddleware(options: {
112
- protectedPaths: string[];
113
- loginPath: string;
114
- cookieName?: string;
115
- }): (request: NextRequest) => NextResponse<unknown>;
116
-
117
- export { createAuthMiddleware, createImageLoader, createServerClient, getAllProducts, securityHeaders, whaleGatewayRewrite, withSecurityHeaders };
@@ -1,10 +0,0 @@
1
- import { p as PixelConfig } from './client-CUKv5fMM.js';
2
-
3
- declare class PixelManager {
4
- private providers;
5
- constructor(configs: PixelConfig[]);
6
- initialize(): Promise<void>;
7
- track(event: string, params?: Record<string, unknown>): void;
8
- }
9
-
10
- export { PixelManager as P };
@@ -1,10 +0,0 @@
1
- import { p as PixelConfig } from './client-CUKv5fMM.cjs';
2
-
3
- declare class PixelManager {
4
- private providers;
5
- constructor(configs: PixelConfig[]);
6
- initialize(): Promise<void>;
7
- track(event: string, params?: Record<string, unknown>): void;
8
- }
9
-
10
- export { PixelManager as P };