j-queue-sdk-web
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ConnectionJQueueSdkWeb=e():t.ConnectionJQueueSdkWeb=e()}(this,(()=>(()=>{"use strict";var t={156:function(t,e,n){var s=this&&this.__awaiter||function(t,e,n,s){return new(n||(n=Promise))((function(i,o){function a(t){try{l(s.next(t))}catch(t){o(t)}}function u(t){try{l(s.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}l((s=s.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=n(613);class o{static log(t,e="info",n){("error"===e?console.error:"warn"===e?console.warn:console.log)(`[J-Queue] ${t}`,null!=n?n:"")}static injectStyles(t){if("undefined"==typeof document||document.querySelector("style[data-jqueue-styles]"))return;const e=document.createElement("style");e.dataset.jqueueStyles="",e.textContent=this.CONFIG.STYLES.LOADER(t),document.head.appendChild(e)}static createPopup(t,e){if("undefined"==typeof document)return;this.removePopup();const n=document.createElement("div");n.id="__jqueue_popup",n.style.cssText=null!=e?e:this.CONFIG.STYLES.POPUP,n.innerHTML=t,document.body.appendChild(n),this.state.popupEl=n}static removePopup(){var t;"undefined"!=typeof document&&(null===(t=this.state.popupEl)||void 0===t||t.remove(),this.state.popupEl=null)}static toggleNavigation(t){"undefined"!=typeof window&&this.state.isNavigating!==t&&(window.onbeforeunload=t?()=>{var t;return(null===(t=this.state.queueStatus)||void 0===t?void 0:t.uuid)&&this.state.apiUrl&&this.sendLeaveRequest(),"Navigation is currently blocked."}:null,this.state.isNavigating=t)}static sendLeaveRequest(){const{apiUrl:t,queueStatus:e}=this.state;if(t&&(null==e?void 0:e.uuid))try{const n=JSON.stringify({uuid:e.uuid});navigator.sendBeacon(`${t}${this.CONFIG.API_ENDPOINTS.LEAVE}`,n)}catch(t){this.log("Leave API (sendBeacon) failed","error",t)}}static getDefaultPopupContent(t,e="ko",n){var s;const i=this.CONFIG.MESSAGES[e],o=null!==(s=null==n?void 0:n.textColor)&&void 0!==s?s:"#276bff";return`\n <div style="display: flex; flex-direction: column; align-items: center; width: 100%;">\n <div style="padding: 20px; text-align: center;">\n <p style="font-size: 16px; line-height: 1.5; margin: 0 0 20px 0; color: ${o};">\n ${i.MESS_1}<br>${i.MESS_2}\n </p>\n <div style="position: relative; width: 150px; height: 150px; margin: 20px auto;">\n <span style="position: absolute; inset: 0;" class="loader-jqueue_popup"></span>\n <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center;">\n <div style="font-size: 14px; color: ${o};">${i.MESS_3}</div>\n <div style="font-size: 36px; color: ${o}; font-weight: bold;">${t}</div>\n </div>\n </div>\n </div>\n </div>\n `}static setupSocket(t,e,n,s,i){const o=new URLSearchParams(Object.assign(Object.assign({},e.query),{uuid:n})),a=new WebSocket(`${t}?${o.toString()}`);this.state.socket=a,a.onopen=()=>{this.log("WebSocket connected"),this.ttlInterval=setInterval((()=>{a.readyState===WebSocket.OPEN&&(a.send(JSON.stringify({event:"online-queue:set-ttl",data:Object.assign(Object.assign({},e.query),{uuid:n})})),this.log("Sent online-queue:set-ttl"))}),this.CONFIG.TTL_INTERVAL)},a.onmessage=t=>{try{const e=JSON.parse(t.data);"online-queue:status"===e.event?i(e.data):s&&e.event in s&&s[e.event](e.data,{createPopup:this.createPopup.bind(this),removePopup:this.removePopup.bind(this),preventNavigation:()=>this.toggleNavigation(!0),allowNavigation:()=>this.toggleNavigation(!1)})}catch(t){this.log("WebSocket message handling failed","error",t)}},a.onerror=t=>{this.log("WebSocket error","error",t)},a.onclose=t=>{this.log(`WebSocket closed: code=${t.code}, reason=${t.reason}`,"warn"),this.ttlInterval&&(clearInterval(this.ttlInterval),this.ttlInterval=null)}}static addStatusListener(t){this.statusListeners.push(t)}static removeStatusListener(t){this.statusListeners=this.statusListeners.filter((e=>e!==t))}static getQueueStatus(){return this.state.queueStatus}static fetchStatus(t,e,n){return s(this,void 0,void 0,(function*(){const e=new URLSearchParams({});return e.append("uuid",n),(yield fetch(`${t}${this.CONFIG.API_ENDPOINTS.STATUS}?${e.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}))}static getAdjustedPollInterval(t,e){return t>=100?e+t/100*1e3:e}static updateQueueStatus(t,e){var n,s;if(!t)return void this.log("Invalid status response received","warn");const{status:o,position:a,uuid:u}=t;if(this.state.queueStatus={status:o,position:a,uuid:u},this.state.storageKey&&"undefined"!=typeof sessionStorage&&sessionStorage.setItem(this.state.storageKey,u),this.statusListeners.forEach((t=>t({status:o,position:a,uuid:u}))),o===i.OnlineQueueStatus.ACTIVE)this.removePopup(),this.toggleNavigation(!1),this.statusInterval&&(clearInterval(this.statusInterval),this.statusInterval=null);else{const t="function"==typeof(null==e?void 0:e.content)?e.content(a):null!==(n=null==e?void 0:e.content)&&void 0!==n?n:this.getDefaultPopupContent(a,null!==(s=null==e?void 0:e.language)&&void 0!==s?s:"ko",e);this.createPopup(t,null==e?void 0:e.style),this.toggleNavigation(!0)}}static startStatusPolling(t,e,n,o,a,u,l){var r,d;let c=this.getAdjustedPollInterval(null!==(d=null===(r=this.state.queueStatus)||void 0===r?void 0:r.position)&&void 0!==d?d:0,a);const p=()=>s(this,void 0,void 0,(function*(){var s;try{const r=yield this.fetchStatus(e,null!==(s=n.query)&&void 0!==s?s:{},o);this.updateQueueStatus(r.data,u);const d=this.getAdjustedPollInterval(r.data.position,a);d!==c&&this.statusInterval&&(clearInterval(this.statusInterval),c=d,this.statusInterval=setInterval(p,c)),r.data.status===i.OnlineQueueStatus.ACTIVE&&this.setupSocket(t,n,o,l,(t=>this.updateQueueStatus(t.data,u)))}catch(t){this.log("Status polling failed","error",t)}}));this.statusInterval=setInterval(p,c)}static init(t){return s(this,arguments,void 0,(function*({wsUrl:t,apiUrl:e,socketConfig:n={},popupConfig:s={},customEvents:o={},pollInterval:a=this.CONFIG.STATUS_POLL_INTERVAL,option:u={storageKey:this.CONFIG.STORAGE_KEY}}){var l,r,d;if(!t||!e)throw new Error("Both wsUrl and apiUrl are required for initialization");if("undefined"==typeof WebSocket)throw new Error("WebSocket is not supported in this environment.");this.state=Object.assign(Object.assign({},this.state),{storageKey:null!==(l=u.storageKey)&&void 0!==l?l:this.CONFIG.STORAGE_KEY,wsUrl:t,apiUrl:e,socketConfig:n}),this.injectStyles(s);try{const u=yield fetch(`${e}${this.CONFIG.API_ENDPOINTS.JOIN}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(null!==(r=n.query)&&void 0!==r?r:{})}),l=yield u.json();return(null===(d=l.data)||void 0===d?void 0:d.uuid)?(this.updateQueueStatus(l.data,s),l.data.status===i.OnlineQueueStatus.ACTIVE?this.setupSocket(t,n,l.data.uuid,o,(t=>this.updateQueueStatus(t.data,s))):l.data.status===i.OnlineQueueStatus.WAITING&&this.startStatusPolling(t,e,n,l.data.uuid,a,s,o),{disconnect:()=>this.disconnect()}):(this.log("Join response missing UUID","error"),{disconnect:()=>this.disconnect()})}catch(t){return this.log("Initialization failed","error",t),{disconnect:()=>this.disconnect()}}}))}static cleanup(){this.state.storageKey&&"undefined"!=typeof sessionStorage&&sessionStorage.removeItem(this.state.storageKey),this.statusInterval&&(clearInterval(this.statusInterval),this.statusInterval=null),this.ttlInterval&&(clearInterval(this.ttlInterval),this.ttlInterval=null),this.removePopup(),this.toggleNavigation(!1),this.state={socket:null,popupEl:null,isNavigating:!1,storageKey:null,queueStatus:null,wsUrl:null,apiUrl:null,socketConfig:null},this.statusListeners=[]}static disconnect(){var t,e,n;(null===(t=this.state.socket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&(null===(e=this.state.queueStatus)||void 0===e?void 0:e.uuid)&&this.state.apiUrl&&this.sendLeaveRequest(),null===(n=this.state.socket)||void 0===n||n.close(),this.cleanup()}}o.CONFIG={STATUS_POLL_INTERVAL:1e3,TTL_INTERVAL:5e3,STORAGE_KEY:"queue_token",API_ENDPOINTS:{JOIN:"/join",STATUS:"/status",LEAVE:"/leave"},MESSAGES:{en:{MESS_1:"Progressing sequentially based on access order.",MESS_2:"We are doing our best to proceed quickly.",MESS_3:"Queue Number"},ko:{MESS_1:"접속한 순서대로 순차적 진행 중입니다.",MESS_2:"빠른 서비스 진행을 위해 최선을 다하고 있습니다.",MESS_3:"대기순번"}},STYLES:{POPUP:"\n position: fixed;\n inset: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n z-index: 10000;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 28px;\n ",LOADER:t=>{var e,n;return`\n .loader-jqueue_popup {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n display: inline-block;\n position: relative;\n background: linear-gradient(0deg, ${null!==(e=null==t?void 0:t.loaderGradientEnd)&&void 0!==e?e:"rgba(39,107,255,0.05)"} 33%, ${null!==(n=null==t?void 0:t.loaderGradientStart)&&void 0!==n?n:"#276bff"} 100%);\n box-sizing: border-box;\n animation: rotation 1s linear infinite;\n }\n .loader-jqueue_popup::after {\n content: '';\n box-sizing: border-box;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 96%;\n height: 96%;\n border-radius: 50%;\n background: #fff;\n }\n @keyframes rotation {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n `}}},o.state={socket:null,popupEl:null,isNavigating:!1,storageKey:null,queueStatus:null,wsUrl:null,apiUrl:null,socketConfig:null},o.statusInterval=null,o.ttlInterval=null,o.statusListeners=[],"undefined"!=typeof window&&(window.ConnectionJQueueSdkWeb=o),e.default=o},613:(t,e)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.OnlineQueueStatus=void 0,function(t){t[t.WAITING=1]="WAITING",t[t.ACTIVE=2]="ACTIVE"}(n||(e.OnlineQueueStatus=n={}))}},e={},n=function n(s){var i=e[s];if(void 0!==i)return i.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,n),o.exports}(156);return n.default})())); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ConnectionJQueueSdkWeb=e():t.ConnectionJQueueSdkWeb=e()}(this,(()=>(()=>{"use strict";var t={156:function(t,e,n){var s=this&&this.__awaiter||function(t,e,n,s){return new(n||(n=Promise))((function(i,o){function a(t){try{l(s.next(t))}catch(t){o(t)}}function u(t){try{l(s.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}l((s=s.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const i=n(613);class o{static log(t,e="info",n){("error"===e?console.error:"warn"===e?console.warn:console.log)(`[J-Queue] ${t}`,null!=n?n:"")}static injectStyles(t){if("undefined"==typeof document||document.querySelector("style[data-jqueue-styles]"))return;const e=document.createElement("style");e.dataset.jqueueStyles="",e.textContent=this.CONFIG.STYLES.LOADER(t),document.head.appendChild(e)}static createPopup(t,e){if("undefined"==typeof document)return;this.removePopup();const n=document.createElement("div");n.id="__jqueue_popup",n.style.cssText=null!=e?e:this.CONFIG.STYLES.POPUP,n.innerHTML=t,document.body.appendChild(n),this.state.popupEl=n}static removePopup(){var t;"undefined"!=typeof document&&(null===(t=this.state.popupEl)||void 0===t||t.remove(),this.state.popupEl=null)}static toggleNavigation(t){"undefined"!=typeof window&&this.state.isNavigating!==t&&(window.onbeforeunload=t?()=>{var t;return(null===(t=this.state.queueStatus)||void 0===t?void 0:t.uuid)&&this.state.apiUrl&&this.sendLeaveRequest(),"Navigation is currently blocked."}:null,this.state.isNavigating=t)}static sendLeaveRequest(){const{apiUrl:t,queueStatus:e}=this.state;if(t&&(null==e?void 0:e.uuid))try{const n=new URLSearchParams;n.set("uuid",null==e?void 0:e.uuid),navigator.sendBeacon(`${t}${this.CONFIG.API_ENDPOINTS.LEAVE}`,n)}catch(t){this.log("Leave API (sendBeacon) failed","error",t)}}static getDefaultPopupContent(t,e="ko",n){var s;const i=this.CONFIG.MESSAGES[e],o=null!==(s=null==n?void 0:n.textColor)&&void 0!==s?s:"#276bff";return`\n <div style="display: flex; flex-direction: column; align-items: center; width: 100%;">\n <div style="padding: 20px; text-align: center;">\n <p style="font-size: 16px; line-height: 1.5; margin: 0 0 20px 0; color: ${o};">\n ${i.MESS_1}<br>${i.MESS_2}\n </p>\n <div style="position: relative; width: 150px; height: 150px; margin: 20px auto;">\n <span style="position: absolute; inset: 0;" class="loader-jqueue_popup"></span>\n <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center;">\n <div style="font-size: 14px; color: ${o};">${i.MESS_3}</div>\n <div style="font-size: 36px; color: ${o}; font-weight: bold;">${t}</div>\n </div>\n </div>\n </div>\n </div>\n `}static setupSocket(t,e,n,s,i){const o=new URLSearchParams(Object.assign(Object.assign({},e.query),{uuid:n})),a=new WebSocket(`${t}?${o.toString()}`);this.state.socket=a,a.onopen=()=>{this.log("WebSocket connected"),this.ttlInterval=setInterval((()=>{a.readyState===WebSocket.OPEN&&(a.send(JSON.stringify({event:"online-queue:set-ttl",data:Object.assign(Object.assign({},e.query),{uuid:n})})),this.log("Sent online-queue:set-ttl"))}),this.CONFIG.TTL_INTERVAL)},a.onmessage=t=>{try{const e=JSON.parse(t.data);"online-queue:status"===e.event?i(e.data):s&&e.event in s&&s[e.event](e.data,{createPopup:this.createPopup.bind(this),removePopup:this.removePopup.bind(this),preventNavigation:()=>this.toggleNavigation(!0),allowNavigation:()=>this.toggleNavigation(!1)})}catch(t){this.log("WebSocket message handling failed","error",t)}},a.onerror=t=>{this.log("WebSocket error","error",t)},a.onclose=t=>{this.log(`WebSocket closed: code=${t.code}, reason=${t.reason}`,"warn"),this.ttlInterval&&(clearInterval(this.ttlInterval),this.ttlInterval=null)}}static addStatusListener(t){this.statusListeners.push(t)}static removeStatusListener(t){this.statusListeners=this.statusListeners.filter((e=>e!==t))}static getQueueStatus(){return this.state.queueStatus}static fetchStatus(t,e,n){return s(this,void 0,void 0,(function*(){const e=new URLSearchParams({});return e.append("uuid",n),(yield fetch(`${t}${this.CONFIG.API_ENDPOINTS.STATUS}?${e.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}))}static getAdjustedPollInterval(t,e){return t>=100?e+t/100*1e3:e}static updateQueueStatus(t,e){var n,s;if(!t)return void this.log("Invalid status response received","warn");const{status:o,position:a,uuid:u}=t;if(this.state.queueStatus={status:o,position:a,uuid:u},this.state.storageKey&&"undefined"!=typeof sessionStorage&&sessionStorage.setItem(this.state.storageKey,u),this.statusListeners.forEach((t=>t({status:o,position:a,uuid:u}))),o===i.OnlineQueueStatus.ACTIVE)this.removePopup(),this.toggleNavigation(!1),this.statusInterval&&(clearInterval(this.statusInterval),this.statusInterval=null);else{const t="function"==typeof(null==e?void 0:e.content)?e.content(a):null!==(n=null==e?void 0:e.content)&&void 0!==n?n:this.getDefaultPopupContent(a,null!==(s=null==e?void 0:e.language)&&void 0!==s?s:"ko",e);this.createPopup(t,null==e?void 0:e.style),this.toggleNavigation(!0)}}static startStatusPolling(t,e,n,o,a,u,l){var r,d;let c=this.getAdjustedPollInterval(null!==(d=null===(r=this.state.queueStatus)||void 0===r?void 0:r.position)&&void 0!==d?d:0,a);const p=()=>s(this,void 0,void 0,(function*(){var s;try{const r=yield this.fetchStatus(e,null!==(s=n.query)&&void 0!==s?s:{},o);this.updateQueueStatus(r.data,u);const d=this.getAdjustedPollInterval(r.data.position,a);d!==c&&this.statusInterval&&(clearInterval(this.statusInterval),c=d,this.statusInterval=setInterval(p,c)),r.data.status===i.OnlineQueueStatus.ACTIVE&&this.setupSocket(t,n,o,l,(t=>this.updateQueueStatus(t.data,u)))}catch(t){this.log("Status polling failed","error",t)}}));this.statusInterval=setInterval(p,c)}static init(t){return s(this,arguments,void 0,(function*({wsUrl:t,apiUrl:e,socketConfig:n={},popupConfig:s={},customEvents:o={},pollInterval:a=this.CONFIG.STATUS_POLL_INTERVAL,option:u={storageKey:this.CONFIG.STORAGE_KEY}}){var l,r,d;if(!t||!e)throw new Error("Both wsUrl and apiUrl are required for initialization");if("undefined"==typeof WebSocket)throw new Error("WebSocket is not supported in this environment.");this.state=Object.assign(Object.assign({},this.state),{storageKey:null!==(l=u.storageKey)&&void 0!==l?l:this.CONFIG.STORAGE_KEY,wsUrl:t,apiUrl:e,socketConfig:n}),this.injectStyles(s);try{const u=yield fetch(`${e}${this.CONFIG.API_ENDPOINTS.JOIN}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(null!==(r=n.query)&&void 0!==r?r:{})}),l=yield u.json();return(null===(d=l.data)||void 0===d?void 0:d.uuid)?(this.updateQueueStatus(l.data,s),l.data.status===i.OnlineQueueStatus.ACTIVE?this.setupSocket(t,n,l.data.uuid,o,(t=>this.updateQueueStatus(t.data,s))):l.data.status===i.OnlineQueueStatus.WAITING&&this.startStatusPolling(t,e,n,l.data.uuid,a,s,o),{disconnect:()=>this.disconnect()}):(this.log("Join response missing UUID","error"),{disconnect:()=>this.disconnect()})}catch(t){return this.log("Initialization failed","error",t),{disconnect:()=>this.disconnect()}}}))}static cleanup(){this.state.storageKey&&"undefined"!=typeof sessionStorage&&sessionStorage.removeItem(this.state.storageKey),this.statusInterval&&(clearInterval(this.statusInterval),this.statusInterval=null),this.ttlInterval&&(clearInterval(this.ttlInterval),this.ttlInterval=null),this.removePopup(),this.toggleNavigation(!1),this.state={socket:null,popupEl:null,isNavigating:!1,storageKey:null,queueStatus:null,wsUrl:null,apiUrl:null,socketConfig:null},this.statusListeners=[]}static disconnect(){var t,e,n;(null===(t=this.state.socket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&(null===(e=this.state.queueStatus)||void 0===e?void 0:e.uuid)&&this.state.apiUrl&&this.sendLeaveRequest(),null===(n=this.state.socket)||void 0===n||n.close(),this.cleanup()}}o.CONFIG={STATUS_POLL_INTERVAL:1e3,TTL_INTERVAL:5e3,STORAGE_KEY:"queue_token",API_ENDPOINTS:{JOIN:"/join",STATUS:"/status",LEAVE:"/leave"},MESSAGES:{en:{MESS_1:"Progressing sequentially based on access order.",MESS_2:"We are doing our best to proceed quickly.",MESS_3:"Queue Number"},ko:{MESS_1:"접속한 순서대로 순차적 진행 중입니다.",MESS_2:"빠른 서비스 진행을 위해 최선을 다하고 있습니다.",MESS_3:"대기순번"}},STYLES:{POPUP:"\n position: fixed;\n inset: 0;\n width: 100%;\n height: 100%;\n background: #fff;\n z-index: 10000;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 28px;\n ",LOADER:t=>{var e,n;return`\n .loader-jqueue_popup {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n display: inline-block;\n position: relative;\n background: linear-gradient(0deg, ${null!==(e=null==t?void 0:t.loaderGradientEnd)&&void 0!==e?e:"rgba(39,107,255,0.05)"} 33%, ${null!==(n=null==t?void 0:t.loaderGradientStart)&&void 0!==n?n:"#276bff"} 100%);\n box-sizing: border-box;\n animation: rotation 1s linear infinite;\n }\n .loader-jqueue_popup::after {\n content: '';\n box-sizing: border-box;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 96%;\n height: 96%;\n border-radius: 50%;\n background: #fff;\n }\n @keyframes rotation {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n `}}},o.state={socket:null,popupEl:null,isNavigating:!1,storageKey:null,queueStatus:null,wsUrl:null,apiUrl:null,socketConfig:null},o.statusInterval=null,o.ttlInterval=null,o.statusListeners=[],"undefined"!=typeof window&&(window.ConnectionJQueueSdkWeb=o),e.default=o},613:(t,e)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.OnlineQueueStatus=void 0,function(t){t[t.WAITING=1]="WAITING",t[t.ACTIVE=2]="ACTIVE"}(n||(e.OnlineQueueStatus=n={}))}},e={},n=function n(s){var i=e[s];if(void 0!==i)return i.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,n),o.exports}(156);return n.default})())); | ||
//# sourceMappingURL=j-queue-sdk-web.js.map |
@@ -69,3 +69,4 @@ "use strict"; | ||
try { | ||
const data = JSON.stringify({ uuid: queueStatus.uuid }); | ||
const data = new URLSearchParams(); | ||
data.set('uuid', queueStatus === null || queueStatus === void 0 ? void 0 : queueStatus.uuid); | ||
navigator.sendBeacon(`${apiUrl}${this.CONFIG.API_ENDPOINTS.LEAVE}`, data); | ||
@@ -72,0 +73,0 @@ } |
{ | ||
"name": "j-queue-sdk-web", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "A TypeScript package to check WebSocket connection status and control web access with a popup", | ||
@@ -5,0 +5,0 @@ "main": "dist/j-queue-sdk-web.js", |
@@ -33,5 +33,4 @@ # j-queue-sdk-web | ||
query: { | ||
app_id: 'XXXXX', | ||
service_name: 'NEWS', | ||
ip_address: 'IP_ADDRESS_CLIENT', // Replace with actual IP | ||
app_id: 'XXXXX', // Replace with actual App id | ||
service_name: 'NEWS', // Replace with actual Service name | ||
}, | ||
@@ -38,0 +37,0 @@ }, |
@@ -162,3 +162,3 @@ import { InitConfig, PopupConfig, OnlineQueueStatus, CustomEventUtils } from './types'; | ||
try { | ||
const data = JSON.stringify({ uuid: queueStatus.uuid }); | ||
const data = new URLSearchParams(); data.set('uuid', queueStatus?.uuid); | ||
navigator.sendBeacon(`${apiUrl}${this.CONFIG.API_ENDPOINTS.LEAVE}`, data); | ||
@@ -165,0 +165,0 @@ } catch (error) { |
Sorry, the diff of this file is not supported yet
107494
0.22%1294
0.08%143
-0.69%