From 680566f99a65790fe5cc21b19035a179fc2d51d0 Mon Sep 17 00:00:00 2001 From: uparkalau <132397574+uparkalau@users.noreply.github.com> Date: Sun, 29 Sep 2024 23:00:18 -0700 Subject: [PATCH 1/8] feat(WIP): Implement secure script delivery and popup rendering - Added secure endpoint to serve popupRenderer.js script with API ID validation - Implemented middleware for API ID and client ID validation - Adjusted main index file to include new script route - Updated client-side HTML/JavaScript snippet for secure script fetching --- backend/index.js | 6 ++- backend/public/scripts/bannerRender.js | 0 backend/public/scripts/popupRender.js | 52 +++++++++++++++++++ backend/public/snippets/popupSnippet.html | 30 +++++++++++ .../onboard/bannerData.controller.js | 12 +++++ backend/src/controllers/onboard/index.js | 7 +++ .../onboard/popupData.controller.js | 13 +++++ .../onboard/tourData.controller.js | 13 +++++ backend/src/middleware/onboard.middleware.js | 35 +++++++++++++ backend/src/routes/onboard.routes.js | 15 ++++++ backend/src/routes/script.routes.js | 0 backend/src/scripts/popup.script.js | 0 backend/src/service/popup.service.js | 18 +++++++ 13 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 backend/public/scripts/bannerRender.js create mode 100644 backend/public/scripts/popupRender.js create mode 100644 backend/public/snippets/popupSnippet.html create mode 100644 backend/src/controllers/onboard/bannerData.controller.js create mode 100644 backend/src/controllers/onboard/index.js create mode 100644 backend/src/controllers/onboard/popupData.controller.js create mode 100644 backend/src/controllers/onboard/tourData.controller.js create mode 100644 backend/src/middleware/onboard.middleware.js create mode 100644 backend/src/routes/onboard.routes.js create mode 100644 backend/src/routes/script.routes.js create mode 100644 backend/src/scripts/popup.script.js diff --git a/backend/index.js b/backend/index.js index 0472de5e..5d589f98 100644 --- a/backend/index.js +++ b/backend/index.js @@ -14,7 +14,8 @@ const mocks = require('./src/routes/mocks.routes'); const popup = require('./src/routes/popup.routes'); const popup_log = require('./src/routes/popuplog.routes'); const banner = require('./src/routes/banner.routes'); -// const tourRoutes = require('./src/routes/tour.routes'); +const onboardRoutes = require('./src/routes/onboard.routes'); +// const scriptRoutes = require('./src/routes/script.routes'); const app = express(); @@ -42,7 +43,8 @@ app.use('/api/mock/', mocks); app.use('/api/popup', popup); app.use('/api/popup_log', popup_log); app.use('/api/banner', banner); -// app.use('/api/tours', tourRoutes); +app.use('/api/onboard', onboardRoutes); +// app.use('/api/scripts', scriptRoutes); app.use((err, req, res, next) => { console.error(err.stack); diff --git a/backend/public/scripts/bannerRender.js b/backend/public/scripts/bannerRender.js new file mode 100644 index 00000000..e69de29b diff --git a/backend/public/scripts/popupRender.js b/backend/public/scripts/popupRender.js new file mode 100644 index 00000000..6c8cb366 --- /dev/null +++ b/backend/public/scripts/popupRender.js @@ -0,0 +1,52 @@ +const showPopup = (popupData) => { + if (!popupData || popupData.length === 0) { + console.warn('No popup data available'); + return; + } + + popupData.forEach(popup => { + // Create popup container + const popupContainer = document.createElement('div'); + Object.assign(popupContainer.style, { + position: 'fixed', + bottom: '20px', + right: '20px', + backgroundColor: popup.headerBg || '#FFFFFF', + padding: '20px', + border: '1px solid #000', + zIndex: 1000, + }); + + // Create header + const header = document.createElement('h2'); + header.textContent = popup.headerText; + header.style.color = popup.headerTextColor || '#000'; + popupContainer.appendChild(header); + + // Create content + const content = document.createElement('div'); + content.innerHTML = popup.contentHtml; + Object.assign(content.style, { + color: popup.fontColor || '#000', + fontSize: popup.font || '14px', + }); + popupContainer.appendChild(content); + + // Create action button + const actionButton = document.createElement('button'); + actionButton.textContent = popup.actionButtonText || 'Close'; + Object.assign(actionButton.style, { + backgroundColor: popup.actionButtonColor || '#CCC', + }); + actionButton.addEventListener('click', () => { + document.body.removeChild(popupContainer); // Remove popup when button is clicked + }); + popupContainer.appendChild(actionButton); + + // Append the popup to the document body + document.body.appendChild(popupContainer); + }); + }; + + export default showPopup; + \ No newline at end of file diff --git a/backend/public/snippets/popupSnippet.html b/backend/public/snippets/popupSnippet.html new file mode 100644 index 00000000..609f3217 --- /dev/null +++ b/backend/public/snippets/popupSnippet.html @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/backend/src/controllers/onboard/bannerData.controller.js b/backend/src/controllers/onboard/bannerData.controller.js new file mode 100644 index 00000000..394d0a4f --- /dev/null +++ b/backend/src/controllers/onboard/bannerData.controller.js @@ -0,0 +1,12 @@ +const bannerService = require("../service/banner.service.js"); +const getBannerData = async (req, res) => { + try { + const { userId } = req.body; + const bannerData = await bannerService.getBannerData(userId); + res.status(200).json(bannerData); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}; + +module.exports = { getBannerData }; diff --git a/backend/src/controllers/onboard/index.js b/backend/src/controllers/onboard/index.js new file mode 100644 index 00000000..db465d6d --- /dev/null +++ b/backend/src/controllers/onboard/index.js @@ -0,0 +1,7 @@ +module.exports = { + // bannerData: require('./bannerData.controller'), + popupData: require('./popupData.controller'), + // tourData: require('./tourData.controller'), + // hintData: require('./hintData.controller') + }; + \ No newline at end of file diff --git a/backend/src/controllers/onboard/popupData.controller.js b/backend/src/controllers/onboard/popupData.controller.js new file mode 100644 index 00000000..89420a83 --- /dev/null +++ b/backend/src/controllers/onboard/popupData.controller.js @@ -0,0 +1,13 @@ +const popupService = require('../../service/popup.service'); + +const getPopupData = async (req, res) => { + try { + const { userId } = req.body; + const popupData = await popupService.getPopups(userId); + res.status(200).json(popupData); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}; + +module.exports = { getPopupData }; diff --git a/backend/src/controllers/onboard/tourData.controller.js b/backend/src/controllers/onboard/tourData.controller.js new file mode 100644 index 00000000..3a2ce68f --- /dev/null +++ b/backend/src/controllers/onboard/tourData.controller.js @@ -0,0 +1,13 @@ +const tourService = require('../service/tour.service'); + +const getTourData = async (req, res) => { + try { + const { userId } = req.body; + const tourData = await tourService.getTourData(userId); + res.status(200).json(tourData); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}; + +module.exports = { getTourData }; diff --git a/backend/src/middleware/onboard.middleware.js b/backend/src/middleware/onboard.middleware.js new file mode 100644 index 00000000..fd5a79e7 --- /dev/null +++ b/backend/src/middleware/onboard.middleware.js @@ -0,0 +1,35 @@ +const db = require('../models'); +const { v4: uuidv4 } = require('uuid'); + +// Middleware to validate API ID +const validateApiId = async (req, res, next) => { + const { apiId } = req.query; // Assume API ID is sent in query params + if (!apiId) { + return res.status(400).json({ error: "API ID is required." }); + } + + try { + const user = await db.User.findOne({ where: { apiId } }); // API ID must be in User model + if (!user) { + return res.status(403).json({ error: "Invalid API ID." }); + } + + req.user = user; // Attach the user to the request for future use + next(); + } catch (error) { + return res.status(500).json({ error: "API ID validation failed." }); + } +}; + +// Middleware to generate client ID for each session +const generateClientId = (req, res, next) => { + if (!req.session.clientId) { + req.session.clientId = uuidv4(); // Generate new client ID and store in session + } + next(); +}; + +module.exports = { + validateApiId, + generateClientId +}; diff --git a/backend/src/routes/onboard.routes.js b/backend/src/routes/onboard.routes.js new file mode 100644 index 00000000..de26f64f --- /dev/null +++ b/backend/src/routes/onboard.routes.js @@ -0,0 +1,15 @@ +const express = require("express"); +const { validateApiId, generateClientId } = require("../middleware/onboard.middleware"); +const onboardControllers = require("../controllers/onboard"); + +const router = express.Router(); + +router.use(validateApiId); +router.use(generateClientId); + +// router.get("/banner", onboardControllers.bannerData.getBannerData); +router.get("/popup", onboardControllers.popupData.getPopupData); +// router.get("/tour", onboardControllers.tourData.getTourData); +// router.get("/hint", onboardControllers.hintData.getHintData); + +module.exports = router; diff --git a/backend/src/routes/script.routes.js b/backend/src/routes/script.routes.js new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/scripts/popup.script.js b/backend/src/scripts/popup.script.js new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/service/popup.service.js b/backend/src/service/popup.service.js index 125ff94e..4a1497e3 100644 --- a/backend/src/service/popup.service.js +++ b/backend/src/service/popup.service.js @@ -54,6 +54,24 @@ class PopupService { throw new Error("Error retrieving popup by ID"); } } + + async getPopupByApiAndClientId(apiId, clientId) { + try { + return await Popup.findAll({ + include: [ + { + model: db.User, + as: "creator", + where: { apiId } + }, + ], + where: { clientId }, + order: [['createdAt', 'DESC']], + }); + } catch (error) { + throw new Error("Error retrieving popups for the given API and Client ID"); + } + } } module.exports = new PopupService(); From fa70b3f5c99bb579baeeae9094cb8e0013e49000 Mon Sep 17 00:00:00 2001 From: tunckiral Date: Thu, 5 Dec 2024 22:08:57 -0500 Subject: [PATCH 2/8] changing and refactor codes --- jsAgent/banner.js | 1 + jsAgent/links.js | 1 + jsAgent/main.js | 154 +++++++++++++++++++++++++++++++++++++++++ jsAgent/popup.js | 88 +++++++++++++++++++++++ jsAgent/popupRender.js | 52 ++++++++++++++ jsAgent/tour.js | 1 + 6 files changed, 297 insertions(+) create mode 100644 jsAgent/banner.js create mode 100644 jsAgent/links.js create mode 100644 jsAgent/main.js create mode 100644 jsAgent/popup.js create mode 100644 jsAgent/popupRender.js create mode 100644 jsAgent/tour.js diff --git a/jsAgent/banner.js b/jsAgent/banner.js new file mode 100644 index 00000000..80ce9d76 --- /dev/null +++ b/jsAgent/banner.js @@ -0,0 +1 @@ +console.log('banner.js is here!'); \ No newline at end of file diff --git a/jsAgent/links.js b/jsAgent/links.js new file mode 100644 index 00000000..bd636406 --- /dev/null +++ b/jsAgent/links.js @@ -0,0 +1 @@ +console.log('link.js is here!'); \ No newline at end of file diff --git a/jsAgent/main.js b/jsAgent/main.js new file mode 100644 index 00000000..86d64c08 --- /dev/null +++ b/jsAgent/main.js @@ -0,0 +1,154 @@ +//CONSTANTS + +const BW_SERVER_ENDPOINT_BASE = 'localhost:3000/api/'; +const BW_POPUP_JS_URL ='popup/get_popup/1'; +const BW_BANNER_JS_URL =''; +const BW_TOUR_JS_URL =''; +const BW_LINKS_JS_URL =''; +const BW_USER_KEY = 'BW_USER_KEY'; + +//GLOBALS +window.BW_USER = ''; + +if (window.bw === undefined) { window.bw = {} } +if (bw.util === undefined) { bw.util = {} } + + + +bw.util = { + isScriptLoaded : function (src) { + var scripts = document.getElementsByTagName("script"); + for (var i = 0; i < scripts.length; i++) + if (scripts[i].getAttribute('src') == src) return true; + return false; + }, + loadScriptAsync : function (url, cb, errcb) { + try { + if (bw.util.isScriptLoaded(url)) { + cb && cb(); + } else { + var script = document.createElement("script"); + script.type = "text/javascript"; + script.async = false; + if (script.readyState) { + script.onreadystatechange = function () { + if (script.readyState == "loaded" || script.readyState == "complete") { + script.onreadystatechange = null; + cb && cb(); + } + }; + } else { + script.onload = function () { + cb && cb(); + }; + } + script.onerror = function () { + errcb && errcb(); + }; + script.src = url; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script); + } + } catch (e) { + console.log(e); + } + }, + bindLive: function (selector, event, cb, cnx) { + bw.util.addEvent(cnx || document, event, function (e) { + var qs = (cnx || document).querySelectorAll(selector); + if (qs) { + var el = e.target || e.srcElement, index = -1; + while (el && ((index = Array.prototype.indexOf.call(qs, el)) === -1)) el = el.parentElement; + if (index > -1) cb.call(el, e); + } + }); + }, + addEvent: function (el, type, fn) { + if (el.attachEvent) el.attachEvent('on' + type, fn); else el.addEventListener(type, fn); + }, + generateGUID :function () { + var guid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (o) { + var n = Math.random() * 16 | 0, + g = o == "x" ? n : (n & 3 | 8); + return g.toString(16) + }); + return guid; + } +} + +bw.data={ + getData: async function (userId) { + const myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + + const requestOptions = { + method: "POST", + headers: myHeaders, + body: JSON.stringify({ userId }), + redirect: "follow" + }; + + const response = await fetch(`${BW_SERVER_ENDPOINT_BASE}/mock/onboard`, requestOptions); + const data = await response.json(); + return data; + } +} + +bw.store = { + insert: function (key, value) { + localStorage.setItem(key, value); + }, + remove: function (key) { + localStorage.removeItem(key); + }, + get: function (key) { + return localStorage.getItem(key); + } +} + +bw.user = { + createUser: function () { + const generated_userId = bw.util.generateGUID(); + bw.store.insert(BW_USER_KEY, generated_userId); + window.BW_USER = generated_userId; + }, + checkIfBwUserCreated: function () { + let result = false; + let userID = bw.store.get(BW_USER_KEY); + if (userID != null) { + result = true; + } + return result; + }, + getUserID : function(){ + return bw.store.get(BW_USER_KEY); + }, + removeUser: function(){ + bw.store.remove(BW_USER_KEY); + } +} +bw.init = (cb) => { + if(!bw.user.checkIfBwUserCreated()){ + bw.user.createUser(); + } + window.BW_USER = bw.user.getUserID(); + cb && cb(); +}; + +( + function () { + + bw.init(async function (){ + const onBoardConfig = await bw.data.getData(window.BW_USER); + debugger; + if (onBoardConfig.popupData) { + bw.util.loadScriptAsync(BW_POPUP_JS_URL); + } else if (onBoardConfig.tourData) { + bw.util.loadScriptAsync(BW_TOUR_JS_URL); + } else if(onBoardConfig.bannerData){ + bw.util.loadScriptAsync(BW_BANNER_JS_URL); + } else if(onBoardConfig.linkData){ + bw.util.loadScriptAsync(BW_LINKS_JS_URL); + } + }); + } +)(); \ No newline at end of file diff --git a/jsAgent/popup.js b/jsAgent/popup.js new file mode 100644 index 00000000..82ac7f39 --- /dev/null +++ b/jsAgent/popup.js @@ -0,0 +1,88 @@ +const defaultOptions = { + padding: 16, + hasFooter: true, + + + closeButtonAction: "no action", + popupSize: "small", + url: "https://", + actionButtonText: "Take me to subscription page", + headerBackgroundColor: "#F8F9F8", + headerColor: "#101828", + textColor: "#344054", + buttonBackgroundColor: "#7F56D9", + buttonTextColor: "#FFFFFF", + header: "default", + content: "", +} + +bw.popup = { + + init: function () { + bw.popup.addOverlay(); + bw.popup.addModal(()=>{ + bw.popup.bindEvents(); + }); + }, + + addOverlay: function () { + document.body.insertAdjacentHTML('afterbegin', `
`); + }, + addModal: function (cb) { + const options = window + let overlay = document.getElementById('bw-overlay'); + for (let i = 0; i < options.length; i++) { + let option = { + ...defaultOptions, + ...options[i] + }; + let temp_html = ` +
+ +
` + overlay.insertAdjacentHTML('afterbegin', temp_html); + } + cb && cb(); + }, + addHeader: function(headerTitle, bgColor, textColor, padding){ + let headerHtml = ``; + return headerHtml; + }, + addButton: function(footerHtml_, color, padding, btnId, btnEvent){ + let footerHtml = ``; + + if(btnEvent == 'close'){ + bw.util.bindLive(`#${btnId}`, 'click', function(){ + bw.popup.hideModal(); + }); + } + return footerHtml; + }, + bindEvents: function(){ + bw.util.bindLive(`#bw-modal-close`, 'click', function(){ + bw.popup.hideModal(); + }); + }, + showModal: function () { + document.getElementById('bw-overlay').style.display = 'block'; + }, + hideModal: function(){ + document.getElementById('bw-overlay').style.display = 'none'; + } +}; + + +(async function () { + bw.popup.init(); +})(); \ No newline at end of file diff --git a/jsAgent/popupRender.js b/jsAgent/popupRender.js new file mode 100644 index 00000000..6c8cb366 --- /dev/null +++ b/jsAgent/popupRender.js @@ -0,0 +1,52 @@ +const showPopup = (popupData) => { + if (!popupData || popupData.length === 0) { + console.warn('No popup data available'); + return; + } + + popupData.forEach(popup => { + // Create popup container + const popupContainer = document.createElement('div'); + Object.assign(popupContainer.style, { + position: 'fixed', + bottom: '20px', + right: '20px', + backgroundColor: popup.headerBg || '#FFFFFF', + padding: '20px', + border: '1px solid #000', + zIndex: 1000, + }); + + // Create header + const header = document.createElement('h2'); + header.textContent = popup.headerText; + header.style.color = popup.headerTextColor || '#000'; + popupContainer.appendChild(header); + + // Create content + const content = document.createElement('div'); + content.innerHTML = popup.contentHtml; + Object.assign(content.style, { + color: popup.fontColor || '#000', + fontSize: popup.font || '14px', + }); + popupContainer.appendChild(content); + + // Create action button + const actionButton = document.createElement('button'); + actionButton.textContent = popup.actionButtonText || 'Close'; + Object.assign(actionButton.style, { + backgroundColor: popup.actionButtonColor || '#CCC', + }); + actionButton.addEventListener('click', () => { + document.body.removeChild(popupContainer); // Remove popup when button is clicked + }); + popupContainer.appendChild(actionButton); + + // Append the popup to the document body + document.body.appendChild(popupContainer); + }); + }; + + export default showPopup; + \ No newline at end of file diff --git a/jsAgent/tour.js b/jsAgent/tour.js new file mode 100644 index 00000000..3e96f605 --- /dev/null +++ b/jsAgent/tour.js @@ -0,0 +1 @@ +console.log('tour.js is here'); \ No newline at end of file From 5859fd514f98b15d4a22c76d2f9e069c1a6afd42 Mon Sep 17 00:00:00 2001 From: tunckiral Date: Tue, 10 Dec 2024 03:13:28 -0500 Subject: [PATCH 3/8] corrections --- backend/.env | 2 +- backend/Dockerfile | 2 +- backend/package-lock.json | 552 ++------------------------- backend/package.json | 2 +- backend/src/routes/guide.routes.js | 2 +- backend/src/service/popup.service.js | 8 + frontend/Dockerfile | 2 +- jsAgent/main.js | 32 +- 8 files changed, 59 insertions(+), 543 deletions(-) diff --git a/backend/.env b/backend/.env index f1ebcc98..c3ee6081 100644 --- a/backend/.env +++ b/backend/.env @@ -5,7 +5,7 @@ NODE_ENV=development DEV_DB_USERNAME=user123 DEV_DB_PASSWORD=password123 DEV_DB_NAME=onboarding_db -DEV_DB_HOST=db +DEV_DB_HOST=localhost DEV_DB_PORT=5432 EMAIL_ENABLE=false diff --git a/backend/Dockerfile b/backend/Dockerfile index 3679a783..d17a4a51 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22-alpine3.20 +FROM node:22 WORKDIR /app diff --git a/backend/package-lock.json b/backend/package-lock.json index 178862c7..ed1fd7b3 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "cors": "^2.8.5", "dotenv": "^16.4.5", @@ -20,7 +19,7 @@ "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", "nodemailer": "^6.9.15", - "pg": "^8.11.5", + "pg": "^8.13.1", "sequelize": "^6.37.3" }, "devDependencies": { @@ -131,26 +130,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/@mapbox/node-pre-gyp": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", - "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", - "license": "BSD-3-Clause", - "dependencies": { - "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "make-dir": "^3.1.0", - "node-fetch": "^2.6.7", - "nopt": "^5.0.0", - "npmlog": "^5.0.1", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.11" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - } - }, "node_modules/@one-ini/wasm": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.1.1.tgz", @@ -199,12 +178,6 @@ "integrity": "sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag==", "license": "MIT" }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "license": "ISC" - }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -218,45 +191,11 @@ "node": ">= 0.6" } }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agent-base/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/agent-base/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "license": "MIT" - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -292,26 +231,6 @@ "node": ">= 8" } }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "license": "ISC" - }, - "node_modules/are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", - "deprecated": "This package is no longer supported.", - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -332,22 +251,9 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, "license": "MIT" }, - "node_modules/bcrypt": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz", - "integrity": "sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "@mapbox/node-pre-gyp": "^1.0.11", - "node-addon-api": "^5.0.0" - }, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/bcryptjs": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", @@ -402,6 +308,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -480,15 +387,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "license": "ISC", - "engines": { - "node": ">=10" - } - }, "node_modules/cli-color": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.4.tgz", @@ -538,15 +436,6 @@ "dev": true, "license": "MIT" }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, "node_modules/commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -561,6 +450,7 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, "license": "MIT" }, "node_modules/config-chain": { @@ -574,12 +464,6 @@ "proto-list": "~1.2.1" } }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "license": "ISC" - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -684,12 +568,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", - "license": "MIT" - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -709,15 +587,6 @@ "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/detect-libc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", - "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, "node_modules/dotenv": { "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", @@ -807,6 +676,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, "license": "MIT" }, "node_modules/encodeurl": { @@ -1107,36 +977,6 @@ "node": ">=10" } }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "license": "ISC" - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1161,27 +1001,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", - "deprecated": "This package is no longer supported.", - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1211,27 +1030,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -1331,12 +1129,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "license": "ISC" - }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -1383,42 +1175,6 @@ "node": ">= 0.8" } }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/https-proxy-agent/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "license": "MIT" - }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -1447,17 +1203,6 @@ ], "license": "MIT" }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -1523,6 +1268,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1823,30 +1569,6 @@ "es5-ext": "~0.10.2" } }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -1931,6 +1653,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -1952,48 +1675,12 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, "license": "ISC", "engines": { "node": ">=8" } }, - "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/moment": { "version": "2.30.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", @@ -2043,32 +1730,6 @@ "dev": true, "license": "ISC" }, - "node_modules/node-addon-api": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", - "license": "MIT" - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/nodemailer": { "version": "6.9.15", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.15.tgz", @@ -2132,21 +1793,6 @@ "dev": true, "license": "MIT" }, - "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "license": "ISC", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2157,19 +1803,6 @@ "node": ">=0.10.0" } }, - "node_modules/npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", - "deprecated": "This package is no longer supported.", - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2203,15 +1836,6 @@ "node": ">= 0.8" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, "node_modules/package-json-from-dist": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", @@ -2228,15 +1852,6 @@ "node": ">= 0.8" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -2278,14 +1893,14 @@ "license": "MIT" }, "node_modules/pg": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.12.0.tgz", - "integrity": "sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ==", + "version": "8.13.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.1.tgz", + "integrity": "sha512-OUir1A0rPNZlX//c7ksiu7crsGZTKSOXJPgtNiHGIlC9H0lO+NC6ZDYksSgBYY/thSWhnSRBv8w1lieNNGATNQ==", "license": "MIT", "dependencies": { - "pg-connection-string": "^2.6.4", - "pg-pool": "^3.6.2", - "pg-protocol": "^1.6.1", + "pg-connection-string": "^2.7.0", + "pg-pool": "^3.7.0", + "pg-protocol": "^1.7.0", "pg-types": "^2.1.0", "pgpass": "1.x" }, @@ -2312,9 +1927,9 @@ "optional": true }, "node_modules/pg-connection-string": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.4.tgz", - "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz", + "integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==", "license": "MIT" }, "node_modules/pg-int8": { @@ -2327,18 +1942,18 @@ } }, "node_modules/pg-pool": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", - "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.7.0.tgz", + "integrity": "sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==", "license": "MIT", "peerDependencies": { "pg": ">=8.0" } }, "node_modules/pg-protocol": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.1.tgz", - "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.7.0.tgz", + "integrity": "sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==", "license": "MIT" }, "node_modules/pg-types": { @@ -2484,20 +2099,6 @@ "node": ">= 0.8" } }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -2545,22 +2146,6 @@ "integrity": "sha512-XgmCoxKWkDofwH8WddD0w85ZfqYz+ZHlr5yo+3YUCfycWawU56T5ckWXsScsj5B8tqUcIG67DxXByo3VUgiAdA==", "license": "MIT" }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2770,12 +2355,6 @@ "node": ">= 0.8.0" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "license": "ISC" - }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -2840,12 +2419,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "license": "ISC" - }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -2886,19 +2459,11 @@ "node": ">= 0.8" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -2929,6 +2494,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -2977,23 +2543,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tar": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", - "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/timers-ext": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.8.tgz", @@ -3046,12 +2595,6 @@ "nodetouch": "bin/nodetouch.js" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "license": "MIT" - }, "node_modules/type": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz", @@ -3130,12 +2673,6 @@ "node": ">= 0.8" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -3172,22 +2709,6 @@ "node": ">= 0.8" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3204,15 +2725,6 @@ "node": ">= 8" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/wkx": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.5.0.tgz", @@ -3265,12 +2777,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -3290,12 +2796,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "license": "ISC" - }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/backend/package.json b/backend/package.json index 9deb853d..08f38955 100644 --- a/backend/package.json +++ b/backend/package.json @@ -24,7 +24,7 @@ "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", "nodemailer": "^6.9.15", - + "pg": "^8.13.1", "sequelize": "^6.37.3" }, "devDependencies": { diff --git a/backend/src/routes/guide.routes.js b/backend/src/routes/guide.routes.js index 4904d726..adf32244 100644 --- a/backend/src/routes/guide.routes.js +++ b/backend/src/routes/guide.routes.js @@ -3,7 +3,7 @@ const guideController = require("../controllers/guide.controller.js"); const router = express.Router(); -router.get("/get_guides_by_url", guideController.getGuidesByUrl); +router.post("/get_guides_by_url", guideController.getGuidesByUrl); // router.get("/get_incomplete_guides_by_url", guideController.getIncompleteGuidesByUrl); module.exports = router; diff --git a/backend/src/service/popup.service.js b/backend/src/service/popup.service.js index 4a1497e3..21824d2c 100644 --- a/backend/src/service/popup.service.js +++ b/backend/src/service/popup.service.js @@ -72,6 +72,14 @@ class PopupService { throw new Error("Error retrieving popups for the given API and Client ID"); } } + + async getPopupByUrl(url) { + try { + return await Popup.findAll({ where: { url } }); + } catch (error) { + throw new Error("Error retrieving Popup by URL"); + } + }; } module.exports = new PopupService(); diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f3badd6d..8306193c 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22-alpine3.20 +FROM node:22 WORKDIR /app diff --git a/jsAgent/main.js b/jsAgent/main.js index 86d64c08..2005d795 100644 --- a/jsAgent/main.js +++ b/jsAgent/main.js @@ -1,10 +1,8 @@ //CONSTANTS -const BW_SERVER_ENDPOINT_BASE = 'localhost:3000/api/'; -const BW_POPUP_JS_URL ='popup/get_popup/1'; -const BW_BANNER_JS_URL =''; -const BW_TOUR_JS_URL =''; -const BW_LINKS_JS_URL =''; +const BW_SERVER_ENDPOINT_BASE = 'http://localhost:3000/api/'; +const BW_POPUP_JS_URL= 'http://localhost:8082/popup.js' +const BW_GUIDE_URL='guide/get_guides_by_url'; const BW_USER_KEY = 'BW_USER_KEY'; //GLOBALS @@ -83,11 +81,14 @@ bw.data={ const requestOptions = { method: "POST", headers: myHeaders, - body: JSON.stringify({ userId }), + body: JSON.stringify({ + userId, + url : location.origin + }), redirect: "follow" }; - const response = await fetch(`${BW_SERVER_ENDPOINT_BASE}/mock/onboard`, requestOptions); + const response = await fetch(`${BW_SERVER_ENDPOINT_BASE}${BW_GUIDE_URL}`, requestOptions); const data = await response.json(); return data; } @@ -126,6 +127,7 @@ bw.user = { bw.store.remove(BW_USER_KEY); } } + bw.init = (cb) => { if(!bw.user.checkIfBwUserCreated()){ bw.user.createUser(); @@ -138,17 +140,23 @@ bw.init = (cb) => { function () { bw.init(async function (){ - const onBoardConfig = await bw.data.getData(window.BW_USER); + + try { + const onBoardConfig = await bw.data.getData(window.BW_USER); debugger; - if (onBoardConfig.popupData) { + if (onBoardConfig.popup.length > 0) { bw.util.loadScriptAsync(BW_POPUP_JS_URL); - } else if (onBoardConfig.tourData) { + } else if (onBoardConfig.tour?.length > 0) { bw.util.loadScriptAsync(BW_TOUR_JS_URL); - } else if(onBoardConfig.bannerData){ + } else if(onBoardConfig.banner?.length > 0){ bw.util.loadScriptAsync(BW_BANNER_JS_URL); - } else if(onBoardConfig.linkData){ + } else if(onBoardConfig.link?.length > 0){ bw.util.loadScriptAsync(BW_LINKS_JS_URL); } + } catch (error) { + console.log('error :', error); + } + }); } )(); \ No newline at end of file From f46f9272d6c05bba1395958b33b1f5973211700d Mon Sep 17 00:00:00 2001 From: tunckiral Date: Tue, 10 Dec 2024 04:50:07 -0500 Subject: [PATCH 4/8] adding up functionalities --- .DS_Store | Bin 6148 -> 6148 bytes jsAgent/main.js | 3 +- jsAgent/popup.js | 92 +++++++++++++++++++++++++++++------------------ 3 files changed, 60 insertions(+), 35 deletions(-) diff --git a/.DS_Store b/.DS_Store index 50d86b883aa6ddc4c5ed3ff7ea417814bf25652f..0882062e027ae90a4707b1c05d8620db97fbb5a2 100644 GIT binary patch delta 334 zcmZoMXfc=|#>B)qu~2NHo+2a5!~pA!4;mPOj2`QHc7`m5Vg^TsbcR%hJcg2_^5TM| zoctsP28JC;1v#0;B?bo97@3$^SlQUwIoY|{V}mpD%Y#c2OG=BK5{sfiypa6-oFo`K zF)1uFwLD%x#5q5&Br!8DwFs;sGbI(MBqlsFFD1X+DZex?r5LQYJ{Tgy$;rVPFCbA} zZE9wqqhM-gS*xQ^ZD|B#n^+pv)^c))D(hPZ#b@W_=H+(*9R~!Aj1ZcE7fQpZZXg5A zTV=sTc{%xc=|CBnE{N)l_YSdaX6NAN0EW-Ti{F_i^NZ+;fTTdm8Xz=S$L0``4a^f8 FSO6O)QS<-+ delta 74 zcmZoMXfc=|#>CJzu~2NHo+2aD!~pBb1|lqz`I#&>yD%SS*&M)J%e0xDgP#MaXtN{p ccjn3bBD$Q63=9khfS6&j4UhEZ7?CB+0OK1HY5)KL diff --git a/jsAgent/main.js b/jsAgent/main.js index 2005d795..c67aa4ed 100644 --- a/jsAgent/main.js +++ b/jsAgent/main.js @@ -143,7 +143,8 @@ bw.init = (cb) => { try { const onBoardConfig = await bw.data.getData(window.BW_USER); - debugger; + console.log('data loaded:' , onBoardConfig); + window.bwonboarddata=onBoardConfig; if (onBoardConfig.popup.length > 0) { bw.util.loadScriptAsync(BW_POPUP_JS_URL); } else if (onBoardConfig.tour?.length > 0) { diff --git a/jsAgent/popup.js b/jsAgent/popup.js index 82ac7f39..22ee314c 100644 --- a/jsAgent/popup.js +++ b/jsAgent/popup.js @@ -1,8 +1,5 @@ const defaultOptions = { - padding: 16, - hasFooter: true, - - + padding: 20, closeButtonAction: "no action", popupSize: "small", url: "https://", @@ -13,9 +10,24 @@ const defaultOptions = { buttonBackgroundColor: "#7F56D9", buttonTextColor: "#FFFFFF", header: "default", - content: "", + content: "" } +const PopUpSize = Object.freeze({ + small:{ + width: 400, + height: 250 + }, + medium:{ + width: 500, + height: 300 + }, + large:{ + width: 700, + height: 350 + } +}); + bw.popup = { init: function () { @@ -29,45 +41,57 @@ bw.popup = { document.body.insertAdjacentHTML('afterbegin', `
`); }, addModal: function (cb) { - const options = window + const options = window.bwonboarddata.popup[0]; let overlay = document.getElementById('bw-overlay'); - for (let i = 0; i < options.length; i++) { - let option = { - ...defaultOptions, - ...options[i] - }; - let temp_html = ` -
- ` + overlay.insertAdjacentHTML('afterbegin', temp_html); cb && cb(); }, addHeader: function(headerTitle, bgColor, textColor, padding){ - let headerHtml = `