@@ -19,42 +19,57 @@ qx.Class.define("osparc.wrapper.BookACallIframe", {
1919 extend : qx . ui . embed . Iframe ,
2020
2121 construct : function ( ) {
22- // Build base URL
23- let url = osparc . wrapper . BookACallIframe . SERVICE_URL ;
24-
25- const params = [ ] ;
26- const myAuthData = osparc . auth . Data . getInstance ( ) ;
27- const firstName = myAuthData . getFirstName ( ) ;
28- if ( firstName ) {
29- params . push ( "first_name=" + encodeURIComponent ( firstName ) ) ;
30- }
31- const lastName = myAuthData . getLastName ( ) ;
32- if ( lastName ) {
33- params . push ( "last_name=" + encodeURIComponent ( lastName ) ) ;
34- }
35- const email = myAuthData . getEmail ( ) ;
36- if ( email ) {
37- params . push ( "email=" + encodeURIComponent ( email ) ) ;
38- }
39-
40- if ( params . length > 0 ) {
41- url += "?" + params . join ( "&" ) ;
42- }
43-
44- // Call parent constructor
45- this . base ( arguments , url ) ;
22+ this . base ( arguments ) ;
4623
4724 this . setAppearance ( "iframe-no-border" ) ;
4825
26+ this . initDevServiceUrl ( ) ;
27+
4928 // not only once, every time there is a load (e.g. when navigating in the iframe)
5029 this . addListener ( "load" , ( ) => this . __updateStyles ( ) , this ) ;
5130 } ,
5231
32+ properties : {
33+ serviceUrl : {
34+ check : "String" ,
35+ nullable : true ,
36+ init : null ,
37+ apply : "__applyServiceUrl"
38+ }
39+ } ,
40+
5341 statics : {
54- SERVICE_URL : "http://localhost:8000/booking " ,
42+ DEV_SERVICE_URL : "http://10.43.103.145/index.php " ,
5543 } ,
5644
5745 members : {
46+ initDevServiceUrl : function ( ) {
47+ this . setServiceUrl ( this . self ( ) . DEV_SERVICE_URL ) ;
48+ } ,
49+
50+ __applyServiceUrl : function ( url ) {
51+ const params = [ ] ;
52+ const myAuthData = osparc . auth . Data . getInstance ( ) ;
53+ const firstName = myAuthData . getFirstName ( ) ;
54+ if ( firstName ) {
55+ params . push ( "first_name=" + encodeURIComponent ( firstName ) ) ;
56+ }
57+ const lastName = myAuthData . getLastName ( ) ;
58+ if ( lastName ) {
59+ params . push ( "last_name=" + encodeURIComponent ( lastName ) ) ;
60+ }
61+ const email = myAuthData . getEmail ( ) ;
62+ if ( email ) {
63+ params . push ( "email=" + encodeURIComponent ( email ) ) ;
64+ }
65+
66+ if ( params . length > 0 ) {
67+ url += "?" + params . join ( "&" ) ;
68+ }
69+
70+ this . setSource ( url ) ;
71+ } ,
72+
5873 __updateStyles : function ( ) {
5974 const colorManager = qx . theme . manager . Color . getInstance ( ) ;
6075 const iframe = this . getContentElement ( ) . getDomElement ( ) ;
@@ -63,7 +78,7 @@ qx.Class.define("osparc.wrapper.BookACallIframe", {
6378 '--osparc-text-color' : colorManager . resolve ( "text" ) ,
6479 '--osparc-primary' : colorManager . resolve ( "product-color" ) ,
6580 } ;
66- const url = new URL ( this . self ( ) . SERVICE_URL ) ;
81+ const url = new URL ( this . getServiceUrl ( ) ) ;
6782 iframe . contentWindow . postMessage ( {
6883 type : 'osparc-theme' ,
6984 theme
0 commit comments