dn-react-router-toolkit 0.1.1 → 0.1.3

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 +106 -0
  36. package/dist/auth-kit/with_auth.mjs +69 -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 +10 -8
  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 +10 -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 -61
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
  175. package/dist/cjs/auth-kit/google_auth.js +0 -69
  176. package/dist/cjs/auth-kit/jwt.js +0 -54
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -43
  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 -49
  183. package/dist/cjs/components/modal/hooks.js +0 -76
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -79
  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 -148
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -88
  191. package/dist/cjs/file-kit/file_service.js +0 -32
  192. package/dist/cjs/file-kit/object_storage.js +0 -51
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -63
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -37
  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 -22
  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 -38
  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 -278
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -15
  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 -57
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -16
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -65
  220. package/dist/esm/auth-kit/jwt.js +0 -50
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -39
  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 -45
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -67
  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 -43
  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 -144
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -84
  245. package/dist/esm/file-kit/file_service.js +0 -28
  246. package/dist/esm/file-kit/object_storage.js +0 -47
  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 -58
  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 -31
  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 -18
  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 -34
  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 -275
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -12
  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,69 +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
- AUTH;
7
- GOOGLE_CLIENT_ID;
8
- GOOGLE_CLIENT_SECRET;
9
- GOOGLE_REDIRECT_URI;
10
- constructor(AUTH, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) {
11
- this.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
12
- this.GOOGLE_CLIENT_SECRET = GOOGLE_CLIENT_SECRET;
13
- this.GOOGLE_REDIRECT_URI = GOOGLE_REDIRECT_URI;
14
- this.AUTH = AUTH;
15
- }
16
- async signIn(code) {
17
- const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
18
- method: "POST",
19
- headers: {
20
- "Content-Type": "application/x-www-form-urlencoded",
21
- },
22
- body: new URLSearchParams({
23
- code,
24
- client_id: this.GOOGLE_CLIENT_ID,
25
- client_secret: this.GOOGLE_CLIENT_SECRET,
26
- redirect_uri: this.GOOGLE_REDIRECT_URI,
27
- grant_type: "authorization_code",
28
- }),
29
- });
30
- if (!tokenRes.ok) {
31
- if (process.env.NODE_ENV === "development") {
32
- throw (0, response_1.INTERNAL_SERVER_ERROR)(`구글 토큰 발급에 실패했습니다. status: ${tokenRes.status}, message: ${await tokenRes.text()}`);
33
- }
34
- throw (0, response_1.INTERNAL_SERVER_ERROR)("인증에 실패했습니다.");
35
- }
36
- const { access_token } = await tokenRes.json();
37
- const userRes = await fetch("https://www.googleapis.com/oauth2/v1/userinfo", {
38
- headers: {
39
- Authorization: `Bearer ${access_token}`,
40
- },
41
- });
42
- if (!userRes.ok) {
43
- throw (0, response_1.BAD_REQUEST)("유저 정보를 가져오는데 실패했습니다.");
44
- }
45
- const { id, email, name, picture } = await userRes.json();
46
- const user = await this.AUTH.findUser("google", {
47
- id,
48
- email,
49
- name,
50
- picture,
51
- });
52
- if (!user) {
53
- throw (0, response_1.createJsonResponse)(404)({
54
- provider: "google",
55
- id,
56
- name,
57
- picture,
58
- message: "사용자를 찾을 수 없습니다.",
59
- });
60
- }
61
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
62
- return {
63
- user,
64
- accessToken,
65
- refreshToken,
66
- };
67
- }
68
- }
69
- exports.GoogleAuth = GoogleAuth;
@@ -1,54 +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
- siteOrigin;
7
- constructor(siteOrigin) {
8
- this.siteOrigin = siteOrigin;
9
- }
10
- async verify(token, secret) {
11
- try {
12
- const result = await (0, jose_1.jwtVerify)(token, new TextEncoder().encode(secret));
13
- return result.payload;
14
- }
15
- catch (_) {
16
- return;
17
- }
18
- }
19
- async verifyAccessToken(token) {
20
- return this.verify(token, process.env.ACCESS_TOKEN_SECRET);
21
- }
22
- async verifyRefreshToken(token) {
23
- return this.verify(token, process.env.REFRESH_TOKEN_SECRET);
24
- }
25
- async sign(payload, secret, { expiresIn } = {}) {
26
- let builder = new jose_1.SignJWT(payload)
27
- .setProtectedHeader({ alg: "HS256", typ: "JWT" })
28
- .setIssuedAt();
29
- if (this.siteOrigin) {
30
- builder = builder.setIssuer(this.siteOrigin);
31
- }
32
- if (expiresIn) {
33
- builder = builder.setExpirationTime(expiresIn);
34
- }
35
- return builder.sign(new TextEncoder().encode(secret));
36
- }
37
- async signAccessToken(payload) {
38
- return this.sign(payload, process.env.ACCESS_TOKEN_SECRET, {
39
- expiresIn: process.env.ACCESS_TOKEN_EXPIRES_IN || "10s",
40
- });
41
- }
42
- async signRefreshToken(payload) {
43
- return this.sign(payload, process.env.REFRESH_TOKEN_SECRET, {
44
- expiresIn: process.env.REFRESH_TOKEN_EXPIRES_IN || "1d",
45
- });
46
- }
47
- decode(token) {
48
- return (0, jose_1.decodeJwt)(token);
49
- }
50
- getExpirationTime(token) {
51
- return new Date(Number((0, jose_1.decodeJwt)(token).exp) * 1000);
52
- }
53
- }
54
- exports.JWTManager = JWTManager;
@@ -1,43 +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
- AUTH;
7
- constructor(AUTH) {
8
- this.AUTH = AUTH;
9
- }
10
- async signIn(kakaoAccessToken) {
11
- const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
12
- headers: {
13
- Authorization: `Bearer ${kakaoAccessToken}`,
14
- },
15
- });
16
- if (!userRes.ok) {
17
- throw new Error("유저 정보를 가져오는데 실패했습니다.");
18
- }
19
- const { id, kakao_account } = await userRes.json();
20
- const { email, profile } = kakao_account;
21
- const payload = {
22
- id,
23
- email,
24
- name: profile.nickname,
25
- picture: profile.thumbnail_image_url,
26
- };
27
- const user = await this.AUTH.findUser("kakao", payload);
28
- if (!user) {
29
- throw (0, http_kit_1.createJsonResponse)(404)({
30
- provider: "kakao",
31
- ...payload,
32
- message: "사용자를 찾을 수 없습니다.",
33
- });
34
- }
35
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
36
- return {
37
- user,
38
- accessToken,
39
- refreshToken,
40
- };
41
- }
42
- }
43
- 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,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = FullscreenContainer;
4
- exports.useFullscreen = useFullscreen;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const cn_1 = require("../../cn");
7
- const react_1 = require("react");
8
- function FullscreenContainer({ className, children, ...props }) {
9
- const containerRef = (0, react_1.useRef)(null);
10
- useFullscreen(containerRef);
11
- return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, ...props, className: (0, cn_1.cn)("fixed left-0 right-0 top-0 bottom-0", className), children: children }));
12
- }
13
- function useFullscreen(ref) {
14
- (0, react_1.useEffect)(() => {
15
- const container = ref.current;
16
- if (!container) {
17
- return;
18
- }
19
- const scroll = () => {
20
- if (scrollY > 0) {
21
- window.scrollTo({
22
- top: 0,
23
- behavior: "instant",
24
- });
25
- }
26
- };
27
- const resize = () => {
28
- if (!visualViewport) {
29
- return;
30
- }
31
- container.classList.remove("bottom-0");
32
- container.style.height = `${visualViewport?.height}px`;
33
- if (visualViewport.height < window.innerHeight) {
34
- window.addEventListener("scroll", scroll);
35
- }
36
- else {
37
- window.removeEventListener("scroll", scroll);
38
- }
39
- };
40
- resize();
41
- visualViewport?.addEventListener("resize", resize);
42
- scroll();
43
- return () => {
44
- window.removeEventListener("scroll", scroll);
45
- visualViewport?.removeEventListener("resize", resize);
46
- };
47
- }, [ref]);
48
- return "fixed inset-0";
49
- }
@@ -1,76 +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 jsx_runtime_1 = require("react/jsx-runtime");
11
- const react_1 = require("react");
12
- const react_dom_1 = require("react-dom");
13
- const modal_1 = __importDefault(require("./modal"));
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
- ch2.current?.(true);
43
- };
44
- const close = () => {
45
- ch2.current?.(false);
46
- };
47
- const Component = (0, react_1.useCallback)(function Component(props) {
48
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
49
- const createPortal = useModalPortal();
50
- (0, react_1.useEffect)(() => {
51
- ch2.current = (v) => {
52
- setIsOpen(v);
53
- };
54
- return () => {
55
- ch2.current = null;
56
- };
57
- }, []);
58
- (0, react_1.useEffect)(() => {
59
- if (isOpen) {
60
- // document.body.style.overflow = "hidden";
61
- }
62
- else {
63
- // document.body.style.overflow = "";
64
- }
65
- return () => {
66
- // document.body.style.overflow = "";
67
- };
68
- }, [isOpen]);
69
- return ((0, jsx_runtime_1.jsx)(exports.ModalContext.Provider, { value: { open, close, isOpen }, children: createPortal((0, jsx_runtime_1.jsx)(modal_1.default, { ...props, open: isOpen, onBackgroundClick: close })) }));
70
- }, []);
71
- return {
72
- open,
73
- close,
74
- Modal: Component,
75
- };
76
- }
@@ -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,79 +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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.default = Modal;
37
- const jsx_runtime_1 = require("react/jsx-runtime");
38
- const react_1 = __importStar(require("react"));
39
- const fullscreen_container_1 = require("./fullscreen_container");
40
- const cn_1 = require("../../cn");
41
- function Modal({ open, className, background = "bg-gray-500/25", onBackgroundClick, children, ...props }) {
42
- const containerRef = (0, react_1.useRef)(null);
43
- const fullscreen = (0, fullscreen_container_1.useFullscreen)(containerRef);
44
- const [mounted, setMounted] = react_1.default.useState(false);
45
- (0, react_1.useEffect)(() => {
46
- if (open) {
47
- // document.body.style.overflow = "hidden";
48
- setMounted(true);
49
- }
50
- else {
51
- // document.body.style.overflow = "";
52
- setTimeout(() => {
53
- setMounted(false);
54
- }, 200);
55
- }
56
- return () => {
57
- // document.body.style.overflow = "";
58
- };
59
- }, [open]);
60
- const onBackgroundMouseDown = (event) => {
61
- event.preventDefault();
62
- onBackgroundClick?.();
63
- };
64
- const onModalMouseDown = (event) => {
65
- event.stopPropagation();
66
- };
67
- const onBackgroundTouchStart = (event) => {
68
- event.preventDefault();
69
- onBackgroundClick?.();
70
- };
71
- const onModalTouchStart = (event) => {
72
- event.stopPropagation();
73
- };
74
- return ((0, jsx_runtime_1.jsx)("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
75
- ? (0, cn_1.cn)(background, "ease-out")
76
- : "bg-transparent ease-in pointer-events-none"), onMouseDown: onBackgroundMouseDown, onTouchStart: onBackgroundTouchStart, children: (0, jsx_runtime_1.jsx)("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
77
- ? "translate-y-[0px] opacity-100 ease-out"
78
- : "translate-y-[100%] md:translate-y-[50px] opacity-0 ease-in"), children: (open || mounted) && ((0, jsx_runtime_1.jsx)("div", { ...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: children })) }) }));
79
- }
@@ -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;