Socket
Socket
Sign inDemoInstall

@queue-it/connector-javascript

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.1 to 4.2.0

2

dist/defaultEnqueueTokenProvider.d.ts

@@ -0,3 +1,3 @@

import { Payload, Token } from "@queue-it/queue-token";
import { IEnqueueTokenProvider } from "./connectorContextProvider";
import { Token, Payload } from "@queue-it/queue-token";
export declare class DefaultEnqueueTokenProvider implements IEnqueueTokenProvider {

@@ -4,0 +4,0 @@ _customerId: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultEnqueueTokenProvider = void 0;
var TokenOrigin_1 = require("@queue-it/queue-token/dist/model/TokenOrigin");
var queueitHelpers_1 = require("./queueitHelpers");

@@ -26,4 +27,5 @@ var DefaultEnqueueTokenProvider = /** @class */ (function () {

}
var token = this._tokenGenerator.Enqueue(this._customerId)
.WithPayload(payload.Generate())
var token = this._tokenGenerator
.Enqueue(this._customerId)
.WithPayload(payload.WithOrigin(TokenOrigin_1.TokenOrigin.Connector).Generate())
.WithEventId(waitingRoomId)

@@ -30,0 +32,0 @@ .WithIpAddress(this._clientIp, this._xForwardedFor)

@@ -0,5 +1,5 @@

export * from "./connectorContextProvider";
export { DefaultEnqueueTokenProvider, ICustomData, } from "./defaultEnqueueTokenProvider";
export { KnownUser } from "./knownUser";
export * from "./models";
export { Utils, QueueParameterHelper, QueueUrlParams } from "./queueitHelpers";
export * from "./connectorContextProvider";
export { DefaultEnqueueTokenProvider, ICustomData } from "./defaultEnqueueTokenProvider";
export { QueueParameterHelper, QueueUrlParams, Utils } from "./queueitHelpers";

@@ -17,3 +17,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultEnqueueTokenProvider = exports.QueueUrlParams = exports.QueueParameterHelper = exports.Utils = exports.KnownUser = void 0;
exports.Utils = exports.QueueUrlParams = exports.QueueParameterHelper = exports.KnownUser = exports.DefaultEnqueueTokenProvider = void 0;
__exportStar(require("./connectorContextProvider"), exports);
var defaultEnqueueTokenProvider_1 = require("./defaultEnqueueTokenProvider");
Object.defineProperty(exports, "DefaultEnqueueTokenProvider", { enumerable: true, get: function () { return defaultEnqueueTokenProvider_1.DefaultEnqueueTokenProvider; } });
var knownUser_1 = require("./knownUser");

@@ -23,8 +26,5 @@ Object.defineProperty(exports, "KnownUser", { enumerable: true, get: function () { return knownUser_1.KnownUser; } });

var queueitHelpers_1 = require("./queueitHelpers");
Object.defineProperty(exports, "Utils", { enumerable: true, get: function () { return queueitHelpers_1.Utils; } });
Object.defineProperty(exports, "QueueParameterHelper", { enumerable: true, get: function () { return queueitHelpers_1.QueueParameterHelper; } });
Object.defineProperty(exports, "QueueUrlParams", { enumerable: true, get: function () { return queueitHelpers_1.QueueUrlParams; } });
__exportStar(require("./connectorContextProvider"), exports);
var defaultEnqueueTokenProvider_1 = require("./defaultEnqueueTokenProvider");
Object.defineProperty(exports, "DefaultEnqueueTokenProvider", { enumerable: true, get: function () { return defaultEnqueueTokenProvider_1.DefaultEnqueueTokenProvider; } });
Object.defineProperty(exports, "Utils", { enumerable: true, get: function () { return queueitHelpers_1.Utils; } });
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import * as IntegrationModels from './integrationConfigModel';
import { IHttpRequest } from '../connectorContextProvider';
import { IHttpRequest } from "../connectorContextProvider";
import * as IntegrationModels from "./integrationConfigModel";
export interface IIntegrationEvaluator {

@@ -4,0 +4,0 @@ getMatchedIntegrationConfig(customerIntegration: IntegrationModels.CustomerIntegration, currentPageUrl: string, request: IHttpRequest): IntegrationModels.IntegrationConfigModel;

@@ -27,4 +27,4 @@ "use strict";

exports.ComparisonOperatorHelper = exports.HttpHeaderValidatorHelper = exports.RequestBodyValidatorHelper = exports.UserAgentValidatorHelper = exports.CookieValidatorHelper = exports.UrlValidatorHelper = exports.IntegrationEvaluator = void 0;
var models_1 = require("../models");
var IntegrationModels = __importStar(require("./integrationConfigModel"));
var models_1 = require("../models");
var IntegrationEvaluator = /** @class */ (function () {

@@ -189,3 +189,5 @@ function IntegrationEvaluator() {

if (ignoreCase)
evaluation = value.toUpperCase().indexOf(valueToCompare.toUpperCase()) !== -1;
evaluation =
value.toUpperCase().indexOf(valueToCompare.toUpperCase()) !==
-1;
else

@@ -192,0 +194,0 @@ evaluation = value.indexOf(valueToCompare) !== -1;

export declare class IntegrationConfigModel {
Name: string;
EventId: string;
InvolvedWaitingRoomIds: Array<string>;
CookieDomain: string;

@@ -5,0 +6,0 @@ IsCookieHttpOnly: boolean;

@@ -1,4 +0,4 @@

import { UserInQueueService } from './userInQueueService';
import { IConnectorContextProvider } from './connectorContextProvider';
import { CancelEventConfig, QueueEventConfig, RequestValidationResult } from './models';
import { IConnectorContextProvider } from "./connectorContextProvider";
import { CancelEventConfig, QueueEventConfig, RequestValidationResult } from "./models";
import { UserInQueueService } from "./userInQueueService";
export declare class KnownUser {

@@ -5,0 +5,0 @@ static readonly QueueITTokenKey = "queueittoken";

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

exports.KnownUser = void 0;
var IntegrationConfigHelpers = __importStar(require("./IntegrationConfig/integrationConfigHelpers"));
var models_1 = require("./models");
var queueitHelpers_1 = require("./queueitHelpers");
var userInQueueService_1 = require("./userInQueueService");
var userInQueueStateCookieRepository_1 = require("./userInQueueStateCookieRepository");
var models_1 = require("./models");
var queueitHelpers_1 = require("./queueitHelpers");
var IntegrationConfigHelpers = __importStar(require("./IntegrationConfig/integrationConfigHelpers"));
var KnownUser = /** @class */ (function () {

@@ -79,17 +79,34 @@ function KnownUser() {

KnownUser.isQueueAjaxCall = function (contextProvider) {
return !!contextProvider.getHttpRequest().getHeader(this.QueueITAjaxHeaderKey);
return !!contextProvider
.getHttpRequest()
.getHeader(this.QueueITAjaxHeaderKey);
};
KnownUser.generateTargetUrl = function (originalTargetUrl, contextProvider) {
return !this.isQueueAjaxCall(contextProvider) ?
originalTargetUrl :
queueitHelpers_1.Utils.decodeUrl(contextProvider.getHttpRequest().getHeader(this.QueueITAjaxHeaderKey));
return !this.isQueueAjaxCall(contextProvider)
? originalTargetUrl
: queueitHelpers_1.Utils.decodeUrl(contextProvider
.getHttpRequest()
.getHeader(this.QueueITAjaxHeaderKey));
};
KnownUser.logExtraRequestDetails = function (debugEntries, contextProvider) {
debugEntries["ServerUtcTime"] = (new Date()).toISOString().split('.')[0] + "Z";
debugEntries["RequestIP"] = contextProvider.getHttpRequest().getUserHostAddress();
debugEntries["RequestHttpHeader_Via"] = contextProvider.getHttpRequest().getHeader("Via");
debugEntries["RequestHttpHeader_Forwarded"] = contextProvider.getHttpRequest().getHeader("Forwarded");
debugEntries["RequestHttpHeader_XForwardedFor"] = contextProvider.getHttpRequest().getHeader("X-Forwarded-For");
debugEntries["RequestHttpHeader_XForwardedHost"] = contextProvider.getHttpRequest().getHeader("X-Forwarded-Host");
debugEntries["RequestHttpHeader_XForwardedProto"] = contextProvider.getHttpRequest().getHeader("X-Forwarded-Proto");
debugEntries["ServerUtcTime"] =
new Date().toISOString().split(".")[0] + "Z";
debugEntries["RequestIP"] = contextProvider
.getHttpRequest()
.getUserHostAddress();
debugEntries["RequestHttpHeader_Via"] = contextProvider
.getHttpRequest()
.getHeader("Via");
debugEntries["RequestHttpHeader_Forwarded"] = contextProvider
.getHttpRequest()
.getHeader("Forwarded");
debugEntries["RequestHttpHeader_XForwardedFor"] = contextProvider
.getHttpRequest()
.getHeader("X-Forwarded-For");
debugEntries["RequestHttpHeader_XForwardedHost"] = contextProvider
.getHttpRequest()
.getHeader("X-Forwarded-Host");
debugEntries["RequestHttpHeader_XForwardedProto"] = contextProvider
.getHttpRequest()
.getHeader("X-Forwarded-Proto");
};

@@ -119,4 +136,7 @@ KnownUser.setDebugCookie = function (debugEntries, contextProvider) {

debugEntries["QueueitToken"] = queueitToken;
debugEntries["OriginalUrl"] = contextProvider.getHttpRequest().getAbsoluteUri();
debugEntries["QueueConfig"] = queueConfig !== null ? queueConfig.getString() : "NULL";
debugEntries["OriginalUrl"] = contextProvider
.getHttpRequest()
.getAbsoluteUri();
debugEntries["QueueConfig"] =
queueConfig !== null ? queueConfig.getString() : "NULL";
this.logExtraRequestDetails(debugEntries, contextProvider);

@@ -152,4 +172,7 @@ }

debugEntries["QueueitToken"] = queueitToken;
debugEntries["CancelConfig"] = cancelConfig !== null ? cancelConfig.getString() : "NULL";
debugEntries["OriginalUrl"] = contextProvider.getHttpRequest().getAbsoluteUri();
debugEntries["CancelConfig"] =
cancelConfig !== null ? cancelConfig.getString() : "NULL";
debugEntries["OriginalUrl"] = contextProvider
.getHttpRequest()
.getAbsoluteUri();
this.logExtraRequestDetails(debugEntries, contextProvider);

@@ -191,3 +214,3 @@ }

}
queueEventConfig = new models_1.QueueEventConfig(matchedConfig.EventId, 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)];

@@ -200,3 +223,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.QueueDomain, matchedConfig.CookieDomain, matchedConfig.IsCookieHttpOnly || false, matchedConfig.IsCookieSecure || false, customerIntegrationInfo.Version, matchedConfig.Name);
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 targetUrl = this.generateTargetUrl(currentUrlWithoutQueueITToken, contextProvider);

@@ -267,3 +290,5 @@ return this._cancelRequestByLocalConfig(targetUrl, queueitToken, cancelEventConfig, customerId, secretKey, contextProvider, debugEntries, isDebug);

debugEntries["QueueitToken"] = queueitToken;
debugEntries["OriginalUrl"] = contextProvider.getHttpRequest().getAbsoluteUri();
debugEntries["OriginalUrl"] = contextProvider
.getHttpRequest()
.getAbsoluteUri();
this.logExtraRequestDetails(debugEntries, contextProvider);

@@ -273,3 +298,6 @@ }

if (connectorDiagnostics.isEnabled) {
debugEntries["ConfigVersion"] = customerIntegrationInfo && customerIntegrationInfo.Version ? customerIntegrationInfo.Version.toString() : "NULL";
debugEntries["ConfigVersion"] =
customerIntegrationInfo && customerIntegrationInfo.Version
? customerIntegrationInfo.Version.toString()
: "NULL";
}

@@ -283,6 +311,8 @@ if (!currentUrlWithoutQueueITToken)

if (connectorDiagnostics.isEnabled) {
debugEntries["MatchedConfig"] = matchedConfig ? matchedConfig.Name : "NULL";
debugEntries["MatchedConfig"] = matchedConfig
? matchedConfig.Name
: "NULL";
}
if (!matchedConfig)
return [2 /*return*/, new models_1.RequestValidationResult(null, null, null, null, null, null)];
return [2 /*return*/, new models_1.RequestValidationResult(null, null, null, null, null, null, null)];
_a = matchedConfig.ActionType;

@@ -289,0 +319,0 @@ switch (_a) {

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

@@ -15,3 +16,3 @@ culture: string;

queueIdUsageLimit: number | null;
constructor(eventId: 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, 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);
getString(): string;

@@ -21,2 +22,3 @@ }

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

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

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

@@ -39,3 +41,4 @@ }

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

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

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

var QueueEventConfig = /** @class */ (function () {
function QueueEventConfig(eventId, layoutName, culture, queueDomain, extendCookieValidity, cookieValidityMinute, cookieDomain, isCookieHttpOnly, isCookieSecure, version, actionName, verifyActionEnabled, queueIdUsageLimit) {
if (actionName === void 0) { actionName = 'unspecified'; }
function QueueEventConfig(eventId, involvedWaitingRoomIds, 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.layoutName = layoutName;

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

QueueEventConfig.prototype.getString = function () {
return "EventId:".concat(this.eventId, "&Version:").concat(this.version, "&ActionName:").concat(this.actionName, "&QueueDomain:").concat(this.queueDomain) +
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) +
"&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));
};

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

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

@@ -47,6 +49,6 @@ this.cookieDomain = cookieDomain;

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

@@ -57,3 +59,3 @@ return CancelEventConfig;

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

@@ -65,2 +67,3 @@ this.eventId = eventId;

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

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

@@ -1,3 +0,3 @@

import { RequestValidationResult } from './models';
import { IConnectorContextProvider } from "./connectorContextProvider";
import { RequestValidationResult } from "./models";
export declare enum ErrorCode {

@@ -4,0 +4,0 @@ Hash = "hash",

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

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
return '%' + c.charCodeAt(0).toString(16);
return "%" + c.charCodeAt(0).toString(16);
});

@@ -29,3 +29,5 @@ };

var cryptoProvider;
if (context && context.getCryptoProvider && (cryptoProvider = context.getCryptoProvider())) {
if (context &&
context.getCryptoProvider &&
(cryptoProvider = context.getCryptoProvider())) {
return cryptoProvider.getSha256Hash(secretKey, stringToHash);

@@ -48,9 +50,8 @@ }

var l;
var o = '';
var o = "";
var n;
s += '';
s += "";
for (i = 0, l = s.length; i < l; i++) {
n = s.charCodeAt(i)
.toString(16);
o += n.length < 2 ? '0' + n : n;
n = s.charCodeAt(i).toString(16);
o += n.length < 2 ? "0" + n : n;
}

@@ -145,5 +146,5 @@ return o;

QueueParameterHelper.RedirectTypeKey = "rt";
QueueParameterHelper.HashedIPKey = 'hip';
QueueParameterHelper.KeyValueSeparatorChar = '_';
QueueParameterHelper.KeyValueSeparatorGroupChar = '~';
QueueParameterHelper.HashedIPKey = "hip";
QueueParameterHelper.KeyValueSeparatorChar = "_";
QueueParameterHelper.KeyValueSeparatorGroupChar = "~";
return QueueParameterHelper;

@@ -158,6 +159,6 @@ }());

var result = {};
var items = cookieValue.split('&');
var items = cookieValue.split("&");
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
var keyValue = item.split('=');
var keyValue = item.split("=");
result[keyValue[0]] = keyValue[1];

@@ -190,7 +191,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);
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, redirectUrl, null, 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);
this.validationResult = new models_1.RequestValidationResult("ConnectorDiagnosticsRedirect", null, null, "https://api2.queue-it.net/diagnostics/connector/error/?code=setup", null, null, null);
};

@@ -273,4 +274,4 @@ ConnectorDiagnostics.verify = function (customerId, secretKey, queueitToken, context) {

resultToModify.details["ip"] = "";
resultToModify.details['cip'] = Utils.bin2hex(clientIp);
resultToModify.details['hip'] = hashedIp;
resultToModify.details["cip"] = Utils.bin2hex(clientIp);
resultToModify.details["hip"] = hashedIp;
return resultToModify;

@@ -281,4 +282,4 @@ };

resultToModify = resultToModify !== null && resultToModify !== void 0 ? resultToModify : new SessionValidationResult(false);
resultToModify.details['hash'] = '';
resultToModify.details['h'] = storedHash;
resultToModify.details["hash"] = "";
resultToModify.details["h"] = storedHash;
return resultToModify;

@@ -289,3 +290,3 @@ };

resultToModify = resultToModify !== null && resultToModify !== void 0 ? resultToModify : new SessionValidationResult(false);
resultToModify.details['expired'] = '';
resultToModify.details["expired"] = "";
return resultToModify;

@@ -296,3 +297,3 @@ };

resultToModify = resultToModify !== null && resultToModify !== void 0 ? resultToModify : new SessionValidationResult(false);
resultToModify.details['error'] = '';
resultToModify.details["error"] = "";
return resultToModify;

@@ -299,0 +300,0 @@ };

@@ -1,4 +0,4 @@

import { RequestValidationResult, QueueEventConfig, CancelEventConfig } from './models';
import { UserInQueueStateCookieRepository } from './userInQueueStateCookieRepository';
import { IConnectorContextProvider } from './connectorContextProvider';
import { IConnectorContextProvider } from "./connectorContextProvider";
import { CancelEventConfig, QueueEventConfig, RequestValidationResult } from "./models";
import { UserInQueueStateCookieRepository } from "./userInQueueStateCookieRepository";
export declare enum InvalidTokenErrorCode {

@@ -20,3 +20,3 @@ Hash = "hash",

private generateRedirectUrl;
validateQueueRequest(targetUrl: string, queueitToken: string, config: QueueEventConfig, customerId: any, secretKey: any, apiKey: string): Promise<RequestValidationResult>;
validateQueueRequest(targetUrl: string, queueitToken: string, config: QueueEventConfig, customerId: string, secretKey: string, apiKey: string): Promise<RequestValidationResult>;
private getVerifyActionErrorresult;

@@ -23,0 +23,0 @@ private validateVerifyAction;

@@ -40,4 +40,4 @@ "use strict";

exports.UserInQueueService = exports.InvalidTokenErrorCode = void 0;
var models_1 = require("./models");
var queueitHelpers_1 = require("./queueitHelpers");
var models_1 = require("./models");
var InvalidTokenErrorCode;

@@ -58,3 +58,5 @@ (function (InvalidTokenErrorCode) {

var errorCode = validationResult.errorCode;
var queueItTokenParam = qParams ? "&queueittoken=".concat(qParams.queueITToken) : '';
var queueItTokenParam = qParams
? "&queueittoken=".concat(qParams.queueITToken)
: "";
var query = this.getQueryString(customerId, config.eventId, config.version, config.culture, config.layoutName, config.actionName, validationResult.getInvalidReason()) +

@@ -66,12 +68,12 @@ queueItTokenParam +

var redirectUrl = this.generateRedirectUrl(config.queueDomain, uriPath, query);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName, config.involvedWaitingRoomIds);
};
UserInQueueService.prototype.getQueueResult = function (targetUrl, config, customerId) {
var _a;
var enqueueToken = this.contextProvider.getEnqueueTokenProvider
&& ((_a = this.contextProvider.getEnqueueTokenProvider()) === null || _a === void 0 ? void 0 : _a.getEnqueueToken(config.eventId));
var query = this.getQueryString(customerId, config.eventId, config.version, config.culture, config.layoutName, config.actionName, null, enqueueToken) +
(targetUrl ? "&t=" + queueitHelpers_1.Utils.encodeUrl(targetUrl) : "");
var enqueueToken = this.contextProvider.getEnqueueTokenProvider &&
((_a = this.contextProvider
.getEnqueueTokenProvider()) === null || _a === void 0 ? void 0 : _a.getEnqueueToken(config.eventId));
var query = this.getQueryString(customerId, config.eventId, config.version, config.culture, config.layoutName, config.actionName, null, enqueueToken) + (targetUrl ? "&t=" + queueitHelpers_1.Utils.encodeUrl(targetUrl) : "");
var redirectUrl = this.generateRedirectUrl(config.queueDomain, "", query);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName);
return new models_1.RequestValidationResult(models_1.ActionTypes.QueueAction, config.eventId, null, redirectUrl, null, config.actionName, config.involvedWaitingRoomIds);
};

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

queueTokenParams = queueitHelpers_1.QueueParameterHelper.extractQueueParams(queueitToken);
state = this.userInQueueStateRepository.getState(config.eventId, config.cookieValidityMinute, secretKey, true);
state = this.userInQueueStateRepository.getState(config.eventId, config.involvedWaitingRoomIds, config.cookieValidityMinute, secretKey, true);
if (!state.isValid) return [3 /*break*/, 3];

@@ -124,8 +126,8 @@ if (!config.verifyActionEnabled) return [3 /*break*/, 2];

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

@@ -146,4 +148,4 @@ }

if (!config.verifyActionEnabled || verifyActionResult) {
this.userInQueueStateRepository.store(config.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, queueTokenParams.queueId, null, queueTokenParams.redirectType, config.actionName);
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);
}

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

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

@@ -201,16 +203,43 @@ return [2 /*return*/, requestValidationResult];

//we do not care how long cookie is valid while canceling cookie
var state = this.userInQueueStateRepository.getState(config.eventId, -1, secretKey, false);
var state = this.userInQueueStateRepository.getState(config.eventId, config.involvedWaitingRoomIds, -1, secretKey, false);
if (state.isValid) {
this.userInQueueStateRepository.cancelQueueCookie(config.eventId, config.cookieDomain, config.isCookieHttpOnly, config.isCookieSecure);
var query = this.getQueryString(customerId, config.eventId, config.version, null, null, config.actionName) +
(targetUrl ? "&r=" + queueitHelpers_1.Utils.encodeUrl(targetUrl) : "");
var uriPath = "cancel/".concat(customerId, "/").concat(config.eventId);
if (state.queueId) {
uriPath += "/".concat(state.queueId);
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;
}
var redirectUrl = this.generateRedirectUrl(config.queueDomain, uriPath, query);
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, config.eventId, state.queueId, redirectUrl, state.redirectType, config.actionName);
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);
}
}
else {
uriPath = "cancel/multiple/".concat(customerId);
query_1 = "wrl=";
state.waitingRoomQueueIdPairs.forEach(function (key, value, map) {
query_1 += "".concat(value, "~").concat(key);
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);
}
else {
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, config.eventId, null, null, null, config.actionName);
return new models_1.RequestValidationResult(models_1.ActionTypes.CancelAction, config.eventId, null, null, null, config.actionName, null);
}

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

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

@@ -235,9 +264,15 @@ UserInQueueService.prototype.callVerifyActionApi = function (contextProvider, customerId, eventId, queueId, queueIdUsageLimit, apiKey, actionName) {

}
RESPONSE_BODY_VARIABLE_NAME = 'QIdUsageCount';
RESPONSE_BODY_VARIABLE_NAME = "QIdUsageCount";
endpointurl = "/queueit/verifyqidusage/".concat(customerId, "/").concat(eventId, "/").concat(queueId, "/").concat(queueIdUsageLimit);
ip = this.contextProvider.getHttpRequest().getUserHostAddress();
requestUrl = this.contextProvider.getHttpRequest().getAbsoluteUri();
userAgent = this.contextProvider.getHttpRequest().getUserAgent();
ip = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
requestUrl = this.contextProvider
.getHttpRequest()
.getAbsoluteUri();
userAgent = this.contextProvider
.getHttpRequest()
.getUserAgent();
options = {
method: 'POST'
method: "POST",
};

@@ -248,12 +283,12 @@ options.body = JSON.stringify({

ActionName: actionName,
UserAgent: userAgent
UserAgent: userAgent,
});
options.headers = {
"api-key": apiKey,
"port": 443,
port: 443,
"Content-Type": "application/json",
"Content-Length": options.body.length
"Content-Length": options.body.length,
};
isAllowed = false;
responseMessage = '';
responseMessage = "";
_a.label = 1;

@@ -270,3 +305,5 @@ case 1:

}
else if (apiCallResult.httpStatusCode == 403 && !Number.isNaN(usedQidNumber) && usedQidNumber >= queueIdUsageLimit) {
else if (apiCallResult.httpStatusCode == 403 &&
!Number.isNaN(usedQidNumber) &&
usedQidNumber >= queueIdUsageLimit) {
isAllowed = false;

@@ -286,3 +323,3 @@ }

IsAllowed: isAllowed,
ResponseMessage: responseMessage
ResponseMessage: responseMessage,
}];

@@ -302,3 +339,5 @@ case 5: return [2 /*return*/];

return new TokenValidationOutput(queueitHelpers_1.SessionValidationResult.newFailedResult(InvalidTokenErrorCode.Expired));
var clientIp = this.contextProvider.getHttpRequest().getUserHostAddress();
var clientIp = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
if (queueParams.hashedIp && clientIp) {

@@ -305,0 +344,0 @@ var expectedIpHash = queueitHelpers_1.Utils.generateSHA256Hash(secretKey, clientIp, this.contextProvider);

@@ -1,3 +0,3 @@

import { IConnectorContextProvider } from './connectorContextProvider';
import { SessionValidationResult } from './queueitHelpers';
import { IConnectorContextProvider } from "./connectorContextProvider";
import { SessionValidationResult } from "./queueitHelpers";
export declare enum CookieValidationResult {

@@ -41,5 +41,5 @@ NotFound = 0,

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

@@ -49,2 +49,3 @@ private generateHash;

export declare class CookieStateInfo {
waitingRoomId: string;
queueId: string;

@@ -57,3 +58,4 @@ fixedCookieValidityMinutes: number | null;

clientIp: string | null;
constructor(queueId: string, fixedCookieValidityMinutes: number | null, redirectType: string, hashedIp: string | null, cookieValidationResult: CookieValidationResult, cookie: QueueItAcceptedCookie, clientIp: string | null);
waitingRoomQueueIdPairs: Map<string, string>;
constructor(waitingRoomId: string, queueId: string, fixedCookieValidityMinutes: number | null, redirectType: string, hashedIp: string | null, cookieValidationResult: CookieValidationResult, cookie: QueueItAcceptedCookie, clientIp: string | null, waitingRoomQueueIdPairs: Map<string, string>);
get isValid(): boolean;

@@ -60,0 +62,0 @@ get isFound(): boolean;

@@ -62,3 +62,5 @@ "use strict";

isCookieSecure = isCookieSecure == null ? false : isCookieSecure;
this.createCookie(eventId, queueId, fixedCookieValidityMinutes ? fixedCookieValidityMinutes.toString() : "", redirectType, hashedIp, cookieDomain, isCookieHttpOnly, isCookieSecure, secretKey);
this.createCookie(eventId, queueId, fixedCookieValidityMinutes
? fixedCookieValidityMinutes.toString()
: "", redirectType, hashedIp, cookieDomain, isCookieHttpOnly, isCookieSecure, secretKey);
};

@@ -69,5 +71,11 @@ UserInQueueStateCookieRepository.prototype.createCookie = function (eventId, queueId, fixedCookieValidityMinutes, redirectType, hashedIp, cookieDomain, isCookieHttpOnly, isCookieSecure, secretKey) {

var cookieValues = new Array();
cookieValues.push({ key: QueueItAcceptedCookie.EventIdKey, value: eventId });
cookieValues.push({
key: QueueItAcceptedCookie.EventIdKey,
value: eventId,
});
if (queueId) {
cookieValues.push({ key: QueueItAcceptedCookie.QueueIdKey, value: queueId });
cookieValues.push({
key: QueueItAcceptedCookie.QueueIdKey,
value: queueId,
});
}

@@ -77,13 +85,22 @@ if (fixedCookieValidityMinutes) {

key: QueueItAcceptedCookie.FixedCookieValidityMinutesKey,
value: fixedCookieValidityMinutes
value: fixedCookieValidityMinutes,
});
}
cookieValues.push({ key: QueueItAcceptedCookie.RedirectTypeKey, value: redirectType.toLowerCase() });
cookieValues.push({ key: QueueItAcceptedCookie.IssueTimeKey, value: issueTime });
cookieValues.push({
key: QueueItAcceptedCookie.RedirectTypeKey,
value: redirectType.toLowerCase(),
});
cookieValues.push({
key: QueueItAcceptedCookie.IssueTimeKey,
value: issueTime,
});
if (hashedIp) {
cookieValues.push({ key: QueueItAcceptedCookie.HashedIpKey, value: hashedIp });
cookieValues.push({
key: QueueItAcceptedCookie.HashedIpKey,
value: hashedIp,
});
}
cookieValues.push({
key: QueueItAcceptedCookie.HashKey,
value: this.generateHash(eventId.toLowerCase(), queueId, fixedCookieValidityMinutes, redirectType.toLowerCase(), issueTime, hashedIp, secretKey)
value: this.generateHash(eventId.toLowerCase(), queueId, fixedCookieValidityMinutes, redirectType.toLowerCase(), issueTime, hashedIp, secretKey),
});

@@ -93,23 +110,49 @@ var tomorrow = new Date();

var expire = Math.floor(tomorrow.getTime() / 1000);
this.contextProvider.getHttpResponse().setCookie(cookieKey, queueitHelpers_1.CookieHelper.toValueFromKeyValueCollection(cookieValues), cookieDomain, expire, isCookieHttpOnly, isCookieSecure);
this.contextProvider
.getHttpResponse()
.setCookie(cookieKey, queueitHelpers_1.CookieHelper.toValueFromKeyValueCollection(cookieValues), cookieDomain, expire, isCookieHttpOnly, isCookieSecure);
};
UserInQueueStateCookieRepository.prototype.getState = function (eventId, cookieValidityMinutes, secretKey, validateTime) {
UserInQueueStateCookieRepository.prototype.getState = function (eventId, involvedWaitingRoomIds, cookieValidityMinutes, secretKey, validateTime) {
var qitAcceptedCookie = null;
var clientIp = this.contextProvider.getHttpRequest().getUserHostAddress();
var clientIp = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
var noValidAcceptedCookieSet = true;
var cookieStateInfo = null;
var waitingRoomQueueIdPairs = new Map();
try {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(eventId);
var cookie = this.contextProvider.getHttpRequest().getCookieValue(cookieKey);
if (!cookie)
return new CookieStateInfo("", null, "", null, CookieValidationResult.NotFound, null, clientIp);
qitAcceptedCookie = QueueItAcceptedCookie.fromCookieHeader(cookie);
var cookieValidationResult = this.isCookieValid(secretKey, qitAcceptedCookie, eventId, cookieValidityMinutes, validateTime);
if (cookieValidationResult != CookieValidationResult.Valid) {
return new CookieStateInfo("", null, "", qitAcceptedCookie.hashedIp, cookieValidationResult, qitAcceptedCookie, clientIp);
(eventId ? [eventId] : []).concat(involvedWaitingRoomIds).forEach(function (wrId) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(wrId);
var cookie = this.contextProvider
.getHttpRequest()
.getCookieValue(cookieKey);
if (cookie) {
qitAcceptedCookie =
QueueItAcceptedCookie.fromCookieHeader(cookie);
var cookieValidationResult = this.isCookieValid(secretKey, qitAcceptedCookie, wrId, 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 (cookieValidationResult ==
CookieValidationResult.Valid) {
noValidAcceptedCookieSet = false;
waitingRoomQueueIdPairs.set(wrId, qitAcceptedCookie.queueId);
}
}
}
}.bind(this));
if (cookieStateInfo) {
cookieStateInfo.waitingRoomQueueIdPairs =
waitingRoomQueueIdPairs;
return cookieStateInfo;
}
return new CookieStateInfo(qitAcceptedCookie.queueId, qitAcceptedCookie.fixedCookieValidityMinutes
? parseInt(qitAcceptedCookie.fixedCookieValidityMinutes)
: null, qitAcceptedCookie.redirectType, qitAcceptedCookie.hashedIp, CookieValidationResult.Valid, qitAcceptedCookie, clientIp);
return new CookieStateInfo(eventId, "", 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);
return new CookieStateInfo("", "", null, "", qitAcceptedCookie === null || qitAcceptedCookie === void 0 ? void 0 : qitAcceptedCookie.hashedIp, CookieValidationResult.Error, qitAcceptedCookie, clientIp, null);
}

@@ -125,3 +168,5 @@ };

if (validateTime) {
var validity = cookie.fixedCookieValidityMinutes ? parseInt(cookie.fixedCookieValidityMinutes) : cookieValidityMinutes;
var validity = cookie.fixedCookieValidityMinutes
? parseInt(cookie.fixedCookieValidityMinutes)
: cookieValidityMinutes;
var expirationTime = parseInt(cookie.issueTimeString) + validity * 60;

@@ -131,3 +176,5 @@ if (expirationTime < queueitHelpers_1.Utils.getCurrentTime())

}
var userHostAddress = this.contextProvider.getHttpRequest().getUserHostAddress();
var userHostAddress = this.contextProvider
.getHttpRequest()
.getUserHostAddress();
if (cookie.hashedIp && userHostAddress) {

@@ -145,10 +192,18 @@ var hashedUserHostAddress = queueitHelpers_1.Utils.generateSHA256Hash(secretKey, userHostAddress, this.contextProvider);

};
UserInQueueStateCookieRepository.prototype.cancelQueueCookie = function (eventId, cookieDomain, isCookieHttpOnly, isCookieSecure) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(eventId);
this.contextProvider.getHttpResponse()
.setCookie(cookieKey, "", cookieDomain, 0, isCookieHttpOnly, isCookieSecure);
UserInQueueStateCookieRepository.prototype.cancelQueueCookie = function (eventId, involvedWaitingRoomIds, cookieDomain, isCookieHttpOnly, isCookieSecure) {
var _this = this;
(eventId ? [eventId] : [])
.concat(involvedWaitingRoomIds)
.forEach(function (wrId) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(wrId);
_this.contextProvider
.getHttpResponse()
.setCookie(cookieKey, "", cookieDomain, 0, isCookieHttpOnly, isCookieSecure);
});
};
UserInQueueStateCookieRepository.prototype.reissueQueueCookie = function (eventId, cookieValidityMinutes, cookieDomain, isCookieHttpOnly, isCookieSecure, secretKey) {
var cookieKey = UserInQueueStateCookieRepository.getCookieKey(eventId);
var cookie = this.contextProvider.getHttpRequest().getCookieValue(cookieKey);
var cookie = this.contextProvider
.getHttpRequest()
.getCookieValue(cookieKey);
if (!cookie)

@@ -161,12 +216,13 @@ return;

if (qitAcceptedCookie.fixedCookieValidityMinutes)
fixedCookieValidityMinutes = qitAcceptedCookie.fixedCookieValidityMinutes.toString();
fixedCookieValidityMinutes =
qitAcceptedCookie.fixedCookieValidityMinutes.toString();
this.createCookie(eventId, qitAcceptedCookie.queueId, fixedCookieValidityMinutes, qitAcceptedCookie.redirectType, qitAcceptedCookie.hashedIp, cookieDomain, isCookieHttpOnly, isCookieSecure, secretKey);
};
UserInQueueStateCookieRepository.prototype.generateHash = function (eventId, queueId, fixedCookieValidityMinutes, redirectType, issueTime, hashedIp, secretKey) {
var valueToHash = eventId
+ (queueId ? queueId : "")
+ (fixedCookieValidityMinutes ? fixedCookieValidityMinutes : "")
+ redirectType
+ issueTime
+ (hashedIp ? hashedIp : "");
var valueToHash = eventId +
(queueId ? queueId : "") +
(fixedCookieValidityMinutes ? fixedCookieValidityMinutes : "") +
redirectType +
issueTime +
(hashedIp ? hashedIp : "");
return queueitHelpers_1.Utils.generateSHA256Hash(secretKey, valueToHash, this.contextProvider);

@@ -179,3 +235,4 @@ };

var CookieStateInfo = /** @class */ (function () {
function CookieStateInfo(queueId, fixedCookieValidityMinutes, redirectType, hashedIp, cookieValidationResult, cookie, clientIp) {
function CookieStateInfo(waitingRoomId, queueId, fixedCookieValidityMinutes, redirectType, hashedIp, cookieValidationResult, cookie, clientIp, waitingRoomQueueIdPairs) {
this.waitingRoomId = waitingRoomId;
this.queueId = queueId;

@@ -188,2 +245,3 @@ this.fixedCookieValidityMinutes = fixedCookieValidityMinutes;

this.clientIp = clientIp;
this.waitingRoomQueueIdPairs = waitingRoomQueueIdPairs;
}

@@ -206,3 +264,4 @@ Object.defineProperty(CookieStateInfo.prototype, "isValid", {

get: function () {
return this.cookieValidationResult === CookieValidationResult.IpBindingMismatch;
return (this.cookieValidationResult ===
CookieValidationResult.IpBindingMismatch);
},

@@ -239,8 +298,8 @@ enumerable: false,

if (this.redirectType) {
result.details['r'] = this.redirectType;
result.details["r"] = this.redirectType;
}
if (this.queueId) {
result.details['q'] = this.queueId;
result.details["q"] = this.queueId;
}
result.details['st'] = Date.now().toString();
result.details["st"] = Date.now().toString();
}

@@ -247,0 +306,0 @@ return result;

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

@@ -16,3 +16,4 @@ "main": "dist/index.js",

"buildtest": "npm run build && npm run test",
"test:watch": "nodemon --watch test -x \"npm run test\""
"test:watch": "nodemon --watch test -x \"npm run test\"",
"build:watch": "tsc --watch"
},

@@ -23,3 +24,3 @@ "keywords": [],

"dependencies": {
"@queue-it/queue-token": "^1.0.3"
"@queue-it/queue-token": "^1.0.4"
},

@@ -26,0 +27,0 @@ "devDependencies": {

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

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc