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
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleAuth = void 0;
4
- const response_1 = require("../http-kit/response");
5
- class GoogleAuth {
6
- constructor(AUTH, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) {
7
- this.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
8
- this.GOOGLE_CLIENT_SECRET = GOOGLE_CLIENT_SECRET;
9
- this.GOOGLE_REDIRECT_URI = GOOGLE_REDIRECT_URI;
10
- this.AUTH = AUTH;
11
- }
12
- async signIn(code) {
13
- const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/x-www-form-urlencoded",
17
- },
18
- body: new URLSearchParams({
19
- code,
20
- client_id: this.GOOGLE_CLIENT_ID,
21
- client_secret: this.GOOGLE_CLIENT_SECRET,
22
- redirect_uri: this.GOOGLE_REDIRECT_URI,
23
- grant_type: "authorization_code",
24
- }),
25
- });
26
- if (!tokenRes.ok) {
27
- if (process.env.NODE_ENV === "development") {
28
- throw (0, response_1.INTERNAL_SERVER_ERROR)(`구글 토큰 발급에 실패했습니다. status: ${tokenRes.status}, message: ${await tokenRes.text()}`);
29
- }
30
- throw (0, response_1.INTERNAL_SERVER_ERROR)("인증에 실패했습니다.");
31
- }
32
- const { access_token } = await tokenRes.json();
33
- const userRes = await fetch("https://www.googleapis.com/oauth2/v1/userinfo", {
34
- headers: {
35
- Authorization: `Bearer ${access_token}`,
36
- },
37
- });
38
- if (!userRes.ok) {
39
- throw (0, response_1.BAD_REQUEST)("유저 정보를 가져오는데 실패했습니다.");
40
- }
41
- const { id, email, name, picture } = await userRes.json();
42
- const user = await this.AUTH.findUser("google", {
43
- id,
44
- email,
45
- name,
46
- picture,
47
- });
48
- if (!user) {
49
- throw (0, response_1.createJsonResponse)(404)({
50
- provider: "google",
51
- id,
52
- name,
53
- picture,
54
- message: "사용자를 찾을 수 없습니다.",
55
- });
56
- }
57
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
58
- return {
59
- user,
60
- accessToken,
61
- refreshToken,
62
- };
63
- }
64
- }
65
- exports.GoogleAuth = GoogleAuth;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JWTManager = void 0;
4
- const jose_1 = require("jose");
5
- class JWTManager {
6
- constructor(siteOrigin) {
7
- this.siteOrigin = siteOrigin;
8
- }
9
- async verify(token, secret) {
10
- try {
11
- const result = await (0, jose_1.jwtVerify)(token, new TextEncoder().encode(secret));
12
- return result.payload;
13
- }
14
- catch (_) {
15
- return;
16
- }
17
- }
18
- async verifyAccessToken(token) {
19
- return this.verify(token, process.env.ACCESS_TOKEN_SECRET);
20
- }
21
- async verifyRefreshToken(token) {
22
- return this.verify(token, process.env.REFRESH_TOKEN_SECRET);
23
- }
24
- async sign(payload, secret, { expiresIn } = {}) {
25
- let builder = new jose_1.SignJWT(payload)
26
- .setProtectedHeader({ alg: "HS256", typ: "JWT" })
27
- .setIssuedAt();
28
- if (this.siteOrigin) {
29
- builder = builder.setIssuer(this.siteOrigin);
30
- }
31
- if (expiresIn) {
32
- builder = builder.setExpirationTime(expiresIn);
33
- }
34
- return builder.sign(new TextEncoder().encode(secret));
35
- }
36
- async signAccessToken(payload) {
37
- return this.sign(payload, process.env.ACCESS_TOKEN_SECRET, {
38
- expiresIn: process.env.ACCESS_TOKEN_EXPIRES_IN || "10s",
39
- });
40
- }
41
- async signRefreshToken(payload) {
42
- return this.sign(payload, process.env.REFRESH_TOKEN_SECRET, {
43
- expiresIn: process.env.REFRESH_TOKEN_EXPIRES_IN || "1d",
44
- });
45
- }
46
- decode(token) {
47
- return (0, jose_1.decodeJwt)(token);
48
- }
49
- getExpirationTime(token) {
50
- return new Date(Number((0, jose_1.decodeJwt)(token).exp) * 1000);
51
- }
52
- }
53
- exports.JWTManager = JWTManager;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KakaoAuth = void 0;
4
- const http_kit_1 = require("../http-kit");
5
- class KakaoAuth {
6
- constructor(AUTH) {
7
- this.AUTH = AUTH;
8
- }
9
- async signIn(kakaoAccessToken) {
10
- const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
11
- headers: {
12
- Authorization: `Bearer ${kakaoAccessToken}`,
13
- },
14
- });
15
- if (!userRes.ok) {
16
- throw new Error("유저 정보를 가져오는데 실패했습니다.");
17
- }
18
- const { id, kakao_account } = await userRes.json();
19
- const { email, profile } = kakao_account;
20
- const payload = {
21
- id,
22
- email,
23
- name: profile.nickname,
24
- picture: profile.thumbnail_image_url,
25
- };
26
- const user = await this.AUTH.findUser("kakao", payload);
27
- if (!user) {
28
- throw (0, http_kit_1.createJsonResponse)(404)(Object.assign(Object.assign({ provider: "kakao" }, payload), { message: "사용자를 찾을 수 없습니다." }));
29
- }
30
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
31
- return {
32
- user,
33
- accessToken,
34
- refreshToken,
35
- };
36
- }
37
- }
38
- exports.KakaoAuth = KakaoAuth;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWithAuthHandler = createWithAuthHandler;
4
- const auth_service_1 = require("./auth_service");
5
- function createWithAuthHandler({ JWT_MANAGER, AUTH, }) {
6
- return function (fn) {
7
- return async function (arg) {
8
- const cookie = arg.request.headers.get("cookie");
9
- const accessToken = await auth_service_1.ACCESS_TOKEN_COOKIE.parse(cookie);
10
- if (accessToken) {
11
- const payload = await JWT_MANAGER.verifyAccessToken(accessToken);
12
- if (payload) {
13
- return fn(payload)(arg);
14
- }
15
- }
16
- const refreshToken = await auth_service_1.REFRESH_TOKEN_COOKIE.parse(cookie);
17
- if (refreshToken) {
18
- try {
19
- const refreshedAccessToken = await AUTH.refreshAccessToken(refreshToken);
20
- const setCookieHeader = await AUTH.getRefreshTokenSetCookie(refreshedAccessToken);
21
- return new Response("Temporary Redirect", {
22
- status: 307,
23
- headers: {
24
- "Set-Cookie": setCookieHeader,
25
- Location: arg.request.url,
26
- },
27
- });
28
- }
29
- catch (e) {
30
- if (e instanceof Error) {
31
- console.log(e.message);
32
- }
33
- const setCookieHeader = await AUTH.getRefreshTokenSetCookie(null);
34
- return new Response("Temporary Redirect", {
35
- status: 307,
36
- headers: {
37
- "Set-Cookie": setCookieHeader,
38
- Location: arg.request.url,
39
- },
40
- });
41
- }
42
- }
43
- return fn(undefined)(arg);
44
- };
45
- };
46
- }
package/dist/cjs/cn.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cn = cn;
4
- function cn(...classes) {
5
- return classes.filter(Boolean).join(" ").trim();
6
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./modal"), exports);
18
- __exportStar(require("./styles"), exports);
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.default = FullscreenContainer;
18
- exports.useFullscreen = useFullscreen;
19
- const cn_1 = require("../../cn");
20
- const react_1 = __importDefault(require("react"));
21
- const react_2 = require("react");
22
- function FullscreenContainer(_a) {
23
- var { className, children } = _a, props = __rest(_a, ["className", "children"]);
24
- const containerRef = (0, react_2.useRef)(null);
25
- useFullscreen(containerRef);
26
- return (react_1.default.createElement("div", Object.assign({ ref: containerRef }, props, { className: (0, cn_1.cn)("fixed left-0 right-0 top-0 bottom-0", className) }), children));
27
- }
28
- function useFullscreen(ref) {
29
- (0, react_2.useEffect)(() => {
30
- const container = ref.current;
31
- if (!container) {
32
- return;
33
- }
34
- const scroll = () => {
35
- if (scrollY > 0) {
36
- window.scrollTo({
37
- top: 0,
38
- behavior: "instant",
39
- });
40
- }
41
- };
42
- const resize = () => {
43
- if (!visualViewport) {
44
- return;
45
- }
46
- container.classList.remove("bottom-0");
47
- container.style.height = `${visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.height}px`;
48
- if (visualViewport.height < window.innerHeight) {
49
- window.addEventListener("scroll", scroll);
50
- }
51
- else {
52
- window.removeEventListener("scroll", scroll);
53
- }
54
- };
55
- resize();
56
- visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.addEventListener("resize", resize);
57
- scroll();
58
- return () => {
59
- window.removeEventListener("scroll", scroll);
60
- visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.removeEventListener("resize", resize);
61
- };
62
- }, [ref]);
63
- return "fixed inset-0";
64
- }
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ModalContext = void 0;
7
- exports.useModalRoot = useModalRoot;
8
- exports.useModalPortal = useModalPortal;
9
- exports.useModal = useModal;
10
- const react_1 = require("react");
11
- const react_dom_1 = require("react-dom");
12
- const modal_1 = __importDefault(require("./modal"));
13
- const react_2 = __importDefault(require("react"));
14
- function useModalRoot() {
15
- const [container, setContainer] = (0, react_1.useState)(null);
16
- (0, react_1.useEffect)(() => {
17
- const container = document.getElementById("modal-root");
18
- if (container) {
19
- setContainer(container);
20
- }
21
- return () => {
22
- setContainer(null);
23
- };
24
- }, []);
25
- return container;
26
- }
27
- function useModalPortal() {
28
- const container = useModalRoot();
29
- if (!container) {
30
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
- return (children) => null;
32
- }
33
- return (children) => {
34
- return (0, react_dom_1.createPortal)(children, container);
35
- };
36
- }
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- exports.ModalContext = (0, react_1.createContext)({});
39
- function useModal() {
40
- const ch2 = (0, react_1.useRef)(null);
41
- const open = () => {
42
- var _a;
43
- (_a = ch2.current) === null || _a === void 0 ? void 0 : _a.call(ch2, true);
44
- };
45
- const close = () => {
46
- var _a;
47
- (_a = ch2.current) === null || _a === void 0 ? void 0 : _a.call(ch2, false);
48
- };
49
- const Component = (0, react_1.useCallback)(function Component(props) {
50
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
51
- const createPortal = useModalPortal();
52
- (0, react_1.useEffect)(() => {
53
- ch2.current = (v) => {
54
- setIsOpen(v);
55
- };
56
- return () => {
57
- ch2.current = null;
58
- };
59
- }, []);
60
- (0, react_1.useEffect)(() => {
61
- if (isOpen) {
62
- // document.body.style.overflow = "hidden";
63
- }
64
- else {
65
- // document.body.style.overflow = "";
66
- }
67
- return () => {
68
- // document.body.style.overflow = "";
69
- };
70
- }, [isOpen]);
71
- return (react_2.default.createElement(exports.ModalContext.Provider, { value: { open, close, isOpen } }, createPortal(react_2.default.createElement(modal_1.default, Object.assign({}, props, { open: isOpen, onBackgroundClick: close })))));
72
- }, []);
73
- return {
74
- open,
75
- close,
76
- Modal: Component,
77
- };
78
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./fullscreen_container"), exports);
18
- __exportStar(require("./hooks"), exports);
19
- __exportStar(require("./modal"), exports);
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __rest = (this && this.__rest) || function (s, e) {
36
- var t = {};
37
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
- t[p] = s[p];
39
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
- t[p[i]] = s[p[i]];
43
- }
44
- return t;
45
- };
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.default = Modal;
48
- const react_1 = __importStar(require("react"));
49
- const fullscreen_container_1 = require("./fullscreen_container");
50
- const cn_1 = require("../../cn");
51
- function Modal(_a) {
52
- var { open, className, background = "bg-gray-500/25", onBackgroundClick, children } = _a, props = __rest(_a, ["open", "className", "background", "onBackgroundClick", "children"]);
53
- const containerRef = (0, react_1.useRef)(null);
54
- const fullscreen = (0, fullscreen_container_1.useFullscreen)(containerRef);
55
- const [mounted, setMounted] = react_1.default.useState(false);
56
- (0, react_1.useEffect)(() => {
57
- if (open) {
58
- // document.body.style.overflow = "hidden";
59
- setMounted(true);
60
- }
61
- else {
62
- // document.body.style.overflow = "";
63
- setTimeout(() => {
64
- setMounted(false);
65
- }, 200);
66
- }
67
- return () => {
68
- // document.body.style.overflow = "";
69
- };
70
- }, [open]);
71
- const onBackgroundMouseDown = (event) => {
72
- event.preventDefault();
73
- onBackgroundClick === null || onBackgroundClick === void 0 ? void 0 : onBackgroundClick();
74
- };
75
- const onModalMouseDown = (event) => {
76
- event.stopPropagation();
77
- };
78
- const onBackgroundTouchStart = (event) => {
79
- event.preventDefault();
80
- onBackgroundClick === null || onBackgroundClick === void 0 ? void 0 : onBackgroundClick();
81
- };
82
- const onModalTouchStart = (event) => {
83
- event.stopPropagation();
84
- };
85
- return (react_1.default.createElement("div", { ref: containerRef, className: (0, cn_1.cn)(fullscreen, "z-[999] flex flex-col justify-center transition-bg duration-200 md:px-6 overflow-hidden print:px-0 print:block print:overflow-auto", open && mounted
86
- ? (0, cn_1.cn)(background, "ease-out")
87
- : "bg-transparent ease-in pointer-events-none"), onMouseDown: onBackgroundMouseDown, onTouchStart: onBackgroundTouchStart },
88
- react_1.default.createElement("div", { className: (0, cn_1.cn)("relative flex-1 flex flex-col justify-end md:justify-center items-center transition-[opacity transform] duration-200 print:block", open && mounted
89
- ? "translate-y-[0px] opacity-100 ease-out"
90
- : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in") }, (open || mounted) && (react_1.default.createElement("div", Object.assign({}, props, { className: (0, cn_1.cn)(className, "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"), onMouseDown: onModalMouseDown, onTouchStart: onModalTouchStart }), children)))));
91
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dangerousButtonStyle = exports.outlineButtonStyle = exports.disabledButtonStyle = exports.primaryButtonStyle = exports.baseButtonStyle = exports.formInputStyle = exports.inputBackgroundStyle = void 0;
4
- exports.inputBackgroundStyle = "text-[16px] border border-neutral-200 outline-none appearance-none disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-neutral-400";
5
- exports.formInputStyle = `w-full px-3 ${exports.inputBackgroundStyle} h-[40px]`;
6
- exports.baseButtonStyle = "transition-colors text-sm font-semibold cursor-pointer flex items-center justify-center rounded-lg whitespace-nowrap text-ellipsis overflow-hidden";
7
- exports.primaryButtonStyle = `${exports.baseButtonStyle} px-4 h-[40px] bg-gradient-to-br from-primary-400 to-primary-500 text-white transition-colors`;
8
- exports.disabledButtonStyle = `${exports.baseButtonStyle} h-[40px] px-4 bg-neutral-200 text-neutral-400`;
9
- exports.outlineButtonStyle = `${exports.baseButtonStyle} h-[40px] px-4 bg-white border border-neutral-300 hover:bg-neutral-50`;
10
- exports.dangerousButtonStyle = `${exports.baseButtonStyle} h-[40px] px-4 bg-white border hover:bg-red-50 text-red-600`;
package/dist/cjs/date.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatHumanDateTime = void 0;
7
- const moment_timezone_1 = __importDefault(require("moment-timezone"));
8
- const formatHumanDateTime = (value) => {
9
- const date = (0, moment_timezone_1.default)(value).tz("Asia/Seoul");
10
- const now = (0, moment_timezone_1.default)().tz("Asia/Seoul");
11
- if (date.isAfter(now.clone().subtract(1, "minute"))) {
12
- return "방금 전";
13
- }
14
- if (date.isAfter(now.clone().subtract(1, "hour"))) {
15
- const diff = now.diff(date, "minute");
16
- return `${diff}분 전`;
17
- }
18
- if (date.isAfter(now.clone().subtract(6, "hours"))) {
19
- const diff = now.diff(date, "hour");
20
- return `${diff}시간 전`;
21
- }
22
- if (date.isAfter(now.clone().subtract(1, "week"))) {
23
- const diff = now.diff(date, "day");
24
- return `${diff}일 전`;
25
- }
26
- if (date.isSame(now, "year")) {
27
- return date.format("M월 D일");
28
- }
29
- return date.format("YYYY년 M월 D일");
30
- };
31
- exports.formatHumanDateTime = formatHumanDateTime;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCDN = void 0;
4
- const createCDN = (origin) => {
5
- return (key, { width } = {}) => {
6
- return (key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : undefined);
7
- };
8
- };
9
- exports.createCDN = createCDN;