@picked/react 0.0.7-next.3 → 0.0.7
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/context.d.ts +0 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/hooks/step.d.ts +19 -20
- package/dist/hooks/step.d.ts.map +1 -1
- package/dist/hooks/step.js +1 -1
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Picked } from '@picked/client';
|
|
|
2
2
|
export declare const ClientContext: import('react').Context<Picked | null>;
|
|
3
3
|
export declare const ClientProvider: import('react').Provider<Picked | null>;
|
|
4
4
|
export declare const ExperienceContext: import('react').Context<{
|
|
5
|
-
id: string;
|
|
6
5
|
experienceId: string;
|
|
7
6
|
configStore: import('effector').Store<{
|
|
8
7
|
type: string;
|
|
@@ -39,7 +38,6 @@ export declare const ExperienceContext: import('react').Context<{
|
|
|
39
38
|
stepsHistoryStore: import('effector').Store<import('@picked/client').HistoryEntry[]>;
|
|
40
39
|
} | null>;
|
|
41
40
|
export declare const ExperienceProvider: import('react').Provider<{
|
|
42
|
-
id: string;
|
|
43
41
|
experienceId: string;
|
|
44
42
|
configStore: import('effector').Store<{
|
|
45
43
|
type: string;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEhE,eAAO,MAAM,aAAa,wCAAqC,CAAA;AAC/D,eAAO,MAAM,cAAc,yCAAyB,CAAA;AAEpD,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEhE,eAAO,MAAM,aAAa,wCAAqC,CAAA;AAC/D,eAAO,MAAM,cAAc,yCAAyB,CAAA;AAEpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAiD,CAAA;AAC/E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAA"}
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { Store } from 'effector';
|
|
2
1
|
import { Field, Response } from '@picked/client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fields: Store<FieldWithValue[]>;
|
|
13
|
-
isActiveStep?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function useStep(): {
|
|
16
|
-
step: StepWithLabel;
|
|
17
|
-
fields: FieldWithValue[];
|
|
2
|
+
export interface StepContextValue {
|
|
3
|
+
step: {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
fields: {
|
|
8
|
+
field: Field | undefined;
|
|
9
|
+
value: Response | undefined;
|
|
10
|
+
}[];
|
|
18
11
|
isActiveStep: boolean;
|
|
19
|
-
}
|
|
12
|
+
}
|
|
13
|
+
export declare function useStep(): StepContextValue;
|
|
20
14
|
export declare function useSetStepContext(stepId: string): {
|
|
21
|
-
step:
|
|
22
|
-
|
|
15
|
+
step: {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
fields: {
|
|
20
|
+
field: Field | undefined;
|
|
21
|
+
value: import('@picked/client').FieldValue | undefined;
|
|
22
|
+
}[];
|
|
23
23
|
isActiveStep: boolean;
|
|
24
24
|
};
|
|
25
|
-
export {};
|
|
26
25
|
//# sourceMappingURL=step.d.ts.map
|
package/dist/hooks/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAKrD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAA;KAAE,EAAE,CAAA;IACnE,YAAY,EAAE,OAAO,CAAA;CACtB;AAID,wBAAgB,OAAO,qBAOtB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;EA4C/C"}
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as
|
|
1
|
+
import{createContext as a,useContext as w,useMemo as h}from"react";import{combine as C}from"effector";import{useUnit as b}from"effector-react";import{useStepRouter as E}from"../router/context.js";import{useExperience as P,usePicked as k}from"./client.js";const v=a(null);function $(){const e=w(v);if(!e)throw new Error("useStep must be used within a StepContextProvider");return e}function g(e){const d=P(),s=k(),{activeStep:t}=E(),p=h(()=>(t==null?void 0:t.id)===e,[t==null?void 0:t.id,e]),i=b(C({tree:d.treeStore,fields:s.fields.listStore,responses:s.responses.listStore},({tree:c,fields:f,responses:l})=>{const n=c.steps.find(o=>o.id===e);if(!n)throw new Error(`Step with id "${e}" not found in the experience tree.`);const m=n.fieldIds.map(o=>{var u;const x=f.find(r=>r.id===o),S=(u=l.find(r=>r.fieldId===o))==null?void 0:u.value;return{field:x,value:S}});return{step:{id:n.id,label:n.label},fields:m}}));return{step:i.step,fields:i.fields,isActiveStep:p}}export{g as useSetStepContext,$ as useStep};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/react",
|
|
3
|
-
"version": "0.0.7
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@picked/client": "workspace:*",
|
|
6
6
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
],
|
|
55
55
|
"module": "./dist/index.js",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@picked/client": "0.0.7
|
|
57
|
+
"@picked/client": "0.0.7",
|
|
58
58
|
"effector": "^23.3.0",
|
|
59
59
|
"effector-react": "^23.3.0",
|
|
60
60
|
"react": "^19.1.0",
|