@vitnode/core 1.2.0-canary.59 → 1.2.0-canary.61

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 (283) hide show
  1. package/dist/scripts/get-config.js +15 -0
  2. package/dist/scripts/plugin.js +188 -0
  3. package/dist/scripts/prepare-database.js +177 -0
  4. package/dist/scripts/prepare-plugins-files.js +134 -0
  5. package/dist/scripts/run-interactive-shell-command.js +21 -0
  6. package/dist/scripts/scripts.js +39 -13
  7. package/dist/scripts/shared/file-utils.js +203 -0
  8. package/dist/src/api/adapters/sso/discord.js +1 -77
  9. package/dist/src/api/adapters/sso/facebook.js +1 -76
  10. package/dist/src/api/adapters/sso/google.js +1 -87
  11. package/dist/src/api/config.js +1 -67
  12. package/dist/src/api/lib/check-plugin-id.js +1 -43
  13. package/dist/src/api/lib/cron.js +1 -22
  14. package/dist/src/api/lib/logger-middleware.js +1 -35
  15. package/dist/src/api/lib/module.js +1 -22
  16. package/dist/src/api/lib/plugin.js +1 -22
  17. package/dist/src/api/lib/route.js +1 -27
  18. package/dist/src/api/lib/with-pagination.js +1 -83
  19. package/dist/src/api/middlewares/captcha.middleware.js +1 -63
  20. package/dist/src/api/middlewares/cron-auth.middleware.js +1 -19
  21. package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
  22. package/dist/src/api/middlewares/global.middleware.js +1 -104
  23. package/dist/src/api/middlewares/rate-limiter.middleware.js +1 -32
  24. package/dist/src/api/models/device.js +1 -61
  25. package/dist/src/api/models/email.d.ts.map +1 -1
  26. package/dist/src/api/models/email.js +1 -77
  27. package/dist/src/api/models/password.js +1 -36
  28. package/dist/src/api/models/session-admin.d.ts.map +1 -1
  29. package/dist/src/api/models/session-admin.js +1 -97
  30. package/dist/src/api/models/session.d.ts.map +1 -1
  31. package/dist/src/api/models/session.js +1 -76
  32. package/dist/src/api/models/sso.js +1 -120
  33. package/dist/src/api/models/user/get-user-by-id.js +1 -19
  34. package/dist/src/api/models/user/sign-in-with-passwords.js +1 -22
  35. package/dist/src/api/models/user/sign-up.js +1 -73
  36. package/dist/src/api/models/user.js +1 -8
  37. package/dist/src/api/modules/admin/admin.module.js +1 -19
  38. package/dist/src/api/modules/admin/advanced/advanced.admin.module.js +1 -11
  39. package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.js +1 -12
  40. package/dist/src/api/modules/admin/advanced/cron/routes/get.route.js +1 -66
  41. package/dist/src/api/modules/admin/advanced/cron/routes/run.route.js +1 -95
  42. package/dist/src/api/modules/admin/debug/debug.admin.module.js +1 -10
  43. package/dist/src/api/modules/admin/debug/routes/logs.route.js +1 -94
  44. package/dist/src/api/modules/admin/routes/session.route.js +1 -47
  45. package/dist/src/api/modules/admin/users/routes/list.route.js +1 -79
  46. package/dist/src/api/modules/admin/users/routes/users.route.js +1 -84
  47. package/dist/src/api/modules/admin/users/users.admin.module.js +1 -10
  48. package/dist/src/api/modules/cron/cron/clean.cron.js +1 -24
  49. package/dist/src/api/modules/cron/cron.module.js +1 -14
  50. package/dist/src/api/modules/cron/helpers/process-cron-jobs.d.ts.map +1 -1
  51. package/dist/src/api/modules/cron/helpers/process-cron-jobs.js +1 -72
  52. package/dist/src/api/modules/cron/routes/cron.route.d.ts.map +1 -1
  53. package/dist/src/api/modules/cron/routes/cron.route.js +1 -95
  54. package/dist/src/api/modules/middleware/middleware.module.js +1 -10
  55. package/dist/src/api/modules/middleware/route.js +1 -49
  56. package/dist/src/api/modules/users/avatar-color.js +1 -43
  57. package/dist/src/api/modules/users/routes/change-password.route.js +1 -58
  58. package/dist/src/api/modules/users/routes/reset-passowrd.route.js +1 -91
  59. package/dist/src/api/modules/users/routes/session.route.js +1 -46
  60. package/dist/src/api/modules/users/routes/sign-in.route.js +1 -71
  61. package/dist/src/api/modules/users/routes/sign-out.route.js +1 -43
  62. package/dist/src/api/modules/users/routes/sign-up.route.js +1 -77
  63. package/dist/src/api/modules/users/routes/test.route.js +1 -33
  64. package/dist/src/api/modules/users/sso/routes/callback.route.js +1 -52
  65. package/dist/src/api/modules/users/sso/routes/create-url.route.js +1 -36
  66. package/dist/src/api/modules/users/sso/sso.module.js +1 -12
  67. package/dist/src/api/modules/users/users.module.js +1 -26
  68. package/dist/src/api/plugin.js +1 -15
  69. package/dist/src/app/login/page.js +1 -16
  70. package/dist/src/app/login/reset-password/page.js +1 -18
  71. package/dist/src/app/login/sso/[providerId]/page.js +1 -10
  72. package/dist/src/app/register/page.js +1 -16
  73. package/dist/src/app_admin/core/advanced/cron/page.js +1 -42
  74. package/dist/src/app_admin/core/debug/page.js +1 -45
  75. package/dist/src/app_admin/core/page.js +1 -5
  76. package/dist/src/app_admin/core/test/page.js +1 -5
  77. package/dist/src/app_admin/core/users/page.js +1 -38
  78. package/dist/src/components/avatar.js +1 -14
  79. package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +1 -42
  80. package/dist/src/components/confirm-action/content.js +1 -31
  81. package/dist/src/components/date-format.js +1 -41
  82. package/dist/src/components/form/auto-form.js +1 -103
  83. package/dist/src/components/form/common/desc.js +1 -9
  84. package/dist/src/components/form/common/label.js +1 -18
  85. package/dist/src/components/form/fields/checkbox.js +1 -37
  86. package/dist/src/components/form/fields/combobox-async.js +1 -123
  87. package/dist/src/components/form/fields/combobox.js +1 -87
  88. package/dist/src/components/form/fields/input.js +1 -39
  89. package/dist/src/components/form/fields/radio-group.js +1 -50
  90. package/dist/src/components/form/fields/select.js +1 -58
  91. package/dist/src/components/form/fields/switch.js +1 -36
  92. package/dist/src/components/form/fields/textarea.js +1 -36
  93. package/dist/src/components/i18n-provider.js +1 -43
  94. package/dist/src/components/logo-vitnode.js +1 -119
  95. package/dist/src/components/switchers/langs/language-switcher.js +1 -47
  96. package/dist/src/components/switchers/themes/theme-switcher.js +1 -28
  97. package/dist/src/components/table/content.js +1 -81
  98. package/dist/src/components/table/data-table.js +1 -68
  99. package/dist/src/components/table/order-table-head.js +1 -50
  100. package/dist/src/components/table/pagination.js +1 -122
  101. package/dist/src/components/tiptap/extension.js +1 -33
  102. package/dist/src/components/tiptap/toolbar/actions/alignment-action.js +1 -91
  103. package/dist/src/components/tiptap/toolbar/actions/bold-action.js +1 -39
  104. package/dist/src/components/tiptap/toolbar/actions/headings-action.js +1 -93
  105. package/dist/src/components/tiptap/toolbar/actions/italic-action.js +1 -38
  106. package/dist/src/components/tiptap/toolbar/actions/list-action.js +1 -61
  107. package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.js +1 -59
  108. package/dist/src/components/tiptap/toolbar/actions/underline-action.js +1 -38
  109. package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.js +1 -63
  110. package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.js +1 -11
  111. package/dist/src/components/tiptap/toolbar/tiptap-toolbar.js +1 -55
  112. package/dist/src/components/tiptap/toolbar/use-toolbar-editor.js +1 -5
  113. package/dist/src/components/ui/accordion.js +1 -46
  114. package/dist/src/components/ui/alert-dialog.js +1 -123
  115. package/dist/src/components/ui/alert.js +1 -39
  116. package/dist/src/components/ui/badge.js +1 -28
  117. package/dist/src/components/ui/button-client.js +1 -57
  118. package/dist/src/components/ui/button.js +1 -32
  119. package/dist/src/components/ui/card.js +1 -52
  120. package/dist/src/components/ui/checkbox.js +1 -20
  121. package/dist/src/components/ui/collapsible.js +1 -22
  122. package/dist/src/components/ui/command.js +1 -98
  123. package/dist/src/components/ui/context-menu.js +1 -140
  124. package/dist/src/components/ui/dialog.js +1 -189
  125. package/dist/src/components/ui/drawer.js +1 -83
  126. package/dist/src/components/ui/dropdown-menu.js +1 -141
  127. package/dist/src/components/ui/editor-content.js +1 -10
  128. package/dist/src/components/ui/editor.js +1 -35
  129. package/dist/src/components/ui/form.js +1 -148
  130. package/dist/src/components/ui/header-content.js +1 -30
  131. package/dist/src/components/ui/hover-card.js +1 -29
  132. package/dist/src/components/ui/input-otp.js +1 -48
  133. package/dist/src/components/ui/input.js +1 -11
  134. package/dist/src/components/ui/label.js +1 -12
  135. package/dist/src/components/ui/loader.js +1 -16
  136. package/dist/src/components/ui/menubar.js +1 -151
  137. package/dist/src/components/ui/navigation-menu.js +1 -82
  138. package/dist/src/components/ui/popover.js +1 -35
  139. package/dist/src/components/ui/progress.js +1 -19
  140. package/dist/src/components/ui/radio-group.js +1 -27
  141. package/dist/src/components/ui/scroll-area.js +1 -33
  142. package/dist/src/components/ui/select.js +1 -113
  143. package/dist/src/components/ui/separator.js +1 -14
  144. package/dist/src/components/ui/sheet.js +1 -92
  145. package/dist/src/components/ui/sidebar.js +1 -433
  146. package/dist/src/components/ui/skeleton.js +1 -10
  147. package/dist/src/components/ui/slider.js +1 -50
  148. package/dist/src/components/ui/sonner.js +1 -26
  149. package/dist/src/components/ui/switch.js +1 -16
  150. package/dist/src/components/ui/table.js +1 -63
  151. package/dist/src/components/ui/tabs.js +1 -33
  152. package/dist/src/components/ui/textarea.js +1 -10
  153. package/dist/src/components/ui/toggle-group.js +1 -45
  154. package/dist/src/components/ui/toggle.js +1 -34
  155. package/dist/src/components/ui/tooltip.js +1 -57
  156. package/dist/src/config.js +1 -4
  157. package/dist/src/database/admins.js +1 -74
  158. package/dist/src/database/cron.js +1 -22
  159. package/dist/src/database/languages.js +1 -52
  160. package/dist/src/database/logs.js +1 -34
  161. package/dist/src/database/moderators.js +1 -37
  162. package/dist/src/database/roles.js +1 -13
  163. package/dist/src/database/sessions.js +1 -60
  164. package/dist/src/database/users.js +1 -145
  165. package/dist/src/drizzle.config.js +1 -67
  166. package/dist/src/emails/default-template.js +1 -99
  167. package/dist/src/emails/reset-password.js +1 -132
  168. package/dist/src/emails/ui/button.js +1 -36
  169. package/dist/src/emails/ui/card.js +1 -39
  170. package/dist/src/hooks/use-before-unload.js +1 -30
  171. package/dist/src/hooks/use-captcha.js +1 -122
  172. package/dist/src/hooks/use-mobile.js +1 -16
  173. package/dist/src/lib/api/get-middleware-api.js +1 -13
  174. package/dist/src/lib/api/get-next-cron-run-date.js +1 -14
  175. package/dist/src/lib/api/get-next-cron-run-date.test.js +1 -55
  176. package/dist/src/lib/api/get-session-admin-api.js +1 -19
  177. package/dist/src/lib/api/get-session-api.js +1 -14
  178. package/dist/src/lib/api/should-cron-job-run.js +1 -16
  179. package/dist/src/lib/api/should-cron-job-run.test.js +1 -213
  180. package/dist/src/lib/api/validate-cron-schedule.d.ts +2 -0
  181. package/dist/src/lib/api/validate-cron-schedule.d.ts.map +1 -0
  182. package/dist/src/lib/api/validate-cron-schedule.js +1 -0
  183. package/dist/src/lib/api/validate-cron-schedule.test.d.ts +2 -0
  184. package/dist/src/lib/api/validate-cron-schedule.test.d.ts.map +1 -0
  185. package/dist/src/lib/api/validate-cron-schedule.test.js +1 -0
  186. package/dist/src/lib/colors.js +1 -140
  187. package/dist/src/lib/colors.test.js +1 -173
  188. package/dist/src/lib/config.js +1 -14
  189. package/dist/src/lib/ctrl-or-command-character.js +1 -5
  190. package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -12
  191. package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +1 -78
  192. package/dist/src/lib/fetcher/core.js +3 -48
  193. package/dist/src/lib/fetcher/helpers-server.js +1 -18
  194. package/dist/src/lib/fetcher/helpers.js +1 -16
  195. package/dist/src/lib/fetcher/helpers.test.js +1 -37
  196. package/dist/src/lib/fetcher/types.js +1 -1
  197. package/dist/src/lib/fetcher-client.js +1 -17
  198. package/dist/src/lib/fetcher.js +1 -33
  199. package/dist/src/lib/helpers/auto-form.js +1 -98
  200. package/dist/src/lib/helpers/auto-form.test.js +1 -336
  201. package/dist/src/lib/navigation.d.ts +15 -13
  202. package/dist/src/lib/navigation.d.ts.map +1 -1
  203. package/dist/src/lib/navigation.js +1 -11
  204. package/dist/src/lib/plugin.js +1 -3
  205. package/dist/src/lib/special-characters.js +1 -4
  206. package/dist/src/lib/special-characters.test.js +1 -56
  207. package/dist/src/lib/utils.js +1 -5
  208. package/dist/src/locales/en.json +308 -0
  209. package/dist/src/tests/setup.js +1 -6
  210. package/dist/src/views/admin/layouts/admin-layout.js +1 -73
  211. package/dist/src/views/admin/layouts/sidebar/nav/item.js +1 -98
  212. package/dist/src/views/admin/layouts/sidebar/nav/nav.js +1 -60
  213. package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -28
  214. package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -14
  215. package/dist/src/views/admin/layouts/user-bar/client.js +1 -69
  216. package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -32
  217. package/dist/src/views/admin/sign-in/sign-in-admin-view.js +1 -27
  218. package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.js +1 -97
  219. package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.js +1 -23
  220. package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.js +1 -38
  221. package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +1 -44
  222. package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +1 -35
  223. package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +1 -5
  224. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +1 -281
  225. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +1 -67
  226. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +1 -14
  227. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +1 -30
  228. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +1 -96
  229. package/dist/src/views/admin/views/core/test.js +1 -161
  230. package/dist/src/views/admin/views/core/users/users-admin-view.js +1 -89
  231. package/dist/src/views/auth/password-reset/change-password-form/form.js +1 -48
  232. package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +1 -22
  233. package/dist/src/views/auth/password-reset/change-password-form/use-form.js +1 -36
  234. package/dist/src/views/auth/password-reset/form/form.js +1 -104
  235. package/dist/src/views/auth/password-reset/form/mutation-api.js +1 -21
  236. package/dist/src/views/auth/password-reset/form/use-form.js +1 -33
  237. package/dist/src/views/auth/password-reset/password-reset-view.js +1 -37
  238. package/dist/src/views/auth/sign-in/form/form.js +1 -64
  239. package/dist/src/views/auth/sign-in/form/mutation-api.js +1 -33
  240. package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -1
  241. package/dist/src/views/auth/sign-in/form/use-form.js +1 -38
  242. package/dist/src/views/auth/sign-in/sign-in-view.js +1 -61
  243. package/dist/src/views/auth/sign-up/components/password-input.js +1 -96
  244. package/dist/src/views/auth/sign-up/email-confirmation-view.js +1 -55
  245. package/dist/src/views/auth/sign-up/form/form.js +1 -89
  246. package/dist/src/views/auth/sign-up/form/mutation-api.js +1 -30
  247. package/dist/src/views/auth/sign-up/form/use-form.js +1 -70
  248. package/dist/src/views/auth/sign-up/sign-up-view.js +1 -65
  249. package/dist/src/views/auth/sign-up/wrapper.js +1 -22
  250. package/dist/src/views/auth/sso/buttons/client.js +1 -22
  251. package/dist/src/views/auth/sso/buttons/mutation-api.js +1 -24
  252. package/dist/src/views/auth/sso/buttons/sso-buttons.js +1 -56
  253. package/dist/src/views/auth/sso/callback/callback-sso-view.js +1 -32
  254. package/dist/src/views/auth/sso/callback/client/client.js +1 -68
  255. package/dist/src/views/auth/sso/callback/client/mutation-api.js +1 -32
  256. package/dist/src/views/error/back-button.js +1 -14
  257. package/dist/src/views/error/error-view.js +1 -58
  258. package/dist/src/views/error/global-error-view.js +1 -50
  259. package/dist/src/views/layouts/provider.js +1 -44
  260. package/dist/src/views/layouts/root-layout.js +1 -25
  261. package/dist/src/views/layouts/theme/header/header.js +1 -38
  262. package/dist/src/views/layouts/theme/header/user/auth/auth.js +1 -33
  263. package/dist/src/views/layouts/theme/header/user/auth/client.js +1 -47
  264. package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +1 -27
  265. package/dist/src/views/layouts/theme/header/user/user.js +1 -32
  266. package/dist/src/views/layouts/theme/layout.js +1 -16
  267. package/dist/src/vitnode.config.d.ts.map +1 -1
  268. package/dist/src/vitnode.config.js +1 -42
  269. package/dist/tsconfig.tsbuildinfo +1 -1
  270. package/dist/tsup.config.js +18 -0
  271. package/dist/vitest.config.d.ts.map +1 -1
  272. package/dist/vitest.config.js +49 -0
  273. package/eslint.config.mjs +2 -0
  274. package/package.json +40 -44
  275. package/dist/src/api/adapters/cron/node-cron.adapter.d.ts +0 -3
  276. package/dist/src/api/adapters/cron/node-cron.adapter.d.ts.map +0 -1
  277. package/dist/src/api/adapters/cron/node-cron.adapter.js +0 -11
  278. package/dist/src/api/adapters/email/nodemailer.d.ts +0 -10
  279. package/dist/src/api/adapters/email/nodemailer.d.ts.map +0 -1
  280. package/dist/src/api/adapters/email/nodemailer.js +0 -30
  281. package/dist/src/api/adapters/email/resend.d.ts +0 -6
  282. package/dist/src/api/adapters/email/resend.d.ts.map +0 -1
  283. package/dist/src/api/adapters/email/resend.js +0 -21
@@ -1,145 +1 @@
1
- import { relations } from "drizzle-orm";
2
- import { index, pgTable } from "drizzle-orm/pg-core";
3
- import { core_languages } from "./languages.js";
4
- import { core_roles } from "./roles.js";
5
- export const core_users = pgTable("core_users", (t)=>({
6
- id: t.serial().primaryKey(),
7
- nameCode: t.varchar({
8
- length: 255
9
- }).notNull().unique(),
10
- name: t.varchar({
11
- length: 255
12
- }).notNull().unique(),
13
- email: t.varchar({
14
- length: 255
15
- }).notNull().unique(),
16
- password: t.varchar(),
17
- createdAt: t.timestamp().notNull().defaultNow(),
18
- newsletter: t.boolean().notNull().default(false),
19
- avatarColor: t.varchar({
20
- length: 6
21
- }).notNull(),
22
- emailVerified: t.boolean().notNull().default(false),
23
- roleId: t.integer().references(()=>core_roles.id).notNull(),
24
- birthday: t.timestamp(),
25
- ipAddress: t.varchar({
26
- length: 40
27
- }).notNull(),
28
- language: t.varchar({
29
- length: 32
30
- }).notNull().default("en").references(()=>core_languages.code, {
31
- onDelete: "set default"
32
- })
33
- }), (t)=>[
34
- index("core_users_name_code_idx").on(t.nameCode),
35
- index("core_users_name_idx").on(t.name),
36
- index("core_users_email_idx").on(t.email)
37
- ]).enableRLS();
38
- export const core_users_relations = relations(core_users, ({ one, many })=>({
39
- group: one(core_roles, {
40
- fields: [
41
- core_users.roleId
42
- ],
43
- references: [
44
- core_roles.id
45
- ]
46
- }),
47
- language: one(core_languages, {
48
- fields: [
49
- core_users.language
50
- ],
51
- references: [
52
- core_languages.code
53
- ]
54
- }),
55
- confirm_email: one(core_users_confirm_emails, {
56
- fields: [
57
- core_users.id
58
- ],
59
- references: [
60
- core_users_confirm_emails.userId
61
- ]
62
- }),
63
- sso: many(core_users_sso),
64
- forgot_password: one(core_users_forgot_password, {
65
- fields: [
66
- core_users.id
67
- ],
68
- references: [
69
- core_users_forgot_password.userId
70
- ]
71
- })
72
- }));
73
- export const core_users_sso = pgTable("core_users_sso", (t)=>({
74
- userId: t.integer().references(()=>core_users.id, {
75
- onDelete: "cascade"
76
- }).notNull(),
77
- providerId: t.varchar({
78
- length: 255
79
- }).notNull(),
80
- providerAccountId: t.varchar({
81
- length: 255
82
- }).notNull(),
83
- createdAt: t.timestamp().notNull().defaultNow(),
84
- updatedAt: t.timestamp().notNull().$onUpdate(()=>new Date())
85
- }), (t)=>[
86
- index("core_users_sso_user_id_idx").on(t.userId)
87
- ]).enableRLS();
88
- export const core_users_sso_relations = relations(core_users_sso, ({ one })=>({
89
- user: one(core_users, {
90
- fields: [
91
- core_users_sso.userId
92
- ],
93
- references: [
94
- core_users.id
95
- ]
96
- })
97
- }));
98
- export const core_users_confirm_emails = pgTable("core_users_confirm_emails", (t)=>({
99
- id: t.serial().primaryKey(),
100
- userId: t.integer().references(()=>core_users.id, {
101
- onDelete: "cascade"
102
- }).notNull(),
103
- token: t.varchar({
104
- length: 100
105
- }).notNull().unique(),
106
- createdAt: t.timestamp().notNull().defaultNow(),
107
- expiresAt: t.timestamp().notNull(),
108
- ipAddress: t.varchar({
109
- length: 40
110
- }).notNull()
111
- })).enableRLS();
112
- export const core_users_confirm_emails_relations = relations(core_users_confirm_emails, ({ one })=>({
113
- user: one(core_users, {
114
- fields: [
115
- core_users_confirm_emails.userId
116
- ],
117
- references: [
118
- core_users.id
119
- ]
120
- })
121
- }));
122
- export const core_users_forgot_password = pgTable("core_users_forgot_password", (t)=>({
123
- id: t.serial().primaryKey(),
124
- userId: t.integer().references(()=>core_users.id, {
125
- onDelete: "cascade"
126
- }).notNull().unique(),
127
- token: t.varchar({
128
- length: 100
129
- }).notNull().unique(),
130
- ipAddress: t.varchar({
131
- length: 40
132
- }).notNull(),
133
- createdAt: t.timestamp().notNull().defaultNow(),
134
- expiresAt: t.timestamp().notNull()
135
- })).enableRLS();
136
- export const core_users_forgot_password_relations = relations(core_users_forgot_password, ({ one })=>({
137
- user: one(core_users, {
138
- fields: [
139
- core_users_forgot_password.userId
140
- ],
141
- references: [
142
- core_users.id
143
- ]
144
- })
145
- }));
1
+ import{relations}from"drizzle-orm";import{index,pgTable}from"drizzle-orm/pg-core";import{core_languages}from"./languages.js";import{core_roles}from"./roles.js";export const core_users=pgTable("core_users",t=>({id:t.serial().primaryKey(),nameCode:t.varchar({length:255}).notNull().unique(),name:t.varchar({length:255}).notNull().unique(),email:t.varchar({length:255}).notNull().unique(),password:t.varchar(),createdAt:t.timestamp().notNull().defaultNow(),newsletter:t.boolean().notNull().default(false),avatarColor:t.varchar({length:6}).notNull(),emailVerified:t.boolean().notNull().default(false),roleId:t.integer().references(()=>core_roles.id).notNull(),birthday:t.timestamp(),ipAddress:t.varchar({length:40}).notNull(),language:t.varchar({length:32}).notNull().default("en").references(()=>core_languages.code,{onDelete:"set default"})}),t=>[index("core_users_name_code_idx").on(t.nameCode),index("core_users_name_idx").on(t.name),index("core_users_email_idx").on(t.email)]).enableRLS();export const core_users_relations=relations(core_users,({one,many})=>({group:one(core_roles,{fields:[core_users.roleId],references:[core_roles.id]}),language:one(core_languages,{fields:[core_users.language],references:[core_languages.code]}),confirm_email:one(core_users_confirm_emails,{fields:[core_users.id],references:[core_users_confirm_emails.userId]}),sso:many(core_users_sso),forgot_password:one(core_users_forgot_password,{fields:[core_users.id],references:[core_users_forgot_password.userId]})}));export const core_users_sso=pgTable("core_users_sso",t=>({userId:t.integer().references(()=>core_users.id,{onDelete:"cascade"}).notNull(),providerId:t.varchar({length:255}).notNull(),providerAccountId:t.varchar({length:255}).notNull(),createdAt:t.timestamp().notNull().defaultNow(),updatedAt:t.timestamp().notNull().$onUpdate(()=>new Date)}),t=>[index("core_users_sso_user_id_idx").on(t.userId)]).enableRLS();export const core_users_sso_relations=relations(core_users_sso,({one})=>({user:one(core_users,{fields:[core_users_sso.userId],references:[core_users.id]})}));export const core_users_confirm_emails=pgTable("core_users_confirm_emails",t=>({id:t.serial().primaryKey(),userId:t.integer().references(()=>core_users.id,{onDelete:"cascade"}).notNull(),token:t.varchar({length:100}).notNull().unique(),createdAt:t.timestamp().notNull().defaultNow(),expiresAt:t.timestamp().notNull(),ipAddress:t.varchar({length:40}).notNull()})).enableRLS();export const core_users_confirm_emails_relations=relations(core_users_confirm_emails,({one})=>({user:one(core_users,{fields:[core_users_confirm_emails.userId],references:[core_users.id]})}));export const core_users_forgot_password=pgTable("core_users_forgot_password",t=>({id:t.serial().primaryKey(),userId:t.integer().references(()=>core_users.id,{onDelete:"cascade"}).notNull().unique(),token:t.varchar({length:100}).notNull().unique(),ipAddress:t.varchar({length:40}).notNull(),createdAt:t.timestamp().notNull().defaultNow(),expiresAt:t.timestamp().notNull()})).enableRLS();export const core_users_forgot_password_relations=relations(core_users_forgot_password,({one})=>({user:one(core_users,{fields:[core_users_forgot_password.userId],references:[core_users.id]})}));
@@ -1,67 +1 @@
1
- import { defineConfig } from "drizzle-kit";
2
- import { existsSync, readdirSync } from "node:fs";
3
- import { join, resolve } from "node:path";
4
- export const defineVitNodeDrizzleConfig = ({ vitNodeApiConfig, ...args })=>{
5
- const pluginId = vitNodeApiConfig.plugins.map((plugin)=>plugin.pluginId);
6
- const findMonorepoRoot = (startPath)=>{
7
- let currentPath = startPath;
8
- while(currentPath !== resolve(currentPath, "..")){
9
- const turboConfigPath = join(currentPath, "turbo.json");
10
- if (existsSync(turboConfigPath)) {
11
- return currentPath;
12
- }
13
- currentPath = resolve(currentPath, "..");
14
- }
15
- return null;
16
- };
17
- const checkPluginPath = (basePath, itemId)=>{
18
- const pluginPath = resolve(basePath, "node_modules", itemId, "dist", "src", "database");
19
- // Check if the plugin path exists
20
- if (!existsSync(pluginPath)) {
21
- return null;
22
- }
23
- // Check if there are any .js files in the directory
24
- try {
25
- const files = readdirSync(pluginPath);
26
- const hasSchemaFiles = files.some((file)=>file.endsWith(".js"));
27
- if (!hasSchemaFiles) return null;
28
- // Return glob pattern for schema files
29
- return join(pluginPath, "*.js").replace(/\\/g, "/");
30
- } catch {
31
- return null;
32
- }
33
- };
34
- const cwd = process.cwd();
35
- const monorepoRoot = findMonorepoRoot(cwd);
36
- const pluginPaths = [
37
- "@vitnode/core",
38
- ...pluginId
39
- ].flatMap((itemId)=>{
40
- const paths = [];
41
- // Check in current working directory
42
- const cwdPath = checkPluginPath(cwd, itemId);
43
- if (cwdPath) paths.push(cwdPath);
44
- // Check in monorepo root if it exists and is different from cwd
45
- if (monorepoRoot && monorepoRoot !== cwd) {
46
- const rootPath = checkPluginPath(monorepoRoot, itemId);
47
- if (rootPath) paths.push(rootPath);
48
- }
49
- return paths;
50
- }).filter((pluginPath)=>pluginPath !== null);
51
- // Normalize args.schema into an array without nested ternary expressions
52
- let baseSchemas = [];
53
- if (Array.isArray(args.schema)) {
54
- baseSchemas = args.schema;
55
- } else if (args.schema) {
56
- baseSchemas = [
57
- args.schema
58
- ];
59
- }
60
- return defineConfig({
61
- ...args,
62
- schema: [
63
- ...baseSchemas,
64
- ...pluginPaths
65
- ]
66
- });
67
- };
1
+ import{defineConfig}from"drizzle-kit";import{existsSync,readdirSync}from"node:fs";import{join,resolve}from"node:path";export const defineVitNodeDrizzleConfig=({vitNodeApiConfig,...args})=>{const pluginId=vitNodeApiConfig.plugins.map(plugin=>plugin.pluginId);const findMonorepoRoot=startPath=>{let currentPath=startPath;while(currentPath!==resolve(currentPath,"..")){const turboConfigPath=join(currentPath,"turbo.json");if(existsSync(turboConfigPath)){return currentPath}currentPath=resolve(currentPath,"..")}return null};const checkPluginPath=(basePath,itemId)=>{const pluginPath=resolve(basePath,"node_modules",itemId,"dist","src","database");if(!existsSync(pluginPath)){return null}try{const files=readdirSync(pluginPath);const hasSchemaFiles=files.some(file=>file.endsWith(".js"));if(!hasSchemaFiles)return null;return join(pluginPath,"*.js").replace(/\\/g,"/")}catch{return null}};const cwd=process.cwd();const monorepoRoot=findMonorepoRoot(cwd);const pluginPaths=["@vitnode/core",...pluginId].flatMap(itemId=>{const paths=[];const cwdPath=checkPluginPath(cwd,itemId);if(cwdPath)paths.push(cwdPath);if(monorepoRoot&&monorepoRoot!==cwd){const rootPath=checkPluginPath(monorepoRoot,itemId);if(rootPath)paths.push(rootPath)}return paths}).filter(pluginPath=>pluginPath!==null);let baseSchemas=[];if(Array.isArray(args.schema)){baseSchemas=args.schema}else if(args.schema){baseSchemas=[args.schema]}return defineConfig({...args,schema:[...baseSchemas,...pluginPaths]})};
@@ -1,99 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Body, Container, Head, Html, Img, Link, Preview, Section, Tailwind, Text } from "@react-email/components";
3
- import { CONFIG } from "../lib/config.js";
4
- DefaultTemplateEmail.PreviewProps = {
5
- children: "This is a preview text for the email template.",
6
- templateProps: {
7
- metadata: {
8
- title: "VitNode - Email Template",
9
- shortTitle: "VitNode",
10
- url: CONFIG.web.href
11
- },
12
- logo: {
13
- src: "http://localhost:3000/logo_vitnode_dark.png"
14
- }
15
- },
16
- i18n: {
17
- messages: {},
18
- locale: "en"
19
- }
20
- };
21
- export default function DefaultTemplateEmail({ children, i18n: { locale }, templateProps: { logo, metadata, previewText, head, tailwindConfig } }) {
22
- return /*#__PURE__*/ _jsxs(Html, {
23
- lang: locale,
24
- children: [
25
- /*#__PURE__*/ _jsx(Head, {
26
- children: head
27
- }),
28
- previewText && /*#__PURE__*/ _jsx(Preview, {
29
- children: previewText
30
- }),
31
- /*#__PURE__*/ _jsx(Tailwind, {
32
- config: {
33
- ...tailwindConfig,
34
- theme: {
35
- ...tailwindConfig?.theme,
36
- extend: {
37
- ...tailwindConfig?.theme?.extend,
38
- colors: {
39
- background: "#edf2f8",
40
- foreground: "#0e1216",
41
- card: "#ffffff",
42
- "card-foreground": "#171b1f",
43
- popover: "#ffffff",
44
- "popover-foreground": "#171b1f",
45
- primary: "#3160c0",
46
- "primary-foreground": "#fafafa",
47
- secondary: "#f4f9ff",
48
- "secondary-foreground": "#1e2226",
49
- muted: "#eaeff5",
50
- "muted-foreground": "#686c72",
51
- accent: "#e0e5eb",
52
- "accent-foreground": "#1e2226",
53
- destructive: "#de3b3f",
54
- warn: "#906600",
55
- border: "#d9dfe4",
56
- input: "#d9dfe4",
57
- ring: "#5aa3ec",
58
- ...tailwindConfig?.theme?.extend?.colors
59
- }
60
- }
61
- }
62
- },
63
- children: /*#__PURE__*/ _jsx(Body, {
64
- className: "text-foreground bg-background mx-auto px-2 font-sans",
65
- children: /*#__PURE__*/ _jsxs(Container, {
66
- className: "mx-auto max-w-[465px]",
67
- children: [
68
- /*#__PURE__*/ _jsx(Section, {
69
- className: "my-8",
70
- children: logo?.src ? /*#__PURE__*/ _jsx(Img, {
71
- alt: logo.text ?? metadata.title,
72
- className: "mx-auto my-0 max-w-[150px]",
73
- src: logo.src
74
- }) : /*#__PURE__*/ _jsx(Text, {
75
- className: "m-0 text-center text-2xl",
76
- children: logo?.text ?? metadata.title
77
- })
78
- }),
79
- children,
80
- /*#__PURE__*/ _jsx(Section, {
81
- className: "my-8 text-center text-sm",
82
- children: /*#__PURE__*/ _jsxs(Link, {
83
- className: "text-muted-foreground",
84
- href: metadata.url,
85
- children: [
86
- metadata.shortTitle ?? metadata.title,
87
- " ©",
88
- " ",
89
- new Date().getFullYear()
90
- ]
91
- })
92
- })
93
- ]
94
- })
95
- })
96
- })
97
- ]
98
- });
99
- }
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Body,Container,Head,Html,Img,Link,Preview,Section,Tailwind,Text}from"@react-email/components";import{CONFIG}from"../lib/config.js";DefaultTemplateEmail.PreviewProps={children:"This is a preview text for the email template.",templateProps:{metadata:{title:"VitNode - Email Template",shortTitle:"VitNode",url:CONFIG.web.href},logo:{src:"http://localhost:3000/logo_vitnode_dark.png"}},i18n:{messages:{},locale:"en"}};export default function DefaultTemplateEmail({children,i18n:{locale},templateProps:{logo,metadata,previewText,head,tailwindConfig}}){return _jsxs(Html,{lang:locale,children:[_jsx(Head,{children:head}),previewText&&_jsx(Preview,{children:previewText}),_jsx(Tailwind,{config:{...tailwindConfig,theme:{...tailwindConfig?.theme,extend:{...tailwindConfig?.theme?.extend,colors:{background:"#edf2f8",foreground:"#0e1216",card:"#ffffff","card-foreground":"#171b1f",popover:"#ffffff","popover-foreground":"#171b1f",primary:"#3160c0","primary-foreground":"#fafafa",secondary:"#f4f9ff","secondary-foreground":"#1e2226",muted:"#eaeff5","muted-foreground":"#686c72",accent:"#e0e5eb","accent-foreground":"#1e2226",destructive:"#de3b3f",warn:"#906600",border:"#d9dfe4",input:"#d9dfe4",ring:"#5aa3ec",...tailwindConfig?.theme?.extend?.colors}}}},children:_jsx(Body,{className:"text-foreground bg-background mx-auto px-2 font-sans",children:_jsxs(Container,{className:"mx-auto max-w-[465px]",children:[_jsx(Section,{className:"my-8",children:logo?.src?_jsx(Img,{alt:logo.text??metadata.title,className:"mx-auto my-0 max-w-[150px]",src:logo.src}):_jsx(Text,{className:"m-0 text-center text-2xl",children:logo?.text??metadata.title})}),children,_jsx(Section,{className:"my-8 text-center text-sm",children:_jsxs(Link,{className:"text-muted-foreground",href:metadata.url,children:[metadata.shortTitle??metadata.title," ©"," ",new Date().getFullYear()]})})]})})})]})}
@@ -1,132 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Hr, Link, Section, Text } from "@react-email/components";
3
- import { createTranslator } from "use-intl";
4
- import DefaultTemplateEmail from "./default-template.js";
5
- import { EmailButton } from "./ui/button.js";
6
- import { EmailCard, EmailCardContent, EmailCardDescription, EmailCardFooter, EmailCardHeader, EmailCardTitle } from "./ui/card.js";
7
- ResetPasswordEmailTemplate.PreviewProps = {
8
- ...DefaultTemplateEmail.PreviewProps,
9
- resetUrl: "https://example.com/reset-password?token=abc123",
10
- expiryDate: new Date(Date.now() + 30 * 60 * 1000),
11
- userIpAddress: "192.168.1.1",
12
- user: {
13
- id: 1,
14
- name: "John Doe",
15
- email: "john@example.com",
16
- language: "en",
17
- nameCode: "john-doe"
18
- },
19
- i18n: {
20
- ...DefaultTemplateEmail.PreviewProps.i18n,
21
- messages: {
22
- core: {
23
- auth: {
24
- reset_password: {
25
- email: {
26
- subject: "Reset your password",
27
- greeting: "Hello {name}!",
28
- intro: "We received a request to reset your password for your account.",
29
- button: "Reset Password",
30
- instructions: "Click the button above to reset your password. This link will expire in 30 minutes for security reasons.",
31
- no_action: "If you didn't request a password reset, you can safely ignore this email. Your password will remain unchanged.",
32
- security_note: "For your security, this request was made from IP address: {ip}",
33
- help: "If you're having trouble with the button above, copy and paste the URL below into your web browser:",
34
- expire_time: "This link will expire on {date}"
35
- }
36
- }
37
- }
38
- }
39
- }
40
- }
41
- };
42
- export default function ResetPasswordEmailTemplate({ i18n, resetUrl, expiryDate, userIpAddress, user, ...props }) {
43
- const t = createTranslator(i18n);
44
- const userName = user?.name ?? "there";
45
- return /*#__PURE__*/ _jsxs(DefaultTemplateEmail, {
46
- i18n: i18n,
47
- templateProps: {
48
- ...props.templateProps,
49
- previewText: t("core.auth.reset_password.email.subject")
50
- },
51
- user: user,
52
- children: [
53
- /*#__PURE__*/ _jsxs(EmailCard, {
54
- children: [
55
- /*#__PURE__*/ _jsxs(EmailCardHeader, {
56
- children: [
57
- /*#__PURE__*/ _jsx(EmailCardTitle, {
58
- children: t("core.auth.reset_password.email.greeting", {
59
- name: userName
60
- })
61
- }),
62
- /*#__PURE__*/ _jsx(EmailCardDescription, {
63
- children: t("core.auth.reset_password.email.intro")
64
- })
65
- ]
66
- }),
67
- /*#__PURE__*/ _jsxs(EmailCardContent, {
68
- children: [
69
- /*#__PURE__*/ _jsx(Section, {
70
- className: "text-center",
71
- children: /*#__PURE__*/ _jsx(EmailButton, {
72
- className: "min-w-[200px]",
73
- href: resetUrl,
74
- size: "lg",
75
- children: t("core.auth.reset_password.email.button")
76
- })
77
- }),
78
- /*#__PURE__*/ _jsx(Text, {
79
- className: "text-muted-foreground mt-6 text-sm leading-relaxed",
80
- children: t("core.auth.reset_password.email.instructions")
81
- }),
82
- /*#__PURE__*/ _jsx(Text, {
83
- className: "text-muted-foreground mt-4 text-sm leading-relaxed",
84
- children: t("core.auth.reset_password.email.expire_time", {
85
- date: expiryDate.toLocaleString(i18n.locale, {
86
- year: "numeric",
87
- month: "long",
88
- day: "numeric",
89
- hour: "2-digit",
90
- minute: "2-digit",
91
- timeZoneName: "short"
92
- })
93
- })
94
- })
95
- ]
96
- }),
97
- /*#__PURE__*/ _jsxs(EmailCardFooter, {
98
- children: [
99
- /*#__PURE__*/ _jsx(Hr, {
100
- className: "border-border my-4 w-full border-t border-solid"
101
- }),
102
- /*#__PURE__*/ _jsx(Text, {
103
- className: "text-muted-foreground m-0 text-sm leading-relaxed",
104
- children: t("core.auth.reset_password.email.no_action")
105
- }),
106
- userIpAddress && /*#__PURE__*/ _jsx(Text, {
107
- className: "text-muted-foreground mt-4 text-xs",
108
- children: t("core.auth.reset_password.email.security_note", {
109
- ip: userIpAddress
110
- })
111
- })
112
- ]
113
- })
114
- ]
115
- }),
116
- /*#__PURE__*/ _jsxs(Section, {
117
- className: "mt-6",
118
- children: [
119
- /*#__PURE__*/ _jsx(Text, {
120
- className: "text-muted-foreground text-sm",
121
- children: t("core.auth.reset_password.email.help")
122
- }),
123
- /*#__PURE__*/ _jsx(Link, {
124
- className: "text-primary break-all text-sm underline",
125
- href: resetUrl,
126
- children: resetUrl
127
- })
128
- ]
129
- })
130
- ]
131
- });
132
- }
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Hr,Link,Section,Text}from"@react-email/components";import{createTranslator}from"use-intl";import DefaultTemplateEmail from"./default-template.js";import{EmailButton}from"./ui/button.js";import{EmailCard,EmailCardContent,EmailCardDescription,EmailCardFooter,EmailCardHeader,EmailCardTitle}from"./ui/card.js";ResetPasswordEmailTemplate.PreviewProps={...DefaultTemplateEmail.PreviewProps,resetUrl:"https://example.com/reset-password?token=abc123",expiryDate:new Date(Date.now()+30*60*1e3),userIpAddress:"192.168.1.1",user:{id:1,name:"John Doe",email:"john@example.com",language:"en",nameCode:"john-doe"},i18n:{...DefaultTemplateEmail.PreviewProps.i18n,messages:{core:{auth:{reset_password:{email:{subject:"Reset your password",greeting:"Hello {name}!",intro:"We received a request to reset your password for your account.",button:"Reset Password",instructions:"Click the button above to reset your password. This link will expire in 30 minutes for security reasons.",no_action:"If you didn't request a password reset, you can safely ignore this email. Your password will remain unchanged.",security_note:"For your security, this request was made from IP address: {ip}",help:"If you're having trouble with the button above, copy and paste the URL below into your web browser:",expire_time:"This link will expire on {date}"}}}}}}};export default function ResetPasswordEmailTemplate({i18n,resetUrl,expiryDate,userIpAddress,user,...props}){const t=createTranslator(i18n);const userName=user?.name??"there";return _jsxs(DefaultTemplateEmail,{i18n:i18n,templateProps:{...props.templateProps,previewText:t("core.auth.reset_password.email.subject")},user:user,children:[_jsxs(EmailCard,{children:[_jsxs(EmailCardHeader,{children:[_jsx(EmailCardTitle,{children:t("core.auth.reset_password.email.greeting",{name:userName})}),_jsx(EmailCardDescription,{children:t("core.auth.reset_password.email.intro")})]}),_jsxs(EmailCardContent,{children:[_jsx(Section,{className:"text-center",children:_jsx(EmailButton,{className:"min-w-[200px]",href:resetUrl,size:"lg",children:t("core.auth.reset_password.email.button")})}),_jsx(Text,{className:"text-muted-foreground mt-6 text-sm leading-relaxed",children:t("core.auth.reset_password.email.instructions")}),_jsx(Text,{className:"text-muted-foreground mt-4 text-sm leading-relaxed",children:t("core.auth.reset_password.email.expire_time",{date:expiryDate.toLocaleString(i18n.locale,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})})})]}),_jsxs(EmailCardFooter,{children:[_jsx(Hr,{className:"border-border my-4 w-full border-t border-solid"}),_jsx(Text,{className:"text-muted-foreground m-0 text-sm leading-relaxed",children:t("core.auth.reset_password.email.no_action")}),userIpAddress&&_jsx(Text,{className:"text-muted-foreground mt-4 text-xs",children:t("core.auth.reset_password.email.security_note",{ip:userIpAddress})})]})]}),_jsxs(Section,{className:"mt-6",children:[_jsx(Text,{className:"text-muted-foreground text-sm",children:t("core.auth.reset_password.email.help")}),_jsx(Link,{className:"text-primary text-sm break-all underline",href:resetUrl,children:resetUrl})]})]})}
@@ -1,36 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button as ButtonReactEmail } from "@react-email/components";
3
- import { cva } from "class-variance-authority";
4
- import { cn } from "../../lib/utils.js";
5
- const buttonVariants = cva("cursor-pointer whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all", {
6
- variants: {
7
- variant: {
8
- default: "bg-primary text-primary-foreground shadow-xs",
9
- destructive: "bg-destructive text-white shadow-xs",
10
- destructiveGhost: "text-destructive",
11
- outline: "border bg-background shadow-xs",
12
- secondary: "bg-secondary text-secondary-foreground shadow-xs",
13
- ghost: "",
14
- link: "text-primary underline-offset-4"
15
- },
16
- size: {
17
- default: "px-4 py-2",
18
- sm: "rounded-md gap-1.5 px-3 py-1.5",
19
- lg: "rounded-md px-6 py-2.5"
20
- }
21
- },
22
- defaultVariants: {
23
- variant: "default",
24
- size: "default"
25
- }
26
- });
27
- export const EmailButton = ({ className, variant, size, ...props })=>{
28
- return /*#__PURE__*/ _jsx(ButtonReactEmail, {
29
- className: cn(buttonVariants({
30
- variant,
31
- size,
32
- className
33
- })),
34
- ...props
35
- });
36
- };
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Button as ButtonReactEmail}from"@react-email/components";import{cva}from"class-variance-authority";import{cn}from"../../lib/utils.js";const buttonVariants=cva("cursor-pointer whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs",destructive:"bg-destructive text-white shadow-xs",destructiveGhost:"text-destructive",outline:"border bg-background shadow-xs",secondary:"bg-secondary text-secondary-foreground shadow-xs",ghost:"",link:"text-primary underline-offset-4"},size:{default:"px-4 py-2",sm:"rounded-md gap-1.5 px-3 py-1.5",lg:"rounded-md px-6 py-2.5"}},defaultVariants:{variant:"default",size:"default"}});export const EmailButton=({className,variant,size,...props})=>{return _jsx(ButtonReactEmail,{className:cn(buttonVariants({variant,size,className})),...props})};
@@ -1,39 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Section, Text } from "@react-email/components";
3
- import { cn } from "../../lib/utils.js";
4
- export const EmailCard = ({ className, ...props })=>{
5
- return /*#__PURE__*/ _jsx(Section, {
6
- className: cn("bg-card text-card-foreground border-border rounded-xl border border-solid py-6 shadow-sm", className),
7
- ...props
8
- });
9
- };
10
- export const EmailCardHeader = ({ className, ...props })=>{
11
- return /*#__PURE__*/ _jsx(Section, {
12
- className: cn("mb-6 px-6", className),
13
- ...props
14
- });
15
- };
16
- export const EmailCardTitle = ({ className, ...props })=>{
17
- return /*#__PURE__*/ _jsx(Text, {
18
- className: cn("text-xl font-semibold leading-[0]", className),
19
- ...props
20
- });
21
- };
22
- export const EmailCardDescription = ({ className, ...props })=>{
23
- return /*#__PURE__*/ _jsx(Text, {
24
- className: cn("text-muted-foreground m-0 text-sm", className),
25
- ...props
26
- });
27
- };
28
- export const EmailCardContent = ({ className, ...props })=>{
29
- return /*#__PURE__*/ _jsx(Section, {
30
- className: cn("px-6", className),
31
- ...props
32
- });
33
- };
34
- export const EmailCardFooter = ({ className, ...props })=>{
35
- return /*#__PURE__*/ _jsx(Section, {
36
- className: cn("mt-6 px-6", className),
37
- ...props
38
- });
39
- };
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{Section,Text}from"@react-email/components";import{cn}from"../../lib/utils.js";export const EmailCard=({className,...props})=>{return _jsx(Section,{className:cn("bg-card text-card-foreground border-border rounded-xl border border-solid py-6 shadow-sm",className),...props})};export const EmailCardHeader=({className,...props})=>{return _jsx(Section,{className:cn("mb-6 px-6",className),...props})};export const EmailCardTitle=({className,...props})=>{return _jsx(Text,{className:cn("text-xl leading-[0] font-semibold",className),...props})};export const EmailCardDescription=({className,...props})=>{return _jsx(Text,{className:cn("text-muted-foreground m-0 text-sm",className),...props})};export const EmailCardContent=({className,...props})=>{return _jsx(Section,{className:cn("px-6",className),...props})};export const EmailCardFooter=({className,...props})=>{return _jsx(Section,{className:cn("mt-6 px-6",className),...props})};
@@ -1,30 +1 @@
1
- import React from "react";
2
- export const useBeforeUnload = (enabled = true, message)=>{
3
- const handler = React.useCallback((event)=>{
4
- const finalEnabled = typeof enabled === "function" ? enabled() : true;
5
- if (!finalEnabled) {
6
- return;
7
- }
8
- event.preventDefault();
9
- if (message) {
10
- event.preventDefault();
11
- return message;
12
- }
13
- return message;
14
- }, [
15
- enabled,
16
- message
17
- ]);
18
- React.useEffect(()=>{
19
- if (!enabled) {
20
- return;
21
- }
22
- window.addEventListener("beforeunload", handler);
23
- return ()=>{
24
- window.removeEventListener("beforeunload", handler);
25
- };
26
- }, [
27
- enabled,
28
- handler
29
- ]);
30
- };
1
+ import React from"react";export const useBeforeUnload=(enabled=true,message)=>{const handler=React.useCallback(event=>{const finalEnabled=typeof enabled==="function"?enabled():true;if(!finalEnabled){return}event.preventDefault();if(message){event.preventDefault();return message}return message},[enabled,message]);React.useEffect(()=>{if(!enabled){return}window.addEventListener("beforeunload",handler);return()=>{window.removeEventListener("beforeunload",handler)}},[enabled,handler])};