UNPKG

@plattar/plattar-web

Version:

Module for interfacing with the Plattar Embeds and Web Viewers (https://www.plattar.com)

60 lines (49 loc) 1.54 kB
class Util { static getServerLocation(server) { switch (server) { case "production": return "https://renderer.plattar.com/"; case "staging": return "https://renderer-staging.plattar.com/"; case "review": return "https://renderer-review.plattar.com/"; case "dev": return "https://localhost/"; default: return undefined; } } static getElementLocation(etype) { const isValid = Util.isValidType(etype); if (isValid) { return `${etype}.html`; } return undefined; } static isValidType(etype) { switch (etype) { case "viewer": case "editor": case "ewall": case "facear": case "studio": case "product": case "launcher": case "gallery": case "model": case "configurator": case "adhoc": case "webxr": return true; default: return false; } } static id() { return Math.abs(Math.floor(Math.random() * 10000000000000)); } static getPermissionString(permissions) { if (permissions && permissions.length > 0) { let permissionString = permissions[0]; for (let i = 1; i < permissions.length; i++) { permissionString += "; " + permissions[i]; } return permissionString; } return undefined; } } module.exports = Util;