@modulbank/sendamo
Advanced tools
Comparing version 0.0.26-beta-sm-8778-integration-with-cityes-add-9d99acaa to 0.0.26-beta-sm-8778-integration-with-cityes-add-c2967bd3
@@ -55,3 +55,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
// Идентификатор, если пришел в поисковых систем | ||
const searchEngine = ((_a = window === null || window === void 0 ? void 0 : window.document) === null || _a === void 0 ? void 0 : _a.referrer) ? getCookie("utm_source") : "current.src"; | ||
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 params = { | ||
@@ -81,8 +85,9 @@ // @ts-ignore | ||
return new Promise((resolve, reject) => { | ||
const url = new URL('https://postback.cityads.com/service/postback/'); | ||
url.searchParams.set('campaign_secret', 'oPBnE0'); | ||
url.searchParams.set('order_id', orderId); | ||
url.searchParams.set('click_id', clickId); | ||
// @ts-ignore | ||
fetch(`https://postback.cityads.com/service/postback/?campaign_secret=oPBnE0&order_id='\'${orderId}&click_id=${clickId}`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json;charset=utf-8', | ||
} | ||
fetch(url.toString(), { | ||
method: 'GET' | ||
}) | ||
@@ -114,5 +119,7 @@ .then((response) => __awaiter(this, void 0, void 0, function* () { | ||
if (response.status === 200) { | ||
const orderId = getCookie("order_id"); | ||
const responseData = yield response.json(); | ||
const orderId = getCookie("order_id") || responseData.lead_id; | ||
const clickId = getCookie("click_id"); | ||
if (clickId && orderId) { | ||
const utmSource = getCookie("utm_source"); | ||
if (utmSource === "cityads") { | ||
sendPostBack(clickId, orderId); | ||
@@ -119,0 +126,0 @@ } |
{ | ||
"name": "@modulbank/sendamo", | ||
"version": "0.0.26-beta-sm-8778-integration-with-cityes-add-9d99acaa", | ||
"version": "0.0.26-beta-sm-8778-integration-with-cityes-add-c2967bd3", | ||
"description": "send to amocrm method", | ||
@@ -5,0 +5,0 @@ "homepage": "", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8327
183