@alexsab-ru/scripts 0.5.3 → 0.5.4

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.
Files changed (2) hide show
  1. package/lib/form.js +6 -4
  2. package/package.json +1 -1
package/lib/form.js CHANGED
@@ -119,7 +119,7 @@ const showMessageModal = (messageModal, icon, message) => {
119
119
  messageModal.classList.remove("hidden");
120
120
  };
121
121
 
122
- export const connectForms = (url, callback, callback_error, ct_routeKey = 'ct_callback', verbose = false) => {
122
+ export const connectForms = (url, callback, callback_error, ct_routeKey = '', verbose = false) => {
123
123
 
124
124
  // Отправка всех форм
125
125
  document.querySelectorAll("form").forEach((form) => {
@@ -187,9 +187,11 @@ document.querySelectorAll("form").forEach((form) => {
187
187
  let formDataObj = {};
188
188
  try {
189
189
  // Отправка заявки на обратный возов в CallTouch
190
- const requestData = await createRequest(ct_routeKey, phone.value, verbose);
191
- formData.append("ct_callback", true);
192
- formData.append("ctw_createRequest", requestData);
190
+ if(ct_routeKey != '') {
191
+ const requestData = await createRequest(ct_routeKey, phone.value, verbose);
192
+ formData.append("ct_callback", true);
193
+ formData.append("ctw_createRequest", JSON.stringify(requestData));
194
+ }
193
195
  } catch (error) {
194
196
  formData.append("ctw_createRequest", error);
195
197
  verbose && console.error("Error during request Calltouch callback:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexsab-ru/scripts",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "common libs for websites",
5
5
  "main": "index.js",
6
6
  "scripts": {