Socket
Socket
Sign inDemoInstall

@modulbank/sendamo

Package Overview
Dependencies
0
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.26-beta-sm-8778-integration-with-cityes-add-f179c01e to 0.0.26

2

dist/index.d.ts
import { iParams } from './types';
export default function SandAmo(amoUrl: string): {
takeParamsForSendAmo: (phoneNumber: string, name: string, actionType?: string, productCode?: string, comment?: string) => iParams;
sendAmo: (params: iParams) => Promise<{}>;
sendAmo: (params: any) => Promise<Response>;
};

@@ -99,31 +99,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', `https://postback.cityads.com/service/postback/?campaign_secret=oPBnE0&order_id=${orderId}&click_id=${clickId}`, true);
xhr.onload = function () {
if (xhr.status === 200) {
resolve(xhr.responseText);
// @ts-ignore
fetch(`/postback-cityads/?campaign_secret=oPBnE0&order_id=${orderId}&click_id=${clickId}`, {
method: 'GET',
})
.then((response) => __awaiter(this, void 0, void 0, function* () {
if (response.status === 200) {
resolve(response);
}
else {
reject(new Error(`Postback request failed with status: ${xhr.status}`));
throw new Error(yield response.json());
}
};
xhr.onerror = function () {
reject(new Error('Network error occurred during postback request.'));
};
xhr.send();
}))
.catch((err) => {
reject(err);
});
});
}
function sendAmo(params) {
return new Promise((resolve, reject) => {
// @ts-ignore
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
body: JSON.stringify(params),
})
.then((response) => __awaiter(this, void 0, void 0, function* () {
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
body: JSON.stringify(params),
});
if (response.status === 200) {
const responseData = yield response.json();
const utmSource = getCookie("utm_source");

@@ -133,2 +132,3 @@ if (utmSource === "cityads") {

if (!orderId) {
const responseData = yield response.json();
orderId = responseData.lead_id;

@@ -138,7 +138,5 @@ cookieSet([['order_id', orderId]], 720);

const clickId = getCookie("click_id");
sendPostBack(clickId, orderId).then(() => {
resolve(response);
});
yield sendPostBack(clickId, orderId);
}
resolve(response);
return response;
}

@@ -148,6 +146,6 @@ else {

}
}))
.catch((err) => {
reject(err);
});
}
catch (error) {
throw error;
}
});

@@ -154,0 +152,0 @@ }

{
"name": "@modulbank/sendamo",
"version": "0.0.26-beta-sm-8778-integration-with-cityes-add-f179c01e",
"version": "0.0.26",
"description": "send to amocrm method",

@@ -5,0 +5,0 @@ "homepage": "",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc