mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Rename Element Pro -> Host Signup
This commit is contained in:
parent
6286c23aa5
commit
bb53ae8038
6 changed files with 33 additions and 33 deletions
|
@ -69,9 +69,9 @@
|
||||||
@import "./views/dialogs/_DeactivateAccountDialog.scss";
|
@import "./views/dialogs/_DeactivateAccountDialog.scss";
|
||||||
@import "./views/dialogs/_DevtoolsDialog.scss";
|
@import "./views/dialogs/_DevtoolsDialog.scss";
|
||||||
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
|
@import "./views/dialogs/_EditCommunityPrototypeDialog.scss";
|
||||||
@import "./views/dialogs/_ElementProDialog.scss";
|
|
||||||
@import "./views/dialogs/_FeedbackDialog.scss";
|
@import "./views/dialogs/_FeedbackDialog.scss";
|
||||||
@import "./views/dialogs/_GroupAddressPicker.scss";
|
@import "./views/dialogs/_GroupAddressPicker.scss";
|
||||||
|
@import "./views/dialogs/_HostSignupDialog.scss";
|
||||||
@import "./views/dialogs/_IncomingSasDialog.scss";
|
@import "./views/dialogs/_IncomingSasDialog.scss";
|
||||||
@import "./views/dialogs/_InviteDialog.scss";
|
@import "./views/dialogs/_InviteDialog.scss";
|
||||||
@import "./views/dialogs/_KeyboardShortcutsDialog.scss";
|
@import "./views/dialogs/_KeyboardShortcutsDialog.scss";
|
||||||
|
|
|
@ -14,16 +14,16 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.mx_ElementProDialog .mx_Dialog {
|
.mx_HostSignupDialog .mx_Dialog {
|
||||||
height: 66%;
|
height: 66%;
|
||||||
min-width: 50%;
|
min-width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ElementProBaseDialog {
|
.mx_HostSignupBaseDialog {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ElementProDialog_container {
|
.mx_HostSignupDialog_container {
|
||||||
height: 90%;
|
height: 90%;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import ElementProDialog from "../views/dialogs/ElementProDialog";
|
import HostSignupDialog from "../views/dialogs/HostSignupDialog";
|
||||||
import Modal, {IHandle} from "../../Modal";
|
import Modal, {IHandle} from "../../Modal";
|
||||||
import {
|
import {
|
||||||
IconizedContextMenuOption,
|
IconizedContextMenuOption,
|
||||||
|
@ -27,15 +27,15 @@ interface IProps {}
|
||||||
|
|
||||||
interface IState {}
|
interface IState {}
|
||||||
|
|
||||||
export default class ElementProAction extends React.PureComponent<IProps, IState> {
|
export default class HostSignupAction extends React.PureComponent<IProps, IState> {
|
||||||
private closingAllowed = false;
|
private closingAllowed = false;
|
||||||
private modalRef: IHandle<void[]>;
|
private modalRef: IHandle<void[]>;
|
||||||
|
|
||||||
private openDialog = () => {
|
private openDialog = () => {
|
||||||
this.modalRef = Modal.createTrackedDialog(
|
this.modalRef = Modal.createTrackedDialog(
|
||||||
'Element Pro Open', '', ElementProDialog, {
|
'Host Signup Open', '', HostSignupDialog, {
|
||||||
requestClose: this.requestClose,
|
requestClose: this.requestClose,
|
||||||
}, "mx_ElementProDialog", false, true, {
|
}, "mx_HostSignupDialog", false, true, {
|
||||||
onBeforeClose: async () => this.closingAllowed,
|
onBeforeClose: async () => this.closingAllowed,
|
||||||
},
|
},
|
||||||
);
|
);
|
|
@ -51,7 +51,7 @@ import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
|
||||||
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
||||||
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
||||||
import {UIFeature} from "../../settings/UIFeature";
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
import ElementProAction from "./ElementProAction";
|
import HostSignupAction from "./HostSignupAction";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isMinimized: boolean;
|
isMinimized: boolean;
|
||||||
|
@ -274,7 +274,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
let topSection;
|
let topSection;
|
||||||
const signupLink = getHostingLink("user-context-menu");
|
const signupLink = getHostingLink("user-context-menu");
|
||||||
const elementProConfig = SdkConfig.get().element_pro;
|
const hostSignupConfig = SdkConfig.get().host_signup;
|
||||||
if (MatrixClientPeg.get().isGuest()) {
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
topSection = (
|
topSection = (
|
||||||
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
|
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
|
||||||
|
@ -294,20 +294,20 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
} else if (signupLink || elementProConfig) {
|
} else if (signupLink || hostSignupConfig) {
|
||||||
let elementProIFrame;
|
let hostSignupAction;
|
||||||
if (elementProConfig && elementProConfig.url) {
|
if (hostSignupConfig && hostSignupConfig.url) {
|
||||||
// If element_pro.domains is set to a non-empty array, only show
|
// If host_signup.domains is set to a non-empty array, only show
|
||||||
// dialog if the user is on the domain or a subdomain.
|
// dialog if the user is on the domain or a subdomain.
|
||||||
const elementProDomains = elementProConfig.domains || [];
|
const hostSignupDomains = hostSignupConfig.domains || [];
|
||||||
const mxDomain = MatrixClientPeg.get().getDomain();
|
const mxDomain = MatrixClientPeg.get().getDomain();
|
||||||
const validDomains = elementProDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
|
const validDomains = hostSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
|
||||||
if (!elementProDomains || validDomains.length > 0) {
|
if (!hostSignupDomains || validDomains.length > 0) {
|
||||||
elementProIFrame = <div
|
hostSignupAction = <div
|
||||||
className=""
|
className=""
|
||||||
onClick={this.onCloseMenu}
|
onClick={this.onCloseMenu}
|
||||||
>
|
>
|
||||||
<ElementProAction />
|
<HostSignupAction />
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{elementProIFrame}
|
{hostSignupAction}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import SdkConfig from "../../../SdkConfig";
|
||||||
import {_t} from "../../../languageHandler";
|
import {_t} from "../../../languageHandler";
|
||||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||||
import {IPostmessage, IPostmessageResponseData, PostmessageAction} from "./ElementProDialogTypes";
|
import {IPostmessage, IPostmessageResponseData, PostmessageAction} from "./HostSignupDialogTypes";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
requestClose(): void;
|
requestClose(): void;
|
||||||
|
@ -34,9 +34,9 @@ interface IState {
|
||||||
error: string;
|
error: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ElementProDialog extends React.PureComponent<IProps, IState> {
|
export default class HostSignupDialog extends React.PureComponent<IProps, IState> {
|
||||||
private iframeRef: React.RefObject<HTMLIFrameElement> = React.createRef();
|
private iframeRef: React.RefObject<HTMLIFrameElement> = React.createRef();
|
||||||
private readonly elementProSetupUrl: string;
|
private readonly hostSignupSetupUrl: string;
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -46,15 +46,15 @@ export default class ElementProDialog extends React.PureComponent<IProps, IState
|
||||||
error: null,
|
error: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.elementProSetupUrl = SdkConfig.get().element_pro.url;
|
this.hostSignupSetupUrl = SdkConfig.get().host_signup.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private messageHandler = (message: IPostmessage) => {
|
private messageHandler = (message: IPostmessage) => {
|
||||||
if (!this.elementProSetupUrl.startsWith(message.origin)) {
|
if (!this.hostSignupSetupUrl.startsWith(message.origin)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (message.data.action) {
|
switch (message.data.action) {
|
||||||
case PostmessageAction.ElementProAccountDetailsRequest:
|
case PostmessageAction.HostSignupAccountDetailsRequest:
|
||||||
Modal.createDialog(
|
Modal.createDialog(
|
||||||
ElementProDataConfirmDialog,
|
ElementProDataConfirmDialog,
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ export default class ElementProDialog extends React.PureComponent<IProps, IState
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendMessage = (message: IPostmessageResponseData) => {
|
private sendMessage = (message: IPostmessageResponseData) => {
|
||||||
this.iframeRef.current.contentWindow.postMessage(message, this.elementProSetupUrl);
|
this.iframeRef.current.contentWindow.postMessage(message, this.hostSignupSetupUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async sendAccountDetails() {
|
private async sendAccountDetails() {
|
||||||
|
@ -111,7 +111,7 @@ export default class ElementProDialog extends React.PureComponent<IProps, IState
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.sendMessage({
|
this.sendMessage({
|
||||||
action: PostmessageAction.ElementProAccountDetails,
|
action: PostmessageAction.HostSignupAccountDetails,
|
||||||
account: {
|
account: {
|
||||||
accessToken: await MatrixClientPeg.get().getAccessToken(),
|
accessToken: await MatrixClientPeg.get().getAccessToken(),
|
||||||
name: OwnProfileStore.instance.displayName,
|
name: OwnProfileStore.instance.displayName,
|
||||||
|
@ -133,15 +133,15 @@ export default class ElementProDialog extends React.PureComponent<IProps, IState
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
className="mx_ElementProBaseDialog"
|
className="mx_HostSignupBaseDialog"
|
||||||
onFinished={this.onFinished}
|
onFinished={this.onFinished}
|
||||||
title={_t("Set up your own personal Element host")}
|
title={_t("Set up your own personal Element host")}
|
||||||
hasCancel={true}
|
hasCancel={true}
|
||||||
fixedWidth={false}
|
fixedWidth={false}
|
||||||
>
|
>
|
||||||
<div className="mx_ElementProDialog_container">
|
<div className="mx_HostSignupDialog_container">
|
||||||
<iframe
|
<iframe
|
||||||
src={this.elementProSetupUrl}
|
src={this.hostSignupSetupUrl}
|
||||||
ref={this.iframeRef}
|
ref={this.iframeRef}
|
||||||
sandbox="allow-forms allow-scripts allow-same-origin"
|
sandbox="allow-forms allow-scripts allow-same-origin"
|
||||||
/>
|
/>
|
|
@ -1,7 +1,7 @@
|
||||||
export enum PostmessageAction {
|
export enum PostmessageAction {
|
||||||
CloseDialog = "close_dialog",
|
CloseDialog = "close_dialog",
|
||||||
ElementProAccountDetails = "element_pro_account_details",
|
HostSignupAccountDetails = "host_signup_account_details",
|
||||||
ElementProAccountDetailsRequest = "element_pro_account_details_request",
|
HostSignupAccountDetailsRequest = "host_signup_account_details_request",
|
||||||
SetupComplete = "setup_complete",
|
SetupComplete = "setup_complete",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue