🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

j-queue-sdk-web

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

j-queue-sdk-web - npm Package Compare versions

Comparing version

to
1.1.9

2

package.json
{
"name": "j-queue-sdk-web",
"version": "1.1.8",
"version": "1.1.9",
"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",

@@ -53,2 +53,3 @@ # j-queue-sdk-web

loaderGradientEnd: 'rgba(39,107,255,0.05)',
isShowLoadingOnConnect: true // Show loading popup before connection
},

@@ -81,3 +82,3 @@ customEvents: {

- `wsUrl` (string, required): Socket.IO server URL (e.g., `wss://queue-server.example.com`).
- `apiUrl` (string, optional): API server URL for HTTP requests (e.g., `https://api.example.com`). Required for sending `/leave` requests.
- `apiUrl` (string, optional): API server URL for HTTP requests (e.g., `https://api.example.com`). Required for sending `/leave` requests. Defaults to an empty string.
- `option` (object, optional): Additional configuration options for the SDK.

@@ -89,11 +90,12 @@ - `storageTokenKey` (string): Key used to store the queue UUID in `sessionStorage` (default: `'queue_token'`).

- `transports` (string[]): Transport methods (e.g., `['websocket']`). Defaults to `['websocket']`.
- `reconnectionAttempts` (number): Number of reconnection attempts (e.g., `3`). Defaults to `3`.
- `reconnectionDelay` (number): Delay between reconnection attempts in milliseconds (e.g., `1000`). Defaults to `1000`.
- `popupConfig` (object, optional):
- `reconnectionAttempts` (number): Number of reconnection attempts (default: `3`).
- `reconnectionDelay` (number): Delay between reconnection attempts in milliseconds (default: `1000`).
- `popupConfig` (object, optional): Configuration for the popup display.
- `language` ('en' | 'ko'): Language for default popup content (default: `'ko'`).
- `style` (string): Custom CSS for the popup.
- `content` (string | (position: number) => string): Custom HTML content for the popup, either as a static string or a function that takes `position` and returns HTML.
- `textColor` (string): Color for the popup text (e.g., `'#276bff'`).
- `loaderGradientStart` (string): Starting color of the loader gradient (e.g., `'#276bff'`).
- `loaderGradientEnd` (string): Ending color of the loader gradient (e.g., `'rgba(39,107,255,0.05)'`).
- `textColor` (string): Color for the popup text (default: `'#276bff'`).
- `loaderGradientStart` (string): Starting color of the loader gradient (default: `'#276bff'`).
- `loaderGradientEnd` (string): Ending color of the loader gradient (default: `'rgba(39,107,255,0.05)'`).
- `isShowLoadingOnConnect` (boolean): If `true`, displays a loading popup before establishing the socket connection. Defaults to `false`.
- `customEvents` (object, optional): Key-value pairs where the key is the event name and the value is a handler function. The handler receives event `data` and utilities `{ createPopup, removePopup, preventNavigation, allowNavigation }`.

@@ -108,3 +110,4 @@

- `WAITING`: Displays a customizable full-screen popup with the queue `position`, prevents navigation, and emits `online-queue:status` at an interval of 2000ms (adjusted by `(position / 100) * 1000`ms for positions >= 100).
- `EMPTY`: Logs an error (`'[j-queue-sdk-web] - Connect key does not exist!'`) to the console and clears any active intervals, taking no further UI or navigation actions.
- `EMPTY`: Displays an alert (`'[J Queue] - Connect key does not exist!'`) and clears any active intervals, taking no further UI or navigation actions.
- Supports pre-connection loading popup if `popupConfig.isShowLoadingOnConnect` is `true`, shown before the socket connects and removed on connection success or failure.
- Supports custom Socket.IO events via `customEvents`.

@@ -138,3 +141,3 @@ - Provides utilities (`createPopup`, `removePopup`, `preventNavigation`, `allowNavigation`) for custom event handlers.

Tests are located in the `tests` directory and cover initialization, status handling, socket events, disconnection, and listener management, with mocked Socket.IO connections.
Tests are located in the `tests` directory and cover initialization, status handling, socket events, disconnection, listener management, and loading popup behavior, with mocked Socket.IO connections.

@@ -141,0 +144,0 @@ ## Security Note