@bikiran/utils 2.3.2 → 2.3.3

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/dist/index.d.ts CHANGED
@@ -27,7 +27,15 @@ export { showCurrencySign, showInt } from "./lib/utils/show";
27
27
  export { addOption, addOption2 } from "./lib/utils/option";
28
28
  export { getBikiranUrl, getAccountUrl, getApiUrl, getApi2Url, getApi3Url, getBaseDomain, getSupportUrl, generateAnyUrl, getAdManageUrl, getAppoceanUrl, getDBConnectionString, getDocsUrl, getDomainUrl, getHostingUrl, getSiteUrl, SUB_DOMAIN_NAMES, isDev, getMode, } from "./lib/utils/Env";
29
29
  export type { TInputChangeEvent, TTextAreaChangeEvent, TMouseEvent, TFormEvent, TKeyboardEvent, TFocusEvent, TDragEvent, TState, } from "./lib/types/GlobalType";
30
+ export type { TDomainProperty, TDomainDuration, TDomainInfo, } from "./lib/types/domain";
31
+ export type { TApp } from "./lib/types/app";
32
+ export type { TInputChangeEvent as TInputChangeEventAlt, TTextAreaChangeEvent as TTextAreaChangeEventAlt, TMouseEvent as TMouseEventAlt, TFormEvent as TFormEventAlt, TKeyboardEvent as TKeyboardEventAlt, TFocusEvent as TFocusEventAlt, TDragEvent as TDragEventAlt, TState as TStateAlt, } from "./lib/types/event";
33
+ export type { TUser } from "./lib/types/user";
34
+ export type { TApiResponse, TPagination } from "./lib/types/response";
35
+ export type { TInvoiceInfo, TAddressBilling, TAddressShipping, } from "./lib/types/invoice";
30
36
  export { default as countries } from "./lib/utils/country.json";
31
37
  export { win, doc, storage } from "./lib/utils/dom";
32
38
  export { setLocalStorage, getLocalStorage } from "./lib/utils/storage";
33
39
  export { mkQueryString, mkToken, mkStrongPassword, } from "./lib/utils/StringOperation";
40
+ export { default as StatusColor } from "./lib/utils/statusColor";
41
+ export { useOutsideClick } from "./lib/utils/OutsideClick";
package/dist/index.js CHANGED
@@ -30,3 +30,7 @@ export { default as countries } from "./lib/utils/country.json";
30
30
  export { win, doc, storage } from "./lib/utils/dom";
31
31
  export { setLocalStorage, getLocalStorage } from "./lib/utils/storage";
32
32
  export { mkQueryString, mkToken, mkStrongPassword, } from "./lib/utils/StringOperation";
33
+ // UI utilities
34
+ export { default as StatusColor } from "./lib/utils/statusColor";
35
+ // React hooks
36
+ export { useOutsideClick } from "./lib/utils/OutsideClick";
package/dist/index.ts CHANGED
@@ -61,6 +61,41 @@ export type {
61
61
  TDragEvent,
62
62
  TState,
63
63
  } from "./lib/types/GlobalType";
64
+
65
+ // Domain types
66
+ export type {
67
+ TDomainProperty,
68
+ TDomainDuration,
69
+ TDomainInfo,
70
+ } from "./lib/types/domain";
71
+
72
+ // App types
73
+ export type { TApp } from "./lib/types/app";
74
+
75
+ // Event types (alternative to GlobalType)
76
+ export type {
77
+ TInputChangeEvent as TInputChangeEventAlt,
78
+ TTextAreaChangeEvent as TTextAreaChangeEventAlt,
79
+ TMouseEvent as TMouseEventAlt,
80
+ TFormEvent as TFormEventAlt,
81
+ TKeyboardEvent as TKeyboardEventAlt,
82
+ TFocusEvent as TFocusEventAlt,
83
+ TDragEvent as TDragEventAlt,
84
+ TState as TStateAlt,
85
+ } from "./lib/types/event";
86
+
87
+ // User types
88
+ export type { TUser } from "./lib/types/user";
89
+
90
+ // Response types
91
+ export type { TApiResponse, TPagination } from "./lib/types/response";
92
+
93
+ // Invoice types
94
+ export type {
95
+ TInvoiceInfo,
96
+ TAddressBilling,
97
+ TAddressShipping,
98
+ } from "./lib/types/invoice";
64
99
  export { default as countries } from "./lib/utils/country.json";
65
100
  export { win, doc, storage } from "./lib/utils/dom";
66
101
  export { setLocalStorage, getLocalStorage } from "./lib/utils/storage";
@@ -69,3 +104,9 @@ export {
69
104
  mkToken,
70
105
  mkStrongPassword,
71
106
  } from "./lib/utils/StringOperation";
107
+
108
+ // UI utilities
109
+ export { default as StatusColor } from "./lib/utils/statusColor";
110
+
111
+ // React hooks
112
+ export { useOutsideClick } from "./lib/utils/OutsideClick";
@@ -0,0 +1,9 @@
1
+ export type TApp = {
2
+ id: number;
3
+ name: string;
4
+ appKey: string;
5
+ description: string;
6
+ website: string;
7
+ logo: string;
8
+ status: string;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export type TApp = {
2
+ id: number;
3
+ name: string;
4
+ appKey: string;
5
+ description: string;
6
+ website: string;
7
+ logo: string;
8
+ status: string;
9
+ };
@@ -0,0 +1,26 @@
1
+ export type TDomainProperty = {
2
+ domainName: string;
3
+ tld: string;
4
+ isAvailable: boolean;
5
+ };
6
+ export type TDomainDuration = {
7
+ quantity: number;
8
+ price: number;
9
+ offerPrice: number;
10
+ save: number;
11
+ };
12
+ export type TDomainInfo = {
13
+ packageId: number;
14
+ assetKey: string;
15
+ cartItemId: number;
16
+ title: string;
17
+ minQuantity: number;
18
+ selectedQuantity: number;
19
+ price: number;
20
+ priceRenew: number;
21
+ durations: TDomainDuration[];
22
+ unitName: string;
23
+ domainName: string;
24
+ domainProperty: TDomainProperty;
25
+ hostingProperty: any;
26
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ export type TDomainProperty = {
2
+ domainName: string;
3
+ tld: string;
4
+ isAvailable: boolean;
5
+ };
6
+
7
+ export type TDomainDuration = {
8
+ quantity: number;
9
+ price: number;
10
+ offerPrice: number;
11
+ save: number;
12
+ };
13
+
14
+ export type TDomainInfo = {
15
+ packageId: number;
16
+ assetKey: string;
17
+ cartItemId: number;
18
+ title: string;
19
+ minQuantity: number;
20
+ selectedQuantity: number;
21
+ price: number;
22
+ priceRenew: number;
23
+ durations: TDomainDuration[];
24
+ unitName: string;
25
+ domainName: string;
26
+ domainProperty: TDomainProperty;
27
+ hostingProperty: any;
28
+ };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export type TInputChangeEvent = React.ChangeEvent<HTMLInputElement>;
3
+ export type TTextAreaChangeEvent = React.ChangeEvent<HTMLTextAreaElement>;
4
+ export type TMouseEvent = React.MouseEvent<HTMLButtonElement>;
5
+ export type TFormEvent = React.FormEvent<HTMLFormElement>;
6
+ export type TKeyboardEvent = React.KeyboardEvent<HTMLInputElement>;
7
+ export type TFocusEvent = React.FocusEvent<HTMLInputElement>;
8
+ export type TDragEvent = React.DragEvent<HTMLDivElement>;
9
+ export type TState<T> = React.Dispatch<React.SetStateAction<T>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+
3
+ export type TInputChangeEvent = React.ChangeEvent<HTMLInputElement>;
4
+
5
+ export type TTextAreaChangeEvent = React.ChangeEvent<HTMLTextAreaElement>;
6
+
7
+ export type TMouseEvent = React.MouseEvent<HTMLButtonElement>;
8
+
9
+ export type TFormEvent = React.FormEvent<HTMLFormElement>;
10
+
11
+ export type TKeyboardEvent = React.KeyboardEvent<HTMLInputElement>;
12
+
13
+ export type TFocusEvent = React.FocusEvent<HTMLInputElement>;
14
+
15
+ export type TDragEvent = React.DragEvent<HTMLDivElement>;
16
+
17
+ export type TState<T> = React.Dispatch<React.SetStateAction<T>>;
@@ -0,0 +1,111 @@
1
+ export type TInvoiceInfo = {
2
+ id: number;
3
+ customId: string;
4
+ userId: number;
5
+ projectId: number;
6
+ billingId: number;
7
+ invoiceTitle: string;
8
+ localCurrency: string;
9
+ convertRatio: number;
10
+ paymentStatus: string;
11
+ paymentTime: number;
12
+ timeIssue: number;
13
+ timeDue: number;
14
+ totalItem: number;
15
+ totalPrice: number;
16
+ totalOfferPrice: number;
17
+ totalVat: number;
18
+ totalSaving: number;
19
+ totalPaid: number;
20
+ totalDue: number;
21
+ noteTitle: string;
22
+ noteDescription: string;
23
+ status: string;
24
+ gatewayId: number;
25
+ };
26
+ export type TAddressBilling = {
27
+ name: string;
28
+ organization: string;
29
+ email: string;
30
+ mobile: string;
31
+ telephone: string;
32
+ fax: string;
33
+ line1: string;
34
+ line2: string;
35
+ line3: string;
36
+ country: string;
37
+ state: string;
38
+ city: string;
39
+ zipCode: string;
40
+ };
41
+ export type TAddressShipping = {
42
+ name: string;
43
+ organization: string;
44
+ email: string;
45
+ mobile: string;
46
+ telephone: string;
47
+ fax: string;
48
+ line1: string;
49
+ line2: string;
50
+ line3: string;
51
+ country: string;
52
+ state: string;
53
+ city: string;
54
+ zipCode: string;
55
+ };
56
+ export type TInvoiceProduct = {
57
+ id: number;
58
+ type: string;
59
+ title: string;
60
+ quantity: number;
61
+ unitName: string;
62
+ domain: string;
63
+ price: number;
64
+ priceOffer: number;
65
+ vat: number;
66
+ totalPrice: number;
67
+ duration: string;
68
+ };
69
+ export type TPaymentOption = {
70
+ id: number;
71
+ provider: string;
72
+ title: string;
73
+ subTitle: string;
74
+ buttonText: string;
75
+ isDefault: number;
76
+ icon: string;
77
+ priority: number;
78
+ status: string;
79
+ };
80
+ export type TPaymentIssue = {
81
+ key: string;
82
+ message: string;
83
+ };
84
+ export type TAddressPayload = {
85
+ type: string;
86
+ name: string;
87
+ organization: string;
88
+ email: string;
89
+ mobile: string;
90
+ telephone: string;
91
+ fax: string;
92
+ line1: string;
93
+ line2: string;
94
+ line3: string;
95
+ country: string;
96
+ state: string;
97
+ city: string;
98
+ zipCode: string;
99
+ };
100
+ export type TInvoiceData = {
101
+ invoice: TInvoiceInfo;
102
+ items: TInvoiceProduct[];
103
+ addressBilling: TAddressBilling;
104
+ addressShipping: TAddressShipping;
105
+ paymentGateways?: TPaymentOption[];
106
+ paymentIssues?: TPaymentIssue[];
107
+ linkDownload: string;
108
+ linkPrint: string;
109
+ transactions?: [];
110
+ notFound?: boolean;
111
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,118 @@
1
+ export type TInvoiceInfo = {
2
+ id: number;
3
+ customId: string;
4
+ userId: number;
5
+ projectId: number;
6
+ billingId: number;
7
+ invoiceTitle: string;
8
+ localCurrency: string;
9
+ convertRatio: number;
10
+ paymentStatus: string;
11
+ paymentTime: number;
12
+ timeIssue: number;
13
+ timeDue: number;
14
+ totalItem: number;
15
+ totalPrice: number;
16
+ totalOfferPrice: number;
17
+ totalVat: number;
18
+ totalSaving: number;
19
+ totalPaid: number;
20
+ totalDue: number;
21
+ noteTitle: string;
22
+ noteDescription: string;
23
+ status: string;
24
+ gatewayId: number;
25
+ };
26
+
27
+ export type TAddressBilling = {
28
+ name: string;
29
+ organization: string;
30
+ email: string;
31
+ mobile: string;
32
+ telephone: string;
33
+ fax: string;
34
+ line1: string;
35
+ line2: string;
36
+ line3: string;
37
+ country: string;
38
+ state: string;
39
+ city: string;
40
+ zipCode: string;
41
+ };
42
+
43
+ export type TAddressShipping = {
44
+ name: string;
45
+ organization: string;
46
+ email: string;
47
+ mobile: string;
48
+ telephone: string;
49
+ fax: string;
50
+ line1: string;
51
+ line2: string;
52
+ line3: string;
53
+ country: string;
54
+ state: string;
55
+ city: string;
56
+ zipCode: string;
57
+ };
58
+
59
+ export type TInvoiceProduct = {
60
+ id: number;
61
+ type: string;
62
+ title: string;
63
+ quantity: number;
64
+ unitName: string;
65
+ domain: string;
66
+ price: number;
67
+ priceOffer: number;
68
+ vat: number;
69
+ totalPrice: number;
70
+ duration: string;
71
+ };
72
+
73
+ export type TPaymentOption = {
74
+ id: number;
75
+ provider: string;
76
+ title: string;
77
+ subTitle: string;
78
+ buttonText: string;
79
+ isDefault: number;
80
+ icon: string;
81
+ priority: number;
82
+ status: string;
83
+ };
84
+
85
+ export type TPaymentIssue = {
86
+ key: string;
87
+ message: string;
88
+ };
89
+
90
+ export type TAddressPayload = {
91
+ type: string;
92
+ name: string;
93
+ organization: string;
94
+ email: string;
95
+ mobile: string;
96
+ telephone: string;
97
+ fax: string;
98
+ line1: string;
99
+ line2: string;
100
+ line3: string;
101
+ country: string;
102
+ state: string;
103
+ city: string;
104
+ zipCode: string;
105
+ };
106
+
107
+ export type TInvoiceData = {
108
+ invoice: TInvoiceInfo;
109
+ items: TInvoiceProduct[];
110
+ addressBilling: TAddressBilling;
111
+ addressShipping: TAddressShipping;
112
+ paymentGateways?: TPaymentOption[];
113
+ paymentIssues?: TPaymentIssue[];
114
+ linkDownload: string;
115
+ linkPrint: string;
116
+ transactions?: [];
117
+ notFound?: boolean;
118
+ };
@@ -0,0 +1,11 @@
1
+ export type TApiResponse<T> = {
2
+ error: number | boolean;
3
+ message?: string;
4
+ data?: T;
5
+ referenceName?: string;
6
+ };
7
+ export type TPagination = {
8
+ cpp: number;
9
+ offset: number;
10
+ page: number;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export type TApiResponse<T> = {
2
+ error: number | boolean;
3
+ message?: string;
4
+ data?: T;
5
+ referenceName?: string;
6
+ };
7
+
8
+ export type TPagination = {
9
+ cpp: number;
10
+ offset: number;
11
+ page: number;
12
+ };
@@ -0,0 +1,4 @@
1
+ export type TUser = {
2
+ userUid?: string;
3
+ refreshToken?: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type TUser = {
2
+ userUid?: string;
3
+ refreshToken?: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare function useOutsideClick(ref: React.RefObject<HTMLElement>, callback: () => void): void;
@@ -0,0 +1,14 @@
1
+ import { useEffect } from "react";
2
+ export function useOutsideClick(ref, callback) {
3
+ useEffect(() => {
4
+ function handleClickOutside(event) {
5
+ if (ref.current && !ref.current.contains(event.target)) {
6
+ callback();
7
+ }
8
+ }
9
+ document.addEventListener("mousedown", handleClickOutside);
10
+ return () => {
11
+ document.removeEventListener("mousedown", handleClickOutside);
12
+ };
13
+ }, [ref, callback]);
14
+ }
@@ -0,0 +1,19 @@
1
+ import React, { useEffect } from "react";
2
+
3
+ export function useOutsideClick(
4
+ ref: React.RefObject<HTMLElement>,
5
+ callback: () => void
6
+ ) {
7
+ useEffect(() => {
8
+ function handleClickOutside(event: MouseEvent) {
9
+ if (ref.current && !ref.current.contains(event.target as Node)) {
10
+ callback();
11
+ }
12
+ }
13
+
14
+ document.addEventListener("mousedown", handleClickOutside);
15
+ return () => {
16
+ document.removeEventListener("mousedown", handleClickOutside);
17
+ };
18
+ }, [ref, callback]);
19
+ }
@@ -0,0 +1,7 @@
1
+ import { FC } from "react";
2
+ type StatusColorProps = {
3
+ status: string;
4
+ className?: string;
5
+ };
6
+ declare const StatusColor: FC<StatusColorProps>;
7
+ export default StatusColor;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "./cn";
3
+ const StatusColor = ({ status, className }) => {
4
+ const getColor = (status) => {
5
+ switch (status.toLowerCase()) {
6
+ case "active":
7
+ return "text-success";
8
+ case "success":
9
+ return "text-success";
10
+ case "inactive":
11
+ return "text-error";
12
+ case "suspended":
13
+ return "text-error";
14
+ case "pending":
15
+ return "text-yellow-500";
16
+ case "progressing":
17
+ return "text-green-500";
18
+ case "closed":
19
+ return "text-success";
20
+ case "open":
21
+ return "text-secondary";
22
+ case "completed":
23
+ return "text-secondary";
24
+ case "not-configured":
25
+ return "red-500";
26
+ case "failed":
27
+ return "red-500";
28
+ default:
29
+ return "text-black "; // Default color
30
+ }
31
+ };
32
+ const capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
33
+ return (_jsx("span", { className: cn(getColor(status), className), children: capitalizeFirstLetter(status) || "---" }));
34
+ };
35
+ export default StatusColor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikiran/utils",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [