Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@queue-it/connector-javascript

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@queue-it/connector-javascript - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

9

dist/knownUser.js

@@ -164,2 +164,3 @@ "use strict";

KnownUser._cancelRequestByLocalConfig = function (targetUrl, queueitToken, cancelConfig, customerId, secretKey, contextProvider, debugEntries, isDebug) {
var _a;
targetUrl = this.generateTargetUrl(targetUrl, contextProvider);

@@ -185,4 +186,4 @@ if (isDebug) {

throw new models_1.ConnectorException("cancelConfig can not be null.");
if (!cancelConfig.eventId)
throw new models_1.ConnectorException("cancelConfig.eventId can not be null or empty.");
if (!(((_a = cancelConfig.waitingRoomIds) === null || _a === void 0 ? void 0 : _a.length) > 0))
throw new models_1.ConnectorException("cancelConfig.waitingRoomIds can not be null or empty.");
if (!cancelConfig.queueDomain)

@@ -212,3 +213,3 @@ throw new models_1.ConnectorException("cancelConfig.queueDomain can not be null or empty.");

}
queueEventConfig = new models_1.QueueEventConfig(matchedConfig.EventId, matchedConfig.InvolvedWaitingRoomIds || [], matchedConfig.LayoutName, matchedConfig.Culture, matchedConfig.QueueDomain, matchedConfig.ExtendCookieValidity, matchedConfig.CookieValidityMinute, matchedConfig.CookieDomain, matchedConfig.IsCookieHttpOnly || false, matchedConfig.IsCookieSecure || false, customerIntegrationInfo.Version, matchedConfig.Name, matchedConfig.VerifyQueueIdEnabled, matchedConfig.QueueIdUsageLimit);
queueEventConfig = new models_1.QueueEventConfig(matchedConfig.EventId, matchedConfig.InvolvedWaitingRoomIds, matchedConfig.LayoutName, matchedConfig.Culture, matchedConfig.QueueDomain, matchedConfig.ExtendCookieValidity, matchedConfig.CookieValidityMinute, matchedConfig.CookieDomain, matchedConfig.IsCookieHttpOnly || false, matchedConfig.IsCookieSecure || false, customerIntegrationInfo.Version, matchedConfig.Name, matchedConfig.VerifyQueueIdEnabled, matchedConfig.QueueIdUsageLimit);
return [4 /*yield*/, this._resolveQueueRequestByLocalConfig(targetUrl, queueitToken, queueEventConfig, customerId, secretKey, contextProvider, debugEntries, isDebug, apiKey)];

@@ -221,3 +222,3 @@ case 1: return [2 /*return*/, _a.sent()];

KnownUser.handleCancelAction = function (currentUrlWithoutQueueITToken, queueitToken, customerIntegrationInfo, customerId, secretKey, matchedConfig, contextProvider, debugEntries, isDebug) {
var cancelEventConfig = new models_1.CancelEventConfig(matchedConfig.EventId, matchedConfig.InvolvedWaitingRoomIds || [], matchedConfig.QueueDomain, matchedConfig.CookieDomain, matchedConfig.IsCookieHttpOnly || false, matchedConfig.IsCookieSecure || false, customerIntegrationInfo.Version, matchedConfig.Name);
var cancelEventConfig = new models_1.CancelEventConfig(queueitHelpers_1.Utils.concatenateWaitingRoomIds(matchedConfig.EventId, matchedConfig.InvolvedWaitingRoomIds), matchedConfig.QueueDomain, matchedConfig.CookieDomain, matchedConfig.IsCookieHttpOnly || false, matchedConfig.IsCookieSecure || false, customerIntegrationInfo.Version, matchedConfig.Name);
var targetUrl = this.generateTargetUrl(currentUrlWithoutQueueITToken, contextProvider);

@@ -224,0 +225,0 @@ return this._cancelRequestByLocalConfig(targetUrl, queueitToken, cancelEventConfig, customerId, secretKey, contextProvider, debugEntries, isDebug);

export declare class QueueEventConfig {
eventId: string;
involvedWaitingRoomIds: Array<string>;
allowedWaitingRoomIds: Array<string>;
layoutName: string;

@@ -16,8 +16,7 @@ culture: string;

queueIdUsageLimit: number | null;
constructor(eventId: string, involvedWaitingRoomIds: Array<string>, layoutName: string, culture: string, queueDomain: string, extendCookieValidity: boolean, cookieValidityMinute: number, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean, version: number, actionName: string, verifyActionEnabled: boolean, queueIdUsageLimit: number | null);
constructor(eventId: string, allowedWaitingRoomIds: Array<string>, layoutName: string, culture: string, queueDomain: string, extendCookieValidity: boolean, cookieValidityMinute: number, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean, version: number, actionName: string, verifyActionEnabled: boolean, queueIdUsageLimit: number | null);
getString(): string;
}
export declare class CancelEventConfig {
eventId: string;
involvedWaitingRoomIds: Array<string>;
waitingRoomIds: Array<string>;
queueDomain: string;

@@ -29,3 +28,3 @@ cookieDomain: string;

actionName: string;
constructor(eventId: string, involvedWaitingRoomIds: Array<string>, queueDomain: string, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean, version: number, actionName?: string);
constructor(waitingRoomIds: Array<string>, queueDomain: string, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean, version: number, actionName?: string);
getString(): string;

@@ -36,2 +35,3 @@ }

eventId: string;
involvedWaitingRoomIds: Array<string>;
queueId: string;

@@ -41,4 +41,3 @@ redirectUrl: string;

actionName: string;
involvedWaitingRoomIds: Array<string>;
constructor(actionType: string, eventId: string, queueId: string, redirectUrl: string, redirectType: string, actionName: string, involvedWaitingRoomIds: Array<string>);
constructor(actionType: string, eventId: string, involvedWaitingRoomIds: Array<string>, queueId: string, redirectUrl: string, redirectType: string, actionName: string);
isAjaxResult: boolean;

@@ -45,0 +44,0 @@ doRedirect(): boolean;

@@ -6,7 +6,7 @@ "use strict";

var QueueEventConfig = /** @class */ (function () {
function QueueEventConfig(eventId, involvedWaitingRoomIds, layoutName, culture, queueDomain, extendCookieValidity, cookieValidityMinute, cookieDomain, isCookieHttpOnly, isCookieSecure, version, actionName, verifyActionEnabled, queueIdUsageLimit) {
function QueueEventConfig(eventId, allowedWaitingRoomIds, layoutName, culture, queueDomain, extendCookieValidity, cookieValidityMinute, cookieDomain, isCookieHttpOnly, isCookieSecure, version, actionName, verifyActionEnabled, queueIdUsageLimit) {
if (actionName === void 0) { actionName = "unspecified"; }
if (verifyActionEnabled === void 0) { verifyActionEnabled = false; }
this.eventId = eventId;
this.involvedWaitingRoomIds = involvedWaitingRoomIds;
this.allowedWaitingRoomIds = allowedWaitingRoomIds;
this.layoutName = layoutName;

@@ -26,6 +26,14 @@ this.culture = culture;

QueueEventConfig.prototype.getString = function () {
return ("EventId:".concat(this.eventId, "&Version:").concat(this.version, "&ActionName:").concat(this.actionName, "&QueueDomain:").concat(this.queueDomain) +
"&CookieDomain:".concat(this.cookieDomain, "&IsCookieHttpOnly:").concat(this.isCookieHttpOnly, "&IsCookieSecure:").concat(this.isCookieSecure) +
return ("EventId:".concat(this.eventId) +
"&AllowedWaitingRoomIds:".concat(this.allowedWaitingRoomIds) +
"&Version:".concat(this.version) +
"&ActionName:".concat(this.actionName) +
"&QueueDomain:".concat(this.queueDomain) +
"&CookieDomain:".concat(this.cookieDomain) +
"&IsCookieHttpOnly:".concat(this.isCookieHttpOnly) +
"&IsCookieSecure:".concat(this.isCookieSecure) +
"&ExtendCookieValidity:".concat(this.extendCookieValidity) +
"&CookieValidityMinute:".concat(this.cookieValidityMinute, "&LayoutName:").concat(this.layoutName, "&Culture:").concat(this.culture));
"&CookieValidityMinute:".concat(this.cookieValidityMinute) +
"&LayoutName:".concat(this.layoutName) +
"&Culture:".concat(this.culture));
};

@@ -36,6 +44,5 @@ return QueueEventConfig;

var CancelEventConfig = /** @class */ (function () {
function CancelEventConfig(eventId, involvedWaitingRoomIds, queueDomain, cookieDomain, isCookieHttpOnly, isCookieSecure, version, actionName) {
function CancelEventConfig(waitingRoomIds, queueDomain, cookieDomain, isCookieHttpOnly, isCookieSecure, version, actionName) {
if (actionName === void 0) { actionName = "unspecified"; }
this.eventId = eventId;
this.involvedWaitingRoomIds = involvedWaitingRoomIds;
this.waitingRoomIds = waitingRoomIds;
this.queueDomain = queueDomain;

@@ -49,5 +56,8 @@ this.cookieDomain = cookieDomain;

CancelEventConfig.prototype.getString = function () {
return ("EventId:".concat(this.eventId, "&Version:").concat(this.version) +
return ("WaitingRoomIds:".concat(this.waitingRoomIds) +
"&Version:".concat(this.version) +
"&QueueDomain:".concat(this.queueDomain) +
"&CookieDomain:".concat(this.cookieDomain, "&IsCookieHttpOnly:").concat(this.isCookieHttpOnly, "&IsCookieSecure:").concat(this.isCookieSecure) +
"&CookieDomain:".concat(this.cookieDomain) +
"&IsCookieHttpOnly:".concat(this.isCookieHttpOnly) +
"&IsCookieSecure:".concat(this.isCookieSecure) +
"&ActionName:".concat(this.actionName));

@@ -59,5 +69,6 @@ };

var RequestValidationResult = /** @class */ (function () {
function RequestValidationResult(actionType, eventId, queueId, redirectUrl, redirectType, actionName, involvedWaitingRoomIds) {
function RequestValidationResult(actionType, eventId, involvedWaitingRoomIds, queueId, redirectUrl, redirectType, actionName) {
this.actionType = actionType;
this.eventId = eventId;
this.involvedWaitingRoomIds = involvedWaitingRoomIds;
this.queueId = queueId;

@@ -67,3 +78,2 @@ this.redirectUrl = redirectUrl;

this.actionName = actionName;
this.involvedWaitingRoomIds = involvedWaitingRoomIds;
}

@@ -70,0 +80,0 @@ RequestValidationResult.prototype.doRedirect = function () {

@@ -16,2 +16,3 @@ import { IConnectorContextProvider } from "./connectorContextProvider";

static generateUUID(): string;
static concatenateWaitingRoomIds(eventId: string, waitingRoomIds: Array<string>): Array<string>;
}

@@ -18,0 +19,0 @@ export declare class QueueUrlParams {

@@ -68,2 +68,9 @@ "use strict";

};
Utils.concatenateWaitingRoomIds = function (eventId, waitingRoomIds) {
return (eventId ? [eventId] : [])
.concat(waitingRoomIds ? waitingRoomIds : [])
.filter(function (element, index, array) {
return array.indexOf(element) === index;
});
};
return Utils;

@@ -187,7 +194,7 @@ }());

var redirectUrl = "https://".concat(customerId, ".api2.queue-it.net/").concat(customerId, "/diagnostics/connector/error/?code=").concat(errorCode);
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, redirectUrl, null, null, null);
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, null, redirectUrl, null, null);
};
ConnectorDiagnostics.prototype.setStateWithSetupError = function () {
this.hasError = true;
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, "https://api2.queue-it.net/diagnostics/connector/error/?code=setup", null, null, null);
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, null, "https://api2.queue-it.net/diagnostics/connector/error/?code=setup", null, null);
};

@@ -194,0 +201,0 @@ ConnectorDiagnostics.verify = function (customerId, secretKey, queueitToken, context) {

@@ -66,3 +66,3 @@ "use strict";

var redirectUrl = this.generateRedirectUrl(config.queueDomain, uriPath, query);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName, config.involvedWaitingRoomIds);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, config.allowedWaitingRoomIds, null, redirectUrl, null, config.actionName);
};

@@ -76,3 +76,3 @@ UserInQueueService.prototype.getQueueResult = function (targetUrl, config, customerId) {

var redirectUrl = this.generateRedirectUrl(config.queueDomain, "", query);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName, config.involvedWaitingRoomIds);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, config.allowedWaitingRoomIds, null, redirectUrl, null, config.actionName);
};

@@ -107,3 +107,3 @@ UserInQueueService.prototype.getQueryString = function (customerId, eventId, configVersion, culture, layoutName, actionName, invalidCookieReason, enqueueToken) {

return __awaiter(this, void 0, void 0, function () {
var requestValidationResult, verifyActionResult, isTokenValid, queueTokenParams, state, validationOutput;
var requestValidationResult, verifyActionResult, isTokenValid, allWaitingRoomIds, queueTokenParams, state, validationOutput;
return __generator(this, function (_a) {

@@ -114,4 +114,5 @@ switch (_a.label) {

isTokenValid = false;
allWaitingRoomIds = queueitHelpers_1.Utils.concatenateWaitingRoomIds(config.eventId, config.allowedWaitingRoomIds);
queueTokenParams = queueitHelpers_1.QueueParameterHelper.extractQueueParams(queueitToken);
state = this.userInQueueStateRepository.getState(config.eventId, config.involvedWaitingRoomIds, config.cookieValidityMinute, secretKey, true);
state = this.userInQueueStateRepository.getState(allWaitingRoomIds, config.cookieValidityMinute, secretKey, true, models_1.ActionTypes.QueueAction);
if (!state.isValid) return [3 /*break*/, 3];

@@ -128,6 +129,6 @@ if (!config.verifyActionEnabled) return [3 /*break*/, 2];

}
return [2 /*return*/, new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, state.queueId, null, state.redirectType, config.actionName, config.involvedWaitingRoomIds)];
return [2 /*return*/, new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, config.allowedWaitingRoomIds, state.queueId, null, state.redirectType, config.actionName)];
}
if (config.verifyActionEnabled && !verifyActionResult) {
this.userInQueueStateRepository.cancelQueueCookie(config.eventId, config.involvedWaitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
this.userInQueueStateRepository.cancelQueueCookie(allWaitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
return [2 /*return*/, this.getVerifyActionErrorresult(customerId, targetUrl, config, queueTokenParams)];

@@ -148,4 +149,4 @@ }

if (!config.verifyActionEnabled || verifyActionResult) {
this.userInQueueStateRepository.store(state.waitingRoomId, queueTokenParams.queueId, queueTokenParams.cookieValidityMinutes, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure, queueTokenParams.redirectType, queueTokenParams.hashedIp, secretKey);
requestValidationResult = new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, queueTokenParams.queueId, null, queueTokenParams.redirectType, config.actionName, config.involvedWaitingRoomIds);
this.userInQueueStateRepository.store(queueTokenParams.eventId, queueTokenParams.queueId, queueTokenParams.cookieValidityMinutes, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure, queueTokenParams.redirectType, queueTokenParams.hashedIp, secretKey);
requestValidationResult = new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, config.allowedWaitingRoomIds, queueTokenParams.queueId, null, queueTokenParams.redirectType, config.actionName);
}

@@ -170,3 +171,3 @@ if (config.verifyActionEnabled && !verifyActionResult) {

if (state.isFound && !isTokenValid) {
this.userInQueueStateRepository.cancelQueueCookie(config.eventId, config.involvedWaitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
this.userInQueueStateRepository.cancelQueueCookie(allWaitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
}

@@ -203,43 +204,22 @@ return [2 /*return*/, requestValidationResult];

//we do not care how long cookie is valid while canceling cookie
var state = this.userInQueueStateRepository.getState(config.eventId, config.involvedWaitingRoomIds, -1, secretKey, false);
var state = this.userInQueueStateRepository.getState(config.waitingRoomIds, -1, secretKey, false, models_1.ActionTypes.CancelAction);
if (state.isValid) {
this.userInQueueStateRepository.cancelQueueCookie(config.eventId, config.involvedWaitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
var waitingRoomIdToCancel = "";
var queueIdToCancel = "";
var useOldLogic = true;
var uriPath = void 0;
var query_1;
if (config.involvedWaitingRoomIds.length == 0) {
waitingRoomIdToCancel = config.eventId;
queueIdToCancel = state.queueId;
}
else if (state.waitingRoomQueueIdPairs.size == 1) {
waitingRoomIdToCancel = Array.from(state.waitingRoomQueueIdPairs.keys())[0];
queueIdToCancel = state.waitingRoomQueueIdPairs.get(waitingRoomIdToCancel);
}
else {
useOldLogic = false;
}
if (useOldLogic) {
query_1 = this.getQueryString(customerId, waitingRoomIdToCancel, config.version, null, null, config.actionName);
uriPath = "cancel/".concat(customerId, "/").concat(waitingRoomIdToCancel);
if (queueIdToCancel) {
uriPath += "/".concat(queueIdToCancel);
this.userInQueueStateRepository.cancelQueueCookie(config.waitingRoomIds, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
var uriPath = "cancel/multiple/".concat(customerId);
var query_1 = "wrl=";
config.waitingRoomIds.forEach(function (waitingRoomId, index, array) {
query_1 += "".concat(waitingRoomId);
if (state.waitingRoomQueueIdPairs.has(waitingRoomId)) {
query_1 += "~".concat(state.waitingRoomQueueIdPairs.get(waitingRoomId));
}
}
else {
uriPath = "cancel/multiple/".concat(customerId);
query_1 = "wrl=";
state.waitingRoomQueueIdPairs.forEach(function (key, value, map) {
query_1 += "".concat(value, "~").concat(key);
if (index < array.length - 1) {
query_1 += "_";
});
query_1 = query_1.replace(/\_$/, "");
}
}
});
query_1 += targetUrl ? "&r=" + queueitHelpers_1.Utils.encodeUrl(targetUrl) : "";
var redirectUrl = this.generateRedirectUrl(config.queueDomain, uriPath, query_1);
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, config.eventId, state.queueId, redirectUrl, state.redirectType, config.actionName, config.involvedWaitingRoomIds);
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, null, config.waitingRoomIds, state.queueId, redirectUrl, state.redirectType, config.actionName);
}
else {
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, config.eventId, null, null, null, config.actionName, null);
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, null, config.waitingRoomIds, null, null, config.actionName, null);
}

@@ -251,3 +231,3 @@ };

UserInQueueService.prototype.getIgnoreResult = function (actionName) {
return new models_1.RequestValidationResult(models_1.ActionTypes.IgnoreAction, null, null, null, null, actionName, null);
return new models_1.RequestValidationResult(models_1.ActionTypes.IgnoreAction, null, null, null, null, null, actionName);
};

@@ -328,6 +308,8 @@ UserInQueueService.prototype.callVerifyActionApi = function (contextProvider, customerId, eventId, queueId, queueIdUsageLimit, apiKey, actionName) {

UserInQueueService.prototype.validateToken = function (config, queueParams, secretKey) {
var _a;
var calculatedHash = queueitHelpers_1.Utils.generateSHA256Hash(secretKey, queueParams.queueITTokenWithoutHash, this.contextProvider);
if (calculatedHash !== queueParams.hashCode)
return new TokenValidationOutput(queueitHelpers_1.SessionValidationResult.newFailedResult(InvalidTokenErrorCode.Hash));
if (queueParams.eventId !== config.eventId)
if (queueParams.eventId !== config.eventId &&
((_a = config.allowedWaitingRoomIds) === null || _a === void 0 ? void 0 : _a.indexOf(queueParams.eventId)) === -1)
return new TokenValidationOutput(queueitHelpers_1.SessionValidationResult.newFailedResult(InvalidTokenErrorCode.WaitingRoomId));

@@ -349,3 +331,3 @@ if (queueParams.timeStamp < queueitHelpers_1.Utils.getCurrentTime())

};
UserInQueueService.SDK_VERSION = "javascript-" + "4.1.1";
UserInQueueService.SDK_VERSION = "javascript-" + "4.2.1";
return UserInQueueService;

@@ -352,0 +334,0 @@ }());

import { IConnectorContextProvider } from "./connectorContextProvider";
import { ActionTypes } from "./models";
import { SessionValidationResult } from "./queueitHelpers";

@@ -41,5 +42,5 @@ export declare enum CookieValidationResult {

private createCookie;
getState(eventId: string, involvedWaitingRoomIds: Array<string>, cookieValidityMinutes: number, secretKey: string, validateTime: boolean): CookieStateInfo;
getState(waitingRoomIds: Array<string>, cookieValidityMinutes: number, secretKey: string, validateTime: boolean, actionType: ActionTypes): CookieStateInfo;
private isCookieValid;
cancelQueueCookie(eventId: string, involvedWaitingRoomIds: Array<string>, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean): void;
cancelQueueCookie(waitingRoomIds: Array<string>, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean): void;
reissueQueueCookie(eventId: string, cookieValidityMinutes: number, cookieDomain: string, isCookieHttpOnly: boolean, isCookieSecure: boolean, secretKey: string): void;

@@ -46,0 +47,0 @@ private generateHash;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CookieStateInfo = exports.UserInQueueStateCookieRepository = exports.QueueItAcceptedCookie = exports.CookieValidationResult = void 0;
var models_1 = require("./models");
var queueitHelpers_1 = require("./queueitHelpers");

@@ -111,13 +112,15 @@ var CookieValidationResult;

};
UserInQueueStateCookieRepository.prototype.getState = function (eventId, involvedWaitingRoomIds, cookieValidityMinutes, secretKey, validateTime) {
var qitAcceptedCookie = null;
var clientIp = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
var noValidAcceptedCookieSet = true;
UserInQueueStateCookieRepository.prototype.getState = function (waitingRoomIds, cookieValidityMinutes, secretKey, validateTime, actionType) {
var validAcceptedCookieFound = false;
var queueitAcceptedCookie = null;
var cookieStateInfo = null;
var waitingRoomQueueIdPairs = new Map();
var clientIp = "";
try {
(eventId ? [eventId] : []).concat(involvedWaitingRoomIds).forEach(function (wrId) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(wrId);
clientIp = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
for (var _i = 0, waitingRoomIds_1 = waitingRoomIds; _i < waitingRoomIds_1.length; _i++) {
var waitingRoomId = waitingRoomIds_1[_i];
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(waitingRoomId);
var cookie = this.contextProvider

@@ -127,21 +130,27 @@ .getHttpRequest()

if (cookie) {
qitAcceptedCookie =
queueitAcceptedCookie =
QueueItAcceptedCookie.fromCookieHeader(cookie);
var cookieValidationResult = this.isCookieValid(secretKey, qitAcceptedCookie, wrId, cookieValidityMinutes, validateTime);
var cookieValidationResult = this.isCookieValid(secretKey, queueitAcceptedCookie, waitingRoomId, cookieValidityMinutes, validateTime);
if (cookieValidationResult !=
CookieValidationResult.NotFound) {
if (noValidAcceptedCookieSet) {
cookieStateInfo = new CookieStateInfo(wrId, qitAcceptedCookie.queueId, qitAcceptedCookie.fixedCookieValidityMinutes
? parseInt(qitAcceptedCookie.fixedCookieValidityMinutes)
: null, qitAcceptedCookie.redirectType, qitAcceptedCookie.hashedIp, cookieValidationResult, qitAcceptedCookie, clientIp, new Map());
noValidAcceptedCookieSet = false;
if (!validAcceptedCookieFound) {
cookieStateInfo = new CookieStateInfo(waitingRoomId, queueitAcceptedCookie.queueId, queueitAcceptedCookie.fixedCookieValidityMinutes
? parseInt(queueitAcceptedCookie.fixedCookieValidityMinutes)
: null, queueitAcceptedCookie.redirectType, queueitAcceptedCookie.hashedIp, cookieValidationResult, queueitAcceptedCookie, clientIp, new Map());
}
if (cookieValidationResult ==
CookieValidationResult.Valid) {
noValidAcceptedCookieSet = false;
waitingRoomQueueIdPairs.set(wrId, qitAcceptedCookie.queueId);
validAcceptedCookieFound = true;
// Safety net redirects don't include queue id
if (queueitAcceptedCookie.queueId) {
waitingRoomQueueIdPairs.set(waitingRoomId, queueitAcceptedCookie.queueId);
}
// Queue Action only needs one valid state
if (actionType == models_1.ActionTypes.QueueAction) {
break;
}
}
}
}
}.bind(this));
}
if (cookieStateInfo) {

@@ -152,6 +161,6 @@ cookieStateInfo.waitingRoomQueueIdPairs =

}
return new CookieStateInfo(eventId, "", null, "", null, CookieValidationResult.NotFound, null, clientIp, null);
return new CookieStateInfo(waitingRoomIds[0] || null, "", null, "", null, CookieValidationResult.NotFound, null, clientIp, null);
}
catch (ex) {
return new CookieStateInfo("", "", null, "", qitAcceptedCookie === null || qitAcceptedCookie === void 0 ? void 0 : qitAcceptedCookie.hashedIp, CookieValidationResult.Error, qitAcceptedCookie, clientIp, null);
return new CookieStateInfo("", "", null, "", queueitAcceptedCookie === null || queueitAcceptedCookie === void 0 ? void 0 : queueitAcceptedCookie.hashedIp, CookieValidationResult.Error, queueitAcceptedCookie, clientIp, null);
}

@@ -189,7 +198,5 @@ };

};
UserInQueueStateCookieRepository.prototype.cancelQueueCookie = function (eventId, involvedWaitingRoomIds, cookieDomain, isCookieHttpOnly, isCookieSecure) {
UserInQueueStateCookieRepository.prototype.cancelQueueCookie = function (waitingRoomIds, cookieDomain, isCookieHttpOnly, isCookieSecure) {
var _this = this;
(eventId ? [eventId] : [])
.concat(involvedWaitingRoomIds)
.forEach(function (wrId) {
waitingRoomIds.forEach(function (wrId) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(wrId);

@@ -196,0 +203,0 @@ _this.contextProvider

{
"name": "@queue-it/connector-javascript",
"version": "4.2.0",
"version": "4.2.1",
"description": "Connector to integrate Queue-it into a javascript based server side application.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc