kui-utils 0.0.4 → 0.0.6
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/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/index.d.ts +23 -36
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +7 -2
package/index.d.ts
CHANGED
|
@@ -23,22 +23,17 @@ declare const checkIsIOS: () => boolean;
|
|
|
23
23
|
|
|
24
24
|
declare const cleanEmptyFields: <T>(array: T[], data: any, key: keyof T) => T[];
|
|
25
25
|
|
|
26
|
+
declare type PhoneParams = {
|
|
27
|
+
phoneCode: string;
|
|
28
|
+
phoneNumber: string;
|
|
29
|
+
};
|
|
30
|
+
declare type ResHandlerParams = {
|
|
31
|
+
withEndLoading?: boolean;
|
|
32
|
+
};
|
|
26
33
|
declare type ObjectType = {
|
|
27
34
|
[key: string]: any;
|
|
28
35
|
};
|
|
29
36
|
|
|
30
|
-
declare class Loader$1 {
|
|
31
|
-
isLoading: boolean;
|
|
32
|
-
hasError: boolean;
|
|
33
|
-
loadingMessage?: string;
|
|
34
|
-
errorMessage?: string;
|
|
35
|
-
constructor(isLoading?: boolean);
|
|
36
|
-
startLoading: (message?: string | undefined, withoutCleanError?: boolean | undefined) => void;
|
|
37
|
-
endLoading: () => void;
|
|
38
|
-
setError: (errorMessage?: string | undefined, err?: any) => void;
|
|
39
|
-
cleanError: () => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
37
|
declare const clearNotValidFields: (data: ObjectType, withNull?: boolean | undefined) => {
|
|
43
38
|
[key: string]: any;
|
|
44
39
|
};
|
|
@@ -63,35 +58,12 @@ declare const getFileNameFromUrl: (text: string, limit?: number) => string;
|
|
|
63
58
|
|
|
64
59
|
declare const getNestedData: (data: any, key: string) => any;
|
|
65
60
|
|
|
66
|
-
declare type PhoneParams = {
|
|
67
|
-
phoneCode: string;
|
|
68
|
-
phoneNumber: string;
|
|
69
|
-
};
|
|
70
|
-
declare type ResHandlerParams = {
|
|
71
|
-
withEndLoading?: boolean;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
61
|
declare const getPhoneNumberFromPhoneParams: ({ phoneCode, phoneNumber }: PhoneParams, fill?: string | undefined) => string;
|
|
75
62
|
|
|
76
63
|
declare const getPhoneParamsFromString: (phone: string) => PhoneParams | null;
|
|
77
64
|
|
|
78
65
|
declare const promisesWithCallback: (promises: Promise<any>[], callback?: Function | undefined) => Promise<PromiseSettledResult<any>[]>;
|
|
79
66
|
|
|
80
|
-
declare const resHandler: <T>(result: [Error | null, T | undefined], loader: Loader$1, callback?: ((res: T) => void) | undefined, errorMessage?: string | undefined, params?: ResHandlerParams | undefined) => void;
|
|
81
|
-
|
|
82
|
-
declare const toNumber: (value?: string | number | null | undefined) => number | null;
|
|
83
|
-
|
|
84
|
-
declare const updateQueryParams: (newLink: string) => void;
|
|
85
|
-
|
|
86
|
-
declare type CookieOptions = {
|
|
87
|
-
path?: string;
|
|
88
|
-
"max-age"?: number;
|
|
89
|
-
expires?: Date;
|
|
90
|
-
};
|
|
91
|
-
declare function setCookie(name: string, value: string | number, options?: CookieOptions): void;
|
|
92
|
-
declare function deleteCookie(name: string): void;
|
|
93
|
-
declare function getCookie(name: string): string | undefined;
|
|
94
|
-
|
|
95
67
|
declare class Loader {
|
|
96
68
|
isLoading: boolean;
|
|
97
69
|
hasError: boolean;
|
|
@@ -158,6 +130,21 @@ declare class MultistepForm<T extends object, U extends readonly string[] = []>
|
|
|
158
130
|
get stage(): Values<U> | null;
|
|
159
131
|
}
|
|
160
132
|
|
|
133
|
+
declare const resHandler: <T>(result: [Error | null, T | undefined], loader: Loader, callback?: ((res: T) => void) | undefined, errorMessage?: string | undefined, params?: ResHandlerParams | undefined) => void;
|
|
134
|
+
|
|
135
|
+
declare const toNumber: (value?: string | number | null | undefined) => number | null;
|
|
136
|
+
|
|
137
|
+
declare const updateQueryParams: (newLink: string) => void;
|
|
138
|
+
|
|
139
|
+
declare type CookieOptions = {
|
|
140
|
+
path?: string;
|
|
141
|
+
"max-age"?: number;
|
|
142
|
+
expires?: Date;
|
|
143
|
+
};
|
|
144
|
+
declare function setCookie(name: string, value: string | number, options?: CookieOptions): void;
|
|
145
|
+
declare function deleteCookie(name: string): void;
|
|
146
|
+
declare function getCookie(name: string): string | undefined;
|
|
147
|
+
|
|
161
148
|
declare const phoneRegExp: RegExp;
|
|
162
149
|
declare const isValidWithMaskExp: RegExp;
|
|
163
150
|
declare const dateRegExp: RegExp;
|
|
@@ -187,4 +174,4 @@ declare const _default: ({
|
|
|
187
174
|
mask: boolean;
|
|
188
175
|
})[];
|
|
189
176
|
|
|
190
|
-
export { Loader, MultistepForm, PaginationRes, Paginator, PhoneParams, ResHandlerParams, SortOrder, SortingFilter, Values, accountRegExp, addLeadZero, addToArrayByCondition, applyMask, bicRegExp, callPromises, carNumberRegExp, checkIsIOS, cleanEmptyFields, clearNotValidFields, copyInfo, corrAccountRegExp, _default as countries, cropText, dateRegExp, declineByNumber, deleteCookie, emailRegExp, formatError, generateFormDataBody, getChangedValue, getCookie, getFileNameFromFile, getFileNameFromUrl, getNestedData, getPhoneNumberFromPhoneParams, getPhoneParamsFromString, innRegExp, isValidWithMaskExp, mediumPasswordRegExp, monthYearRegExp, phoneRegExp, promisesWithCallback, resHandler, setCookie, simplePasswordRegExp, strongPasswordRegExp, swiftRegExp, toNumber, updateQueryParams, useDebounce, useForkRef, useTabIndex, useToggle, useWindowWidth };
|
|
177
|
+
export { Loader, MultistepForm, ObjectType, PaginationRes, Paginator, PhoneParams, ResHandlerParams, SortOrder, SortingFilter, Values, accountRegExp, addLeadZero, addToArrayByCondition, applyMask, bicRegExp, callPromises, carNumberRegExp, checkIsIOS, cleanEmptyFields, clearNotValidFields, copyInfo, corrAccountRegExp, _default as countries, cropText, dateRegExp, declineByNumber, deleteCookie, emailRegExp, formatError, generateFormDataBody, getChangedValue, getCookie, getFileNameFromFile, getFileNameFromUrl, getNestedData, getPhoneNumberFromPhoneParams, getPhoneParamsFromString, innRegExp, isValidWithMaskExp, mediumPasswordRegExp, monthYearRegExp, phoneRegExp, promisesWithCallback, resHandler, setCookie, simplePasswordRegExp, strongPasswordRegExp, swiftRegExp, toNumber, updateQueryParams, useDebounce, useForkRef, useTabIndex, useToggle, useWindowWidth };
|
package/index.js
CHANGED
|
@@ -2017,7 +2017,8 @@ function setCookie(name, value, options) {
|
|
|
2017
2017
|
if (options === void 0) { options = {}; }
|
|
2018
2018
|
var cookieOptions = __assign({ path: "/" }, options);
|
|
2019
2019
|
var updatedCookie = "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(value));
|
|
2020
|
-
|
|
2020
|
+
Object.keys(cookieOptions).forEach(function (key) {
|
|
2021
|
+
var val = cookieOptions[key];
|
|
2021
2022
|
updatedCookie += "; ".concat(key);
|
|
2022
2023
|
updatedCookie += "=".concat(val);
|
|
2023
2024
|
});
|