@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
@@ -0,0 +1,147 @@
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 makePageProto_exports = {};
20
+ __export(makePageProto_exports, {
21
+ makePageProto: () => makePageProto
22
+ });
23
+ module.exports = __toCommonJS(makePageProto_exports);
24
+ var import_base = require("@akanjs/base");
25
+ var import_client = require("@akanjs/client");
26
+ var import_common = require("@akanjs/common");
27
+ const getPageInfo = /* @__PURE__ */ __name(() => {
28
+ if (import_base.baseClientEnv.side !== "server") {
29
+ return {
30
+ locale: window.location.pathname.split("/")[1] ?? "en",
31
+ path: "/" + window.location.pathname.split("/").slice(2).join("/")
32
+ };
33
+ }
34
+ const locale = (0, import_client.getHeader)("x-locale") ?? "en";
35
+ const path = (0, import_client.getHeader)("x-path") ?? "/";
36
+ return {
37
+ locale,
38
+ path
39
+ };
40
+ }, "getPageInfo");
41
+ const langIdx = {
42
+ en: 0,
43
+ ko: 1,
44
+ zhChs: 2,
45
+ zhCht: 3
46
+ };
47
+ const dictionary = {};
48
+ const translator = /* @__PURE__ */ __name((lang, key, param) => {
49
+ const idx = langIdx[lang];
50
+ try {
51
+ const msg = (0, import_common.pathGet)(key, dictionary)?.[idx];
52
+ if (!msg) {
53
+ import_common.Logger.error(`No translation for ${key}`);
54
+ return key;
55
+ }
56
+ return param ? msg.replace(/{([^}]+)}/g, (_, key2) => param[key2]) : msg;
57
+ } catch (e) {
58
+ return key;
59
+ }
60
+ }, "translator");
61
+ translator.rich = (lang, key, param) => {
62
+ const idx = langIdx[lang];
63
+ const msg = (0, import_common.pathGet)(key, dictionary)?.[idx];
64
+ if (!msg) {
65
+ import_common.Logger.error(`No translation for ${key}`);
66
+ return key;
67
+ }
68
+ return param ? msg.replace(/{([^}]+)}/g, (_, key2) => param[key2]) : msg;
69
+ };
70
+ const makePageProto = /* @__PURE__ */ __name((locales) => {
71
+ locales.forEach((locale) => {
72
+ Object.keys(locale).forEach((key) => dictionary[key] = Object.assign(dictionary[key] ?? {}, locale[key]));
73
+ });
74
+ return () => {
75
+ const { locale, path } = getPageInfo();
76
+ const lang = locale;
77
+ const l = /* @__PURE__ */ __name((key, param) => translator(lang, key, param), "l");
78
+ l.rich = (key, param) => /* @__PURE__ */ React.createElement("span", {
79
+ dangerouslySetInnerHTML: {
80
+ __html: translator.rich(lang, key, {
81
+ ...param,
82
+ // strong: (chunks: string) => `<b>${chunks}</b>`,
83
+ // "bg-primary": (chunks: string) => `<span className="bg-primary text-base-100">${chunks}</span>`,
84
+ // primary: (chunks: string) => `<span className="bg-base-100 text-primary">${chunks}</span>`,
85
+ br: `<br />`
86
+ })
87
+ }
88
+ });
89
+ l.field = (model, field) => {
90
+ const key = `${model}.${field}`;
91
+ return l(key);
92
+ };
93
+ l.desc = (model, field) => {
94
+ const key = `${model}.desc-${field}`;
95
+ return l(key);
96
+ };
97
+ l.enum = (model, field, value) => {
98
+ const key = `${model}.enum-${field}-${value}`;
99
+ return l(key);
100
+ };
101
+ l.enumdesc = (model, field, value) => {
102
+ const key = `${model}.enumdesc-${field}-${value}`;
103
+ return l(key);
104
+ };
105
+ l.api = (model, endpoint) => {
106
+ const key = `${model}.api-${endpoint}`;
107
+ return l(key);
108
+ };
109
+ l.apidesc = (model, endpoint) => {
110
+ const key = `${model}.apidesc-${endpoint}`;
111
+ return l(key);
112
+ };
113
+ l.arg = (model, endpoint, arg) => {
114
+ const key = `${model}.arg-${endpoint}-${arg}`;
115
+ return l(key);
116
+ };
117
+ l.argdesc = (model, endpoint, arg) => {
118
+ const key = `${model}.argdesc-${endpoint}-${arg}`;
119
+ return l(key);
120
+ };
121
+ l.qry = (model, queryKey) => {
122
+ const key = `${model}.qry-${queryKey}`;
123
+ return l(key);
124
+ };
125
+ l.qrydesc = (model, queryKey) => {
126
+ const key = `${model}.qrydesc-${queryKey}`;
127
+ return l(key);
128
+ };
129
+ l.qarg = (model, queryKey, arg) => {
130
+ const key = `${model}.qarg-${queryKey}-${arg}`;
131
+ return l(key);
132
+ };
133
+ l.qargdesc = (model, queryKey, arg) => {
134
+ const key = `${model}.qargdesc-${queryKey}-${arg}`;
135
+ return l(key);
136
+ };
137
+ return {
138
+ path,
139
+ l,
140
+ lang
141
+ };
142
+ };
143
+ }, "makePageProto");
144
+ // Annotate the CommonJS export names for ESM import in node:
145
+ 0 && (module.exports = {
146
+ makePageProto
147
+ });
package/src/types.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ type LoginAuth = "user" | "admin" | "public";
2
+ interface LoginForm {
3
+ auth: LoginAuth;
4
+ redirect?: string;
5
+ unauthorize?: string;
6
+ jwt?: string | null;
7
+ }
8
+
9
+ export type { LoginAuth, LoginForm };
package/src/types.js ADDED
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var types_exports = {};
15
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,11 @@
1
+ import * as _capacitor_camera from '@capacitor/camera';
2
+ import { PermissionStatus } from '@capacitor/camera';
3
+
4
+ declare const useCamera: () => {
5
+ permissions: PermissionStatus;
6
+ getPhoto: (src?: "prompt" | "camera" | "photos") => Promise<_capacitor_camera.Photo | undefined>;
7
+ pickImage: () => Promise<_capacitor_camera.GalleryPhotos>;
8
+ checkPermission: (type: "photos" | "camera" | "all") => Promise<void>;
9
+ };
10
+
11
+ export { useCamera };
@@ -0,0 +1,114 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var useCamera_exports = {};
21
+ __export(useCamera_exports, {
22
+ useCamera: () => useCamera
23
+ });
24
+ module.exports = __toCommonJS(useCamera_exports);
25
+ var import_client = require("@akanjs/client");
26
+ var import_camera = require("@capacitor/camera");
27
+ var import_react = require("react");
28
+ const useCamera = /* @__PURE__ */ __name(() => {
29
+ const [permissions, setPermissions] = (0, import_react.useState)({
30
+ camera: "prompt",
31
+ photos: "prompt"
32
+ });
33
+ const checkPermission = /* @__PURE__ */ __name(async (type) => {
34
+ try {
35
+ if (type === "photos") {
36
+ if (permissions.photos === "prompt") {
37
+ const { photos } = await import_camera.Camera.requestPermissions();
38
+ setPermissions((prev) => ({
39
+ ...prev,
40
+ photos
41
+ }));
42
+ } else if (permissions.photos === "denied") {
43
+ location.assign("app-settings:");
44
+ return;
45
+ }
46
+ } else if (type === "camera") {
47
+ if (permissions.camera === "prompt") {
48
+ const { camera } = await import_camera.Camera.requestPermissions();
49
+ setPermissions((prev) => ({
50
+ ...prev,
51
+ camera
52
+ }));
53
+ } else if (permissions.camera === "denied") {
54
+ location.assign("app-settings:");
55
+ return;
56
+ }
57
+ } else {
58
+ if (permissions.camera === "prompt" || permissions.photos === "prompt") {
59
+ const permissions2 = await import_camera.Camera.requestPermissions();
60
+ setPermissions(permissions2);
61
+ } else if (permissions.camera === "denied" || permissions.photos === "denied") {
62
+ location.assign("app-settings:");
63
+ return;
64
+ }
65
+ }
66
+ } catch (e) {
67
+ }
68
+ }, "checkPermission");
69
+ const getPhoto = /* @__PURE__ */ __name(async (src = "prompt") => {
70
+ const source = import_client.device.info.platform !== "web" ? src === "prompt" ? import_camera.CameraSource.Prompt : src === "camera" ? import_camera.CameraSource.Camera : import_camera.CameraSource.Photos : import_camera.CameraSource.Photos;
71
+ const permission = src === "prompt" ? "all" : src === "camera" ? "camera" : "photos";
72
+ void checkPermission(permission);
73
+ try {
74
+ const photo = await import_camera.Camera.getPhoto({
75
+ quality: 100,
76
+ source,
77
+ allowEditing: false,
78
+ resultType: import_camera.CameraResultType.DataUrl,
79
+ promptLabelHeader: "\uD504\uB85C\uD544 \uC0AC\uC9C4\uC744 \uC62C\uB824\uC8FC\uC138\uC694",
80
+ promptLabelPhoto: "\uC568\uBC94\uC5D0\uC11C \uC120\uD0DD\uD558\uAE30",
81
+ promptLabelPicture: "\uC0AC\uC9C4 \uCC0D\uAE30",
82
+ promptLabelCancel: "\uCDE8\uC18C"
83
+ });
84
+ return photo;
85
+ } catch (e) {
86
+ if (e === "User cancelled photos app") return;
87
+ }
88
+ }, "getPhoto");
89
+ const pickImage = /* @__PURE__ */ __name(async () => {
90
+ void checkPermission("photos");
91
+ const photo = await import_camera.Camera.pickImages({
92
+ quality: 90
93
+ });
94
+ return photo;
95
+ }, "pickImage");
96
+ (0, import_react.useEffect)(() => {
97
+ void (async () => {
98
+ if (import_client.device.info.platform !== "web") {
99
+ const permissions2 = await import_camera.Camera.checkPermissions();
100
+ setPermissions(permissions2);
101
+ }
102
+ })();
103
+ }, []);
104
+ return {
105
+ permissions,
106
+ getPhoto,
107
+ pickImage,
108
+ checkPermission
109
+ };
110
+ }, "useCamera");
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ useCamera
114
+ });
@@ -0,0 +1,51 @@
1
+ import { Dayjs } from 'dayjs';
2
+
3
+ interface ProtoFile {
4
+ id: string;
5
+ filename: string;
6
+ abstractData: string | null;
7
+ imageSize: [number, number];
8
+ progress: number | null;
9
+ url: string;
10
+ size: number;
11
+ status: string;
12
+ createdAt: Dayjs;
13
+ updatedAt: Dayjs;
14
+ removedAt: Dayjs | null;
15
+ mimetype: string;
16
+ encoding: string;
17
+ origin: string | null;
18
+ lastModifiedAt: Dayjs;
19
+ }
20
+ interface ProtoAppInfo {
21
+ appId: string | null;
22
+ appName: string;
23
+ deviceId: string | null;
24
+ platform: "ios" | "android" | null;
25
+ major: number;
26
+ minor: number;
27
+ patch: number;
28
+ branch: string;
29
+ buildNum: string | null;
30
+ versionOs: string | null;
31
+ isEmulator: boolean | null;
32
+ }
33
+
34
+ declare const useCodepush: ({ serverUrl, branch }: {
35
+ serverUrl: string;
36
+ branch: "debug" | "develop" | "main";
37
+ }) => {
38
+ update: boolean;
39
+ version: string;
40
+ initialize: () => Promise<void>;
41
+ checkNewRelease: () => Promise<{
42
+ release: ProtoAppInfo & {
43
+ appBuild: string;
44
+ };
45
+ bundleFile: ProtoFile;
46
+ } | undefined>;
47
+ codepush: () => Promise<void>;
48
+ statManager: () => Promise<void>;
49
+ };
50
+
51
+ export { useCodepush };
@@ -0,0 +1,115 @@
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 useCodepush_exports = {};
31
+ __export(useCodepush_exports, {
32
+ useCodepush: () => useCodepush
33
+ });
34
+ module.exports = __toCommonJS(useCodepush_exports);
35
+ var import_common = require("@akanjs/common");
36
+ var import_app = require("@capacitor/app");
37
+ var import_device = require("@capacitor/device");
38
+ var import_capacitor_updater = require("@capgo/capacitor-updater");
39
+ var import_axios = __toESM(require("axios"));
40
+ var import_react = require("react");
41
+ const useCodepush = /* @__PURE__ */ __name(({ serverUrl, branch }) => {
42
+ const [update, setUpdate] = (0, import_react.useState)(false);
43
+ const [version, setVersion] = (0, import_react.useState)("");
44
+ const initialize = /* @__PURE__ */ __name(async () => {
45
+ await import_capacitor_updater.CapacitorUpdater.notifyAppReady();
46
+ }, "initialize");
47
+ const checkNewRelease = /* @__PURE__ */ __name(async () => {
48
+ const info = await import_device.Device.getInfo();
49
+ const app = await import_app.App.getInfo();
50
+ const pluginVersion = await import_capacitor_updater.CapacitorUpdater.getPluginVersion();
51
+ const { deviceId } = await import_capacitor_updater.CapacitorUpdater.getDeviceId();
52
+ const { bundle: version2, native } = await import_capacitor_updater.CapacitorUpdater.current();
53
+ const builtInversion = await import_capacitor_updater.CapacitorUpdater.getBuiltinVersion();
54
+ const appId = app.id;
55
+ const platform = info.platform;
56
+ window.alert(`getBuildinVersion:${builtInversion.version}
57
+ current.bundle:${version2.version}
58
+ currennt.native:${native}`);
59
+ const { major, minor, patch } = (0, import_common.splitVersion)(version2.version === "builtin" ? app.version : version2.version);
60
+ const appName = process.env.NEXT_PUBLIC_APP_NAME ?? "";
61
+ const appInfo = {
62
+ appId,
63
+ appName,
64
+ deviceId,
65
+ platform,
66
+ branch,
67
+ isEmulator: info.isVirtual,
68
+ major: parseInt(major),
69
+ minor: parseInt(minor),
70
+ patch: parseInt(patch),
71
+ buildNum: app.build,
72
+ versionOs: info.osVersion
73
+ };
74
+ const url = serverUrl.replace("lu", "akasys");
75
+ const release = (await import_axios.default.post(`${url}/release/codepush`, {
76
+ data: {
77
+ ...appInfo
78
+ }
79
+ })).data;
80
+ if (!release) return;
81
+ const file = (await import_axios.default.get(`${url}/file/file/${release.appBuild}`)).data;
82
+ return {
83
+ release,
84
+ bundleFile: file
85
+ };
86
+ }, "checkNewRelease");
87
+ const codepush = /* @__PURE__ */ __name(async () => {
88
+ const isNewRelease = await checkNewRelease();
89
+ if (!isNewRelease) return;
90
+ const { release, bundleFile } = isNewRelease;
91
+ setUpdate(true);
92
+ const bundle = await import_capacitor_updater.CapacitorUpdater.download({
93
+ url: bundleFile.url,
94
+ version: (0, import_common.mergeVersion)(release.major, release.minor, release.patch)
95
+ });
96
+ await import_capacitor_updater.CapacitorUpdater.set(bundle);
97
+ }, "codepush");
98
+ const getVersion = /* @__PURE__ */ __name(async () => {
99
+ return await import_capacitor_updater.CapacitorUpdater.getBuiltinVersion();
100
+ }, "getVersion");
101
+ const statManager = /* @__PURE__ */ __name(async () => {
102
+ }, "statManager");
103
+ return {
104
+ update,
105
+ version,
106
+ initialize,
107
+ checkNewRelease,
108
+ codepush,
109
+ statManager
110
+ };
111
+ }, "useCodepush");
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ useCodepush
115
+ });
@@ -0,0 +1,10 @@
1
+ import * as _capacitor_community_contacts from '@capacitor-community/contacts';
2
+ import { PermissionStatus } from '@capacitor-community/contacts';
3
+
4
+ declare const useContact: () => {
5
+ permissions: PermissionStatus;
6
+ getContacts: () => Promise<_capacitor_community_contacts.ContactPayload[]>;
7
+ checkPermission: () => Promise<void>;
8
+ };
9
+
10
+ export { useContact };
@@ -0,0 +1,73 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var useContact_exports = {};
21
+ __export(useContact_exports, {
22
+ useContact: () => useContact
23
+ });
24
+ module.exports = __toCommonJS(useContact_exports);
25
+ var import_client = require("@akanjs/client");
26
+ var import_contacts = require("@capacitor-community/contacts");
27
+ var import_react = require("react");
28
+ const useContact = /* @__PURE__ */ __name(() => {
29
+ const [permissions, setPermissions] = (0, import_react.useState)({
30
+ contacts: "prompt"
31
+ });
32
+ const checkPermission = /* @__PURE__ */ __name(async () => {
33
+ try {
34
+ if (permissions.contacts === "prompt") {
35
+ const { contacts } = await import_contacts.Contacts.requestPermissions();
36
+ setPermissions((prev) => ({
37
+ ...prev,
38
+ contacts
39
+ }));
40
+ } else if (permissions.contacts === "denied") {
41
+ location.assign("app-settings:");
42
+ return;
43
+ }
44
+ } catch (e) {
45
+ }
46
+ }, "checkPermission");
47
+ const getContacts = /* @__PURE__ */ __name(async () => {
48
+ await checkPermission();
49
+ const { contacts } = await import_contacts.Contacts.getContacts({
50
+ projection: {
51
+ name: true,
52
+ phones: true
53
+ }
54
+ });
55
+ return contacts;
56
+ }, "getContacts");
57
+ (0, import_react.useEffect)(() => {
58
+ void (async () => {
59
+ if (import_client.device.info.platform === "web") return;
60
+ const permissions2 = await import_contacts.Contacts.checkPermissions();
61
+ setPermissions(permissions2);
62
+ })();
63
+ }, []);
64
+ return {
65
+ permissions,
66
+ getContacts,
67
+ checkPermission
68
+ };
69
+ }, "useContact");
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ useContact
73
+ });
@@ -0,0 +1,44 @@
1
+ import * as react from 'react';
2
+ import * as _react_spring_web from '@react-spring/web';
3
+ import * as _use_gesture_react_dist_declarations_src_types from '@use-gesture/react/dist/declarations/src/types';
4
+ import { R as RouteGuide, P as PathRoute, S as SafeAreaTransition, a as PageTransition, C as ContainerTransition, L as Location, H as History, T as TransitionType } from '../csrTypes-B6ATv9-y.js';
5
+ import 'react-spring';
6
+
7
+ interface RouterInstance {
8
+ push: (href: string) => void;
9
+ replace: (href: string) => void;
10
+ back: () => void;
11
+ refresh: () => void;
12
+ }
13
+
14
+ declare const useCsrValues: (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]) => {
15
+ topSafeArea: SafeAreaTransition | null;
16
+ page: PageTransition | null;
17
+ prevPage: PageTransition | null;
18
+ topInset: ContainerTransition | null;
19
+ bottomInset: ContainerTransition | null;
20
+ topLeftAction: ContainerTransition | null;
21
+ bottomSafeArea: SafeAreaTransition | null;
22
+ pageBind: (...args: any[]) => _use_gesture_react_dist_declarations_src_types.ReactDOMAttributes;
23
+ pageClassName: string;
24
+ transDirection: "vertical" | "horizontal" | "none";
25
+ transUnitRange: number[];
26
+ transUnit: _react_spring_web.SpringValue<number>;
27
+ transPercent: _react_spring_web.Interpolation<number>;
28
+ transProgress: _react_spring_web.Interpolation<number>;
29
+ clientWidth: number;
30
+ clientHeight: number;
31
+ location: Location;
32
+ prevLocation: Location | null;
33
+ history: react.MutableRefObject<History>;
34
+ topSafeAreaRef: react.MutableRefObject<HTMLDivElement | null>;
35
+ bottomSafeAreaRef: react.MutableRefObject<HTMLDivElement | null>;
36
+ prevPageContentRef: react.MutableRefObject<HTMLDivElement | null>;
37
+ pageContentRef: react.MutableRefObject<HTMLDivElement | null>;
38
+ frameRootRef: react.MutableRefObject<HTMLDivElement | null>;
39
+ onBack: react.MutableRefObject<{ [K in TransitionType]?: () => Promise<void>; }>;
40
+ router: RouterInstance;
41
+ pathRoutes: PathRoute[];
42
+ };
43
+
44
+ export { useCsrValues };