@wix/forms 1.0.0

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.
Files changed (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/forms-v4-submission.http.d.ts +23 -0
  5. package/build/cjs/src/forms-v4-submission.http.js +316 -0
  6. package/build/cjs/src/forms-v4-submission.http.js.map +1 -0
  7. package/build/cjs/src/forms-v4-submission.public.d.ts +16 -0
  8. package/build/cjs/src/forms-v4-submission.public.js +64 -0
  9. package/build/cjs/src/forms-v4-submission.public.js.map +1 -0
  10. package/build/cjs/src/forms-v4-submission.types.d.ts +412 -0
  11. package/build/cjs/src/forms-v4-submission.types.js +25 -0
  12. package/build/cjs/src/forms-v4-submission.types.js.map +1 -0
  13. package/build/cjs/src/forms-v4-submission.universal.d.ts +627 -0
  14. package/build/cjs/src/forms-v4-submission.universal.js +586 -0
  15. package/build/cjs/src/forms-v4-submission.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/forms-v4-submission.http.d.ts +23 -0
  20. package/build/es/src/forms-v4-submission.http.js +304 -0
  21. package/build/es/src/forms-v4-submission.http.js.map +1 -0
  22. package/build/es/src/forms-v4-submission.public.d.ts +16 -0
  23. package/build/es/src/forms-v4-submission.public.js +49 -0
  24. package/build/es/src/forms-v4-submission.public.js.map +1 -0
  25. package/build/es/src/forms-v4-submission.types.d.ts +412 -0
  26. package/build/es/src/forms-v4-submission.types.js +22 -0
  27. package/build/es/src/forms-v4-submission.types.js.map +1 -0
  28. package/build/es/src/forms-v4-submission.universal.d.ts +627 -0
  29. package/build/es/src/forms-v4-submission.universal.js +555 -0
  30. package/build/es/src/forms-v4-submission.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1,412 @@
1
+ export interface FormSubmission {
2
+ /**
3
+ * Submission id.
4
+ * @readonly
5
+ */
6
+ id?: string | null;
7
+ /** Id of a form to which submission belongs. */
8
+ formId?: string;
9
+ /**
10
+ * Form namespace to which submissions belong.
11
+ * @readonly
12
+ */
13
+ namespace?: string;
14
+ /** Status of the submission. */
15
+ status?: SubmissionStatus;
16
+ /** Submission values where key is a target of a form field and value is a submissions for the given field. */
17
+ submissions?: Record<string, any>;
18
+ /**
19
+ * Date of creation.
20
+ * @readonly
21
+ */
22
+ createdDate?: Date;
23
+ /**
24
+ * Date of last update.
25
+ * @readonly
26
+ */
27
+ updatedDate?: Date;
28
+ /**
29
+ * Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision.
30
+ * @readonly
31
+ */
32
+ revision?: string | null;
33
+ /**
34
+ * Identification of submission creator
35
+ * @readonly
36
+ */
37
+ submitter?: Submitter;
38
+ /** Flag identifying if submission was read by user */
39
+ seen?: boolean;
40
+ }
41
+ export declare enum SubmissionStatus {
42
+ UNDEFINED = "UNDEFINED",
43
+ PENDING = "PENDING",
44
+ CONFIRMED = "CONFIRMED"
45
+ }
46
+ export interface Owner extends OwnerOwnerOneOf {
47
+ /** Member ID. */
48
+ memberId?: string | null;
49
+ /** Visitor ID. */
50
+ visitorId?: string | null;
51
+ /** Service ID. */
52
+ serviceId?: string | null;
53
+ /** User ID. */
54
+ userId?: string | null;
55
+ /** External app id */
56
+ externalAppId?: string | null;
57
+ }
58
+ /** @oneof */
59
+ export interface OwnerOwnerOneOf {
60
+ /** Member ID. */
61
+ memberId?: string | null;
62
+ /** Visitor ID. */
63
+ visitorId?: string | null;
64
+ /** Service ID. */
65
+ serviceId?: string | null;
66
+ /** User ID. */
67
+ userId?: string | null;
68
+ /** External app id */
69
+ externalAppId?: string | null;
70
+ }
71
+ export interface Submitter extends SubmitterSubmitterOneOf {
72
+ /** Member ID. */
73
+ memberId?: string | null;
74
+ /** Visitor ID. */
75
+ visitorId?: string | null;
76
+ /** Service ID. */
77
+ serviceId?: string | null;
78
+ /** User ID. */
79
+ userId?: string | null;
80
+ /** External app id */
81
+ externalAppId?: string | null;
82
+ }
83
+ /** @oneof */
84
+ export interface SubmitterSubmitterOneOf {
85
+ /** Member ID. */
86
+ memberId?: string | null;
87
+ /** Visitor ID. */
88
+ visitorId?: string | null;
89
+ /** Service ID. */
90
+ serviceId?: string | null;
91
+ /** User ID. */
92
+ userId?: string | null;
93
+ /** External app id */
94
+ externalAppId?: string | null;
95
+ }
96
+ export interface DomainEvent extends DomainEventBodyOneOf {
97
+ createdEvent?: EntityCreatedEvent;
98
+ updatedEvent?: EntityUpdatedEvent;
99
+ deletedEvent?: EntityDeletedEvent;
100
+ actionEvent?: ActionEvent;
101
+ extendedFieldsUpdatedEvent?: ExtendedFieldsUpdatedEvent;
102
+ /** random GUID so clients can tell if event was already handled */
103
+ id?: string;
104
+ /**
105
+ * Assumes actions are also always typed to an entity_type
106
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
107
+ */
108
+ entityFqdn?: string;
109
+ /**
110
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
111
+ * This is although the created/updated/deleted notion is duplication of the oneof types
112
+ * Example: created/updated/deleted/started/completed/email_opened
113
+ */
114
+ slug?: string;
115
+ /**
116
+ * Assuming that all messages including Actions have id
117
+ * Example: The id of the specific order, the id of a specific campaign
118
+ */
119
+ entityId?: string;
120
+ /** The time of the event. Useful if there was a delay in dispatching */
121
+ eventTime?: Date;
122
+ /**
123
+ * A field that should be set if this event was triggered by an anonymize request.
124
+ * For example you must set it to true when sending an event as a result of a GDPR right to be forgotten request.
125
+ * NOTE: This field is not relevant for `EntityCreatedEvent` but is located here for better ergonomics of consumers.
126
+ */
127
+ triggeredByAnonymizeRequest?: boolean | null;
128
+ /** If present, indicates the action that triggered the event. */
129
+ originatedFrom?: string | null;
130
+ /**
131
+ * A sequence number defining the order of updates to the underlying entity.
132
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
133
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
134
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
135
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
136
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
137
+ */
138
+ entityEventSequence?: string | null;
139
+ }
140
+ /** @oneof */
141
+ export interface DomainEventBodyOneOf {
142
+ createdEvent?: EntityCreatedEvent;
143
+ updatedEvent?: EntityUpdatedEvent;
144
+ deletedEvent?: EntityDeletedEvent;
145
+ actionEvent?: ActionEvent;
146
+ extendedFieldsUpdatedEvent?: ExtendedFieldsUpdatedEvent;
147
+ }
148
+ export interface EntityCreatedEvent {
149
+ entityAsJson?: string;
150
+ }
151
+ export interface EntityUpdatedEvent {
152
+ /**
153
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
154
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
155
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
156
+ */
157
+ currentEntityAsJson?: string;
158
+ }
159
+ export interface EntityDeletedEvent {
160
+ }
161
+ export interface ActionEvent {
162
+ bodyAsJson?: string;
163
+ }
164
+ export interface ExtendedFieldsUpdatedEvent {
165
+ currentEntityAsJson?: string;
166
+ }
167
+ export interface Empty {
168
+ }
169
+ export interface UpsertContactFromSubmissionRequest {
170
+ /** Submission from which contact needs to be upserted. */
171
+ submissionId?: string;
172
+ /** Optional contact id to which submission should be mapped. */
173
+ contactId?: string | null;
174
+ /** Indicates contact has verified primary email. */
175
+ emailVerified?: boolean;
176
+ }
177
+ export interface UpsertContactFromSubmissionResponse {
178
+ /** Submit contact response. */
179
+ submitContactResponse?: SubmitContactResponse;
180
+ }
181
+ export interface SubmitContactResponse {
182
+ /** ID of the contact that was found or created. */
183
+ contactId?: string;
184
+ /**
185
+ * Identity type of the returned contact.
186
+ *
187
+ * - `CONTACT`: The returned contact ID belongs to a new or existing contact.
188
+ * - `MEMBER`: The returned contact ID belongs to the currently logged-in site member.
189
+ * - `NOT_AUTHENTICATED_MEMBER`: The returned contact ID belongs to a site member who is not currently logged in.
190
+ */
191
+ identityType?: IdentityType;
192
+ /**
193
+ * Indicates whether the contact was just created or already existed.
194
+ *
195
+ * If the contact was just created, returns `true`.
196
+ * If it already existed, returns `false`.
197
+ */
198
+ newContact?: boolean;
199
+ }
200
+ export declare enum IdentityType {
201
+ UNKNOWN = "UNKNOWN",
202
+ /** Existing or new contact */
203
+ CONTACT = "CONTACT",
204
+ /** Member is logged in, matching logic skipped */
205
+ MEMBER = "MEMBER",
206
+ /** Matching contact is a member, Merge logic won't be applied */
207
+ NOT_AUTHENTICATED_MEMBER = "NOT_AUTHENTICATED_MEMBER"
208
+ }
209
+ export interface SubmissionContactMapped {
210
+ /**
211
+ * Mapped upserted contact ID.
212
+ * @readonly
213
+ */
214
+ contactId?: string;
215
+ /**
216
+ * Mapped contact emails.
217
+ * @readonly
218
+ */
219
+ emails?: string[];
220
+ /** Identifies the namespace that the submission's form belongs to. */
221
+ namespace?: string;
222
+ }
223
+ export interface CreateSubmissionRequest {
224
+ /** Submission to be created. */
225
+ submission: FormSubmission;
226
+ /** Captcha token */
227
+ captchaToken?: string | null;
228
+ }
229
+ export interface CreateSubmissionResponse {
230
+ /** The created submission. */
231
+ submission?: FormSubmission;
232
+ }
233
+ export interface CreateSubmissionByOwnerRequest {
234
+ /** Submission to be created. */
235
+ submission?: FormSubmission;
236
+ }
237
+ export interface CreateSubmissionByOwnerResponse {
238
+ /** The created submission. */
239
+ submission?: FormSubmission;
240
+ }
241
+ export interface GetSubmissionRequest {
242
+ /** Id of the submission to retrieve. */
243
+ submissionId: string;
244
+ }
245
+ export interface GetSubmissionResponse {
246
+ /** The retrieved submission. */
247
+ submission?: FormSubmission;
248
+ }
249
+ export interface UpdateSubmissionRequest {
250
+ /** Submission to be updated, may be partial. */
251
+ submission: FormSubmission;
252
+ }
253
+ export interface UpdateSubmissionResponse {
254
+ /** The updated submission. */
255
+ submission?: FormSubmission;
256
+ }
257
+ export interface ConfirmSubmissionRequest {
258
+ /** Submission id. */
259
+ submissionId: string;
260
+ }
261
+ export interface ConfirmSubmissionResponse {
262
+ /** Confirmed submission. */
263
+ submission?: FormSubmission;
264
+ }
265
+ export interface DeleteSubmissionRequest {
266
+ /** Id of the submission to delete. */
267
+ submissionId: string;
268
+ }
269
+ export interface DeleteSubmissionResponse {
270
+ }
271
+ export interface QuerySubmissionRequest {
272
+ /** WQL expression. */
273
+ query: CursorQuery;
274
+ /** Return only own submissions. */
275
+ onlyYourOwn?: boolean;
276
+ }
277
+ export interface CursorQuery extends CursorQueryPagingMethodOneOf {
278
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
279
+ cursorPaging?: CursorPaging;
280
+ /**
281
+ * Filter object in the following format:
282
+ * `"filter" : {
283
+ * "fieldName1": "value1",
284
+ * "fieldName2":{"$operator":"value2"}
285
+ * }`
286
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
287
+ */
288
+ filter?: Record<string, any> | null;
289
+ /**
290
+ * Sort object in the following format:
291
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
292
+ */
293
+ sort?: Sorting[];
294
+ }
295
+ /** @oneof */
296
+ export interface CursorQueryPagingMethodOneOf {
297
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
298
+ cursorPaging?: CursorPaging;
299
+ }
300
+ export interface Sorting {
301
+ /** Name of the field to sort by. */
302
+ fieldName?: string;
303
+ /** Sort order. */
304
+ order?: SortOrder;
305
+ }
306
+ export declare enum SortOrder {
307
+ ASC = "ASC",
308
+ DESC = "DESC"
309
+ }
310
+ export interface CursorPaging {
311
+ /** Number of items to load. */
312
+ limit?: number | null;
313
+ /**
314
+ * Pointer to the next or previous page in the list of results.
315
+ *
316
+ * You can get the relevant cursor token
317
+ * from the `pagingMetadata` object in the previous call's response.
318
+ * Not relevant for the first request.
319
+ */
320
+ cursor?: string | null;
321
+ }
322
+ export interface QuerySubmissionResponse {
323
+ /** The retrieved Submissions. */
324
+ submissions?: FormSubmission[];
325
+ /** Paging metadata. */
326
+ metadata?: CursorPagingMetadata;
327
+ }
328
+ export interface CursorPagingMetadata {
329
+ /** Number of items returned in the response. */
330
+ count?: number | null;
331
+ /** Offset that was requested. */
332
+ cursors?: Cursors;
333
+ /**
334
+ * Indicates if there are more results after the current page.
335
+ * If `true`, another page of results can be retrieved.
336
+ * If `false`, this is the last page.
337
+ */
338
+ hasNext?: boolean | null;
339
+ }
340
+ export interface Cursors {
341
+ /** Cursor pointing to next page in the list of results. */
342
+ next?: string | null;
343
+ /** Cursor pointing to previous page in the list of results. */
344
+ prev?: string | null;
345
+ }
346
+ export interface CountSubmissionsRequest {
347
+ /** Form IDs. */
348
+ formIds: string[];
349
+ /** Identifies the namespace that the forms belong to. */
350
+ namespace: string;
351
+ }
352
+ export interface CountSubmissionsResponse {
353
+ /** Forms submissions count. */
354
+ formsSubmissionsCount?: FormSubmissionsCount[];
355
+ }
356
+ export interface FormSubmissionsCount {
357
+ /** Form ID. */
358
+ formId?: string;
359
+ /** Total form submissions count. */
360
+ totalCount?: number;
361
+ /** Unseen form submissions count. */
362
+ unseenCount?: number;
363
+ }
364
+ export interface GetMediaUploadURLRequest {
365
+ /** Form id. */
366
+ formId: string;
367
+ /** Name of file to upload. */
368
+ filename: string;
369
+ /** Mime type of file to upload. */
370
+ mimeType: string;
371
+ }
372
+ export interface GetMediaUploadURLResponse {
373
+ /** Url to upload file. */
374
+ uploadUrl?: string;
375
+ }
376
+ export interface BulkMarkSubmissionsAsSeenRequest {
377
+ /** Submission ids to mark as seen. */
378
+ ids: string[];
379
+ /** Submissions form id. */
380
+ formId: string;
381
+ }
382
+ export interface BulkMarkSubmissionsAsSeenResponse {
383
+ }
384
+ export interface Task {
385
+ key?: TaskKey;
386
+ executeAt?: Date;
387
+ payload?: string | null;
388
+ }
389
+ export interface TaskKey {
390
+ appId?: string;
391
+ instanceId?: string;
392
+ subjectId?: string | null;
393
+ }
394
+ export interface TaskAction extends TaskActionActionOneOf {
395
+ complete?: Complete;
396
+ cancel?: Cancel;
397
+ reschedule?: Reschedule;
398
+ }
399
+ /** @oneof */
400
+ export interface TaskActionActionOneOf {
401
+ complete?: Complete;
402
+ cancel?: Cancel;
403
+ reschedule?: Reschedule;
404
+ }
405
+ export interface Complete {
406
+ }
407
+ export interface Cancel {
408
+ }
409
+ export interface Reschedule {
410
+ executeAt?: Date;
411
+ payload?: string | null;
412
+ }
@@ -0,0 +1,22 @@
1
+ export var SubmissionStatus;
2
+ (function (SubmissionStatus) {
3
+ SubmissionStatus["UNDEFINED"] = "UNDEFINED";
4
+ SubmissionStatus["PENDING"] = "PENDING";
5
+ SubmissionStatus["CONFIRMED"] = "CONFIRMED";
6
+ })(SubmissionStatus || (SubmissionStatus = {}));
7
+ export var IdentityType;
8
+ (function (IdentityType) {
9
+ IdentityType["UNKNOWN"] = "UNKNOWN";
10
+ /** Existing or new contact */
11
+ IdentityType["CONTACT"] = "CONTACT";
12
+ /** Member is logged in, matching logic skipped */
13
+ IdentityType["MEMBER"] = "MEMBER";
14
+ /** Matching contact is a member, Merge logic won't be applied */
15
+ IdentityType["NOT_AUTHENTICATED_MEMBER"] = "NOT_AUTHENTICATED_MEMBER";
16
+ })(IdentityType || (IdentityType = {}));
17
+ export var SortOrder;
18
+ (function (SortOrder) {
19
+ SortOrder["ASC"] = "ASC";
20
+ SortOrder["DESC"] = "DESC";
21
+ })(SortOrder || (SortOrder = {}));
22
+ //# sourceMappingURL=forms-v4-submission.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-v4-submission.types.js","sourceRoot":"","sources":["../../../src/forms-v4-submission.types.ts"],"names":[],"mappings":"AAyCA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,2CAAuB,CAAA;AACzB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAyKD,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,8BAA8B;IAC9B,mCAAmB,CAAA;IACnB,kDAAkD;IAClD,iCAAiB,CAAA;IACjB,iEAAiE;IACjE,qEAAqD,CAAA;AACvD,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB;AAmHD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}