@picked/svelte 0.0.1-dev.1767924764002 → 0.0.1-dev.1767932013788
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.
|
@@ -54,15 +54,7 @@ export declare function getForm<const TFieldIds extends readonly string[]>({ id:
|
|
|
54
54
|
label: string;
|
|
55
55
|
description?: string;
|
|
56
56
|
value: string;
|
|
57
|
-
condition
|
|
58
|
-
/**
|
|
59
|
-
* Factory function to create a callback observer with automatic cleanup
|
|
60
|
-
* Reduces duplication across success/error/submit callback patterns
|
|
61
|
-
*/
|
|
62
|
-
? /**
|
|
63
|
-
* Factory function to create a callback observer with automatic cleanup
|
|
64
|
-
* Reduces duplication across success/error/submit callback patterns
|
|
65
|
-
*/: import('node_modules/@picked/client/dist/types/logic-engine').LogicRule;
|
|
57
|
+
condition?: import('node_modules/@picked/client/dist/types/logic-engine').LogicRule;
|
|
66
58
|
}[] | null;
|
|
67
59
|
id: string;
|
|
68
60
|
name: string;
|
package/dist/form/form.svelte.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
CommitResponses,
|
|
3
2
|
ExperienceStep,
|
|
4
3
|
Field,
|
|
5
4
|
FieldValue,
|
|
@@ -18,7 +17,7 @@ import {
|
|
|
18
17
|
type Store,
|
|
19
18
|
combine,
|
|
20
19
|
} from 'effector'
|
|
21
|
-
import { getPicked, getExperience
|
|
20
|
+
import { getPicked, getExperience } from '../hooks'
|
|
22
21
|
|
|
23
22
|
interface Response {
|
|
24
23
|
questionId: Field['id']
|
|
@@ -121,7 +120,7 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
121
120
|
source: client.fields.listStore,
|
|
122
121
|
effect: createEffect(async (allFields: Field[]) => {
|
|
123
122
|
const filteredFields = allFields.filter((field) =>
|
|
124
|
-
(
|
|
123
|
+
fieldIds.some((id) => id === field.id),
|
|
125
124
|
)
|
|
126
125
|
return await getStepFields(client, filteredFields)
|
|
127
126
|
}),
|
|
@@ -190,7 +189,13 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
190
189
|
data: commitResult.data,
|
|
191
190
|
}),
|
|
192
191
|
effect: createEffect(
|
|
193
|
-
async ({
|
|
192
|
+
async ({
|
|
193
|
+
step,
|
|
194
|
+
data,
|
|
195
|
+
}: {
|
|
196
|
+
step: ExperienceStep | null
|
|
197
|
+
data: Record<FieldId, FieldValue>
|
|
198
|
+
}) => {
|
|
194
199
|
// Only fire events if in experience context
|
|
195
200
|
if (experienceInstance) {
|
|
196
201
|
client.eventBus({
|
|
@@ -200,6 +205,7 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
200
205
|
step: step ?? undefined,
|
|
201
206
|
})
|
|
202
207
|
}
|
|
208
|
+
|
|
203
209
|
return data
|
|
204
210
|
},
|
|
205
211
|
),
|
|
@@ -227,7 +233,7 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
227
233
|
client.eventBus({
|
|
228
234
|
type: 'field_validation_error',
|
|
229
235
|
exception: { reason: [exception] },
|
|
230
|
-
experience: experienceInstance
|
|
236
|
+
experience: experienceInstance,
|
|
231
237
|
step: step ?? undefined,
|
|
232
238
|
})
|
|
233
239
|
})
|
|
@@ -277,7 +283,7 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
277
283
|
source: {
|
|
278
284
|
stepFields: fieldsStore,
|
|
279
285
|
},
|
|
280
|
-
fn: ({ stepFields }, event) => {
|
|
286
|
+
fn: ({ stepFields }, event): Record<FieldId, FieldValue> => {
|
|
281
287
|
event.preventDefault()
|
|
282
288
|
|
|
283
289
|
const formData = new FormData(event.currentTarget)
|
|
@@ -369,7 +375,7 @@ export function getForm<const TFieldIds extends readonly string[]>({
|
|
|
369
375
|
})
|
|
370
376
|
})
|
|
371
377
|
|
|
372
|
-
return responses.data
|
|
378
|
+
return responses.data
|
|
373
379
|
},
|
|
374
380
|
target: submitObserver.executeFx,
|
|
375
381
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1767932013788",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"module": "./dist/index.js",
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@picked/client": "0.0.1-dev.
|
|
78
|
+
"@picked/client": "0.0.1-dev.1767932013788",
|
|
79
79
|
"effector": "^23.3.0",
|
|
80
80
|
"svelte": "^5.34.3"
|
|
81
81
|
},
|