mirror of
https://github.com/makeplane/plane.git
synced 2025-12-28 16:06:33 +01:00
fix: disco server proxy
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
"NEXT_PUBLIC_SENTRY_DSN",
|
||||
"SENTRY_MONITORING_ENABLED",
|
||||
"NEXT_PUBLIC_PRO_PLAN_MONTHLY_REDIRECT_URL",
|
||||
"NEXT_PUBLIC_PRO_PLAN_YEARLY_REDIRECT_URL"
|
||||
"NEXT_PUBLIC_PRO_PLAN_YEARLY_REDIRECT_URL",
|
||||
"NEXT_PUBLIC_DISCO_BASE_URL"
|
||||
],
|
||||
"pipeline": {
|
||||
"build": {
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { FC, Fragment, useState } from "react";
|
||||
import useSWR from "swr";
|
||||
// icons
|
||||
import { CheckCircle } from "lucide-react";
|
||||
// ui
|
||||
import { Dialog, Transition, Tab } from "@headlessui/react";
|
||||
// store
|
||||
import { useEventTracker } from "@/hooks/store";
|
||||
// services
|
||||
import { DiscoService } from "@/services/disco.service";
|
||||
|
||||
const discoService = new DiscoService();
|
||||
|
||||
function classNames(...classes: any[]) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
@@ -30,15 +35,18 @@ const YEARLY_PLAN_ITEMS = [
|
||||
"Tiered discounts for the second and third years",
|
||||
];
|
||||
|
||||
export type ProPlanModalProps = {
|
||||
export type CloudProductsModalProps = {
|
||||
isOpen: boolean;
|
||||
handleClose: () => void;
|
||||
};
|
||||
|
||||
export const ProPlanModal: FC<ProPlanModalProps> = (props) => {
|
||||
export const CloudProductsModal: FC<CloudProductsModalProps> = (props) => {
|
||||
const { isOpen, handleClose } = props;
|
||||
// store
|
||||
const { captureEvent } = useEventTracker();
|
||||
// fetch products
|
||||
const { data } = useSWR("CLOUD_PAYMENT_PRODUCTS", () => discoService.listProducts());
|
||||
console.log("data", data);
|
||||
// states
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const [tabIndex, setTabIndex] = useState(0);
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./pro-plan-modal";
|
||||
export * from "./cloud-products-modal";
|
||||
export * from "./plane-one-modal";
|
||||
export * from "./plane-one-billing";
|
||||
export * from "./plane-cloud-billing";
|
||||
|
||||
@@ -3,7 +3,7 @@ import Image from "next/image";
|
||||
// ui
|
||||
import { Tooltip, Button, getButtonStyling } from "@plane/ui";
|
||||
// components
|
||||
import { PlaneOneModal, ProPlanModal } from "@/components/license";
|
||||
import { PlaneOneModal, CloudProductsModal } from "@/components/license";
|
||||
// hooks
|
||||
import { cn } from "@/helpers/common.helper";
|
||||
import { useEventTracker, useInstance } from "@/hooks/store";
|
||||
@@ -31,10 +31,10 @@ export const PlaneBadge: React.FC = () => {
|
||||
captureEvent("plane_one_modal_opened", {});
|
||||
};
|
||||
|
||||
if (process.env.NEXT_PUBLIC_PRO_PLAN_MONTHLY_REDIRECT_URL || process.env.NEXT_PUBLIC_PRO_PLAN_YEARLY_REDIRECT_URL) {
|
||||
if (process.env.NEXT_PUBLIC_DISCO_BASE_URL !== "") {
|
||||
return (
|
||||
<>
|
||||
<ProPlanModal isOpen={isProPlanModalOpen} handleClose={() => setIsProPlanModalOpen(false)} />
|
||||
<CloudProductsModal isOpen={isProPlanModalOpen} handleClose={() => setIsProPlanModalOpen(false)} />
|
||||
<Button
|
||||
variant="outline-primary"
|
||||
className="w-1/2 cursor-pointer rounded-2xl px-3 py-1.5 text-center text-sm font-medium outline-none"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export const DISCO_BASE_URL = process.env.NEXT_PUBLIC_DISCO_BASE_URL || "";
|
||||
|
||||
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || "";
|
||||
|
||||
export const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || "";
|
||||
|
||||
@@ -66,6 +66,19 @@ const nextConfig = {
|
||||
destination: `${posthogHost}/:path*`,
|
||||
},
|
||||
];
|
||||
|
||||
if (process.env.NEXT_PUBLIC_DISCO_BASE_URL) {
|
||||
const DISCO_BASE_URL = process.env.NEXT_PUBLIC_DISCO_BASE_URL
|
||||
rewrites.push({
|
||||
source: "/disco",
|
||||
destination: `${DISCO_BASE_URL}/api/`,
|
||||
})
|
||||
rewrites.push({
|
||||
source: "/disco/:path*",
|
||||
destination: `${DISCO_BASE_URL}/:path*/`,
|
||||
})
|
||||
}
|
||||
|
||||
if (process.env.NEXT_PUBLIC_ADMIN_BASE_URL || process.env.NEXT_PUBLIC_ADMIN_BASE_PATH) {
|
||||
const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || ""
|
||||
const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || ""
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// helpers
|
||||
import { API_BASE_URL } from "@/helpers/common.helper";
|
||||
// services
|
||||
import { APIService } from "@/services/api.service";
|
||||
|
||||
export class DashboardService extends APIService {
|
||||
export class DiscoService extends APIService {
|
||||
constructor() {
|
||||
super(API_BASE_URL);
|
||||
super("/disco");
|
||||
}
|
||||
|
||||
listProducts(): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user