one-click-accessibility/modules/settings/assets/js/hooks/use-auth.js
Nirbhay Singh 0dac7e1699
[APP-1198] [APP-1199] Quota bar and notices (#219)
* add: quota bar

* add: openLink helper function

* add: styled elements and visits link placeholder

* update: remove hover state from the box

* add: quota notices

* update: quota access and usage calculations

* add: logic to calculate plan usage

* update: move logic to calculate plan usage to hook

* add: todo note

* add: todos

* add: mixpanel events

* fix: hide quota bar when sidebar is minimized

* fix: settings panel was not expanding when sidebar is minimized

* update: text and structure of the bar

* update: quota calculation logic

* update: remove TODOs

* update: text and values

* fix: height of the container for icon settings

* update: golinks

* update: golinks
2025-03-17 10:23:26 +02:00

30 lines
567 B
JavaScript

import API from '../api';
import { GOLINKS } from '../constants';
export const useAuth = () => {
const { subscriptionId } = 123;
const redirectToConnect = async () => {
const link = await getConnectLink();
window.open(link, '_self').focus();
};
const getConnectLink = async () => {
return API.initConnect();
};
const getUpgradeLink = () => {
const url = new URL(GOLINKS.UPGRADE);
url.searchParams.append('subscription_id', subscriptionId);
return url.toString();
};
return {
redirectToConnect,
getConnectLink,
getUpgradeLink,
};
};