@picked/react 0.0.12 → 0.0.13

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 CHANGED
@@ -5,10 +5,10 @@ export declare const ExperienceContext: import('react').Context<{
5
5
  id: string;
6
6
  experienceId: string;
7
7
  configStore: import('effector').Store<{
8
- type: string;
9
8
  name: string;
10
9
  decisionLogic: import('node_modules/@picked/client/dist/types/logic-engine').LogicRule | undefined;
11
10
  targetSelectors: import('@picked/client').ExperienceTarget[];
11
+ initializeOpenLogic: import('node_modules/@picked/client/dist/types/logic-engine').LogicValue | import('node_modules/@picked/client/dist/types/logic-engine').LogicRule;
12
12
  }>;
13
13
  target: HTMLElement | undefined;
14
14
  componentStore: import('effector').Store<{
@@ -42,10 +42,10 @@ export declare const ExperienceProvider: import('react').Provider<{
42
42
  id: string;
43
43
  experienceId: string;
44
44
  configStore: import('effector').Store<{
45
- type: string;
46
45
  name: string;
47
46
  decisionLogic: import('node_modules/@picked/client/dist/types/logic-engine').LogicRule | undefined;
48
47
  targetSelectors: import('@picked/client').ExperienceTarget[];
48
+ initializeOpenLogic: import('node_modules/@picked/client/dist/types/logic-engine').LogicValue | import('node_modules/@picked/client/dist/types/logic-engine').LogicRule;
49
49
  }>;
50
50
  target: HTMLElement | undefined;
51
51
  componentStore: import('effector').Store<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAQxE,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9D;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc;;0BAKd,WAAW,GAAG;YAAE,aAAa,EAAE,WAAW,GAAG,eAAe,CAAA;SAAE;;EA0G9F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAQxE,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9D;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc;;0BAKd,WAAW,GAAG;YAAE,aAAa,EAAE,WAAW,GAAG,eAAe,CAAA;SAAE;;EA+G9F"}
@@ -1 +1 @@
1
- import{usePicked as y,useExperience as v}from"../hooks/client.js";import"../hooks/step.js";import"react";import"@picked/client";function _(a){const s=y();v();const{id:o,title:l}=a;async function d(c){var f,m;c.preventDefault(),s.eventBus({type:"form_submit",form:{id:o,title:l}});const p=new FormData(c.currentTarget),i={data:{},push(t){const r=t.questionId,e=this.data[r];e?Array.isArray(e)&&Array.isArray(t.value)?Array.isArray(e)&&Array.isArray(t.value)&&(typeof e[0]=="string"?this.data[r]=[...e,...t.value].map(String):typeof e[0]=="number"?this.data[r]=[...e,...t.value].map(Number):typeof e[0]=="boolean"?this.data[r]=[...e,...t.value].map(u=>!!u):this.data[r]=t.value):this.data[r]=t.value:this.data[r]=t.value}};for(const[t,r]of p.entries()){const e=s.fields.getById(t).getState();if(!e)continue;const u=e.id;switch(e.type){case"text":i.push({questionId:u,value:e.multiple?[String(r)]:String(r)});break;case"number":i.push({questionId:u,value:e.multiple?[Number(r)]:Number(r)});break;case"boolean":i.push({questionId:u,value:e.multiple?[r==="true"]:r==="true"});break}}const{errors:n}=await s.responses.commit(i.data);if(n.length>0){s.eventBus({type:"form_submit_error",form:{id:o,title:l},exception:{reason:n}}),n.forEach(t=>{s.eventBus({type:"field_validation_error",exception:{reason:[t]}})}),await((f=a.onError)==null?void 0:f.call(a,n));return}s.eventBus({type:"form_submit_success",form:{id:o,title:l}}),await((m=a.onSuccess)==null?void 0:m.call(a))}return{form:{onsubmit:d}}}export{_ as useForm};
1
+ import{usePicked as v,useExperience as b}from"../hooks/client.js";import"../hooks/step.js";import"react";import"@picked/client";function _(a){const s=v(),i=b(),{id:l,title:c}=a;async function p(f){var m,d;f.preventDefault(),s.eventBus({type:"form_submit",form:{id:l,title:c},experience:i});const y=new FormData(f.currentTarget),n={data:{},push(t){const r=t.questionId,e=this.data[r];e?Array.isArray(e)&&Array.isArray(t.value)?Array.isArray(e)&&Array.isArray(t.value)&&(typeof e[0]=="string"?this.data[r]=[...e,...t.value].map(String):typeof e[0]=="number"?this.data[r]=[...e,...t.value].map(Number):typeof e[0]=="boolean"?this.data[r]=[...e,...t.value].map(u=>!!u):this.data[r]=t.value):this.data[r]=t.value:this.data[r]=t.value}};for(const[t,r]of y.entries()){const e=s.fields.getById(t).getState();if(!e)continue;const u=e.id;switch(e.type){case"text":n.push({questionId:u,value:e.multiple?[String(r)]:String(r)});break;case"number":n.push({questionId:u,value:e.multiple?[Number(r)]:Number(r)});break;case"boolean":n.push({questionId:u,value:e.multiple?[r==="true"]:r==="true"});break}}const{errors:o}=await s.responses.commit(n.data);if(o.length>0){s.eventBus({type:"form_submit_error",form:{id:l,title:c},exception:{reason:o},experience:i}),o.forEach(t=>{s.eventBus({type:"field_validation_error",exception:{reason:[t]},experience:i})}),await((m=a.onError)==null?void 0:m.call(a,o));return}s.eventBus({type:"form_submit_success",form:{id:l,title:c},experience:i}),await((d=a.onSuccess)==null?void 0:d.call(a))}return{form:{onsubmit:p}}}export{_ as useForm};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/react",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "devDependencies": {
5
5
  "@picked/client": "workspace:*",
6
6
  "@repo/eslint-config": "workspace:*",
@@ -14,7 +14,7 @@
14
14
  "fast-glob": "^3.3.3",
15
15
  "typedoc": "^0.28.5",
16
16
  "typedoc-plugin-markdown": "^4.6.3",
17
- "vite": "^6.3.5",
17
+ "vite": "^6.4.1",
18
18
  "vite-plugin-dts": "^4.5.4"
19
19
  },
20
20
  "exports": {
@@ -54,7 +54,7 @@
54
54
  ],
55
55
  "module": "./dist/index.js",
56
56
  "peerDependencies": {
57
- "@picked/client": "0.0.12",
57
+ "@picked/client": "0.0.13",
58
58
  "effector": "^23.3.0",
59
59
  "effector-react": "^23.3.0",
60
60
  "react": "^19.1.0",