diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..dc31c684e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "memphis", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{} diff --git a/ui_src/src/App.js b/ui_src/src/App.js index 6a564f62a..b1a346550 100644 --- a/ui_src/src/App.js +++ b/ui_src/src/App.js @@ -15,7 +15,6 @@ import 'App.scss'; import { Switch, Route, withRouter } from 'react-router-dom'; import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; import { JSONCodec, StringCodec, connect } from 'nats.ws'; -import { useStiggContext } from '@stigg/react-sdk'; import { useMediaQuery } from 'react-responsive'; import { useHistory } from 'react-router-dom'; import { message, notification } from 'antd'; @@ -27,18 +26,16 @@ import { LOCAL_STORAGE_INTERNAL_WS_PASS, LOCAL_STORAGE_CONNECTION_TOKEN, LOCAL_STORAGE_TOKEN, - LOCAL_STORAGE_USER_PASS_BASED_AUTH, - USER_IMAGE, - LOCAL_STORAGE_PLAN + LOCAL_STORAGE_USER_PASS_BASED_AUTH } from 'const/localStorageConsts'; -import { CLOUD_URL, HANDLE_REFRESH_INTERVAL, WS_PREFIX } from 'config'; -import { isCheckoutCompletedTrue, isCloud } from 'services/valueConvertor'; +import { HANDLE_REFRESH_INTERVAL, WS_PREFIX } from 'config'; +import { isCheckoutCompletedTrue } from 'services/valueConvertor'; import { ReactComponent as InfoNotificationIcon } from 'assets/images/infoNotificationIcon.svg'; import { handleRefreshTokenRequest, httpRequest } from 'services/http'; import { ReactComponent as RedirectIcon } from 'assets/images/redirectIcon.svg'; import { ReactComponent as SuccessIcon } from 'assets/images/successIcon.svg'; import { ReactComponent as CloseIcon } from 'assets/images/closeNotification.svg'; -import { showMessages, useGetAllowedActions } from 'services/genericServices'; +import { showMessages } from 'services/genericServices'; import StationOverview from 'domain/stationOverview'; import { ReactComponent as ErrorIcon } from 'assets/images/errorIcon.svg'; import MessageJourney from 'domain/messageJourney'; @@ -52,21 +49,18 @@ import PrivateRoute from 'PrivateRoute'; import AuthService from 'services/auth'; import Overview from 'domain/overview'; import Loader from 'components/loader'; -import Functions from 'domain/functions'; import { Context } from 'hooks/store'; import pathDomains from 'router'; import Users from 'domain/users'; -import { planType } from "const/globalConst"; +import { planType } from 'const/globalConst'; let SysLogs = undefined; let Login = undefined; let Signup = undefined; -if (!isCloud()) { - SysLogs = require('domain/sysLogs').default; - Login = require('domain/login').default; - Signup = require('domain/signup').default; -} +SysLogs = require('domain/sysLogs').default; +Login = require('domain/login').default; +Signup = require('domain/signup').default; const App = withRouter(() => { const [state, dispatch] = useContext(Context); @@ -76,69 +70,20 @@ const App = withRouter(() => { const urlParams = new URLSearchParams(window.location.search); const firebase_id_token = urlParams.get('firebase_id_token'); const firebase_organization_id = urlParams.get('firebase_organization_id'); - const [cloudLogedIn, setCloudLogedIn] = useState(isCloud() ? false : true); - const [refreshPlan, setRefreshPlan] = useState(isCloud() ? true : false); + const [cloudLogedIn, setCloudLogedIn] = useState(true); + const [refreshPlan, setRefreshPlan] = useState(false); const [persistedNotifications, setPersistedNotifications] = useState(() => { const storedNotifications = JSON.parse(localStorage.getItem('persistedNotifications')); return storedNotifications || []; }); const [displayedNotifications, setDisplayedNotifications] = useState([]); const [systemMessage, setSystemMessage] = useState([]); - const { stigg } = isCloud() && useStiggContext(); - const getAllowedActions = useGetAllowedActions(); const stateRef = useRef([]); stateRef.current = [cloudLogedIn, persistedNotifications]; - const handleLoginWithToken = async () => { - try { - const data = await httpRequest('POST', ApiEndpoints.LOGIN, { firebase_id_token, firebase_organization_id }, {}, {}, false); - if (data) { - stigg.setCustomerId(data.account_name); - localStorage.setItem(USER_IMAGE, data.user_image); - AuthService.saveToLocalStorage(data); - dispatch({ type: 'SET_USER_DATA', payload: data }); - try { - let wsHost = localStorage.getItem(LOCAL_STORAGE_WS_HOST); - wsHost = `${WS_PREFIX}://${wsHost}`; - let conn; - if (localStorage.getItem(LOCAL_STORAGE_USER_PASS_BASED_AUTH) === 'true') { - const account_id = localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID); - const internal_ws_pass = localStorage.getItem(LOCAL_STORAGE_INTERNAL_WS_PASS); - conn = await connect({ - servers: [wsHost], - user: '$memphis_user$' + account_id, - pass: internal_ws_pass, - timeout: '5000' - }); - } else { - const connection_token = localStorage.getItem(LOCAL_STORAGE_CONNECTION_TOKEN); - conn = await connect({ - servers: [wsHost], - token: '::' + connection_token, - timeout: '5000' - }); - } - dispatch({ type: 'SET_SOCKET_DETAILS', payload: conn }); - } catch (error) { - throw new Error(error); - } - } - history.push('/overview'); - setCloudLogedIn(true); - } catch (error) { - setCloudLogedIn(true); - console.log(error); - } - }; - useEffect(() => { - if (isCloud() && firebase_id_token) { - const fetchData = async () => { - await handleLoginWithToken(); - }; - fetchData(); - } else setCloudLogedIn(true); + setCloudLogedIn(true); }, []); useEffect(() => { @@ -161,8 +106,6 @@ const App = withRouter(() => { } else if (localStorage.getItem(LOCAL_STORAGE_TOKEN)) { const handleRefreshData = await handleRefreshTokenRequest(); dispatch({ type: 'SET_USER_DATA', payload: handleRefreshData }); - isCloud() && stigg.setCustomerId(handleRefreshData.account_name); - isCloud() && localStorage.setItem(LOCAL_STORAGE_PLAN, handleRefreshData.plan); if (handleRefreshData !== '') { if (firstTime) { try { @@ -193,9 +136,7 @@ const App = withRouter(() => { } return true; } - } else { - isCloud() ? window.location.replace(CLOUD_URL) : history.push(pathDomains.signup); - } + } else history.push(pathDomains.signup); }, []); const handleUpdatePlan = async () => { @@ -204,7 +145,6 @@ const App = withRouter(() => { dispatch({ type: 'SET_ENTITLEMENTS', payload: data?.entitelments }); dispatch({ type: 'SET_PLAN_TYPE', payload: data.plan === planType.FREE }); setRefreshPlan(false); - await getAllowedActions(); showMessages('success', 'Your plan has been successfully updated.'); } catch (error) { setRefreshPlan(false); @@ -382,335 +322,157 @@ const App = withRouter(() => { {systemMessage?.length > 0 && displaySystemMessage()}
{' '} - {!authCheck && - cloudLogedIn && - !refreshPlan && - (!isCloud() ? ( - - - - - -
- } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - }>} /> - }>} /> - }>} - /> - }>} - /> - - - - } - > - } - /> - - - - - ) : ( - - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - {/* - - - } - > - } - /> */} - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - - - - } - > - } - /> - }>} /> - }>} /> - }>} - /> - }>} /> - }>} /> - }>} - /> + {!authCheck && cloudLogedIn && !refreshPlan && ( + + + + + + + } + > + } + /> + + + + } + > + } + /> + + + + } + > + } + /> + + + + } + > + } + /> + + + + } + > + } + /> + + + + } + > + } + /> + + + + } + > + } + /> - - - - } - > - } - /> - - - - - ))} + + + + } + > + } + /> + + + + } + > + } + /> + }>} /> + }>} /> + }>} + /> + }>} + /> + + + + } + > + } + /> + + + + + )} ); diff --git a/ui_src/src/PrivateRoute.js b/ui_src/src/PrivateRoute.js index 25a6bd9b7..0a47e8e30 100644 --- a/ui_src/src/PrivateRoute.js +++ b/ui_src/src/PrivateRoute.js @@ -14,22 +14,13 @@ import React from 'react'; import { Route, Redirect } from 'react-router-dom'; import AuthService from 'services/auth'; -import { isCloud } from 'services/valueConvertor'; -import { CLOUD_URL } from 'config'; import pathDomains from 'router'; function PrivateRoute(props) { const { component: Component, ...rest } = props; if (AuthService.isValidToken()) { return Component} />; - } else { - if (isCloud()) { - AuthService.clearLocalStorage(); - window.location.replace(CLOUD_URL); - } else { - return ; - } - } + } else return ; } export default PrivateRoute; diff --git a/ui_src/src/components/Tabs/index.js b/ui_src/src/components/Tabs/index.js index 13c63c5e0..0adee9ccb 100644 --- a/ui_src/src/components/Tabs/index.js +++ b/ui_src/src/components/Tabs/index.js @@ -22,7 +22,6 @@ import React from 'react'; import TooltipComponent from 'components/tooltip/tooltip'; import CheckboxComponent from 'components/checkBox'; import { PriorityHighRounded } from '@material-ui/icons'; -import CloudOnly from 'components/cloudOnly'; const CustomTabs = ({ tabs, onChange, value, disabled, length, tooltip, icon = false, checkbox = false, defaultActiveKey, tabsCounter, icons }) => { return ( @@ -39,10 +38,7 @@ const CustomTabs = ({ tabs, onChange, value, disabled, length, tooltip, icon = f {icons && icons[index] && !icon && icons[index]} {checkbox && } - <> - {`${tab?.name || tab} ${tabsCounter ? `(${tabsCounter[index]})` : ''} `} - {tab?.cloudOnly && } - + <>{`${tab?.name || tab} ${tabsCounter ? `(${tabsCounter[index]})` : ''} `} {length && length[index] && icon && (
diff --git a/ui_src/src/components/cloudModal/index.js b/ui_src/src/components/cloudModal/index.js deleted file mode 100644 index ab7c09a20..000000000 --- a/ui_src/src/components/cloudModal/index.js +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2022-2023 The Memphis.dev Authors -// Licensed under the Memphis Business Source License 1.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// Changed License: [Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0), as published by the Apache Foundation. -// -// https://github.com/memphisdev/memphis/blob/master/LICENSE -// -// Additional Use Grant: You may make use of the Licensed Work (i) only as part of your own product or service, provided it is not a message broker or a message queue product or service; and (ii) provided that you do not use, provide, distribute, or make available the Licensed Work as a Service. -// A "Service" is a commercial offering, product, hosted, or managed service, that allows third parties (other than your own employees and contractors acting on your behalf) to access and/or use the Licensed Work or a substantial set of the features or functionality of the Licensed Work to third parties as a software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other similar services that compete with Licensor products or services. - -import './style.scss'; - -import React from 'react'; -import { ReactComponent as FunctionIntegrateIcon } from 'assets/images/functionIntegrate.svg'; -import BundleBanner from 'assets/images/banners/bundle1.webp'; -import CloudBanner from 'assets/images/banners/cloud2.webp'; -import FunctionsBanner from 'assets/images/banners/function3.webp'; -import UpgradeBanner from 'assets/images/banners/upgrade4.webp'; -import UpgradePlans from 'components/upgradePlans'; -import Modal from 'components/modal'; -import Button from 'components/button'; -import { sendTrace } from 'services/genericServices'; - -const CloudModal = ({ type, open, handleClose }) => { - const content = { - bundle: { - title: , - subtitle: ( - <> - Get Your Open-Source Today! - - ), - banner: BundleBanner, - leftBtn: 'Learn More', - leftBtnLink: 'https://memphis.dev/open-source-support-bundle/', - rightBtn: 'Book a Call', - rightBtnLink: 'https://meetings.hubspot.com/yaniv-benhemo' - }, - cloud: { - title: , - subtitle: 'Embrace serverless, enjoy peace of mind, and experience enhanced resilience.', - banner: CloudBanner, - leftBtn: 'Learn More', - leftBtnLink: 'https://memphis.dev/memphis-dev-cloud/', - rightBtn: 'Create a free account', - rightBtnLink: 'https://cloud.memphis.dev/' - }, - upgrade: { - title: ( - <> - - - - ), - subtitle: 'To Unlock More Features And Enhance Your Experience!', - banner: UpgradeBanner, - leftBtn: 'Chat With Your Account Manager', - leftBtnLink: 'https://meetings.hubspot.com/yaniv-benhemo/upgrade-call', - rightBtn: 'Upgrade Now', - rightBtnLink: '' - }, - functions: { - title: ( - <> - - - - ), - subtitle: 'Discover A Faster And Smarter Way To Do Event-driven And Stream Processing', - banner: FunctionsBanner, - leftBtn: 'Learn More', - leftBtnLink: 'https://functions.memphis.dev/', - rightBtn: 'Book a demo', - rightBtnLink: 'https://meetings.hubspot.com/yaniv-benhemo/demo-for-memphis-functions' - } - }; - - return ( - - -
- -
- {content[type]?.title} - -
- } - displayButtons={false} - width="560px" - height="390px" - clickOutside={handleClose} - open={open} - className="cloud-modal" - > -
- banner -
- -