New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@searchspring/snap-store-mobx

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@searchspring/snap-store-mobx - npm Package Compare versions

Comparing version 0.23.1 to 0.24.0

28

dist/cjs/Search/Stores/FacetStore.js

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

.filter(function (facet) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f, _g, _h;
var facetMeta = meta.facets[facet.field];

@@ -37,10 +37,12 @@ // exclude facets that have no meta data

// trim facets - remove facets that have no use
if ((_b = (_a = config.settings) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.trim) {
var facetConfig = ((_b = (_a = config.settings) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.fields) && ((_d = (_c = config.settings) === null || _c === void 0 ? void 0 : _c.facets) === null || _d === void 0 ? void 0 : _d.fields[facet.field]);
var shouldTrim = typeof (facetConfig === null || facetConfig === void 0 ? void 0 : facetConfig.trim) == 'boolean' ? facetConfig.trim : (_f = (_e = config.settings) === null || _e === void 0 ? void 0 : _e.facets) === null || _f === void 0 ? void 0 : _f.trim;
if (shouldTrim) {
if (facet.type === 'range' && facet.range.low == facet.range.high) {
return false;
}
else if (((_c = facet.values) === null || _c === void 0 ? void 0 : _c.length) == 0) {
else if (((_g = facet.values) === null || _g === void 0 ? void 0 : _g.length) == 0) {
return false;
}
else if (!facet.filtered && ((_d = facet.values) === null || _d === void 0 ? void 0 : _d.length) == 1) {
else if (!facet.filtered && ((_h = facet.values) === null || _h === void 0 ? void 0 : _h.length) == 1) {
return facet.values[0].count != pagination.totalResults;

@@ -55,3 +57,3 @@ }

case 'range':
return new RangeFacet(services, storage, facet, facetMeta);
return new RangeFacet(config, services, storage, facet, facetMeta);
case 'value':

@@ -120,4 +122,6 @@ case 'range-buckets':

__extends(RangeFacet, _super);
function RangeFacet(services, storage, facet, facetMeta) {
var _this = _super.call(this, services, storage, facet, facetMeta) || this;
function RangeFacet(config, services, storage, facet, facetMeta) {
var _this = this;
var _a, _b, _c, _d, _e, _f;
_this = _super.call(this, services, storage, facet, facetMeta) || this;
_this.range = {

@@ -132,3 +136,5 @@ low: 0,

_this.step = facet.step;
var storedRange = _this.storage.get("facets.".concat(_this.field, ".range"));
var facetConfig = ((_b = (_a = config.settings) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.fields) && ((_d = (_c = config.settings) === null || _c === void 0 ? void 0 : _c.facets) === null || _d === void 0 ? void 0 : _d.fields[facet.field]);
var shouldStore = typeof (facetConfig === null || facetConfig === void 0 ? void 0 : facetConfig.storeRange) == 'boolean' ? facetConfig.storeRange : (_f = (_e = config.settings) === null || _e === void 0 ? void 0 : _e.facets) === null || _f === void 0 ? void 0 : _f.storeRange;
var storedRange = shouldStore && _this.storage.get("facets.".concat(_this.field, ".range"));
if (storedRange && facet.filtered && (facet.range.low > storedRange.low || facet.range.high < storedRange.high)) {

@@ -162,3 +168,3 @@ // range from API has shrunk

var _this = this;
var _a, _b;
var _a, _b, _c, _d, _e, _f;
_this = _super.call(this, services, storage, facet, facetMeta) || this;

@@ -229,3 +235,5 @@ _this.values = [];

[];
if (((_b = (_a = config.settings) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.pinFiltered) && facetMeta.display !== 'hierarchy') {
var facetConfig = ((_b = (_a = config.settings) === null || _a === void 0 ? void 0 : _a.facets) === null || _b === void 0 ? void 0 : _b.fields) && ((_d = (_c = config.settings) === null || _c === void 0 ? void 0 : _c.facets) === null || _d === void 0 ? void 0 : _d.fields[facet.field]);
var shouldPin = typeof (facetConfig === null || facetConfig === void 0 ? void 0 : facetConfig.pinFiltered) == 'boolean' ? facetConfig.pinFiltered : (_f = (_e = config.settings) === null || _e === void 0 ? void 0 : _e.facets) === null || _f === void 0 ? void 0 : _f.pinFiltered;
if (shouldPin && facetMeta.display !== 'hierarchy') {
_this.values.sort(function (a, b) { return Number(b.filtered) - Number(a.filtered); });

@@ -232,0 +240,0 @@ }

@@ -18,5 +18,6 @@ import type { UrlManager } from '@searchspring/snap-url-manager';

};
facets?: {
trim?: boolean;
pinFiltered?: boolean;
facets?: FacetStoreConfig & {
fields?: {
[field: string]: FacetStoreConfig;
};
};

@@ -28,2 +29,7 @@ infinite?: {

};
declare type FacetStoreConfig = {
trim?: boolean;
pinFiltered?: boolean;
storeRange?: boolean;
};
export declare type FinderStoreConfig = StoreConfig & {

@@ -58,5 +64,6 @@ globals?: any;

syncInputs?: boolean;
facets?: {
trim?: boolean;
pinFiltered?: boolean;
facets?: FacetStoreConfig & {
fields?: {
[field: string]: FacetStoreConfig;
};
};

@@ -85,2 +92,3 @@ trending?: {

}
export {};
//# sourceMappingURL=types.d.ts.map

@@ -18,3 +18,5 @@ import { makeObservable, observable, action, computed, reaction } from 'mobx';

// trim facets - remove facets that have no use
if (config.settings?.facets?.trim) {
const facetConfig = config.settings?.facets?.fields && config.settings?.facets?.fields[facet.field];
const shouldTrim = typeof facetConfig?.trim == 'boolean' ? facetConfig.trim : config.settings?.facets?.trim;
if (shouldTrim) {
if (facet.type === 'range' && facet.range.low == facet.range.high) {

@@ -36,3 +38,3 @@ return false;

case 'range':
return new RangeFacet(services, storage, facet, facetMeta);
return new RangeFacet(config, services, storage, facet, facetMeta);
case 'value':

@@ -87,3 +89,3 @@ case 'range-buckets':

class RangeFacet extends Facet {
constructor(services, storage, facet, facetMeta) {
constructor(config, services, storage, facet, facetMeta) {
super(services, storage, facet, facetMeta);

@@ -99,3 +101,5 @@ this.range = {

this.step = facet.step;
const storedRange = this.storage.get(`facets.${this.field}.range`);
const facetConfig = config.settings?.facets?.fields && config.settings?.facets?.fields[facet.field];
const shouldStore = typeof facetConfig?.storeRange == 'boolean' ? facetConfig.storeRange : config.settings?.facets?.storeRange;
const storedRange = shouldStore && this.storage.get(`facets.${this.field}.range`);
if (storedRange && facet.filtered && (facet.range.low > storedRange.low || facet.range.high < storedRange.high)) {

@@ -190,3 +194,5 @@ // range from API has shrunk

[];
if (config.settings?.facets?.pinFiltered && facetMeta.display !== 'hierarchy') {
const facetConfig = config.settings?.facets?.fields && config.settings?.facets?.fields[facet.field];
const shouldPin = typeof facetConfig?.pinFiltered == 'boolean' ? facetConfig.pinFiltered : config.settings?.facets?.pinFiltered;
if (shouldPin && facetMeta.display !== 'hierarchy') {
this.values.sort((a, b) => Number(b.filtered) - Number(a.filtered));

@@ -193,0 +199,0 @@ }

@@ -18,5 +18,6 @@ import type { UrlManager } from '@searchspring/snap-url-manager';

};
facets?: {
trim?: boolean;
pinFiltered?: boolean;
facets?: FacetStoreConfig & {
fields?: {
[field: string]: FacetStoreConfig;
};
};

@@ -28,2 +29,7 @@ infinite?: {

};
declare type FacetStoreConfig = {
trim?: boolean;
pinFiltered?: boolean;
storeRange?: boolean;
};
export declare type FinderStoreConfig = StoreConfig & {

@@ -58,5 +64,6 @@ globals?: any;

syncInputs?: boolean;
facets?: {
trim?: boolean;
pinFiltered?: boolean;
facets?: FacetStoreConfig & {
fields?: {
[field: string]: FacetStoreConfig;
};
};

@@ -85,2 +92,3 @@ trending?: {

}
export {};
//# sourceMappingURL=types.d.ts.map
{
"name": "@searchspring/snap-store-mobx",
"version": "0.23.1",
"version": "0.24.0",
"description": "Snap MobX Store",

@@ -23,7 +23,7 @@ "main": "dist/cjs/index.js",

"dependencies": {
"@searchspring/snap-toolbox": "^0.23.1",
"@searchspring/snap-toolbox": "^0.24.0",
"mobx": "^6.3.12"
},
"devDependencies": {
"@searchspring/snap-url-manager": "^0.23.1"
"@searchspring/snap-url-manager": "^0.24.0"
},

@@ -34,3 +34,3 @@ "sideEffects": false,

],
"gitHead": "56fee54f115b415326331ac2aa1100c73ced6523"
"gitHead": "2aadf9555a7c409f6922a4ab72938d2ea0510faf"
}

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

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