hazo_notify 1.0.0 → 1.0.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/emailer/emailer.d.ts +19 -0
- package/dist/emailer/emailer.d.ts.map +1 -0
- package/dist/emailer/emailer.js +224 -0
- package/dist/emailer/emailer.js.map +1 -0
- package/{src/lib/emailer/index.ts → dist/emailer/index.d.ts} +1 -1
- package/dist/emailer/index.d.ts.map +1 -0
- package/dist/emailer/index.js +34 -0
- package/dist/emailer/index.js.map +1 -0
- package/dist/emailer/providers/index.d.ts +15 -0
- package/dist/emailer/providers/index.d.ts.map +1 -0
- package/dist/emailer/providers/index.js +36 -0
- package/dist/emailer/providers/index.js.map +1 -0
- package/dist/emailer/providers/pop3_provider.d.ts +15 -0
- package/dist/emailer/providers/pop3_provider.d.ts.map +1 -0
- package/dist/emailer/providers/pop3_provider.js +29 -0
- package/dist/emailer/providers/pop3_provider.js.map +1 -0
- package/dist/emailer/providers/smtp_provider.d.ts +15 -0
- package/dist/emailer/providers/smtp_provider.d.ts.map +1 -0
- package/dist/emailer/providers/smtp_provider.js +29 -0
- package/dist/emailer/providers/smtp_provider.js.map +1 -0
- package/dist/emailer/providers/zeptomail_provider.d.ts +15 -0
- package/dist/emailer/providers/zeptomail_provider.d.ts.map +1 -0
- package/dist/emailer/providers/zeptomail_provider.js +255 -0
- package/dist/emailer/providers/zeptomail_provider.js.map +1 -0
- package/dist/emailer/types.d.ts +94 -0
- package/dist/emailer/types.d.ts.map +1 -0
- package/dist/emailer/types.js +6 -0
- package/dist/emailer/types.js.map +1 -0
- package/dist/emailer/utils/constants.d.ts +15 -0
- package/dist/emailer/utils/constants.d.ts.map +1 -0
- package/dist/emailer/utils/constants.js +22 -0
- package/dist/emailer/utils/constants.js.map +1 -0
- package/{src/lib/emailer/utils/index.ts → dist/emailer/utils/index.d.ts} +1 -2
- package/dist/emailer/utils/index.d.ts.map +1 -0
- package/dist/emailer/utils/index.js +24 -0
- package/dist/emailer/utils/index.js.map +1 -0
- package/dist/emailer/utils/logger.d.ts +40 -0
- package/dist/emailer/utils/logger.d.ts.map +1 -0
- package/dist/emailer/utils/logger.js +60 -0
- package/dist/emailer/utils/logger.js.map +1 -0
- package/dist/emailer/utils/validation.d.ts +37 -0
- package/dist/emailer/utils/validation.d.ts.map +1 -0
- package/dist/emailer/utils/validation.js +81 -0
- package/dist/emailer/utils/validation.js.map +1 -0
- package/{src/lib/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/emailer/emailer.d.ts +19 -0
- package/dist/lib/emailer/emailer.d.ts.map +1 -0
- package/dist/lib/emailer/emailer.js +220 -0
- package/dist/lib/emailer/emailer.js.map +1 -0
- package/dist/lib/emailer/index.d.ts +11 -0
- package/dist/lib/emailer/index.d.ts.map +1 -0
- package/dist/lib/emailer/index.js +34 -0
- package/dist/lib/emailer/index.js.map +1 -0
- package/dist/lib/emailer/providers/index.d.ts +15 -0
- package/dist/lib/emailer/providers/index.d.ts.map +1 -0
- package/dist/lib/emailer/providers/index.js +36 -0
- package/dist/lib/emailer/providers/index.js.map +1 -0
- package/dist/lib/emailer/providers/pop3_provider.d.ts +15 -0
- package/dist/lib/emailer/providers/pop3_provider.d.ts.map +1 -0
- package/dist/lib/emailer/providers/pop3_provider.js +29 -0
- package/dist/lib/emailer/providers/pop3_provider.js.map +1 -0
- package/dist/lib/emailer/providers/smtp_provider.d.ts +15 -0
- package/dist/lib/emailer/providers/smtp_provider.d.ts.map +1 -0
- package/dist/lib/emailer/providers/smtp_provider.js +29 -0
- package/dist/lib/emailer/providers/smtp_provider.js.map +1 -0
- package/dist/lib/emailer/providers/zeptomail_provider.d.ts +15 -0
- package/dist/lib/emailer/providers/zeptomail_provider.d.ts.map +1 -0
- package/dist/lib/emailer/providers/zeptomail_provider.js +250 -0
- package/dist/lib/emailer/providers/zeptomail_provider.js.map +1 -0
- package/dist/lib/emailer/types.d.ts +94 -0
- package/dist/lib/emailer/types.d.ts.map +1 -0
- package/dist/lib/emailer/types.js +6 -0
- package/dist/lib/emailer/types.js.map +1 -0
- package/dist/lib/emailer/utils/constants.d.ts +14 -0
- package/dist/lib/emailer/utils/constants.d.ts.map +1 -0
- package/dist/lib/emailer/utils/constants.js +22 -0
- package/dist/lib/emailer/utils/constants.js.map +1 -0
- package/dist/lib/emailer/utils/index.d.ts +8 -0
- package/dist/lib/emailer/utils/index.d.ts.map +1 -0
- package/dist/lib/emailer/utils/index.js +24 -0
- package/dist/lib/emailer/utils/index.js.map +1 -0
- package/dist/lib/emailer/utils/logger.d.ts +37 -0
- package/dist/lib/emailer/utils/logger.d.ts.map +1 -0
- package/dist/lib/emailer/utils/logger.js +60 -0
- package/dist/lib/emailer/utils/logger.js.map +1 -0
- package/dist/lib/emailer/utils/validation.d.ts +37 -0
- package/dist/lib/emailer/utils/validation.d.ts.map +1 -0
- package/dist/lib/emailer/utils/validation.js +81 -0
- package/dist/lib/emailer/utils/validation.js.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +22 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +18 -0
- package/dist/utils.js.map +1 -0
- package/package.json +23 -7
- package/.cursor/rules/db_schema.mdc +0 -0
- package/.cursor/rules/design.mdc +0 -16
- package/.cursor/rules/general.mdc +0 -49
- package/components/emailer-html-editor.tsx +0 -94
- package/components/ui/button.tsx +0 -53
- package/components/ui/card.tsx +0 -78
- package/components/ui/input.tsx +0 -24
- package/components/ui/label.tsx +0 -21
- package/components/ui/sidebar.tsx +0 -121
- package/components/ui/spinner.tsx +0 -54
- package/components/ui/textarea.tsx +0 -23
- package/components/ui/tooltip.tsx +0 -30
- package/components.json +0 -20
- package/jest.config.js +0 -27
- package/jest.setup.js +0 -1
- package/next.config.js +0 -22
- package/postcss.config.js +0 -6
- package/src/app/api/hazo_notify/emailer/send/__tests__/route.test.ts +0 -227
- package/src/app/api/hazo_notify/emailer/send/route.ts +0 -537
- package/src/app/editor-00/page.tsx +0 -47
- package/src/app/globals.css +0 -69
- package/src/app/hazo_notify/emailer_test/layout.tsx +0 -53
- package/src/app/hazo_notify/emailer_test/page.tsx +0 -369
- package/src/app/hazo_notify/layout.tsx +0 -77
- package/src/app/hazo_notify/page.tsx +0 -12
- package/src/app/layout.tsx +0 -26
- package/src/app/page.tsx +0 -14
- package/src/components/blocks/editor-00/editor.tsx +0 -61
- package/src/components/blocks/editor-00/nodes.ts +0 -11
- package/src/components/blocks/editor-00/plugins.tsx +0 -36
- package/src/components/editor/editor-ui/content-editable.tsx +0 -34
- package/src/components/editor/themes/editor-theme.css +0 -91
- package/src/components/editor/themes/editor-theme.ts +0 -130
- package/src/components/ui/button.tsx +0 -53
- package/src/components/ui/card.tsx +0 -78
- package/src/components/ui/input.tsx +0 -24
- package/src/components/ui/label.tsx +0 -21
- package/src/components/ui/sidebar.tsx +0 -121
- package/src/components/ui/spinner.tsx +0 -54
- package/src/components/ui/textarea.tsx +0 -23
- package/src/components/ui/tooltip.tsx +0 -30
- package/src/lib/emailer/__tests__/emailer.test.ts +0 -200
- package/src/lib/emailer/emailer.ts +0 -263
- package/src/lib/emailer/providers/__tests__/zeptomail_provider.test.ts +0 -196
- package/src/lib/emailer/providers/index.ts +0 -33
- package/src/lib/emailer/providers/pop3_provider.ts +0 -30
- package/src/lib/emailer/providers/smtp_provider.ts +0 -30
- package/src/lib/emailer/providers/zeptomail_provider.ts +0 -299
- package/src/lib/emailer/types.ts +0 -119
- package/src/lib/emailer/utils/constants.ts +0 -24
- package/src/lib/emailer/utils/logger.ts +0 -71
- package/src/lib/emailer/utils/validation.ts +0 -84
- package/src/lib/utils.ts +0 -6
- package/tailwind.config.ts +0 -65
- package/tsconfig.json +0 -27
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cn } from "@/lib/utils"
|
|
3
|
-
|
|
4
|
-
interface SidebarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
children: React.ReactNode
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
9
|
-
({ className, children, ...props }, ref) => (
|
|
10
|
-
<div
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
"flex h-screen w-64 flex-col border-r bg-card text-card-foreground",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
)
|
|
22
|
-
Sidebar.displayName = "Sidebar"
|
|
23
|
-
|
|
24
|
-
const SidebarHeader = React.forwardRef<
|
|
25
|
-
HTMLDivElement,
|
|
26
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
27
|
-
>(({ className, ...props }, ref) => (
|
|
28
|
-
<div
|
|
29
|
-
ref={ref}
|
|
30
|
-
className={cn("flex h-16 items-center border-b px-6", className)}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
))
|
|
34
|
-
SidebarHeader.displayName = "SidebarHeader"
|
|
35
|
-
|
|
36
|
-
const SidebarContent = React.forwardRef<
|
|
37
|
-
HTMLDivElement,
|
|
38
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
39
|
-
>(({ className, ...props }, ref) => (
|
|
40
|
-
<div
|
|
41
|
-
ref={ref}
|
|
42
|
-
className={cn("flex-1 overflow-y-auto px-4 py-4", className)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
))
|
|
46
|
-
SidebarContent.displayName = "SidebarContent"
|
|
47
|
-
|
|
48
|
-
const SidebarFooter = React.forwardRef<
|
|
49
|
-
HTMLDivElement,
|
|
50
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
51
|
-
>(({ className, ...props }, ref) => (
|
|
52
|
-
<div
|
|
53
|
-
ref={ref}
|
|
54
|
-
className={cn("border-t px-4 py-4", className)}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
))
|
|
58
|
-
SidebarFooter.displayName = "SidebarFooter"
|
|
59
|
-
|
|
60
|
-
const SidebarNav = React.forwardRef<
|
|
61
|
-
HTMLNavElement,
|
|
62
|
-
React.HTMLAttributes<HTMLNavElement>
|
|
63
|
-
>(({ className, ...props }, ref) => (
|
|
64
|
-
<nav
|
|
65
|
-
ref={ref}
|
|
66
|
-
className={cn("space-y-1", className)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
))
|
|
70
|
-
SidebarNav.displayName = "SidebarNav"
|
|
71
|
-
|
|
72
|
-
const SidebarNavItem = React.forwardRef<
|
|
73
|
-
HTMLLIElement,
|
|
74
|
-
React.HTMLAttributes<HTMLLIElement>
|
|
75
|
-
>(({ className, ...props }, ref) => (
|
|
76
|
-
<li
|
|
77
|
-
ref={ref}
|
|
78
|
-
className={cn("", className)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
))
|
|
82
|
-
SidebarNavItem.displayName = "SidebarNavItem"
|
|
83
|
-
|
|
84
|
-
interface SidebarNavLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
85
|
-
active?: boolean
|
|
86
|
-
asChild?: boolean
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const SidebarNavLink = React.forwardRef<HTMLAnchorElement, SidebarNavLinkProps>(
|
|
90
|
-
({ className, active, asChild, children, ...props }, ref) => {
|
|
91
|
-
if (asChild) {
|
|
92
|
-
return <>{children}</>;
|
|
93
|
-
}
|
|
94
|
-
return (
|
|
95
|
-
<a
|
|
96
|
-
ref={ref}
|
|
97
|
-
className={cn(
|
|
98
|
-
"flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors",
|
|
99
|
-
active
|
|
100
|
-
? "bg-accent text-accent-foreground"
|
|
101
|
-
: "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
102
|
-
className
|
|
103
|
-
)}
|
|
104
|
-
{...props}
|
|
105
|
-
>
|
|
106
|
-
{children}
|
|
107
|
-
</a>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
SidebarNavLink.displayName = "SidebarNavLink"
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
Sidebar,
|
|
115
|
-
SidebarHeader,
|
|
116
|
-
SidebarContent,
|
|
117
|
-
SidebarFooter,
|
|
118
|
-
SidebarNav,
|
|
119
|
-
SidebarNavItem,
|
|
120
|
-
SidebarNavLink,
|
|
121
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cn } from "@/lib/utils"
|
|
3
|
-
|
|
4
|
-
export interface SpinnerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
size?: "sm" | "md" | "lg"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
|
|
9
|
-
({ className, size = "md", ...props }, ref) => {
|
|
10
|
-
const size_classes = {
|
|
11
|
-
sm: "h-4 w-4",
|
|
12
|
-
md: "h-8 w-8",
|
|
13
|
-
lg: "h-12 w-12",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn("inline-block", className)}
|
|
20
|
-
{...props}
|
|
21
|
-
role="status"
|
|
22
|
-
aria-label="Loading"
|
|
23
|
-
>
|
|
24
|
-
<svg
|
|
25
|
-
className={cn(
|
|
26
|
-
"animate-spin text-primary",
|
|
27
|
-
size_classes[size]
|
|
28
|
-
)}
|
|
29
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
-
fill="none"
|
|
31
|
-
viewBox="0 0 24 24"
|
|
32
|
-
>
|
|
33
|
-
<circle
|
|
34
|
-
className="opacity-25"
|
|
35
|
-
cx="12"
|
|
36
|
-
cy="12"
|
|
37
|
-
r="10"
|
|
38
|
-
stroke="currentColor"
|
|
39
|
-
strokeWidth="4"
|
|
40
|
-
/>
|
|
41
|
-
<path
|
|
42
|
-
className="opacity-75"
|
|
43
|
-
fill="currentColor"
|
|
44
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
45
|
-
/>
|
|
46
|
-
</svg>
|
|
47
|
-
<span className="sr-only">Loading...</span>
|
|
48
|
-
</div>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
Spinner.displayName = "Spinner"
|
|
53
|
-
|
|
54
|
-
export { Spinner }
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cn } from "@/lib/utils"
|
|
3
|
-
|
|
4
|
-
export interface TextareaProps
|
|
5
|
-
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
|
6
|
-
|
|
7
|
-
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
8
|
-
({ className, ...props }, ref) => {
|
|
9
|
-
return (
|
|
10
|
-
<textarea
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
-
className
|
|
14
|
-
)}
|
|
15
|
-
ref={ref}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
Textarea.displayName = "Textarea"
|
|
22
|
-
|
|
23
|
-
export { Textarea }
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
const TooltipProvider = TooltipPrimitive.Provider
|
|
9
|
-
|
|
10
|
-
const Tooltip = TooltipPrimitive.Root
|
|
11
|
-
|
|
12
|
-
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
13
|
-
|
|
14
|
-
const TooltipContent = React.forwardRef<
|
|
15
|
-
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
16
|
-
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
17
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
18
|
-
<TooltipPrimitive.Content
|
|
19
|
-
ref={ref}
|
|
20
|
-
sideOffset={sideOffset}
|
|
21
|
-
className={cn(
|
|
22
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
23
|
-
className
|
|
24
|
-
)}
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
))
|
|
28
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
|
29
|
-
|
|
30
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
package/components.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "default",
|
|
4
|
-
"rsc": true,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "tailwind.config.ts",
|
|
8
|
-
"css": "src/app/globals.css",
|
|
9
|
-
"baseColor": "slate",
|
|
10
|
-
"cssVariables": true,
|
|
11
|
-
"prefix": ""
|
|
12
|
-
},
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "@/components",
|
|
15
|
-
"utils": "@/lib/utils",
|
|
16
|
-
"ui": "@/components/ui",
|
|
17
|
-
"lib": "@/lib",
|
|
18
|
-
"hooks": "@/hooks"
|
|
19
|
-
}
|
|
20
|
-
}
|
package/jest.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const nextJest = require('next/jest');
|
|
2
|
-
|
|
3
|
-
const createJestConfig = nextJest({
|
|
4
|
-
dir: './',
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
const customJestConfig = {
|
|
8
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
9
|
-
testEnvironment: 'jest-environment-jsdom',
|
|
10
|
-
moduleNameMapper: {
|
|
11
|
-
'^@/(.*)$': '<rootDir>/src/$1',
|
|
12
|
-
'^@/components/(.*)$': '<rootDir>/components/$1',
|
|
13
|
-
},
|
|
14
|
-
collectCoverageFrom: [
|
|
15
|
-
'src/**/*.{js,jsx,ts,tsx}',
|
|
16
|
-
'!src/**/*.d.ts',
|
|
17
|
-
'!src/**/*.stories.{js,jsx,ts,tsx}',
|
|
18
|
-
'!src/**/__tests__/**',
|
|
19
|
-
'!src/app/**',
|
|
20
|
-
],
|
|
21
|
-
testMatch: [
|
|
22
|
-
'**/__tests__/**/*.test.[jt]s?(x)',
|
|
23
|
-
'**/?(*.)+(spec|test).[jt]s?(x)',
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports = createJestConfig(customJestConfig);
|
package/jest.setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
package/next.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** @type {import('next').NextConfig} */
|
|
2
|
-
const nextConfig = {
|
|
3
|
-
reactStrictMode: true,
|
|
4
|
-
typescript: {
|
|
5
|
-
ignoreBuildErrors: false,
|
|
6
|
-
},
|
|
7
|
-
eslint: {
|
|
8
|
-
ignoreDuringBuilds: false,
|
|
9
|
-
},
|
|
10
|
-
webpack: (config, { isServer }) => {
|
|
11
|
-
if (isServer) {
|
|
12
|
-
// Externalize isomorphic-dompurify for server-side rendering
|
|
13
|
-
config.externals = config.externals || [];
|
|
14
|
-
config.externals.push({
|
|
15
|
-
'isomorphic-dompurify': 'commonjs isomorphic-dompurify',
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return config;
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
module.exports = nextConfig;
|
package/postcss.config.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration tests for emailer API route
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { POST } from '../../route';
|
|
6
|
-
import { NextRequest } from 'next/server';
|
|
7
|
-
|
|
8
|
-
// Mock the emailer service
|
|
9
|
-
jest.mock('@/lib/emailer', () => ({
|
|
10
|
-
send_email: jest.fn(),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
import { send_email } from '@/lib/emailer';
|
|
14
|
-
|
|
15
|
-
describe('POST /api/hazo_notify/emailer/send', () => {
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
jest.clearAllMocks();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should send email successfully', async () => {
|
|
21
|
-
(send_email as jest.Mock).mockResolvedValueOnce({
|
|
22
|
-
success: true,
|
|
23
|
-
message_id: 'test_message_id',
|
|
24
|
-
message: 'Email sent successfully',
|
|
25
|
-
raw_response: {
|
|
26
|
-
status: 200,
|
|
27
|
-
body: {
|
|
28
|
-
data: {
|
|
29
|
-
message_id: 'test_message_id',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const request_body = {
|
|
36
|
-
to: 'recipient@example.com',
|
|
37
|
-
subject: 'Test Subject',
|
|
38
|
-
content: {
|
|
39
|
-
text: 'Test email content',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Create a mock Request object
|
|
44
|
-
const request = new Request('http://localhost/api/hazo_notify/emailer/send', {
|
|
45
|
-
method: 'POST',
|
|
46
|
-
body: JSON.stringify(request_body),
|
|
47
|
-
headers: {
|
|
48
|
-
'Content-Type': 'application/json',
|
|
49
|
-
},
|
|
50
|
-
}) as NextRequest;
|
|
51
|
-
|
|
52
|
-
const response = await POST(request);
|
|
53
|
-
const data = await response.json();
|
|
54
|
-
|
|
55
|
-
expect(response.status).toBe(200);
|
|
56
|
-
expect(data.success).toBe(true);
|
|
57
|
-
expect(data.message_id).toBe('test_message_id');
|
|
58
|
-
expect(send_email).toHaveBeenCalledTimes(1);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should validate required fields', async () => {
|
|
62
|
-
const request_body = {
|
|
63
|
-
to: '',
|
|
64
|
-
subject: 'Test Subject',
|
|
65
|
-
content: {
|
|
66
|
-
text: 'Test email content',
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// Create a mock Request object
|
|
71
|
-
const request = new Request('http://localhost/api/hazo_notify/emailer/send', {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
body: JSON.stringify(request_body),
|
|
74
|
-
headers: {
|
|
75
|
-
'Content-Type': 'application/json',
|
|
76
|
-
},
|
|
77
|
-
}) as NextRequest;
|
|
78
|
-
|
|
79
|
-
const response = await POST(request);
|
|
80
|
-
const data = await response.json();
|
|
81
|
-
|
|
82
|
-
expect(response.status).toBe(400);
|
|
83
|
-
expect(data.success).toBe(false);
|
|
84
|
-
expect(data.error).toContain('Recipient email address');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should handle email sending failure', async () => {
|
|
88
|
-
(send_email as jest.Mock).mockResolvedValueOnce({
|
|
89
|
-
success: false,
|
|
90
|
-
error: 'Failed to send email',
|
|
91
|
-
message: 'Failed to send email',
|
|
92
|
-
raw_response: {
|
|
93
|
-
status: 500,
|
|
94
|
-
body: {
|
|
95
|
-
error: 'Failed to send email',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const request_body = {
|
|
101
|
-
to: 'recipient@example.com',
|
|
102
|
-
subject: 'Test Subject',
|
|
103
|
-
content: {
|
|
104
|
-
text: 'Test email content',
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// Create a mock Request object
|
|
109
|
-
const request = new Request('http://localhost/api/hazo_notify/emailer/send', {
|
|
110
|
-
method: 'POST',
|
|
111
|
-
body: JSON.stringify(request_body),
|
|
112
|
-
headers: {
|
|
113
|
-
'Content-Type': 'application/json',
|
|
114
|
-
},
|
|
115
|
-
}) as NextRequest;
|
|
116
|
-
|
|
117
|
-
const response = await POST(request);
|
|
118
|
-
const data = await response.json();
|
|
119
|
-
|
|
120
|
-
expect(response.status).toBe(500);
|
|
121
|
-
expect(data.success).toBe(false);
|
|
122
|
-
expect(data.error).toBe('Failed to send email');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('should support HTML email content', async () => {
|
|
126
|
-
(send_email as jest.Mock).mockResolvedValueOnce({
|
|
127
|
-
success: true,
|
|
128
|
-
message_id: 'test_message_id',
|
|
129
|
-
message: 'Email sent successfully',
|
|
130
|
-
raw_response: {
|
|
131
|
-
status: 200,
|
|
132
|
-
body: {
|
|
133
|
-
data: {
|
|
134
|
-
message_id: 'test_message_id',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const request_body = {
|
|
141
|
-
to: 'recipient@example.com',
|
|
142
|
-
subject: 'Test Subject',
|
|
143
|
-
content: {
|
|
144
|
-
html: '<h1>Test HTML Email</h1>',
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// Create a mock Request object
|
|
149
|
-
const request = new Request('http://localhost/api/hazo_notify/emailer/send', {
|
|
150
|
-
method: 'POST',
|
|
151
|
-
body: JSON.stringify(request_body),
|
|
152
|
-
headers: {
|
|
153
|
-
'Content-Type': 'application/json',
|
|
154
|
-
},
|
|
155
|
-
}) as NextRequest;
|
|
156
|
-
|
|
157
|
-
const response = await POST(request);
|
|
158
|
-
const data = await response.json();
|
|
159
|
-
|
|
160
|
-
expect(response.status).toBe(200);
|
|
161
|
-
expect(data.success).toBe(true);
|
|
162
|
-
expect(send_email).toHaveBeenCalledWith(
|
|
163
|
-
expect.objectContaining({
|
|
164
|
-
content: {
|
|
165
|
-
html: '<h1>Test HTML Email</h1>',
|
|
166
|
-
},
|
|
167
|
-
})
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('should support attachments', async () => {
|
|
172
|
-
(send_email as jest.Mock).mockResolvedValueOnce({
|
|
173
|
-
success: true,
|
|
174
|
-
message_id: 'test_message_id',
|
|
175
|
-
message: 'Email sent successfully',
|
|
176
|
-
raw_response: {
|
|
177
|
-
status: 200,
|
|
178
|
-
body: {
|
|
179
|
-
data: {
|
|
180
|
-
message_id: 'test_message_id',
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const request_body = {
|
|
187
|
-
to: 'recipient@example.com',
|
|
188
|
-
subject: 'Test Subject',
|
|
189
|
-
content: {
|
|
190
|
-
text: 'Test email content',
|
|
191
|
-
},
|
|
192
|
-
attachments: [
|
|
193
|
-
{
|
|
194
|
-
filename: 'test.txt',
|
|
195
|
-
content: 'dGVzdCBjb250ZW50',
|
|
196
|
-
mime_type: 'text/plain',
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// Create a mock Request object
|
|
202
|
-
const request = new Request('http://localhost/api/hazo_notify/emailer/send', {
|
|
203
|
-
method: 'POST',
|
|
204
|
-
body: JSON.stringify(request_body),
|
|
205
|
-
headers: {
|
|
206
|
-
'Content-Type': 'application/json',
|
|
207
|
-
},
|
|
208
|
-
}) as NextRequest;
|
|
209
|
-
|
|
210
|
-
const response = await POST(request);
|
|
211
|
-
const data = await response.json();
|
|
212
|
-
|
|
213
|
-
expect(response.status).toBe(200);
|
|
214
|
-
expect(data.success).toBe(true);
|
|
215
|
-
expect(send_email).toHaveBeenCalledWith(
|
|
216
|
-
expect.objectContaining({
|
|
217
|
-
attachments: [
|
|
218
|
-
{
|
|
219
|
-
filename: 'test.txt',
|
|
220
|
-
content: 'dGVzdCBjb250ZW50',
|
|
221
|
-
mime_type: 'text/plain',
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
})
|
|
225
|
-
);
|
|
226
|
-
});
|
|
227
|
-
});
|