@akanjs/next 0.0.39 → 0.0.40

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 (46) hide show
  1. package/csrTypes-B6ATv9-y.d.ts +88 -0
  2. package/index.d.ts +33 -0
  3. package/index.js +20 -2723
  4. package/package.json +2 -35
  5. package/src/bootCsr.d.ts +3 -0
  6. package/src/bootCsr.js +206 -0
  7. package/src/createNextMiddleware.d.ts +5 -0
  8. package/src/createNextMiddleware.js +88 -0
  9. package/src/createRobotPage.d.ts +5 -0
  10. package/src/createRobotPage.js +39 -0
  11. package/src/createSitemapPage.d.ts +5 -0
  12. package/src/createSitemapPage.js +34 -0
  13. package/src/index.d.ts +33 -0
  14. package/src/index.js +82 -0
  15. package/src/lazy.d.ts +8 -0
  16. package/src/lazy.js +40 -0
  17. package/src/makePageProto.d.ts +42 -0
  18. package/src/makePageProto.js +147 -0
  19. package/src/types.d.ts +9 -0
  20. package/src/types.js +15 -0
  21. package/src/useCamera.d.ts +11 -0
  22. package/src/useCamera.js +114 -0
  23. package/src/useCodepush.d.ts +51 -0
  24. package/src/useCodepush.js +115 -0
  25. package/src/useContact.d.ts +10 -0
  26. package/src/useContact.js +73 -0
  27. package/src/useCsrValues.d.ts +44 -0
  28. package/src/useCsrValues.js +924 -0
  29. package/src/useDebounce.d.ts +3 -0
  30. package/src/useDebounce.js +42 -0
  31. package/src/useFetch.d.ts +8 -0
  32. package/src/useFetch.js +54 -0
  33. package/src/useGeoLocation.d.ts +12 -0
  34. package/src/useGeoLocation.js +51 -0
  35. package/src/useHistory.d.ts +24 -0
  36. package/src/useHistory.js +88 -0
  37. package/src/useInterval.d.ts +5 -0
  38. package/src/useInterval.js +49 -0
  39. package/src/useLocation.d.ts +12 -0
  40. package/src/useLocation.js +92 -0
  41. package/src/usePurchase.d.ts +20 -0
  42. package/src/usePurchase.js +139 -0
  43. package/src/usePushNoti.d.ts +8 -0
  44. package/src/usePushNoti.js +68 -0
  45. package/src/useThrottle.d.ts +3 -0
  46. package/src/useThrottle.js +44 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/next",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,38 +14,5 @@
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
17
- "dependencies": {
18
- "@capacitor-community/contacts": "^6.1.1",
19
- "@capacitor-community/fcm": "^7.1.1",
20
- "@capacitor/app": "^7.0.1",
21
- "@capacitor/camera": "^7.0.1",
22
- "@capacitor/core": "^7.2.0",
23
- "@capacitor/device": "^7.0.1",
24
- "@capacitor/geolocation": "^7.1.2",
25
- "@capacitor/haptics": "^7.0.1",
26
- "@capacitor/keyboard": "^7.0.1",
27
- "@capacitor/preferences": "^7.0.1",
28
- "@capacitor/push-notifications": "^7.0.1",
29
- "@capgo/capacitor-updater": "^7.0.50",
30
- "@formatjs/intl-localematcher": "^0.5.10",
31
- "@react-spring/web": "^9.7.5",
32
- "@urql/core": "^5.1.0",
33
- "@use-gesture/react": "^10.3.1",
34
- "axios": "^1.7.9",
35
- "capacitor-plugin-safe-area": "^3.0.4",
36
- "clsx": "^2.1.1",
37
- "cordova-plugin-purchase": "^13.12.1",
38
- "dayjs": "^1.11.13",
39
- "immer": "^10.1.1",
40
- "js-cookie": "^3.0.5",
41
- "jwt-decode": "^4.0.0",
42
- "negotiator": "^1.0.0",
43
- "next": "^15.3.2",
44
- "pluralize": "^8.0.0",
45
- "react": "^18.3.1",
46
- "react-device-detect": "^2.2.3",
47
- "react-dom": "^18.3.1",
48
- "reflect-metadata": "^0.2.2",
49
- "socket.io-client": "^4.8.1"
50
- }
17
+ "dependencies": {}
51
18
  }
@@ -0,0 +1,3 @@
1
+ declare const bootCsr: (context: Record<string, () => Promise<unknown>>, rootPath: string, entryPath?: string) => Promise<void>;
2
+
3
+ export { bootCsr };
package/src/bootCsr.js ADDED
@@ -0,0 +1,206 @@
1
+ "use client";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var bootCsr_exports = {};
31
+ __export(bootCsr_exports, {
32
+ bootCsr: () => bootCsr
33
+ });
34
+ module.exports = __toCommonJS(bootCsr_exports);
35
+ var import_client = require("@akanjs/client");
36
+ var import_client2 = require("@akanjs/client");
37
+ var import_common = require("@akanjs/common");
38
+ var import_react = __toESM(require("react"));
39
+ var ReactDOM = __toESM(require("react-dom/client"));
40
+ var import_useCsrValues = require("./useCsrValues");
41
+ const supportLanguages = [
42
+ "en",
43
+ "ko"
44
+ ];
45
+ const bootCsr = /* @__PURE__ */ __name(async (context, rootPath, entryPath = "/route") => {
46
+ const [, jwt] = await Promise.all([
47
+ import_client.device.init({
48
+ supportLanguages
49
+ }),
50
+ import_client.storage.getItem("jwt")
51
+ ]);
52
+ if (jwt) (0, import_client.initAuth)({
53
+ jwt
54
+ });
55
+ import_common.Logger.verbose(`Set default language: ${import_client.device.lang}`);
56
+ const pages = {};
57
+ await Promise.all(Object.entries(context).map(async ([key, value]) => {
58
+ pages[key] = await value();
59
+ }));
60
+ const getPageState = /* @__PURE__ */ __name((csrConfig) => {
61
+ const { transition, safeArea, topInset, bottomInset, gesture, cache } = csrConfig ?? {};
62
+ const pageState = {
63
+ transition: transition ?? "none",
64
+ topSafeArea: safeArea === false ? 0 : import_client.device.topSafeArea,
65
+ bottomSafeArea: safeArea === false ? 0 : import_client.device.bottomSafeArea,
66
+ // topSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.topSafeArea,
67
+ // bottomSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.bottomSafeArea,
68
+ topInset: topInset === true ? import_client2.DEFAULT_TOP_INSET : topInset === false ? 0 : topInset ?? 0,
69
+ bottomInset: bottomInset === true ? import_client2.DEFAULT_BOTTOM_INSET : bottomInset === false ? 0 : bottomInset ?? 0,
70
+ gesture: gesture ?? true,
71
+ cache: cache ?? false
72
+ };
73
+ return pageState;
74
+ }, "getPageState");
75
+ const routeMap = /* @__PURE__ */ new Map();
76
+ routeMap.set("/", {
77
+ path: "/",
78
+ children: /* @__PURE__ */ new Map()
79
+ });
80
+ for (const filePath of Object.keys(pages)) {
81
+ const fileName = /\.\/(.*)\.tsx$/.exec(filePath)?.[1];
82
+ if (!fileName) continue;
83
+ const fileType = fileName.endsWith("page") ? "page" : fileName.endsWith("layout") ? "layout" : null;
84
+ if (!fileType) continue;
85
+ const pathSegments = [
86
+ "/",
87
+ ...fileName.split("/").slice(0, -1).map((segment) => `/${segment.replace(/\[(.*?)\]/g, ":$1")}`)
88
+ ];
89
+ const targetRouteMap = pathSegments.slice(0, -1).reduce((rMap, path) => {
90
+ if (!rMap.has(path)) rMap.set(path, {
91
+ path,
92
+ children: /* @__PURE__ */ new Map()
93
+ });
94
+ return rMap.get(path)?.children;
95
+ }, routeMap);
96
+ if (!targetRouteMap) continue;
97
+ const targetPath = pathSegments[pathSegments.length - 1];
98
+ targetRouteMap.set(targetPath, {
99
+ // action: pages[path]?.action,
100
+ // ErrorBoundary: pages[path]?.ErrorBoundary,
101
+ ...targetRouteMap.get(targetPath) ?? {
102
+ path: targetPath,
103
+ children: /* @__PURE__ */ new Map()
104
+ },
105
+ ...fileType === "layout" ? {
106
+ Layout: pages[filePath].default
107
+ } : {
108
+ Page: pages[filePath].default,
109
+ pageState: getPageState(pages[filePath].default.csrConfig),
110
+ csrConfig: pages[filePath].default.csrConfig
111
+ }
112
+ });
113
+ }
114
+ const pathname = window.location.pathname;
115
+ const initialPath = import_client.device.lang + entryPath;
116
+ window.document.body.style.overflow = "hidden";
117
+ const getPathRoutes = /* @__PURE__ */ __name((route, parentRootLayouts = [], parentLayouts = [], parentPaths = []) => {
118
+ const parentPath = parentPaths.filter((path2) => path2 !== "/").join("");
119
+ const currentPathSegment = /^\/\(.*\)$/.test(route.path) ? "" : route.path;
120
+ const isRoot = [
121
+ "/",
122
+ "/:lang"
123
+ ].includes(parentPath + currentPathSegment) && parentRootLayouts.length < 2;
124
+ const path = parentPath + currentPathSegment;
125
+ const pathSegments = [
126
+ ...parentPaths,
127
+ ...currentPathSegment ? [
128
+ currentPathSegment
129
+ ] : []
130
+ ];
131
+ const RootLayouts = [
132
+ ...parentRootLayouts,
133
+ ...isRoot && route.Layout ? [
134
+ route.Layout
135
+ ] : []
136
+ ];
137
+ const Layouts = [
138
+ ...parentLayouts,
139
+ ...!isRoot && route.Layout ? [
140
+ route.Layout
141
+ ] : []
142
+ ];
143
+ return [
144
+ ...route.Page ? [
145
+ {
146
+ path,
147
+ pathSegments,
148
+ Page: route.Page,
149
+ RootLayouts,
150
+ Layouts,
151
+ pageState: route.pageState ?? import_client2.defaultPageState
152
+ }
153
+ ] : [],
154
+ ...route.children.size ? [
155
+ ...route.children.values()
156
+ ].flatMap((child) => getPathRoutes(child, RootLayouts, Layouts, pathSegments)) : []
157
+ ];
158
+ }, "getPathRoutes");
159
+ const rootRoute = routeMap.get("/");
160
+ if (!rootRoute) throw new Error("No root route");
161
+ const pathRoutes = getPathRoutes(rootRoute);
162
+ const routeGuide = {
163
+ pathSegment: "/",
164
+ children: {}
165
+ };
166
+ pathRoutes.forEach((pathRoute) => {
167
+ const pathSegments = pathRoute.pathSegments.slice(1);
168
+ pathSegments.reduce((routeGuide2, pathSegment, index) => {
169
+ const child = routeGuide2.children[pathSegment];
170
+ routeGuide2.children[pathSegment] = {
171
+ ...child ?? {},
172
+ pathSegment,
173
+ ...index === pathSegments.length - 1 ? {
174
+ pathRoute
175
+ } : {},
176
+ children: child?.children ?? {}
177
+ };
178
+ return routeGuide2.children[pathSegment];
179
+ }, routeGuide);
180
+ });
181
+ const RouterProvider = /* @__PURE__ */ __name(() => {
182
+ const csrValues = (0, import_useCsrValues.useCsrValues)(routeGuide, pathRoutes);
183
+ const { location } = csrValues;
184
+ return /* @__PURE__ */ import_react.default.createElement(import_client2.csrContext.Provider, {
185
+ value: csrValues
186
+ }, location.pathRoute.RootLayouts.reduceRight((children, Layout) => {
187
+ return /* @__PURE__ */ import_react.default.createElement(Layout, {
188
+ params: location.params,
189
+ searchParams: location.searchParams
190
+ }, children);
191
+ }, /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null)));
192
+ }, "RouterProvider");
193
+ if (pathname !== `/${initialPath}`) {
194
+ window.location.replace(initialPath);
195
+ return;
196
+ } else {
197
+ const el = document.getElementById("root");
198
+ if (!el) throw new Error("No root element");
199
+ const root = ReactDOM.createRoot(el);
200
+ root.render(/* @__PURE__ */ import_react.default.createElement(RouterProvider, null));
201
+ }
202
+ }, "bootCsr");
203
+ // Annotate the CommonJS export names for ESM import in node:
204
+ 0 && (module.exports = {
205
+ bootCsr
206
+ });
@@ -0,0 +1,5 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ declare const createNextMiddleware: () => (request: NextRequest) => NextResponse<unknown>;
4
+
5
+ export { createNextMiddleware };
@@ -0,0 +1,88 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var createNextMiddleware_exports = {};
30
+ __export(createNextMiddleware_exports, {
31
+ createNextMiddleware: () => createNextMiddleware
32
+ });
33
+ module.exports = __toCommonJS(createNextMiddleware_exports);
34
+ var import_base = require("@akanjs/base");
35
+ var import_common = require("@akanjs/common");
36
+ var import_intl_localematcher = require("@formatjs/intl-localematcher");
37
+ var import_negotiator = __toESM(require("negotiator"));
38
+ var import_server = require("next/server");
39
+ const i18n = {
40
+ defaultLocale: "en",
41
+ locales: [
42
+ "en",
43
+ "ko"
44
+ ]
45
+ };
46
+ const basePaths = process.env.basePaths ? process.env.basePaths.split(",") : [];
47
+ function getLocale(request) {
48
+ if (!request.headers.get("accept-language")) return i18n.defaultLocale;
49
+ const negotiatorHeaders = {};
50
+ request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
51
+ try {
52
+ const languages = new import_negotiator.default({
53
+ headers: negotiatorHeaders
54
+ }).languages();
55
+ return (0, import_intl_localematcher.match)(languages, i18n.locales, i18n.defaultLocale);
56
+ } catch (e) {
57
+ return i18n.defaultLocale;
58
+ }
59
+ }
60
+ __name(getLocale, "getLocale");
61
+ const createNextMiddleware = /* @__PURE__ */ __name(() => {
62
+ import_common.Logger.rawLog(import_base.logo, "console");
63
+ const middleware = /* @__PURE__ */ __name((request) => {
64
+ const pathname = request.nextUrl.pathname;
65
+ const pathnameIsMissingLocale = i18n.locales.every((locale2) => !pathname.startsWith(`/${locale2}/`) && pathname !== `/${locale2}`);
66
+ if (pathnameIsMissingLocale) return import_server.NextResponse.redirect(new URL(`/${getLocale(request)}/${request.nextUrl.href.split("/").slice(3).join("/")}`, request.url));
67
+ const splits = pathname.split("/");
68
+ const locale = splits[1];
69
+ const basePath = basePaths.includes(splits[2]) ? splits[2] : null;
70
+ const headers = new Headers(request.headers);
71
+ const searchParams = new URLSearchParams(request.nextUrl.search);
72
+ const searchParamJwt = searchParams.get("jwt");
73
+ headers.set("x-locale", locale);
74
+ headers.set("x-path", "/" + splits.slice(2).join("/"));
75
+ if (basePath) headers.set("x-base-path", basePath);
76
+ if (searchParamJwt) headers.set("jwt", searchParamJwt);
77
+ return import_server.NextResponse.next({
78
+ request: {
79
+ headers
80
+ }
81
+ });
82
+ }, "middleware");
83
+ return middleware;
84
+ }, "createNextMiddleware");
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ createNextMiddleware
88
+ });
@@ -0,0 +1,5 @@
1
+ import { MetadataRoute } from 'next';
2
+
3
+ declare const createRobotPage: (clientHttpUri: string, config?: MetadataRoute.Robots) => MetadataRoute.Robots;
4
+
5
+ export { createRobotPage };
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var createRobotPage_exports = {};
20
+ __export(createRobotPage_exports, {
21
+ createRobotPage: () => createRobotPage
22
+ });
23
+ module.exports = __toCommonJS(createRobotPage_exports);
24
+ const createRobotPage = /* @__PURE__ */ __name((clientHttpUri, config) => {
25
+ return {
26
+ ...config ?? {},
27
+ rules: {
28
+ userAgent: "*",
29
+ allow: "/",
30
+ disallow: "/admin/",
31
+ ...config?.rules ?? {}
32
+ },
33
+ sitemap: `${clientHttpUri}/sitemap.xml`
34
+ };
35
+ }, "createRobotPage");
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ createRobotPage
39
+ });
@@ -0,0 +1,5 @@
1
+ import { MetadataRoute } from 'next';
2
+
3
+ declare const createSitemapPage: (clientHttpUri: string, paths: string[]) => MetadataRoute.Sitemap;
4
+
5
+ export { createSitemapPage };
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var createSitemapPage_exports = {};
20
+ __export(createSitemapPage_exports, {
21
+ createSitemapPage: () => createSitemapPage
22
+ });
23
+ module.exports = __toCommonJS(createSitemapPage_exports);
24
+ const lastModified = /* @__PURE__ */ new Date();
25
+ const createSitemapPage = /* @__PURE__ */ __name((clientHttpUri, paths) => {
26
+ return paths.map((path) => ({
27
+ url: `${clientHttpUri}${path}`,
28
+ lastModified
29
+ }));
30
+ }, "createSitemapPage");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ createSitemapPage
34
+ });
package/src/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ export { LoginAuth, LoginForm } from './types.js';
2
+ export { useFetch } from './useFetch.js';
3
+ export { lazy } from './lazy.js';
4
+ export { makePageProto } from './makePageProto.js';
5
+ export { useDebounce } from './useDebounce.js';
6
+ export { useInterval } from './useInterval.js';
7
+ export { bootCsr } from './bootCsr.js';
8
+ export { useCamera } from './useCamera.js';
9
+ export { useContact } from './useContact.js';
10
+ export { usePushNoti } from './usePushNoti.js';
11
+ export { useGeoLocation } from './useGeoLocation.js';
12
+ export { useCodepush } from './useCodepush.js';
13
+ export { CdvProductType, PlatformType, ProductType, usePurchase } from './usePurchase.js';
14
+ export { useCsrValues } from './useCsrValues.js';
15
+ export { createRobotPage } from './createRobotPage.js';
16
+ export { createSitemapPage } from './createSitemapPage.js';
17
+ export { createNextMiddleware } from './createNextMiddleware.js';
18
+ export { useThrottle } from './useThrottle.js';
19
+ export { useHistory } from './useHistory.js';
20
+ export { useLocation } from './useLocation.js';
21
+ import 'next/dynamic';
22
+ import 'react';
23
+ import '@capacitor/camera';
24
+ import '@capacitor-community/contacts';
25
+ import '@capacitor/geolocation';
26
+ import '@capacitor/core';
27
+ import 'dayjs';
28
+ import '@react-spring/web';
29
+ import '@use-gesture/react/dist/declarations/src/types';
30
+ import '../csrTypes-B6ATv9-y.js';
31
+ import 'react-spring';
32
+ import 'next';
33
+ import 'next/server';
package/src/index.js ADDED
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var src_exports = {};
19
+ __export(src_exports, {
20
+ bootCsr: () => import_bootCsr.bootCsr,
21
+ createNextMiddleware: () => import_createNextMiddleware.createNextMiddleware,
22
+ createRobotPage: () => import_createRobotPage.createRobotPage,
23
+ createSitemapPage: () => import_createSitemapPage.createSitemapPage,
24
+ lazy: () => import_lazy.lazy,
25
+ makePageProto: () => import_makePageProto.makePageProto,
26
+ useCamera: () => import_useCamera.useCamera,
27
+ useCodepush: () => import_useCodepush.useCodepush,
28
+ useContact: () => import_useContact.useContact,
29
+ useCsrValues: () => import_useCsrValues.useCsrValues,
30
+ useDebounce: () => import_useDebounce.useDebounce,
31
+ useFetch: () => import_useFetch.useFetch,
32
+ useGeoLocation: () => import_useGeoLocation.useGeoLocation,
33
+ useHistory: () => import_useHistory.useHistory,
34
+ useInterval: () => import_useInterval.useInterval,
35
+ useLocation: () => import_useLocation.useLocation,
36
+ usePurchase: () => import_usePurchase.usePurchase,
37
+ usePushNoti: () => import_usePushNoti.usePushNoti,
38
+ useThrottle: () => import_useThrottle.useThrottle
39
+ });
40
+ module.exports = __toCommonJS(src_exports);
41
+ var import_useFetch = require("./useFetch");
42
+ var import_lazy = require("./lazy");
43
+ var import_makePageProto = require("./makePageProto");
44
+ var import_useDebounce = require("./useDebounce");
45
+ var import_useInterval = require("./useInterval");
46
+ var import_bootCsr = require("./bootCsr");
47
+ var import_useCamera = require("./useCamera");
48
+ var import_useContact = require("./useContact");
49
+ var import_usePushNoti = require("./usePushNoti");
50
+ var import_useGeoLocation = require("./useGeoLocation");
51
+ var import_useCodepush = require("./useCodepush");
52
+ var import_usePurchase = require("./usePurchase");
53
+ var import_useCsrValues = require("./useCsrValues");
54
+ var import_createRobotPage = require("./createRobotPage");
55
+ var import_createSitemapPage = require("./createSitemapPage");
56
+ var import_createNextMiddleware = require("./createNextMiddleware");
57
+ var import_useThrottle = require("./useThrottle");
58
+ var import_useHistory = require("./useHistory");
59
+ var import_useLocation = require("./useLocation");
60
+ //! PageAgent csr에서 말썽 일으킨다
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ bootCsr,
64
+ createNextMiddleware,
65
+ createRobotPage,
66
+ createSitemapPage,
67
+ lazy,
68
+ makePageProto,
69
+ useCamera,
70
+ useCodepush,
71
+ useContact,
72
+ useCsrValues,
73
+ useDebounce,
74
+ useFetch,
75
+ useGeoLocation,
76
+ useHistory,
77
+ useInterval,
78
+ useLocation,
79
+ usePurchase,
80
+ usePushNoti,
81
+ useThrottle
82
+ });
package/src/lazy.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { DynamicOptions } from 'next/dynamic';
2
+ import { ComponentType } from 'react';
3
+
4
+ declare const lazy: <T extends ComponentType<any>>(loader: (x?: string) => Promise<{
5
+ default: T;
6
+ } | T>, option?: DynamicOptions<T>) => T;
7
+
8
+ export { lazy };
package/src/lazy.js ADDED
@@ -0,0 +1,40 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var lazy_exports = {};
30
+ __export(lazy_exports, {
31
+ lazy: () => lazy
32
+ });
33
+ module.exports = __toCommonJS(lazy_exports);
34
+ var import_dynamic = __toESM(require("next/dynamic"));
35
+ //! next build를 위해서 lint 무시
36
+ const lazy = /* @__PURE__ */ __name((loader, option) => (0, import_dynamic.default)(loader, option ?? {}), "lazy");
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ lazy
40
+ });
@@ -0,0 +1,42 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ type TranslationSingle = readonly [string, string] | readonly [string, string, string, string];
4
+ type TranslationWithParam = readonly [string, string, {
5
+ [key: string]: string | number;
6
+ }];
7
+ type Translation = TranslationSingle | TranslationWithParam;
8
+ type GetKeys<O> = O extends infer U ? (U extends object ? keyof U : never) : never;
9
+ type TransMessage<Locale extends Record<string, any>> = Locale extends infer U ? U extends object ? {
10
+ [K in keyof U]-?: `${K & string}${U[K] extends Record<string, any> ? `.${GetKeys<U[K]>}` : never}`;
11
+ }[keyof U] : never : never;
12
+
13
+ declare const makePageProto: <Locale extends {
14
+ [key: string]: {
15
+ [key: string]: Translation;
16
+ };
17
+ }>(locales: Locale[]) => () => {
18
+ path: string;
19
+ l: {
20
+ (key: TransMessage<Locale>, param?: {
21
+ [key: string]: string | number;
22
+ }): string;
23
+ rich(key: TransMessage<Locale>, param?: {
24
+ [key: string]: string | number;
25
+ }): ReactNode;
26
+ field<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey]): string;
27
+ desc<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey]): string;
28
+ enum<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey], value: string): string;
29
+ enumdesc<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey], value: string): string;
30
+ api<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey]): string;
31
+ apidesc<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey]): string;
32
+ arg<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey], arg: string): string;
33
+ argdesc<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey], arg: string): string;
34
+ qry<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey]): string;
35
+ qrydesc<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey]): string;
36
+ qarg<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey], arg: string): string;
37
+ qargdesc<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey], arg: string): string;
38
+ };
39
+ lang: string;
40
+ };
41
+
42
+ export { makePageProto };