From 013b675806212b18a428bad860c7d25082d5319d Mon Sep 17 00:00:00 2001 From: Tiago Evangelista Pinto Date: Thu, 28 Sep 2023 07:09:26 -0300 Subject: [PATCH] init --- .../setupWizard/steps/RegisterServerStep.tsx | 43 ++++++------------- .../rocketchat-i18n/i18n/en.i18n.json | 10 ++--- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/apps/meteor/client/views/setupWizard/steps/RegisterServerStep.tsx b/apps/meteor/client/views/setupWizard/steps/RegisterServerStep.tsx index 6bc2e25259b6..a5596380212d 100644 --- a/apps/meteor/client/views/setupWizard/steps/RegisterServerStep.tsx +++ b/apps/meteor/client/views/setupWizard/steps/RegisterServerStep.tsx @@ -1,5 +1,4 @@ -import { RegisterServerPage, StandaloneServerPage } from '@rocket.chat/onboarding-ui'; -import { useRoute } from '@rocket.chat/ui-contexts'; +import { RegisterServerPage, RegisterOfflinePage } from '@rocket.chat/onboarding-ui'; import type { ReactElement, ComponentProps } from 'react'; import React, { useState } from 'react'; @@ -7,51 +6,37 @@ import { useSetupWizardContext } from '../contexts/SetupWizardContext'; const SERVER_OPTIONS = { REGISTERED: 'REGISTERED', - STANDALONE: 'STANDALONE', + OFFLINE: 'OFFLINE', }; const RegisterServerStep = (): ReactElement => { - const { goToPreviousStep, currentStep, setSetupWizardData, registerServer, maxSteps, offline, completeSetupWizard } = + const { goToPreviousStep, currentStep, goToNextStep, goToStep, setSetupWizardData, registerServer, maxSteps, offline } = useSetupWizardContext(); const [serverOption, setServerOption] = useState(SERVER_OPTIONS.REGISTERED); - const router = useRoute('cloud'); - - const handleRegisterOffline: ComponentProps['onSubmit'] = async () => { - await completeSetupWizard(); - router.push({}, { register: 'true' }); - }; - - const handleRegister: ComponentProps['onSubmit'] = async (data) => { - if (data.registerType !== 'standalone') { - setSetupWizardData((prevState) => ({ ...prevState, serverData: data })); - await registerServer(data); - } + const handleRegister: ComponentProps['onSubmit'] = async (data: { email: string; resend?: boolean }) => { + goToNextStep(); + setSetupWizardData((prevState) => ({ ...prevState, serverData: data })); + await registerServer(data); }; - const handleConfirmStandalone: ComponentProps['onSubmit'] = async ({ registerType }) => { - if (registerType !== 'registered') { - return completeSetupWizard(); - } + const handleConfirmOffline: ComponentProps['onSubmit'] = async (/* data: unknown*/) => { + // TODO: CALL REGISTER WITH TOKEN + return goToStep(4); }; - if (serverOption === SERVER_OPTIONS.STANDALONE) { + if (serverOption === SERVER_OPTIONS.OFFLINE) { return ( - setServerOption(SERVER_OPTIONS.REGISTERED)} - onSubmit={handleConfirmStandalone} - stepCount={maxSteps} - /> + setServerOption(SERVER_OPTIONS.REGISTERED)} onSubmit={handleConfirmOffline} /> ); } return ( setServerOption(SERVER_OPTIONS.STANDALONE)} + onClickRegisterOffline={(): void => setServerOption(SERVER_OPTIONS.OFFLINE)} onBackButtonClick={goToPreviousStep} stepCount={maxSteps} - onSubmit={offline ? handleRegisterOffline : handleRegister} + onSubmit={handleRegister} currentStep={currentStep} offline={offline} /> diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index 0df90c85bd8e..2fba84161d6b 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -5855,7 +5855,8 @@ "onboarding.component.form.action.next": "Next", "onboarding.component.form.action.skip": "Skip this step", "onboarding.component.form.action.register": "Register", - "onboarding.component.form.action.registerNow": "Register now", + "onboarding.component.form.action.registerWorkspace": "Register workspace", + "onboarding.component.form.action.registerOffline": "Register offline", "onboarding.component.form.action.confirm": "Confirm", "onboarding.component.form.termsAndConditions": "I agree with <1>Terms and Conditions and <3>Privacy Policy", "onboarding.component.emailCodeFallback": "Didn’t receive email? <1>Resend or <3>Change email", @@ -5909,6 +5910,9 @@ "onboarding.form.organizationInfoForm.fields.organizationSize.placeholder": "Select", "onboarding.form.organizationInfoForm.fields.country.label": "Country", "onboarding.form.organizationInfoForm.fields.country.placeholder": "Select", + "onboarding.form.registerOfflineForm.title": "Register Offline", + "onboarding.form.registerOfflineForm.description": "If for any reason your workspace can’t be connected to the internet, follow these steps:<1>1. Go to: <2>cloud.rocket.chat > Workspaces and click “<3>Register self-managed”<4>2. Copy the token and paste it below", + "onboarding.form.registerOfflineForm.fields.registrationToken.inputLabel": "Registration token", "onboarding.form.registeredServerForm.title": "Register your workspace", "onboarding.form.registeredServerForm.included.push": "Mobile push notifications", "onboarding.form.registeredServerForm.included.externalProviders": "Integration with external providers (WhatsApp, Facebook, Telegram, Twitter)", @@ -5919,10 +5923,6 @@ "onboarding.form.registeredServerForm.registerLater": "Register later", "onboarding.form.registeredServerForm.notConnectedToInternet": "The server is not connected to the internet, so you’ll have to do an offline registration for this workspace.", "onboarding.form.registeredServerForm.registrationEngagement": "Registration allows automatic license updates, notifications of critical vulnerabilities and access to Rocket.Chat Cloud services. No sensitive workspace data is shared; statistics sent to Rocket.Chat is made visible to you within the administration area.", - "onboarding.form.standaloneServerForm.title": "Standalone Server Confirmation", - "onboarding.form.standaloneServerForm.servicesUnavailable": "Some of the services will be unavailable or will require manual setup", - "onboarding.form.standaloneServerForm.publishOwnApp": "In order to send push notitications you need to compile and publish your own app to Google Play and App Store", - "onboarding.form.standaloneServerForm.manuallyIntegrate": "Need to manually integrate with external services", "Something_Went_Wrong": "Something went wrong", "Toolbox_room_actions": "Primary Room actions", "Theme_light": "Light",