@constructor-io/constructorio-ui-autocomplete
Advanced tools
Comparing version 1.20.9 to 1.21.0
@@ -121,3 +121,3 @@ "use strict"; | ||
try { | ||
cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackSearchSubmit(query, { originalQuery: query }); | ||
(0, utils_1.trackSearchSubmit)(cioClient, query, { originalQuery: query }); | ||
} | ||
@@ -137,3 +137,3 @@ catch (error) { | ||
try { | ||
cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackSearchSubmit(query, { originalQuery: query }); | ||
(0, utils_1.trackSearchSubmit)(cioClient, query, { originalQuery: query }); | ||
} | ||
@@ -140,0 +140,0 @@ catch (error) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const downshift_1 = require("downshift"); | ||
const utils_1 = require("../utils"); | ||
let idCounter = 0; | ||
@@ -18,3 +19,3 @@ const useDownShift = ({ setQuery, items, onSubmit, cioClient, previousQuery = '' }) => (0, downshift_1.useCombobox)({ | ||
setQuery(selectedItem.value || ''); | ||
cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackSearchSubmit(selectedItem.value, { | ||
(0, utils_1.trackSearchSubmit)(cioClient, selectedItem.value, { | ||
originalQuery: previousQuery, | ||
@@ -21,0 +22,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.translate = exports.getItemsForActiveSections = exports.trackRecommendationView = exports.escapeRegExp = exports.getActiveSectionsWithData = exports.getCioClient = exports.disableStoryActions = exports.stringifyWithDefaults = exports.functionStrings = exports.getStoryParams = exports.sleep = exports.clearConstructorRequests = exports.isTrackingRequestSent = exports.toKebabCase = exports.camelToStartCase = exports.getItemPosition = exports.getFeatures = void 0; | ||
exports.logger = exports.trackSearchSubmit = exports.translate = exports.getItemsForActiveSections = exports.trackRecommendationView = exports.escapeRegExp = exports.getActiveSectionsWithData = exports.getCioClient = exports.disableStoryActions = exports.stringifyWithDefaults = exports.functionStrings = exports.getStoryParams = exports.sleep = exports.clearConstructorRequests = exports.isTrackingRequestSent = exports.toKebabCase = exports.camelToStartCase = exports.getItemPosition = exports.getFeatures = void 0; | ||
const tslib_1 = require("tslib"); | ||
const constructorio_client_javascript_1 = tslib_1.__importDefault(require("@constructor-io/constructorio-client-javascript")); | ||
// eslint-disable-next-line import/no-cycle | ||
const beaconUtils_1 = require("./beaconUtils"); | ||
const typeGuards_1 = require("./typeGuards"); | ||
@@ -213,1 +215,21 @@ const version_1 = tslib_1.__importDefault(require("./version")); | ||
exports.translate = translate; | ||
const trackSearchSubmit = (cioClient, term, autocompleteData = {}) => { | ||
cioClient === null || cioClient === void 0 ? void 0 : cioClient.tracker.trackSearchSubmit(term, autocompleteData); | ||
(0, beaconUtils_1.storageSetItem)(beaconUtils_1.CONSTANTS.SEARCH_TERM_STORAGE_KEY, term); | ||
(0, beaconUtils_1.storeRecentSearch)(term, {}); | ||
(0, beaconUtils_1.storeRecentAction)(beaconUtils_1.CONSTANTS.SEARCH_SUBMIT); | ||
}; | ||
exports.trackSearchSubmit = trackSearchSubmit; | ||
const logger = (error) => { | ||
var _a; | ||
try { | ||
if (typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.LOGGER)) { | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
} | ||
catch (e) { | ||
// process variable is not available and logger should not be active | ||
} | ||
}; | ||
exports.logger = logger; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '1.20.9'; | ||
exports.default = '1.21.0'; |
@@ -6,3 +6,3 @@ 'use client'; | ||
import usePrevious from './usePrevious'; | ||
import { getItemPosition, getItemsForActiveSections, getFeatures, trackRecommendationView, toKebabCase, } from '../utils'; | ||
import { getItemPosition, getItemsForActiveSections, getFeatures, trackRecommendationView, toKebabCase, trackSearchSubmit, } from '../utils'; | ||
import useConsoleErrors from './useConsoleErrors'; | ||
@@ -131,3 +131,3 @@ import useSections from './useSections'; | ||
try { | ||
cioClient?.tracker.trackSearchSubmit(query, { originalQuery: query }); | ||
trackSearchSubmit(cioClient, query, { originalQuery: query }); | ||
} | ||
@@ -148,3 +148,3 @@ catch (error) { | ||
try { | ||
cioClient?.tracker.trackSearchSubmit(query, { originalQuery: query }); | ||
trackSearchSubmit(cioClient, query, { originalQuery: query }); | ||
} | ||
@@ -151,0 +151,0 @@ catch (error) { |
import { useCombobox } from 'downshift'; | ||
import { trackSearchSubmit } from '../utils'; | ||
let idCounter = 0; | ||
@@ -15,3 +16,3 @@ const useDownShift = ({ setQuery, items, onSubmit, cioClient, previousQuery = '' }) => useCombobox({ | ||
setQuery(selectedItem.value || ''); | ||
cioClient?.tracker.trackSearchSubmit(selectedItem.value, { | ||
trackSearchSubmit(cioClient, selectedItem.value, { | ||
originalQuery: previousQuery, | ||
@@ -18,0 +19,0 @@ }); |
import ConstructorIOClient from '@constructor-io/constructorio-client-javascript'; | ||
// eslint-disable-next-line import/no-cycle | ||
import { storageSetItem, storeRecentSearch, storeRecentAction, CONSTANTS } from './beaconUtils'; | ||
import { isRecommendationsSection } from './typeGuards'; | ||
@@ -194,1 +196,18 @@ import version from './version'; | ||
}; | ||
export const trackSearchSubmit = (cioClient, term, autocompleteData = {}) => { | ||
cioClient?.tracker.trackSearchSubmit(term, autocompleteData); | ||
storageSetItem(CONSTANTS.SEARCH_TERM_STORAGE_KEY, term); | ||
storeRecentSearch(term, {}); | ||
storeRecentAction(CONSTANTS.SEARCH_SUBMIT); | ||
}; | ||
export const logger = (error) => { | ||
try { | ||
if (typeof process !== 'undefined' && process?.env?.LOGGER) { | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
} | ||
catch (e) { | ||
// process variable is not available and logger should not be active | ||
} | ||
}; |
@@ -1,1 +0,1 @@ | ||
export default '1.20.9'; | ||
export default '1.21.0'; |
@@ -44,2 +44,4 @@ import ConstructorIOClient from '@constructor-io/constructorio-client-javascript'; | ||
export declare const translate: (word: string, translations?: Translations) => any; | ||
export declare const trackSearchSubmit: (cioClient: any, term: any, autocompleteData?: {}) => void; | ||
export declare const logger: (error: any) => void; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.20.9"; | ||
declare const _default: "1.21.0"; | ||
export default _default; |
{ | ||
"name": "@constructor-io/constructorio-ui-autocomplete", | ||
"version": "1.20.9", | ||
"version": "1.21.0", | ||
"description": "Constructor.io Autocomplete UI library for web applications", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
470674
4368
2