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
3
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.43.1 to 0.44.0

2

dist/cjs/Autocomplete/AutocompleteStore.js

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

this.merchandising = new Stores_1.SearchMerchandisingStore(this.services, data.merchandising || {});
this.search = new Stores_2.AutocompleteQueryStore(this.services, data.autocomplete || {}, data.search || {});
this.search = new Stores_2.AutocompleteQueryStore(this.services, data.autocomplete || {}, data.search || {}, this.config);
// only run if we want to update the facets (not locked)

@@ -127,0 +127,0 @@ if (!this.state.locks.facets.locked) {

import type { UrlManager } from '@searchspring/snap-url-manager';
import type { SearchResponseModelSearch, AutocompleteResponseModelAllOfAutocomplete } from '@searchspring/snapi-types';
import type { StoreServices } from '../../types';
import type { AutocompleteStoreConfig, StoreServices } from '../../types';
export declare class AutocompleteQueryStore {
query?: Query;
originalQuery?: Query;
constructor(services: StoreServices, autocomplete: AutocompleteResponseModelAllOfAutocomplete, search: SearchResponseModelSearch);
correctedQuery?: Query;
constructor(services: StoreServices, autocomplete: AutocompleteResponseModelAllOfAutocomplete, search: SearchResponseModelSearch, config: AutocompleteStoreConfig);
}

@@ -9,0 +10,0 @@ declare class Query {

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

var AutocompleteQueryStore = /** @class */ (function () {
function AutocompleteQueryStore(services, autocomplete, search) {
function AutocompleteQueryStore(services, autocomplete, search, config) {
var _a;
var observables = {};

@@ -13,5 +14,11 @@ if (search === null || search === void 0 ? void 0 : search.query) {

}
if ((autocomplete === null || autocomplete === void 0 ? void 0 : autocomplete.correctedQuery) && autocomplete.query) {
this.originalQuery = new Query(services.urlManager, autocomplete.query);
observables.originalQuery = mobx_1.observable;
if (autocomplete === null || autocomplete === void 0 ? void 0 : autocomplete.correctedQuery) {
if ((_a = config.settings) === null || _a === void 0 ? void 0 : _a.integratedSpellCorrection) {
this.correctedQuery = new Query(services.urlManager, autocomplete.correctedQuery);
observables.correctedQuery = mobx_1.observable;
}
else if (autocomplete.query) {
this.originalQuery = new Query(services.urlManager, autocomplete.query);
observables.originalQuery = mobx_1.observable;
}
}

@@ -18,0 +25,0 @@ (0, mobx_1.makeObservable)(this, observables);

@@ -8,6 +8,3 @@ import type { StoreConfigs, StoreServices } from '../../types';

pageSize: number;
pageSizeOptions: {
label: string;
value: number;
}[];
pageSizeOptions: PageSizeOption[];
defaultPageSize: number;

@@ -29,4 +26,15 @@ totalResults: number;

}
export declare class PageSizeOption {
private services;
value: number;
label: string;
url: UrlManager;
active: boolean;
constructor(services: StoreServices, currentPageSize: number, option: {
value: number;
label: string;
});
}
export declare class Page {
services: StoreServices;
private services;
number: number;

@@ -33,0 +41,0 @@ active: boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Page = exports.SearchPaginationStore = void 0;
exports.Page = exports.PageSizeOption = exports.SearchPaginationStore = void 0;
var mobx_1 = require("mobx");

@@ -13,3 +13,5 @@ var SearchPaginationStore = /** @class */ (function () {

}; }
var _a;
var _this = this;
var _a, _b;
var paginationSettings = (_a = config === null || config === void 0 ? void 0 : config.settings) === null || _a === void 0 ? void 0 : _a.pagination;
this.services = services;

@@ -20,5 +22,5 @@ this.controllerConfig = config;

this.totalResults = paginationData.totalResults;
this.defaultPageSize = (_a = meta === null || meta === void 0 ? void 0 : meta.pagination) === null || _a === void 0 ? void 0 : _a.defaultPageSize;
this.defaultPageSize = (_b = meta === null || meta === void 0 ? void 0 : meta.pagination) === null || _b === void 0 ? void 0 : _b.defaultPageSize;
this.totalPages = paginationData.totalPages;
this.pageSizeOptions = [
var pageSizeOptions = (paginationSettings === null || paginationSettings === void 0 ? void 0 : paginationSettings.pageSizeOptions) || [
{

@@ -37,3 +39,10 @@ label: "Show ".concat(this.defaultPageSize),

];
this.pageSizeOptions = pageSizeOptions.map(function (pageOption) {
return new PageSizeOption(_this.services, _this.pageSize, {
label: pageOption.label,
value: pageOption.value,
});
});
(0, mobx_1.makeObservable)(this, {
pageSizeOptions: mobx_1.observable,
page: mobx_1.observable,

@@ -183,2 +192,14 @@ pageSize: mobx_1.observable,

exports.SearchPaginationStore = SearchPaginationStore;
var PageSizeOption = /** @class */ (function () {
function PageSizeOption(services, currentPageSize, option) {
var _a;
this.services = services;
this.value = option.value;
this.label = option.label;
this.url = (_a = this.services) === null || _a === void 0 ? void 0 : _a.urlManager.remove('page').set('pageSize', option.value);
this.active = Boolean(currentPageSize == option.value);
}
return PageSizeOption;
}());
exports.PageSizeOption = PageSizeOption;
var Page = /** @class */ (function () {

@@ -185,0 +206,0 @@ function Page(services, page) {

@@ -29,2 +29,8 @@ import type { UrlManager } from '@searchspring/snap-url-manager';

};
pagination?: {
pageSizeOptions?: {
label: string;
value: number;
}[];
};
};

@@ -31,0 +37,0 @@ };

@@ -93,3 +93,3 @@ import { makeObservable, observable } from 'mobx';

this.merchandising = new SearchMerchandisingStore(this.services, data.merchandising || {});
this.search = new AutocompleteQueryStore(this.services, data.autocomplete || {}, data.search || {});
this.search = new AutocompleteQueryStore(this.services, data.autocomplete || {}, data.search || {}, this.config);
// only run if we want to update the facets (not locked)

@@ -96,0 +96,0 @@ if (!this.state.locks.facets.locked) {

import type { UrlManager } from '@searchspring/snap-url-manager';
import type { SearchResponseModelSearch, AutocompleteResponseModelAllOfAutocomplete } from '@searchspring/snapi-types';
import type { StoreServices } from '../../types';
import type { AutocompleteStoreConfig, StoreServices } from '../../types';
export declare class AutocompleteQueryStore {
query?: Query;
originalQuery?: Query;
constructor(services: StoreServices, autocomplete: AutocompleteResponseModelAllOfAutocomplete, search: SearchResponseModelSearch);
correctedQuery?: Query;
constructor(services: StoreServices, autocomplete: AutocompleteResponseModelAllOfAutocomplete, search: SearchResponseModelSearch, config: AutocompleteStoreConfig);
}

@@ -9,0 +10,0 @@ declare class Query {

import { observable, makeObservable } from 'mobx';
export class AutocompleteQueryStore {
constructor(services, autocomplete, search) {
constructor(services, autocomplete, search, config) {
const observables = {};

@@ -9,5 +9,11 @@ if (search?.query) {

}
if (autocomplete?.correctedQuery && autocomplete.query) {
this.originalQuery = new Query(services.urlManager, autocomplete.query);
observables.originalQuery = observable;
if (autocomplete?.correctedQuery) {
if (config.settings?.integratedSpellCorrection) {
this.correctedQuery = new Query(services.urlManager, autocomplete.correctedQuery);
observables.correctedQuery = observable;
}
else if (autocomplete.query) {
this.originalQuery = new Query(services.urlManager, autocomplete.query);
observables.originalQuery = observable;
}
}

@@ -14,0 +20,0 @@ makeObservable(this, observables);

@@ -8,6 +8,3 @@ import type { StoreConfigs, StoreServices } from '../../types';

pageSize: number;
pageSizeOptions: {
label: string;
value: number;
}[];
pageSizeOptions: PageSizeOption[];
defaultPageSize: number;

@@ -29,4 +26,15 @@ totalResults: number;

}
export declare class PageSizeOption {
private services;
value: number;
label: string;
url: UrlManager;
active: boolean;
constructor(services: StoreServices, currentPageSize: number, option: {
value: number;
label: string;
});
}
export declare class Page {
services: StoreServices;
private services;
number: number;

@@ -33,0 +41,0 @@ active: boolean;

@@ -9,2 +9,3 @@ import { observable, action, computed, makeObservable } from 'mobx';

}, meta) {
const paginationSettings = config?.settings?.pagination;
this.services = services;

@@ -17,3 +18,3 @@ this.controllerConfig = config;

this.totalPages = paginationData.totalPages;
this.pageSizeOptions = [
const pageSizeOptions = paginationSettings?.pageSizeOptions || [
{

@@ -32,3 +33,8 @@ label: `Show ${this.defaultPageSize}`,

];
this.pageSizeOptions = pageSizeOptions.map((pageOption) => new PageSizeOption(this.services, this.pageSize, {
label: pageOption.label,
value: pageOption.value,
}));
makeObservable(this, {
pageSizeOptions: observable,
page: observable,

@@ -142,2 +148,11 @@ pageSize: observable,

}
export class PageSizeOption {
constructor(services, currentPageSize, option) {
this.services = services;
this.value = option.value;
this.label = option.label;
this.url = this.services?.urlManager.remove('page').set('pageSize', option.value);
this.active = Boolean(currentPageSize == option.value);
}
}
export class Page {

@@ -144,0 +159,0 @@ constructor(services, page) {

@@ -29,2 +29,8 @@ import type { UrlManager } from '@searchspring/snap-url-manager';

};
pagination?: {
pageSizeOptions?: {
label: string;
value: number;
}[];
};
};

@@ -31,0 +37,0 @@ };

{
"name": "@searchspring/snap-store-mobx",
"version": "0.43.1",
"version": "0.44.0",
"description": "Snap MobX Store",

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

"dependencies": {
"@searchspring/snap-toolbox": "^0.43.1",
"@searchspring/snap-toolbox": "^0.44.0",
"mobx": "^6.6.1"
},
"devDependencies": {
"@searchspring/snap-client": "^0.43.1",
"@searchspring/snap-url-manager": "^0.43.1"
"@searchspring/snap-client": "^0.44.0",
"@searchspring/snap-url-manager": "^0.44.0"
},

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

],
"gitHead": "45b2fd3657b3d4dddf4256657d18baa4be0647f8"
"gitHead": "d22fcf1a316fdae0866c21dbd697da8c4a706965"
}

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 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