@alexsab-ru/scripts 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/calltouch.js CHANGED
@@ -3,7 +3,7 @@ export const createRequest = (routeKey, phoneValue, verbose = false) => {
3
3
  if(window.ctw) {
4
4
  window.ctw.getRouteKeyData(routeKey, function(success, data){
5
5
  verbose && console.log(success, data);
6
- if (success && data.widgetFound) {
6
+ if (success) {
7
7
  if (data.widgetFound) {
8
8
  if (data.widgetData.callCenterWorkingMode == 'working_hours') {
9
9
  verbose && console.log('колл-центр работает, отображение виджета');
package/lib/form.js CHANGED
@@ -120,7 +120,7 @@ const showMessageModal = (messageModal, icon, message) => {
120
120
  };
121
121
 
122
122
 
123
- export const connectForms = (url, callback, callback_error) => {
123
+ export const connectForms = (url, callback, callback_error, ct_routeKey = 'ct_callback', verbose = false) => {
124
124
 
125
125
  // Отправка всех форм
126
126
  document.querySelectorAll("form").forEach((form) => {
@@ -154,7 +154,7 @@ document.querySelectorAll("form").forEach((form) => {
154
154
  reachGoal("form_submit");
155
155
 
156
156
  // Отправка заявки на обратный возов в CallTouch
157
- createRequest("ct_callback", phone.value);
157
+ createRequest(ct_routeKey, phone.value, verbose);
158
158
 
159
159
  let formData = new FormData(form);
160
160
  if(getCookie('fta')) {
@@ -203,7 +203,7 @@ document.querySelectorAll("form").forEach((form) => {
203
203
  })
204
204
  .then((res) => res.json())
205
205
  .then((data) => {
206
- // console.log(data);
206
+ verbose && console.log(data);
207
207
  stateBtn(btn, "Отправить");
208
208
  if (data.answer == "required") {
209
209
  reachGoal("form_required");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexsab-ru/scripts",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "common libs for websites",
5
5
  "main": "index.js",
6
6
  "scripts": {