removido bun
This commit is contained in:
parent
98bcbff6cf
commit
430ff53c68
26 changed files with 2086 additions and 371 deletions
72
dist-back/NPS/index.js
Normal file
72
dist-back/NPS/index.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var NPS_exports = {};
|
||||
__export(NPS_exports, {
|
||||
abrirNps: () => abrirNps
|
||||
});
|
||||
module.exports = __toCommonJS(NPS_exports);
|
||||
var import_p_respostas = require("p-respostas");
|
||||
const abrirNps = (emDesenvolvimento) => async (parametros) => {
|
||||
const base_site = emDesenvolvimento ? "http://localhost:5040/nps" : "https://carro-de-boi.idz.one/nps";
|
||||
const base_api = `${base_site}/api`;
|
||||
const { sistema, inquilino, codigo_usuario } = parametros;
|
||||
const nome_local_storage_proxima = `nps_proxima_avaliacao_${sistema}_${codigo_usuario}_${inquilino}_0`;
|
||||
const proxima_avaliacao = localStorage.getItem(nome_local_storage_proxima);
|
||||
if (!proxima_avaliacao) {
|
||||
const url_proxima_avaliacao = new URL(
|
||||
`${base_api}/${sistema}/proxima_avaliacao`
|
||||
);
|
||||
for (const [chave, valor] of Object.entries(parametros)) {
|
||||
url_proxima_avaliacao.searchParams.append(chave, valor);
|
||||
}
|
||||
const response = await fetch(url_proxima_avaliacao.href).then(
|
||||
(resposta) => resposta.json()
|
||||
).catch((error) => import_p_respostas.respostaComuns.erro(error.message));
|
||||
const proxima_avaliacao2 = response.valor;
|
||||
proxima_avaliacao2 && localStorage.setItem(nome_local_storage_proxima, proxima_avaliacao2);
|
||||
}
|
||||
const abrir_modal = proxima_avaliacao && (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) >= proxima_avaliacao;
|
||||
if (!abrir_modal) {
|
||||
return;
|
||||
}
|
||||
localStorage.removeItem(nome_local_storage_proxima);
|
||||
const urlIfrma = new URL(base_site);
|
||||
for (const [chave, valor] of Object.entries(parametros)) {
|
||||
urlIfrma.searchParams.append(chave, valor);
|
||||
}
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = urlIfrma.href;
|
||||
iframe.style.position = "fixed";
|
||||
iframe.style.top = "0";
|
||||
iframe.style.left = "0";
|
||||
iframe.style.width = "100%";
|
||||
iframe.style.height = "100%";
|
||||
iframe.style.border = "none";
|
||||
iframe.style.zIndex = "999999";
|
||||
document.body.appendChild(iframe);
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.data === "fechar") {
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
});
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
abrirNps
|
||||
});
|
||||
16
dist-back/NPS/tipos_nps.js
Normal file
16
dist-back/NPS/tipos_nps.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var tipos_nps_exports = {};
|
||||
module.exports = __toCommonJS(tipos_nps_exports);
|
||||
Loading…
Add table
Add a link
Reference in a new issue