@streamlayer/sdk-web-interfaces 0.18.15 → 0.18.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/feature.js CHANGED
@@ -56,14 +56,13 @@ export class AbstractFeature {
56
56
  for (configKey in config) {
57
57
  this.config.setValue(configKey, config[configKey]);
58
58
  }
59
- if (settings?.overlaySettings.case === this.settingsKey) {
59
+ if (settings?.overlaySettings?.case !== undefined && settings?.overlaySettings.case === this.settingsKey) {
60
60
  const newSettings = settings.overlaySettings.value;
61
61
  if (newSettings !== undefined) {
62
62
  let key;
63
63
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
64
64
  // @ts-ignore
65
65
  for (key in newSettings) {
66
- console.log(key, newSettings[key]);
67
66
  if (newSettings[key] !== 0 && newSettings[key] !== '') {
68
67
  this.settings.setValue(key, newSettings[key]);
69
68
  }
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { AbstractStore, mergeStores } from './store/abstract';
8
8
  export { ApiStore } from './store/api';
9
9
  export interface StreamLayerSDK {
10
10
  openFeature: (featureType: FeatureType) => void;
11
- closeFeature: () => void;
11
+ closeFeature: (destroy?: boolean) => void;
12
12
  }
13
13
  export interface StreamLayerContext {
14
14
  sdk: StreamLayerSDK;
@@ -63,9 +63,9 @@ export class AbstractStore {
63
63
  constructor(store, name) {
64
64
  this.store = store;
65
65
  this.name = name;
66
- if (process.env.NODE_ENV !== 'production') {
67
- slStoreLogger(this.store, this.name);
68
- }
66
+ // if (process.env.NODE_ENV !== 'production') {
67
+ slStoreLogger(this.store, this.name);
68
+ // }
69
69
  }
70
70
  /**
71
71
  * return store instance
@@ -1,4 +1,4 @@
1
- import type { FetcherStore } from '@nanostores/query';
1
+ import type { FetcherStore, FetcherValue } from '@nanostores/query';
2
2
  import { WritableAtom } from 'nanostores';
3
3
  import { AbstractStore } from './abstract';
4
4
  /**
@@ -6,7 +6,7 @@ import { AbstractStore } from './abstract';
6
6
  */
7
7
  export declare class ApiStore<StoreValue, StoreInstance extends FetcherStore<StoreValue, any> = FetcherStore<StoreValue, any>> extends AbstractStore<StoreInstance> {
8
8
  private readonly atomStore;
9
- constructor(store: StoreInstance, name: string, atomPicker?: (val?: StoreInstance['value']) => string | undefined);
9
+ constructor(store: StoreInstance, name: string, atomPicker?: (val: FetcherValue<StoreValue, unknown>, prevVal?: string) => string | undefined);
10
10
  getAtomStore: () => WritableAtom<string | undefined>;
11
11
  getValue: () => Promise<StoreValue | undefined>;
12
12
  getValues: () => never;
package/lib/store/api.js CHANGED
@@ -10,7 +10,11 @@ export class ApiStore extends AbstractStore {
10
10
  this.atomStore = atom();
11
11
  if (atomPicker) {
12
12
  store.subscribe((data) => {
13
- this.atomStore.set(atomPicker(data));
13
+ const prev = this.atomStore.get();
14
+ const newValue = atomPicker(data, prev);
15
+ if (prev !== newValue) {
16
+ this.atomStore.set(newValue);
17
+ }
14
18
  });
15
19
  }
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/sdk-web-interfaces",
3
- "version": "0.18.15",
3
+ "version": "0.18.18",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "nanostores": "^0.9.5",
22
22
  "@bufbuild/protobuf": "^1.4.2",
23
23
  "microdiff": "^1.3.2",
24
- "@streamlayer/sdk-web-types": "^0.20.1"
24
+ "@streamlayer/sdk-web-types": "^0.1.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tslib": "^2.6.2"