diff --git a/services/static-webserver/client/source/class/osparc/support/SupportCenter.js b/services/static-webserver/client/source/class/osparc/support/SupportCenter.js index b56bcd5e55b2..c13997267df9 100644 --- a/services/static-webserver/client/source/class/osparc/support/SupportCenter.js +++ b/services/static-webserver/client/source/class/osparc/support/SupportCenter.js @@ -47,7 +47,7 @@ qx.Class.define("osparc.support.SupportCenter", { this.getChildControl("conversations-button"); } - this.__showHome(); + this.__selectHomeStackPage(); }, statics: { @@ -100,7 +100,9 @@ qx.Class.define("osparc.support.SupportCenter", { case "buttons-layout": control = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({ alignX: "center", - })); + })).set({ + visibility: osparc.store.Groups.getInstance().isSupportEnabled() ? "visible" : "excluded", + }); this.add(control); break; case "home-button": @@ -112,7 +114,7 @@ qx.Class.define("osparc.support.SupportCenter", { allowGrowX: true, center: true, }); - control.addListener("execute", () => this.__showHome(), this); + control.addListener("execute", () => this.__selectHomeStackPage(), this); this.getChildControl("buttons-layout").add(control, { flex: 1 }); break; case "conversations-button": @@ -151,37 +153,35 @@ qx.Class.define("osparc.support.SupportCenter", { return control || this.base(arguments, id); }, - __showHome: function() { + __selectHomeStackPage: function() { this.setCaption(this.tr("Help & Support")); this.getChildControl("main-stack").setSelection([this.getChildControl("home-page")]); - this.getChildControl("home-button").set({ + this.getChildControl("home-button").getChildControl("icon").set({ textColor: "strong-main", }); - this.getChildControl("conversations-button").set({ + this.getChildControl("conversations-button").getChildControl("icon").set({ textColor: "text", }); }, - showConversations: function() { + __selectConversationsStackPage: function() { this.setCaption(this.tr("Conversations")); this.getChildControl("main-stack").setSelection([this.getChildControl("conversations-stack")]); - this.getChildControl("home-button").set({ + this.getChildControl("home-button").getChildControl("icon").set({ textColor: "text", }); - this.getChildControl("conversations-button").set({ + this.getChildControl("conversations-button").getChildControl("icon").set({ textColor: "strong-main", }); + }, + + showConversations: function() { + this.__selectConversationsStackPage(); this.getChildControl("conversations-stack").setSelection([this.getChildControl("conversations-page")]); }, __showConversation: function() { - this.getChildControl("main-stack").setSelection([this.getChildControl("conversations-stack")]); - this.getChildControl("home-button").set({ - textColor: "text", - }); - this.getChildControl("conversations-button").set({ - textColor: "strong-main", - }); + this.__selectConversationsStackPage(); this.getChildControl("conversations-stack").setSelection([this.getChildControl("conversation-page")]); }, diff --git a/services/static-webserver/client/source/class/osparc/wrapper/BookACallIframe.js b/services/static-webserver/client/source/class/osparc/wrapper/BookACallIframe.js index fc9fa7511525..5f674a3e0304 100644 --- a/services/static-webserver/client/source/class/osparc/wrapper/BookACallIframe.js +++ b/services/static-webserver/client/source/class/osparc/wrapper/BookACallIframe.js @@ -19,42 +19,57 @@ qx.Class.define("osparc.wrapper.BookACallIframe", { extend: qx.ui.embed.Iframe, construct: function() { - // Build base URL - let url = osparc.wrapper.BookACallIframe.SERVICE_URL; - - const params = []; - const myAuthData = osparc.auth.Data.getInstance(); - const firstName = myAuthData.getFirstName(); - if (firstName) { - params.push("first_name=" + encodeURIComponent(firstName)); - } - const lastName = myAuthData.getLastName(); - if (lastName) { - params.push("last_name=" + encodeURIComponent(lastName)); - } - const email = myAuthData.getEmail(); - if (email) { - params.push("email=" + encodeURIComponent(email)); - } - - if (params.length > 0) { - url += "?" + params.join("&"); - } - - // Call parent constructor - this.base(arguments, url); + this.base(arguments); this.setAppearance("iframe-no-border"); + this.initDevServiceUrl(); + // not only once, every time there is a load (e.g. when navigating in the iframe) this.addListener("load", () => this.__updateStyles(), this); }, + properties: { + serviceUrl: { + check: "String", + nullable: true, + init: null, + apply: "__applyServiceUrl" + } + }, + statics: { - SERVICE_URL: "http://localhost:8000/booking", + DEV_SERVICE_URL: "http://10.43.103.145/index.php", }, members: { + initDevServiceUrl: function() { + this.setServiceUrl(this.self().DEV_SERVICE_URL); + }, + + __applyServiceUrl: function(url) { + const params = []; + const myAuthData = osparc.auth.Data.getInstance(); + const firstName = myAuthData.getFirstName(); + if (firstName) { + params.push("first_name=" + encodeURIComponent(firstName)); + } + const lastName = myAuthData.getLastName(); + if (lastName) { + params.push("last_name=" + encodeURIComponent(lastName)); + } + const email = myAuthData.getEmail(); + if (email) { + params.push("email=" + encodeURIComponent(email)); + } + + if (params.length > 0) { + url += "?" + params.join("&"); + } + + this.setSource(url); + }, + __updateStyles: function() { const colorManager = qx.theme.manager.Color.getInstance(); const iframe = this.getContentElement().getDomElement(); @@ -63,7 +78,7 @@ qx.Class.define("osparc.wrapper.BookACallIframe", { '--osparc-text-color': colorManager.resolve("text"), '--osparc-primary': colorManager.resolve("product-color"), }; - const url = new URL(this.self().SERVICE_URL); + const url = new URL(this.getServiceUrl()); iframe.contentWindow.postMessage({ type: 'osparc-theme', theme