@picked/svelte 0.0.1-dev.1767591456821 → 0.0.1-dev.1767653321515

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.
@@ -21,5 +21,6 @@ export declare function getForm({ id: formId, title, fields }: GetFormOptions):
21
21
  onFormSubmit: (callback: SubmitCallback) => void;
22
22
  onFormSuccess: (callback: SuccessCallback) => void;
23
23
  onFormError: (callback: ErrorCallback) => void;
24
+ isFormSubmitting: import('effector').StoreWritable<boolean>;
24
25
  };
25
26
  export {};
@@ -73,6 +73,7 @@ export function getForm({ id: formId, title, fields }: GetFormOptions) {
73
73
  const stopNavigationEvent = createEvent<void>()
74
74
  const allCallbacksCompleteEvent = createEvent<void>()
75
75
 
76
+ const isFormSubmitting = createStore<boolean>(false)
76
77
  const stopNavigationStore = createStore(false)
77
78
  stopNavigationStore
78
79
  .on(stopNavigationEvent, () => true) // Set to true when stopNavigation is used in onFormSuccess
@@ -146,6 +147,13 @@ export function getForm({ id: formId, title, fields }: GetFormOptions) {
146
147
  ),
147
148
  })
148
149
 
150
+ // set isFormSubmitting to true when the form is submitted
151
+ sample({
152
+ clock: submitEvent,
153
+ fn: () => true,
154
+ target: isFormSubmitting,
155
+ })
156
+
149
157
  sample({
150
158
  clock: submitEvent,
151
159
  source: { step: stepStore },
@@ -329,6 +337,12 @@ export function getForm({ id: formId, title, fields }: GetFormOptions) {
329
337
  target: errorObserver.executeFx,
330
338
  })
331
339
 
340
+ sample({
341
+ clock: [allCallbacksCompleteEvent, errorObserver.executeFx.done],
342
+ fn: () => false,
343
+ target: isFormSubmitting,
344
+ })
345
+
332
346
  return {
333
347
  form: {
334
348
  onsubmit: submitEvent,
@@ -336,5 +350,6 @@ export function getForm({ id: formId, title, fields }: GetFormOptions) {
336
350
  onFormSubmit: submitObserver.register,
337
351
  onFormSuccess: successObserver.register,
338
352
  onFormError: errorObserver.register,
353
+ isFormSubmitting,
339
354
  }
340
355
  }
@@ -21,6 +21,7 @@ export declare function getStep(): {
21
21
  stopNavigation: import('effector').EventCallable<void>;
22
22
  }) => void | Promise<void>) => void;
23
23
  onFormError: (callback: (errors: import('@picked/client').ValidationError[]) => void | Promise<void>) => void;
24
+ isFormSubmitting: import('effector').StoreWritable<boolean>;
24
25
  step: Store<ExperienceStep>;
25
26
  fields: Store<FieldWithValue[]>;
26
27
  isActiveStep: Store<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/svelte",
3
- "version": "0.0.1-dev.1767591456821",
3
+ "version": "0.0.1-dev.1767653321515",
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.1767591456821",
78
+ "@picked/client": "0.0.1-dev.1767653321515",
79
79
  "effector": "^23.3.0",
80
80
  "svelte": "^5.34.3"
81
81
  },