@helpdice/sdk 0.2.1 → 0.2.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/dist/account/index.d.ts +2 -2
- package/dist/account/update_profile.d.ts +1 -1
- package/dist/account/update_profile.js +1 -1
- package/dist/account/update_profile.js.map +1 -1
- package/dist/accounting/index.d.ts +5 -5
- package/dist/auth/endpoint.d.ts +2 -0
- package/dist/auth/endpoint.js +3 -1
- package/dist/auth/endpoint.js.map +1 -1
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/resetPassword.d.ts +11 -0
- package/dist/auth/resetPassword.js +13 -0
- package/dist/auth/resetPassword.js.map +1 -0
- package/dist/config/axios.d.ts +2 -1
- package/dist/config/axios.js +58 -48
- package/dist/config/axios.js.map +1 -1
- package/dist/config/index.d.ts +8 -7
- package/dist/config/index.js.map +1 -1
- package/dist/config/route.d.ts +1 -1
- package/dist/config/route.js +7 -2
- package/dist/config/route.js.map +1 -1
- package/dist/content/index.d.ts +10 -10
- package/dist/hooks/useUser.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory/index.d.ts +3 -3
- package/dist/linkie/endpoint.d.ts +6 -0
- package/dist/linkie/endpoint.js +7 -0
- package/dist/linkie/endpoint.js.map +1 -0
- package/dist/linkie/index.d.ts +12 -0
- package/dist/linkie/index.js +16 -0
- package/dist/linkie/index.js.map +1 -0
- package/dist/linkie/shortUrl.d.ts +12 -0
- package/dist/linkie/shortUrl.js +13 -0
- package/dist/linkie/shortUrl.js.map +1 -0
- package/dist/linkie/types.d.ts +9 -0
- package/dist/linkie/types.js +2 -0
- package/dist/linkie/types.js.map +1 -0
- package/dist/support/index.d.ts +1 -1
- package/package.json +3 -3
package/dist/account/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const Account: {
|
|
2
|
-
profile: (id: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
updateProfile: (data: import("./types.js").Profile, { config, onFetching, onSuccess, onError, onSettled
|
|
2
|
+
profile: (id: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
updateProfile: (data: import("./types.js").Profile, { config, onFetching, onSuccess, onError, onSettled }: {
|
|
4
4
|
onFetching?: () => void;
|
|
5
5
|
onSuccess?: (data: object) => void;
|
|
6
6
|
onError?: (error: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthRequestParams } from "../auth/types.js";
|
|
2
2
|
import type { Profile } from "./types.js";
|
|
3
|
-
declare const updateProfile: (data: Profile, { config, onFetching, onSuccess, onError, onSettled
|
|
3
|
+
declare const updateProfile: (data: Profile, { config, onFetching, onSuccess, onError, onSettled }: {
|
|
4
4
|
onFetching?: () => void;
|
|
5
5
|
onSuccess?: (data: object) => void;
|
|
6
6
|
onError?: (error: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { put } from "../config/axios.js";
|
|
2
2
|
import handler from "../config/handler.js";
|
|
3
3
|
import { getUrl } from "../config/route.js";
|
|
4
|
-
const updateProfile = (data, { config, onFetching, onSuccess, onError, onSettled
|
|
4
|
+
const updateProfile = (data, { config, onFetching, onSuccess, onError, onSettled }) => {
|
|
5
5
|
return handler(put(getUrl("account", "v1", "profile"), data, config), {
|
|
6
6
|
onFetching: () => onFetching?.(),
|
|
7
7
|
onError: (error) => onError?.(error),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_profile.js","sourceRoot":"","sources":["../../src/account/update_profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,MAAM,aAAa,GAAG,CACrB,IAAa,EACb,EACC,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,
|
|
1
|
+
{"version":3,"file":"update_profile.js","sourceRoot":"","sources":["../../src/account/update_profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,MAAM,aAAa,GAAG,CACrB,IAAa,EACb,EACC,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,EAOT,EACA,EAAE;IACH,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;QACrE,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE;QAChC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC;QACpC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QACtC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;KAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const Accounting: {
|
|
2
|
-
item: (slug: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
items: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
+
item: (slug: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
items: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
4
|
createInvoice: (data: import("./types.js").Invoice, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
5
5
|
onFetching?: () => void;
|
|
6
6
|
onSuccess?: (data: object) => void;
|
|
@@ -19,7 +19,7 @@ declare const Accounting: {
|
|
|
19
19
|
params: import("../auth/types.js").AuthRequestParams;
|
|
20
20
|
};
|
|
21
21
|
}) => Promise<void>;
|
|
22
|
-
invoices: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
|
+
invoices: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
23
23
|
submitInvoice: (data: import("./types.js").SubmitInvoice, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
24
24
|
onFetching?: () => void;
|
|
25
25
|
onSuccess?: (data: object) => void;
|
|
@@ -29,7 +29,7 @@ declare const Accounting: {
|
|
|
29
29
|
params: import("../auth/types.js").AuthRequestParams;
|
|
30
30
|
};
|
|
31
31
|
}) => Promise<void>;
|
|
32
|
-
itemCategories: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
33
|
-
itemBrands: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
32
|
+
itemCategories: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
33
|
+
itemBrands: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
34
34
|
};
|
|
35
35
|
export default Accounting;
|
package/dist/auth/endpoint.d.ts
CHANGED
package/dist/auth/endpoint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/auth/endpoint.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;IACZ,EAAE,EAAE;QACH,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/auth/endpoint.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;IACZ,EAAE,EAAE;QACH,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,QAAQ;QAChB,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,QAAQ;QACvB,cAAc,EAAE,mBAAmB;QACnC,eAAe,EAAE,iBAAiB;KAClC;CACD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ declare const Auth: {
|
|
|
27
27
|
params: import("./types.js").AuthRequestParams;
|
|
28
28
|
};
|
|
29
29
|
}) => Promise<void>;
|
|
30
|
+
resetPassword: (data: import("./types.js").AuthRequest, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
31
|
+
onFetching?: () => void;
|
|
32
|
+
onSuccess?: (data: object) => void;
|
|
33
|
+
onError?: (error: string) => void;
|
|
34
|
+
onSettled?: () => void;
|
|
35
|
+
config?: {
|
|
36
|
+
params: import("./types.js").AuthRequestParams;
|
|
37
|
+
};
|
|
38
|
+
}) => Promise<void>;
|
|
30
39
|
signInWithGoogle: typeof signInWithGoogle;
|
|
31
40
|
saveTokenToCookie: (token: string) => void;
|
|
32
41
|
saveTokenToStorage: (token: string) => void;
|
package/dist/auth/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import cookie from "js-cookie";
|
|
2
2
|
import { jwtDecode } from "jwt-decode";
|
|
3
|
+
// import type { NextPageContext } from "next";
|
|
3
4
|
import { getConfig } from "../config/index.js";
|
|
4
5
|
import { isAuth } from "../utils/auth.js";
|
|
5
6
|
import { getDataFromStorage, setDataInStorage, setEncryptionKey, } from "../utils/localStorage.js";
|
|
@@ -11,10 +12,12 @@ import signUp from "./signup.js";
|
|
|
11
12
|
import validateConfig from "../config/validate.js";
|
|
12
13
|
import authWithToken from "./authWithToken.js";
|
|
13
14
|
import authWithKey from "./authWithKey.js";
|
|
15
|
+
import resetPassword from "./resetPassword.js";
|
|
14
16
|
const Auth = {
|
|
15
17
|
signIn,
|
|
16
18
|
signUp,
|
|
17
19
|
register,
|
|
20
|
+
resetPassword,
|
|
18
21
|
signInWithGoogle,
|
|
19
22
|
saveTokenToCookie: (token) => {
|
|
20
23
|
validateConfig(['tokenKey']);
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,+CAA+C;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,IAAI,GAAG;IACZ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,iBAAiB,EAAE,CAAC,KAAa,EAAE,EAAE;QACpC,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7B,M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AAG,CAAC,EAAE,CAAC;oBAC/C,WAAW,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;gBAC/C,CAAC;gBACD,4BAA4B;gBAC5B,gBAAgB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAC9C,CAAC;iBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACpC,IAAI,KAAK,EAAE,CAAC;oBACX,gBAAgB,CAAC,aAAa,EAAE,EAAE,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBACnE,CAAC;qBAAM,CAAC;oBACP,OAAO,CAAC,KAAK,CACZ,8DAA8D,CAC9D,CAAC;gBACH,CAAC;YACF,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;IACF,CAAC;IACD,eAAe,EAAE,CAAC,MAAgB,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,CAAC;YACZ,OAAO,MAAM,EAAE,CAAC;QACjB,CAAC;QACD,OAAO,kBAAkB,CAAC,oBAAoB,CAAC,KAAK,SAAS,CAAC;IAC/D,CAAC;IACD,qEAAqE;IACrE,MAAM;IACN,MAAM,EAAE;QACP,aAAa;QACb,WAAW;KACX;CACD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AuthRequest, AuthRequestParams } from "./types.js";
|
|
2
|
+
declare const resetPassword: (data: AuthRequest, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
3
|
+
onFetching?: () => void;
|
|
4
|
+
onSuccess?: (data: object) => void;
|
|
5
|
+
onError?: (error: string) => void;
|
|
6
|
+
onSettled?: () => void;
|
|
7
|
+
config?: {
|
|
8
|
+
params: AuthRequestParams;
|
|
9
|
+
};
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
export default resetPassword;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { post } from "../config/axios.js";
|
|
2
|
+
import handler from "../config/handler.js";
|
|
3
|
+
import { getUrl } from "../config/route.js";
|
|
4
|
+
const resetPassword = (data, { config, onFetching, onSuccess, onError, onSettled, }) => {
|
|
5
|
+
return handler(post(getUrl("auth", "v1", "reset_password"), data, config), {
|
|
6
|
+
onFetching: () => onFetching?.(),
|
|
7
|
+
onError: (error) => onError?.(error),
|
|
8
|
+
onSuccess: (data) => onSuccess?.(data),
|
|
9
|
+
onSettled: () => onSettled?.(),
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export default resetPassword;
|
|
13
|
+
//# sourceMappingURL=resetPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resetPassword.js","sourceRoot":"","sources":["../../src/auth/resetPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,MAAM,aAAa,GAAG,CAClB,IAAiB,EACjB,EACI,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,GAOZ,EACH,EAAE;IACA,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;QACvE,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE;QAChC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC;QACpC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QACtC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;KACjC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/config/axios.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
2
|
import type { AuthRequest, SignupRequest } from "../auth/types.js";
|
|
3
3
|
export declare const http: import("axios").AxiosInstance;
|
|
4
|
-
export declare const chttp: import("axios").AxiosInstance;
|
|
5
4
|
export declare const post: (endpoint: string, data?: unknown, config?: AxiosRequestConfig<unknown>) => Promise<AxiosResponse>;
|
|
6
5
|
export declare const put: (endpoint: string, data?: unknown, config?: AxiosRequestConfig<unknown>) => Promise<AxiosResponse>;
|
|
7
6
|
export declare const get: (endpoint: string, config?: AxiosRequestConfig<unknown>) => Promise<AxiosResponse>;
|
|
@@ -10,3 +9,5 @@ export declare const login: (data: AuthRequest) => Promise<AxiosResponse>;
|
|
|
10
9
|
export declare const logout: () => Promise<AxiosResponse>;
|
|
11
10
|
export declare const passwordReset: (data: Partial<AuthRequest>) => Promise<AxiosResponse>;
|
|
12
11
|
export declare const signup: (data: SignupRequest) => Promise<AxiosResponse>;
|
|
12
|
+
export declare const chttp: import("axios").AxiosInstance;
|
|
13
|
+
export declare const linkiePost: (endpoint: string, data?: unknown, config?: AxiosRequestConfig<unknown>) => Promise<AxiosResponse>;
|
package/dist/config/axios.js
CHANGED
|
@@ -5,7 +5,6 @@ import { REFRESH_TOKEN_KEY, TOKEN_KEY,
|
|
|
5
5
|
import { getCookie } from "../utils/auth.js";
|
|
6
6
|
import { getConfig } from "./index.js";
|
|
7
7
|
import validateConfig from "./validate.js";
|
|
8
|
-
// export const BASE_URL = getConfig().apiUrl;
|
|
9
8
|
export const http = axios.create({
|
|
10
9
|
withCredentials: true,
|
|
11
10
|
headers: {
|
|
@@ -13,13 +12,6 @@ export const http = axios.create({
|
|
|
13
12
|
"Content-Type": "application/json",
|
|
14
13
|
},
|
|
15
14
|
});
|
|
16
|
-
export const chttp = axios.create({
|
|
17
|
-
withCredentials: true,
|
|
18
|
-
headers: {
|
|
19
|
-
"Access-Control-Allow-Origin": "*",
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
15
|
http.interceptors.request.use((config) => {
|
|
24
16
|
validateConfig(['apiKey', 'apiUrl']);
|
|
25
17
|
const { apiUrl } = getConfig();
|
|
@@ -32,45 +24,6 @@ http.interceptors.request.use((config) => {
|
|
|
32
24
|
}
|
|
33
25
|
return config;
|
|
34
26
|
}, Promise.reject);
|
|
35
|
-
chttp.interceptors.request.use((config) => {
|
|
36
|
-
validateConfig(['apiKey', 'apiUrl']);
|
|
37
|
-
const { apiUrl } = getConfig();
|
|
38
|
-
config.baseURL = apiUrl;
|
|
39
|
-
if (config.headers) {
|
|
40
|
-
config.headers["Content-Type"] = "application/json";
|
|
41
|
-
config.headers.Authorization = localStorage.getItem(TOKEN_KEY) || "";
|
|
42
|
-
}
|
|
43
|
-
return config;
|
|
44
|
-
}, Promise.reject);
|
|
45
|
-
chttp.interceptors.response.use((response) => response, async (error) => {
|
|
46
|
-
if (error.code === "ERR_NETWORK") {
|
|
47
|
-
return Promise.reject(error);
|
|
48
|
-
}
|
|
49
|
-
const refreshToken = localStorage.getItem(REFRESH_TOKEN_KEY);
|
|
50
|
-
if (!refreshToken) {
|
|
51
|
-
return Promise.reject(error);
|
|
52
|
-
}
|
|
53
|
-
// const originalRequest = error.config;
|
|
54
|
-
// if (error.response.status === 401 && !originalRequest._retry) {
|
|
55
|
-
// originalRequest._retry = true;
|
|
56
|
-
// if (http.defaults.headers) {
|
|
57
|
-
// http.defaults.headers.Authorization = `Bearer ${refreshToken}`;
|
|
58
|
-
// }
|
|
59
|
-
// try {
|
|
60
|
-
// const res = await post('auth/token');
|
|
61
|
-
// const { access_token, threshold } = res.data;
|
|
62
|
-
// // handleItem(TOKEN_KEY, access_token);
|
|
63
|
-
// // handleItem(TOKEN_THRESHOLD_KEY, setThreshold(threshold));
|
|
64
|
-
// if (http.defaults.headers) {
|
|
65
|
-
// http.defaults.headers.Authorization = access_token;
|
|
66
|
-
// }
|
|
67
|
-
// return await http(originalRequest);
|
|
68
|
-
// } catch (reason) {
|
|
69
|
-
// return Promise.reject(reason);
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
return Promise.reject(error);
|
|
73
|
-
});
|
|
74
27
|
export const post = (endpoint, data, config) => new Promise((resolve, reject) => http
|
|
75
28
|
.post(endpoint, data, config)
|
|
76
29
|
.then(resolve)
|
|
@@ -94,5 +47,62 @@ export const login = (data) => post("passport/basic/login", data);
|
|
|
94
47
|
export const logout = () => post("user/logout");
|
|
95
48
|
export const passwordReset = (data) => post("user/reset-password", data);
|
|
96
49
|
export const signup = (data) => post("passport/basic/signup", data);
|
|
97
|
-
/*
|
|
50
|
+
/* ======================================================================================================= */
|
|
51
|
+
/* ------------------------------------ For Linkie App --------------------------------------------------- */
|
|
52
|
+
/* ======================================================================================================= */
|
|
53
|
+
export const chttp = axios.create({
|
|
54
|
+
withCredentials: true,
|
|
55
|
+
headers: {
|
|
56
|
+
"Access-Control-Allow-Origin": "*",
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
chttp.interceptors.request.use((config) => {
|
|
61
|
+
validateConfig(['apiKey', 'tokenKey', 'linkieUrl']);
|
|
62
|
+
const { linkieUrl } = getConfig();
|
|
63
|
+
config.baseURL = linkieUrl;
|
|
64
|
+
if (config.headers) {
|
|
65
|
+
config.headers["Content-Type"] = "application/json";
|
|
66
|
+
config.headers.Authorization = localStorage.getItem(TOKEN_KEY) || "";
|
|
67
|
+
config.headers["HB-API-KEY"] =
|
|
68
|
+
`Bearer ${getConfig().apiKey}` || "";
|
|
69
|
+
}
|
|
70
|
+
return config;
|
|
71
|
+
}, Promise.reject);
|
|
72
|
+
// chttp.interceptors.response.use(
|
|
73
|
+
// (response) => response,
|
|
74
|
+
// async (error) => {
|
|
75
|
+
// if (error.code === "ERR_NETWORK") {
|
|
76
|
+
// return Promise.reject(error);
|
|
77
|
+
// }
|
|
78
|
+
// const refreshToken = localStorage.getItem(REFRESH_TOKEN_KEY);
|
|
79
|
+
// if (!refreshToken) {
|
|
80
|
+
// return Promise.reject(error);
|
|
81
|
+
// }
|
|
82
|
+
// // const originalRequest = error.config;
|
|
83
|
+
// // if (error.response.status === 401 && !originalRequest._retry) {
|
|
84
|
+
// // originalRequest._retry = true;
|
|
85
|
+
// // if (http.defaults.headers) {
|
|
86
|
+
// // http.defaults.headers.Authorization = `Bearer ${refreshToken}`;
|
|
87
|
+
// // }
|
|
88
|
+
// // try {
|
|
89
|
+
// // const res = await post('auth/token');
|
|
90
|
+
// // const { access_token, threshold } = res.data;
|
|
91
|
+
// // // handleItem(TOKEN_KEY, access_token);
|
|
92
|
+
// // // handleItem(TOKEN_THRESHOLD_KEY, setThreshold(threshold));
|
|
93
|
+
// // if (http.defaults.headers) {
|
|
94
|
+
// // http.defaults.headers.Authorization = access_token;
|
|
95
|
+
// // }
|
|
96
|
+
// // return await http(originalRequest);
|
|
97
|
+
// // } catch (reason) {
|
|
98
|
+
// // return Promise.reject(reason);
|
|
99
|
+
// // }
|
|
100
|
+
// // }
|
|
101
|
+
// return Promise.reject(error);
|
|
102
|
+
// },
|
|
103
|
+
// );
|
|
104
|
+
export const linkiePost = (endpoint, data, config) => new Promise((resolve, reject) => chttp
|
|
105
|
+
.post(endpoint, data, config)
|
|
106
|
+
.then(resolve)
|
|
107
|
+
.catch((e) => reject(e.response?.data)));
|
|
98
108
|
//# sourceMappingURL=axios.js.map
|
package/dist/config/axios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/config/axios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACN,iBAAiB,EACjB,SAAS;AACT,uBAAuB;EACvB,MAAM,gBAAgB,CAAC;AAKxB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M,CAAC,OAAO,CAAC,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACrE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3B,UAAU,SAAS,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAEnB,mCAAmC;AACnC,2BAA2B;AAC3B,sBAAsB;AACtB,wCAAwC;AACxC,mCAAmC;AACnC,MAAM;AAEN,kEAAkE;AAElE,yBAAyB;AACzB,mCAAmC;AACnC,MAAM;AAEN,6CAA6C;AAE7C,uEAAuE;AACvE,wCAAwC;AAExC,sCAAsC;AACtC,2EAA2E;AAC3E,WAAW;AAEX,eAAe;AACf,iDAAiD;AACjD,yDAAyD;AAEzD,mDAAmD;AACnD,wEAAwE;AAExE,wCAAwC;AACxC,iEAAiE;AACjE,aAAa;AACb,+CAA+C;AAC/C,4BAA4B;AAC5B,0CAA0C;AAC1C,WAAW;AACX,SAAS;AAET,kCAAkC;AAClC,MAAM;AACN,KAAK;AAEL,MAAM,CAAC,MAAM,UAAU,GAAG,CACzB,QAAgB,EAChB,IAAc,EACd,MAAoC,EACX,EAAE,CAC3B,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAC/B,KAAK;KACH,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC;KAC5B,IAAI,CAAC,OAAO,CAAC;KACb,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CACxC,CAAC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -2,19 +2,20 @@ import { default as firebase } from "firebase/compat/app";
|
|
|
2
2
|
export type Config = {
|
|
3
3
|
apiKey: string | null;
|
|
4
4
|
apiUrl: string;
|
|
5
|
+
linkieUrl?: string;
|
|
5
6
|
appUrl: string;
|
|
6
7
|
tokenKey: string;
|
|
7
8
|
environment: string;
|
|
8
9
|
firebase?: FirebaseConfig;
|
|
9
10
|
};
|
|
10
11
|
export interface FirebaseConfig {
|
|
11
|
-
apiKey
|
|
12
|
-
authDomain
|
|
13
|
-
projectId
|
|
14
|
-
storageBucket
|
|
15
|
-
messagingSenderId
|
|
16
|
-
appId
|
|
17
|
-
measurementId
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
authDomain?: string;
|
|
14
|
+
projectId?: string;
|
|
15
|
+
storageBucket?: string;
|
|
16
|
+
messagingSenderId?: string;
|
|
17
|
+
appId?: string;
|
|
18
|
+
measurementId?: string;
|
|
18
19
|
}
|
|
19
20
|
export declare function initializeSDK(newConfig: Partial<Config>): void;
|
|
20
21
|
export declare function getFirebase(): firebase.default.app.App;
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,cAAc,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,cAAc,MAAM,eAAe,CAAC;AAuB3C,IAAI,MAAM,GAAW;IACnB,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,SAA0B;IACtD,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IACrC,cAAc,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7B,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;IAC9B,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC3D,CAAC;IACD,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/config/route.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getUrl(category: string, version: string, action: string): string;
|
|
1
|
+
export declare function getUrl(category: string, version: string, action: string, omitCategory?: boolean): string;
|
package/dist/config/route.js
CHANGED
|
@@ -4,6 +4,7 @@ import assets from "../assets/endpoint.js";
|
|
|
4
4
|
import auth from "../auth/endpoint.js";
|
|
5
5
|
import cms from "../content/endpoint.js";
|
|
6
6
|
import inventory from "../inventory/endpoint.js";
|
|
7
|
+
import linkie from "../linkie/endpoint.js";
|
|
7
8
|
import payment from "../payment/endpoint.js";
|
|
8
9
|
import sales from "../sales/endpoint.js";
|
|
9
10
|
import support from "../support/endpoint.js";
|
|
@@ -18,16 +19,20 @@ const urls = {
|
|
|
18
19
|
payment,
|
|
19
20
|
inventory,
|
|
20
21
|
tools,
|
|
21
|
-
sales
|
|
22
|
+
sales,
|
|
23
|
+
linkie
|
|
22
24
|
};
|
|
23
25
|
// Function to get the URL dynamically based on category, version, and action
|
|
24
|
-
export function getUrl(category, version, action) {
|
|
26
|
+
export function getUrl(category, version, action, omitCategory = false) {
|
|
25
27
|
const categoryData = urls[category]; // Access the correct category dynamically
|
|
26
28
|
if (categoryData) {
|
|
27
29
|
const versionData = categoryData[version]; // Access the correct version dynamically
|
|
28
30
|
// console.log(versionData?.[action]);
|
|
29
31
|
if (versionData !== undefined) {
|
|
30
32
|
console.log(versionData[action]);
|
|
33
|
+
if (omitCategory) {
|
|
34
|
+
return `/api/${version}/${versionData[action]}`;
|
|
35
|
+
}
|
|
31
36
|
return `/api/${version}/${category}/${versionData[action]}`; // Construct the URL
|
|
32
37
|
}
|
|
33
38
|
throw new Error(`Invalid action: ${action} for version: ${version} in category: ${category}`);
|
package/dist/config/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/config/route.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,GAAG,MAAM,wBAAwB,CAAC;AACzC,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAYzC,MAAM,IAAI,GAAS;IAClB,IAAI;IACJ,GAAG;IACH,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,KAAK;IACL,KAAK;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/config/route.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,GAAG,MAAM,wBAAwB,CAAC;AACzC,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO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").AxiosResponse<any, any>>;
|
|
3
|
-
articles: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
articleCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
-
mcq: (slug: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
-
mcqs: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
-
allMcqs: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
-
mcqsCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
9
|
-
qna: (slug: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
|
-
qnas: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
11
|
-
qnasCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
+
article: (slug: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
articles: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
articleCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
|
+
mcq: (slug: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
6
|
+
mcqs: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
7
|
+
allMcqs: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
8
|
+
mcqsCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
9
|
+
qna: (slug: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
10
|
+
qnas: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
11
|
+
qnasCategories: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
12
12
|
};
|
|
13
13
|
export default Content;
|
package/dist/hooks/useUser.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const useUser: () => {
|
|
2
|
-
user: import("axios").AxiosResponse<any, any> | undefined;
|
|
2
|
+
user: import("axios").AxiosResponse<any, any, {}> | undefined;
|
|
3
3
|
isLoading: boolean;
|
|
4
4
|
error: any;
|
|
5
5
|
loggedOut: any;
|
|
6
|
-
mutate: import("swr").KeyedMutator<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
mutate: import("swr").KeyedMutator<import("axios").AxiosResponse<any, any, {}>>;
|
|
7
7
|
};
|
|
8
8
|
export default useUser;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export { default as shareUrl } from "./utils/share.js";
|
|
|
12
12
|
export { default as Sales } from "./sales/index.js";
|
|
13
13
|
export { default as Inventory } from "./inventory/index.js";
|
|
14
14
|
export { default as Tools } from "./tools/index.js";
|
|
15
|
+
export { default as Linkie } from "./linkie/index.js";
|
|
15
16
|
export { getConfig, initializeSDK } from './config/index.js';
|
|
16
17
|
export * from './sales/types.js';
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,9 @@ export { default as shareUrl } from "./utils/share.js";
|
|
|
15
15
|
export { default as Sales } from "./sales/index.js";
|
|
16
16
|
export { default as Inventory } from "./inventory/index.js";
|
|
17
17
|
export { default as Tools } from "./tools/index.js";
|
|
18
|
+
export { default as Linkie } from "./linkie/index.js";
|
|
18
19
|
export { getConfig, initializeSDK } from './config/index.js';
|
|
19
20
|
// export { useUser, usePrivate, useAuth } from './hooks';
|
|
20
|
-
//
|
|
21
|
+
// Types
|
|
21
22
|
export * from './sales/types.js';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,oCAAoC;AAEpC,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;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AACpD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,0DAA0D;AAE1D,QAAQ;AACR,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const Inventory: {
|
|
2
|
-
getStoreById: (id: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
getStoreBySlug: (slug: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
getStoreProducts: (slug: string, category: string, brand: string, price: string, search: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
+
getStoreById: (id: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
getStoreBySlug: (slug: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
getStoreProducts: (slug: string, category: string, brand: string, price: string, search: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
5
|
};
|
|
6
6
|
export default Inventory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/linkie/endpoint.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACd,EAAE,EAAE;QACH,OAAO,EAAE,SAAS;KAClB;CACD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const Linkie: {
|
|
2
|
+
shortUrl: (data: import("./types.js").ShortenRequest, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
3
|
+
onFetching?: () => void;
|
|
4
|
+
onSuccess?: (data: object) => void;
|
|
5
|
+
onError?: (error: string) => void;
|
|
6
|
+
onSettled?: () => void;
|
|
7
|
+
config?: {
|
|
8
|
+
params: import("../auth/types.js").AuthRequestParams;
|
|
9
|
+
};
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export default Linkie;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// import cookie from "js-cookie";
|
|
2
|
+
// import { jwtDecode } from "jwt-decode";
|
|
3
|
+
// import type { NextPageContext } from "next";
|
|
4
|
+
// import { getConfig } from "../config/index.js";
|
|
5
|
+
// import { isAuth } from "../utils/auth.js";
|
|
6
|
+
// import {
|
|
7
|
+
// getDataFromStorage,
|
|
8
|
+
// setDataInStorage,
|
|
9
|
+
// setEncryptionKey,
|
|
10
|
+
// } from "../utils/localStorage.js";
|
|
11
|
+
import shortUrl from "./shortUrl.js";
|
|
12
|
+
const Linkie = {
|
|
13
|
+
shortUrl
|
|
14
|
+
};
|
|
15
|
+
export default Linkie;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linkie/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,0CAA0C;AAC1C,+CAA+C;AAC/C,kDAAkD;AAClD,6CAA6C;AAC7C,WAAW;AACX,uBAAuB;AACvB,qBAAqB;AACrB,qBAAqB;AACrB,qCAAqC;AACrC,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,MAAM,MAAM,GAAG;IACd,QAAQ;CACR,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AuthRequestParams } from "../auth/types.js";
|
|
2
|
+
import type { ShortenRequest } from "./types.js";
|
|
3
|
+
declare const shortUrl: (data: ShortenRequest, { config, onFetching, onSuccess, onError, onSettled, }: {
|
|
4
|
+
onFetching?: () => void;
|
|
5
|
+
onSuccess?: (data: object) => void;
|
|
6
|
+
onError?: (error: string) => void;
|
|
7
|
+
onSettled?: () => void;
|
|
8
|
+
config?: {
|
|
9
|
+
params: AuthRequestParams;
|
|
10
|
+
};
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
export default shortUrl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { linkiePost } from "../config/axios.js";
|
|
2
|
+
import handler from "../config/handler.js";
|
|
3
|
+
import { getUrl } from "../config/route.js";
|
|
4
|
+
const shortUrl = (data, { config, onFetching, onSuccess, onError, onSettled, }) => {
|
|
5
|
+
return handler(linkiePost(getUrl("linkie", "v1", "shorten", true), data, config), {
|
|
6
|
+
onFetching: () => onFetching?.(),
|
|
7
|
+
onError: (error) => onError?.(error),
|
|
8
|
+
onSuccess: (data) => onSuccess?.(data),
|
|
9
|
+
onSettled: () => onSettled?.(),
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export default shortUrl;
|
|
13
|
+
//# sourceMappingURL=shortUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortUrl.js","sourceRoot":"","sources":["../../src/linkie/shortUrl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,MAAM,QAAQ,GAAG,CAChB,IAAoB,EACpB,EACC,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EACP,SAAS,GAOT,EACA,EAAE;IACH,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;QACjF,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE;QAChC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC;QACpC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC;QACtC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;KAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/linkie/types.ts"],"names":[],"mappings":""}
|
package/dist/support/index.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ declare const Support: {
|
|
|
17
17
|
params: unknown;
|
|
18
18
|
};
|
|
19
19
|
}) => Promise<void>;
|
|
20
|
-
tickets: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
20
|
+
tickets: (config?: object | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
21
21
|
};
|
|
22
22
|
export default Support;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helpdice/sdk",
|
|
3
|
-
"type": "module",
|
|
4
3
|
"description": "A backend API-based SDK (Software Development Kit) provides developers with pre-built tools and libraries to interact seamlessly with a backend server or service. It simplifies the process of integrating external functionality, such as authentication, data storage, or third-party services, into applications. The SDK typically includes API endpoints, functions, and documentation, allowing developers to make requests, handle responses, and manage errors efficiently. By abstracting complex backend logic, it speeds up development, reduces coding errors, and ensures consistent interactions with the backend, making it easier to build scalable, secure, and feature-rich applications.",
|
|
5
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.6",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"url": "https://github.com/helpdice/sdk/issues"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"axios": "^1.
|
|
31
|
+
"axios": "^1.12.2",
|
|
32
32
|
"crypto-js": "^4.2.0",
|
|
33
33
|
"firebase": "^11.2.0",
|
|
34
34
|
"fs": "^0.0.1-security",
|