|
|
@@ -37,10 +37,6 @@ type TGetPublishableKey = {
|
|
|
publishableKey: string;
|
|
|
};
|
|
|
|
|
|
-type TGetUsageDashboard = {
|
|
|
- url: string;
|
|
|
-};
|
|
|
-
|
|
|
type TGetCredits = {
|
|
|
creditGrantsList: CreditGrantList;
|
|
|
};
|
|
|
@@ -49,25 +45,6 @@ type TGetPlan = {
|
|
|
plan: Plan;
|
|
|
};
|
|
|
|
|
|
-const embeddableDashboardColors = {
|
|
|
- standardText: "Gray_dark",
|
|
|
- greyMedium: "Gray_medium",
|
|
|
- borders: "Gray_light",
|
|
|
- hover: "Gray_extralight",
|
|
|
- background: "White",
|
|
|
- primaryMedium: "Primary_medium",
|
|
|
- primaryLight: "Primary_light",
|
|
|
- usageLine0: "Usageline_0",
|
|
|
- usageLine1: "Usageline_1",
|
|
|
- usageLine2: "Usageline_2",
|
|
|
- usageLine3: "Usageline_3",
|
|
|
- usageLine4: "Usageline_4",
|
|
|
- usageLine5: "Usageline_5",
|
|
|
- usageLine6: "Usageline_6",
|
|
|
- usageLine7: "Usageline_7",
|
|
|
- usageLine8: "Usageline_8",
|
|
|
-};
|
|
|
-
|
|
|
export const usePaymentMethods = (): TUsePaymentMethod => {
|
|
|
const { currentProject } = useContext(Context);
|
|
|
|
|
|
@@ -183,49 +160,6 @@ export const checkIfProjectHasPayment = (): TCheckHasPaymentEnabled => {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
-export const useCustomerDashboard = (dashboard: string): TGetUsageDashboard => {
|
|
|
- const { currentProject } = useContext(Context);
|
|
|
-
|
|
|
- const colorOverrides = [
|
|
|
- { name: embeddableDashboardColors.background, value: "#121212" },
|
|
|
- { name: embeddableDashboardColors.borders, value: "#121212" },
|
|
|
- { name: embeddableDashboardColors.hover, value: "#DFDFE1" },
|
|
|
- { name: embeddableDashboardColors.greyMedium, value: "#121212" },
|
|
|
- { name: embeddableDashboardColors.primaryLight, value: "#121212" },
|
|
|
- { name: embeddableDashboardColors.primaryMedium, value: "#DFDFE1" },
|
|
|
- { name: embeddableDashboardColors.standardText, value: "#DFDFE1" },
|
|
|
- ];
|
|
|
-
|
|
|
- // Return an embeddable dashboard for the customer
|
|
|
- const dashboardReq = useQuery(
|
|
|
- ["getUsageDashboard", currentProject?.id, dashboard],
|
|
|
- async () => {
|
|
|
- if (!currentProject?.id || currentProject.id === -1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const res = await api.getUsageDashboard(
|
|
|
- "<token>",
|
|
|
- {
|
|
|
- dashboard,
|
|
|
- color_overrides: colorOverrides,
|
|
|
- },
|
|
|
- {
|
|
|
- project_id: currentProject?.id,
|
|
|
- }
|
|
|
- );
|
|
|
- console.log(res);
|
|
|
- return res.data;
|
|
|
- },
|
|
|
- {
|
|
|
- staleTime: Infinity,
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- return {
|
|
|
- url: dashboardReq.data,
|
|
|
- };
|
|
|
-};
|
|
|
-
|
|
|
export const usePublishableKey = (): TGetPublishableKey => {
|
|
|
const { currentProject } = useContext(Context);
|
|
|
|