@akanjs/next 0.0.39 → 0.0.41

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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/next",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1 @@
1
+ export declare const bootCsr: (context: Record<string, () => Promise<unknown>>, rootPath: string, entryPath?: string) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { NextRequest, NextResponse } from "next/server";
2
+ export declare const createNextMiddleware: () => (request: NextRequest) => NextResponse<unknown>;
@@ -0,0 +1,2 @@
1
+ import { MetadataRoute } from "next";
2
+ export declare const createRobotPage: (clientHttpUri: string, config?: MetadataRoute.Robots) => MetadataRoute.Robots;
@@ -0,0 +1,2 @@
1
+ import { MetadataRoute } from "next";
2
+ export declare const createSitemapPage: (clientHttpUri: string, paths: string[]) => MetadataRoute.Sitemap;
package/src/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export type * from "./types";
2
+ export { useFetch } from "./useFetch";
3
+ export { lazy } from "./lazy";
4
+ export { makePageProto } from "./makePageProto";
5
+ export { useDebounce } from "./useDebounce";
6
+ export { useInterval } from "./useInterval";
7
+ export { bootCsr } from "./bootCsr";
8
+ export { useCamera } from "./useCamera";
9
+ export { useContact } from "./useContact";
10
+ export { usePushNoti } from "./usePushNoti";
11
+ export { useGeoLocation } from "./useGeoLocation";
12
+ export { useCodepush } from "./useCodepush";
13
+ export { usePurchase, type PlatformType, type ProductType, type CdvProductType } from "./usePurchase";
14
+ export { useCsrValues } from "./useCsrValues";
15
+ export { createRobotPage } from "./createRobotPage";
16
+ export { createSitemapPage } from "./createSitemapPage";
17
+ export { createNextMiddleware } from "./createNextMiddleware";
18
+ export { useThrottle } from "./useThrottle";
19
+ export { useHistory } from "./useHistory";
20
+ export { useLocation } from "./useLocation";
package/src/lazy.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { DynamicOptions } from "next/dynamic";
2
+ import { ComponentType } from "react";
3
+ export declare const lazy: <T extends ComponentType<any>>(loader: (x?: string) => Promise<{
4
+ default: T;
5
+ } | T>, option?: DynamicOptions<T>) => T;
@@ -0,0 +1,30 @@
1
+ import { type Translation, type TransMessage } from "@akanjs/dictionary";
2
+ import type { ReactNode } from "react";
3
+ export declare const makePageProto: <Locale extends {
4
+ [key: string]: {
5
+ [key: string]: Translation;
6
+ };
7
+ }>(locales: Locale[]) => () => {
8
+ path: string;
9
+ l: {
10
+ (key: TransMessage<Locale>, param?: {
11
+ [key: string]: string | number;
12
+ }): string;
13
+ rich(key: TransMessage<Locale>, param?: {
14
+ [key: string]: string | number;
15
+ }): ReactNode;
16
+ field<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey]): string;
17
+ desc<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey]): string;
18
+ enum<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey], value: string): string;
19
+ enumdesc<ModelKey extends keyof Locale>(model: ModelKey, field: keyof Locale[ModelKey], value: string): string;
20
+ api<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey]): string;
21
+ apidesc<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey]): string;
22
+ arg<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey], arg: string): string;
23
+ argdesc<ModelKey extends keyof Locale>(model: ModelKey, endpoint: keyof Locale[ModelKey], arg: string): string;
24
+ qry<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey]): string;
25
+ qrydesc<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey]): string;
26
+ qarg<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey], arg: string): string;
27
+ qargdesc<ModelKey extends keyof Locale>(model: ModelKey, queryKey: keyof Locale[ModelKey], arg: string): string;
28
+ };
29
+ lang: string;
30
+ };
package/src/types.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export type LoginAuth = "user" | "admin" | "public";
2
+ export interface LoginForm {
3
+ auth: LoginAuth;
4
+ redirect?: string;
5
+ unauthorize?: string;
6
+ jwt?: string | null;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { PermissionStatus } from "@capacitor/camera";
2
+ export declare const useCamera: () => {
3
+ permissions: PermissionStatus;
4
+ getPhoto: (src?: "prompt" | "camera" | "photos") => Promise<import("@capacitor/camera").Photo | undefined>;
5
+ pickImage: () => Promise<import("@capacitor/camera").GalleryPhotos>;
6
+ checkPermission: (type: "photos" | "camera" | "all") => Promise<void>;
7
+ };
@@ -0,0 +1,17 @@
1
+ import type { ProtoAppInfo, ProtoFile } from "@akanjs/constant";
2
+ export declare const useCodepush: ({ serverUrl, branch }: {
3
+ serverUrl: string;
4
+ branch: "debug" | "develop" | "main";
5
+ }) => {
6
+ update: boolean;
7
+ version: string;
8
+ initialize: () => Promise<void>;
9
+ checkNewRelease: () => Promise<{
10
+ release: ProtoAppInfo & {
11
+ appBuild: string;
12
+ };
13
+ bundleFile: ProtoFile;
14
+ } | undefined>;
15
+ codepush: () => Promise<void>;
16
+ statManager: () => Promise<void>;
17
+ };
@@ -0,0 +1,6 @@
1
+ import { PermissionStatus } from "@capacitor-community/contacts";
2
+ export declare const useContact: () => {
3
+ permissions: PermissionStatus;
4
+ getContacts: () => Promise<import("@capacitor-community/contacts").ContactPayload[]>;
5
+ checkPermission: () => Promise<void>;
6
+ };
@@ -0,0 +1,30 @@
1
+ import { PathRoute, type RouteGuide, type RouterInstance, type TransitionType } from "@akanjs/client";
2
+ export declare const useCsrValues: (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]) => {
3
+ topSafeArea: import("@akanjs/client").SafeAreaTransition | null;
4
+ page: import("@akanjs/client").PageTransition | null;
5
+ prevPage: import("@akanjs/client").PageTransition | null;
6
+ topInset: import("@akanjs/client").ContainerTransition | null;
7
+ bottomInset: import("@akanjs/client").ContainerTransition | null;
8
+ topLeftAction: import("@akanjs/client").ContainerTransition | null;
9
+ bottomSafeArea: import("@akanjs/client").SafeAreaTransition | null;
10
+ pageBind: (...args: any[]) => import("@use-gesture/react/dist/declarations/src/types").ReactDOMAttributes;
11
+ pageClassName: string;
12
+ transDirection: "vertical" | "horizontal" | "none";
13
+ transUnitRange: number[];
14
+ transUnit: import("@react-spring/web").SpringValue<number>;
15
+ transPercent: import("@react-spring/web").Interpolation<number>;
16
+ transProgress: import("@react-spring/web").Interpolation<number>;
17
+ clientWidth: number;
18
+ clientHeight: number;
19
+ location: import("@akanjs/client").Location;
20
+ prevLocation: import("@akanjs/client").Location | null;
21
+ history: import("react").MutableRefObject<import("@akanjs/client").History>;
22
+ topSafeAreaRef: import("react").MutableRefObject<HTMLDivElement | null>;
23
+ bottomSafeAreaRef: import("react").MutableRefObject<HTMLDivElement | null>;
24
+ prevPageContentRef: import("react").MutableRefObject<HTMLDivElement | null>;
25
+ pageContentRef: import("react").MutableRefObject<HTMLDivElement | null>;
26
+ frameRootRef: import("react").MutableRefObject<HTMLDivElement | null>;
27
+ onBack: import("react").MutableRefObject<{ [K in TransitionType]?: () => Promise<void>; }>;
28
+ router: RouterInstance;
29
+ pathRoutes: PathRoute[];
30
+ };
@@ -0,0 +1 @@
1
+ export declare const useDebounce: <Callback extends (...args: any) => any>(callback: Callback, states?: any[], wait?: number) => Callback;
@@ -0,0 +1,6 @@
1
+ export declare const useFetch: <Return>(fnOrPromise: Promise<Return> | Return, { onError }?: {
2
+ onError?: (err: string) => void;
3
+ }) => {
4
+ fulfilled: boolean;
5
+ value: Return | null;
6
+ };
@@ -0,0 +1,7 @@
1
+ export declare const useGeoLocation: () => {
2
+ checkPermission: () => Promise<{
3
+ geolocation: import("@capacitor/core").PermissionState;
4
+ coarseLocation: import("@capacitor/core").PermissionState;
5
+ }>;
6
+ getPosition: () => Promise<import("@capacitor/geolocation").Position | undefined>;
7
+ };
@@ -0,0 +1,20 @@
1
+ import type { History, Location } from "@akanjs/client";
2
+ interface setForwardOptions {
3
+ type: "push" | "replace" | "popForward";
4
+ location: Location;
5
+ scrollTop?: number;
6
+ }
7
+ interface setBackOptions {
8
+ type: "back" | "popBack";
9
+ location: Location;
10
+ scrollTop?: number;
11
+ }
12
+ export declare const useHistory: (locations?: Location[]) => {
13
+ history: import("react").MutableRefObject<History>;
14
+ setHistoryForward: ({ type, location, scrollTop }: setForwardOptions) => void;
15
+ setHistoryBack: ({ location, scrollTop }: setBackOptions) => void;
16
+ getCurrentLocation: () => Location;
17
+ getPrevLocation: () => Location | null;
18
+ getScrollTop: (pathname?: string) => number;
19
+ };
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const useInterval: (callback: (() => void) | (() => Promise<void>), delay: number) => import("react").MutableRefObject<(() => void) | (() => Promise<void>) | null>;
@@ -0,0 +1,8 @@
1
+ import { type Location, type RouteGuide } from "@akanjs/client";
2
+ interface UseLocationOptions {
3
+ rootRouteGuide: RouteGuide;
4
+ }
5
+ export declare const useLocation: ({ rootRouteGuide }: UseLocationOptions) => {
6
+ getLocation: (href: string) => Location;
7
+ };
8
+ export {};
@@ -0,0 +1,19 @@
1
+ import "cordova-plugin-purchase/www/store";
2
+ export type PlatformType = "android" | "ios" | "all";
3
+ export interface ProductType {
4
+ id: string;
5
+ type: keyof typeof CdvPurchase.ProductType;
6
+ }
7
+ export type CdvProductType = CdvPurchase.ProductType;
8
+ export declare const usePurchase: ({ platform, productInfo, url, onPay, onSubscribe, }: {
9
+ platform: PlatformType;
10
+ productInfo: ProductType[];
11
+ url: string;
12
+ onPay?: (transaction: CdvPurchase.Transaction) => void | Promise<void>;
13
+ onSubscribe?: (transaction: CdvPurchase.Transaction) => void | Promise<void>;
14
+ }) => {
15
+ isLoading: boolean;
16
+ products: CdvPurchase.Product[];
17
+ purchaseProduct: (product: CdvPurchase.Product) => Promise<void>;
18
+ restorePurchases: () => Promise<void>;
19
+ };
@@ -0,0 +1,6 @@
1
+ export declare const usePushNoti: () => {
2
+ init: () => Promise<void>;
3
+ checkPermission: () => Promise<boolean>;
4
+ register: () => Promise<void>;
5
+ getToken: () => Promise<string | undefined>;
6
+ };
@@ -0,0 +1 @@
1
+ export declare const useThrottle: (func: (...args: any) => any, delay?: number, deps?: any[]) => (...args: any[]) => void;