PageSourceSearch

https://www.arm.com/Coveo/Hive/js/CoveoForSitecoreUserContext.js

js arm.com collected 2026-09-24 06:55:02 UTC 6,774 bytes, 175 lines download raw bytes

vendor: 4,029 bytes, lines 1-98
1(function webpackUniversalModuleDefinition(root, factory) {
2	if(typeof exports === 'object' && typeof module === 'object')
3		module.exports = factory();
4	else if(typeof define === 'function' && define.amd)
5		define([], factory);
6	else if(typeof exports === 'object')
7		exports["CoveoForSitecoreUserContext"] = factory();
8	else
9		root["CoveoForSitecoreUserContext"] = factory();
10})(window, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ 	// The module cache
13/******/ 	var installedModules = {};
14/******/
15/******/ 	// The require function
16/******/ 	function __webpack_require__(moduleId) {
17/******/
18/******/ 		// Check if module is in cache
19/******/ 		if(installedModules[moduleId]) {
20/******/ 			return installedModules[moduleId].exports;
21/******/ 		}
22/******/ 		// Create a new module (and put it into the cache)
23/******/ 		var module = installedModules[moduleId] = {
24/******/ 			i: moduleId,
25/******/ 			l: false,
26/******/ 			exports: {}
27/******/ 		};
28/******/
29/******/ 		// Execute the module function
30/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ 		// Flag the module as loaded
33/******/ 		module.l = true;
34/******/
35/******/ 		// Return the exports of the module
36/******/ 		return module.exports;
37/******/ 	}
38/******/
39/******/
40/******/ 	// expose the modules object (__webpack_modules__)
41/******/ 	__webpack_require__.m = modules;
42/******/
43/******/ 	// expose the module cache
44/******/ 	__webpack_require__.c = installedModules;
45/******/
46/******/ 	// define getter function for harmony exports
47/******/ 	__webpack_require__.d = function(exports, name, getter) {
48/******/ 		if(!__webpack_require__.o(exports, name)) {
49/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ 		}
51/******/ 	};
52/******/
53/******/ 	// define __esModule on exports
54/******/ 	__webpack_require__.r = function(exports) {
55/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ 		}
58/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
59/******/ 	};
60/******/
61/******/ 	// create a fake namespace object
62/******/ 	// mode & 1: value is a module id, require it
63/******/ 	// mode & 2: merge all properties of value into the ns
64/******/ 	// mode & 4: return value when already ns object
65/******/ 	// mode & 8|1: behave like require
66/******/ 	__webpack_require__.t = function(value, mode) {
67/******/ 		if(mode & 1) value = __webpack_require__(value);
68/******/ 		if(mode & 8) return value;
69/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ 		var ns = Object.create(null);
71/******/ 		__webpack_require__.r(ns);
72/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ 		return ns;
75/******/ 	};
76/******/
77/******/ 	// getDefaultExport function for compatibility with non-harmony modules
78/******/ 	__webpack_require__.n = function(module) {
79/******/ 		var getter = module && module.__esModule ?
80/******/ 			function getDefault() { return module['default']; } :
81/******/ 			function getModuleExports() { return module; };
82/******/ 		__webpack_require__.d(getter, 'a', getter);
83/******/ 		return getter;
84/******/ 	};
85/******/
86/******/ 	// Object.prototype.hasOwnProperty.call
87/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ 	// __webpack_public_path__
90/******/ 	__webpack_require__.p = "";
91/******/
92/******/
93/******/ 	// Load entry module and return exports
94/******/ 	return __webpack_require__(__webpack_require__.s = "./src/UserContextEntry.ts");
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./src/UserContextEntry.ts":
100/*!*********************************!*\
101  !*** ./src/UserContextEntry.ts ***!
102  \*********************************/
103/*! no static exports found */
104/***/ (function(module, exports, __webpack_require__) {
105
106"use strict";
107
108Object.defineProperty(exports, "__esModule", { value: true });
109exports.handler = void 0;
110var UserContextHandler_1 = __webpack_require__(/*! ./handlers/UserContextHandler */ "./src/handlers/UserContextHandler.ts");
111Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return UserContextHandler_1.handler; } });
112
113
114/***/ }),
115
116/***/ "./src/handlers/UserContextHandler.ts":
117/*!********************************************!*\
118  !*** ./src/handlers/UserContextHandler.ts ***!
119  \********************************************/
120/*! no static exports found */
121/***/ (function(module, exports, __webpack_require__) {
122
123"use strict";
124
125Object.defineProperty(exports, "__esModule", { value: true });
126exports.handler = exports.UserContextHandler = void 0;
127var UserContextHandler = exports.UserContextHandler = /** @class */ (function () {
128    function UserContextHandler() {
129        this.context = {};
130    }
131    UserContextHandler.prototype.initializeContext = function (context) {
132        this.context = this.replaceInvalidCharactersInContext(context);
133        return this;
134    };
135    UserContextHandler.prototype.setContext = function (key, value) {
136        this.context[this.replaceInvalidCharacters(key)] = value;
137        return this;
138    };
139    UserContextHandler.prototype.getContext = function () {
140        return this.context;
141    };
142    UserContextHandler.prototype.replaceInvalidCharactersInContext = function (context) {
143        var _this = this;
144        var validContext = {};
145        Object.keys(context)
146            .map(function (key) {
147            return {
148                key: _this.replaceInvalidCharacters(key),
149                value: context[key],
150            };
151        })
152            .filter(function (contextValue) { return contextValue.key !== ''; })
153            .forEach(function (contextValue) { return (validContext[contextValue.key] = contextValue.value); });
154        return validContext;
155    };
156    UserContextHandler.prototype.replaceInvalidCharacters = function (key) {
157        if (typeof key === 'string') {
158            return key.replace(UserContextHandler.invalidCharacters, '_');
159        }
160        else {
161            console.error("The user context key '{key}' is not a string.");
162            return '';
163        }
164    };
165    UserContextHandler.invalidCharacters = /[^a-z0-9_]/gi;
166    return UserContextHandler;
167}());
168exports.handler = new UserContextHandler();
169
170
171/***/ })
171
172
173/******/ });
174});
175//# sourceMappingURL=CoveoForSitecoreUserContext.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.