@djangocfg/ext-newsletter 1.0.0
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/README.md +140 -0
- package/dist/chunk-LQLPNWHR.js +2075 -0
- package/dist/hooks.cjs +2539 -0
- package/dist/hooks.d.cts +267 -0
- package/dist/hooks.d.ts +267 -0
- package/dist/hooks.js +370 -0
- package/dist/index.cjs +2153 -0
- package/dist/index.d.cts +2084 -0
- package/dist/index.d.ts +2084 -0
- package/dist/index.js +1 -0
- package/package.json +80 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter.ts +210 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__bulk_email.ts +93 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__campaigns.ts +338 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__logs.ts +92 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__newsletters.ts +150 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__subscriptions.ts +210 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/ext_newsletter__newsletter__testing.ts +93 -0
- package/src/api/generated/ext_newsletter/_utils/fetchers/index.ts +34 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter.ts +81 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__bulk_email.ts +42 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__campaigns.ts +130 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__logs.ts +37 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__newsletters.ts +52 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__subscriptions.ts +78 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__testing.ts +42 -0
- package/src/api/generated/ext_newsletter/_utils/hooks/index.ts +34 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/BulkEmailRequest.schema.ts +26 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/BulkEmailResponse.schema.ts +23 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/EmailLog.schema.ts +31 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/ErrorResponse.schema.ts +20 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/Newsletter.schema.ts +26 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/NewsletterCampaign.schema.ts +33 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/NewsletterCampaignRequest.schema.ts +26 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/NewsletterSubscription.schema.ts +27 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PaginatedEmailLogList.schema.ts +24 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PaginatedNewsletterCampaignList.schema.ts +24 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PaginatedNewsletterList.schema.ts +24 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PaginatedNewsletterSubscriptionList.schema.ts +24 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PatchedNewsletterCampaignRequest.schema.ts +26 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/PatchedUnsubscribeRequest.schema.ts +19 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/SendCampaignRequest.schema.ts +19 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/SendCampaignResponse.schema.ts +22 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/SubscribeRequest.schema.ts +20 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/SubscribeResponse.schema.ts +21 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/SuccessResponse.schema.ts +20 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/TestEmailRequest.schema.ts +21 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/Unsubscribe.schema.ts +19 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/UnsubscribeRequest.schema.ts +19 -0
- package/src/api/generated/ext_newsletter/_utils/schemas/index.ts +40 -0
- package/src/api/generated/ext_newsletter/api-instance.ts +131 -0
- package/src/api/generated/ext_newsletter/client.ts +319 -0
- package/src/api/generated/ext_newsletter/enums.ts +24 -0
- package/src/api/generated/ext_newsletter/errors.ts +116 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter/client.ts +38 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter/models.ts +71 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__bulk_email/client.ts +24 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__bulk_email/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__bulk_email/models.ts +29 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__campaigns/client.ts +85 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__campaigns/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__campaigns/models.ts +100 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__logs/client.ts +35 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__logs/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__logs/models.ts +51 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__newsletters/client.ts +45 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__newsletters/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__newsletters/models.ts +42 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__subscriptions/client.ts +55 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__subscriptions/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__subscriptions/models.ts +92 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__testing/client.ts +24 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__testing/index.ts +2 -0
- package/src/api/generated/ext_newsletter/ext_newsletter__newsletter__testing/models.ts +24 -0
- package/src/api/generated/ext_newsletter/http.ts +103 -0
- package/src/api/generated/ext_newsletter/index.ts +315 -0
- package/src/api/generated/ext_newsletter/logger.ts +259 -0
- package/src/api/generated/ext_newsletter/retry.ts +175 -0
- package/src/api/generated/ext_newsletter/schema.json +1739 -0
- package/src/api/generated/ext_newsletter/storage.ts +161 -0
- package/src/api/generated/ext_newsletter/validation-events.ts +133 -0
- package/src/api/index.ts +9 -0
- package/src/components/Hero/index.tsx +160 -0
- package/src/components/Hero/types.ts +37 -0
- package/src/config.ts +20 -0
- package/src/contexts/newsletter/NewsletterContext.tsx +264 -0
- package/src/contexts/newsletter/types.ts +32 -0
- package/src/hooks/index.ts +21 -0
- package/src/index.ts +14 -0
- package/src/utils/logger.ts +9 -0
package/src/api/generated/ext_newsletter/_utils/hooks/ext_newsletter__newsletter__subscriptions.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SWR Hooks for Subscriptions
|
|
5
|
+
*
|
|
6
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
7
|
+
* revalidation, and optimistic updates.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Query hooks (GET)
|
|
12
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
13
|
+
*
|
|
14
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
15
|
+
* const createUser = useCreateUser()
|
|
16
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import useSWR from 'swr'
|
|
20
|
+
import { useSWRConfig } from 'swr'
|
|
21
|
+
import * as Fetchers from '../fetchers/ext_newsletter__newsletter__subscriptions'
|
|
22
|
+
import type { API } from '../../index'
|
|
23
|
+
import type { PaginatedNewsletterSubscriptionList } from '../schemas/PaginatedNewsletterSubscriptionList.schema'
|
|
24
|
+
import type { SubscribeRequest } from '../schemas/SubscribeRequest.schema'
|
|
25
|
+
import type { SubscribeResponse } from '../schemas/SubscribeResponse.schema'
|
|
26
|
+
import type { SuccessResponse } from '../schemas/SuccessResponse.schema'
|
|
27
|
+
import type { UnsubscribeRequest } from '../schemas/UnsubscribeRequest.schema'
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Subscribe to Newsletter
|
|
31
|
+
*
|
|
32
|
+
* @method POST
|
|
33
|
+
* @path /cfg/newsletter/subscribe/
|
|
34
|
+
*/
|
|
35
|
+
export function useCreateNewsletterSubscribeCreate() {
|
|
36
|
+
const { mutate } = useSWRConfig()
|
|
37
|
+
|
|
38
|
+
return async (data: SubscribeRequest, client?: API): Promise<SubscribeResponse> => {
|
|
39
|
+
const result = await Fetchers.createNewsletterSubscribeCreate(data, client)
|
|
40
|
+
// Revalidate related queries
|
|
41
|
+
mutate('cfg-newsletter-subscribe')
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* List User Subscriptions
|
|
49
|
+
*
|
|
50
|
+
* @method GET
|
|
51
|
+
* @path /cfg/newsletter/subscriptions/
|
|
52
|
+
*/
|
|
53
|
+
export function useNewsletterSubscriptionsList(params?: { page?: number; page_size?: number }, client?: API): ReturnType<typeof useSWR<PaginatedNewsletterSubscriptionList>> {
|
|
54
|
+
return useSWR<PaginatedNewsletterSubscriptionList>(
|
|
55
|
+
params ? ['cfg-newsletter-subscriptions', params] : 'cfg-newsletter-subscriptions',
|
|
56
|
+
() => Fetchers.getNewsletterSubscriptionsList(params, client)
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Unsubscribe from Newsletter
|
|
63
|
+
*
|
|
64
|
+
* @method POST
|
|
65
|
+
* @path /cfg/newsletter/unsubscribe/
|
|
66
|
+
*/
|
|
67
|
+
export function useCreateNewsletterUnsubscribeCreate() {
|
|
68
|
+
const { mutate } = useSWRConfig()
|
|
69
|
+
|
|
70
|
+
return async (data: UnsubscribeRequest, client?: API): Promise<SuccessResponse> => {
|
|
71
|
+
const result = await Fetchers.createNewsletterUnsubscribeCreate(data, client)
|
|
72
|
+
// Revalidate related queries
|
|
73
|
+
mutate('cfg-newsletter-unsubscribe')
|
|
74
|
+
return result
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SWR Hooks for Testing
|
|
5
|
+
*
|
|
6
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
7
|
+
* revalidation, and optimistic updates.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Query hooks (GET)
|
|
12
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
13
|
+
*
|
|
14
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
15
|
+
* const createUser = useCreateUser()
|
|
16
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { useSWRConfig } from 'swr'
|
|
20
|
+
import * as Fetchers from '../fetchers/ext_newsletter__newsletter__testing'
|
|
21
|
+
import type { API } from '../../index'
|
|
22
|
+
import type { BulkEmailResponse } from '../schemas/BulkEmailResponse.schema'
|
|
23
|
+
import type { TestEmailRequest } from '../schemas/TestEmailRequest.schema'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Test Email Sending
|
|
27
|
+
*
|
|
28
|
+
* @method POST
|
|
29
|
+
* @path /cfg/newsletter/test/
|
|
30
|
+
*/
|
|
31
|
+
export function useCreateNewsletterTestCreate() {
|
|
32
|
+
const { mutate } = useSWRConfig()
|
|
33
|
+
|
|
34
|
+
return async (data: TestEmailRequest, client?: API): Promise<BulkEmailResponse> => {
|
|
35
|
+
const result = await Fetchers.createNewsletterTestCreate(data, client)
|
|
36
|
+
// Revalidate related queries
|
|
37
|
+
mutate('cfg-newsletter-test')
|
|
38
|
+
return result
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SWR Hooks - React data fetching hooks
|
|
5
|
+
*
|
|
6
|
+
* Auto-generated from OpenAPI specification.
|
|
7
|
+
* Powered by SWR for automatic caching and revalidation.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Automatic caching and deduplication
|
|
11
|
+
* - Revalidation on focus/reconnect
|
|
12
|
+
* - Optimistic updates
|
|
13
|
+
* - Type-safe parameters and responses
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import * as hooks from './hooks'
|
|
18
|
+
*
|
|
19
|
+
* // Query hooks (GET)
|
|
20
|
+
* const { data, error, isLoading } = hooks.useUsers({ page: 1 })
|
|
21
|
+
*
|
|
22
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
23
|
+
* const createUser = hooks.useCreateUser()
|
|
24
|
+
* await createUser({ name: 'John' })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export * from './ext_newsletter__newsletter__bulk_email'
|
|
29
|
+
export * from './ext_newsletter__newsletter__campaigns'
|
|
30
|
+
export * from './ext_newsletter__newsletter__logs'
|
|
31
|
+
export * from './ext_newsletter__newsletter__newsletters'
|
|
32
|
+
export * from './ext_newsletter__newsletter__subscriptions'
|
|
33
|
+
export * from './ext_newsletter__newsletter__testing'
|
|
34
|
+
export * from './ext_newsletter__newsletter'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for BulkEmailRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for bulk email.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for bulk email.
|
|
11
|
+
*/
|
|
12
|
+
export const BulkEmailRequestSchema = z.object({
|
|
13
|
+
recipients: z.array(z.email()),
|
|
14
|
+
subject: z.string().min(1).max(255),
|
|
15
|
+
email_title: z.string().min(1).max(255),
|
|
16
|
+
main_text: z.string().min(1),
|
|
17
|
+
main_html_content: z.string().optional(),
|
|
18
|
+
button_text: z.string().max(100).optional(),
|
|
19
|
+
button_url: z.url().optional(),
|
|
20
|
+
secondary_text: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Infer TypeScript type from Zod schema
|
|
25
|
+
*/
|
|
26
|
+
export type BulkEmailRequest = z.infer<typeof BulkEmailRequestSchema>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for BulkEmailResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for bulk email sending.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Response for bulk email sending.
|
|
11
|
+
*/
|
|
12
|
+
export const BulkEmailResponseSchema = z.object({
|
|
13
|
+
success: z.boolean(),
|
|
14
|
+
sent_count: z.int(),
|
|
15
|
+
failed_count: z.int(),
|
|
16
|
+
total_recipients: z.int(),
|
|
17
|
+
error: z.string().optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Infer TypeScript type from Zod schema
|
|
22
|
+
*/
|
|
23
|
+
export type BulkEmailResponse = z.infer<typeof BulkEmailResponseSchema>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for EmailLog
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for EmailLog model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import * as Enums from '../../enums'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serializer for EmailLog model.
|
|
12
|
+
*/
|
|
13
|
+
export const EmailLogSchema = z.object({
|
|
14
|
+
id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
15
|
+
user: z.int().nullable(),
|
|
16
|
+
user_email: z.string(),
|
|
17
|
+
newsletter: z.int().nullable(),
|
|
18
|
+
newsletter_title: z.string(),
|
|
19
|
+
recipient: z.string(),
|
|
20
|
+
subject: z.string(),
|
|
21
|
+
body: z.string(),
|
|
22
|
+
status: z.nativeEnum(Enums.EmailLogStatus),
|
|
23
|
+
created_at: z.iso.datetime(),
|
|
24
|
+
sent_at: z.iso.datetime().nullable(),
|
|
25
|
+
error_message: z.string().nullable(),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Infer TypeScript type from Zod schema
|
|
30
|
+
*/
|
|
31
|
+
export type EmailLog = z.infer<typeof EmailLogSchema>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for ErrorResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Generic error response.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generic error response.
|
|
11
|
+
*/
|
|
12
|
+
export const ErrorResponseSchema = z.object({
|
|
13
|
+
success: z.boolean().optional(),
|
|
14
|
+
message: z.string(),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Infer TypeScript type from Zod schema
|
|
19
|
+
*/
|
|
20
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for Newsletter
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for Newsletter model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for Newsletter model.
|
|
11
|
+
*/
|
|
12
|
+
export const NewsletterSchema = z.object({
|
|
13
|
+
id: z.int(),
|
|
14
|
+
title: z.string().max(255),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
is_active: z.boolean().optional(),
|
|
17
|
+
auto_subscribe: z.boolean().optional(),
|
|
18
|
+
created_at: z.iso.datetime(),
|
|
19
|
+
updated_at: z.iso.datetime(),
|
|
20
|
+
subscribers_count: z.int(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Infer TypeScript type from Zod schema
|
|
25
|
+
*/
|
|
26
|
+
export type Newsletter = z.infer<typeof NewsletterSchema>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for NewsletterCampaign
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for NewsletterCampaign model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import * as Enums from '../../enums'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serializer for NewsletterCampaign model.
|
|
12
|
+
*/
|
|
13
|
+
export const NewsletterCampaignSchema = z.object({
|
|
14
|
+
id: z.int(),
|
|
15
|
+
newsletter: z.int(),
|
|
16
|
+
newsletter_title: z.string(),
|
|
17
|
+
subject: z.string().max(255),
|
|
18
|
+
email_title: z.string().max(255),
|
|
19
|
+
main_text: z.string(),
|
|
20
|
+
main_html_content: z.string().optional(),
|
|
21
|
+
button_text: z.string().max(100).optional(),
|
|
22
|
+
button_url: z.url().optional(),
|
|
23
|
+
secondary_text: z.string().optional(),
|
|
24
|
+
status: z.nativeEnum(Enums.NewsletterCampaignStatus),
|
|
25
|
+
created_at: z.iso.datetime(),
|
|
26
|
+
sent_at: z.iso.datetime().nullable(),
|
|
27
|
+
recipient_count: z.int(),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Infer TypeScript type from Zod schema
|
|
32
|
+
*/
|
|
33
|
+
export type NewsletterCampaign = z.infer<typeof NewsletterCampaignSchema>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for NewsletterCampaignRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for NewsletterCampaign model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for NewsletterCampaign model.
|
|
11
|
+
*/
|
|
12
|
+
export const NewsletterCampaignRequestSchema = z.object({
|
|
13
|
+
newsletter: z.int(),
|
|
14
|
+
subject: z.string().min(1).max(255),
|
|
15
|
+
email_title: z.string().min(1).max(255),
|
|
16
|
+
main_text: z.string().min(1),
|
|
17
|
+
main_html_content: z.string().optional(),
|
|
18
|
+
button_text: z.string().max(100).optional(),
|
|
19
|
+
button_url: z.url().optional(),
|
|
20
|
+
secondary_text: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Infer TypeScript type from Zod schema
|
|
25
|
+
*/
|
|
26
|
+
export type NewsletterCampaignRequest = z.infer<typeof NewsletterCampaignRequestSchema>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for NewsletterSubscription
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for NewsletterSubscription model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for NewsletterSubscription model.
|
|
11
|
+
*/
|
|
12
|
+
export const NewsletterSubscriptionSchema = z.object({
|
|
13
|
+
id: z.int(),
|
|
14
|
+
newsletter: z.int(),
|
|
15
|
+
newsletter_title: z.string(),
|
|
16
|
+
user: z.int().nullable().optional(),
|
|
17
|
+
user_email: z.string(),
|
|
18
|
+
email: z.email(),
|
|
19
|
+
is_active: z.boolean().optional(),
|
|
20
|
+
subscribed_at: z.iso.datetime(),
|
|
21
|
+
unsubscribed_at: z.iso.datetime().nullable(),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Infer TypeScript type from Zod schema
|
|
26
|
+
*/
|
|
27
|
+
export type NewsletterSubscription = z.infer<typeof NewsletterSubscriptionSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaginatedEmailLogList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* */
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
import { EmailLogSchema } from './EmailLog.schema'
|
|
8
|
+
|
|
9
|
+
export const PaginatedEmailLogListSchema = z.object({
|
|
10
|
+
count: z.int(),
|
|
11
|
+
page: z.int(),
|
|
12
|
+
pages: z.int(),
|
|
13
|
+
page_size: z.int(),
|
|
14
|
+
has_next: z.boolean(),
|
|
15
|
+
has_previous: z.boolean(),
|
|
16
|
+
next_page: z.int().nullable().optional(),
|
|
17
|
+
previous_page: z.int().nullable().optional(),
|
|
18
|
+
results: z.array(EmailLogSchema),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type PaginatedEmailLogList = z.infer<typeof PaginatedEmailLogListSchema>
|
package/src/api/generated/ext_newsletter/_utils/schemas/PaginatedNewsletterCampaignList.schema.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaginatedNewsletterCampaignList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* */
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
import { NewsletterCampaignSchema } from './NewsletterCampaign.schema'
|
|
8
|
+
|
|
9
|
+
export const PaginatedNewsletterCampaignListSchema = z.object({
|
|
10
|
+
count: z.int(),
|
|
11
|
+
page: z.int(),
|
|
12
|
+
pages: z.int(),
|
|
13
|
+
page_size: z.int(),
|
|
14
|
+
has_next: z.boolean(),
|
|
15
|
+
has_previous: z.boolean(),
|
|
16
|
+
next_page: z.int().nullable().optional(),
|
|
17
|
+
previous_page: z.int().nullable().optional(),
|
|
18
|
+
results: z.array(NewsletterCampaignSchema),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type PaginatedNewsletterCampaignList = z.infer<typeof PaginatedNewsletterCampaignListSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaginatedNewsletterList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* */
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
import { NewsletterSchema } from './Newsletter.schema'
|
|
8
|
+
|
|
9
|
+
export const PaginatedNewsletterListSchema = z.object({
|
|
10
|
+
count: z.int(),
|
|
11
|
+
page: z.int(),
|
|
12
|
+
pages: z.int(),
|
|
13
|
+
page_size: z.int(),
|
|
14
|
+
has_next: z.boolean(),
|
|
15
|
+
has_previous: z.boolean(),
|
|
16
|
+
next_page: z.int().nullable().optional(),
|
|
17
|
+
previous_page: z.int().nullable().optional(),
|
|
18
|
+
results: z.array(NewsletterSchema),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type PaginatedNewsletterList = z.infer<typeof PaginatedNewsletterListSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaginatedNewsletterSubscriptionList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* */
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
import { NewsletterSubscriptionSchema } from './NewsletterSubscription.schema'
|
|
8
|
+
|
|
9
|
+
export const PaginatedNewsletterSubscriptionListSchema = z.object({
|
|
10
|
+
count: z.int(),
|
|
11
|
+
page: z.int(),
|
|
12
|
+
pages: z.int(),
|
|
13
|
+
page_size: z.int(),
|
|
14
|
+
has_next: z.boolean(),
|
|
15
|
+
has_previous: z.boolean(),
|
|
16
|
+
next_page: z.int().nullable().optional(),
|
|
17
|
+
previous_page: z.int().nullable().optional(),
|
|
18
|
+
results: z.array(NewsletterSubscriptionSchema),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type PaginatedNewsletterSubscriptionList = z.infer<typeof PaginatedNewsletterSubscriptionListSchema>
|
package/src/api/generated/ext_newsletter/_utils/schemas/PatchedNewsletterCampaignRequest.schema.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PatchedNewsletterCampaignRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for NewsletterCampaign model.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for NewsletterCampaign model.
|
|
11
|
+
*/
|
|
12
|
+
export const PatchedNewsletterCampaignRequestSchema = z.object({
|
|
13
|
+
newsletter: z.int().optional(),
|
|
14
|
+
subject: z.string().min(1).max(255).optional(),
|
|
15
|
+
email_title: z.string().min(1).max(255).optional(),
|
|
16
|
+
main_text: z.string().min(1).optional(),
|
|
17
|
+
main_html_content: z.string().optional(),
|
|
18
|
+
button_text: z.string().max(100).optional(),
|
|
19
|
+
button_url: z.url().optional(),
|
|
20
|
+
secondary_text: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Infer TypeScript type from Zod schema
|
|
25
|
+
*/
|
|
26
|
+
export type PatchedNewsletterCampaignRequest = z.infer<typeof PatchedNewsletterCampaignRequestSchema>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PatchedUnsubscribeRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for unsubscribe.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for unsubscribe.
|
|
11
|
+
*/
|
|
12
|
+
export const PatchedUnsubscribeRequestSchema = z.object({
|
|
13
|
+
subscription_id: z.int().optional(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type PatchedUnsubscribeRequest = z.infer<typeof PatchedUnsubscribeRequestSchema>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for SendCampaignRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for sending campaign.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for sending campaign.
|
|
11
|
+
*/
|
|
12
|
+
export const SendCampaignRequestSchema = z.object({
|
|
13
|
+
campaign_id: z.int(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type SendCampaignRequest = z.infer<typeof SendCampaignRequestSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for SendCampaignResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for sending campaign.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Response for sending campaign.
|
|
11
|
+
*/
|
|
12
|
+
export const SendCampaignResponseSchema = z.object({
|
|
13
|
+
success: z.boolean(),
|
|
14
|
+
message: z.string().optional(),
|
|
15
|
+
sent_count: z.int().optional(),
|
|
16
|
+
error: z.string().optional(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type SendCampaignResponse = z.infer<typeof SendCampaignResponseSchema>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for SubscribeRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for newsletter subscription.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for newsletter subscription.
|
|
11
|
+
*/
|
|
12
|
+
export const SubscribeRequestSchema = z.object({
|
|
13
|
+
newsletter_id: z.int(),
|
|
14
|
+
email: z.email(),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Infer TypeScript type from Zod schema
|
|
19
|
+
*/
|
|
20
|
+
export type SubscribeRequest = z.infer<typeof SubscribeRequestSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for SubscribeResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for subscription.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Response for subscription.
|
|
11
|
+
*/
|
|
12
|
+
export const SubscribeResponseSchema = z.object({
|
|
13
|
+
success: z.boolean(),
|
|
14
|
+
message: z.string(),
|
|
15
|
+
subscription_id: z.int().optional(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type SubscribeResponse = z.infer<typeof SubscribeResponseSchema>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for SuccessResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Generic success response.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generic success response.
|
|
11
|
+
*/
|
|
12
|
+
export const SuccessResponseSchema = z.object({
|
|
13
|
+
success: z.boolean(),
|
|
14
|
+
message: z.string(),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Infer TypeScript type from Zod schema
|
|
19
|
+
*/
|
|
20
|
+
export type SuccessResponse = z.infer<typeof SuccessResponseSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TestEmailRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for test email.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for test email.
|
|
11
|
+
*/
|
|
12
|
+
export const TestEmailRequestSchema = z.object({
|
|
13
|
+
email: z.email(),
|
|
14
|
+
subject: z.string().min(1).max(255).optional(),
|
|
15
|
+
message: z.string().min(1).optional(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type TestEmailRequest = z.infer<typeof TestEmailRequestSchema>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for Unsubscribe
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Simple serializer for unsubscribe.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Simple serializer for unsubscribe.
|
|
11
|
+
*/
|
|
12
|
+
export const UnsubscribeSchema = z.object({
|
|
13
|
+
subscription_id: z.int(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Infer TypeScript type from Zod schema
|
|
18
|
+
*/
|
|
19
|
+
export type Unsubscribe = z.infer<typeof UnsubscribeSchema>
|