@bigbinary/neeto-form-frontend 1.2.14 → 1.2.15

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.
@@ -43,7 +43,7 @@
43
43
  "nif": "Name",
44
44
  "tif": "Single line text",
45
45
  "eif": "Email",
46
- "pif": "Phone",
46
+ "pif": "Phone number",
47
47
  "rif": "Rating",
48
48
  "tcf": "Terms and conditions",
49
49
  "date": "Date",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-form-frontend",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "Neeto Form Engine Frontend",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbinary/neeto-form-nano",
package/types.d.ts CHANGED
@@ -1,3 +1,268 @@
1
- import React from "react";
1
+ import axios from "axios";
2
+ import { ButtonProps, TypographyProps } from "@bigbinary/neetoui";
3
+ import React, { FormHTMLAttributes, HTMLAttributes } from "react";
4
+ import {
5
+ UseQueryResult,
6
+ UseMutationResult,
7
+ UseQueryOptions,
8
+ UseMutationOptions,
9
+ } from "react-query";
10
+ import { EditorProps } from "@bigbinary/neeto-editor";
11
+ import { Schema } from "yup";
2
12
 
3
- export const WelcomeScreen = React.FC<{}>;
13
+ interface Question {
14
+ id: string;
15
+ entityId?: string;
16
+ entityType?: string;
17
+ label: string;
18
+ placeholder?: string;
19
+ isRequired?: boolean;
20
+ optionsAttributes?: {
21
+ id: string;
22
+ label: string;
23
+ displayOrder: number;
24
+ }[];
25
+ highestRatingLabel?: string;
26
+ lowestRatingLabel?: string;
27
+ averageRatingLabel?: string;
28
+ options?: KeyValuePair[];
29
+ count?: number;
30
+ shape?: string;
31
+ kind: string;
32
+ [key: string]: any;
33
+ }
34
+
35
+ interface BuildFormProps {
36
+ id: string;
37
+ allowAdditionalGuests?: boolean;
38
+ onUpdate?: (data: any) => void;
39
+ buildRequestArgs?: any;
40
+ showAddQuestionDivider?: boolean;
41
+ nonRemovableFields?: string[];
42
+ requiredFields?: string[];
43
+ formDomProps?: FormHTMLAttributes<HTMLFormElement>;
44
+ showActionBlock?: boolean;
45
+ submitButtonProps?: HTMLAttributes<HTMLButtonElement>;
46
+ cancelButtonProps?: HTMLAttributes<HTMLButtonElement>;
47
+ questionKinds?: KeyValuePair[];
48
+ isKindAlreadyActive?: (args: {
49
+ activeQuestions: KeyValuePair[];
50
+ kind: KeyValuePair;
51
+ }) => boolean;
52
+ getActiveKindDetails?: (args: {
53
+ allQuestionKinds: KeyValuePair[];
54
+ item: Item;
55
+ }) => {
56
+ kind: string;
57
+ label: string;
58
+ FieldComponent: React.FC;
59
+ FieldIcon: string | any;
60
+ isSingular: boolean;
61
+ };
62
+ showLoader?: boolean;
63
+ kindUniqueOn?: string[];
64
+ isFieldRequired?: (item: Item) => boolean;
65
+ isFieldLabelDisabled?: (item: Item) => boolean;
66
+ isQuestionDeletable?: (item: Item) => boolean;
67
+ disabledAddButtonTooltipProps?: DisabledAddButtonTooltipProps;
68
+ }
69
+
70
+ interface ExternalFormProps {
71
+ preview?: boolean;
72
+ formId: string;
73
+ submissionId?: string;
74
+ customSubmitHandler?: (data: any) => void;
75
+ onBeforeSubmit?: (
76
+ data: any,
77
+ values: any
78
+ ) => any | Promise<any> | void | Promise<void> | undefined | null;
79
+ onSubmitSuccess?: (data: any) => void;
80
+ showTitle?: boolean;
81
+ formTitle?: string;
82
+ titleProps?: TypographyProps;
83
+ submitRequestArgs?: any;
84
+ footer?: React.ReactNode;
85
+ submitButtonProps?: ButtonProps;
86
+ cancelButtonProps?: ButtonProps;
87
+ resetButtonProps?: ButtonProps;
88
+ showPrefixIcons?: boolean;
89
+ displayThankYou?: boolean;
90
+ showSuccessToastr?: boolean;
91
+ showEmptyState?: boolean;
92
+ className?: string;
93
+ preserveValues?: boolean;
94
+ clearValuesOnReset?: boolean;
95
+ clearValuesOnSubmit?: boolean;
96
+ onChange?: (values: any) => void;
97
+ initialValues?: any;
98
+ formDomProps?: FormHTMLAttributes<HTMLFormElement>;
99
+ editorProps?: EditorProps;
100
+ customValidator?: (question: Question) => Schema;
101
+ }
102
+
103
+ interface DisabledAddButtonTooltipProps {
104
+ content?: string
105
+ }
106
+
107
+ interface SubmissionProps {
108
+ formId: string;
109
+ submissionId: string;
110
+ className?: string;
111
+ questionLabelProps?: TypographyProps;
112
+ answerProps?: TypographyProps;
113
+ }
114
+
115
+ interface IBuildFormState {
116
+ values: any;
117
+ dirty: boolean;
118
+ isSubmitting: boolean;
119
+ isValid: boolean;
120
+ errors: { [key: string]: string }[];
121
+ submitForm: () => void;
122
+ resetForm: () => void;
123
+ }
124
+
125
+ interface ISubmission {
126
+ responses: {
127
+ label: string;
128
+ value: string;
129
+ kind: string;
130
+ }[];
131
+ }
132
+
133
+ interface KeyValuePair {
134
+ [key: string]: any;
135
+ }
136
+
137
+ interface UpdateHookResponse<TData = unknown, TError = unknown>
138
+ extends Omit<UseMutationResult<TData, TError>, "mutate" | "mutateAsync"> {
139
+ mutate: (args: { id: string; values: KeyValuePair }) => Promise<TData>;
140
+ mutateAsync: (args: { id: string; values: KeyValuePair }) => Promise<TData>;
141
+ }
142
+
143
+ interface CreateHookResponse<TData = unknown, TError = unknown>
144
+ extends Omit<UseMutationResult<TData, TError>, "mutate" | "mutateAsync"> {
145
+ mutate: (values: KeyValuePair) => Promise<TData>;
146
+ mutateAsync: (values: KeyValuePair) => Promise<TData>;
147
+ }
148
+
149
+ interface DeleteHookResponse<TData = unknown, TError = unknown>
150
+ extends Omit<UseMutationResult<TData, TError>, "mutate" | "mutateAsync"> {
151
+ mutate: (args: { id: string }) => Promise<TData>;
152
+ mutateAsync: (args: { id: string }) => Promise<TData>;
153
+ }
154
+
155
+ interface FormHookOptions extends UseQueryOptions {
156
+ formId: string;
157
+ preview?: boolean;
158
+ }
159
+
160
+ interface Item {
161
+ label: string;
162
+ isRequired: boolean;
163
+ optionsAttributes: KeyValuePair[];
164
+ metadata?: KeyValuePair[];
165
+ kind: string;
166
+ nodeId: string;
167
+ }
168
+
169
+ interface EmailProps {
170
+ name: string;
171
+ isRequired: boolean;
172
+ }
173
+
174
+ interface DropdownProps {
175
+ item: Item;
176
+ name: string;
177
+ isRequired: boolean;
178
+ }
179
+
180
+ interface ShortTextProps {
181
+ name: string;
182
+ isRequired: boolean;
183
+ }
184
+
185
+ interface LongTextProps {
186
+ name: string;
187
+ isRequired: boolean;
188
+ }
189
+
190
+ interface MultipleChoiceProps {
191
+ item: Item;
192
+ name: string;
193
+ isRequired: boolean;
194
+ }
195
+
196
+ interface SingleChoiceProps {
197
+ item: Item;
198
+ name: string;
199
+ isRequired: boolean;
200
+ }
201
+
202
+ interface PhoneProps {
203
+ name: string;
204
+ isRequired: boolean;
205
+ }
206
+
207
+ interface RatingProps {
208
+ name: string;
209
+ isRequired: boolean;
210
+ }
211
+
212
+ interface TermsProps {
213
+ name: string;
214
+ }
215
+
216
+ interface StarRatingProps {
217
+ name: string;
218
+ isRequired: boolean;
219
+ }
220
+
221
+ interface AdditionalGuestsProps {
222
+ name: string;
223
+ }
224
+
225
+ interface ConditionProps {
226
+ name: string;
227
+ isRequired: boolean;
228
+ }
229
+
230
+ export const BuildForm: React.FC<BuildFormProps>;
231
+ export const ExternalForm: React.FC<ExternalFormProps>;
232
+ export const Submission: React.FC<SubmissionProps>;
233
+ export const NeetoFormProvider: React.FC;
234
+ export const Fields: {
235
+ Email: React.FC<EmailProps>;
236
+ Dropdown: React.FC<DropdownProps>;
237
+ ShortText: React.FC<ShortTextProps>;
238
+ LongText: React.FC<LongTextProps>;
239
+ MultipleChoice: React.FC<MultipleChoiceProps>;
240
+ SingleChoice: React.FC<SingleChoiceProps>;
241
+ Phone: React.FC<PhoneProps>;
242
+ Rating: React.FC<RatingProps>;
243
+ Terms: React.FC<TermsProps>;
244
+ StarRating: React.FC<StarRatingProps>;
245
+ AdditionalGuests: React.FC<AdditionalGuestsProps>;
246
+ Condition: React.FC<ConditionProps>;
247
+ };
248
+
249
+ export const useBuildFormState: () => IBuildFormState;
250
+ export const useFormSubmission: (args: {
251
+ formId: string;
252
+ submissionId: string;
253
+ }) => {
254
+ submission: ISubmission;
255
+ isLoading: boolean;
256
+ };
257
+
258
+ export const useForms: (options?: UseQueryOptions) => UseQueryResult;
259
+ export const useForm: (options?: FormHookOptions) => UseQueryResult;
260
+ export const useCreateForm: (
261
+ options?: UseMutationOptions
262
+ ) => CreateHookResponse;
263
+ export const useUpdateForm: (
264
+ options?: UseMutationOptions
265
+ ) => UpdateHookResponse;
266
+ export const useDeleteForm: (
267
+ options?: UseMutationOptions
268
+ ) => DeleteHookResponse;