@akanjs/next 0.0.97 → 0.0.98
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.
- package/{bootCsr.mjs → bootCsr.cjs} +52 -28
- package/bootCsr.js +28 -52
- package/createNextMiddleware.cjs +78 -0
- package/createNextMiddleware.js +13 -42
- package/createRobotPage.cjs +34 -0
- package/createRobotPage.js +3 -22
- package/createSitemapPage.cjs +26 -0
- package/createSitemapPage.js +3 -22
- package/index.cjs +60 -0
- package/index.js +40 -59
- package/lazy.cjs +35 -0
- package/lazy.js +5 -34
- package/{makePageProto.mjs → makePageProto.cjs} +32 -13
- package/makePageProto.js +13 -32
- package/package.json +2 -2
- package/types.cjs +15 -0
- package/types.js +0 -15
- package/useCamera.cjs +96 -0
- package/useCamera.js +17 -36
- package/useCodepush.cjs +103 -0
- package/useCodepush.js +25 -54
- package/useContact.cjs +55 -0
- package/useContact.js +12 -31
- package/{useCsrValues.mjs → useCsrValues.cjs} +74 -59
- package/useCsrValues.js +59 -74
- package/useDebounce.cjs +37 -0
- package/useDebounce.js +5 -24
- package/useFetch.cjs +42 -0
- package/useFetch.js +6 -25
- package/useGeoLocation.cjs +40 -0
- package/useGeoLocation.js +6 -25
- package/{useHistory.mjs → useHistory.cjs} +29 -10
- package/useHistory.js +10 -29
- package/useInterval.cjs +40 -0
- package/useInterval.js +7 -26
- package/{useLocation.mjs → useLocation.cjs} +24 -5
- package/useLocation.js +5 -24
- package/{usePurchase.mjs → usePurchase.cjs} +29 -10
- package/usePurchase.js +10 -29
- package/usePushNoti.cjs +61 -0
- package/usePushNoti.js +16 -35
- package/useThrottle.cjs +39 -0
- package/useThrottle.js +6 -25
- package/createNextMiddleware.mjs +0 -49
- package/createRobotPage.mjs +0 -15
- package/createSitemapPage.mjs +0 -7
- package/index.mjs +0 -41
- package/lazy.mjs +0 -6
- package/types.mjs +0 -0
- package/useCamera.mjs +0 -77
- package/useCodepush.mjs +0 -74
- package/useContact.mjs +0 -36
- package/useDebounce.mjs +0 -18
- package/useFetch.mjs +0 -23
- package/useGeoLocation.mjs +0 -21
- package/useInterval.mjs +0 -21
- package/usePushNoti.mjs +0 -42
- package/useThrottle.mjs +0 -20
package/useInterval.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useInterval_exports = {};
|
|
20
|
+
__export(useInterval_exports, {
|
|
21
|
+
useInterval: () => useInterval
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useInterval_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
const useInterval = (callback, delay) => {
|
|
26
|
+
const savedCallback = (0, import_react.useRef)(null);
|
|
27
|
+
(0, import_react.useEffect)(() => {
|
|
28
|
+
savedCallback.current = callback;
|
|
29
|
+
}, [callback]);
|
|
30
|
+
(0, import_react.useEffect)(() => {
|
|
31
|
+
const tick = () => {
|
|
32
|
+
void savedCallback.current?.();
|
|
33
|
+
};
|
|
34
|
+
const id = setInterval(tick, delay);
|
|
35
|
+
return () => {
|
|
36
|
+
clearInterval(id);
|
|
37
|
+
};
|
|
38
|
+
}, [delay]);
|
|
39
|
+
return savedCallback;
|
|
40
|
+
};
|
package/useInterval.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useInterval_exports = {};
|
|
20
|
-
__export(useInterval_exports, {
|
|
21
|
-
useInterval: () => useInterval
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useInterval_exports);
|
|
24
|
-
var import_react = require("react");
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
25
3
|
const useInterval = (callback, delay) => {
|
|
26
|
-
const savedCallback =
|
|
27
|
-
|
|
4
|
+
const savedCallback = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
28
6
|
savedCallback.current = callback;
|
|
29
7
|
}, [callback]);
|
|
30
|
-
|
|
8
|
+
useEffect(() => {
|
|
31
9
|
const tick = () => {
|
|
32
10
|
void savedCallback.current?.();
|
|
33
11
|
};
|
|
@@ -38,3 +16,6 @@ const useInterval = (callback, delay) => {
|
|
|
38
16
|
}, [delay]);
|
|
39
17
|
return savedCallback;
|
|
40
18
|
};
|
|
19
|
+
export {
|
|
20
|
+
useInterval
|
|
21
|
+
};
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useLocation_exports = {};
|
|
20
|
+
__export(useLocation_exports, {
|
|
21
|
+
useLocation: () => useLocation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useLocation_exports);
|
|
24
|
+
var import_react = require("react");
|
|
3
25
|
const useLocation = ({ rootRouteGuide }) => {
|
|
4
|
-
const getLocation = useCallback((href) => {
|
|
26
|
+
const getLocation = (0, import_react.useCallback)((href) => {
|
|
5
27
|
const getPathSegments = (pathname2) => {
|
|
6
28
|
return [
|
|
7
29
|
...pathname2.split("/").filter((pathSegment) => !!pathSegment).map((pathSegment) => `/${pathSegment}`)
|
|
@@ -54,6 +76,3 @@ const useLocation = ({ rootRouteGuide }) => {
|
|
|
54
76
|
}, []);
|
|
55
77
|
return { getLocation };
|
|
56
78
|
};
|
|
57
|
-
export {
|
|
58
|
-
useLocation
|
|
59
|
-
};
|
package/useLocation.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useLocation_exports = {};
|
|
20
|
-
__export(useLocation_exports, {
|
|
21
|
-
useLocation: () => useLocation
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useLocation_exports);
|
|
24
|
-
var import_react = require("react");
|
|
2
|
+
import { useCallback } from "react";
|
|
25
3
|
const useLocation = ({ rootRouteGuide }) => {
|
|
26
|
-
const getLocation =
|
|
4
|
+
const getLocation = useCallback((href) => {
|
|
27
5
|
const getPathSegments = (pathname2) => {
|
|
28
6
|
return [
|
|
29
7
|
...pathname2.split("/").filter((pathSegment) => !!pathSegment).map((pathSegment) => `/${pathSegment}`)
|
|
@@ -76,3 +54,6 @@ const useLocation = ({ rootRouteGuide }) => {
|
|
|
76
54
|
}, []);
|
|
77
55
|
return { getLocation };
|
|
78
56
|
};
|
|
57
|
+
export {
|
|
58
|
+
useLocation
|
|
59
|
+
};
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var usePurchase_exports = {};
|
|
20
|
+
__export(usePurchase_exports, {
|
|
21
|
+
usePurchase: () => usePurchase
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(usePurchase_exports);
|
|
24
|
+
var import_store = require("cordova-plugin-purchase/www/store");
|
|
25
|
+
var import_app = require("@capacitor/app");
|
|
26
|
+
var import_react = require("react");
|
|
5
27
|
const usePurchase = ({
|
|
6
28
|
platform,
|
|
7
29
|
productInfo,
|
|
@@ -9,15 +31,15 @@ const usePurchase = ({
|
|
|
9
31
|
onPay,
|
|
10
32
|
onSubscribe
|
|
11
33
|
}) => {
|
|
12
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
13
|
-
const billingRef = useRef();
|
|
14
|
-
useEffect(() => {
|
|
34
|
+
const [isLoading, setIsLoading] = (0, import_react.useState)(true);
|
|
35
|
+
const billingRef = (0, import_react.useRef)();
|
|
36
|
+
(0, import_react.useEffect)(() => {
|
|
15
37
|
const init = async () => {
|
|
16
38
|
if (CdvPurchase.store.isReady) {
|
|
17
39
|
setIsLoading(false);
|
|
18
40
|
return;
|
|
19
41
|
}
|
|
20
|
-
const app = await App.getInfo();
|
|
42
|
+
const app = await import_app.App.getInfo();
|
|
21
43
|
if (platform === "all")
|
|
22
44
|
CdvPurchase.store.register([
|
|
23
45
|
...productInfo.map((prouct) => ({
|
|
@@ -115,6 +137,3 @@ const usePurchase = ({
|
|
|
115
137
|
restorePurchases
|
|
116
138
|
};
|
|
117
139
|
};
|
|
118
|
-
export {
|
|
119
|
-
usePurchase
|
|
120
|
-
};
|
package/usePurchase.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var usePurchase_exports = {};
|
|
20
|
-
__export(usePurchase_exports, {
|
|
21
|
-
usePurchase: () => usePurchase
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(usePurchase_exports);
|
|
24
|
-
var import_store = require("cordova-plugin-purchase/www/store");
|
|
25
|
-
var import_app = require("@capacitor/app");
|
|
26
|
-
var import_react = require("react");
|
|
2
|
+
import "cordova-plugin-purchase/www/store";
|
|
3
|
+
import { App } from "@capacitor/app";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
27
5
|
const usePurchase = ({
|
|
28
6
|
platform,
|
|
29
7
|
productInfo,
|
|
@@ -31,15 +9,15 @@ const usePurchase = ({
|
|
|
31
9
|
onPay,
|
|
32
10
|
onSubscribe
|
|
33
11
|
}) => {
|
|
34
|
-
const [isLoading, setIsLoading] =
|
|
35
|
-
const billingRef =
|
|
36
|
-
|
|
12
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
13
|
+
const billingRef = useRef();
|
|
14
|
+
useEffect(() => {
|
|
37
15
|
const init = async () => {
|
|
38
16
|
if (CdvPurchase.store.isReady) {
|
|
39
17
|
setIsLoading(false);
|
|
40
18
|
return;
|
|
41
19
|
}
|
|
42
|
-
const app = await
|
|
20
|
+
const app = await App.getInfo();
|
|
43
21
|
if (platform === "all")
|
|
44
22
|
CdvPurchase.store.register([
|
|
45
23
|
...productInfo.map((prouct) => ({
|
|
@@ -137,3 +115,6 @@ const usePurchase = ({
|
|
|
137
115
|
restorePurchases
|
|
138
116
|
};
|
|
139
117
|
};
|
|
118
|
+
export {
|
|
119
|
+
usePurchase
|
|
120
|
+
};
|
package/usePushNoti.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var usePushNoti_exports = {};
|
|
20
|
+
__export(usePushNoti_exports, {
|
|
21
|
+
usePushNoti: () => usePushNoti
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(usePushNoti_exports);
|
|
24
|
+
var import_device = require("@capacitor/device");
|
|
25
|
+
var import_push_notifications = require("@capacitor/push-notifications");
|
|
26
|
+
var import_fcm = require("@capacitor-community/fcm");
|
|
27
|
+
const usePushNoti = () => {
|
|
28
|
+
const init = async () => {
|
|
29
|
+
const device = await import_device.Device.getInfo();
|
|
30
|
+
if (device.platform === "web")
|
|
31
|
+
return;
|
|
32
|
+
void import_fcm.FCM.setAutoInit({ enabled: true });
|
|
33
|
+
void import_push_notifications.PushNotifications.requestPermissions().then(async (result) => {
|
|
34
|
+
if (result.receive === "granted") {
|
|
35
|
+
await import_push_notifications.PushNotifications.register();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const checkPermission = async () => {
|
|
40
|
+
const { receive } = await import_push_notifications.PushNotifications.checkPermissions();
|
|
41
|
+
return receive === "granted";
|
|
42
|
+
};
|
|
43
|
+
const register = async () => {
|
|
44
|
+
const device = await import_device.Device.getInfo();
|
|
45
|
+
if (device.platform === "web")
|
|
46
|
+
return;
|
|
47
|
+
const { receive } = await import_push_notifications.PushNotifications.checkPermissions();
|
|
48
|
+
if (receive === "denied")
|
|
49
|
+
location.assign("app-settings:");
|
|
50
|
+
else
|
|
51
|
+
await import_push_notifications.PushNotifications.register();
|
|
52
|
+
};
|
|
53
|
+
const getToken = async () => {
|
|
54
|
+
const device = await import_device.Device.getInfo();
|
|
55
|
+
if (device.platform === "web")
|
|
56
|
+
return;
|
|
57
|
+
const { token } = await import_fcm.FCM.getToken();
|
|
58
|
+
return token;
|
|
59
|
+
};
|
|
60
|
+
return { init, checkPermission, register, getToken };
|
|
61
|
+
};
|
package/usePushNoti.js
CHANGED
|
@@ -1,61 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var usePushNoti_exports = {};
|
|
20
|
-
__export(usePushNoti_exports, {
|
|
21
|
-
usePushNoti: () => usePushNoti
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(usePushNoti_exports);
|
|
24
|
-
var import_device = require("@capacitor/device");
|
|
25
|
-
var import_push_notifications = require("@capacitor/push-notifications");
|
|
26
|
-
var import_fcm = require("@capacitor-community/fcm");
|
|
2
|
+
import { Device } from "@capacitor/device";
|
|
3
|
+
import { PushNotifications } from "@capacitor/push-notifications";
|
|
4
|
+
import { FCM } from "@capacitor-community/fcm";
|
|
27
5
|
const usePushNoti = () => {
|
|
28
6
|
const init = async () => {
|
|
29
|
-
const device = await
|
|
7
|
+
const device = await Device.getInfo();
|
|
30
8
|
if (device.platform === "web")
|
|
31
9
|
return;
|
|
32
|
-
void
|
|
33
|
-
void
|
|
10
|
+
void FCM.setAutoInit({ enabled: true });
|
|
11
|
+
void PushNotifications.requestPermissions().then(async (result) => {
|
|
34
12
|
if (result.receive === "granted") {
|
|
35
|
-
await
|
|
13
|
+
await PushNotifications.register();
|
|
36
14
|
}
|
|
37
15
|
});
|
|
38
16
|
};
|
|
39
17
|
const checkPermission = async () => {
|
|
40
|
-
const { receive } = await
|
|
18
|
+
const { receive } = await PushNotifications.checkPermissions();
|
|
41
19
|
return receive === "granted";
|
|
42
20
|
};
|
|
43
21
|
const register = async () => {
|
|
44
|
-
const device = await
|
|
22
|
+
const device = await Device.getInfo();
|
|
45
23
|
if (device.platform === "web")
|
|
46
24
|
return;
|
|
47
|
-
const { receive } = await
|
|
25
|
+
const { receive } = await PushNotifications.checkPermissions();
|
|
48
26
|
if (receive === "denied")
|
|
49
27
|
location.assign("app-settings:");
|
|
50
28
|
else
|
|
51
|
-
await
|
|
29
|
+
await PushNotifications.register();
|
|
52
30
|
};
|
|
53
31
|
const getToken = async () => {
|
|
54
|
-
const device = await
|
|
32
|
+
const device = await Device.getInfo();
|
|
55
33
|
if (device.platform === "web")
|
|
56
34
|
return;
|
|
57
|
-
const { token } = await
|
|
35
|
+
const { token } = await FCM.getToken();
|
|
58
36
|
return token;
|
|
59
37
|
};
|
|
60
38
|
return { init, checkPermission, register, getToken };
|
|
61
39
|
};
|
|
40
|
+
export {
|
|
41
|
+
usePushNoti
|
|
42
|
+
};
|
package/useThrottle.cjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useThrottle_exports = {};
|
|
20
|
+
__export(useThrottle_exports, {
|
|
21
|
+
useThrottle: () => useThrottle
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useThrottle_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
const useThrottle = (func, delay = 200, deps = []) => {
|
|
26
|
+
const throttleSeed = (0, import_react.useRef)(null);
|
|
27
|
+
const throttleFunction = (0, import_react.useCallback)(
|
|
28
|
+
(...args) => {
|
|
29
|
+
if (throttleSeed.current)
|
|
30
|
+
return;
|
|
31
|
+
func(...args);
|
|
32
|
+
throttleSeed.current = setTimeout(() => {
|
|
33
|
+
throttleSeed.current = null;
|
|
34
|
+
}, delay);
|
|
35
|
+
},
|
|
36
|
+
[func, delay, ...deps]
|
|
37
|
+
);
|
|
38
|
+
return throttleFunction;
|
|
39
|
+
};
|
package/useThrottle.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useThrottle_exports = {};
|
|
20
|
-
__export(useThrottle_exports, {
|
|
21
|
-
useThrottle: () => useThrottle
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useThrottle_exports);
|
|
24
|
-
var import_react = require("react");
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
25
3
|
const useThrottle = (func, delay = 200, deps = []) => {
|
|
26
|
-
const throttleSeed =
|
|
27
|
-
const throttleFunction =
|
|
4
|
+
const throttleSeed = useRef(null);
|
|
5
|
+
const throttleFunction = useCallback(
|
|
28
6
|
(...args) => {
|
|
29
7
|
if (throttleSeed.current)
|
|
30
8
|
return;
|
|
@@ -37,3 +15,6 @@ const useThrottle = (func, delay = 200, deps = []) => {
|
|
|
37
15
|
);
|
|
38
16
|
return throttleFunction;
|
|
39
17
|
};
|
|
18
|
+
export {
|
|
19
|
+
useThrottle
|
|
20
|
+
};
|
package/createNextMiddleware.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { logo } from "@akanjs/base";
|
|
2
|
-
import { Logger } from "@akanjs/common";
|
|
3
|
-
import { match as matchLocale } from "@formatjs/intl-localematcher";
|
|
4
|
-
import Negotiator from "negotiator";
|
|
5
|
-
import { NextResponse } from "next/server";
|
|
6
|
-
const i18n = { defaultLocale: "en", locales: ["en", "ko"] };
|
|
7
|
-
const basePaths = process.env.basePaths ? process.env.basePaths.split(",") : [];
|
|
8
|
-
function getLocale(request) {
|
|
9
|
-
if (!request.headers.get("accept-language"))
|
|
10
|
-
return i18n.defaultLocale;
|
|
11
|
-
const negotiatorHeaders = {};
|
|
12
|
-
request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
|
|
13
|
-
try {
|
|
14
|
-
const languages = new Negotiator({ headers: negotiatorHeaders }).languages();
|
|
15
|
-
return matchLocale(languages, i18n.locales, i18n.defaultLocale);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
return i18n.defaultLocale;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const createNextMiddleware = () => {
|
|
21
|
-
Logger.rawLog(logo, "console");
|
|
22
|
-
const middleware = (request) => {
|
|
23
|
-
const pathname = request.nextUrl.pathname;
|
|
24
|
-
const pathnameIsMissingLocale = i18n.locales.every(
|
|
25
|
-
(locale2) => !pathname.startsWith(`/${locale2}/`) && pathname !== `/${locale2}`
|
|
26
|
-
);
|
|
27
|
-
if (pathnameIsMissingLocale)
|
|
28
|
-
return NextResponse.redirect(
|
|
29
|
-
new URL(`/${getLocale(request)}/${request.nextUrl.href.split("/").slice(3).join("/")}`, request.url)
|
|
30
|
-
);
|
|
31
|
-
const splits = pathname.split("/");
|
|
32
|
-
const locale = splits[1];
|
|
33
|
-
const basePath = basePaths.includes(splits[2]) ? splits[2] : null;
|
|
34
|
-
const headers = new Headers(request.headers);
|
|
35
|
-
const searchParams = new URLSearchParams(request.nextUrl.search);
|
|
36
|
-
const searchParamJwt = searchParams.get("jwt");
|
|
37
|
-
headers.set("x-locale", locale);
|
|
38
|
-
headers.set("x-path", "/" + splits.slice(2).join("/"));
|
|
39
|
-
if (basePath)
|
|
40
|
-
headers.set("x-base-path", basePath);
|
|
41
|
-
if (searchParamJwt)
|
|
42
|
-
headers.set("jwt", searchParamJwt);
|
|
43
|
-
return NextResponse.next({ request: { headers } });
|
|
44
|
-
};
|
|
45
|
-
return middleware;
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
createNextMiddleware
|
|
49
|
-
};
|
package/createRobotPage.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const createRobotPage = (clientHttpUri, config) => {
|
|
2
|
-
return {
|
|
3
|
-
...config ?? {},
|
|
4
|
-
rules: {
|
|
5
|
-
userAgent: "*",
|
|
6
|
-
allow: "/",
|
|
7
|
-
disallow: "/admin/",
|
|
8
|
-
...config?.rules ?? {}
|
|
9
|
-
},
|
|
10
|
-
sitemap: `${clientHttpUri}/sitemap.xml`
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
createRobotPage
|
|
15
|
-
};
|
package/createSitemapPage.mjs
DELETED
package/index.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useFetch } from "./useFetch";
|
|
2
|
-
import { lazy } from "./lazy";
|
|
3
|
-
import { makePageProto } from "./makePageProto";
|
|
4
|
-
import { useDebounce } from "./useDebounce";
|
|
5
|
-
import { useInterval } from "./useInterval";
|
|
6
|
-
import { bootCsr } from "./bootCsr";
|
|
7
|
-
import { useCamera } from "./useCamera";
|
|
8
|
-
import { useContact } from "./useContact";
|
|
9
|
-
import { usePushNoti } from "./usePushNoti";
|
|
10
|
-
import { useGeoLocation } from "./useGeoLocation";
|
|
11
|
-
import { useCodepush } from "./useCodepush";
|
|
12
|
-
import { usePurchase } from "./usePurchase";
|
|
13
|
-
import { useCsrValues } from "./useCsrValues";
|
|
14
|
-
import { createRobotPage } from "./createRobotPage";
|
|
15
|
-
import { createSitemapPage } from "./createSitemapPage";
|
|
16
|
-
import { createNextMiddleware } from "./createNextMiddleware";
|
|
17
|
-
//! PageAgent csr에서 말썽 일으킨다
|
|
18
|
-
import { useThrottle } from "./useThrottle";
|
|
19
|
-
import { useHistory } from "./useHistory";
|
|
20
|
-
import { useLocation } from "./useLocation";
|
|
21
|
-
export {
|
|
22
|
-
bootCsr,
|
|
23
|
-
createNextMiddleware,
|
|
24
|
-
createRobotPage,
|
|
25
|
-
createSitemapPage,
|
|
26
|
-
lazy,
|
|
27
|
-
makePageProto,
|
|
28
|
-
useCamera,
|
|
29
|
-
useCodepush,
|
|
30
|
-
useContact,
|
|
31
|
-
useCsrValues,
|
|
32
|
-
useDebounce,
|
|
33
|
-
useFetch,
|
|
34
|
-
useGeoLocation,
|
|
35
|
-
useHistory,
|
|
36
|
-
useInterval,
|
|
37
|
-
useLocation,
|
|
38
|
-
usePurchase,
|
|
39
|
-
usePushNoti,
|
|
40
|
-
useThrottle
|
|
41
|
-
};
|
package/lazy.mjs
DELETED
package/types.mjs
DELETED
|
File without changes
|