@oxyhq/services 0.0.20 → 0.0.22
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/components/auth/AccountSwitcher.d.ts.map +1 -1
- package/dist/components/auth/AccountSwitcher.js +9 -8
- package/dist/components/auth/OAvatar.d.ts +8 -0
- package/dist/components/auth/OAvatar.d.ts.map +1 -0
- package/dist/components/auth/OAvatar.js +18 -0
- package/dist/components/auth/SignInButton.js +1 -1
- package/dist/components/auth/styles/oavatar.module.css +34 -0
- package/dist/components/auth/styles/oavatar.module.css.map +1 -0
- package/dist/components/auth/styles/sign-in-button.module.css +30 -0
- package/dist/components/auth/styles/sign-in-button.module.css.map +1 -0
- package/dist/hooks/useOxySession.d.ts +1 -1
- package/dist/hooks/useOxySession.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AccountSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSwitcher.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AccountSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,aAAa;IACrB,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACnE;AAED,iBAAS,QAAQ,CAAC,EAAE,kBAAkB,EAAE,EAAE,aAAa,qBA8CtD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Image from "next/image";
|
|
3
|
-
import { signOut
|
|
3
|
+
import { signOut } from "next-auth/react";
|
|
4
|
+
import useOxySession from "../../hooks/useOxySession";
|
|
4
5
|
function UserInfo({ setDisplayUserInfo }) {
|
|
5
|
-
const {
|
|
6
|
-
return (React.createElement("div", { className: "
|
|
7
|
-
React.createElement("button", { onClick: () => setDisplayUserInfo((prev) => false), className: "absolute right-3 top-3 rounded-full bg-
|
|
6
|
+
const { session } = useOxySession();
|
|
7
|
+
return (React.createElement("div", { className: "fixed z-10 flex flex-col items-center justify-center\n space-y-3 rounded-2xl bg-dark px-5 py-3 text-sm font-medium text-textC\n shadow-md shadow-[#b4bebb]" },
|
|
8
|
+
React.createElement("button", { onClick: () => setDisplayUserInfo((prev) => false), className: "absolute right-3 top-3 rounded-full bg-dark p-1 hover:bg-dark" }),
|
|
8
9
|
React.createElement("p", null, session?.user?.email),
|
|
9
10
|
React.createElement("div", { className: "h-20 w-20 rounded-full border" },
|
|
10
|
-
React.createElement(Image, { src: session?.user?.
|
|
11
|
+
React.createElement(Image, { src: session?.user?.avatar, className: "h-full w-full rounded-full object-center", height: 500, width: 500, draggable: false, alt: "avatar" })),
|
|
11
12
|
React.createElement("h2", { className: "tablet:text-2xl text-xl font-normal" },
|
|
12
13
|
"Hi, ",
|
|
13
14
|
session?.user?.name,
|
|
14
15
|
"!"),
|
|
15
|
-
React.createElement("button", { className: "rounded-full border border-black px-7 py-2 text-textC2 hover:bg-[#d3dfee]" }, "Manage your
|
|
16
|
+
React.createElement("button", { className: "rounded-full border border-black px-7 py-2 text-textC2 hover:bg-[#d3dfee]" }, "Manage your Oxy Account"),
|
|
16
17
|
React.createElement("div", { className: "flex space-x-1" },
|
|
17
|
-
React.createElement("button", { className: "tablet:w-44 flex w-36 items-center space-x-2 rounded-l-full bg-white py-3 pl-3 hover:bg-
|
|
18
|
+
React.createElement("button", { className: "tablet:w-44 flex w-36 items-center space-x-2 rounded-l-full bg-white py-3 pl-3 hover:bg-dark" },
|
|
18
19
|
React.createElement("span", null, "Add account")),
|
|
19
|
-
React.createElement("button", { onClick: () => signOut(), className: "tablet:w-44 flex w-36 items-center space-x-2 rounded-r-full bg-white py-3 pl-3 hover:bg-
|
|
20
|
+
React.createElement("button", { onClick: () => signOut(), className: "tablet:w-44 flex w-36 items-center space-x-2 rounded-r-full bg-white py-3 pl-3 hover:bg-dark" },
|
|
20
21
|
React.createElement("span", null, "Sign out"))),
|
|
21
22
|
React.createElement("div", { className: "flex h-10 items-center space-x-2 text-xs" },
|
|
22
23
|
React.createElement("span", null, "Privacy policy"),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAvatar.d.ts","sourceRoot":"","sources":["../../../src/components/auth/OAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,OAAO,8BAIjB;IACD,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,sBAkBA,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styles from "./oavatar.module.css";
|
|
3
|
+
import { OxyLogo } from "../assets/oxy-logo";
|
|
4
|
+
import useOxySession from "../../hooks/useOxySession";
|
|
5
|
+
export const OAvatar = ({ icon = React.createElement(OxyLogo, null), text = "Sign in with Oxy", callback = window.location.href, }) => {
|
|
6
|
+
const { session } = useOxySession();
|
|
7
|
+
const onClick = () => {
|
|
8
|
+
if (!session?.user?.id) {
|
|
9
|
+
const redirectUrl = `https://auth.oxy.so/?callback=${encodeURIComponent(callback)}`;
|
|
10
|
+
window.location.href = redirectUrl;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
// Open account switcher logic here
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return (React.createElement("button", { onClick: onClick, className: styles.oavatar }, icon && icon));
|
|
17
|
+
};
|
|
18
|
+
export default OAvatar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styles from "./sign-in-button.module.css";
|
|
2
|
+
import styles from "./styles/sign-in-button.module.css";
|
|
3
3
|
import { OxyLogo } from "../assets/oxy-logo";
|
|
4
4
|
export const SignInButton = ({ icon = React.createElement(OxyLogo, null), text = "Sign in with Oxy", callback = window.location.href, }) => {
|
|
5
5
|
const onClick = () => {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.oavatar {
|
|
2
|
+
width: 2rem;
|
|
3
|
+
height: 2rem;
|
|
4
|
+
padding: 0.7em;
|
|
5
|
+
border-radius: 100vmax;
|
|
6
|
+
font-size: var(--fs-milli);
|
|
7
|
+
font-weight: var(--fw-700);
|
|
8
|
+
color: var(--clr-dark);
|
|
9
|
+
background-color: var(--clr-light);
|
|
10
|
+
border: 1px solid var(--clr-auth-border);
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
transition: background 0.2s ease-in-out;
|
|
16
|
+
}
|
|
17
|
+
.oavatar:hover {
|
|
18
|
+
background-color: var(--clr-auth-button-hover);
|
|
19
|
+
}
|
|
20
|
+
.oavatar:active {
|
|
21
|
+
background-color: var(--clr-auth-button-active);
|
|
22
|
+
}
|
|
23
|
+
.oavatar:focus-visible {
|
|
24
|
+
outline: 2px solid var(--clr-light);
|
|
25
|
+
background-color: var(--clr-auth-button-hover);
|
|
26
|
+
}
|
|
27
|
+
.oavatar svg {
|
|
28
|
+
width: var(--fs-h2);
|
|
29
|
+
height: var(--fs-h2);
|
|
30
|
+
fill: var(--clr-dark);
|
|
31
|
+
margin-right: 0.5em;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/*# sourceMappingURL=oavatar.module.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/components/auth/styles/oavatar.module.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA","file":"oavatar.module.css"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
padding: 0.7em;
|
|
4
|
+
border-radius: 100vmax;
|
|
5
|
+
background-color: var(--clr-light);
|
|
6
|
+
border: 1px solid var(--clr-auth-border);
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
transition: background 0.2s ease-in-out;
|
|
12
|
+
}
|
|
13
|
+
.container:hover {
|
|
14
|
+
background-color: var(--clr-auth-button-hover);
|
|
15
|
+
}
|
|
16
|
+
.container:active {
|
|
17
|
+
background-color: var(--clr-auth-button-active);
|
|
18
|
+
}
|
|
19
|
+
.container:focus-visible {
|
|
20
|
+
outline: 2px solid var(--clr-light);
|
|
21
|
+
background-color: var(--clr-auth-button-hover);
|
|
22
|
+
}
|
|
23
|
+
.container svg {
|
|
24
|
+
width: var(--fs-h2);
|
|
25
|
+
height: var(--fs-h2);
|
|
26
|
+
fill: var(--clr-dark);
|
|
27
|
+
margin-right: 0.5em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*# sourceMappingURL=sign-in-button.module.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/components/auth/styles/sign-in-button.module.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA","file":"sign-in-button.module.css"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOxySession.d.ts","sourceRoot":"","sources":["../../src/hooks/useOxySession.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC;QAClB,
|
|
1
|
+
{"version":3,"file":"useOxySession.d.ts","sourceRoot":"","sources":["../../src/hooks/useOxySession.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,eAAe,2EAmC1B,CAAC;AAEH,iBAAS,aAAa;;;;EAQrB;AAED,eAAe,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import useOxySession from "./hooks/useOxySession";
|
|
2
2
|
import getUserById from "./hooks/getUserById";
|
|
3
3
|
import SignInButton from "./components/auth/SignInButton";
|
|
4
|
-
|
|
4
|
+
import AccountSwitcher from "./components/auth/AccountSwitcher";
|
|
5
|
+
import OAvatar from "./components/auth/OAvatar";
|
|
6
|
+
export { useOxySession, getUserById, SignInButton, AccountSwitcher, OAvatar };
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,YAAY,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAC1D,OAAO,eAAe,MAAM,mCAAmC,CAAC;AAChE,OAAO,OAAO,MAAM,2BAA2B,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import useOxySession from "./hooks/useOxySession";
|
|
2
2
|
import getUserById from "./hooks/getUserById";
|
|
3
3
|
import SignInButton from "./components/auth/SignInButton";
|
|
4
|
-
|
|
4
|
+
import AccountSwitcher from "./components/auth/AccountSwitcher";
|
|
5
|
+
import OAvatar from "./components/auth/OAvatar";
|
|
6
|
+
export { useOxySession, getUserById, SignInButton, AccountSwitcher, OAvatar };
|