UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

44 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.postTrackingDataToHubspot = void 0; const environment_1 = require("../environment"); const authentication_client_1 = require("./authentication-client"); async function postTrackingDataToHubspot(property, value) { if (environment_1.ALWAYSAI_DO_NOT_TRACK) { return; } let email = 'undefined'; try { ({ email } = await (0, authentication_client_1.CliAuthenticationClient)({ readonly: true }).getInfo()); } catch (e) { return; } const data = { properties: [ { property, value } ] }; const body = { data, email }; try { await fetch('https://ausfl8paoe.execute-api.us-west-2.amazonaws.com/dev2/post-survey-responses', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), redirect: 'follow' }); } catch (e) { return; } } exports.postTrackingDataToHubspot = postTrackingDataToHubspot; //# sourceMappingURL=post-tracking-data-to-hubspot.js.map