@odynn/awayz-core 0.2.0
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/README.md +50 -0
- package/dist/AccountService-BjwUydb_.js +7670 -0
- package/dist/assets/CashValue.css +1 -0
- package/dist/components/CashValue/CashValue.js +21590 -0
- package/dist/configs/awayzClient.js +12 -0
- package/dist/configs/awayzConfig.js +1 -0
- package/dist/configs/baseUrl.js +8 -0
- package/dist/configs/defaultAwayzConfig.js +11 -0
- package/dist/configs/endpoints.js +5 -0
- package/dist/context/AwayzContext.js +16 -0
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +168 -0
- package/dist/hooks/useAwayzAuth/useAwayzAuth.types.js +1 -0
- package/dist/hooks/useAwayzContext.js +13 -0
- package/dist/lib/components/CashValue/CashValue.d.ts +14 -0
- package/dist/lib/configs/awayzClient.d.ts +2 -0
- package/dist/lib/configs/awayzConfig.d.ts +36 -0
- package/dist/lib/configs/baseUrl.d.ts +2 -0
- package/dist/lib/configs/defaultAwayzConfig.d.ts +8 -0
- package/dist/lib/configs/endpoints.d.ts +26 -0
- package/dist/lib/context/AwayzContext.d.ts +17 -0
- package/dist/lib/hooks/useAwayzAuth/useAwayzAuth.d.ts +37 -0
- package/dist/lib/hooks/useAwayzAuth/useAwayzAuth.types.d.ts +17 -0
- package/dist/lib/hooks/useAwayzContext.d.ts +2 -0
- package/dist/lib/main.d.ts +6 -0
- package/dist/lib/providers/AwayzProvider.d.ts +12 -0
- package/dist/lib/services/account/AccountService.d.ts +84 -0
- package/dist/lib/services/account/AccountServices.types.d.ts +152 -0
- package/dist/lib/services/currency/CurrencyService.d.ts +6 -0
- package/dist/lib/services/currency/CurrencyService.types.d.ts +17 -0
- package/dist/lib/services/instance.d.ts +2 -0
- package/dist/lib/types/EAuthFlow.d.ts +8 -0
- package/dist/lib/types/auth.d.ts +21 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/main.js +15 -0
- package/dist/providers/AwayzProvider.js +39 -0
- package/dist/services/account/AccountService.js +7 -0
- package/dist/services/account/AccountServices.types.js +4 -0
- package/dist/services/currency/CurrencyService.js +39 -0
- package/dist/services/currency/CurrencyService.types.js +1 -0
- package/dist/services/instance.js +8 -0
- package/dist/types/EAuthFlow.js +4 -0
- package/dist/types/auth.js +1 -0
- package/dist/types/index.js +4 -0
- package/package.json +44 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IConvertCurrencyArgs {
|
|
2
|
+
baseCurrency: string;
|
|
3
|
+
amount?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IConvertCurrencyResult {
|
|
6
|
+
result: string;
|
|
7
|
+
documentation: string;
|
|
8
|
+
terms_of_use: string;
|
|
9
|
+
time_last_update_unix: number;
|
|
10
|
+
time_last_update_utc: string;
|
|
11
|
+
time_next_update_unix: number;
|
|
12
|
+
time_next_update_utc: string;
|
|
13
|
+
base_code: string;
|
|
14
|
+
target_code: string;
|
|
15
|
+
conversion_rate: number;
|
|
16
|
+
conversion_result: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IAuthData } from '../services/account/AccountServices.types';
|
|
2
|
+
export interface ISignUpParams {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
region: string;
|
|
6
|
+
successUrl?: string;
|
|
7
|
+
cancelUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ISignInParams {
|
|
10
|
+
email: string;
|
|
11
|
+
password: string;
|
|
12
|
+
}
|
|
13
|
+
export type TAuthResponse = {
|
|
14
|
+
success: boolean;
|
|
15
|
+
data: IAuthData;
|
|
16
|
+
message?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
success: boolean;
|
|
19
|
+
message: any;
|
|
20
|
+
data?: undefined;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EAuthFlow';
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AwayzProvider as r } from "./providers/AwayzProvider.js";
|
|
2
|
+
import { useAwayzContext as a } from "./hooks/useAwayzContext.js";
|
|
3
|
+
import { EAuthFlow as x } from "./types/EAuthFlow.js";
|
|
4
|
+
import { c as m, i as p } from "./AccountService-BjwUydb_.js";
|
|
5
|
+
import { awayzClient as i } from "./configs/awayzClient.js";
|
|
6
|
+
import { getBaseUrl as l } from "./configs/baseUrl.js";
|
|
7
|
+
export {
|
|
8
|
+
r as AwayzProvider,
|
|
9
|
+
x as EAuthFlow,
|
|
10
|
+
i as awayzClient,
|
|
11
|
+
m as clientInstance,
|
|
12
|
+
l as getBaseUrl,
|
|
13
|
+
p as instance,
|
|
14
|
+
a as useAwayzContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as i } from "react";
|
|
3
|
+
import { AwayzContext as a } from "../context/AwayzContext.js";
|
|
4
|
+
import { E as m } from "../AccountService-BjwUydb_.js";
|
|
5
|
+
import { useAwayzAuth as s } from "../hooks/useAwayzAuth/useAwayzAuth.js";
|
|
6
|
+
import { setBaseUrl as l } from "../configs/baseUrl.js";
|
|
7
|
+
import { QueryClientProvider as u } from "@tanstack/react-query";
|
|
8
|
+
import { awayzClient as d } from "../configs/awayzClient.js";
|
|
9
|
+
import { defaultAwayzConfig as n } from "../configs/defaultAwayzConfig.js";
|
|
10
|
+
const I = ({ children: e, config: r }) => {
|
|
11
|
+
const o = s({
|
|
12
|
+
authFlow: r.authFlow,
|
|
13
|
+
onSuccess: () => {
|
|
14
|
+
},
|
|
15
|
+
trustedOrigins: r.trustedOrigins
|
|
16
|
+
});
|
|
17
|
+
return i(() => {
|
|
18
|
+
if (!r.clientId) {
|
|
19
|
+
console.error("You need to provide a client ID to the AwayzProvider");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
localStorage.setItem(m.CLIENT_ID, r.clientId), l(r.testMode ?? !1);
|
|
23
|
+
}, [r]), /* @__PURE__ */ t(u, { client: d, children: /* @__PURE__ */ t(
|
|
24
|
+
a.Provider,
|
|
25
|
+
{
|
|
26
|
+
value: {
|
|
27
|
+
...o,
|
|
28
|
+
config: {
|
|
29
|
+
...n,
|
|
30
|
+
...r
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
children: e
|
|
34
|
+
}
|
|
35
|
+
) });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
I as AwayzProvider
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var i = (t, r, e) => r in t ? s(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var c = (t, r, e) => i(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { a as u, b as y, c as p } from "../../AccountService-BjwUydb_.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { ECurrencyEndpoints as m } from "../../configs/endpoints.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "../../context/AwayzContext.js";
|
|
9
|
+
import { awayzClient as C } from "../../configs/awayzClient.js";
|
|
10
|
+
import "@tanstack/react-query";
|
|
11
|
+
class E {
|
|
12
|
+
constructor() {
|
|
13
|
+
c(this, "convertCurrency", async ({
|
|
14
|
+
baseCurrency: r
|
|
15
|
+
}) => {
|
|
16
|
+
try {
|
|
17
|
+
const { success: e, data: n } = await C.ensureQueryData({
|
|
18
|
+
queryKey: [y.CHECK_USER],
|
|
19
|
+
queryFn: u.checkUser
|
|
20
|
+
});
|
|
21
|
+
if (!e)
|
|
22
|
+
throw new Error("Failed to fetch user data");
|
|
23
|
+
const { userRegion: o } = n, { data: a } = await p.post(m.CURRENCY_CONVERSION, {
|
|
24
|
+
target_currency: o.currency,
|
|
25
|
+
base_currency: r
|
|
26
|
+
});
|
|
27
|
+
if (e)
|
|
28
|
+
return a.data.conversion_rate;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(e);
|
|
31
|
+
}
|
|
32
|
+
return 0;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const h = new E();
|
|
37
|
+
export {
|
|
38
|
+
h as CurrencyService
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@odynn/awayz-core",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/main.js",
|
|
9
|
+
"types": "./dist/lib/main.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "tsc -b && vite build",
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"preview": "vite preview",
|
|
15
|
+
"stoot": "npm publish --access public",
|
|
16
|
+
"push": "npm publish --access public"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@tanstack/react-query": "^5.66.9",
|
|
20
|
+
"react": "^18.3.1",
|
|
21
|
+
"react-dom": "^18.3.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^9.17.0",
|
|
25
|
+
"@types/node": "^22.10.7",
|
|
26
|
+
"@types/react": "^18.3.18",
|
|
27
|
+
"@types/react-dom": "^18.3.5",
|
|
28
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
29
|
+
"axios": "^1.7.9",
|
|
30
|
+
"eslint": "^9.17.0",
|
|
31
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
32
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
33
|
+
"glob": "^11.0.1",
|
|
34
|
+
"globals": "^15.14.0",
|
|
35
|
+
"typescript": "~5.6.2",
|
|
36
|
+
"typescript-eslint": "^8.18.2",
|
|
37
|
+
"vite": "^6.0.5",
|
|
38
|
+
"vite-plugin-dts": "^4.5.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
|
42
|
+
"vite-plugin-lib-inject-css": "^2.2.1"
|
|
43
|
+
}
|
|
44
|
+
}
|