payload-plugin-newsletter 0.20.0 → 0.20.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/dist/index.d.cts DELETED
@@ -1,90 +0,0 @@
1
- import { PayloadRequest, Config } from 'payload';
2
- import { NewsletterPluginConfig, BroadcastProvider } from './types.cjs';
3
- import React from 'react';
4
-
5
- interface NextApiRequest {
6
- cookies?: {
7
- [key: string]: string;
8
- };
9
- headers?: {
10
- [key: string]: string | string[] | undefined;
11
- };
12
- [key: string]: any;
13
- }
14
- interface GetServerSidePropsContext {
15
- req: {
16
- cookies?: {
17
- [key: string]: string;
18
- };
19
- headers?: {
20
- [key: string]: string | string[] | undefined;
21
- };
22
- [key: string]: any;
23
- };
24
- [key: string]: any;
25
- }
26
- interface TokenPayload {
27
- id: string;
28
- email: string;
29
- type?: string;
30
- iat?: number;
31
- exp?: number;
32
- }
33
- /**
34
- * Extract token from request cookies
35
- */
36
- declare const getTokenFromRequest: (req: NextApiRequest | GetServerSidePropsContext["req"] | PayloadRequest) => string | null;
37
- /**
38
- * Verify JWT token
39
- */
40
- declare const verifyToken: (token: string, secret: string) => TokenPayload | null;
41
- /**
42
- * Get authentication state for server-side rendering
43
- */
44
- declare const getServerSideAuth: (context: GetServerSidePropsContext, secret?: string) => Promise<{
45
- subscriber: TokenPayload | null;
46
- isAuthenticated: boolean;
47
- }>;
48
- /**
49
- * Higher-order function for protecting pages
50
- */
51
- declare const requireAuth: <P extends {
52
- [key: string]: any;
53
- }>(gssp?: (context: GetServerSidePropsContext) => Promise<{
54
- props: P;
55
- }>) => (context: GetServerSidePropsContext) => Promise<{
56
- redirect: {
57
- destination: string;
58
- permanent: boolean;
59
- };
60
- props?: undefined;
61
- } | {
62
- props: P;
63
- redirect?: undefined;
64
- }>;
65
- /**
66
- * Check if request has valid authentication
67
- */
68
- declare const isAuthenticated: (req: PayloadRequest | NextApiRequest, secret: string) => boolean;
69
-
70
- declare const PluginConfigProvider: React.FC<{
71
- config: NewsletterPluginConfig;
72
- children: React.ReactNode;
73
- }>;
74
- declare const usePluginConfig: () => NewsletterPluginConfig;
75
- /**
76
- * Hook to safely access plugin config without throwing if context is not available
77
- * This is useful for components that might be used outside of the plugin context
78
- */
79
- declare const usePluginConfigOptional: () => NewsletterPluginConfig | null;
80
-
81
- declare module 'payload' {
82
- interface BasePayload {
83
- newsletterEmailService?: any;
84
- broadcastProvider?: BroadcastProvider;
85
- newsletterProvider?: BroadcastProvider;
86
- }
87
- }
88
- declare const newsletterPlugin: (pluginConfig: NewsletterPluginConfig) => (incomingConfig: Config) => Config;
89
-
90
- export { PluginConfigProvider, newsletterPlugin as default, getServerSideAuth, getTokenFromRequest, isAuthenticated, newsletterPlugin, requireAuth, usePluginConfig, usePluginConfigOptional, verifyToken };
package/dist/index.d.ts DELETED
@@ -1,90 +0,0 @@
1
- import { PayloadRequest, Config } from 'payload';
2
- import { NewsletterPluginConfig, BroadcastProvider } from './types.js';
3
- import React from 'react';
4
-
5
- interface NextApiRequest {
6
- cookies?: {
7
- [key: string]: string;
8
- };
9
- headers?: {
10
- [key: string]: string | string[] | undefined;
11
- };
12
- [key: string]: any;
13
- }
14
- interface GetServerSidePropsContext {
15
- req: {
16
- cookies?: {
17
- [key: string]: string;
18
- };
19
- headers?: {
20
- [key: string]: string | string[] | undefined;
21
- };
22
- [key: string]: any;
23
- };
24
- [key: string]: any;
25
- }
26
- interface TokenPayload {
27
- id: string;
28
- email: string;
29
- type?: string;
30
- iat?: number;
31
- exp?: number;
32
- }
33
- /**
34
- * Extract token from request cookies
35
- */
36
- declare const getTokenFromRequest: (req: NextApiRequest | GetServerSidePropsContext["req"] | PayloadRequest) => string | null;
37
- /**
38
- * Verify JWT token
39
- */
40
- declare const verifyToken: (token: string, secret: string) => TokenPayload | null;
41
- /**
42
- * Get authentication state for server-side rendering
43
- */
44
- declare const getServerSideAuth: (context: GetServerSidePropsContext, secret?: string) => Promise<{
45
- subscriber: TokenPayload | null;
46
- isAuthenticated: boolean;
47
- }>;
48
- /**
49
- * Higher-order function for protecting pages
50
- */
51
- declare const requireAuth: <P extends {
52
- [key: string]: any;
53
- }>(gssp?: (context: GetServerSidePropsContext) => Promise<{
54
- props: P;
55
- }>) => (context: GetServerSidePropsContext) => Promise<{
56
- redirect: {
57
- destination: string;
58
- permanent: boolean;
59
- };
60
- props?: undefined;
61
- } | {
62
- props: P;
63
- redirect?: undefined;
64
- }>;
65
- /**
66
- * Check if request has valid authentication
67
- */
68
- declare const isAuthenticated: (req: PayloadRequest | NextApiRequest, secret: string) => boolean;
69
-
70
- declare const PluginConfigProvider: React.FC<{
71
- config: NewsletterPluginConfig;
72
- children: React.ReactNode;
73
- }>;
74
- declare const usePluginConfig: () => NewsletterPluginConfig;
75
- /**
76
- * Hook to safely access plugin config without throwing if context is not available
77
- * This is useful for components that might be used outside of the plugin context
78
- */
79
- declare const usePluginConfigOptional: () => NewsletterPluginConfig | null;
80
-
81
- declare module 'payload' {
82
- interface BasePayload {
83
- newsletterEmailService?: any;
84
- broadcastProvider?: BroadcastProvider;
85
- newsletterProvider?: BroadcastProvider;
86
- }
87
- }
88
- declare const newsletterPlugin: (pluginConfig: NewsletterPluginConfig) => (incomingConfig: Config) => Config;
89
-
90
- export { PluginConfigProvider, newsletterPlugin as default, getServerSideAuth, getTokenFromRequest, isAuthenticated, newsletterPlugin, requireAuth, usePluginConfig, usePluginConfigOptional, verifyToken };