@oxyhq/services 0.0.21 → 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.
@@ -4,8 +4,8 @@ import { signOut } from "next-auth/react";
4
4
  import useOxySession from "../../hooks/useOxySession";
5
5
  function UserInfo({ setDisplayUserInfo }) {
6
6
  const { session } = useOxySession();
7
- return (React.createElement("div", { className: "relative z-10 flex flex-col items-center justify-center\n space-y-3 rounded-2xl bg-darkC2 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-darkC2 p-1 hover:bg-darkC" }),
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" }),
9
9
  React.createElement("p", null, session?.user?.email),
10
10
  React.createElement("div", { className: "h-20 w-20 rounded-full border" },
11
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" })),
@@ -15,9 +15,9 @@ function UserInfo({ setDisplayUserInfo }) {
15
15
  "!"),
16
16
  React.createElement("button", { className: "rounded-full border border-black px-7 py-2 text-textC2 hover:bg-[#d3dfee]" }, "Manage your Oxy Account"),
17
17
  React.createElement("div", { className: "flex space-x-1" },
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-darkC" },
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" },
19
19
  React.createElement("span", null, "Add account")),
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-darkC" },
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" },
21
21
  React.createElement("span", null, "Sign out"))),
22
22
  React.createElement("div", { className: "flex h-10 items-center space-x-2 text-xs" },
23
23
  React.createElement("span", null, "Privacy policy"),
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export declare const OAvatar: ({ icon, text, callback, }: {
3
+ icon?: React.ReactNode;
4
+ text?: string;
5
+ callback?: string;
6
+ }) => React.JSX.Element;
7
+ export default OAvatar;
8
+ //# sourceMappingURL=OAvatar.d.ts.map
@@ -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"}
package/dist/index.d.ts CHANGED
@@ -2,5 +2,6 @@ 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
- export { useOxySession, getUserById, SignInButton, AccountSwitcher };
5
+ import OAvatar from "./components/auth/OAvatar";
6
+ export { useOxySession, getUserById, SignInButton, AccountSwitcher, OAvatar };
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAC1D,OAAO,eAAe,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,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
@@ -2,4 +2,5 @@ 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
- export { useOxySession, getUserById, SignInButton, AccountSwitcher };
5
+ import OAvatar from "./components/auth/OAvatar";
6
+ export { useOxySession, getUserById, SignInButton, AccountSwitcher, OAvatar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "",
5
5
  "homepage": "https://oxy.so/",
6
6
  "main": "./dist/index.js",