@bigbinary/neeto-form-frontend 1.0.21 → 1.0.22

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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import axios from "axios";
2
2
  import { ButtonProps, TypographyProps } from "@bigbinary/neetoui";
3
3
  import React, { FormHTMLAttributes, HTMLAttributes } from "react";
4
+ import { UseQueryResult, UseMutationResult, UseQueryOptions, UseMutationOptions } from "react-query";
4
5
 
5
6
  interface BuildFormProps {
6
7
  id: string;
@@ -69,6 +70,40 @@ interface ISubmission {
69
70
  }[];
70
71
  }
71
72
 
73
+ interface KeyValuePair {
74
+ [key: string]: any;
75
+ }
76
+
77
+ interface UpdateHookResponse<TData = unknown, TError = unknown> extends Omit<UseMutationResult<TData, TError>, 'mutate' | 'mutateAsync'> {
78
+ mutate: (args: {
79
+ id: string;
80
+ values: KeyValuePair
81
+ }) => Promise<TData>;
82
+ mutateAsync: (args: {
83
+ id: string;
84
+ values: KeyValuePair
85
+ }) => Promise<TData>;
86
+ };
87
+
88
+ interface CreateHookResponse<TData = unknown, TError = unknown> extends Omit<UseMutationResult<TData, TError>, 'mutate' | 'mutateAsync'> {
89
+ mutate: (values: KeyValuePair) => Promise<TData>;
90
+ mutateAsync: (values: KeyValuePair) => Promise<TData>;
91
+ };
92
+
93
+ interface DeleteHookResponse<TData = unknown, TError = unknown> extends Omit<UseMutationResult<TData, TError>, 'mutate' | 'mutateAsync'> {
94
+ mutate: (args: {
95
+ id: string;
96
+ })=> Promise<TData>;
97
+ mutateAsync: (args: {
98
+ id: string;
99
+ })=> Promise<TData>;
100
+ };
101
+
102
+ interface FormHookOptions extends UseQueryOptions {
103
+ formId: string,
104
+ preview?: boolean
105
+ }
106
+
72
107
  export const BuildForm: React.FC<BuildFormProps>;
73
108
  export const ExternalForm: React.FC<ExternalFormProps>;
74
109
  export const Submission: React.FC<SubmissionProps>;
@@ -82,3 +117,9 @@ export const useFormSubmission: (args: {
82
117
  submission: ISubmission;
83
118
  isLoading: boolean;
84
119
  };
120
+
121
+ export const useForms: (options? :UseQueryOptions) => UseQueryResult;
122
+ export const useForm: (options?: FormHookOptions) => UseQueryResult;
123
+ export const useCreateForm: (options? :UseMutationOptions) => CreateHookResponse;
124
+ export const useUpdateForm: (options? :UseMutationOptions) => UpdateHookResponse;
125
+ export const useDeleteForm: (options? :UseMutationOptions) => DeleteHookResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-form-frontend",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Neeto Form Engine Frontend",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",