File indexing completed on 2024-05-12 06:01:03

0001 "use strict";
0002 
0003 window.appHelpers = function () {
0004   function getEnv(domain) {
0005     var env;
0006     var lastDotSplit = this.splitByLastDot(domain);
0007 
0008     if (lastDotSplit.indexOf('/') > -1) {
0009       lastDotSplit = lastDotSplit.split('/')[0];
0010     }
0011 
0012     if (lastDotSplit === 'com' || lastDotSplit === 'org') {
0013       env = 'live';
0014     } else {
0015       env = 'test';
0016     }
0017 
0018     return env;
0019   }
0020 
0021   function splitByLastDot(text) {
0022     var index = text.lastIndexOf('.');
0023     return text.slice(index + 1);
0024   }
0025 
0026   return {
0027     getEnv: getEnv,
0028     splitByLastDot: splitByLastDot
0029   };
0030 }();
0031 "use strict";
0032 
0033 window.appHelpers = function () {
0034   function getEnv(domain) {
0035     var env;
0036     var lastDotSplit = this.splitByLastDot(domain);
0037 
0038     if (lastDotSplit.indexOf('/') > -1) {
0039       lastDotSplit = lastDotSplit.split('/')[0];
0040     }
0041 
0042     if (lastDotSplit === 'com' || lastDotSplit === 'org') {
0043       env = 'live';
0044     } else {
0045       env = 'test';
0046     }
0047 
0048     return env;
0049   }
0050 
0051   function splitByLastDot(text) {
0052     var index = text.lastIndexOf('.');
0053     return text.slice(index + 1);
0054   }
0055 
0056   return {
0057     getEnv: getEnv,
0058     splitByLastDot: splitByLastDot
0059   };
0060 }();
0061 "use strict";
0062 
0063 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
0064 
0065 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
0066 
0067 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
0068 
0069 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
0070 
0071 function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
0072 
0073 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
0074 
0075 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
0076 
0077 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
0078 
0079 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
0080 
0081 var SiteHeader =
0082 /*#__PURE__*/
0083 function (_React$Component) {
0084   _inherits(SiteHeader, _React$Component);
0085 
0086   function SiteHeader(props) {
0087     var _this;
0088 
0089     _classCallCheck(this, SiteHeader);
0090 
0091     _this = _possibleConstructorReturn(this, _getPrototypeOf(SiteHeader).call(this, props));
0092     _this.state = {
0093       baseUrl: window.json_baseurl,
0094       searchBaseUrl: window.json_searchbaseurl,
0095       cat_title: window.json_cat_title,
0096       hasIdentity: window.json_hasIdentity,
0097       is_show_title: window.json_is_show_title,
0098       redirectString: window.json_redirectString,
0099       serverUrl: window.json_serverUrl,
0100       serverUri: window.json_serverUri,
0101       store: {
0102         sName: window.json_sname,
0103         name: window.json_store_name,
0104         order: window.json_store_order,
0105         last_char_store_order: window.json_last_char_store_order
0106       },
0107       user: window.json_member,
0108       logo: window.json_logoWidth,
0109       cat_title_left: window.json_cat_title_left,
0110       tabs_left: window.tabs_left,
0111       template: window.json_template,
0112       status: "",
0113       url_logout: window.json_logouturl
0114     };
0115     _this.updateDimensions = _this.updateDimensions.bind(_assertThisInitialized(_this));
0116     return _this;
0117   }
0118 
0119   _createClass(SiteHeader, [{
0120     key: "componentWillMount",
0121     value: function componentWillMount() {
0122       this.updateDimensions();
0123     }
0124   }, {
0125     key: "componentDidMount",
0126     value: function componentDidMount() {
0127       window.addEventListener("resize", this.updateDimensions);
0128       window.addEventListener("orientationchange", this.updateDimensions);
0129     }
0130   }, {
0131     key: "updateDimensions",
0132     value: function updateDimensions() {
0133       var width = window.innerWidth;
0134       var device;
0135 
0136       if (width >= 910) {
0137         device = "large";
0138       } else if (width < 910 && width >= 610) {
0139         device = "mid";
0140       } else if (width < 610) {
0141         device = "tablet";
0142       }
0143 
0144       this.setState({
0145         device: device
0146       });
0147     }
0148   }, {
0149     key: "render",
0150     value: function render() {
0151       var siteHeaderTopRightCssClass; // if (this.state.user){
0152       //   userMenuDisplay = (
0153       //     <SiteHeaderUserMenu
0154       //       serverUrl={this.state.serverUrl}
0155       //       baseUrl={this.state.baseUrl}
0156       //       user={this.state.user}
0157       //     />
0158       //   );
0159       //   siteHeaderTopRightCssClass = "w-user";
0160       // } else {
0161       //   loginMenuDisplay = (
0162       //     <div id="site-header-right-bottom">
0163       //     <SiteHeaderLoginMenu
0164       //       baseUrl={this.state.baseUrl}
0165       //       redirectString={this.state.redirectString}
0166       //       template={this.state.template}
0167       //     />
0168       //     </div>
0169       //   );
0170       // }
0171 
0172       var logoLink = this.state.serverUrl;
0173 
0174       if (this.state.serverUri.indexOf('/s/') > -1) {
0175         logoLink += "/s/" + this.state.store.name;
0176       }
0177 
0178       var siteHeaderStoreNameDisplay;
0179 
0180       if (this.state.is_show_title === "1") {
0181         siteHeaderStoreNameDisplay = React.createElement("div", {
0182           id: "site-header-store-name-container"
0183         }, React.createElement("a", {
0184           href: logoLink
0185         }, this.state.store.name));
0186       }
0187 
0188       var HeaderDisplay;
0189 
0190       if (this.state.device !== "tablet") {
0191         HeaderDisplay = React.createElement("section", {
0192           id: "site-header-wrapper",
0193           style: {
0194             "paddingLeft": this.state.template['header-logo']['width']
0195           }
0196         }, React.createElement("div", {
0197           id: "siter-header-left"
0198         }, React.createElement("div", {
0199           id: "site-header-logo-container",
0200           style: this.state.template['header-logo']
0201         }, React.createElement("a", {
0202           href: logoLink
0203         }, React.createElement("img", {
0204           src: this.state.template['header-logo']['image-src']
0205         }))), siteHeaderStoreNameDisplay), React.createElement("div", {
0206           id: "site-header-right"
0207         }, React.createElement("div", {
0208           id: "site-header-right-top",
0209           className: siteHeaderTopRightCssClass
0210         }, React.createElement(SiteHeaderSearchForm, {
0211           baseUrl: this.state.baseUrl,
0212           searchBaseUrl: this.state.searchBaseUrl,
0213           store: this.state.store,
0214           height: this.state.template.header['height']
0215         }))));
0216       } else {
0217         HeaderDisplay = React.createElement(MobileSiteHeader, {
0218           logoLink: logoLink,
0219           template: this.state.template,
0220           user: this.state.user,
0221           baseUrl: this.state.baseUrl,
0222           searchBaseUrl: this.state.searchBaseUrl,
0223           serverUrl: this.state.serverUrl,
0224           store: this.state.store,
0225           redirectString: this.state.redirectString
0226         });
0227       }
0228 
0229       var templateHeaderStyle;
0230 
0231       if (this.state.template) {
0232         templateHeaderStyle = {
0233           "backgroundImage": this.state.template.header['background-image'],
0234           "backgroundColor": this.state.template.header['background-color'],
0235           "height": this.state.template.header['height']
0236         };
0237       }
0238 
0239       var headerStoreClassName = this.state.store.name.toLowerCase();
0240       if (headerStoreClassName.indexOf('.') > -1) headerStoreClassName = headerStoreClassName.split('.')[0];
0241       return React.createElement("section", {
0242         id: "site-header",
0243         style: templateHeaderStyle,
0244         className: headerStoreClassName
0245       }, HeaderDisplay);
0246     }
0247   }]);
0248 
0249   return SiteHeader;
0250 }(React.Component);
0251 
0252 var SiteHeaderSearchForm =
0253 /*#__PURE__*/
0254 function (_React$Component2) {
0255   _inherits(SiteHeaderSearchForm, _React$Component2);
0256 
0257   function SiteHeaderSearchForm(props) {
0258     var _this2;
0259 
0260     _classCallCheck(this, SiteHeaderSearchForm);
0261 
0262     _this2 = _possibleConstructorReturn(this, _getPrototypeOf(SiteHeaderSearchForm).call(this, props));
0263     _this2.state = {
0264       searchText: ''
0265     };
0266     _this2.onSearchTextChange = _this2.onSearchTextChange.bind(_assertThisInitialized(_this2));
0267     _this2.onSearchFormSubmit = _this2.onSearchFormSubmit.bind(_assertThisInitialized(_this2));
0268     return _this2;
0269   }
0270 
0271   _createClass(SiteHeaderSearchForm, [{
0272     key: "onSearchTextChange",
0273     value: function onSearchTextChange(e) {
0274       this.setState({
0275         searchText: e.target.value
0276       });
0277     }
0278   }, {
0279     key: "onSearchFormSubmit",
0280     value: function onSearchFormSubmit(e) {
0281       e.preventDefault();
0282       window.location.href = this.props.searchBaseUrl + this.state.searchText;
0283     }
0284   }, {
0285     key: "render",
0286     value: function render() {
0287       var siteHeaderSearchFormStyle;
0288 
0289       if (this.props.store.name.toLowerCase().indexOf("appimagehub") > -1) {
0290         var tHeight = parseInt(this.props.height.split('px')[0]);
0291         siteHeaderSearchFormStyle = {
0292           "marginTop": tHeight / 2 - 19 + "px"
0293         };
0294       }
0295 
0296       return React.createElement("div", {
0297         id: "site-header-search-form",
0298         style: siteHeaderSearchFormStyle
0299       }, React.createElement("form", {
0300         id: "search-form",
0301         onSubmit: this.onSearchFormSubmit
0302       }, React.createElement("input", {
0303         onChange: this.onSearchTextChange,
0304         value: this.state.searchText,
0305         type: "text",
0306         name: "projectSearchText"
0307       }), React.createElement("a", {
0308         onClick: this.onSearchFormSubmit
0309       })));
0310     }
0311   }]);
0312 
0313   return SiteHeaderSearchForm;
0314 }(React.Component);
0315 
0316 var SiteHeaderLoginMenu =
0317 /*#__PURE__*/
0318 function (_React$Component3) {
0319   _inherits(SiteHeaderLoginMenu, _React$Component3);
0320 
0321   function SiteHeaderLoginMenu(props) {
0322     var _this3;
0323 
0324     _classCallCheck(this, SiteHeaderLoginMenu);
0325 
0326     _this3 = _possibleConstructorReturn(this, _getPrototypeOf(SiteHeaderLoginMenu).call(this, props));
0327     _this3.state = {};
0328     return _this3;
0329   }
0330 
0331   _createClass(SiteHeaderLoginMenu, [{
0332     key: "render",
0333     value: function render() {
0334       var registerButtonCssClass, loginButtonCssClass;
0335 
0336       if (window.location.href.indexOf('/register') > -1) {
0337         registerButtonCssClass = "active";
0338       }
0339 
0340       if (window.location.href.indexOf('/login') > -1) {
0341         loginButtonCssClass = "active";
0342       }
0343 
0344       var menuItemCssClass = {
0345         "borderColor": this.props.template['header-nav-tabs']['border-color'],
0346         "backgroundColor": this.props.template['header-nav-tabs']['background-color'] //<li style={menuItemCssClass} className={registerButtonCssClass}><a href={this.props.baseUrl + "/register"}>Register</a></li>
0347 
0348       };
0349       return React.createElement("div", {
0350         id: "site-header-login-menu"
0351       }, React.createElement("ul", null, React.createElement("li", {
0352         style: menuItemCssClass,
0353         className: loginButtonCssClass
0354       }, React.createElement("a", {
0355         href: this.props.baseUrl + "/login" + this.props.redirectString
0356       }, "Sign in"))));
0357     }
0358   }]);
0359 
0360   return SiteHeaderLoginMenu;
0361 }(React.Component); // class SiteHeaderUserMenu extends React.Component {
0362 //   constructor(props){
0363 //      super(props);
0364 //      this.state = {};
0365 //     this.handleClick = this.handleClick.bind(this);
0366 //   }
0367 //
0368 //   componentWillMount() {
0369 //     document.addEventListener('mousedown',this.handleClick, false);
0370 //   }
0371 //
0372 //   componentWillUnmount() {
0373 //     document.removeEventListener('mousedown',this.handleClick, false);
0374 //   }
0375 //
0376 //   handleClick(e){
0377 //     let dropdownClass = "";
0378 //     if (this.node.contains(e.target)){
0379 //       if (this.state.dropdownClass === "open"){
0380 //         if (e.target.className === "profile-menu-toggle" ||
0381 //             e.target.className === "profile-menu-image" || 
0382 //             e.target.className === "profile-menu-username"){
0383 //           dropdownClass = "";
0384 //         } else {
0385 //           dropdownClass = "open";
0386 //         }
0387 //       } else {
0388 //         dropdownClass = "open";
0389 //       }
0390 //     }
0391 //     this.setState({dropdownClass:dropdownClass});
0392 //   }
0393 //
0394 //   render(){
0395 //
0396 //     return (
0397 //       <ul id="site-header-user-menu-container">
0398 //         <li ref={node => this.node = node} id="user-menu-toggle" className={this.state.dropdownClass}>
0399 //           <a className="profile-menu-toggle">
0400 //             <img className="profile-menu-image" src={window.json_member_avatar}/>
0401 //             <span className="profile-menu-username">{this.props.user.username}</span>
0402 //           </a>
0403 //           <ul id="user-profile-menu" >
0404 //             <div className="dropdown-header"></div>
0405 //             <li><a href={window.json_baseurl + "product/add"}>Add Product</a></li>
0406 //             <li><a href={window.json_baseurl + "u/" + this.props.user.username + "/products"}>Products</a></li>
0407 //             <li><a href={window.json_baseurl + "u/" + this.props.user.username + "/payout"}>Payout</a></li>
0408 //             <li><a href={window.json_baseurl + "settings"}>Settings</a></li>
0409 //             <li><a href={window.json_logouturl}>Logout</a></li>
0410 //           </ul>
0411 //         </li>
0412 //       </ul>
0413 //     )
0414 //   }
0415 // }
0416 
0417 
0418 var MobileSiteHeader =
0419 /*#__PURE__*/
0420 function (_React$Component4) {
0421   _inherits(MobileSiteHeader, _React$Component4);
0422 
0423   function MobileSiteHeader(props) {
0424     var _this4;
0425 
0426     _classCallCheck(this, MobileSiteHeader);
0427 
0428     _this4 = _possibleConstructorReturn(this, _getPrototypeOf(MobileSiteHeader).call(this, props));
0429     _this4.state = {
0430       status: "switch"
0431     };
0432     _this4.showMobileUserMenu = _this4.showMobileUserMenu.bind(_assertThisInitialized(_this4));
0433     _this4.showMobileSearchForm = _this4.showMobileSearchForm.bind(_assertThisInitialized(_this4));
0434     _this4.showMobileSwitchMenu = _this4.showMobileSwitchMenu.bind(_assertThisInitialized(_this4));
0435     return _this4;
0436   }
0437 
0438   _createClass(MobileSiteHeader, [{
0439     key: "showMobileUserMenu",
0440     value: function showMobileUserMenu() {
0441       this.setState({
0442         status: "user"
0443       });
0444     }
0445   }, {
0446     key: "showMobileSearchForm",
0447     value: function showMobileSearchForm() {
0448       this.setState({
0449         status: "search"
0450       });
0451     }
0452   }, {
0453     key: "showMobileSwitchMenu",
0454     value: function showMobileSwitchMenu() {
0455       this.setState({
0456         status: "switch"
0457       });
0458     }
0459   }, {
0460     key: "render",
0461     value: function render() {
0462       var menuItemCssClass = {
0463         "borderColor": this.props.template['header-nav-tabs']['border-color'],
0464         "backgroundColor": this.props.template['header-nav-tabs']['background-color']
0465       };
0466       var closeMenuElementDisplay = React.createElement("a", {
0467         className: "menu-item",
0468         onClick: this.showMobileSwitchMenu
0469       }, React.createElement("span", {
0470         className: "glyphicon glyphicon-remove"
0471       }));
0472       var mobileMenuDisplay;
0473 
0474       if (this.state.status === "switch") {
0475         mobileMenuDisplay = React.createElement("div", {
0476           id: "switch-menu"
0477         }, React.createElement("a", {
0478           className: "menu-item",
0479           onClick: this.showMobileSearchForm,
0480           id: "user-menu-switch"
0481         }, React.createElement("span", {
0482           className: "glyphicon glyphicon-search"
0483         })));
0484       } else if (this.state.status === "user") {
0485         mobileMenuDisplay = React.createElement("div", {
0486           id: "mobile-user-menu"
0487         }, React.createElement("div", {
0488           className: "menu-content-wrapper"
0489         }, React.createElement(MobileUserContainer, {
0490           user: this.props.user,
0491           baseUrl: this.props.baseUrl,
0492           serverUrl: this.state.serverUrl,
0493           template: this.props.template,
0494           redirectString: this.props.redirectString
0495         })), closeMenuElementDisplay);
0496       } else if (this.state.status === "search") {
0497         mobileMenuDisplay = React.createElement("div", {
0498           id: "mobile-search-menu"
0499         }, React.createElement("div", {
0500           className: "menu-content-wrapper"
0501         }, React.createElement(SiteHeaderSearchForm, {
0502           baseUrl: this.props.baseUrl,
0503           searchBaseUrl: this.props.searchBaseUrl,
0504           store: this.props.store
0505         })), closeMenuElementDisplay);
0506       }
0507 
0508       var logoElementCssClass = this.props.store.name;
0509 
0510       if (this.state.status !== "switch") {
0511         logoElementCssClass += " mini-version";
0512       }
0513 
0514       return React.createElement("section", {
0515         id: "mobile-site-header"
0516       }, React.createElement("div", {
0517         id: "mobile-site-header-logo",
0518         className: logoElementCssClass
0519       }, React.createElement("a", {
0520         href: this.props.logoLink
0521       }, React.createElement("img", {
0522         src: this.props.template['header-logo']['image-src']
0523       }))), React.createElement("div", {
0524         id: "mobile-site-header-menus-container"
0525       }, mobileMenuDisplay));
0526     }
0527   }]);
0528 
0529   return MobileSiteHeader;
0530 }(React.Component);
0531 
0532 var MobileUserContainer =
0533 /*#__PURE__*/
0534 function (_React$Component5) {
0535   _inherits(MobileUserContainer, _React$Component5);
0536 
0537   function MobileUserContainer(props) {
0538     var _this5;
0539 
0540     _classCallCheck(this, MobileUserContainer);
0541 
0542     _this5 = _possibleConstructorReturn(this, _getPrototypeOf(MobileUserContainer).call(this, props));
0543     _this5.state = {};
0544     return _this5;
0545   }
0546 
0547   _createClass(MobileUserContainer, [{
0548     key: "render",
0549     value: function render() {
0550       var userDisplay;
0551 
0552       if (this.props.user) {// userDisplay = (
0553         //   <SiteHeaderUserMenu
0554         //     serverUrl={this.state.serverUrl}
0555         //     baseUrl={this.state.baseUrl}
0556         //     user={this.props.user}
0557         //   />
0558         // );
0559       } else {
0560         userDisplay = React.createElement(SiteHeaderLoginMenu, {
0561           user: this.props.user,
0562           baseUrl: this.props.baseUrl,
0563           template: this.props.template,
0564           redirectString: this.props.redirectString
0565         });
0566       }
0567 
0568       return React.createElement("div", {
0569         id: "mobile-user-container"
0570       }, userDisplay);
0571     }
0572   }]);
0573 
0574   return MobileUserContainer;
0575 }(React.Component);
0576 
0577 ReactDOM.render(React.createElement(SiteHeader, null), document.getElementById('site-header-container'));