Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@modulbank/sendamo

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modulbank/sendamo - npm Package Compare versions

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

41

dist/index.js

@@ -15,2 +15,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
function cookieSet(array, hour, domain) {
const getExpires = () => {
const date = new Date();
if (hour) {
date.setTime(date.getTime() + hour * 3600 * 1000);
return `expires=${date.toUTCString()};`;
}
return '';
};
const getDomain = () => {
if (domain)
return `domain=${domain};`;
return '';
};
for (const pair of array) {
document.cookie = `${pair[0]}=${pair[1]}; ${getDomain()} ${getExpires()} path=/`;
}
}
export default function SandAmo(amoUrl) {

@@ -56,7 +74,4 @@ const url = amoUrl;

// Идентификатор, если пришел в поисковых систем
let searchEngine = ((_a = window === null || window === void 0 ? void 0 : window.document) === null || _a === void 0 ? void 0 : _a.referrer) || current.src;
const utmSource = getCookie("utm_source");
if (utmSource) {
searchEngine = utmSource;
}
const searchEngine = utmSource !== undefined && utmSource !== '' ? utmSource : (((_a = window === null || window === void 0 ? void 0 : window.document) === null || _a === void 0 ? void 0 : _a.referrer) || current.src);
const params = {

@@ -86,3 +101,3 @@ // @ts-ignore

return new Promise((resolve, reject) => {
const url = new URL('https://postback.cityads.com/service/postback/');
const url = new URL('https://modulkassa.ru/postback-cityads/');
url.searchParams.set('campaign_secret', 'oPBnE0');

@@ -99,8 +114,6 @@ url.searchParams.set('order_id', orderId);

}
else {
throw new Error(yield response.json());
}
resolve(response.json());
}))
.catch((err) => {
reject(err);
resolve(err);
});

@@ -121,7 +134,11 @@ });

if (response.status === 200) {
const orderId = getCookie("order_id");
const clickId = getCookie("click_id");
const responseData = yield response.json();
const utmSource = getCookie("utm_source");
console.log(response);
if (utmSource === "cityads") {
let orderId = getCookie("order_id");
if (!orderId) {
orderId = responseData.lead_id;
cookieSet([['order_id', orderId]], 720);
}
const clickId = getCookie("click_id");
sendPostBack(clickId, orderId);

@@ -128,0 +145,0 @@ }

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc