Liveagent - Version 3.2.0

Version Notes

- API changed for the signup form
- settings reset link added
- minor design changes

Download this release

Release Info

Developer Quality Unit, LLC
Extension Liveagent
Version 3.2.0
Comparing to
See all releases


Code changes from version 3.1.1 to 3.2.0

app/code/local/Qualityunit/Liveagent/Block/AccountConnect.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * @copyright Copyright (c) 2015 Quality Unit s.r.o.
4
  * @author Martin Devecka, Martin Pullmann
5
- * @package WpLiveAgentPlugin
6
  * @version 1.0.0
7
  *
8
  * Licensed under GPL2
@@ -11,6 +11,7 @@ class Qualityunit_Liveagent_Block_AccountConnect extends Qualityunit_Liveagent_B
11
 
12
  const CONNECT_ACCOUNT_ACTION_FLAG = 'ca';
13
  const SAVE_BUTTON_CODE_ACTION_FLAG = 'sb';
 
14
 
15
  private $settings = null;
16
 
@@ -59,7 +60,7 @@ class Qualityunit_Liveagent_Block_AccountConnect extends Qualityunit_Liveagent_B
59
  <div id="urlFieldmain" class="g-FormField2 FieldNotSet">
60
  <div id="urlFieldinputPanel" class="g-FormField2-InputPanel"></div>
61
  <div id="urlFieldTextContainer" class="TextBoxContainer TextBoxContainer-mandatory">
62
- <input id="urlFieldinnerWidget" class="Placeholdem TextBox TextBox-mandatory" name="{urlName}" value="{la-url}" placeholder="http://account.ladesk.com" autocomplete="off" type="text">
63
  </div>
64
  <div id="urlFielddescription" class="g-FormField2-Description"></div>
65
  <div id="urlFieldmessage" class="g-FormField2-Message"></div>
2
  /**
3
  * @copyright Copyright (c) 2015 Quality Unit s.r.o.
4
  * @author Martin Devecka, Martin Pullmann
5
+ * @package MgLiveAgentPlugin
6
  * @version 1.0.0
7
  *
8
  * Licensed under GPL2
11
 
12
  const CONNECT_ACCOUNT_ACTION_FLAG = 'ca';
13
  const SAVE_BUTTON_CODE_ACTION_FLAG = 'sb';
14
+ const RESET_SETTINGS_ACTION_FLAG = 'rs';
15
 
16
  private $settings = null;
17
 
60
  <div id="urlFieldmain" class="g-FormField2 FieldNotSet">
61
  <div id="urlFieldinputPanel" class="g-FormField2-InputPanel"></div>
62
  <div id="urlFieldTextContainer" class="TextBoxContainer TextBoxContainer-mandatory">
63
+ <input id="urlFieldinnerWidget" class="Placeholdem TextBox TextBox-mandatory" name="{urlName}" value="{la-url}" placeholder="https://account.ladesk.com" autocomplete="off" type="text">
64
  </div>
65
  <div id="urlFielddescription" class="g-FormField2-Description"></div>
66
  <div id="urlFieldmessage" class="g-FormField2-Message"></div>
app/code/local/Qualityunit/Liveagent/Block/Buttoncode.php CHANGED
@@ -28,11 +28,12 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
28
  $this->assignVariable('displayInAdminPanel', Mage::helper('adminhtml')->__('Display button in admin panel'));
29
  $this->assignVariable('saveWidgetCodeHelp', Mage::helper('adminhtml')->__('The default widget code has just changed. You have to save it to apply the changes to the site chat widget.'));
30
  $this->assignVariable('saveWidgetCode', Mage::helper('adminhtml')->__('Save widget code'));
 
31
 
32
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
33
  $this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
34
 
35
- $code = htmlentities($settings->getSavedButtonCode());
36
 
37
  $this->assignVariable('buttonId', $settings->getSavedButtonId());
38
  $this->assignVariable('la-config-button-code', $this->getTextArea('la-config-button-code', $code, 10 ,200, ' textarea'));
@@ -41,6 +42,7 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
41
  $this->assignVariable('la-url', $settings->getLiveAgentUrl());
42
  $this->assignVariable('loginUrl', $this->getLoginUrl($settings));
43
  $this->assignVariable('ChangeUrl', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_AccountConnect::CONNECT_ACCOUNT_ACTION_FLAG)));
 
44
 
45
  $this->prepareWidgetsBox($settings);
46
 
@@ -176,6 +178,8 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
176
  </tr>
177
  </tbody>
178
  </table>
 
 
179
  </fieldset>
180
  </div>
181
  <div class="entry-edit">
28
  $this->assignVariable('displayInAdminPanel', Mage::helper('adminhtml')->__('Display button in admin panel'));
29
  $this->assignVariable('saveWidgetCodeHelp', Mage::helper('adminhtml')->__('The default widget code has just changed. You have to save it to apply the changes to the site chat widget.'));
30
  $this->assignVariable('saveWidgetCode', Mage::helper('adminhtml')->__('Save widget code'));
31
+ $this->assignVariable('resetText', Mage::helper('adminhtml')->__('Reset settings and start over'));
32
 
33
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
34
  $this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
35
 
36
+ $code = htmlentities($settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE));
37
 
38
  $this->assignVariable('buttonId', $settings->getSavedButtonId());
39
  $this->assignVariable('la-config-button-code', $this->getTextArea('la-config-button-code', $code, 10 ,200, ' textarea'));
42
  $this->assignVariable('la-url', $settings->getLiveAgentUrl());
43
  $this->assignVariable('loginUrl', $this->getLoginUrl($settings));
44
  $this->assignVariable('ChangeUrl', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_AccountConnect::CONNECT_ACCOUNT_ACTION_FLAG)));
45
+ $this->assignVariable('resetUrl', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_AccountConnect::RESET_SETTINGS_ACTION_FLAG)));
46
 
47
  $this->prepareWidgetsBox($settings);
48
 
178
  </tr>
179
  </tbody>
180
  </table>
181
+ <p id="resetLink">{resetText}?</p>
182
+ <input type="hidden" id="resetUrl" value="{resetUrl}" />
183
  </fieldset>
184
  </div>
185
  <div class="entry-edit">
app/code/local/Qualityunit/Liveagent/Block/Signup.php CHANGED
@@ -76,7 +76,7 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
76
  }
77
 
78
  protected function getTemplateString() {
79
- return '<div id="signup" class="nlHostedForm mainBox visible">
80
  <h1>{dialogCaption}</h1>
81
  <p class="secure">{sslSecure}</p>
82
  <div class="LaSignupForm">
@@ -137,7 +137,7 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
137
  </div>
138
  </div>
139
 
140
- <div id="loader" class="nlHostedForm mainBox" style="display:none;">
141
  <h1>{buildingLA}</h1>
142
  <p>{buildingLALong}</p>
143
  <div class="loading-bar">
@@ -168,12 +168,6 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
168
  </div>
169
 
170
  <script type="text/javascript">
171
- jQuery(function($) {
172
- $("#domainFieldinnerWidget").keypress();
173
- $.fn.validateEmail();
174
- $.fn.validateName();
175
- $.fn.validateDomain();
176
- });
177
  var skipCreate = function() {
178
  setLocation(\'{skipUrlAction}\');
179
  return false;
76
  }
77
 
78
  protected function getTemplateString() {
79
+ return '<div id="signup" class="nlHostedForm mainBox">
80
  <h1>{dialogCaption}</h1>
81
  <p class="secure">{sslSecure}</p>
82
  <div class="LaSignupForm">
137
  </div>
138
  </div>
139
 
140
+ <div id="loader" class="nlHostedForm mainBox invisible">
141
  <h1>{buildingLA}</h1>
142
  <p>{buildingLALong}</p>
143
  <div class="loading-bar">
168
  </div>
169
 
170
  <script type="text/javascript">
 
 
 
 
 
 
171
  var skipCreate = function() {
172
  setLocation(\'{skipUrlAction}\');
173
  return false;
app/code/local/Qualityunit/Liveagent/Helper/Settings.php CHANGED
@@ -190,16 +190,16 @@ class Qualityunit_Liveagent_Helper_Settings {
190
  );
191
  }
192
 
193
- public function getSavedButtonCode() {
194
- $config = Mage::getSingleton('liveagent/config');
195
- if (!$config->isButtonEnabled()) {
196
- return '<!-- LiveAgent: la_error - button display is turned off for this store -->';
 
 
 
 
 
197
  }
198
- if ($this->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE) != '') {
199
- return $this->replacePlaceholders($this->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE));
200
- }
201
- return '<!-- LiveAgent: la_error - no button code set yet -->';
202
- }
203
 
204
  public function replacePlaceholders($htmlCode) {
205
  $customerSession = Mage::getSingleton('customer/session');
@@ -215,7 +215,6 @@ class Qualityunit_Liveagent_Helper_Settings {
215
  $customer = $customerSession->getCustomer();
216
 
217
  if (($customer->getFirstname() != null) && ($customer->getFirstname() != '')) {
218
-
219
  $htmlCode = str_replace('%%firstName%%', "LiveAgent.addUserDetail('firstName', '" . $customer->getFirstname() . "');\n", $htmlCode);
220
  }
221
  else {
@@ -236,17 +235,17 @@ class Qualityunit_Liveagent_Helper_Settings {
236
  $htmlCode = str_replace('%%email%%', '', $htmlCode);
237
  }
238
 
239
- if ($customer->getPrimaryBillingAddress() !== false) {
240
- if (($customer->getPrimaryBillingAddress()->getTelephone() != null) && ($customer->getPrimaryBillingAddress()->getTelephone() != '')) {
241
- $htmlCode = str_replace('%%phone%%', "LiveAgent.addUserDetail('phone', '" . $customer->getPrimaryBillingAddress()->getTelephone() . "');\n", $htmlCode);
242
- }
243
- else {
244
- $htmlCode = str_replace('%%phone%%', '', $htmlCode);
245
- }
246
- }
247
- else {
248
- $htmlCode = str_replace('%%phone%%', '', $htmlCode);
249
- }
250
  return $htmlCode;
251
  }
252
 
190
  );
191
  }
192
 
193
+ public function getSavedButtonCode() {
194
+ $config = Mage::getSingleton('liveagent/config');
195
+ if (!$config->isButtonEnabled()) {
196
+ return '<!-- LiveAgent: la_error - button display is turned off for this store -->';
197
+ }
198
+ if ($this->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE) != '') {
199
+ return $this->replacePlaceholders($this->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE));
200
+ }
201
+ return '<!-- LiveAgent: la_error - no button code set yet -->';
202
  }
 
 
 
 
 
203
 
204
  public function replacePlaceholders($htmlCode) {
205
  $customerSession = Mage::getSingleton('customer/session');
215
  $customer = $customerSession->getCustomer();
216
 
217
  if (($customer->getFirstname() != null) && ($customer->getFirstname() != '')) {
 
218
  $htmlCode = str_replace('%%firstName%%', "LiveAgent.addUserDetail('firstName', '" . $customer->getFirstname() . "');\n", $htmlCode);
219
  }
220
  else {
235
  $htmlCode = str_replace('%%email%%', '', $htmlCode);
236
  }
237
 
238
+ if ($customer->getPrimaryBillingAddress() !== false) {
239
+ if (($customer->getPrimaryBillingAddress()->getTelephone() != null) && ($customer->getPrimaryBillingAddress()->getTelephone() != '')) {
240
+ $htmlCode = str_replace('%%phone%%', "LiveAgent.addUserDetail('phone', '" . $customer->getPrimaryBillingAddress()->getTelephone() . "');\n", $htmlCode);
241
+ }
242
+ else {
243
+ $htmlCode = str_replace('%%phone%%', '', $htmlCode);
244
+ }
245
+ }
246
+ else {
247
+ $htmlCode = str_replace('%%phone%%', '', $htmlCode);
248
+ }
249
  return $htmlCode;
250
  }
251
 
app/code/local/Qualityunit/Liveagent/controllers/Adminhtml/LiveagentController.php CHANGED
@@ -199,9 +199,14 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
199
  $this->renderLayout();
200
  return;
201
  }
202
- if ($this->getRequest()->getParam('action')==Qualityunit_Liveagent_Block_AccountConnect::CONNECT_ACCOUNT_ACTION_FLAG) {
203
  $block = new Qualityunit_Liveagent_Block_AccountConnect();
204
  }
 
 
 
 
 
205
  $this->_addContent($this->getLayout()->createBlock($block));
206
  $this->renderLayout();
207
  }
@@ -239,6 +244,14 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
239
  Mage::log("Response OK", Zend_log::DEBUG);
240
  }
241
 
 
 
 
 
 
 
 
 
242
  private function saveAccountDetails($email, $domain, $apiKey, $authToken) {
243
  if ((strpos($domain, 'http:') === false) && (strpos($domain, 'https:') === false)) {
244
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, 'https://' . $domain . '.ladesk.com/');
199
  $this->renderLayout();
200
  return;
201
  }
202
+ if ($this->getRequest()->getParam('action')==Qualityunit_Liveagent_Block_AccountConnect::CONNECT_ACCOUNT_ACTION_FLAG) {
203
  $block = new Qualityunit_Liveagent_Block_AccountConnect();
204
  }
205
+ if ($this->getRequest()->getParam('action')==Qualityunit_Liveagent_Block_AccountConnect::RESET_SETTINGS_ACTION_FLAG) {
206
+ $this->resetSettings();
207
+ $this->doAfterPost();
208
+ return;
209
+ }
210
  $this->_addContent($this->getLayout()->createBlock($block));
211
  $this->renderLayout();
212
  }
244
  Mage::log("Response OK", Zend_log::DEBUG);
245
  }
246
 
247
+ private function resetSettings() {
248
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, '');
249
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, '');
250
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_API_KEY, '');
251
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, '');
252
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, '');
253
+ }
254
+
255
  private function saveAccountDetails($email, $domain, $apiKey, $authToken) {
256
  if ((strpos($domain, 'http:') === false) && (strpos($domain, 'https:') === false)) {
257
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, 'https://' . $domain . '.ladesk.com/');
app/code/local/Qualityunit/Liveagent/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Qualityunit_Liveagent>
5
- <version>3.1.0</version>
6
  </Qualityunit_Liveagent>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Qualityunit_Liveagent>
5
+ <version>3.2.0</version>
6
  </Qualityunit_Liveagent>
7
  </modules>
8
  <frontend>
app/design/adminhtml/default/default/layout/liveagent.xml CHANGED
@@ -4,9 +4,10 @@
4
  <reference name="head">
5
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery-1.11.3.min.js</name></action>
6
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery-no-conflict.js</name></action>
 
7
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery.alphanum.js</name></action>
8
- <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery.validate.min.js</name></action>
9
  <action method="addItem"><type>skin_js</type><name>liveagent/js/lasignup.js</name></action>
 
10
 
11
  <action method="addItem"><type>skin_css</type><name>liveagent/css/animation.css</name></action>
12
  <action method="addItem"><type>skin_css</type><name>liveagent/css/responsive.css</name></action>
4
  <reference name="head">
5
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery-1.11.3.min.js</name></action>
6
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery-no-conflict.js</name></action>
7
+ <!--action method="addItem"><type>skin_js</type><name>liveagent/js/jquery.validate.min.js</name></action -->
8
  <action method="addItem"><type>skin_js</type><name>liveagent/js/jquery.alphanum.js</name></action>
 
9
  <action method="addItem"><type>skin_js</type><name>liveagent/js/lasignup.js</name></action>
10
+ <action method="addItem"><type>skin_js</type><name>liveagent/js/crm_lasignup.js</name></action>
11
 
12
  <action method="addItem"><type>skin_css</type><name>liveagent/css/animation.css</name></action>
13
  <action method="addItem"><type>skin_css</type><name>liveagent/css/responsive.css</name></action>
app/etc/modules/Qualityunit_Liveagent.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Qualityunit_Liveagent>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
- <version>3.1.0</version>
8
  </Qualityunit_Liveagent>
9
  </modules>
10
  </config>
4
  <Qualityunit_Liveagent>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <version>3.2.0</version>
8
  </Qualityunit_Liveagent>
9
  </modules>
10
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Liveagent</name>
4
- <version>3.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
7
  <channel>community</channel>
@@ -9,11 +9,13 @@
9
  <summary>LiveAgent plugin integrates well known help desk and live chat software into any Magento installation. No HTML knowledge is required.</summary>
10
  <description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.&#xD;
11
  Start by entering your existing account details or easily create one and then just choose which button you want to use for you shop. You are done in few clicks!</description>
12
- <notes>- display in admin option fixed</notes>
 
 
13
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
14
- <date>2016-05-24</date>
15
- <time>06:53:01</time>
16
- <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="AccountConnect.php" hash="8e1d5a6f83b283c440fccaf7c60c3c10"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="95b66c729f07519bdf9187407f5394c2"/></dir></dir></dir></dir><file name="Base.php" hash="86155f5e3264655ceb130dab28c405b6"/><file name="Buttoncode.php" hash="5a7c60199f39ac77d7ccfb2bec3ce2a7"/><file name="Signup.php" hash="4b5c66377a62f53696866964a386cef5"/></dir><dir name="Exception"><file name="Base.php" hash="c54d68353f3f7d765baac10f8900af16"/><file name="ConnectFailed.php" hash="af790857c2ee9972eb1dd0df6b90de68"/><file name="ConnectProblem.php" hash="dd2df3be3af51a621b7ec9df1fd5f8fb"/><file name="SignupFailed.php" hash="88fadc5990ec7a6fce5e1feb8c931ffa"/></dir><dir name="Helper"><file name="Account.php" hash="f4b560d1baff04f76f3fb03051e030f8"/><file name="Connect.php" hash="792d5a829bb069c14186665ae587f465"/><file name="Data.php" hash="9bd5c406141e8b7e62d725815bde5d2e"/><file name="Settings.php" hash="fca13c2ee9135ab0acb840f91f8b624d"/></dir><dir name="Model"><file name="Buttons.php" hash="3c8e6136df4111c3100919b107ba6726"/><file name="Config.php" hash="715888cbcfbdf2d70805fdccf62a05ae"/><file name="Liveagent.php" hash="2c08986c55f107c7398c8f4e7ba99737"/><dir name="Mysql4"><dir name="Buttons"><file name="Collection.php" hash="64edb5ecfc9b1511ae155f347e9a0e6b"/></dir><file name="Buttons.php" hash="5c2fd7184c1bb88b381ef8440bfe1e4f"/><dir name="Liveagent"><file name="Collection.php" hash="29675fde5a317fdf980a549f40502b8e"/></dir><file name="Liveagent.php" hash="559e305b52289e79f9038aea53a85a48"/><dir name="Settings"><file name="Collection.php" hash="d9dfc6b2abadf95ad6dbdee9f52f9c28"/></dir><file name="Settings.php" hash="cdded3171b84b02ed4ad360dd3cb7b71"/></dir><file name="Settings.php" hash="33d2a37b380c4424f072797a9d6978ce"/><file name="Status.php" hash="4e2f42f52c7cdc51388ce9dee5d2f85a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LiveagentController.php" hash="05f6610407d02de85dc8e96806be2165"/></dir><file name="IndexController.php" hash="2af5a61bf7319c38c97a48e0f3723598"/></dir><dir name="etc"><file name="config.xml" hash="2327efa4a3db91bad716b48721d6e36a"/><file name="system.xml" hash="09da588a164356e75136384792e8e749"/></dir><dir name="sql"><dir name="liveagent_setup"><file name="mysql4-install-0.1.0.php" hash="aaf89c3a8e551318bae3891e44c4d06e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="5a77968b68e659dc21bdad2605210333"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="26ca8ed79a896c5ee6df75c2e84b49ca"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="092e58556ff589d03b81df4ed53e548c"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="a49c660e67b8914889779858295125aa"/><file name="report.phtml" hash="2100c3c18095186bd660c6cb66c00fc5"/><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4c503765e35eebae737fc38271fc4615"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Liveagent.xml" hash="89c1531df13125a0fc6657e3cc33e5da"/></dir></target><target name="magelocale"><dir name="en_US"><file name="qualityunit_liveagent.csv" hash="ddb1b449beb20afedd1d63abb446fc4e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="liveagent"><dir name="css"><file name="animation.css" hash="e114422983f975cac20edbe5a12fdb37"/><dir name="fonts"><file name="OpenSans-Bold-webfont.eot" hash="7e78b345bbb56eb154a32396524b5650"/><file name="OpenSans-Bold-webfont.svg" hash="ba40976c12378dfdcd0c0b1b2747421b"/><file name="OpenSans-Bold-webfont.ttf" hash="0b6240e6a9217e44e77bbda8a2ed2bb0"/><file name="OpenSans-Bold-webfont.woff" hash="769a36776804007ab23b7266b22be392"/><file name="OpenSans-Light-webfont.eot" hash="5d5f7deb21a0609f0b12ae5332cfb6b9"/><file name="OpenSans-Light-webfont.svg" hash="93d6578a9051feb87bf857cbb3cabdb7"/><file name="OpenSans-Light-webfont.ttf" hash="4eb5ea0a1bc989d3bfeb9423be53e78f"/><file name="OpenSans-Light-webfont.woff" hash="798bf3bb0819ff94c7c8fd0142f58d22"/><file name="OpenSans-Regular-webfont.eot" hash="3b721cb588d7b323137bd456c237b116"/><file name="OpenSans-Regular-webfont.svg" hash="3b461c91b64d27057676c1a4562b3a15"/><file name="OpenSans-Regular-webfont.ttf" hash="50700928d66c83bc7501ce99690b265a"/><file name="OpenSans-Regular-webfont.woff" hash="9e002ce4035a849d41b9ba83993083d7"/></dir><file name="la-config.css" hash="8606aed8aa15224d003da2ab4228a8dd"/><file name="la-logo.png" hash="331e744a96c4720d1a7583235c3a8245"/><file name="la-tab.png" hash="aa2f9c6e52f8242d0cff65e706252753"/><file name="la_logo.svg" hash="686ec663e568d38de97df58b915f95f6"/><file name="lock.png" hash="7380f52e49851581388b2cd7c8a5d7bd"/><file name="ok_icon.png" hash="e66785de1c506b6f9635d97f35e0c7df"/><file name="report.css" hash="6d75d81d824b4f02db7ab63e595a85cc"/><file name="responsive.css" hash="a3dff048c1feec42f1efc8f066a70a0f"/><file name="style.css" hash="236fa1cec84b5b26261b244cf355659b"/><file name="video.jpg" hash="57d38a4cb802f6009f2f3b0a768d6fc2"/></dir><dir name="js"><file name="jquery-1.11.3.min.js" hash="895323ed2f7258af4fae2c738c8aea49"/><file name="jquery-no-conflict.js" hash="644f0006e36a235d2a6df494bed48636"/><file name="jquery.alphanum.js" hash="3610a43bb5a6892f7e1aae03f05582c2"/><file name="jquery.validate.min.js" hash="d7342d64b483db4cdc836047765c07f3"/><file name="lasignup.js" hash="909a3b89631232c9d782139eb00ecdc4"/></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Liveagent</name>
4
+ <version>3.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
7
  <channel>community</channel>
9
  <summary>LiveAgent plugin integrates well known help desk and live chat software into any Magento installation. No HTML knowledge is required.</summary>
10
  <description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.&#xD;
11
  Start by entering your existing account details or easily create one and then just choose which button you want to use for you shop. You are done in few clicks!</description>
12
+ <notes>- API changed for the signup form&#xD;
13
+ - settings reset link added&#xD;
14
+ - minor design changes</notes>
15
  <authors><author><name>Quality Unit, LLC</name><user>support</user><email>support@qualityunit.com</email></author></authors>
16
+ <date>2016-08-12</date>
17
+ <time>09:01:37</time>
18
+ <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="AccountConnect.php" hash="ab7b38b5718bbb3e6e6bde3335123609"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="95b66c729f07519bdf9187407f5394c2"/></dir></dir></dir></dir><file name="Base.php" hash="86155f5e3264655ceb130dab28c405b6"/><file name="Buttoncode.php" hash="43990c94ee2e7747aa29c84978f007c9"/><file name="Signup.php" hash="90bc067a4447aad0f23ee170981db553"/></dir><dir name="Exception"><file name="Base.php" hash="c54d68353f3f7d765baac10f8900af16"/><file name="ConnectFailed.php" hash="af790857c2ee9972eb1dd0df6b90de68"/><file name="ConnectProblem.php" hash="dd2df3be3af51a621b7ec9df1fd5f8fb"/><file name="SignupFailed.php" hash="88fadc5990ec7a6fce5e1feb8c931ffa"/></dir><dir name="Helper"><file name="Account.php" hash="f4b560d1baff04f76f3fb03051e030f8"/><file name="Connect.php" hash="792d5a829bb069c14186665ae587f465"/><file name="Data.php" hash="9bd5c406141e8b7e62d725815bde5d2e"/><file name="Settings.php" hash="9088c0f9fa1a749e39b496a40466b64a"/></dir><dir name="Model"><file name="Buttons.php" hash="3c8e6136df4111c3100919b107ba6726"/><file name="Config.php" hash="715888cbcfbdf2d70805fdccf62a05ae"/><file name="Liveagent.php" hash="2c08986c55f107c7398c8f4e7ba99737"/><dir name="Mysql4"><dir name="Buttons"><file name="Collection.php" hash="64edb5ecfc9b1511ae155f347e9a0e6b"/></dir><file name="Buttons.php" hash="5c2fd7184c1bb88b381ef8440bfe1e4f"/><dir name="Liveagent"><file name="Collection.php" hash="29675fde5a317fdf980a549f40502b8e"/></dir><file name="Liveagent.php" hash="559e305b52289e79f9038aea53a85a48"/><dir name="Settings"><file name="Collection.php" hash="d9dfc6b2abadf95ad6dbdee9f52f9c28"/></dir><file name="Settings.php" hash="cdded3171b84b02ed4ad360dd3cb7b71"/></dir><file name="Settings.php" hash="33d2a37b380c4424f072797a9d6978ce"/><file name="Status.php" hash="4e2f42f52c7cdc51388ce9dee5d2f85a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LiveagentController.php" hash="a8e68c9e91cc210815cfe0e2ddf897e4"/></dir><file name="IndexController.php" hash="2af5a61bf7319c38c97a48e0f3723598"/></dir><dir name="etc"><file name="config.xml" hash="48cadcea7b7fee0405ac64ec0393655a"/><file name="system.xml" hash="09da588a164356e75136384792e8e749"/></dir><dir name="sql"><dir name="liveagent_setup"><file name="mysql4-install-0.1.0.php" hash="aaf89c3a8e551318bae3891e44c4d06e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="5a77968b68e659dc21bdad2605210333"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="26ca8ed79a896c5ee6df75c2e84b49ca"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="3c222952dbb75507b07569c1250e633f"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="a49c660e67b8914889779858295125aa"/><file name="report.phtml" hash="2100c3c18095186bd660c6cb66c00fc5"/><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4c503765e35eebae737fc38271fc4615"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Liveagent.xml" hash="74fa70c192338b1efedd61b38a406d3f"/></dir></target><target name="magelocale"><dir name="en_US"><file name="qualityunit_liveagent.csv" hash="ddb1b449beb20afedd1d63abb446fc4e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="liveagent"><dir name="css"><file name="animation.css" hash="e114422983f975cac20edbe5a12fdb37"/><dir name="fonts"><file name="OpenSans-Bold-webfont.eot" hash="7e78b345bbb56eb154a32396524b5650"/><file name="OpenSans-Bold-webfont.svg" hash="ba40976c12378dfdcd0c0b1b2747421b"/><file name="OpenSans-Bold-webfont.ttf" hash="0b6240e6a9217e44e77bbda8a2ed2bb0"/><file name="OpenSans-Bold-webfont.woff" hash="769a36776804007ab23b7266b22be392"/><file name="OpenSans-Light-webfont.eot" hash="5d5f7deb21a0609f0b12ae5332cfb6b9"/><file name="OpenSans-Light-webfont.svg" hash="93d6578a9051feb87bf857cbb3cabdb7"/><file name="OpenSans-Light-webfont.ttf" hash="4eb5ea0a1bc989d3bfeb9423be53e78f"/><file name="OpenSans-Light-webfont.woff" hash="798bf3bb0819ff94c7c8fd0142f58d22"/><file name="OpenSans-Regular-webfont.eot" hash="3b721cb588d7b323137bd456c237b116"/><file name="OpenSans-Regular-webfont.svg" hash="3b461c91b64d27057676c1a4562b3a15"/><file name="OpenSans-Regular-webfont.ttf" hash="50700928d66c83bc7501ce99690b265a"/><file name="OpenSans-Regular-webfont.woff" hash="9e002ce4035a849d41b9ba83993083d7"/></dir><file name="la-config.css" hash="8606aed8aa15224d003da2ab4228a8dd"/><file name="la-logo.png" hash="331e744a96c4720d1a7583235c3a8245"/><file name="la-tab.png" hash="aa2f9c6e52f8242d0cff65e706252753"/><file name="la_logo.svg" hash="686ec663e568d38de97df58b915f95f6"/><file name="lock.png" hash="7380f52e49851581388b2cd7c8a5d7bd"/><file name="ok_icon.png" hash="e66785de1c506b6f9635d97f35e0c7df"/><file name="report.css" hash="6d75d81d824b4f02db7ab63e595a85cc"/><file name="responsive.css" hash="a3dff048c1feec42f1efc8f066a70a0f"/><file name="style.css" hash="b46a093edc06c5a8bb7b5b929cc32917"/><file name="video.jpg" hash="57d38a4cb802f6009f2f3b0a768d6fc2"/></dir><dir name="js"><file name="crm_lasignup.js" hash="5d9170dd0b3c7a15753f00f4204a8921"/><file name="jquery-1.11.3.min.js" hash="895323ed2f7258af4fae2c738c8aea49"/><file name="jquery-no-conflict.js" hash="644f0006e36a235d2a6df494bed48636"/><file name="jquery.alphanum.js" hash="3610a43bb5a6892f7e1aae03f05582c2"/><file name="lasignup.js" hash="d7f2750d5bd34e71deb4d0d435673aa8"/></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>7.5.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
21
  </package>
skin/adminhtml/default/default/liveagent/css/style.css CHANGED
@@ -221,7 +221,7 @@ body{oveflow:hidden;max-width:100%}
221
  .fWrapperColor6.cBlock:after{background:#3EB8BD}
222
  .fWrapperColor6.ccBlock:after{background:#3EB8BD}
223
  #c36896 img{border:1px solid #ccc}
224
- .mainBox{width:480px;height:auto;background:rgb(23,0,0);background:rgba(23,0,0,0.6);text-align:center;z-index:9999;position:relative;border-radius:2px}
225
  .mainBox h1{font-weight:300;font-size:42px;color:#fff;line-height:48px;border-bottom:1px solid #6ed100;display:block;text-align:center;background:rgb(23,0,0);border-top-left-radius:2px;border-top-right-radius:2px;background:rgba(23,0,0,0.6);padding:15px 2% 17px;font-family:'OpenSans',sans-serif;margin-bottom:15px}
226
  .bodyLang5 .mainBox h1{font-size:34px}
227
  .mainBox p{color:#fff;max-width:120px;margin:0 15px 15px}
@@ -349,4 +349,7 @@ h3.head-promo-catalog {background-image: url("la_logo.svg");height: 52px;text-in
349
  .form-list td.label label{width: 240px;}
350
  .form-list p.note {color: grey;}
351
  .inUseLabel {width: 100px;display: block;height: 20px;margin: 3px auto 0px;background: transparent url("ok_icon.png") no-repeat scroll left -1px / 20px 20px;}
352
- .displayInAdminCheckbox {display: block; float: left; clear: both}
 
 
 
221
  .fWrapperColor6.cBlock:after{background:#3EB8BD}
222
  .fWrapperColor6.ccBlock:after{background:#3EB8BD}
223
  #c36896 img{border:1px solid #ccc}
224
+ .mainBox{width:480px;height:auto;background:rgb(23,0,0);background:rgba(23,0,0,0.6);text-align:center;z-index:98;position:relative;border-radius:2px}
225
  .mainBox h1{font-weight:300;font-size:42px;color:#fff;line-height:48px;border-bottom:1px solid #6ed100;display:block;text-align:center;background:rgb(23,0,0);border-top-left-radius:2px;border-top-right-radius:2px;background:rgba(23,0,0,0.6);padding:15px 2% 17px;font-family:'OpenSans',sans-serif;margin-bottom:15px}
226
  .bodyLang5 .mainBox h1{font-size:34px}
227
  .mainBox p{color:#fff;max-width:120px;margin:0 15px 15px}
349
  .form-list td.label label{width: 240px;}
350
  .form-list p.note {color: grey;}
351
  .inUseLabel {width: 100px;display: block;height: 20px;margin: 3px auto 0px;background: transparent url("ok_icon.png") no-repeat scroll left -1px / 20px 20px;}
352
+ .displayInAdminCheckbox {display: block; float: left; clear: both}
353
+
354
+ #resetLink {text-align: right; font-style: italic; float: right; margin: 0}
355
+ #resetLink:hover {cursor:pointer; color:#ea7601}
skin/adminhtml/default/default/liveagent/js/crm_lasignup.js ADDED
@@ -0,0 +1,865 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var product_id = "b229622b"; // LiveAgent
2
+ var variationId = "3513230f"; // Trial (not billable)
3
+ var language_code = 'en-US';
4
+ var apikey = "jx5imiBhB6K12zui03YJL0lumHOr7S5T";
5
+ var source = 'magento';
6
+ var requestData = null;
7
+ var formKey = '';
8
+
9
+ (function () {
10
+ function sendApiRequest(options) {
11
+ options.dataType = "json";
12
+
13
+ if(options.data) {
14
+ options.data = JSON.stringify(options.data);
15
+ }
16
+
17
+ if(options.params) {
18
+ options.url += "?" + jQuery.param(options.params);
19
+ options.params = undefined;
20
+ }
21
+
22
+ jQuery.ajax(options);
23
+ }
24
+
25
+ var Api = function () {
26
+ this.url = "https://crm.qualityunit.com/api/v3/";
27
+ this.method = "GET";
28
+ };
29
+
30
+ //retrieves list of countries
31
+ Api.countriesGet = function () {
32
+ Api.apply(this, arguments);
33
+ this.url += "countries";
34
+ };
35
+
36
+ //retrieves price
37
+ Api.priceGet = function () {
38
+ Api.apply(this, arguments);
39
+ this.url += "billing/price";
40
+ this.params = {
41
+ //variationId:
42
+ //country:
43
+ //vatId: optional
44
+ //addons: optional array
45
+ };
46
+ };
47
+
48
+ Api.addonsGet = function (variationId) {
49
+ Api.apply(this, arguments);
50
+ this.url += "variations/" + variationId + "/available_addons";
51
+ };
52
+
53
+ //checks vat validity
54
+ Api.vatCheck = function () {
55
+ Api.apply(this, arguments);
56
+ this.url += "billing/_check_vat";
57
+ this.method = "POST";
58
+ this.params = {
59
+ //vatId:
60
+ }
61
+ };
62
+
63
+ //checks domain validity
64
+ Api.domainCheck = function () {
65
+ Api.apply(this, arguments);
66
+ this.url += "subscriptions/_check_domain";
67
+ this.method = "POST";
68
+ this.params = {
69
+ //product_id:
70
+ //subdomain:
71
+ }
72
+ };
73
+
74
+ //checks install progress
75
+ Api.installProgress = function (subscription_id) {
76
+ Api.apply(this, arguments);
77
+ this.url += "subscriptions/" + subscription_id + "/install_progress";
78
+ };
79
+
80
+ //new subscription
81
+ Api.signup = function () {
82
+ Api.apply(this, arguments);
83
+ this.url += "subscriptions/";
84
+ this.method = "POST";
85
+ this.data = {
86
+ //variation_id:
87
+ //subdomain:
88
+ //language:
89
+ //initial_api_key:
90
+ //billing_period:
91
+ //note:
92
+ //pap_visitor_id:
93
+ //customer: {
94
+ // name:
95
+ // email:
96
+ // company:
97
+ // phone:
98
+ // address1:
99
+ // address2:
100
+ // city:
101
+ // state:
102
+ // country:
103
+ // zip:
104
+ // vat_id:
105
+ // tax_id:
106
+ //},
107
+ //payment_method: {
108
+ // payment_type:
109
+ // payment_token:
110
+ // card_name:
111
+ // card_holder:
112
+ // card_address:
113
+ // card_zip:
114
+ // card_expire:
115
+ //}
116
+ };
117
+ };
118
+ // SignupForm file
119
+ function _generateAccessor(fieldName, accessor) {
120
+ return (function (reset) {
121
+ reset = typeof reset !== "undefined" ? reset : false;
122
+ if (reset || !this[fieldName]) {
123
+ this[fieldName] = accessor.call(this, reset);
124
+ }
125
+ return this[fieldName];
126
+ })
127
+ }
128
+
129
+ function setVisible(element, value) {
130
+ if (value) {
131
+ element.removeClass("invisible");
132
+ } else {
133
+ element.addClass("invisible");
134
+ }
135
+ }
136
+
137
+ var queryString = (function (a) {
138
+ if (a == "") {
139
+ return {};
140
+ }
141
+ var b = {};
142
+ for (var i = 0; i < a.length; ++i) {
143
+ var p = a[i].split('=', 2);
144
+ if (p.length == 1) {
145
+ b[p[0]] = "";
146
+ } else {
147
+ b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
148
+ }
149
+ }
150
+ return b;
151
+ })(window.location.search.substr(1).split('&'));
152
+
153
+ ////////// FormField
154
+ function FormField(name) {
155
+ this._name = name;
156
+ this.active = true;
157
+ this.validators = [];
158
+ this.validationTimer = undefined;
159
+ this.paymentMethod = undefined;
160
+ }
161
+
162
+ FormField.prototype = {
163
+ constructor: FormField,
164
+
165
+ block: _generateAccessor("_block", function (reset) {
166
+ return jQuery("." + this._name);
167
+ }),
168
+
169
+ main: _generateAccessor("_main", function (reset) {
170
+ return jQuery("#" + this._name + "main");
171
+ }),
172
+
173
+ input: _generateAccessor("_input", function (reset) {
174
+ return this.main(reset).find("input");
175
+ }),
176
+
177
+ select: _generateAccessor("_select", function (reset) {
178
+ return this.main(reset).find("select");
179
+ }),
180
+
181
+ value: function (reset) {
182
+ reset = typeof reset !== "undefined" ? reset : false;
183
+ return this.input(reset).val();
184
+ },
185
+
186
+ setActive: function (value) {
187
+ this.active = value === true;
188
+ if (!this.active) {
189
+ this.setState("", "");
190
+ } else if (this.value()) {
191
+ this.validate();
192
+ }
193
+ this.onActivityChange(value);
194
+ },
195
+
196
+ onActivityChange: function (value) {
197
+
198
+ },
199
+
200
+ isActive: function () {
201
+ return this.active;
202
+ },
203
+
204
+ setState: function (state, message) {
205
+ message = typeof message !== "undefined" ? message : "";
206
+ var field = this.main();
207
+ for (var s in FormField.states) {
208
+ if (FormField.states[s] === state) {
209
+ field.addClass(FormField.states[s]);
210
+ } else {
211
+ field.removeClass(FormField.states[s]);
212
+ }
213
+ }
214
+ this.errorMessage(message)
215
+ },
216
+
217
+ errorMessage: function (message) {
218
+ this.main().find(".g-FormField2-Message").html(message)
219
+ },
220
+
221
+ validate: function () {
222
+ if (this.validationTimer) {
223
+ this.cancelValidation();
224
+ }
225
+ if (this.validators.length < 1 || !this.isActive()) {
226
+ return;
227
+ }
228
+
229
+ var inst = this;
230
+ var notifyResult = function (validator) {
231
+ var waiting = false;
232
+ for (var i = 0; i < inst.validators.length; i++) {
233
+ var state = inst.validators[i].state;
234
+ if (state === FormField.states.error) {
235
+ inst.setState(FormField.states.error, inst.validators[i].message);
236
+ return;
237
+ }
238
+ if (state === FormField.states.waiting) {
239
+ waiting = true;
240
+ }
241
+ }
242
+ if (waiting) {
243
+ inst.setState(FormField.states.waiting, "Validating...");
244
+ return;
245
+ }
246
+ inst.setState(FormField.states.valid, validator.message);
247
+ };
248
+
249
+ for (var i = 0; i < this.validators.length; i++) {
250
+ this.validators[i].validate(this, notifyResult);
251
+ }
252
+ },
253
+
254
+ getState: function () {
255
+ var waiting = false;
256
+ for (var i = 0; i < this.validators.length; i++) {
257
+ var state = this.validators[i].state;
258
+ if (state === FormField.states.error) {
259
+ return FormField.states.error;
260
+ }
261
+ if (state === FormField.states.waiting) {
262
+ waiting = true;
263
+ }
264
+ }
265
+ if (waiting) {
266
+ return FormField.states.waiting;
267
+ }
268
+ return FormField.states.valid;
269
+ },
270
+
271
+ scheduleValidation: function (time) {
272
+ time = typeof time !== "undefined" ? time : 0;
273
+ if (time <= 0) {
274
+ this.validate();
275
+ return;
276
+ }
277
+ var inst = this;
278
+ if (this.validationTimer) {
279
+ clearTimeout(this.validationTimer);
280
+ }
281
+ this.validationTimer = setTimeout(function () {
282
+ inst.validationTimer = undefined;
283
+ inst.validate();
284
+ }, time);
285
+ },
286
+
287
+ cancelValidation: function () {
288
+ if (this.validationTimer) {
289
+ clearTimeout(this.validationTimer);
290
+ this.validationTimer = undefined;
291
+ }
292
+ },
293
+
294
+ registerValidator: function (validator) {
295
+ if (jQuery.inArray(validator, this.validators) >= 0) {
296
+ return;
297
+ }
298
+ this.validators.push(validator);
299
+ return this;
300
+ },
301
+
302
+ validateOn: function (event, time, selector) {
303
+ time = typeof time !== "undefined" ? time : 0;
304
+ var inst = this;
305
+ var runValidate = function () {
306
+ inst.scheduleValidation(time);
307
+ };
308
+ if (typeof selector !== "undefined") {
309
+ this.main().find(selector).on(event, runValidate);
310
+ } else {
311
+ this.main().on(event, runValidate);
312
+ }
313
+ return this;
314
+ }
315
+ };
316
+
317
+ FormField.states = {
318
+ error: "g-FormField2-Error",
319
+ waiting: "g-FormField2-Waiting",
320
+ valid: "g-FormField2-Valid"
321
+ };
322
+
323
+ ////////// Field Vaidator
324
+
325
+ function FieldValidator() {
326
+ this.state = FormField.states.error;
327
+ this.message = "Field invalid";
328
+ this.unique = [];
329
+ }
330
+
331
+ FieldValidator.prototype = {
332
+ constructor: FieldValidator,
333
+
334
+ valid: function (message) {
335
+ this.state = FormField.states.valid;
336
+ this.message = message;
337
+ },
338
+
339
+ error: function (message) {
340
+ this.state = FormField.states.error;
341
+ this.message = message;
342
+ },
343
+
344
+ waiting: function () {
345
+ this.state = FormField.states.waiting;
346
+ this.message = "";
347
+ },
348
+
349
+ setUnique: function () {
350
+ this.unique = [];
351
+ for (var i = 0; i < arguments.length; i++) {
352
+ this.unique.push(arguments[i]);
353
+ }
354
+ },
355
+
356
+ uniqueChanged: function () {
357
+ if (this.unique.length != arguments.length) {
358
+ return true;
359
+ }
360
+ for (var i = 0; i < arguments.length; i++) {
361
+ if (this.unique[i] !== arguments[i]) {
362
+ return true;
363
+ }
364
+ }
365
+ return false;
366
+ }
367
+ };
368
+
369
+ FieldValidator.textLength = function (errorMessage, minimum, selector) {
370
+ errorMessage = typeof errorMessage !== "undefined"
371
+ ? errorMessage : "Field can't be empty";
372
+ selector = typeof selector !== "undefined" ? selector : "input";
373
+ minimum = typeof minimum !== "undefined" ? minimum : 1;
374
+
375
+ var validator = new FieldValidator();
376
+ validator.message = errorMessage;
377
+
378
+ validator.validate = function (formField, notifyResult) {
379
+ var input = formField.main().find(selector).val();
380
+ if (input && input.length >= minimum) {
381
+ validator.valid();
382
+ } else {
383
+ validator.error(errorMessage);
384
+ }
385
+ notifyResult(this);
386
+ };
387
+
388
+ return validator;
389
+ };
390
+
391
+ FieldValidator.request = function (createOptions, precheckInput) {
392
+ var validator = new FieldValidator();
393
+
394
+ validator.precheck = precheckInput;
395
+ if (typeof precheckInput === "undefined") {
396
+ validator.precheck = function (formField) {
397
+ var input = formField.input().val();
398
+
399
+ if (input === "undefined" || input === "") {
400
+ this.error("Field can't be empty");
401
+ return true;
402
+ }
403
+
404
+ if (!this.uniqueChanged(input)) {
405
+ return true;
406
+ }
407
+ this.setUnique(input);
408
+ return false;
409
+ };
410
+ }
411
+
412
+ validator.validate = function (formField, notifyResult) {
413
+ if (this.precheck(formField)) {
414
+ notifyResult(this);
415
+ return;
416
+ }
417
+ var options = createOptions(formField);
418
+ options.context = this;
419
+
420
+ options.complete = function () {
421
+ notifyResult(this);
422
+ };
423
+
424
+ sendApiRequest(options);
425
+
426
+ this.waiting();
427
+ notifyResult(this);
428
+ };
429
+
430
+ return validator;
431
+ };
432
+
433
+ FieldValidator.regex = function (regex, errorMessage, selector) {
434
+ selector = typeof selector !== "undefined" ? selector : "input";
435
+
436
+ var validator = new FieldValidator();
437
+ validator.message = errorMessage;
438
+
439
+ validator.validate = function (formField, notifyResult) {
440
+ if (regex.test(formField.main().find(selector).val())) {
441
+ validator.valid();
442
+ } else {
443
+ validator.error(errorMessage);
444
+ }
445
+ notifyResult(this);
446
+ };
447
+
448
+ return validator;
449
+ };
450
+
451
+ ////////// SignupForm
452
+
453
+ function SignupForm() {
454
+
455
+ this.formFields = {};
456
+
457
+ this.submitButton = {
458
+
459
+ isEnabled: function () {
460
+ return !this.main().attr("disabled");
461
+ },
462
+
463
+ setEnabled: function (value) {
464
+ if (value) {
465
+ this.main().removeAttr("disabled");
466
+ } else {
467
+ this.main().attr("disabled", true);
468
+ }
469
+ },
470
+
471
+ main: _generateAccessor("_main", function (reset) {
472
+ return jQuery("#createButtonmain");
473
+ }),
474
+
475
+ text: _generateAccessor("_text", function (reset) {
476
+ return jQuery("#createButtontextSpan");
477
+ })
478
+ };
479
+
480
+ this.errorField = {
481
+ display: function (message) {
482
+ if (message) {
483
+ this.main().html("<div>" + message + "</div>")
484
+ } else {
485
+ this.main().html("");
486
+ }
487
+ },
488
+
489
+ main: _generateAccessor("_main", function (reset) {
490
+ return jQuery("#signUpError");
491
+ })
492
+ }
493
+ }
494
+
495
+ SignupForm.prototype = {
496
+ constructor: SignupForm,
497
+
498
+ block: _generateAccessor("_block", function (reset) {
499
+ return jQuery("#signup");
500
+ }),
501
+
502
+ getField: function (name) {
503
+ if (!this.formFields[name]) {
504
+ this.formFields[name] = new FormField(name);
505
+ }
506
+ return this.formFields[name];
507
+ },
508
+
509
+ setPaymentMethod: function (paymentMethod) {
510
+ if (this.paymentMethod) {
511
+ this.paymentMethod.disable();
512
+ }
513
+ if (paymentMethod) {
514
+ paymentMethod.enable();
515
+ }
516
+ this.paymentMethod = paymentMethod;
517
+ }
518
+ };
519
+
520
+ // Progress loader
521
+ function ProgressLoader() {
522
+ this.dots = "";
523
+ }
524
+
525
+ ProgressLoader.prototype = {
526
+ constructor: ProgressLoader(),
527
+
528
+ block: _generateAccessor("_block", function (reset) {
529
+ return jQuery('#loader');
530
+ }),
531
+
532
+ label: _generateAccessor("_label", function (reset) {
533
+ return this.block(reset).find(".loader-label");
534
+ }),
535
+
536
+ percent: _generateAccessor("_percent", function (reset) {
537
+ return this.block(reset).find(".percentage");
538
+ }),
539
+
540
+ bar: _generateAccessor("_bar", function (reset) {
541
+ return this.block(reset).find(".progress-bar");
542
+ }),
543
+
544
+ setProgress: function (progress) {
545
+ this.bar().width(progress + "%");
546
+ this.percent().text(progress + "%");
547
+ var label = this.label();
548
+ if(this.dots.length > 2) {
549
+ this.dots = ".";
550
+ } else {
551
+ this.dots += ".";
552
+ }
553
+ if (progress <= 33) {
554
+ label.text("Installing" + this.dots);
555
+ } else if (progress <= 66) {
556
+ label.text("Launching" + this.dots);
557
+ } else if (progress == 100){
558
+ label.text("Redirecting" + this.dots);
559
+ } else {
560
+ label.text("Finalizing" + this.dots);
561
+ }
562
+ }
563
+ };
564
+
565
+ // progress loader init
566
+ var progressLoader = new ProgressLoader();
567
+ ////// signup form init ///////
568
+ var sF = new SignupForm();
569
+
570
+ (function (f) {
571
+ var identifier = "__generatedField__";
572
+ f.nameField = identifier;
573
+ f.mailField = identifier;
574
+ f.domainField = identifier;
575
+
576
+ for (var property in f) {
577
+ if (f.hasOwnProperty(property)
578
+ && f[property] === identifier) {
579
+ f[property] = f.getField(property);
580
+ }
581
+ }
582
+ })(sF);
583
+ ///////////////////////////////
584
+ // SignupLogic file
585
+
586
+ function parseError(response, def) {
587
+ if (response.status == 500) {
588
+ return def;
589
+ }
590
+ try {
591
+ var errorData = JSON.parse(response.responseText);
592
+ return errorData.message;
593
+ } catch (ignore) {
594
+ }
595
+ return def;
596
+ }
597
+
598
+ function setEvents(formField) {
599
+ formField.validateOn("focusout")
600
+ .validateOn("keyup", 500)
601
+ .validateOn("change", 500);
602
+ }
603
+
604
+ function initNameField() {
605
+ var nameField = sF.nameField;
606
+ nameField.registerValidator(FieldValidator.textLength());
607
+ setEvents(nameField);
608
+ }
609
+
610
+ function initMailField() {
611
+ //var mailRegex = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
612
+ var mailRegex = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
613
+ var regexMailValidator = FieldValidator.regex(mailRegex, "Email invalid");
614
+ var mailField = sF.mailField;
615
+ mailField.registerValidator(regexMailValidator);
616
+ setEvents(mailField);
617
+ }
618
+
619
+ function initDomainField() {
620
+ var crmOptionsCreator = function (formField) {
621
+ var options = new Api.domainCheck();
622
+
623
+ options.params = {
624
+ productId: product_id,
625
+ subdomain: formField.input().val()
626
+ };
627
+
628
+ options.success = function () {
629
+ this.valid("Domain is valid");
630
+ };
631
+
632
+ options.error = function (jqxhr) {
633
+ this.error(parseError(jqxhr, "Failed to validate domain"));
634
+ };
635
+
636
+ return options;
637
+ };
638
+ var crmDomainValidator = FieldValidator.request(crmOptionsCreator);
639
+
640
+ var domainField = sF.domainField;
641
+ domainField.registerValidator(crmDomainValidator);
642
+ setEvents(domainField);
643
+
644
+ domainField.input().alphanum({
645
+ allow: "-0123456789", // Allow extra characters
646
+ disallow: "", // Disallow extra characters
647
+ allowSpace: false, // Allow the space character
648
+ allowNumeric: true, // Allow digits 0-9
649
+ allowUpper: true, // Allow upper case characters
650
+ allowLower: true, // Allow lower case characters
651
+ allowCaseless: false, // Allow characters that don't have both upper &
652
+ // lower variants - eg Arabic or Chinese
653
+ allowLatin: true, // a-z A-Z
654
+ allowOtherCharSets: false, // eg ? ? Arabic, Chinese etc
655
+ forceLower: true
656
+ });
657
+ }
658
+
659
+ function initFormFields() {
660
+ initNameField();
661
+ initMailField();
662
+ initDomainField();
663
+ }
664
+
665
+ function doLoading(subscription) {
666
+ //setVisible(progressLoader.block(), false);
667
+ //setVisible(jQuery("#completed"), true);
668
+ //
669
+
670
+ var options = new Api.installProgress(subscription.id);
671
+
672
+ options.success = function (data) {
673
+ console.log(JSON.stringify(data));
674
+ if (data.account_status == undefined || data.progress == undefined) {
675
+ progressLoader.setProgress(0);
676
+ progressLoader.label().text("Failed to retrieve valid progress info.");
677
+ setTimeout(function () {
678
+ doLoading(subscription);
679
+ }, 700);
680
+ return;
681
+ }
682
+ if (data.account_status == 'I') {
683
+ progressLoader.setProgress(data.progress);
684
+ setTimeout(function () {
685
+ doLoading(subscription);
686
+ }, 700);
687
+ } else {
688
+ progressLoader.setProgress(100);
689
+ var redirectForm = '<form method="POST" action="' + jQuery('#continue').val() +
690
+ '"><input type="hidden" name="la-full-name" value="' + requestData.customer.name +
691
+ '"><input type="hidden" name="la-owner-email" value="' + requestData.customer.email +
692
+ '"><input type="hidden" name="la-url" value="' + requestData.subdomain +
693
+ '"><input type="hidden" name="apiKey" value="' + requestData.initial_api_key +
694
+ '"><input type="hidden" name="AuthToken" value="' + data.login_token +
695
+ '"><input type="hidden" name="action" value="r"/><input type="hidden" name="form_key" value="' + formKey + '"/></form>';
696
+ jQuery(redirectForm).appendTo('body').submit();
697
+ }
698
+ };
699
+
700
+ options.error = function (jqxhr) {
701
+ progressLoader.label().text(parseError(jqxhr, "Something went wrong when retrieving progress."));
702
+ };
703
+
704
+ sendApiRequest(options);
705
+ }
706
+
707
+ function completeSignup(subscription) {
708
+ setVisible(sF.block(), false);
709
+ setVisible(progressLoader.block(), true);
710
+ ga('send', 'event', 'LA SignUp', jQuery('#plan').val());
711
+ jQuery('<img height="1" width="1" src="//www.googleadservices.com/pagead/conversion/966671101/imp.gif?label=ER6zCKjv_1cQ_fX4zAM&amp;guid=ON&amp;script=0" />').appendTo('#signup');
712
+ doLoading(subscription);
713
+ }
714
+
715
+ function sendSignupRequest(signupData) {
716
+ var errorField = sF.errorField;
717
+ var submitButton = sF.submitButton;
718
+
719
+ var options = new Api.signup();
720
+ options.data = signupData;
721
+ requestData = signupData;
722
+ formKey = jQuery('#form_key').val();
723
+
724
+ options.success = function (subscription) {
725
+ completeSignup(subscription);
726
+ };
727
+
728
+ options.error = function (jqxhr) {
729
+ errorField.display(parseError(jqxhr, "Something went wrong."));
730
+ submitButton.setEnabled(true);
731
+ submitButton.text().html("Start now");
732
+ };
733
+
734
+ sendApiRequest(options);
735
+ }
736
+
737
+ function submitSignup(revalidate) {
738
+ var formStates = FormField.states;
739
+ var errorField = sF.errorField;
740
+ var button = sF.submitButton;
741
+
742
+ var error = false;
743
+ var wait = false;
744
+
745
+ for (var fieldName in sF.formFields) {
746
+ var field = sF.formFields[fieldName];
747
+ if (!field.isActive()) {
748
+ console.info(fieldName + " inactive");
749
+ continue;
750
+ }
751
+ console.info("Checking field: " + fieldName + "...");
752
+ if (field.getState() === FormField.states.error) {
753
+ if (!revalidate) {
754
+ console.warn("Error");
755
+ error = true;
756
+ continue;
757
+ }
758
+ console.warn("Error: Validating...");
759
+ field.validate();
760
+ switch (field.getState()) {
761
+ case formStates.waiting:
762
+ wait = true;
763
+ console.log("new status: Waiting...");
764
+ break;
765
+ case formStates.error:
766
+ error = true;
767
+ console.warn("new status: Error");
768
+ break;
769
+ default:
770
+ console.log("new status: Valid");
771
+ }
772
+ continue;
773
+ }
774
+ if (field.getState() === formStates.waiting) {
775
+ console.log("Waiting...");
776
+ wait = true;
777
+ }
778
+ }
779
+
780
+ var defaultButtonText = "Start now";
781
+
782
+ if (error) {
783
+ console.warn("ERROR: form not submitted");
784
+ console.log("\n---------------------------------\n\n");
785
+ errorField.display("Some fields are invalid");
786
+ button.text().html(defaultButtonText);
787
+ button.setEnabled(true);
788
+ return;
789
+ }
790
+ if (wait) {
791
+ console.log("WAIT: form submit rescheduled");
792
+ console.log("\n---------------------------------\n\n");
793
+ errorField.display("");
794
+ button.text().html("Validating...");
795
+ setTimeout(function () {
796
+ submitSignup(false);
797
+ }, 500);
798
+ return;
799
+ }
800
+ console.info("SUCCESS: form submitted");
801
+ console.log("\n---------------------------------\n\n");
802
+
803
+ errorField.display("");
804
+ button.text().html("Creating...");
805
+ sendSignupRequest({
806
+ variation_id: variationId,
807
+ subdomain: sF.domainField.value(),
808
+ source_id: source,
809
+ initial_api_key: randomString(),
810
+ customer: {
811
+ name: sF.nameField.value(),
812
+ email: sF.mailField.value()
813
+ }
814
+ });
815
+ }
816
+
817
+ function initFormButton() {
818
+ var button = sF.submitButton;
819
+
820
+ button.main().click(function () {
821
+ if (!button.isEnabled()) {
822
+ return;
823
+ }
824
+ button.setEnabled(false);
825
+ submitSignup(true);
826
+ });
827
+ }
828
+
829
+ jQuery(function () {
830
+ initFormFields();
831
+ initFormButton();
832
+
833
+ jQuery.fn.ghostInput = function(options) {
834
+ var o = jQuery.extend({
835
+ ghostText: ".domain.com",
836
+ ghostPlaceholder: "Add subdomain",
837
+ ghostTextClass: "domain"
838
+ }, options);
839
+ return this.each(function(i, element) {
840
+ var $element = jQuery(element);
841
+ if($element.ghostInputValidate)
842
+ return true;
843
+ $element.ghostInputValidate = true;
844
+ var r = $element.attr("id") || "";
845
+ o.ghostText = $element.attr("data-ghost-text") || o.ghostText;
846
+ o.ghosttextspan = jQuery("<label />").text("");
847
+ o.ghostHider = jQuery("<label />").css({"visibility":"hidden"});
848
+ o.ghostBox = jQuery("<label />").attr("for", r).addClass(o.ghostTextClass).append(o.ghostHider).append(o.ghosttextspan);
849
+ $element.parent().prepend(o.ghostBox);
850
+ $element.bind("keyup keydown keypress change",function() {
851
+ setTimeout(function() {
852
+ var t = "" == jQuery.trim($element.val()) ? "": o.ghostText;
853
+ o.ghostHider.text($element.val());
854
+ o.ghosttextspan.text(t)
855
+ }, 0)
856
+ });
857
+ o.ghostBox.bind("click",function() {
858
+ $element.focus();
859
+ });
860
+ return true;
861
+ });
862
+ };
863
+ jQuery("#domainFieldinnerWidget").ghostInput();
864
+ });
865
+ })();
skin/adminhtml/default/default/liveagent/js/jquery.validate.min.js DELETED
@@ -1,4 +0,0 @@
1
- /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
2
- * http://jqueryvalidation.org/
3
- * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
4
- !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
 
 
 
 
skin/adminhtml/default/default/liveagent/js/lasignup.js CHANGED
@@ -1,137 +1,26 @@
1
- var apikey = "jx5imiBhB6K12zui03YJL0lumHOr7S5T";
2
- var productid = "b229622b";
3
- var languageCode = 'en-US';
4
- var redirectAfterSignupToNewWindow = true;
5
-
6
- var valid_sub = false;
7
- var valid_email = false;
8
- var valid_name = false;
9
- var last_valid_sub = "";
10
- var last_valid_email = "";
11
- var token = false;
12
- var timer;
13
- var ccnotrequired = true;
14
- var stripesAnim;
15
- var button_text;
16
- var sending = false;
17
- var requestData = null;
18
- var formKey = '';
 
 
 
19
 
20
  jQuery(function($) {
21
- function stripesAnimate() {
22
- animating();
23
- stripesAnim = setInterval(animating, 2500);
24
- }
25
-
26
- function animating() {
27
- $('.progress-stripes').animate({
28
- marginLeft: "-=30px"
29
- }, 2500, "linear").append('/');
30
- }
31
-
32
- var translateMe = function(phrase) {
33
- if (typeof translations == "undefined") return phrase;
34
- if(translations.hasOwnProperty(phrase)) return translations[phrase];
35
- return phrase;
36
- }
37
-
38
- var setProgress = function(progress) {
39
- if (progress == null) {
40
- progress = 0;
41
- }
42
- $('.progress-bar').width(progress + "%");
43
- if(progress <= 33) {
44
- $('.loader-label').text(translateMe("Installing..."));
45
- } else if(progress <= 66) {
46
- $('.loader-label').text(translateMe("Launching..."));
47
- } else {
48
- $('.loader-label').text(translateMe("Coffee time!"));
49
- }
50
- $('.percentage').text(progress + "%");
51
- }
52
-
53
- var loading = function(account_id) {
54
- var check_url = "https://signup.ladesk.com/api/accounts/" + account_id + "/installprogress?apikey=" + apikey;
55
- $.ajax({
56
- type: "GET",
57
- url: check_url,
58
- success: function(my_data, textStatus, request) {
59
- console.log(my_data.response);
60
- if (my_data.response.account_status != 'a') {
61
- setProgress(my_data.response.progress);
62
- setTimeout(function() {loading(account_id);}, 700);
63
- } else {
64
- $('.progress-bar').width("100%");
65
- $('.loader-label').text(translateMe("Redirecting..."));
66
- $('.percentage').text("100%");
67
- redirectForm = '<form method="POST" action="' + $('#continue').val() +
68
- '"><input type="hidden" name="la-full-name" value="' + requestData.customer_name +
69
- '"><input type="hidden" name="la-owner-email" value="' + requestData.customer_email +
70
- '"><input type="hidden" name="la-url" value="' + requestData.subdomain +
71
- '"><input type="hidden" name="apiKey" value="' + requestData.initial_api_key +
72
- '"><input type="hidden" name="AuthToken" value="' + my_data.response.login_token +
73
- '"><input type="hidden" name="action" value="r"/><input type="hidden" name="form_key" value="' + formKey + '"/></form>';
74
- $(redirectForm).appendTo('body').submit();
75
- }
76
- },
77
- error: function(data, textStatus, errorThrown) {
78
- console.log(data.responseJSON.response.errormessage);
79
- },
80
- dataType: "json"
81
- });
82
- }
83
-
84
- var hideSingupForm = function(response) {
85
- //ga('send', 'event', 'LA SignUp', $('#plan').val());
86
- $('#signup').hide(300);
87
- if (response.cloud_type == "S") {
88
- $('#loader').show(300);
89
- stripesAnimate();
90
- loading(response.account_id, requestData);
91
- } else {
92
- $('#completed').removeClass("invisible");
93
- $('#completed').addClass("visible");
94
- $('#completed').addClass("mainBox");
95
- }
96
- }
97
-
98
- var doSignUpRequest = function() {
99
- var check_url = "https://signup.ladesk.com/api/accounts?apikey=" + apikey;
100
- var extra = {};
101
- if (typeof language_custom != 'undefined') {
102
- languageCode = language_custom;
103
- }
104
- var data = {
105
- variation_id: $('#variation').val(),
106
- customer_email: $('#mailFieldinnerWidget').val(),
107
- customer_name: $('#nameFieldinnerWidget').val(),
108
- subdomain: $('#domainFieldinnerWidget').val(),
109
- location_id: "magento",
110
- language: languageCode,
111
- apikey: apikey,
112
- initial_api_key: randomString(),
113
- extra_params: JSON.stringify(extra)
114
- };
115
- $.ajax({
116
- type: "POST",
117
- url: check_url,
118
- data: data,
119
- success: function(my_data, textStatus, request) {
120
- console.log(my_data.response);
121
- requestData = data;
122
- formKey = $('#form_key').val();
123
- hideSingupForm(my_data.response);
124
- },
125
- error: function (data, textStatus, errorThrown) {
126
- console.log(data.responseJSON.response.errormessage);
127
- $('#createButtonmain').removeAttr("disabled");
128
- $('#createButtontextSpan').html(translateMe('Start now'));
129
- sending = false;
130
- },
131
- dataType: "json"
132
- });
133
- }
134
-
135
  $.fn.setButton = function(buttonId) {
136
  var res = $("textarea#" + buttonId).val();
137
  $("textarea#la-config-button-code").val(res);
@@ -143,131 +32,6 @@ jQuery(function($) {
143
  $.fn.getIframePreviewCode = function(id) {
144
  $('#iFramePreview' + id).contents().find("body").html($('#iFrame' + id).val());
145
  }
146
-
147
- $.fn.addError = function(message) {
148
- this.removeClass("g-FormField2-Error");
149
- this.removeClass("g-FormField2-Waiting");
150
- this.removeClass("g-FormField2-Valid");
151
- this.addClass("g-FormField2-Error");
152
- $(this).find('.g-FormField2-Message').html(message);
153
- }
154
-
155
- $.fn.addValidating = function(message) {
156
- this.removeClass("g-FormField2-Error");
157
- this.removeClass("g-FormField2-Waiting");
158
- this.removeClass("g-FormField2-Valid");
159
- this.addClass("g-FormField2-Waiting");
160
- $(this).find('.g-FormField2-Message').html(message);
161
- }
162
-
163
- $.fn.addOk = function(message) {
164
- this.removeClass("g-FormField2-Error");
165
- this.removeClass("g-FormField2-Waiting");
166
- this.removeClass("g-FormField2-Valid");
167
- this.addClass("g-FormField2-Valid");
168
- $(this).find('.g-FormField2-Message').html(message);
169
- }
170
-
171
- $.fn.removeError = function() {
172
- this.removeClass("g-FormField2-Error");
173
- this.removeClass("g-FormField2-Waiting");
174
- this.removeClass("g-FormField2-Valid");
175
- $(this).find('.g-FormField2-Message').html("");
176
- }
177
-
178
- var sendForm = function() {
179
- if ((valid_sub) && (valid_email) && (valid_name) && (ccnotrequired||token)) {
180
- doSignUpRequest();
181
- } else {
182
- if(!$('#mailFieldmain input').val()) {
183
- $('#mailFieldmain').addError(translateMe("Your email goes here"));
184
- }
185
- if(!$('#nameFieldmain input').val()) {
186
- $('#nameFieldmain').addError(translateMe("Fill in your name"));
187
- }
188
- if(!$('#domainFieldmain input').val()) {
189
- $('#domainFieldmain').addError(translateMe("Choose a unique name"));
190
- }
191
- $('#createButtonmain').removeAttr("disabled");
192
- $('#createButtontextSpan').html(translateMe(button_text));
193
- sending = false;
194
- }
195
- };
196
-
197
- $.fn.validateName = function() {
198
- if(!$('#nameFieldmain input').val()) {
199
- valid_name = false;
200
- $('#nameFieldmain').addError(translateMe("Fill in your name"));
201
- } else {
202
- valid_name = true;
203
- $('#nameFieldmain').addOk("");
204
- }
205
- }
206
-
207
- $.fn.validateEmail = function() {
208
- var email= encodeURIComponent($('#mailFieldmain input').val());
209
- var check_url = "https://signup.ladesk.com/api/signupcheck/email?apikey=" + apikey + "&productid=" + productid + "&email=" + email;
210
- var my_data;
211
- valid_email = false;
212
- $('#mailFieldmain').addValidating(translateMe("Validating email..."));
213
- $.ajax({
214
- url: check_url,
215
- data: my_data,
216
- success: function(my_data, textStatus, request) {
217
- console.log(my_data.response);
218
- if (my_data.response.is_valid == "true") {
219
- $('#mailFieldmain').addOk(translateMe("Email OK."));
220
- valid_email = true;
221
- last_valid_email = email;
222
- } else {
223
- $('#mailFieldmain').addError(translateMe("Yikes! This email is already in use"));
224
- }
225
- },
226
- error: function (my_data, textStatus, errorThrown) {
227
- $('#mailFieldmain').addError(translateMe("Whoops, enter a valid email"));
228
- console.log(my_data.responseJSON.response.errormessage);
229
- },
230
- dataType: "json"
231
- });
232
- }
233
-
234
- $.fn.validateDomain = function() {
235
- var subdomain = $('#domainFieldmain input').val();
236
- if (subdomain == '') {return true;}
237
- var check_url = "https://signup.ladesk.com/api/signupcheck/domain?apikey=" + apikey + "&productid=" + productid + "&subdomain=" + subdomain;
238
- var my_data;
239
- valid_sub = false;
240
- $('#domainFieldmain').addValidating(translateMe("Validating domain..."));
241
- $.ajax({
242
- url: check_url,
243
- data: my_data,
244
- dataType: 'json',
245
- success: function(my_data) {
246
- console.log(my_data.response);
247
- $('#domainFieldmain').addError(translateMe(my_data.response.error));
248
- if (!my_data.response.error) {
249
- $('#domainFieldmain').addOk(translateMe("Domain is valid"));
250
- valid_sub = true;
251
- last_valid_sub = subdomain;
252
- }
253
- },
254
- error: function (my_data, textStatus, errorThrown) {
255
- $('#domainFieldmain').addError(translateMe("Problem with domain. Contact our support, please."));
256
- console.log(my_data.responseJSON.response.errormessage);
257
- },
258
- })
259
- }
260
-
261
- var randomString = function() {
262
- var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
263
- var string_length = 32;
264
- var randomstring = '';
265
- for (var i=0; i < string_length; i++) {
266
- var rnum = Math.floor(Math.random() * chars.length);
267
- randomstring += chars.substring(rnum, rnum + 1);
268
- }
269
- return randomstring;
270
- }
271
 
272
  var replacePlaceholder = function() {
273
  var widgetCode = $('textarea#' + $('#buttonId').val() ).val();
@@ -282,134 +46,27 @@ jQuery(function($) {
282
  if ($('#configOptionPhone').is(':checked')) {
283
  result += "%%phone%%";
284
  }
285
- /*if ($('#configOptionOrder').is(':checked')) {
286
- result += "%%order%%";
287
- }*/
288
  $('textarea#la-config-button-code').val([widgetCode.slice(0, pos), result, widgetCode.slice(pos)].join(''));
289
  $('.SaveWidgetCode').show();
290
  }
291
-
292
- if (typeof productid == 'undefined') {
293
- productid = default_productid;
294
- }
295
-
296
- $('#domainFieldmain input').alphanum({
297
- allow : '-0123456789', // Allow extra characters
298
- disallow : '', // Disallow extra characters
299
- allowSpace : false, // Allow the space character
300
- allowNumeric : true, // Allow digits 0-9
301
- allowUpper : true, // Allow upper case characters
302
- allowLower : true, // Allow lower case characters
303
- allowCaseless : false, // Allow characters that don't have both upper & lower variants - eg Arabic or Chinese
304
- allowLatin : true, // a-z A-Z
305
- allowOtherCharSets : false, // eg é, Á, Arabic, Chinese etc
306
- forceLower : true
307
- });
308
-
309
- $('#domainFieldmain').on('keyup', function() {
310
- clearInterval(timer);
311
- timer = setTimeout(function() {
312
- $.fn.validateDomain();
313
- }, 500);
314
- });
315
 
316
  $('textarea#la-config-button-code').on('change', function() {
317
  $('.SaveWidgetCode').show();
318
  });
319
-
320
- $('#domainFieldmain').on('change', function() {
321
- if(!$('#domainFieldmain input').val()) {
322
- $('#domainFieldmain').addError(translateMe("Choose a unique name"));
323
- } else {
324
- if($('#domainFieldmain input').val() != last_valid_sub) {
325
- $.fn.validateDomain();
326
- }
327
- }
328
- });
329
-
330
- $("#mailFieldmain").on('keyup', function() {
331
- $('#mailFieldmain').removeError();
332
- clearInterval(timer);
333
- timer = setTimeout(function() {
334
- $.fn.validateEmail();
335
- }, 500);
336
- });
337
-
338
- $('#mailFieldmain').focusout(function() {
339
- $('#mailFieldmain').removeError();
340
- if(!$('#mailFieldmain input').val()) {
341
- $('#mailFieldmain').addError(translateMe("Your email goes here"));
342
- } else {
343
- if($('#mailFieldmain input').val() != last_valid_email) {
344
- $.fn.validateEmail();
345
- }
346
- }
347
- });
348
-
349
- $('#mailFieldmain').on('change', function() {
350
- $('#mailFieldmain').removeError();
351
- if(!$('#mailFieldmain input').val()) {
352
- $('#mailFieldmain').addError(translateMe("Your email goes here"));
353
- } else {
354
- $.fn.validateEmail();
355
- }
356
- });
357
-
358
- $('#nameFieldmain').focusout(function() {
359
- $.fn.validateName();
360
- });
361
-
362
- $('#nameFieldmain').on('change', function() {
363
- $.fn.validateName();
364
- });
365
-
366
- $('#createButtontextSpan').click(function() {
367
- if(!sending) {
368
- sending = true;
369
- $(this).attr("disabled", "disabled"); // Disable the submit button to prevent repeated clicks
370
- button_text = $('#createButtontextSpan').html();
371
- $('#createButtontextSpan').html(translateMe('Creating...'));
372
- sendForm();
373
- }
374
- return false;
375
  });
376
 
377
  $('.configOptions input').change(function () {
378
  replacePlaceholder();
379
  });
380
- });
381
-
382
- jQuery(function($) {
383
- $.fn.ghostInput = function(options) {
384
- var o = $.extend({
385
- ghostText: ".domain.com",
386
- ghostPlaceholder: "Add subdomain",
387
- ghostTextClass: "domain"
388
- }, options);
389
- return this.each(function(i, element) {
390
- var $element = $(element);
391
- if($element.ghostInputValidate)
392
- return true;
393
- $element.ghostInputValidate = true;
394
- var r = $element.attr("id") || "";
395
- o.ghostText = $element.attr("data-ghost-text") || o.ghostText;
396
- o.ghosttextspan = $("<label />").text("");
397
- o.ghostHider = $("<label />").css({"visibility":"hidden"});
398
- o.ghostBox = $("<label />").attr("for", r).addClass(o.ghostTextClass).append(o.ghostHider).append(o.ghosttextspan);
399
- $element.parent().prepend(o.ghostBox);
400
- $element.bind("keyup keydown keypress change",function() {
401
- setTimeout(function() {
402
- var t = "" == $.trim($element.val()) ? "": o.ghostText;
403
- o.ghostHider.text($element.val());
404
- o.ghosttextspan.text(t)
405
- }, 0)
406
- });
407
- o.ghostBox.bind("click",function() {
408
- $element.focus();
409
- });
410
- return true;
411
- });
412
- };
413
- $("#domainFieldinnerWidget").ghostInput();
414
- // Placeholdem( document.querySelectorAll( '.Placeholdem' ) );
415
  });
1
+ function randomString() {
2
+ var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
3
+ var string_length = 32;
4
+ var randomstring = '';
5
+ for (var i=0; i < string_length; i++) {
6
+ var rnum = Math.floor(Math.random() * chars.length);
7
+ randomstring += chars.substring(rnum, rnum + 1);
8
+ }
9
+ return randomstring;
10
+ }
11
+
12
+ (function(i,s,o,g,r,a,m){
13
+ i.GoogleAnalyticsObject=r;
14
+ i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
15
+ a=s.createElement(o),m=s.getElementsByTagName(o)[0];
16
+ a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
17
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
18
+ ga('create','UA-56486-1','auto',{allowLinker:true});
19
+ ga('require','linker');
20
+ ga('linker:autoLink',['qualityunit.com','ladesk.com','postaffiliatepro.com','unitminer.com','postaffiliatenetwork.com','getreply.com','swreg.org']);
21
+ ga('send','pageview');
22
 
23
  jQuery(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  $.fn.setButton = function(buttonId) {
25
  var res = $("textarea#" + buttonId).val();
26
  $("textarea#la-config-button-code").val(res);
32
  $.fn.getIframePreviewCode = function(id) {
33
  $('#iFramePreview' + id).contents().find("body").html($('#iFrame' + id).val());
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  var replacePlaceholder = function() {
37
  var widgetCode = $('textarea#' + $('#buttonId').val() ).val();
46
  if ($('#configOptionPhone').is(':checked')) {
47
  result += "%%phone%%";
48
  }
49
+
 
 
50
  $('textarea#la-config-button-code').val([widgetCode.slice(0, pos), result, widgetCode.slice(pos)].join(''));
51
  $('.SaveWidgetCode').show();
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  $('textarea#la-config-button-code').on('change', function() {
55
  $('.SaveWidgetCode').show();
56
  });
57
+
58
+ $('#connectButtontextSpan').on('click', function() {
59
+ $('#configForm').submit();
60
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  });
62
 
63
  $('.configOptions input').change(function () {
64
  replacePlaceholder();
65
  });
66
+
67
+ $('#resetLink').on('click', function() {
68
+ if (confirm("This will RESET everything so you could start over. Do you agree?")) {
69
+ window.location.href = $('#resetUrl').val();
70
+ }
71
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  });