zaions-react-tool-kit
Version:
Zaions React Tool Kit, this is react projects tool kit created by Zaions Dev Team (https://zaions.com). We hope you will love this and all other packages we have developed for you, please do react out if you face any issue in packages we deliver. Once aga
377 lines (346 loc) • 13.8 kB
TypeScript
export { default as ZClassNames } from 'classnames';
import { FormikHelpers, FormikErrors, FormikState } from 'formik';
export { FieldArray as ZFieldArray, Formik as ZFormik, Form as ZFormikForm, useFormikContext as useZFormikContext } from 'formik';
export { default as ZDropzone, Accept as ZDropzoneAccept, useDropzone as useZDropzone } from 'react-dropzone';
import React, { CSSProperties } from 'react';
import { JSX } from 'react/jsx-runtime';
import { ResponseStatusEnum, ResponseCodeEnum, LinkTargetEnum } from 'zaions-tool-kit';
import * as _capacitor_geolocation from '@capacitor/geolocation';
import * as _capacitor_clipboard from '@capacitor/clipboard';
declare const configureZRTK: (options: {}) => void;
declare enum ToastDurationEnum {
long = "long",
short = "short"
}
declare enum ToastPositionEnum {
top = "top",
bottom = "bottom",
center = "center"
}
declare enum zValidationRuleE {
string = "string",
username = "username",
email = "email",
password = "password",
confirm_password = "confirm_password",
url = "url",
phoneNumber = "phoneNumber",
otp = "otp",
accountId = "accountId",
subject = "subject",
message = "message",
linkTitle = "linkTitle"
}
declare enum CONTAINS {
number = "number",
letter = "letter",
specialSymbol = "specialSymbol",
minCharacter = "minCharacter"
}
declare enum ReactToastifyTypeEnum {
info = "info",
success = "success",
warning = "warning",
error = "error",
default = "default"
}
declare enum TableIdsEnum {
id = "tableIdCol",
title = "tableTitleCol",
description = "tableDescriptionCol",
image = "tableImageCol",
status = "tableStatusCol",
amount = "tableAmountCol",
actions = "tableActionsCol",
createdAt = "tableCreatedAtCol",
transferMethod = "tableTransferMethodCol",
receptScreenshot = "tableReceptScreenshotCol",
name = "tableNameCol",
email = "tableEmailCol",
phoneNumber = "tablePhoneNumberCol",
city = "tableCityCol",
role = "tableRoleCol",
country = "tableCountryCol",
referralCode = "tableReferralCodeCol",
withdrawOptions = "tableWithdrawOptionsCol",
isBlocked = "tableIsBlockedCol",
maxPlayersAllowed = "tableMaxPlayersAllowedCol",
minPlayersToStartGame = "tableMinPlayersToStartGameCol",
feePerPlayer = "tableFeePerPlayerCol",
serviceCharges = "tableServiceChargesCol",
engagerServiceCharges = "tableEngagerServiceChargesCol",
roomCode = "tableRoomCodeCol",
gameTitle = "tableGameTitleCol",
private = "tablePrivateCol",
visibility = "tableVisibilityCol",
playersCount = "tablePlayersCountCol",
willStartAt = "tableWillStartAtCol",
capacity = "capacity",
poolValue = "poolValue",
sendTo = "tableSendToCol",
sendAt = "tableSendAtCol",
agentRemarks = "tableAgentRemarksCol",
playerData = "tablePlayerDataCol",
requestAt = "tableRequestAtCol",
playerPhoneNumber = "tablePlayerPhoneNumberCol",
transferAt = "tableTransferAtCol",
requestedAt = "tableRequestedAtCol",
playerEmail = "tablePlayerEmailCol",
roleIdentifier = "roleIdentifier",
isDefault = "isDefault",
gameType = "tableGameTypeCol"
}
type ZFormikHelpers<Value> = FormikHelpers<Value>;
type zSetFieldErrorType = (field: string, message: string | undefined) => void;
type zSetFieldValueType = (field: string, value: unknown, shouldValidate?: boolean | undefined) => Promise<void | FormikErrors<unknown>>;
type zResetFormType<T> = (nextState?: Partial<FormikState<T>> | undefined) => void;
interface ZReactStarsProps {
className?: string;
edit?: boolean;
value?: number;
count?: number;
size?: number;
color1?: string;
color2?: string;
hoverColor?: string;
onChange?: (value: number) => void;
disabled?: boolean;
}
interface IStar {
active: boolean;
hover: boolean;
}
declare const parentStyles: CSSProperties;
declare const defaultStyles: CSSProperties;
declare const disabledStyles: CSSProperties;
declare const StarIcon: ({ fill, size, }: {
fill: string;
size: number;
}) => JSX.Element;
declare const ZReactStars: React.FC<ZReactStarsProps>;
interface IApiResponseResult<T> {
data?: T;
authToken?: string;
dataList?: T;
}
interface IApiResponse<T> {
errors: Record<string, string> | null;
result: IApiResponseResult<T> | null;
message: string;
success: boolean;
status: ResponseStatusEnum;
code: ResponseCodeEnum;
}
interface useZMediaQueryScaleReturnInterface {
is2XlScale: boolean;
isBelowXlScale: boolean;
isBelow2XlScale: boolean;
isXlScale: boolean;
isLgScale: boolean;
isBelowLgScale: boolean;
isMdScale: boolean;
is768Scale: boolean;
isBelow768Scale: boolean;
isBelowMdScale: boolean;
isSmScale: boolean;
isBelowSmScale: boolean;
isXsScale: boolean;
isBelowXsScale: boolean;
is1300pxScale: boolean;
is1200pxScale: boolean;
is1250pxScale: boolean;
is1150pxScale: boolean;
is1100pxScale: boolean;
is900pxScale: boolean;
isBelow900pxScale: boolean;
}
interface ZFilterOptions {
search?: string;
showAll?: string;
itemPerPage: number;
currentPage: number;
keyValueFilter?: Record<string, any>;
}
interface ZPaginationInfoI {
from?: number;
to?: number;
range?: Array<string | number>;
currentPage: number;
canGoPrevious: boolean;
canGoNext: boolean;
pages?: number;
}
interface IUser {
id: string;
name?: string;
email?: string;
createdAt?: string;
updatedAt?: string;
}
declare const isCapAndroid: boolean;
declare const isCapIOS: boolean;
declare const isCapWeb: boolean;
declare const isCapMobileApp: boolean;
declare const isHybrid: boolean;
declare const LOCALSTORAGE_KEYS: {
readonly userData: "8f3j3ff-f-3ff3f";
readonly userAuthToken: "d7fgf33--3-3--3";
readonly resetPassword: "rtogorg4--de-3-02";
};
declare const APP_ROUTES: {
readonly wildCard: "*";
readonly rootRoute: "/";
readonly home: "/home";
readonly register: "/register";
readonly login: "/login";
readonly myAccount: "/my-account";
readonly resetPassword: "/forget-password";
};
declare const API_URLS: {
readonly register: "/register";
readonly login: "/login";
readonly logout: "/logout";
readonly getUserData: "/getUserData";
readonly updateUserData: "/updateUserData";
readonly updateUserStatus: "/updateUserStatus";
};
declare const developerDetails: {
readonly portfolioWebsite: "https://aoneahsan.com";
readonly updatedResume: "https://aoneahsan.com/resume";
readonly updatedCV: "https://aoneahsan.com/cv";
readonly linkedinProfile: "https://linkedin.com/in/aoneahsan";
readonly githubProfile: "https://github.com/aoneahsan";
};
declare const defaultValues: {
minCharacter: number;
};
declare const mediaScales: {
readonly brackpoint_2xl: "1550px";
readonly brackpoint_xl: "1439px";
readonly brackpoint_lg: "1100px";
readonly brackpoint_md: "668px";
readonly brackpoint_sm: "500px";
readonly brackpoint_xs: "350px";
};
declare const fiveMinutesInMileSeconds: number;
declare const reactQueryOptions: {
readonly staleTime: {
readonly fiveMinutes: typeof fiveMinutesInMileSeconds;
};
};
declare const showToast: (message?: string, duration?: ToastDurationEnum, position?: ToastPositionEnum) => Promise<void>;
declare const BROWSER: {
open: (url: string, target?: LinkTargetEnum) => Promise<void>;
};
declare const STORAGE: {
get: <T>(key: string) => Promise<T | null>;
set: (key: string, data: unknown) => Promise<void>;
remove: (key: string) => Promise<void>;
clear: () => Promise<void>;
};
declare const showZAlert: ({ title, message, }: {
title?: string;
message?: string;
}) => Promise<void>;
declare const showZConfirm: ({ title, message, }: {
title?: string;
message?: string;
}) => Promise<{
value: boolean;
}>;
declare const showZPrompt: ({ title, message, }: {
title?: string;
message?: string;
}) => Promise<{
value: string;
cancelled: boolean;
}>;
declare const zWriteToClipboard: (value?: string) => Promise<void>;
declare const zCheckClipboard: () => Promise<_capacitor_clipboard.ReadResult>;
declare const zGetCurrentPosition: () => Promise<_capacitor_geolocation.Position>;
declare const zCheckPermissions: () => Promise<_capacitor_geolocation.PermissionStatus>;
declare const formatFormErrorsFromApiResponse: (errors: Record<string, string> | null) => Record<string, string> | null;
declare const checkIfContains: (val: string, contains?: CONTAINS) => boolean;
declare const validateField: (fieldKey: string, values: Record<string, unknown>, errorsObj: Record<string, unknown>, validationRule?: zValidationRuleE) => void;
declare const validateFields: (fieldKeys: string[], values: Record<string, unknown>, errorsObj: Record<string, unknown>, validationRules: zValidationRuleE[]) => void;
declare const truncateText: (str?: string, length?: number) => string;
declare const getRandomId: () => string;
declare const toTitleCase: (str: string) => string;
declare const ZPaginate: (current: number, total: number) => {
range: number[];
rangeWithDots: Array<string | number>;
};
declare const ZFilterData: <T>({ data, filters, searchKey, caseSensitive, }: {
data: T;
filters: Partial<ZFilterOptions>;
searchKey?: string | string[];
caseSensitive?: boolean;
}) => Array<(T & unknown[])[number]>;
declare const ZFilterAndPaginateData: <T>({ data, filters, searchKey, }: {
data: T;
filters: ZFilterOptions;
searchKey?: string | string[];
}) => {
_data: Array<(T & unknown[])[number]> | null;
_paginationInfo: ZPaginationInfoI;
};
declare const clearAuthDataFromLocalStorage: () => Promise<void>;
declare const setAuthDataInLocalStorage: ({ userData, authToken, }: {
userData?: IUser;
authToken?: string;
}) => Promise<void>;
declare const getAuthTokenFromLocalStorage: () => Promise<string | null>;
declare const getAuthDataFromLocalStorage: () => Promise<{
userData: IUser | null;
authToken: string | null;
} | null>;
declare const setSearchParamsData: (data: unknown, setSearchParams: (nextInit?: any, navigateOpts?: undefined) => void) => void;
declare const getSearchParamsData: <T>(searchParams: URLSearchParams) => T | null;
declare const addQueryParamsInUrl: (url: string, queryParams: Record<string, string> | null) => string;
declare const formatRoutesMatchResult: (routesMatch: string[] | undefined) => {
isLoginRoute: boolean;
isRegisterRoute: boolean;
isHomeRoute: boolean;
isMyAccountRoute: boolean;
} | {
isLoginRoute?: undefined;
isRegisterRoute?: undefined;
isHomeRoute?: undefined;
isMyAccountRoute?: undefined;
};
declare const getTestingAttribute: (selector: string, listItemSelector?: string) => Record<string, string>;
declare const useZMediaQueryScale: () => useZMediaQueryScaleReturnInterface;
declare const backendApi: {
readonly invalidUserData: "invalid user data";
};
declare const formValidations: {
readonly urlIncorrectFormate: "Please enter a valid URL! like (https://yourlink.com) or (http://yourlink.com).";
readonly phoneNumberRequired: "Phone number is require.";
readonly passwordNotMatch: "Password does not match. please try again!";
readonly currency: "currency is required.";
readonly resendCodeLimitExceeded: "Attempt limit exceeded, please try after some time.";
readonly resendCodeSuccess: "Confirmation code resent successfully.";
readonly urlNotValid: "Should be a valid URL";
};
declare const generic: {
readonly registerSuccessfully: "Register successfully :)";
readonly loginSuccessfully: "Login successfully :)";
readonly copied: "Copied";
};
declare const user: {
readonly deletedSuccessfully: "User deleted successfully.";
readonly blockSuccessfully: "User block successfully.";
readonly updatedSuccessfully: "User updated successfully.";
readonly createdSuccessfully: "User created successfully.";
readonly unBlockSuccessfully: "User unblock successfully.";
readonly notFound: "User not found.";
readonly noIdProvided: "No user id provided!";
};
declare const zrtkMessages: {
readonly formValidations: typeof formValidations;
readonly generic: typeof generic;
readonly backendApi: typeof backendApi;
readonly user: typeof user;
};
declare const reportError: (error: unknown, message?: string, showInConsole?: boolean) => void;
export { API_URLS, APP_ROUTES, BROWSER, CONTAINS, type IApiResponse, type IApiResponseResult, type IStar, type IUser, LOCALSTORAGE_KEYS, ReactToastifyTypeEnum, STORAGE, StarIcon, TableIdsEnum, ToastDurationEnum, ToastPositionEnum, ZFilterAndPaginateData, ZFilterData, type ZFilterOptions, type ZFormikHelpers, ZPaginate, type ZPaginationInfoI, ZReactStars, type ZReactStarsProps, addQueryParamsInUrl, checkIfContains, clearAuthDataFromLocalStorage, configureZRTK, defaultStyles, defaultValues, developerDetails, disabledStyles, formatFormErrorsFromApiResponse, formatRoutesMatchResult, getAuthDataFromLocalStorage, getAuthTokenFromLocalStorage, getRandomId, getSearchParamsData, getTestingAttribute, isCapAndroid, isCapIOS, isCapMobileApp, isCapWeb, isHybrid, mediaScales, parentStyles, reactQueryOptions, reportError, setAuthDataInLocalStorage, setSearchParamsData, showToast, showZAlert, showZConfirm, showZPrompt, toTitleCase, truncateText, useZMediaQueryScale, type useZMediaQueryScaleReturnInterface, validateField, validateFields, zCheckClipboard, zCheckPermissions, zGetCurrentPosition, type zResetFormType, type zSetFieldErrorType, type zSetFieldValueType, zValidationRuleE, zWriteToClipboard, zrtkMessages };