dn-react-router-toolkit 0.2.6 → 0.3.1

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 (278) hide show
  1. package/dist/api/create_handler.d.mts +13 -0
  2. package/dist/api/create_handler.d.ts +13 -0
  3. package/dist/api/create_handler.js +276 -0
  4. package/dist/api/create_handler.mjs +282 -0
  5. package/dist/api/index.d.mts +4 -0
  6. package/dist/api/index.d.ts +4 -0
  7. package/dist/api/index.js +276 -0
  8. package/dist/api/index.mjs +282 -0
  9. package/dist/auth/client/index.d.mts +3 -0
  10. package/dist/auth/client/index.d.ts +3 -0
  11. package/dist/{date.js → auth/client/index.js} +25 -32
  12. package/dist/auth/client/index.mjs +21 -0
  13. package/dist/auth/client/redirect_page.d.mts +1 -0
  14. package/dist/auth/client/redirect_page.d.ts +1 -0
  15. package/dist/auth/index.d.mts +4 -0
  16. package/dist/auth/index.d.ts +4 -0
  17. package/dist/auth/index.js +116 -0
  18. package/dist/auth/index.mjs +89 -0
  19. package/dist/auth/server/index.d.mts +1 -0
  20. package/dist/auth/server/index.d.ts +1 -0
  21. package/dist/{slug.js → auth/server/index.js} +6 -14
  22. package/dist/auth/server/index.mjs +2 -0
  23. package/dist/auth/with_auth.d.mts +2 -6
  24. package/dist/auth/with_auth.d.ts +2 -6
  25. package/dist/auth/with_auth.js +3 -0
  26. package/dist/auth/with_auth.mjs +3 -0
  27. package/dist/{components → client}/client_env.d.mts +1 -1
  28. package/dist/{components → client}/client_env.d.ts +1 -1
  29. package/dist/{components → client}/client_env.js +6 -2
  30. package/dist/{components → client}/client_env.mjs +2 -2
  31. package/dist/client/index.d.mts +3 -0
  32. package/dist/client/index.d.ts +3 -0
  33. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  34. package/dist/client/index.mjs +31 -0
  35. package/dist/client/use_user_agent.d.mts +8 -0
  36. package/dist/client/use_user_agent.d.ts +8 -0
  37. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  38. package/dist/client/use_user_agent.mjs +13 -0
  39. package/dist/file/client/index.d.mts +1 -0
  40. package/dist/file/client/index.d.ts +1 -0
  41. package/dist/file/{cdn.js → client/index.js} +6 -16
  42. package/dist/file/client/index.mjs +2 -0
  43. package/dist/file/index.d.mts +1 -0
  44. package/dist/file/index.d.ts +1 -0
  45. package/dist/{cn.js → file/index.js} +6 -14
  46. package/dist/file/index.mjs +2 -0
  47. package/dist/file/server/index.d.mts +1 -0
  48. package/dist/file/server/index.d.ts +1 -0
  49. package/dist/file/server/index.js +24 -0
  50. package/dist/file/server/index.mjs +2 -0
  51. package/dist/http/index.d.mts +1 -1
  52. package/dist/http/index.d.ts +1 -1
  53. package/dist/http/index.js +3 -90
  54. package/dist/http/index.mjs +2 -68
  55. package/dist/index.d.mts +8 -6
  56. package/dist/index.d.ts +8 -6
  57. package/dist/index.js +3 -79
  58. package/dist/index.mjs +2 -58
  59. package/dist/modal/index.d.mts +1 -0
  60. package/dist/modal/index.d.ts +1 -0
  61. package/dist/{sleep.js → modal/index.js} +6 -14
  62. package/dist/modal/index.mjs +2 -0
  63. package/dist/seo/index.d.mts +4 -0
  64. package/dist/seo/index.d.ts +4 -0
  65. package/dist/seo/index.js +304 -0
  66. package/dist/seo/index.mjs +267 -0
  67. package/dist/seo/seo.js +9 -1
  68. package/dist/seo/seo.mjs +9 -1
  69. package/dist/text_editor/index.d.mts +1 -0
  70. package/dist/text_editor/index.d.ts +1 -0
  71. package/dist/text_editor/index.js +24 -0
  72. package/dist/text_editor/index.mjs +2 -0
  73. package/package.json +58 -32
  74. package/dist/auth/apple_auth.d.mts +0 -38
  75. package/dist/auth/apple_auth.d.ts +0 -38
  76. package/dist/auth/apple_auth.js +0 -88
  77. package/dist/auth/apple_auth.mjs +0 -63
  78. package/dist/auth/auth_repository.d.mts +0 -41
  79. package/dist/auth/auth_repository.d.ts +0 -41
  80. package/dist/auth/auth_repository.js +0 -18
  81. package/dist/auth/auth_repository.mjs +0 -0
  82. package/dist/auth/auth_service.d.mts +0 -63
  83. package/dist/auth/auth_service.d.ts +0 -63
  84. package/dist/auth/auth_service.js +0 -210
  85. package/dist/auth/auth_service.mjs +0 -171
  86. package/dist/auth/client/google_login_button.d.mts +0 -7
  87. package/dist/auth/client/google_login_button.d.ts +0 -7
  88. package/dist/auth/client/google_login_button.mjs +0 -37
  89. package/dist/auth/client/provider.d.mts +0 -24
  90. package/dist/auth/client/provider.d.ts +0 -24
  91. package/dist/auth/client/provider.js +0 -154
  92. package/dist/auth/client/provider.mjs +0 -118
  93. package/dist/auth/google_auth.d.mts +0 -33
  94. package/dist/auth/google_auth.d.ts +0 -33
  95. package/dist/auth/google_auth.js +0 -135
  96. package/dist/auth/google_auth.mjs +0 -108
  97. package/dist/auth/handlers/find_auth.d.mts +0 -13
  98. package/dist/auth/handlers/find_auth.d.ts +0 -13
  99. package/dist/auth/handlers/find_auth.js +0 -82
  100. package/dist/auth/handlers/find_auth.mjs +0 -55
  101. package/dist/auth/handlers/login.d.mts +0 -13
  102. package/dist/auth/handlers/login.d.ts +0 -13
  103. package/dist/auth/handlers/login.js +0 -107
  104. package/dist/auth/handlers/login.mjs +0 -80
  105. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  106. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  107. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  108. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  109. package/dist/auth/handlers/logout.d.mts +0 -13
  110. package/dist/auth/handlers/logout.d.ts +0 -13
  111. package/dist/auth/handlers/logout.js +0 -102
  112. package/dist/auth/handlers/logout.mjs +0 -75
  113. package/dist/auth/handlers/refresh.d.mts +0 -13
  114. package/dist/auth/handlers/refresh.d.ts +0 -13
  115. package/dist/auth/handlers/refresh.js +0 -92
  116. package/dist/auth/handlers/refresh.mjs +0 -65
  117. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  118. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  119. package/dist/auth/handlers/request_password_reset.js +0 -87
  120. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  121. package/dist/auth/handlers/reset_password.d.mts +0 -10
  122. package/dist/auth/handlers/reset_password.d.ts +0 -10
  123. package/dist/auth/handlers/reset_password.js +0 -88
  124. package/dist/auth/handlers/reset_password.mjs +0 -61
  125. package/dist/auth/handlers/signup.d.mts +0 -15
  126. package/dist/auth/handlers/signup.d.ts +0 -15
  127. package/dist/auth/handlers/signup.js +0 -147
  128. package/dist/auth/handlers/signup.mjs +0 -112
  129. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  130. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  131. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  132. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  133. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  134. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  135. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  136. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  137. package/dist/auth/jwt_manager.d.mts +0 -38
  138. package/dist/auth/jwt_manager.d.ts +0 -38
  139. package/dist/auth/jwt_manager.js +0 -90
  140. package/dist/auth/jwt_manager.mjs +0 -65
  141. package/dist/auth/kakao_auth.d.mts +0 -27
  142. package/dist/auth/kakao_auth.d.ts +0 -27
  143. package/dist/auth/kakao_auth.js +0 -56
  144. package/dist/auth/kakao_auth.mjs +0 -31
  145. package/dist/auth/password_recovery.d.mts +0 -34
  146. package/dist/auth/password_recovery.d.ts +0 -34
  147. package/dist/auth/password_recovery.js +0 -169
  148. package/dist/auth/password_recovery.mjs +0 -134
  149. package/dist/auth/thirdparty_auth.d.mts +0 -41
  150. package/dist/auth/thirdparty_auth.d.ts +0 -41
  151. package/dist/auth/thirdparty_auth.js +0 -113
  152. package/dist/auth/thirdparty_auth.mjs +0 -86
  153. package/dist/cn.d.mts +0 -3
  154. package/dist/cn.d.ts +0 -3
  155. package/dist/cn.mjs +0 -7
  156. package/dist/components/index.d.mts +0 -5
  157. package/dist/components/index.d.ts +0 -5
  158. package/dist/components/index.js +0 -261
  159. package/dist/components/index.mjs +0 -219
  160. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  161. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  162. package/dist/components/modal/fullscreen_container.js +0 -102
  163. package/dist/components/modal/fullscreen_container.mjs +0 -68
  164. package/dist/components/modal/hooks.d.mts +0 -18
  165. package/dist/components/modal/hooks.d.ts +0 -18
  166. package/dist/components/modal/hooks.js +0 -236
  167. package/dist/components/modal/hooks.mjs +0 -204
  168. package/dist/components/modal/index.d.mts +0 -4
  169. package/dist/components/modal/index.d.ts +0 -4
  170. package/dist/components/modal/index.js +0 -238
  171. package/dist/components/modal/index.mjs +0 -203
  172. package/dist/components/modal/modal.d.mts +0 -13
  173. package/dist/components/modal/modal.d.ts +0 -13
  174. package/dist/components/modal/modal.js +0 -155
  175. package/dist/components/modal/modal.mjs +0 -130
  176. package/dist/components/styles.d.mts +0 -9
  177. package/dist/components/styles.d.ts +0 -9
  178. package/dist/components/styles.js +0 -48
  179. package/dist/components/styles.mjs +0 -17
  180. package/dist/date.d.mts +0 -5
  181. package/dist/date.d.ts +0 -5
  182. package/dist/date.mjs +0 -29
  183. package/dist/file/cdn.d.mts +0 -6
  184. package/dist/file/cdn.d.ts +0 -6
  185. package/dist/file/cdn.mjs +0 -9
  186. package/dist/file/client/drop_file_input.d.mts +0 -36
  187. package/dist/file/client/drop_file_input.d.ts +0 -36
  188. package/dist/file/client/drop_file_input.js +0 -323
  189. package/dist/file/client/drop_file_input.mjs +0 -294
  190. package/dist/file/client/file_upload_button.d.mts +0 -10
  191. package/dist/file/client/file_upload_button.d.ts +0 -10
  192. package/dist/file/client/file_upload_button.js +0 -89
  193. package/dist/file/client/file_upload_button.mjs +0 -58
  194. package/dist/file/client/file_uploader.d.mts +0 -13
  195. package/dist/file/client/file_uploader.d.ts +0 -13
  196. package/dist/file/client/file_uploader.js +0 -163
  197. package/dist/file/client/file_uploader.mjs +0 -136
  198. package/dist/file/client/format_size.d.mts +0 -3
  199. package/dist/file/client/format_size.d.ts +0 -3
  200. package/dist/file/client/format_size.mjs +0 -13
  201. package/dist/file/client/metadata.d.mts +0 -7
  202. package/dist/file/client/metadata.d.ts +0 -7
  203. package/dist/file/client/metadata.js +0 -85
  204. package/dist/file/client/metadata.mjs +0 -60
  205. package/dist/file/file_repository.d.mts +0 -16
  206. package/dist/file/file_repository.d.ts +0 -16
  207. package/dist/file/file_repository.js +0 -18
  208. package/dist/file/file_repository.mjs +0 -0
  209. package/dist/file/file_service.d.mts +0 -32
  210. package/dist/file/file_service.d.ts +0 -32
  211. package/dist/file/file_service.js +0 -66
  212. package/dist/file/file_service.mjs +0 -41
  213. package/dist/file/handlers/delete_file.d.mts +0 -17
  214. package/dist/file/handlers/delete_file.d.ts +0 -17
  215. package/dist/file/handlers/delete_file.js +0 -99
  216. package/dist/file/handlers/delete_file.mjs +0 -72
  217. package/dist/file/handlers/upload_file.d.mts +0 -16
  218. package/dist/file/handlers/upload_file.d.ts +0 -16
  219. package/dist/file/handlers/upload_file.js +0 -106
  220. package/dist/file/handlers/upload_file.mjs +0 -79
  221. package/dist/file/object_storage.d.mts +0 -19
  222. package/dist/file/object_storage.d.ts +0 -19
  223. package/dist/file/object_storage.js +0 -78
  224. package/dist/file/object_storage.mjs +0 -57
  225. package/dist/file/responsive_image.d.mts +0 -20
  226. package/dist/file/responsive_image.d.ts +0 -20
  227. package/dist/file/responsive_image.js +0 -132
  228. package/dist/file/responsive_image.mjs +0 -96
  229. package/dist/http/response.d.mts +0 -19
  230. package/dist/http/response.d.ts +0 -19
  231. package/dist/http/response.js +0 -109
  232. package/dist/http/response.mjs +0 -68
  233. package/dist/route/api.d.mts +0 -21
  234. package/dist/route/api.d.ts +0 -21
  235. package/dist/route/api.js +0 -584
  236. package/dist/route/api.mjs +0 -547
  237. package/dist/singleton.d.mts +0 -3
  238. package/dist/singleton.d.ts +0 -3
  239. package/dist/singleton.js +0 -37
  240. package/dist/singleton.mjs +0 -12
  241. package/dist/sleep.d.mts +0 -3
  242. package/dist/sleep.d.ts +0 -3
  243. package/dist/sleep.mjs +0 -7
  244. package/dist/slug.d.mts +0 -3
  245. package/dist/slug.d.ts +0 -3
  246. package/dist/slug.mjs +0 -7
  247. package/dist/text_editor/attach_media.d.mts +0 -16
  248. package/dist/text_editor/attach_media.d.ts +0 -16
  249. package/dist/text_editor/attach_media.js +0 -237
  250. package/dist/text_editor/attach_media.mjs +0 -210
  251. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  252. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  253. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  254. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  255. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  256. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  257. package/dist/text_editor/plugins/keymap.js +0 -40
  258. package/dist/text_editor/plugins/keymap.mjs +0 -15
  259. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  260. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  261. package/dist/text_editor/plugins/placehoder.js +0 -112
  262. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  263. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  264. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  265. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  266. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  267. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  268. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  269. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  270. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  271. package/dist/text_editor/schema.d.mts +0 -9
  272. package/dist/text_editor/schema.d.ts +0 -9
  273. package/dist/text_editor/schema.js +0 -354
  274. package/dist/text_editor/schema.mjs +0 -319
  275. package/dist/text_editor/text_editor.d.mts +0 -44
  276. package/dist/text_editor/text_editor.d.ts +0 -44
  277. package/dist/text_editor/text_editor.js +0 -830
  278. package/dist/text_editor/text_editor.mjs +0 -802
@@ -0,0 +1,116 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/auth/index.ts
22
+ var auth_exports = {};
23
+ __export(auth_exports, {
24
+ createWithAuthHandler: () => createWithAuthHandler
25
+ });
26
+ module.exports = __toCommonJS(auth_exports);
27
+ __reExport(auth_exports, require("dn-react-toolkit/auth"), module.exports);
28
+
29
+ // src/auth/with_auth.ts
30
+ function createWithAuthHandler({ authService }) {
31
+ return function(fn) {
32
+ const handler = async function(arg) {
33
+ const respond = async (auth) => {
34
+ const userAgent = arg.request.headers.get("User-Agent") || "";
35
+ const res = await fn(auth)(arg);
36
+ if (typeof res === "object" && res !== null && !Array.isArray(res)) {
37
+ if (res instanceof Response) {
38
+ if (res.status < 300 && res.headers.get("Content-Type")?.includes("application/json")) {
39
+ const data = await res.json();
40
+ return new Response(
41
+ JSON.stringify({
42
+ AUTH: auth,
43
+ userAgent,
44
+ ...data
45
+ }),
46
+ {
47
+ status: res.status,
48
+ headers: res.headers
49
+ }
50
+ );
51
+ }
52
+ return res;
53
+ }
54
+ return {
55
+ AUTH: auth,
56
+ userAgent,
57
+ ...res
58
+ };
59
+ }
60
+ return res;
61
+ };
62
+ const accessToken = await authService.getAccessTokenFromRequest(
63
+ arg.request
64
+ );
65
+ if (accessToken) {
66
+ const payload = await authService.jwtManager.verifyAccessToken(
67
+ accessToken
68
+ );
69
+ if (payload) {
70
+ return respond(payload);
71
+ }
72
+ }
73
+ const refreshToken = await authService.getRefreshTokenFromCookies(
74
+ arg.request
75
+ );
76
+ if (refreshToken) {
77
+ try {
78
+ const newAccessToken = await authService.refreshAccessToken(
79
+ refreshToken
80
+ );
81
+ const setCookieHeader = await authService.getAccessTokenSetCookie(
82
+ newAccessToken
83
+ );
84
+ const headers = new Headers();
85
+ headers.append("Set-Cookie", setCookieHeader);
86
+ headers.append("Location", arg.request.url);
87
+ return new Response("Temporary Redirect", {
88
+ status: 307,
89
+ headers
90
+ });
91
+ } catch (e) {
92
+ if (e instanceof Error) {
93
+ console.log(e.message);
94
+ }
95
+ const setCookieHeader = await authService.getRefreshTokenSetCookie(
96
+ null
97
+ );
98
+ const headers = new Headers();
99
+ headers.append("Set-Cookie", setCookieHeader);
100
+ headers.append("Location", arg.request.url);
101
+ return new Response("Temporary Redirect", {
102
+ status: 307,
103
+ headers
104
+ });
105
+ }
106
+ }
107
+ return respond(void 0);
108
+ };
109
+ return handler;
110
+ };
111
+ }
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ createWithAuthHandler,
115
+ ...require("dn-react-toolkit/auth")
116
+ });
@@ -0,0 +1,89 @@
1
+ // src/auth/index.ts
2
+ export * from "dn-react-toolkit/auth";
3
+
4
+ // src/auth/with_auth.ts
5
+ function createWithAuthHandler({ authService }) {
6
+ return function(fn) {
7
+ const handler = async function(arg) {
8
+ const respond = async (auth) => {
9
+ const userAgent = arg.request.headers.get("User-Agent") || "";
10
+ const res = await fn(auth)(arg);
11
+ if (typeof res === "object" && res !== null && !Array.isArray(res)) {
12
+ if (res instanceof Response) {
13
+ if (res.status < 300 && res.headers.get("Content-Type")?.includes("application/json")) {
14
+ const data = await res.json();
15
+ return new Response(
16
+ JSON.stringify({
17
+ AUTH: auth,
18
+ userAgent,
19
+ ...data
20
+ }),
21
+ {
22
+ status: res.status,
23
+ headers: res.headers
24
+ }
25
+ );
26
+ }
27
+ return res;
28
+ }
29
+ return {
30
+ AUTH: auth,
31
+ userAgent,
32
+ ...res
33
+ };
34
+ }
35
+ return res;
36
+ };
37
+ const accessToken = await authService.getAccessTokenFromRequest(
38
+ arg.request
39
+ );
40
+ if (accessToken) {
41
+ const payload = await authService.jwtManager.verifyAccessToken(
42
+ accessToken
43
+ );
44
+ if (payload) {
45
+ return respond(payload);
46
+ }
47
+ }
48
+ const refreshToken = await authService.getRefreshTokenFromCookies(
49
+ arg.request
50
+ );
51
+ if (refreshToken) {
52
+ try {
53
+ const newAccessToken = await authService.refreshAccessToken(
54
+ refreshToken
55
+ );
56
+ const setCookieHeader = await authService.getAccessTokenSetCookie(
57
+ newAccessToken
58
+ );
59
+ const headers = new Headers();
60
+ headers.append("Set-Cookie", setCookieHeader);
61
+ headers.append("Location", arg.request.url);
62
+ return new Response("Temporary Redirect", {
63
+ status: 307,
64
+ headers
65
+ });
66
+ } catch (e) {
67
+ if (e instanceof Error) {
68
+ console.log(e.message);
69
+ }
70
+ const setCookieHeader = await authService.getRefreshTokenSetCookie(
71
+ null
72
+ );
73
+ const headers = new Headers();
74
+ headers.append("Set-Cookie", setCookieHeader);
75
+ headers.append("Location", arg.request.url);
76
+ return new Response("Temporary Redirect", {
77
+ status: 307,
78
+ headers
79
+ });
80
+ }
81
+ }
82
+ return respond(void 0);
83
+ };
84
+ return handler;
85
+ };
86
+ }
87
+ export {
88
+ createWithAuthHandler
89
+ };
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/auth/server';
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/auth/server';
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
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
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,18 +11,14 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
 
20
- // src/slug.ts
21
- var slug_exports = {};
22
- __export(slug_exports, {
23
- toSlug: () => toSlug
24
- });
25
- module.exports = __toCommonJS(slug_exports);
26
- var toSlug = (str) => {
27
- return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
28
- };
17
+ // src/auth/server/index.tsx
18
+ var server_exports = {};
19
+ module.exports = __toCommonJS(server_exports);
20
+ __reExport(server_exports, require("dn-react-toolkit/auth/server"), module.exports);
29
21
  // Annotate the CommonJS export names for ESM import in node:
30
22
  0 && (module.exports = {
31
- toSlug
23
+ ...require("dn-react-toolkit/auth/server")
32
24
  });
@@ -0,0 +1,2 @@
1
+ // src/auth/server/index.tsx
2
+ export * from "dn-react-toolkit/auth/server";
@@ -1,10 +1,6 @@
1
+ import { AccessTokenPayload } from 'dn-react-toolkit/auth';
2
+ import { AuthService } from 'dn-react-toolkit/auth/server';
1
3
  import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
- import { AuthService } from './auth_service.mjs';
3
- import { AccessTokenPayload } from './jwt_manager.mjs';
4
- import 'jose';
5
- import '../file/object_storage.mjs';
6
- import '@aws-sdk/client-s3';
7
- import './auth_repository.mjs';
8
4
 
9
5
  type Handler<T extends LoaderFunctionArgs | ActionFunctionArgs> = (arg: T) => Promise<unknown> | unknown;
10
6
  type InputFN = (auth?: AccessTokenPayload) => Handler<LoaderFunctionArgs> | Handler<ActionFunctionArgs>;
@@ -1,10 +1,6 @@
1
+ import { AccessTokenPayload } from 'dn-react-toolkit/auth';
2
+ import { AuthService } from 'dn-react-toolkit/auth/server';
1
3
  import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
- import { AuthService } from './auth_service.js';
3
- import { AccessTokenPayload } from './jwt_manager.js';
4
- import 'jose';
5
- import '../file/object_storage.js';
6
- import '@aws-sdk/client-s3';
7
- import './auth_repository.js';
8
4
 
9
5
  type Handler<T extends LoaderFunctionArgs | ActionFunctionArgs> = (arg: T) => Promise<unknown> | unknown;
10
6
  type InputFN = (auth?: AccessTokenPayload) => Handler<LoaderFunctionArgs> | Handler<ActionFunctionArgs>;
@@ -27,6 +27,7 @@ function createWithAuthHandler({ authService }) {
27
27
  return function(fn) {
28
28
  const handler = async function(arg) {
29
29
  const respond = async (auth) => {
30
+ const userAgent = arg.request.headers.get("User-Agent") || "";
30
31
  const res = await fn(auth)(arg);
31
32
  if (typeof res === "object" && res !== null && !Array.isArray(res)) {
32
33
  if (res instanceof Response) {
@@ -35,6 +36,7 @@ function createWithAuthHandler({ authService }) {
35
36
  return new Response(
36
37
  JSON.stringify({
37
38
  AUTH: auth,
39
+ userAgent,
38
40
  ...data
39
41
  }),
40
42
  {
@@ -47,6 +49,7 @@ function createWithAuthHandler({ authService }) {
47
49
  }
48
50
  return {
49
51
  AUTH: auth,
52
+ userAgent,
50
53
  ...res
51
54
  };
52
55
  }
@@ -3,6 +3,7 @@ function createWithAuthHandler({ authService }) {
3
3
  return function(fn) {
4
4
  const handler = async function(arg) {
5
5
  const respond = async (auth) => {
6
+ const userAgent = arg.request.headers.get("User-Agent") || "";
6
7
  const res = await fn(auth)(arg);
7
8
  if (typeof res === "object" && res !== null && !Array.isArray(res)) {
8
9
  if (res instanceof Response) {
@@ -11,6 +12,7 @@ function createWithAuthHandler({ authService }) {
11
12
  return new Response(
12
13
  JSON.stringify({
13
14
  AUTH: auth,
15
+ userAgent,
14
16
  ...data
15
17
  }),
16
18
  {
@@ -23,6 +25,7 @@ function createWithAuthHandler({ authService }) {
23
25
  }
24
26
  return {
25
27
  AUTH: auth,
28
+ userAgent,
26
29
  ...res
27
30
  };
28
31
  }
@@ -4,4 +4,4 @@ declare function ClientEnv({ dataKey }: {
4
4
  dataKey?: string;
5
5
  }): React.JSX.Element;
6
6
 
7
- export { ClientEnv as default };
7
+ export { ClientEnv };
@@ -4,4 +4,4 @@ declare function ClientEnv({ dataKey }: {
4
4
  dataKey?: string;
5
5
  }): React.JSX.Element;
6
6
 
7
- export { ClientEnv as default };
7
+ export { ClientEnv };
@@ -27,10 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/components/client_env.tsx
30
+ // src/client/client_env.tsx
31
31
  var client_env_exports = {};
32
32
  __export(client_env_exports, {
33
- default: () => ClientEnv
33
+ ClientEnv: () => ClientEnv
34
34
  });
35
35
  module.exports = __toCommonJS(client_env_exports);
36
36
  var import_react = __toESM(require("react"));
@@ -48,3 +48,7 @@ function ClientEnv({ dataKey = "ENV" }) {
48
48
  }
49
49
  ));
50
50
  }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ ClientEnv
54
+ });
@@ -1,4 +1,4 @@
1
- // src/components/client_env.tsx
1
+ // src/client/client_env.tsx
2
2
  import React from "react";
3
3
  import { useRouteLoaderData } from "react-router";
4
4
  function ClientEnv({ dataKey = "ENV" }) {
@@ -15,5 +15,5 @@ function ClientEnv({ dataKey = "ENV" }) {
15
15
  ));
16
16
  }
17
17
  export {
18
- ClientEnv as default
18
+ ClientEnv
19
19
  };
@@ -0,0 +1,3 @@
1
+ export { ClientEnv } from './client_env.mjs';
2
+ export { useUserAgent } from './use_user_agent.mjs';
3
+ import 'react';
@@ -0,0 +1,3 @@
1
+ export { ClientEnv } from './client_env.js';
2
+ export { useUserAgent } from './use_user_agent.js';
3
+ import 'react';
@@ -27,46 +27,43 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/auth/client/google_login_button.tsx
31
- var google_login_button_exports = {};
32
- __export(google_login_button_exports, {
33
- GoogleLoginButton: () => GoogleLoginButton
30
+ // src/client/index.ts
31
+ var client_exports = {};
32
+ __export(client_exports, {
33
+ ClientEnv: () => ClientEnv,
34
+ useUserAgent: () => useUserAgent
34
35
  });
35
- module.exports = __toCommonJS(google_login_button_exports);
36
- var import_react3 = __toESM(require("react"));
37
- var import_fc = require("react-icons/fc");
38
- var import_react_router2 = require("react-router");
36
+ module.exports = __toCommonJS(client_exports);
39
37
 
40
- // src/auth/client/provider.tsx
38
+ // src/client/client_env.tsx
41
39
  var import_react = __toESM(require("react"));
42
- var import_react2 = require("react");
43
40
  var import_react_router = require("react-router");
44
- var AuthContext = (0, import_react2.createContext)({});
45
- var useAuth = () => {
46
- return (0, import_react2.useContext)(AuthContext);
47
- };
48
-
49
- // src/auth/client/google_login_button.tsx
50
- function GoogleLoginButton({
51
- className = "max-w-[300px] w-full"
52
- }) {
53
- const { loginWithGoogle } = useAuth();
54
- const [searchParams] = (0, import_react_router2.useSearchParams)();
55
- const redirectUrl = searchParams.get("redirectUrl") || "";
56
- return /* @__PURE__ */ import_react3.default.createElement("div", { className }, /* @__PURE__ */ import_react3.default.createElement(
57
- "button",
41
+ function ClientEnv({ dataKey = "ENV" }) {
42
+ const data = (0, import_react_router.useRouteLoaderData)("root");
43
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data && /* @__PURE__ */ import_react.default.createElement(
44
+ "script",
58
45
  {
59
- type: "button",
60
- onClick: () => {
61
- loginWithGoogle(redirectUrl);
62
- },
63
- className: "relative flex items-center border border-neutral-300 px-4 py-3 no-underline hover:no-underline bg-white hover:bg-neutral-100 rounded"
64
- },
65
- /* @__PURE__ */ import_react3.default.createElement(import_fc.FcGoogle, null),
66
- /* @__PURE__ */ import_react3.default.createElement("p", { className: "text-[14px] text-black absolute left-0 right-0 text-center" }, "\uAD6C\uAE00\uB85C \uACC4\uC18D\uD558\uAE30")
46
+ dangerouslySetInnerHTML: {
47
+ __html: `window.process = ${JSON.stringify({
48
+ env: data?.[dataKey]
49
+ })}`
50
+ }
51
+ }
67
52
  ));
68
53
  }
54
+
55
+ // src/client/use_user_agent.tsx
56
+ var import_react_router2 = require("react-router");
57
+ function useUserAgent() {
58
+ const data = (0, import_react_router2.useRouteLoaderData)("root");
59
+ const userAgent = data?.userAgent || "";
60
+ const isMobile = /Mobi|Android/i.test(userAgent);
61
+ const isTablet = /Tablet|iPad/i.test(userAgent);
62
+ const isDesktop = !isMobile && !isTablet;
63
+ return { userAgent, isMobile, isTablet, isDesktop };
64
+ }
69
65
  // Annotate the CommonJS export names for ESM import in node:
70
66
  0 && (module.exports = {
71
- GoogleLoginButton
67
+ ClientEnv,
68
+ useUserAgent
72
69
  });
@@ -0,0 +1,31 @@
1
+ // src/client/client_env.tsx
2
+ import React from "react";
3
+ import { useRouteLoaderData } from "react-router";
4
+ function ClientEnv({ dataKey = "ENV" }) {
5
+ const data = useRouteLoaderData("root");
6
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, data && /* @__PURE__ */ React.createElement(
7
+ "script",
8
+ {
9
+ dangerouslySetInnerHTML: {
10
+ __html: `window.process = ${JSON.stringify({
11
+ env: data?.[dataKey]
12
+ })}`
13
+ }
14
+ }
15
+ ));
16
+ }
17
+
18
+ // src/client/use_user_agent.tsx
19
+ import { useRouteLoaderData as useRouteLoaderData2 } from "react-router";
20
+ function useUserAgent() {
21
+ const data = useRouteLoaderData2("root");
22
+ const userAgent = data?.userAgent || "";
23
+ const isMobile = /Mobi|Android/i.test(userAgent);
24
+ const isTablet = /Tablet|iPad/i.test(userAgent);
25
+ const isDesktop = !isMobile && !isTablet;
26
+ return { userAgent, isMobile, isTablet, isDesktop };
27
+ }
28
+ export {
29
+ ClientEnv,
30
+ useUserAgent
31
+ };
@@ -0,0 +1,8 @@
1
+ declare function useUserAgent(): {
2
+ userAgent: string;
3
+ isMobile: boolean;
4
+ isTablet: boolean;
5
+ isDesktop: boolean;
6
+ };
7
+
8
+ export { useUserAgent };
@@ -0,0 +1,8 @@
1
+ declare function useUserAgent(): {
2
+ userAgent: string;
3
+ isMobile: boolean;
4
+ isTablet: boolean;
5
+ isDesktop: boolean;
6
+ };
7
+
8
+ export { useUserAgent };
@@ -17,22 +17,22 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/file/client/format_size.ts
21
- var format_size_exports = {};
22
- __export(format_size_exports, {
23
- formatSize: () => formatSize
20
+ // src/client/use_user_agent.tsx
21
+ var use_user_agent_exports = {};
22
+ __export(use_user_agent_exports, {
23
+ useUserAgent: () => useUserAgent
24
24
  });
25
- module.exports = __toCommonJS(format_size_exports);
26
- function formatSize(size) {
27
- if (size < 1024) {
28
- return `${size} B`;
29
- }
30
- if (size < 1024 * 1024) {
31
- return `${(size / 1024).toFixed(2)} KB`;
32
- }
33
- return `${(size / (1024 * 1024)).toFixed(2)} MB`;
25
+ module.exports = __toCommonJS(use_user_agent_exports);
26
+ var import_react_router = require("react-router");
27
+ function useUserAgent() {
28
+ const data = (0, import_react_router.useRouteLoaderData)("root");
29
+ const userAgent = data?.userAgent || "";
30
+ const isMobile = /Mobi|Android/i.test(userAgent);
31
+ const isTablet = /Tablet|iPad/i.test(userAgent);
32
+ const isDesktop = !isMobile && !isTablet;
33
+ return { userAgent, isMobile, isTablet, isDesktop };
34
34
  }
35
35
  // Annotate the CommonJS export names for ESM import in node:
36
36
  0 && (module.exports = {
37
- formatSize
37
+ useUserAgent
38
38
  });
@@ -0,0 +1,13 @@
1
+ // src/client/use_user_agent.tsx
2
+ import { useRouteLoaderData } from "react-router";
3
+ function useUserAgent() {
4
+ const data = useRouteLoaderData("root");
5
+ const userAgent = data?.userAgent || "";
6
+ const isMobile = /Mobi|Android/i.test(userAgent);
7
+ const isTablet = /Tablet|iPad/i.test(userAgent);
8
+ const isDesktop = !isMobile && !isTablet;
9
+ return { userAgent, isMobile, isTablet, isDesktop };
10
+ }
11
+ export {
12
+ useUserAgent
13
+ };
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/file/client';
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/file/client';
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
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
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,20 +11,14 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
 
20
- // src/file/cdn.ts
21
- var cdn_exports = {};
22
- __export(cdn_exports, {
23
- createCDN: () => createCDN
24
- });
25
- module.exports = __toCommonJS(cdn_exports);
26
- var createCDN = (origin) => {
27
- return (key, { width } = {}) => {
28
- return key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : void 0;
29
- };
30
- };
17
+ // src/file/client/index.ts
18
+ var client_exports = {};
19
+ module.exports = __toCommonJS(client_exports);
20
+ __reExport(client_exports, require("dn-react-toolkit/file/client"), module.exports);
31
21
  // Annotate the CommonJS export names for ESM import in node:
32
22
  0 && (module.exports = {
33
- createCDN
23
+ ...require("dn-react-toolkit/file/client")
34
24
  });
@@ -0,0 +1,2 @@
1
+ // src/file/client/index.ts
2
+ export * from "dn-react-toolkit/file/client";
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/file';
@@ -0,0 +1 @@
1
+ export * from 'dn-react-toolkit/file';
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
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
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,18 +11,14 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
 
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
- }
17
+ // src/file/index.ts
18
+ var file_exports = {};
19
+ module.exports = __toCommonJS(file_exports);
20
+ __reExport(file_exports, require("dn-react-toolkit/file"), module.exports);
29
21
  // Annotate the CommonJS export names for ESM import in node:
30
22
  0 && (module.exports = {
31
- cn
23
+ ...require("dn-react-toolkit/file")
32
24
  });