dn-react-router-toolkit 0.1.0 → 0.1.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.
Files changed (284) hide show
  1. package/dist/auth-kit/apple_auth.d.mts +24 -0
  2. package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
  3. package/dist/auth-kit/apple_auth.js +75 -0
  4. package/dist/auth-kit/apple_auth.mjs +50 -0
  5. package/dist/auth-kit/auth_service.d.mts +73 -0
  6. package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
  7. package/dist/auth-kit/auth_service.js +257 -0
  8. package/dist/auth-kit/auth_service.mjs +218 -0
  9. package/dist/auth-kit/client/google_login_button.d.mts +9 -0
  10. package/dist/auth-kit/client/google_login_button.d.ts +9 -0
  11. package/dist/auth-kit/client/google_login_button.js +67 -0
  12. package/dist/auth-kit/client/google_login_button.mjs +32 -0
  13. package/dist/auth-kit/client/redirect_page.d.mts +5 -0
  14. package/dist/auth-kit/client/redirect_page.d.ts +5 -0
  15. package/dist/auth-kit/client/redirect_page.js +53 -0
  16. package/dist/auth-kit/client/redirect_page.mjs +18 -0
  17. package/dist/auth-kit/google_auth.d.mts +27 -0
  18. package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
  19. package/dist/auth-kit/google_auth.js +144 -0
  20. package/dist/auth-kit/google_auth.mjs +117 -0
  21. package/dist/auth-kit/jwt.d.mts +18 -0
  22. package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
  23. package/dist/auth-kit/jwt.js +76 -0
  24. package/dist/auth-kit/jwt.mjs +51 -0
  25. package/dist/auth-kit/kakao_auth.d.mts +24 -0
  26. package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
  27. package/dist/auth-kit/kakao_auth.js +115 -0
  28. package/dist/auth-kit/kakao_auth.mjs +88 -0
  29. package/dist/auth-kit/repository.d.mts +42 -0
  30. package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
  31. package/dist/auth-kit/repository.js +18 -0
  32. package/dist/auth-kit/repository.mjs +0 -0
  33. package/dist/auth-kit/with_auth.d.mts +17 -0
  34. package/dist/auth-kit/with_auth.d.ts +17 -0
  35. package/dist/auth-kit/with_auth.js +108 -0
  36. package/dist/auth-kit/with_auth.mjs +71 -0
  37. package/dist/cn.d.mts +3 -0
  38. package/dist/cn.d.ts +3 -0
  39. package/dist/cn.js +32 -0
  40. package/dist/cn.mjs +7 -0
  41. package/dist/components/index.d.mts +5 -0
  42. package/dist/components/index.d.ts +5 -0
  43. package/dist/components/index.js +261 -0
  44. package/dist/components/index.mjs +219 -0
  45. package/dist/components/modal/fullscreen_container.d.mts +7 -0
  46. package/dist/components/modal/fullscreen_container.d.ts +7 -0
  47. package/dist/components/modal/fullscreen_container.js +102 -0
  48. package/dist/components/modal/fullscreen_container.mjs +68 -0
  49. package/dist/components/modal/hooks.d.mts +18 -0
  50. package/dist/components/modal/hooks.d.ts +18 -0
  51. package/dist/components/modal/hooks.js +236 -0
  52. package/dist/components/modal/hooks.mjs +204 -0
  53. package/dist/components/modal/index.d.mts +4 -0
  54. package/dist/components/modal/index.d.ts +4 -0
  55. package/dist/components/modal/index.js +238 -0
  56. package/dist/components/modal/index.mjs +203 -0
  57. package/dist/components/modal/modal.d.mts +13 -0
  58. package/dist/components/modal/modal.d.ts +13 -0
  59. package/dist/components/modal/modal.js +155 -0
  60. package/dist/components/modal/modal.mjs +130 -0
  61. package/dist/components/styles.d.mts +9 -0
  62. package/dist/components/styles.d.ts +9 -0
  63. package/dist/components/styles.js +48 -0
  64. package/dist/components/styles.mjs +17 -0
  65. package/dist/date.d.mts +3 -0
  66. package/dist/date.d.ts +3 -0
  67. package/dist/date.js +63 -0
  68. package/dist/date.mjs +28 -0
  69. package/dist/file-kit/cdn.d.mts +5 -0
  70. package/dist/file-kit/cdn.d.ts +5 -0
  71. package/dist/file-kit/cdn.js +34 -0
  72. package/dist/file-kit/cdn.mjs +9 -0
  73. package/dist/file-kit/client/drop_file_input.d.mts +33 -0
  74. package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +9 -7
  75. package/dist/file-kit/client/drop_file_input.js +235 -0
  76. package/dist/file-kit/client/drop_file_input.mjs +205 -0
  77. package/dist/file-kit/client/file_uploader.d.mts +13 -0
  78. package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
  79. package/dist/file-kit/client/file_uploader.js +115 -0
  80. package/dist/file-kit/client/file_uploader.mjs +90 -0
  81. package/dist/file-kit/file_service.d.mts +26 -0
  82. package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
  83. package/dist/file-kit/file_service.js +60 -0
  84. package/dist/file-kit/file_service.mjs +35 -0
  85. package/dist/file-kit/object_storage.d.mts +17 -0
  86. package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
  87. package/dist/file-kit/object_storage.js +78 -0
  88. package/dist/file-kit/object_storage.mjs +57 -0
  89. package/dist/file-kit/repository.d.mts +16 -0
  90. package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
  91. package/dist/file-kit/repository.js +18 -0
  92. package/dist/file-kit/repository.mjs +0 -0
  93. package/dist/file-kit/responsive_image.d.mts +20 -0
  94. package/dist/file-kit/responsive_image.d.ts +20 -0
  95. package/dist/file-kit/responsive_image.js +123 -0
  96. package/dist/file-kit/responsive_image.mjs +87 -0
  97. package/dist/http-kit/index.d.mts +1 -0
  98. package/dist/http-kit/index.d.ts +1 -0
  99. package/dist/http-kit/index.js +111 -0
  100. package/dist/http-kit/index.mjs +68 -0
  101. package/dist/http-kit/response.d.mts +19 -0
  102. package/dist/http-kit/response.d.ts +19 -0
  103. package/dist/http-kit/response.js +109 -0
  104. package/dist/http-kit/response.mjs +68 -0
  105. package/dist/index.d.mts +4 -0
  106. package/dist/index.d.ts +4 -0
  107. package/dist/index.js +91 -0
  108. package/dist/index.mjs +51 -0
  109. package/dist/route/api/auth/login/[provider]/route.js +113 -0
  110. package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
  111. package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
  112. package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
  113. package/dist/route/api/auth/login/route.d.mts +14 -0
  114. package/dist/route/api/auth/login/route.d.ts +14 -0
  115. package/dist/route/api/auth/login/route.js +107 -0
  116. package/dist/route/api/auth/login/route.mjs +80 -0
  117. package/dist/route/api/auth/logout/route.d.mts +14 -0
  118. package/dist/route/api/auth/logout/route.d.ts +14 -0
  119. package/dist/route/api/auth/logout/route.js +98 -0
  120. package/dist/route/api/auth/logout/route.mjs +71 -0
  121. package/dist/route/api/auth/refresh/route.d.mts +13 -0
  122. package/dist/route/api/auth/refresh/route.d.ts +13 -0
  123. package/dist/route/api/auth/refresh/route.js +92 -0
  124. package/dist/route/api/auth/refresh/route.mjs +65 -0
  125. package/dist/route/api/auth/route.d.mts +13 -0
  126. package/dist/route/api/auth/route.d.ts +13 -0
  127. package/dist/route/api/auth/route.js +82 -0
  128. package/dist/route/api/auth/route.mjs +55 -0
  129. package/dist/route/api/files/[fileId]/route.js +99 -0
  130. package/dist/route/api/files/[fileId]/route.mjs +72 -0
  131. package/dist/route/api/files/_fileId_/route.d.mts +17 -0
  132. package/dist/route/api/files/_fileId_/route.d.ts +17 -0
  133. package/dist/route/api/files/route.d.mts +16 -0
  134. package/dist/route/api/files/route.d.ts +16 -0
  135. package/dist/route/api/files/route.js +106 -0
  136. package/dist/route/api/files/route.mjs +79 -0
  137. package/dist/route/api.d.mts +29 -0
  138. package/dist/route/api.d.ts +29 -0
  139. package/dist/route/api.js +395 -0
  140. package/dist/route/api.mjs +368 -0
  141. package/dist/route/auth/callback/[provider]/route.js +120 -0
  142. package/dist/route/auth/callback/[provider]/route.mjs +93 -0
  143. package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
  144. package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
  145. package/dist/seo-kit/index.d.mts +6 -0
  146. package/dist/seo-kit/index.d.ts +6 -0
  147. package/dist/seo-kit/index.js +321 -0
  148. package/dist/seo-kit/index.mjs +282 -0
  149. package/dist/seo-kit/loader.d.mts +7 -0
  150. package/dist/seo-kit/loader.d.ts +7 -0
  151. package/dist/seo-kit/loader.js +43 -0
  152. package/dist/seo-kit/loader.mjs +18 -0
  153. package/dist/seo-kit/seo.d.mts +103 -0
  154. package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +9 -6
  155. package/dist/seo-kit/seo.js +286 -0
  156. package/dist/seo-kit/seo.mjs +251 -0
  157. package/dist/seo-kit/seo_loader.d.mts +16 -0
  158. package/dist/seo-kit/seo_loader.d.ts +16 -0
  159. package/dist/seo-kit/seo_loader.js +68 -0
  160. package/dist/seo-kit/seo_loader.mjs +31 -0
  161. package/dist/singleton.d.mts +3 -0
  162. package/dist/singleton.d.ts +3 -0
  163. package/dist/singleton.js +37 -0
  164. package/dist/singleton.mjs +12 -0
  165. package/dist/slug.d.mts +3 -0
  166. package/dist/slug.d.ts +3 -0
  167. package/dist/slug.js +32 -0
  168. package/dist/slug.mjs +7 -0
  169. package/package.json +36 -34
  170. package/tsup.config.ts +9 -0
  171. package/dist/cjs/auth-kit/apple_auth.js +0 -60
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -25
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -21
  175. package/dist/cjs/auth-kit/google_auth.js +0 -65
  176. package/dist/cjs/auth-kit/jwt.js +0 -53
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -38
  178. package/dist/cjs/auth-kit/repository.js +0 -2
  179. package/dist/cjs/auth-kit/with_auth.js +0 -46
  180. package/dist/cjs/cn.js +0 -6
  181. package/dist/cjs/components/index.js +0 -18
  182. package/dist/cjs/components/modal/fullscreen_container.js +0 -64
  183. package/dist/cjs/components/modal/hooks.js +0 -78
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -91
  186. package/dist/cjs/components/styles.js +0 -10
  187. package/dist/cjs/date.js +0 -31
  188. package/dist/cjs/file-kit/cdn.js +0 -9
  189. package/dist/cjs/file-kit/client/drop_file_input.js +0 -195
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -78
  191. package/dist/cjs/file-kit/file_service.js +0 -29
  192. package/dist/cjs/file-kit/object_storage.js +0 -50
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -78
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -34
  197. package/dist/cjs/index.js +0 -20
  198. package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
  199. package/dist/cjs/route/api/auth/login/route.js +0 -35
  200. package/dist/cjs/route/api/auth/logout/route.js +0 -22
  201. package/dist/cjs/route/api/auth/refresh/route.js +0 -23
  202. package/dist/cjs/route/api/auth/route.js +0 -12
  203. package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
  204. package/dist/cjs/route/api/files/route.js +0 -34
  205. package/dist/cjs/route/auth/callback/[provider]/route.js +0 -35
  206. package/dist/cjs/route/index.js +0 -80
  207. package/dist/cjs/seo-kit/index.js +0 -19
  208. package/dist/cjs/seo-kit/loader.js +0 -17
  209. package/dist/cjs/seo-kit/seo.js +0 -286
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -19
  211. package/dist/cjs/singleton.js +0 -12
  212. package/dist/cjs/slug.js +0 -10
  213. package/dist/esm/auth-kit/apple_auth.js +0 -56
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -6
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -19
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -2
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -61
  220. package/dist/esm/auth-kit/jwt.js +0 -49
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -34
  222. package/dist/esm/auth-kit/repository.js +0 -1
  223. package/dist/esm/auth-kit/with_auth.d.ts +0 -12
  224. package/dist/esm/auth-kit/with_auth.js +0 -43
  225. package/dist/esm/cn.d.ts +0 -1
  226. package/dist/esm/cn.js +0 -3
  227. package/dist/esm/components/index.d.ts +0 -2
  228. package/dist/esm/components/index.js +0 -2
  229. package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
  230. package/dist/esm/components/modal/fullscreen_container.js +0 -57
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -69
  233. package/dist/esm/components/modal/index.d.ts +0 -3
  234. package/dist/esm/components/modal/index.js +0 -3
  235. package/dist/esm/components/modal/modal.d.ts +0 -10
  236. package/dist/esm/components/modal/modal.js +0 -55
  237. package/dist/esm/components/styles.d.ts +0 -7
  238. package/dist/esm/components/styles.js +0 -7
  239. package/dist/esm/date.d.ts +0 -1
  240. package/dist/esm/date.js +0 -24
  241. package/dist/esm/file-kit/cdn.d.ts +0 -3
  242. package/dist/esm/file-kit/cdn.js +0 -5
  243. package/dist/esm/file-kit/client/drop_file_input.js +0 -158
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -74
  245. package/dist/esm/file-kit/file_service.js +0 -25
  246. package/dist/esm/file-kit/object_storage.js +0 -46
  247. package/dist/esm/file-kit/repository.js +0 -1
  248. package/dist/esm/file-kit/responsive_image.d.ts +0 -17
  249. package/dist/esm/file-kit/responsive_image.js +0 -70
  250. package/dist/esm/http-kit/index.d.ts +0 -1
  251. package/dist/esm/http-kit/index.js +0 -1
  252. package/dist/esm/http-kit/response.d.ts +0 -17
  253. package/dist/esm/http-kit/response.js +0 -28
  254. package/dist/esm/index.d.ts +0 -4
  255. package/dist/esm/index.js +0 -4
  256. package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
  257. package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
  258. package/dist/esm/route/api/auth/login/route.d.ts +0 -6
  259. package/dist/esm/route/api/auth/login/route.js +0 -31
  260. package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
  261. package/dist/esm/route/api/auth/logout/route.js +0 -18
  262. package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
  263. package/dist/esm/route/api/auth/refresh/route.js +0 -19
  264. package/dist/esm/route/api/auth/route.d.ts +0 -4
  265. package/dist/esm/route/api/auth/route.js +0 -8
  266. package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
  267. package/dist/esm/route/api/files/[fileId]/route.js +0 -16
  268. package/dist/esm/route/api/files/route.d.ts +0 -6
  269. package/dist/esm/route/api/files/route.js +0 -30
  270. package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
  271. package/dist/esm/route/auth/callback/[provider]/route.js +0 -31
  272. package/dist/esm/route/index.d.ts +0 -22
  273. package/dist/esm/route/index.js +0 -76
  274. package/dist/esm/seo-kit/index.d.ts +0 -3
  275. package/dist/esm/seo-kit/index.js +0 -3
  276. package/dist/esm/seo-kit/loader.d.ts +0 -5
  277. package/dist/esm/seo-kit/loader.js +0 -14
  278. package/dist/esm/seo-kit/seo.js +0 -280
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -13
  281. package/dist/esm/singleton.d.ts +0 -1
  282. package/dist/esm/singleton.js +0 -9
  283. package/dist/esm/slug.d.ts +0 -1
  284. package/dist/esm/slug.js +0 -6
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/auth-kit/with_auth.ts
31
+ var with_auth_exports = {};
32
+ __export(with_auth_exports, {
33
+ createWithAuthHandler: () => createWithAuthHandler
34
+ });
35
+ module.exports = __toCommonJS(with_auth_exports);
36
+
37
+ // src/auth-kit/auth_service.ts
38
+ var import_bcryptjs = __toESM(require("bcryptjs"));
39
+ var import_uuid = require("uuid");
40
+ var import_react_router = require("react-router");
41
+ var ACCESS_TOKEN_KEY = "access_token";
42
+ var REFRESH_TOKEN_KEY = "refresh_token";
43
+ var ACCESS_TOKEN_COOKIE = (0, import_react_router.createCookie)(ACCESS_TOKEN_KEY, {
44
+ path: "/",
45
+ httpOnly: process.env.NODE_ENV === "production",
46
+ secure: process.env.NODE_ENV === "production",
47
+ sameSite: "strict"
48
+ });
49
+ var REFRESH_TOKEN_COOKIE = (0, import_react_router.createCookie)(REFRESH_TOKEN_KEY, {
50
+ path: "/",
51
+ httpOnly: process.env.NODE_ENV === "production",
52
+ secure: process.env.NODE_ENV === "production",
53
+ sameSite: "strict"
54
+ });
55
+
56
+ // src/auth-kit/with_auth.ts
57
+ function createWithAuthHandler({
58
+ JWT_MANAGER,
59
+ AUTH
60
+ }) {
61
+ return function(fn) {
62
+ return async function(arg) {
63
+ const cookie = arg.request.headers.get("cookie");
64
+ const accessToken = await ACCESS_TOKEN_COOKIE.parse(cookie);
65
+ if (accessToken) {
66
+ const payload = await JWT_MANAGER.verifyAccessToken(accessToken);
67
+ if (payload) {
68
+ return fn(payload)(arg);
69
+ }
70
+ }
71
+ const refreshToken = await REFRESH_TOKEN_COOKIE.parse(cookie);
72
+ if (refreshToken) {
73
+ try {
74
+ const refreshedAccessToken = await AUTH.refreshAccessToken(
75
+ refreshToken
76
+ );
77
+ const setCookieHeader = await AUTH.getRefreshTokenSetCookie(
78
+ refreshedAccessToken
79
+ );
80
+ return new Response("Temporary Redirect", {
81
+ status: 307,
82
+ headers: {
83
+ "Set-Cookie": setCookieHeader,
84
+ Location: arg.request.url
85
+ }
86
+ });
87
+ } catch (e) {
88
+ if (e instanceof Error) {
89
+ console.log(e.message);
90
+ }
91
+ const setCookieHeader = await AUTH.getRefreshTokenSetCookie(null);
92
+ return new Response("Temporary Redirect", {
93
+ status: 307,
94
+ headers: {
95
+ "Set-Cookie": setCookieHeader,
96
+ Location: arg.request.url
97
+ }
98
+ });
99
+ }
100
+ }
101
+ return fn(void 0)(arg);
102
+ };
103
+ };
104
+ }
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ createWithAuthHandler
108
+ });
@@ -0,0 +1,71 @@
1
+ // src/auth-kit/auth_service.ts
2
+ import bcryptjs from "bcryptjs";
3
+ import { v4 } from "uuid";
4
+ import { createCookie } from "react-router";
5
+ var ACCESS_TOKEN_KEY = "access_token";
6
+ var REFRESH_TOKEN_KEY = "refresh_token";
7
+ var ACCESS_TOKEN_COOKIE = createCookie(ACCESS_TOKEN_KEY, {
8
+ path: "/",
9
+ httpOnly: process.env.NODE_ENV === "production",
10
+ secure: process.env.NODE_ENV === "production",
11
+ sameSite: "strict"
12
+ });
13
+ var REFRESH_TOKEN_COOKIE = createCookie(REFRESH_TOKEN_KEY, {
14
+ path: "/",
15
+ httpOnly: process.env.NODE_ENV === "production",
16
+ secure: process.env.NODE_ENV === "production",
17
+ sameSite: "strict"
18
+ });
19
+
20
+ // src/auth-kit/with_auth.ts
21
+ function createWithAuthHandler({
22
+ JWT_MANAGER,
23
+ AUTH
24
+ }) {
25
+ return function(fn) {
26
+ return async function(arg) {
27
+ const cookie = arg.request.headers.get("cookie");
28
+ const accessToken = await ACCESS_TOKEN_COOKIE.parse(cookie);
29
+ if (accessToken) {
30
+ const payload = await JWT_MANAGER.verifyAccessToken(accessToken);
31
+ if (payload) {
32
+ return fn(payload)(arg);
33
+ }
34
+ }
35
+ const refreshToken = await REFRESH_TOKEN_COOKIE.parse(cookie);
36
+ if (refreshToken) {
37
+ try {
38
+ const refreshedAccessToken = await AUTH.refreshAccessToken(
39
+ refreshToken
40
+ );
41
+ const setCookieHeader = await AUTH.getRefreshTokenSetCookie(
42
+ refreshedAccessToken
43
+ );
44
+ return new Response("Temporary Redirect", {
45
+ status: 307,
46
+ headers: {
47
+ "Set-Cookie": setCookieHeader,
48
+ Location: arg.request.url
49
+ }
50
+ });
51
+ } catch (e) {
52
+ if (e instanceof Error) {
53
+ console.log(e.message);
54
+ }
55
+ const setCookieHeader = await AUTH.getRefreshTokenSetCookie(null);
56
+ return new Response("Temporary Redirect", {
57
+ status: 307,
58
+ headers: {
59
+ "Set-Cookie": setCookieHeader,
60
+ Location: arg.request.url
61
+ }
62
+ });
63
+ }
64
+ }
65
+ return fn(void 0)(arg);
66
+ };
67
+ };
68
+ }
69
+ export {
70
+ createWithAuthHandler
71
+ };
package/dist/cn.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ declare function cn(...classes: (string | false | undefined)[]): string;
2
+
3
+ export { cn };
package/dist/cn.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare function cn(...classes: (string | false | undefined)[]): string;
2
+
3
+ export { cn };
package/dist/cn.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/cn.ts
21
+ var cn_exports = {};
22
+ __export(cn_exports, {
23
+ cn: () => cn
24
+ });
25
+ module.exports = __toCommonJS(cn_exports);
26
+ function cn(...classes) {
27
+ return classes.filter(Boolean).join(" ").trim();
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ cn
32
+ });
package/dist/cn.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/cn.ts
2
+ function cn(...classes) {
3
+ return classes.filter(Boolean).join(" ").trim();
4
+ }
5
+ export {
6
+ cn
7
+ };
@@ -0,0 +1,5 @@
1
+ export { Props, useFullscreen } from './modal/fullscreen_container.mjs';
2
+ export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './modal/hooks.mjs';
3
+ export { ModalProps } from './modal/modal.mjs';
4
+ export { baseButtonStyle, dangerousButtonStyle, disabledButtonStyle, formInputStyle, inputBackgroundStyle, outlineButtonStyle, primaryButtonStyle } from './styles.mjs';
5
+ import 'react';
@@ -0,0 +1,5 @@
1
+ export { Props, useFullscreen } from './modal/fullscreen_container.js';
2
+ export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './modal/hooks.js';
3
+ export { ModalProps } from './modal/modal.js';
4
+ export { baseButtonStyle, dangerousButtonStyle, disabledButtonStyle, formInputStyle, inputBackgroundStyle, outlineButtonStyle, primaryButtonStyle } from './styles.js';
5
+ import 'react';
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/index.ts
31
+ var components_exports = {};
32
+ __export(components_exports, {
33
+ ModalContext: () => ModalContext,
34
+ baseButtonStyle: () => baseButtonStyle,
35
+ dangerousButtonStyle: () => dangerousButtonStyle,
36
+ disabledButtonStyle: () => disabledButtonStyle,
37
+ formInputStyle: () => formInputStyle,
38
+ inputBackgroundStyle: () => inputBackgroundStyle,
39
+ outlineButtonStyle: () => outlineButtonStyle,
40
+ primaryButtonStyle: () => primaryButtonStyle,
41
+ useFullscreen: () => useFullscreen,
42
+ useModal: () => useModal,
43
+ useModalPortal: () => useModalPortal,
44
+ useModalRoot: () => useModalRoot
45
+ });
46
+ module.exports = __toCommonJS(components_exports);
47
+
48
+ // src/cn.ts
49
+ function cn(...classes) {
50
+ return classes.filter(Boolean).join(" ").trim();
51
+ }
52
+
53
+ // src/components/modal/fullscreen_container.tsx
54
+ var import_react = __toESM(require("react"));
55
+ var import_react2 = require("react");
56
+ function useFullscreen(ref) {
57
+ (0, import_react2.useEffect)(() => {
58
+ const container = ref.current;
59
+ if (!container) {
60
+ return;
61
+ }
62
+ const scroll = () => {
63
+ if (scrollY > 0) {
64
+ window.scrollTo({
65
+ top: 0,
66
+ behavior: "instant"
67
+ });
68
+ }
69
+ };
70
+ const resize = () => {
71
+ if (!visualViewport) {
72
+ return;
73
+ }
74
+ container.classList.remove("bottom-0");
75
+ container.style.height = `${visualViewport?.height}px`;
76
+ if (visualViewport.height < window.innerHeight) {
77
+ window.addEventListener("scroll", scroll);
78
+ } else {
79
+ window.removeEventListener("scroll", scroll);
80
+ }
81
+ };
82
+ resize();
83
+ visualViewport?.addEventListener("resize", resize);
84
+ scroll();
85
+ return () => {
86
+ window.removeEventListener("scroll", scroll);
87
+ visualViewport?.removeEventListener("resize", resize);
88
+ };
89
+ }, [ref]);
90
+ return "fixed inset-0";
91
+ }
92
+
93
+ // src/components/modal/hooks.tsx
94
+ var import_react4 = require("react");
95
+ var import_react_dom = require("react-dom");
96
+
97
+ // src/components/modal/modal.tsx
98
+ var import_react3 = __toESM(require("react"));
99
+ function Modal({
100
+ open,
101
+ className,
102
+ background = "bg-gray-500/25",
103
+ onBackgroundClick,
104
+ children,
105
+ ...props
106
+ }) {
107
+ const containerRef = (0, import_react3.useRef)(null);
108
+ const fullscreen = useFullscreen(containerRef);
109
+ const [mounted, setMounted] = import_react3.default.useState(false);
110
+ (0, import_react3.useEffect)(() => {
111
+ if (open) {
112
+ setMounted(true);
113
+ } else {
114
+ setTimeout(() => {
115
+ setMounted(false);
116
+ }, 200);
117
+ }
118
+ return () => {
119
+ };
120
+ }, [open]);
121
+ const onBackgroundMouseDown = (event) => {
122
+ event.preventDefault();
123
+ onBackgroundClick?.();
124
+ };
125
+ const onModalMouseDown = (event) => {
126
+ event.stopPropagation();
127
+ };
128
+ const onBackgroundTouchStart = (event) => {
129
+ event.preventDefault();
130
+ onBackgroundClick?.();
131
+ };
132
+ const onModalTouchStart = (event) => {
133
+ event.stopPropagation();
134
+ };
135
+ return /* @__PURE__ */ import_react3.default.createElement(
136
+ "div",
137
+ {
138
+ ref: containerRef,
139
+ className: cn(
140
+ fullscreen,
141
+ "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto",
142
+ open && mounted ? cn(background, "ease-out") : "bg-transparent ease-in pointer-events-none"
143
+ ),
144
+ onMouseDown: onBackgroundMouseDown,
145
+ onTouchStart: onBackgroundTouchStart
146
+ },
147
+ /* @__PURE__ */ import_react3.default.createElement(
148
+ "div",
149
+ {
150
+ className: cn(
151
+ "relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block",
152
+ open && mounted ? "translate-y-[0px] opacity-100 ease-out" : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"
153
+ )
154
+ },
155
+ (open || mounted) && /* @__PURE__ */ import_react3.default.createElement(
156
+ "div",
157
+ {
158
+ ...props,
159
+ className: cn(
160
+ className,
161
+ "w-full max-h-[92vh] print:w-[unset] print:max-h-[unset] rounded-tl-lg rounded-tr-lg md:rounded-lg overflow-auto print:rounded-none"
162
+ ),
163
+ onMouseDown: onModalMouseDown,
164
+ onTouchStart: onModalTouchStart
165
+ },
166
+ children
167
+ )
168
+ )
169
+ );
170
+ }
171
+
172
+ // src/components/modal/hooks.tsx
173
+ var import_react5 = __toESM(require("react"));
174
+ function useModalRoot() {
175
+ const [container, setContainer] = (0, import_react4.useState)(null);
176
+ (0, import_react4.useEffect)(() => {
177
+ const container2 = document.getElementById("modal-root");
178
+ if (container2) {
179
+ setContainer(container2);
180
+ }
181
+ return () => {
182
+ setContainer(null);
183
+ };
184
+ }, []);
185
+ return container;
186
+ }
187
+ function useModalPortal() {
188
+ const container = useModalRoot();
189
+ if (!container) {
190
+ return (children) => null;
191
+ }
192
+ return (children) => {
193
+ return (0, import_react_dom.createPortal)(children, container);
194
+ };
195
+ }
196
+ var ModalContext = (0, import_react4.createContext)({});
197
+ function useModal() {
198
+ const ch2 = (0, import_react4.useRef)(
199
+ null
200
+ );
201
+ const open = () => {
202
+ ch2.current?.(true);
203
+ };
204
+ const close = () => {
205
+ ch2.current?.(false);
206
+ };
207
+ const Component = (0, import_react4.useCallback)(
208
+ function Component2(props) {
209
+ const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
210
+ const createPortal2 = useModalPortal();
211
+ (0, import_react4.useEffect)(() => {
212
+ ch2.current = (v) => {
213
+ setIsOpen(v);
214
+ };
215
+ return () => {
216
+ ch2.current = null;
217
+ };
218
+ }, []);
219
+ (0, import_react4.useEffect)(() => {
220
+ if (isOpen) {
221
+ } else {
222
+ }
223
+ return () => {
224
+ };
225
+ }, [isOpen]);
226
+ return /* @__PURE__ */ import_react5.default.createElement(ModalContext.Provider, { value: { open, close, isOpen } }, createPortal2(
227
+ /* @__PURE__ */ import_react5.default.createElement(Modal, { ...props, open: isOpen, onBackgroundClick: close })
228
+ ));
229
+ },
230
+ []
231
+ );
232
+ return {
233
+ open,
234
+ close,
235
+ Modal: Component
236
+ };
237
+ }
238
+
239
+ // src/components/styles.ts
240
+ var inputBackgroundStyle = "text-[16px] border border-neutral-200 outline-none appearance-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-neutral-400";
241
+ var formInputStyle = `w-full px-3 ${inputBackgroundStyle} h-[40px]`;
242
+ var baseButtonStyle = "transition-colors text-sm font-semibold cursor-pointer flex items-center justify-center rounded-lg whitespace-nowrap text-ellipsis overflow-hidden";
243
+ var primaryButtonStyle = `${baseButtonStyle} px-4 h-[40px] bg-gradient-to-br from-primary-400 to-primary-500 text-white transition-colors`;
244
+ var disabledButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-neutral-200 text-neutral-400`;
245
+ var outlineButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border border-neutral-300 hover:bg-neutral-50`;
246
+ var dangerousButtonStyle = `${baseButtonStyle} h-[40px] px-4 bg-white border hover:bg-red-50 text-red-600`;
247
+ // Annotate the CommonJS export names for ESM import in node:
248
+ 0 && (module.exports = {
249
+ ModalContext,
250
+ baseButtonStyle,
251
+ dangerousButtonStyle,
252
+ disabledButtonStyle,
253
+ formInputStyle,
254
+ inputBackgroundStyle,
255
+ outlineButtonStyle,
256
+ primaryButtonStyle,
257
+ useFullscreen,
258
+ useModal,
259
+ useModalPortal,
260
+ useModalRoot
261
+ });