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.24.0 to 0.25.0

12

dist/cjs/Finder/FinderStore.d.ts

@@ -6,16 +6,24 @@ import type { SearchResponseModel, MetaResponseModel } from '@searchspring/snapi-types';

import { SelectionStore } from './Stores';
import type { FinderStoreConfig, StoreServices } from '../types';
import type { FinderStoreConfig, StoreServices, SelectedSelection, FinderStoreState } from '../types';
export declare class FinderStore extends AbstractStore {
services: StoreServices;
config: FinderStoreConfig;
data: SearchResponseModel & {
meta: MetaResponseModel;
};
meta: MetaResponseModel;
storage: StorageStore;
persistedStorage: StorageStore;
pagination: PaginationStore;
selections: SelectionStore;
state: FinderStoreState;
constructor(config: FinderStoreConfig, services: StoreServices);
setService(name: any, service: any): void;
save(): void;
reset: () => void;
loadPersisted(): void;
update(data: SearchResponseModel & {
meta: MetaResponseModel;
}): void;
}, selectedSelections?: SelectedSelection[]): void;
}
//# sourceMappingURL=FinderStore.d.ts.map

@@ -28,5 +28,20 @@ "use strict";

var _this = this;
var _a;
var _a, _b;
_this = _super.call(this, config) || this;
_this.meta = {};
_this.state = {
persisted: false,
};
_this.reset = function () {
var _a;
if ((_a = _this.config.persist) === null || _a === void 0 ? void 0 : _a.enabled) {
_this.persistedStorage.clear();
_this.state.persisted = false;
}
if (_this.services.urlManager.state.filter) {
_this.storage.clear();
_this.selections = [];
_this.loaded = false;
}
};
if (typeof services != 'object' || typeof ((_a = services.urlManager) === null || _a === void 0 ? void 0 : _a.subscribe) != 'function') {

@@ -36,2 +51,8 @@ throw new Error("Invalid service 'urlManager' passed to AutocompleteStore. Missing \"subscribe\" function.");

_this.services = services;
if ((_b = config.persist) === null || _b === void 0 ? void 0 : _b.enabled) {
_this.persistedStorage = new StorageStore_1.StorageStore({
type: StorageStore_1.StorageType.LOCAL,
key: "ss-".concat(config.id, "-persisted"),
});
}
_this.storage = new StorageStore_1.StorageStore();

@@ -50,8 +71,51 @@ _this.update({ meta: {} });

};
FinderStore.prototype.update = function (data) {
FinderStore.prototype.save = function () {
var _a;
if (((_a = this.config.persist) === null || _a === void 0 ? void 0 : _a.enabled) && this.selections.filter(function (selection) { return selection.selected; }).length) {
this.persistedStorage.set('config', this.config);
this.persistedStorage.set('data', this.data);
this.persistedStorage.set('date', Date.now());
this.persistedStorage.set('selections', this.selections.map(function (selection) {
return {
selected: selection.selected,
data: selection.data,
facet: selection.facet,
};
}));
}
};
FinderStore.prototype.loadPersisted = function () {
var _a;
if (((_a = this.config.persist) === null || _a === void 0 ? void 0 : _a.enabled) && !this.loaded) {
var date = this.persistedStorage.get('date');
var data = this.persistedStorage.get('data');
var config = this.persistedStorage.get('config');
var selections = this.persistedStorage.get('selections');
var isExpired = this.config.persist.expiration && Date.now() - date > this.config.persist.expiration;
if (data && selections.filter(function (selection) { return selection.selected; }).length) {
if (JSON.stringify(config) === JSON.stringify(this.config) && !isExpired) {
this.update(data, selections);
this.state.persisted = true;
this.services.urlManager.go();
}
else {
this.reset();
}
}
}
};
FinderStore.prototype.update = function (data, selectedSelections) {
this.error = undefined;
this.data = JSON.parse(JSON.stringify(data));
this.loaded = !!data.pagination;
this.meta = data.meta;
this.pagination = new Stores_1.PaginationStore(this.config, this.services, data.pagination);
this.selections = new Stores_2.SelectionStore(this.config, this.services, data.facets, this.meta, this.loading, this.storage);
this.selections = new Stores_2.SelectionStore(this.config, this.services, {
state: this.state,
facets: data.facets,
meta: this.meta,
loading: this.loading,
storage: this.storage,
selections: selectedSelections,
});
};

@@ -58,0 +122,0 @@ return FinderStore;

@@ -1,8 +0,17 @@

import type { FinderStoreConfig, StoreServices } from '../../types';
import type { FinderStoreConfig, StoreServices, SelectedSelection, FinderStoreState } from '../../types';
import type { StorageStore } from '../../Storage/StorageStore';
import type { MetaResponseModel, SearchResponseModelFacet } from '@searchspring/snapi-types';
declare type SelectionStoreData = {
state: FinderStoreState;
facets: SearchResponseModelFacet[];
meta: MetaResponseModel;
loading: boolean;
storage: StorageStore;
selections: SelectedSelection[];
};
export declare class SelectionStore extends Array {
static get [Symbol.species](): ArrayConstructor;
constructor(config: FinderStoreConfig, services: StoreServices, facets: SearchResponseModelFacet[], meta: MetaResponseModel, loading: boolean, storage: StorageStore);
constructor(config: FinderStoreConfig, services: StoreServices, { state, facets, meta, loading, storage, selections }: SelectionStoreData);
}
export {};
//# sourceMappingURL=SelectionStore.d.ts.map

@@ -41,6 +41,49 @@ "use strict";

__extends(SelectionStore, _super);
function SelectionStore(config, services, facets, meta, loading, storage) {
var _a;
var selections = [];
if (facets && meta) {
function SelectionStore(config, services, _a) {
var state = _a.state, facets = _a.facets, meta = _a.meta, loading = _a.loading, storage = _a.storage, selections = _a.selections;
var _b;
var selectedSelections = [];
if (selections === null || selections === void 0 ? void 0 : selections.length) {
config.fields.forEach(function (fieldObj) {
var _a;
var storedData = selections.find(function (selection) { return selection.facet.field === fieldObj.field; });
if (storedData) {
var facet_1 = storedData.facet, selected = storedData.selected;
if (facet_1 === null || facet_1 === void 0 ? void 0 : facet_1.hierarchyDelimiter) {
// hierarchy
selections.forEach(function (selection, index) {
var _a, _b;
var levels = (fieldObj === null || fieldObj === void 0 ? void 0 : fieldObj.levels) || ((_a = facet_1 === null || facet_1 === void 0 ? void 0 : facet_1.values[(facet_1 === null || facet_1 === void 0 ? void 0 : facet_1.values.length) - 1]) === null || _a === void 0 ? void 0 : _a.value.split(facet_1.hierarchyDelimiter));
var levelConfig = { index: index, label: fieldObj.levels ? levels[index] : '', key: "ss-".concat(index) };
var storageKey = generateStorageKey(config.id, facet_1.field);
storage.set("".concat(storageKey, ".").concat(levelConfig.key, ".values"), selection.data);
var selectionHierarchy = new SelectionHierarchy(services, config.id, state, facet_1, levelConfig, loading, storage);
selectionHierarchy.selected = selection.selected;
selectionHierarchy.data = selection.data;
if ((_b = config.persist) === null || _b === void 0 ? void 0 : _b.lockSelections) {
selectionHierarchy.disabled = true;
}
if (selection.selected) {
services.urlManager = services.urlManager.set("filter.".concat(selection.facet.field), selection.selected);
}
selectedSelections.push(selectionHierarchy);
});
}
else {
var selection = new Selection(services, config.id, state, facet_1, fieldObj, loading, storage);
selection.selected = selected;
selection.storage.set('selected', selected);
selection.data = facet_1.values;
if (selected) {
services.urlManager = services.urlManager.set("filter.".concat(facet_1.field), selected);
}
if ((_a = config.persist) === null || _a === void 0 ? void 0 : _a.lockSelections) {
selection.disabled = true;
}
selectedSelections.push(selection);
}
}
});
}
else if (facets && meta) {
// re-order facets to match our config

@@ -52,3 +95,3 @@ (config === null || config === void 0 ? void 0 : config.fields) &&

});
(_a = config === null || config === void 0 ? void 0 : config.fields) === null || _a === void 0 ? void 0 : _a.forEach(function (fieldObj) {
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach(function (fieldObj) {
var _a;

@@ -70,11 +113,11 @@ var facet = facets === null || facets === void 0 ? void 0 : facets.filter(function (facet) { return facet.field == fieldObj.field; }).pop();

var levelConfig = { index: index, label: fieldObj.levels ? level : '', key: "ss-".concat(index) };
selections.push(new SelectionHierarchy(services, config.id, facet, levelConfig, loading, storage));
selectedSelections.push(new SelectionHierarchy(services, config.id, state, facet, levelConfig, loading, storage));
});
}
else {
selections.push(new Selection(services, config.id, facet, fieldObj, loading, storage));
selectedSelections.push(new Selection(services, config.id, state, facet, fieldObj, loading, storage));
}
});
}
return _super.apply(this, selections) || this;
return _super.apply(this, selectedSelections) || this;
}

@@ -92,3 +135,3 @@ Object.defineProperty(SelectionStore, Symbol.species, {

var SelectionBase = /** @class */ (function () {
function SelectionBase(services, id, facet, selectionConfig, loading, storageStore) {
function SelectionBase(services, id, state, facet, selectionConfig, loading, storageStore) {
this.filtered = false;

@@ -102,5 +145,7 @@ this.collapsed = false;

this.loading = loading;
this.state = state;
this.id = id;
this.config = selectionConfig;
// inherit all standard facet properties
this.facet = facet;
this.type = facet.type;

@@ -115,3 +160,3 @@ this.field = facet.field;

this.storage = {
key: "ss-finder-".concat(this.id, ".").concat(this.field),
key: generateStorageKey(this.id, this.field),
get: function (key) {

@@ -144,4 +189,4 @@ var path = this.key + (key ? ".".concat(key) : '');

__extends(Selection, _super);
function Selection(services, id, facet, config, loading, storageStore) {
var _this = _super.call(this, services, id, facet, config, loading, storageStore) || this;
function Selection(services, id, state, facet, config, loading, storageStore) {
var _this = _super.call(this, services, id, state, facet, config, loading, storageStore) || this;
_this.loading = loading;

@@ -162,2 +207,3 @@ _this.storage.set('values', facet.values);

this.storage.set('selected', value);
this.state.persisted = false;
if (!value) {

@@ -174,6 +220,6 @@ this.services.urlManager.remove("filter.".concat(this.field)).go();

__extends(SelectionHierarchy, _super);
function SelectionHierarchy(services, id, facet, config, loading, storageStore) {
function SelectionHierarchy(services, id, state, facet, config, loading, storageStore) {
var _this = this;
var _a, _b, _c;
_this = _super.call(this, services, id, facet, config, loading, storageStore) || this;
_this = _super.call(this, services, id, state, facet, config, loading, storageStore) || this;
// inherit additional facet properties

@@ -216,2 +262,3 @@ _this.hierarchyDelimiter = facet.hierarchyDelimiter;

this.selected = value;
this.state.persisted = false;
var selectedLevel = this.config.index;

@@ -240,1 +287,4 @@ var storedLevels = this.storage.get();

}(SelectionBase));
function generateStorageKey(id, field) {
return "ss-finder-".concat(id, ".").concat(field);
}

3

dist/cjs/Search/Stores/QueryStore.d.ts
import type { UrlManager } from '@searchspring/snap-url-manager';
import type { StoreServices } from '../../types';
import type { SearchResponseModelSearch } from '@searchspring/snapi-types';
import type { SearchResponseModelSearch, SearchResponseModelSearchMatchTypeEnum } from '@searchspring/snapi-types';
export declare class QueryStore {

@@ -8,2 +8,3 @@ query: Query;

originalQuery: Query;
matchType: SearchResponseModelSearchMatchTypeEnum;
constructor(services: StoreServices, search: SearchResponseModelSearch);

@@ -10,0 +11,0 @@ }

@@ -20,2 +20,6 @@ "use strict";

}
if (search === null || search === void 0 ? void 0 : search.matchType) {
this.matchType = search.matchType;
observables.matchType = mobx_1.observable;
}
(0, mobx_1.makeObservable)(this, observables);

@@ -22,0 +26,0 @@ }

@@ -23,4 +23,5 @@ export declare class StorageStore {

LOCAL = "local",
COOKIE = "cookie"
COOKIE = "cookie",
MEMORY = "memory"
}
//# sourceMappingURL=StorageStore.d.ts.map

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

switch (config.type) {
case StorageType.SESSION:
case StorageType.SESSION: {
this.type = snap_toolbox_1.featureFlags.storage ? config.type : null;

@@ -35,3 +35,4 @@ if (this.type) {

break;
case StorageType.LOCAL:
}
case StorageType.LOCAL: {
this.type = snap_toolbox_1.featureFlags.storage ? config.type : null;

@@ -43,3 +44,4 @@ if (this.type && !window.localStorage.getItem(this.key)) {

break;
case StorageType.COOKIE:
}
case StorageType.COOKIE: {
if (snap_toolbox_1.featureFlags.cookies) {

@@ -53,2 +55,6 @@ this.type = config.type;

break;
}
default: {
this.type = StorageType.MEMORY;
}
}

@@ -134,2 +140,3 @@ }

StorageType["COOKIE"] = "cookie";
StorageType["MEMORY"] = "memory";
})(StorageType = exports.StorageType || (exports.StorageType = {}));
import type { UrlManager } from '@searchspring/snap-url-manager';
import type { SearchResponseModelFacetValueAllOfValues } from '@searchspring/snapi-types';
export declare type StoreConfig = {

@@ -37,2 +38,7 @@ id: string;

fields: FinderFieldConfig[];
persist?: {
enabled: boolean;
lockSelections?: boolean;
expiration?: number;
};
};

@@ -90,3 +96,11 @@ export declare type FinderFieldConfig = {

}
export declare type SelectedSelection = {
selected: string;
data: SearchResponseModelFacetValueAllOfValues[];
facet: any;
};
export declare type FinderStoreState = {
persisted: boolean;
};
export {};
//# sourceMappingURL=types.d.ts.map

@@ -6,16 +6,24 @@ import type { SearchResponseModel, MetaResponseModel } from '@searchspring/snapi-types';

import { SelectionStore } from './Stores';
import type { FinderStoreConfig, StoreServices } from '../types';
import type { FinderStoreConfig, StoreServices, SelectedSelection, FinderStoreState } from '../types';
export declare class FinderStore extends AbstractStore {
services: StoreServices;
config: FinderStoreConfig;
data: SearchResponseModel & {
meta: MetaResponseModel;
};
meta: MetaResponseModel;
storage: StorageStore;
persistedStorage: StorageStore;
pagination: PaginationStore;
selections: SelectionStore;
state: FinderStoreState;
constructor(config: FinderStoreConfig, services: StoreServices);
setService(name: any, service: any): void;
save(): void;
reset: () => void;
loadPersisted(): void;
update(data: SearchResponseModel & {
meta: MetaResponseModel;
}): void;
}, selectedSelections?: SelectedSelection[]): void;
}
//# sourceMappingURL=FinderStore.d.ts.map
import { makeObservable, observable } from 'mobx';
import { AbstractStore } from '../Abstract/AbstractStore';
import { PaginationStore } from '../Search/Stores';
import { StorageStore } from '../Storage/StorageStore';
import { StorageStore, StorageType } from '../Storage/StorageStore';
import { SelectionStore } from './Stores';

@@ -10,2 +10,16 @@ export class FinderStore extends AbstractStore {

this.meta = {};
this.state = {
persisted: false,
};
this.reset = () => {
if (this.config.persist?.enabled) {
this.persistedStorage.clear();
this.state.persisted = false;
}
if (this.services.urlManager.state.filter) {
this.storage.clear();
this.selections = [];
this.loaded = false;
}
};
if (typeof services != 'object' || typeof services.urlManager?.subscribe != 'function') {

@@ -15,2 +29,8 @@ throw new Error(`Invalid service 'urlManager' passed to AutocompleteStore. Missing "subscribe" function.`);

this.services = services;
if (config.persist?.enabled) {
this.persistedStorage = new StorageStore({
type: StorageType.LOCAL,
key: `ss-${config.id}-persisted`,
});
}
this.storage = new StorageStore();

@@ -28,9 +48,50 @@ this.update({ meta: {} });

}
update(data) {
save() {
if (this.config.persist?.enabled && this.selections.filter((selection) => selection.selected).length) {
this.persistedStorage.set('config', this.config);
this.persistedStorage.set('data', this.data);
this.persistedStorage.set('date', Date.now());
this.persistedStorage.set('selections', this.selections.map((selection) => {
return {
selected: selection.selected,
data: selection.data,
facet: selection.facet,
};
}));
}
}
loadPersisted() {
if (this.config.persist?.enabled && !this.loaded) {
const date = this.persistedStorage.get('date');
const data = this.persistedStorage.get('data');
const config = this.persistedStorage.get('config');
const selections = this.persistedStorage.get('selections');
const isExpired = this.config.persist.expiration && Date.now() - date > this.config.persist.expiration;
if (data && selections.filter((selection) => selection.selected).length) {
if (JSON.stringify(config) === JSON.stringify(this.config) && !isExpired) {
this.update(data, selections);
this.state.persisted = true;
this.services.urlManager.go();
}
else {
this.reset();
}
}
}
}
update(data, selectedSelections) {
this.error = undefined;
this.data = JSON.parse(JSON.stringify(data));
this.loaded = !!data.pagination;
this.meta = data.meta;
this.pagination = new PaginationStore(this.config, this.services, data.pagination);
this.selections = new SelectionStore(this.config, this.services, data.facets, this.meta, this.loading, this.storage);
this.selections = new SelectionStore(this.config, this.services, {
state: this.state,
facets: data.facets,
meta: this.meta,
loading: this.loading,
storage: this.storage,
selections: selectedSelections,
});
}
}

@@ -1,8 +0,17 @@

import type { FinderStoreConfig, StoreServices } from '../../types';
import type { FinderStoreConfig, StoreServices, SelectedSelection, FinderStoreState } from '../../types';
import type { StorageStore } from '../../Storage/StorageStore';
import type { MetaResponseModel, SearchResponseModelFacet } from '@searchspring/snapi-types';
declare type SelectionStoreData = {
state: FinderStoreState;
facets: SearchResponseModelFacet[];
meta: MetaResponseModel;
loading: boolean;
storage: StorageStore;
selections: SelectedSelection[];
};
export declare class SelectionStore extends Array {
static get [Symbol.species](): ArrayConstructor;
constructor(config: FinderStoreConfig, services: StoreServices, facets: SearchResponseModelFacet[], meta: MetaResponseModel, loading: boolean, storage: StorageStore);
constructor(config: FinderStoreConfig, services: StoreServices, { state, facets, meta, loading, storage, selections }: SelectionStoreData);
}
export {};
//# sourceMappingURL=SelectionStore.d.ts.map

@@ -5,5 +5,45 @@ export class SelectionStore extends Array {

}
constructor(config, services, facets, meta, loading, storage) {
const selections = [];
if (facets && meta) {
constructor(config, services, { state, facets, meta, loading, storage, selections }) {
const selectedSelections = [];
if (selections?.length) {
config.fields.forEach((fieldObj) => {
const storedData = selections.find((selection) => selection.facet.field === fieldObj.field);
if (storedData) {
const { facet, selected } = storedData;
if (facet?.hierarchyDelimiter) {
// hierarchy
selections.forEach((selection, index) => {
const levels = fieldObj?.levels || facet?.values[facet?.values.length - 1]?.value.split(facet.hierarchyDelimiter);
const levelConfig = { index, label: fieldObj.levels ? levels[index] : '', key: `ss-${index}` };
const storageKey = generateStorageKey(config.id, facet.field);
storage.set(`${storageKey}.${levelConfig.key}.values`, selection.data);
const selectionHierarchy = new SelectionHierarchy(services, config.id, state, facet, levelConfig, loading, storage);
selectionHierarchy.selected = selection.selected;
selectionHierarchy.data = selection.data;
if (config.persist?.lockSelections) {
selectionHierarchy.disabled = true;
}
if (selection.selected) {
services.urlManager = services.urlManager.set(`filter.${selection.facet.field}`, selection.selected);
}
selectedSelections.push(selectionHierarchy);
});
}
else {
const selection = new Selection(services, config.id, state, facet, fieldObj, loading, storage);
selection.selected = selected;
selection.storage.set('selected', selected);
selection.data = facet.values;
if (selected) {
services.urlManager = services.urlManager.set(`filter.${facet.field}`, selected);
}
if (config.persist?.lockSelections) {
selection.disabled = true;
}
selectedSelections.push(selection);
}
}
});
}
else if (facets && meta) {
// re-order facets to match our config

@@ -34,15 +74,15 @@ config?.fields &&

const levelConfig = { index, label: fieldObj.levels ? level : '', key: `ss-${index}` };
selections.push(new SelectionHierarchy(services, config.id, facet, levelConfig, loading, storage));
selectedSelections.push(new SelectionHierarchy(services, config.id, state, facet, levelConfig, loading, storage));
});
}
else {
selections.push(new Selection(services, config.id, facet, fieldObj, loading, storage));
selectedSelections.push(new Selection(services, config.id, state, facet, fieldObj, loading, storage));
}
});
}
super(...selections);
super(...selectedSelections);
}
}
class SelectionBase {
constructor(services, id, facet, selectionConfig, loading, storageStore) {
constructor(services, id, state, facet, selectionConfig, loading, storageStore) {
this.filtered = false;

@@ -56,5 +96,7 @@ this.collapsed = false;

this.loading = loading;
this.state = state;
this.id = id;
this.config = selectionConfig;
// inherit all standard facet properties
this.facet = facet;
this.type = facet.type;

@@ -69,3 +111,3 @@ this.field = facet.field;

this.storage = {
key: `ss-finder-${this.id}.${this.field}`,
key: generateStorageKey(this.id, this.field),
get: function (key) {

@@ -92,4 +134,4 @@ const path = this.key + (key ? `.${key}` : '');

class Selection extends SelectionBase {
constructor(services, id, facet, config, loading, storageStore) {
super(services, id, facet, config, loading, storageStore);
constructor(services, id, state, facet, config, loading, storageStore) {
super(services, id, state, facet, config, loading, storageStore);
this.loading = loading;

@@ -108,2 +150,3 @@ this.storage.set('values', facet.values);

this.storage.set('selected', value);
this.state.persisted = false;
if (!value) {

@@ -118,4 +161,4 @@ this.services.urlManager.remove(`filter.${this.field}`).go();

class SelectionHierarchy extends SelectionBase {
constructor(services, id, facet, config, loading, storageStore) {
super(services, id, facet, config, loading, storageStore);
constructor(services, id, state, facet, config, loading, storageStore) {
super(services, id, state, facet, config, loading, storageStore);
// inherit additional facet properties

@@ -155,2 +198,3 @@ this.hierarchyDelimiter = facet.hierarchyDelimiter;

this.selected = value;
this.state.persisted = false;
const selectedLevel = this.config.index;

@@ -178,1 +222,4 @@ const storedLevels = this.storage.get();

}
function generateStorageKey(id, field) {
return `ss-finder-${id}.${field}`;
}
import type { UrlManager } from '@searchspring/snap-url-manager';
import type { StoreServices } from '../../types';
import type { SearchResponseModelSearch } from '@searchspring/snapi-types';
import type { SearchResponseModelSearch, SearchResponseModelSearchMatchTypeEnum } from '@searchspring/snapi-types';
export declare class QueryStore {

@@ -8,2 +8,3 @@ query: Query;

originalQuery: Query;
matchType: SearchResponseModelSearchMatchTypeEnum;
constructor(services: StoreServices, search: SearchResponseModelSearch);

@@ -10,0 +11,0 @@ }

@@ -17,2 +17,6 @@ import { observable, makeObservable } from 'mobx';

}
if (search?.matchType) {
this.matchType = search.matchType;
observables.matchType = observable;
}
makeObservable(this, observables);

@@ -19,0 +23,0 @@ }

@@ -23,4 +23,5 @@ export declare class StorageStore {

LOCAL = "local",
COOKIE = "cookie"
COOKIE = "cookie",
MEMORY = "memory"
}
//# sourceMappingURL=StorageStore.d.ts.map

@@ -23,3 +23,3 @@ import { featureFlags, cookies } from '@searchspring/snap-toolbox';

switch (config.type) {
case StorageType.SESSION:
case StorageType.SESSION: {
this.type = featureFlags.storage ? config.type : null;

@@ -31,3 +31,4 @@ if (this.type) {

break;
case StorageType.LOCAL:
}
case StorageType.LOCAL: {
this.type = featureFlags.storage ? config.type : null;

@@ -39,3 +40,4 @@ if (this.type && !window.localStorage.getItem(this.key)) {

break;
case StorageType.COOKIE:
}
case StorageType.COOKIE: {
if (featureFlags.cookies) {

@@ -49,2 +51,6 @@ this.type = config.type;

break;
}
default: {
this.type = StorageType.MEMORY;
}
}

@@ -127,2 +133,3 @@ }

StorageType["COOKIE"] = "cookie";
StorageType["MEMORY"] = "memory";
})(StorageType || (StorageType = {}));
import type { UrlManager } from '@searchspring/snap-url-manager';
import type { SearchResponseModelFacetValueAllOfValues } from '@searchspring/snapi-types';
export declare type StoreConfig = {

@@ -37,2 +38,7 @@ id: string;

fields: FinderFieldConfig[];
persist?: {
enabled: boolean;
lockSelections?: boolean;
expiration?: number;
};
};

@@ -90,3 +96,11 @@ export declare type FinderFieldConfig = {

}
export declare type SelectedSelection = {
selected: string;
data: SearchResponseModelFacetValueAllOfValues[];
facet: any;
};
export declare type FinderStoreState = {
persisted: boolean;
};
export {};
//# sourceMappingURL=types.d.ts.map
{
"name": "@searchspring/snap-store-mobx",
"version": "0.24.0",
"version": "0.25.0",
"description": "Snap MobX Store",

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

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

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

],
"gitHead": "2aadf9555a7c409f6922a4ab72938d2ea0510faf"
"gitHead": "b227a42874d7ae49b2cbe99a9879c7d761b24ee5"
}

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

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