UNPKG

lisenser

Version:

Official JavaScript SDK for Lisenser API (https://lisenser.com/)

100 lines (93 loc) 4.33 kB
var $8zHUo$process = require("process"); var $8zHUo$axios = require("axios"); function $parcel$interopDefault(a) { return a && a.__esModule ? a.default : a; } function $parcel$export(e, n, v, s) { Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); } $parcel$export(module.exports, "getLicenseStatus", () => $882b6d93070905b3$export$ebe47cd59cea4b9b); $parcel$export(module.exports, "activateLicenseKey", () => $882b6d93070905b3$export$acdc80cc207756da); $parcel$export(module.exports, "getTrialStatus", () => $882b6d93070905b3$export$f75056ad8bae6312); $parcel$export(module.exports, "startTrial", () => $882b6d93070905b3$export$50b198a3e49f7f52); $parcel$export(module.exports, "requestOtpForLicenseReset", () => $882b6d93070905b3$export$6d8f8f07e4537969); $parcel$export(module.exports, "resetLicense", () => $882b6d93070905b3$export$7f962e2ef5df702b); $parcel$export(module.exports, "generate3rdPartyToken", () => $882b6d93070905b3$export$6c2bd30bee35e307); const $882b6d93070905b3$var$API_URL = "https://api.lisenser.com/v1"; async function $882b6d93070905b3$export$ebe47cd59cea4b9b(req) { const { licenseKey: key , machineId: machineId , productId: productId } = req; const urlSuffix = req.polling ? "?plg=true" : ""; const url = `${$882b6d93070905b3$var$API_URL}/license/status${urlSuffix}`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { key: key, machineId: machineId, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data; } async function $882b6d93070905b3$export$acdc80cc207756da(req) { const { licenseKey: key , machineId: machineId , productId: productId } = req; const url = `${$882b6d93070905b3$var$API_URL}/license/activate`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { key: key, machineId: machineId, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data; } async function $882b6d93070905b3$export$f75056ad8bae6312(productId, machineId) { const url = `${$882b6d93070905b3$var$API_URL}/trial/status`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { machineId: machineId, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data; } async function $882b6d93070905b3$export$50b198a3e49f7f52(productId, machineId) { const url = `${$882b6d93070905b3$var$API_URL}/trial/activate`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { machineId: machineId, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data; } async function $882b6d93070905b3$export$6d8f8f07e4537969(productId, licenseKey) { const url = `${$882b6d93070905b3$var$API_URL}/license/reset/send-otp`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { key: licenseKey, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data?.sent; } async function $882b6d93070905b3$export$7f962e2ef5df702b(otp, productId, licenseKey) { const url = `${$882b6d93070905b3$var$API_URL}/license/reset/commit`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { key: licenseKey, productId: productId, otp: otp }, $882b6d93070905b3$var$getHeaders()); return resp.data.data?.reset; } async function $882b6d93070905b3$export$6c2bd30bee35e307(req) { const { licenseKey: key , machineId: machineId , productId: productId } = req; const url = `${$882b6d93070905b3$var$API_URL}/3rd-party-token/generate`; const resp = await (0, ($parcel$interopDefault($8zHUo$axios))).post(url, { key: key, machineId: machineId, productId: productId }, $882b6d93070905b3$var$getHeaders()); return resp.data.data.token; } function $882b6d93070905b3$var$getHeaders() { // @ts-ignore if (typeof $8zHUo$process === "undefined") return {}; // @ts-ignore const { platform: platform } = $8zHUo$process; if (!platform) return {}; return { headers: { "User-Agent": `Lisenser JS SDK / ${platform}` } }; } //# sourceMappingURL=main.js.map