@picked/svelte 0.0.67 → 0.0.68
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/dist/hooks/feature.d.ts +38 -3
- package/dist/hooks/feature.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/package.json +2 -2
package/dist/hooks/feature.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
interface FeatureResult {
|
|
3
3
|
id: string;
|
|
4
4
|
bucket: string | boolean;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
type FeatureBucketValue = boolean | string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the reactive store wrapping a feature in an evokable function.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} featureName - The feature id to look up.
|
|
11
|
+
* @returns {Store<() => Promise<FeatureBucketValue>>} The evokable-feature store.
|
|
12
|
+
* @example
|
|
13
|
+
* const $evokable = getFeature('winter-sale')
|
|
14
|
+
*/
|
|
15
|
+
export declare function getFeature(featureName: string): Store<() => Promise<FeatureBucketValue>>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a store that resolves to a feature's evaluated bucket result.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} featureName - The feature id to evaluate.
|
|
20
|
+
* @returns {Store<FeatureResult | undefined>} A store holding the resolved bucket result, or undefined until resolved.
|
|
21
|
+
* @example
|
|
22
|
+
* const $result = getFeatureResult('winter-sale')
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFeatureResult(featureName: string): Store<FeatureResult | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a store holding a feature's admin `enabled` flag.
|
|
27
|
+
*
|
|
28
|
+
* Unlike {@link getFeatureResult}, this reads the static config flag directly and does not
|
|
29
|
+
* trigger bucket resolution — so a disabled feature (`enabled: false`) can be told apart
|
|
30
|
+
* from an enabled feature whose session simply was not allocated. Resolves to `undefined`
|
|
31
|
+
* when the feature is unregistered or carries no `enabled` metadata (for example,
|
|
32
|
+
* manually-registered features).
|
|
33
|
+
*
|
|
34
|
+
* @param {string} featureName - The feature id to look up.
|
|
35
|
+
* @returns {Store<boolean | undefined>} A store holding the feature's `enabled` flag, or undefined when unknown.
|
|
36
|
+
* @example
|
|
37
|
+
* const $enabled = getFeatureEnabled('winter-sale')
|
|
38
|
+
*/
|
|
39
|
+
export declare function getFeatureEnabled(featureName: string): Store<boolean | undefined>;
|
|
40
|
+
export {};
|
package/dist/hooks/feature.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";function o(t){return e().features.getEvokableFeature(t)}function s(e){let s=o(e),c=i(void 0,{skipVoid:!1}),l=r(),u=t({source:s,mapParams:(e,t)=>t,effect:n(async e=>await e())});return a({clock:l,target:u}),a({clock:u.doneData,fn:t=>{if(t!==void 0)return{id:e,bucket:t}},target:c}),l(),a({clock:s,target:l}),c}export{o as getFeature,s as getFeatureResult};
|
|
1
|
+
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";function o(t){return e().features.getEvokableFeature(t)}function s(e){let s=o(e),c=i(void 0,{skipVoid:!1}),l=r(),u=t({source:s,mapParams:(e,t)=>t,effect:n(async e=>await e())});return a({clock:l,target:u}),a({clock:u.doneData,fn:t=>{if(t!==void 0)return{id:e,bucket:t}},target:c}),l(),a({clock:s,target:l}),c}function c(t){return e().features.getById(t).map(e=>e?.enabled,{skipVoid:!1})}export{o as getFeature,c as getFeatureEnabled,s as getFeatureResult};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @file Public re-exports for Svelte hook utilities. */
|
|
2
2
|
export { getPicked, getExperience } from './client';
|
|
3
3
|
export { getPredicate, getPredicateResult } from './predicate';
|
|
4
|
-
export { getFeature, getFeatureResult } from './feature';
|
|
4
|
+
export { getFeature, getFeatureResult, getFeatureEnabled } from './feature';
|
|
5
5
|
export { getAction, getActionResult } from './action';
|
|
6
6
|
export { getStep, setStepContext, getStepContent } from './step';
|
|
7
7
|
export { getContent } from './content';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureResult as
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureEnabled as a,getFeatureResult as o}from"./feature.js";import{getAction as s,getActionResult as c}from"./action.js";import{getStep as l,getStepContent as u,setStepContext as d}from"./step.js";import{getContent as f}from"./content.js";import{getContextScope as p,setContextScope as m,useUnit as h}from"./stores.js";import{createLocalStorageStore as g,createSessionStorageStore as _}from"./storage.js";import{getTrackRecommendationPresentEvent as v}from"./events.js";import{createQuery as y,queryCache as b,queryPresets as x}from"./create-query/index.js";export{g as createLocalStorageStore,y as createQuery,_ as createSessionStorageStore,s as getAction,c as getActionResult,f as getContent,p as getContextScope,e as getExperience,i as getFeature,a as getFeatureEnabled,o as getFeatureResult,t as getPicked,n as getPredicate,r as getPredicateResult,l as getStep,u as getStepContent,v as getTrackRecommendationPresentEvent,b as queryCache,x as queryPresets,m as setContextScope,d as setStepContext,h as useUnit};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"module": "./dist/index.js",
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@picked/client": "0.0.
|
|
109
|
+
"@picked/client": "0.0.68",
|
|
110
110
|
"effector": "^23.3.0",
|
|
111
111
|
"svelte": "^5.46.4"
|
|
112
112
|
},
|