@23blocks/block-forms 4.0.0 → 5.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 (66) hide show
  1. package/CHANGELOG.md +352 -0
  2. package/README.md +107 -138
  3. package/dist/index.esm.js +494 -165
  4. package/dist/src/lib/mappers/appointment.mapper.d.ts.map +1 -1
  5. package/dist/src/lib/mappers/form-instance.mapper.d.ts.map +1 -1
  6. package/dist/src/lib/mappers/form-schema.mapper.d.ts.map +1 -1
  7. package/dist/src/lib/mappers/form-set.mapper.d.ts.map +1 -1
  8. package/dist/src/lib/mappers/form.mapper.d.ts.map +1 -1
  9. package/dist/src/lib/mappers/landing.mapper.d.ts.map +1 -1
  10. package/dist/src/lib/mappers/mail-template.mapper.d.ts.map +1 -1
  11. package/dist/src/lib/mappers/referral.mapper.d.ts.map +1 -1
  12. package/dist/src/lib/mappers/subscription.mapper.d.ts.map +1 -1
  13. package/dist/src/lib/mappers/survey.mapper.d.ts.map +1 -1
  14. package/dist/src/lib/services/application-forms.service.d.ts +0 -39
  15. package/dist/src/lib/services/application-forms.service.d.ts.map +1 -1
  16. package/dist/src/lib/services/appointments.service.d.ts +0 -53
  17. package/dist/src/lib/services/appointments.service.d.ts.map +1 -1
  18. package/dist/src/lib/services/crm-sync.service.d.ts +2 -34
  19. package/dist/src/lib/services/crm-sync.service.d.ts.map +1 -1
  20. package/dist/src/lib/services/form-instances.service.d.ts +0 -55
  21. package/dist/src/lib/services/form-instances.service.d.ts.map +1 -1
  22. package/dist/src/lib/services/form-schema-versions.service.d.ts +0 -44
  23. package/dist/src/lib/services/form-schema-versions.service.d.ts.map +1 -1
  24. package/dist/src/lib/services/form-schemas.service.d.ts +0 -31
  25. package/dist/src/lib/services/form-schemas.service.d.ts.map +1 -1
  26. package/dist/src/lib/services/form-sets.service.d.ts +0 -36
  27. package/dist/src/lib/services/form-sets.service.d.ts.map +1 -1
  28. package/dist/src/lib/services/forms.service.d.ts +0 -26
  29. package/dist/src/lib/services/forms.service.d.ts.map +1 -1
  30. package/dist/src/lib/services/landings.service.d.ts +0 -31
  31. package/dist/src/lib/services/landings.service.d.ts.map +1 -1
  32. package/dist/src/lib/services/mail-templates.service.d.ts +0 -31
  33. package/dist/src/lib/services/mail-templates.service.d.ts.map +1 -1
  34. package/dist/src/lib/services/referrals.service.d.ts +0 -31
  35. package/dist/src/lib/services/referrals.service.d.ts.map +1 -1
  36. package/dist/src/lib/services/subscriptions.service.d.ts +0 -31
  37. package/dist/src/lib/services/subscriptions.service.d.ts.map +1 -1
  38. package/dist/src/lib/services/surveys.service.d.ts +0 -58
  39. package/dist/src/lib/services/surveys.service.d.ts.map +1 -1
  40. package/dist/src/lib/types/application-form.d.ts +0 -21
  41. package/dist/src/lib/types/application-form.d.ts.map +1 -1
  42. package/dist/src/lib/types/appointment.d.ts +68 -18
  43. package/dist/src/lib/types/appointment.d.ts.map +1 -1
  44. package/dist/src/lib/types/crm-sync.d.ts +5 -4
  45. package/dist/src/lib/types/crm-sync.d.ts.map +1 -1
  46. package/dist/src/lib/types/form-instance.d.ts +22 -20
  47. package/dist/src/lib/types/form-instance.d.ts.map +1 -1
  48. package/dist/src/lib/types/form-schema-version.d.ts +6 -6
  49. package/dist/src/lib/types/form-schema-version.d.ts.map +1 -1
  50. package/dist/src/lib/types/form-schema.d.ts +6 -11
  51. package/dist/src/lib/types/form-schema.d.ts.map +1 -1
  52. package/dist/src/lib/types/form-set.d.ts +45 -19
  53. package/dist/src/lib/types/form-set.d.ts.map +1 -1
  54. package/dist/src/lib/types/form.d.ts +60 -2
  55. package/dist/src/lib/types/form.d.ts.map +1 -1
  56. package/dist/src/lib/types/landing.d.ts +45 -11
  57. package/dist/src/lib/types/landing.d.ts.map +1 -1
  58. package/dist/src/lib/types/mail-template.d.ts +45 -21
  59. package/dist/src/lib/types/mail-template.d.ts.map +1 -1
  60. package/dist/src/lib/types/referral.d.ts +61 -21
  61. package/dist/src/lib/types/referral.d.ts.map +1 -1
  62. package/dist/src/lib/types/subscription.d.ts +39 -8
  63. package/dist/src/lib/types/subscription.d.ts.map +1 -1
  64. package/dist/src/lib/types/survey.d.ts +42 -6
  65. package/dist/src/lib/types/survey.d.ts.map +1 -1
  66. package/package.json +3 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,352 @@
1
+ # 5.0.0 (2026-02-20)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - ⚠️ **@23blocks/block-forms:** align all types, services and mappers with API strong params ([31ead5f](https://github.com/23blocks-OS/frontend-sdk/commit/31ead5f))
6
+
7
+ ### ⚠️ Breaking Changes
8
+
9
+ - **@23blocks/block-forms:** align all types, services and mappers with API strong params ([31ead5f](https://github.com/23blocks-OS/frontend-sdk/commit/31ead5f))
10
+ Complete rewrite of forms block to match actual Rails API.
11
+ Root keys fixed: landing_instance→landing, survey_instance→survey,
12
+ mail_template→template, form_submission→responses, report→query_params.
13
+ Field renames: phone→phoneNumber, scheduledAt→startAt, schema→formFields,
14
+ uiSchema→datasource, subject→fromSubject, htmlContent→templateHtml,
15
+ textContent→templateText, providerTemplateId→templateName, fromEmail→fromAddress.
16
+ Removed invented fields: FormReference, SubmitFormInstanceRequest,
17
+ referrerEmail, refereeName, refereePhone, data (on instances), enabled (on Form).
18
+ Added 80+ missing fields across all services including source tracking,
19
+ visitor attribution, assigned-to fields, form configuration options,
20
+ and CRM sync batch parameters.
21
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22
+
23
+ ### ❤️ Thank You
24
+
25
+ - Claude Opus 4.6
26
+ - Juan Pelaez
27
+
28
+ # 4.0.0 (2026-02-20)
29
+
30
+ ### 🩹 Fixes
31
+
32
+ - ⚠️ replace appId with apiKey across all block configs to align with BlockConfig contract ([f81626d](https://github.com/23blocks-OS/frontend-sdk/commit/f81626d))
33
+ - resolve typecheck errors across all block packages ([6089324](https://github.com/23blocks-OS/frontend-sdk/commit/6089324))
34
+
35
+ ### ⚠️ Breaking Changes
36
+
37
+ - replace appId with apiKey across all block configs to align with BlockConfig contract ([f81626d](https://github.com/23blocks-OS/frontend-sdk/commit/f81626d))
38
+ Block config no longer accepts appId. Use apiKey instead.
39
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40
+
41
+ ### 🧱 Updated Dependencies
42
+
43
+ - Updated @23blocks/jsonapi-codec to 3.3.1
44
+ - Updated @23blocks/contracts to 2.3.1
45
+
46
+ ### ❤️ Thank You
47
+
48
+ - Claude Opus 4.6
49
+ - Juan Pelaez
50
+
51
+ ## 3.3.0 (2026-02-17)
52
+
53
+ ### 🚀 Features
54
+
55
+ - add health() method to all 18 blocks for service connectivity checks ([73514a3](https://github.com/23blocks-OS/frontend-sdk/commit/73514a3))
56
+
57
+ ### 🧱 Updated Dependencies
58
+
59
+ - Updated @23blocks/jsonapi-codec to 3.3.0
60
+ - Updated @23blocks/contracts to 2.3.0
61
+
62
+ ### ❤️ Thank You
63
+
64
+ - Claude Opus 4.6
65
+ - Juan Pelaez
66
+
67
+ ## 3.2.0 (2026-02-08)
68
+
69
+ ### 🚀 Features
70
+
71
+ - add comprehensive JSDoc documentation and llms.txt for AI agent consumption ([fd97df2](https://github.com/23blocks-OS/frontend-sdk/commit/fd97df2))
72
+
73
+ ### 🧱 Updated Dependencies
74
+
75
+ - Updated @23blocks/jsonapi-codec to 3.2.0
76
+ - Updated @23blocks/contracts to 2.2.0
77
+
78
+ ### ❤️ Thank You
79
+
80
+ - Claude Opus 4.6
81
+ - Juan Pelaez
82
+
83
+ ## 3.1.9 (2026-02-07)
84
+
85
+ ### 🧱 Updated Dependencies
86
+
87
+ - Updated @23blocks/jsonapi-codec to 3.1.3
88
+ - Updated @23blocks/contracts to 2.1.3
89
+
90
+ ## 3.1.8 (2026-02-06)
91
+
92
+ ### 🧱 Updated Dependencies
93
+
94
+ - Updated @23blocks/jsonapi-codec to 3.1.2
95
+ - Updated @23blocks/contracts to 2.1.2
96
+
97
+ ## 3.1.7 (2026-01-20)
98
+
99
+ ### 🩹 Fixes
100
+
101
+ - resolve TypeScript errors and add PostTemplate validation support ([250d284](https://github.com/23blocks-OS/frontend-sdk/commit/250d284))
102
+
103
+ ### 🧱 Updated Dependencies
104
+
105
+ - Updated @23blocks/jsonapi-codec to 3.1.1
106
+ - Updated @23blocks/contracts to 2.1.1
107
+
108
+ ### ❤️ Thank You
109
+
110
+ - Claude Opus 4.5
111
+ - Juan Pelaez
112
+
113
+ ## 3.1.6 (2026-01-16)
114
+
115
+ ### 🩹 Fixes
116
+
117
+ - **mappers:** remove dangerous uniqueId fallback to resource.id ([e96c555](https://github.com/23blocks-OS/frontend-sdk/commit/e96c555))
118
+
119
+ ### ❤️ Thank You
120
+
121
+ - Claude Opus 4.5
122
+ - Juan Pelaez
123
+
124
+ ## 3.1.5 (2026-01-13)
125
+
126
+ ### 🚀 Features
127
+
128
+ - **forms,crm:** add OTP verification for public forms and document expiration tracking ([426b87d](https://github.com/23blocks-OS/frontend-sdk/commit/426b87d))
129
+
130
+ ### ❤️ Thank You
131
+
132
+ - Claude Opus 4.5
133
+ - Juan Pelaez
134
+
135
+ ## 3.1.4 (2026-01-05)
136
+
137
+ ### 🩹 Fixes
138
+
139
+ - **forms:** rename create to submit for landing and subscription forms ([7c7126f](https://github.com/23blocks-OS/frontend-sdk/commit/7c7126f))
140
+
141
+ ### ❤️ Thank You
142
+
143
+ - Claude Opus 4.5
144
+ - Juan Pelaez
145
+
146
+ ## 3.1.3 (2026-01-05)
147
+
148
+ ### 🚀 Features
149
+
150
+ - ⚠️ **forms:** rename publicForms to applicationForms ([0c5cad6](https://github.com/23blocks-OS/frontend-sdk/commit/0c5cad6))
151
+
152
+ ### ⚠️ Breaking Changes
153
+
154
+ - **forms:** rename publicForms to applicationForms ([0c5cad6](https://github.com/23blocks-OS/frontend-sdk/commit/0c5cad6))
155
+ publicForms renamed to applicationForms
156
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
157
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
158
+
159
+ ### ❤️ Thank You
160
+
161
+ - Claude Opus 4.5
162
+ - Juan Pelaez
163
+
164
+ ## 3.1.2 (2026-01-04)
165
+
166
+ ### 🩹 Fixes
167
+
168
+ - **block-forms:** export all types, services, and mappers ([d43b143](https://github.com/23blocks-OS/frontend-sdk/commit/d43b143))
169
+
170
+ ### ❤️ Thank You
171
+
172
+ - Claude Opus 4.5
173
+ - Juan Pelaez
174
+
175
+ ## 3.1.1 (2026-01-04)
176
+
177
+ ### 🚀 Features
178
+
179
+ - ⚠️ **block-forms:** complete Forms API with all missing endpoints ([93bd809](https://github.com/23blocks-OS/frontend-sdk/commit/93bd809))
180
+
181
+ ### ⚠️ Breaking Changes
182
+
183
+ - **block-forms:** complete Forms API with all missing endpoints ([93bd809](https://github.com/23blocks-OS/frontend-sdk/commit/93bd809))
184
+ FormInstancesService and FormSchemasService now use
185
+ nested routes requiring formUniqueId as first parameter
186
+ New services:
187
+ - FormSchemaVersionsService: full CRUD + publish for schema versions
188
+ - CrmSyncService: CRM sync operations (sync, batch, retry, status)
189
+ Updated services:
190
+ - FormInstancesService: nested routes /forms/:id/instances/*
191
+ - Added: start(), submit(), cancel(), resendMagicLink()
192
+ - FormSchemasService: nested routes /forms/:id/schemas/*
193
+ - FormSetsService: Added match() and autoAssign()
194
+ All services now align with the backend API routes:
195
+ - Forms: /forms/*
196
+ - Schemas: /forms/:id/schemas/*
197
+ - Schema Versions: /forms/:id/schemas/:id/versions/*
198
+ - Instances: /forms/:id/instances/*
199
+ - Form Sets: /form_sets/* (with match/auto_assign)
200
+ - CRM Sync: /crm/*
201
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
202
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
203
+
204
+ ### ❤️ Thank You
205
+
206
+ - Claude Opus 4.5
207
+ - Juan Pelaez
208
+
209
+ ## 3.1.0 (2026-01-01)
210
+
211
+ ### 🧱 Updated Dependencies
212
+
213
+ - Updated @23blocks/jsonapi-codec to 3.1.0
214
+ - Updated @23blocks/contracts to 2.1.0
215
+
216
+ ## 3.0.2 (2025-12-31)
217
+
218
+ ### 🩹 Fixes
219
+
220
+ - replace PATCH with PUT across all services ([6339334](https://github.com/23blocks-OS/frontend-sdk/commit/6339334))
221
+
222
+ ### ❤️ Thank You
223
+
224
+ - Claude Opus 4.5
225
+ - Juan Pelaez
226
+
227
+ ## 3.0.1 (2025-12-17)
228
+
229
+ ### 🧱 Updated Dependencies
230
+
231
+ - Updated @23blocks/jsonapi-codec to 3.0.1
232
+ - Updated @23blocks/contracts to 2.0.1
233
+
234
+ # 3.0.0 (2025-12-17)
235
+
236
+ ### 🧱 Updated Dependencies
237
+
238
+ - Updated @23blocks/jsonapi-codec to 3.0.0
239
+ - Updated @23blocks/contracts to 2.0.0
240
+
241
+ ## 2.1.0 (2025-12-15)
242
+
243
+ ### 🚀 Features
244
+
245
+ - expand SDK API coverage for Content, Files, Forms, Geolocation blocks ([8e5c709](https://github.com/23blocks-OS/frontend-sdk/commit/8e5c709))
246
+
247
+ ### ❤️ Thank You
248
+
249
+ - Claude Opus 4.5
250
+ - Juan Pelaez
251
+
252
+ # 2.0.0 (2025-12-15)
253
+
254
+ ### 🩹 Fixes
255
+
256
+ - ⚠️ wrap all API request parameters with correct Rails object keys ([192ad70](https://github.com/23blocks-OS/frontend-sdk/commit/192ad70))
257
+
258
+ ### ⚠️ Breaking Changes
259
+
260
+ - wrap all API request parameters with correct Rails object keys ([192ad70](https://github.com/23blocks-OS/frontend-sdk/commit/192ad70))
261
+ All service methods now correctly wrap request bodies
262
+ with Rails-expected parameter keys (e.g., `user:`, `contact:`, `order:`).
263
+ This fixes the critical issue where API requests were failing validation
264
+ because parameters were sent flat instead of wrapped.
265
+ Affected blocks:
266
+ - block-authentication: auth, users, guests, apps, subscriptions, api-keys, roles
267
+ - block-crm: contacts, accounts, leads, opportunities, meetings, quotes
268
+ - block-company: companies, departments, teams, team-members, quarters
269
+ - block-content: posts, comments, categories, tags
270
+ - block-products: products, cart, catalog
271
+ - block-sales: orders, order-details, payments, subscriptions
272
+ - block-conversations: messages, groups, draft-messages, notifications
273
+ - block-wallet: wallets, authorization-codes
274
+ - block-files: storage-files, entity-files, file-schemas
275
+ - block-forms: forms, form-schemas, form-sets, form-instances
276
+ - block-assets: assets, asset-events, asset-audits
277
+ - block-campaigns: campaigns, campaign-media, audiences, landing-pages
278
+ - block-geolocation: locations, addresses, areas, regions, routes, bookings, premises
279
+ - block-rewards: rewards, coupons, loyalty, badges
280
+ - block-onboarding: onboardings, flows, user-journeys, user-identities
281
+ - block-university: courses, lessons, enrollments, assignments, submissions
282
+ - block-jarvis: agents, prompts, workflows, conversations
283
+ Consumer API remains unchanged - this is an internal fix.
284
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
285
+ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
286
+
287
+ ### 🧱 Updated Dependencies
288
+
289
+ - Updated @23blocks/jsonapi-codec to 2.0.0
290
+
291
+ ### ❤️ Thank You
292
+
293
+ - Claude Opus 4.5
294
+ - Juan Pelaez
295
+
296
+ ## 1.0.4 (2025-12-14)
297
+
298
+ ### 🧱 Updated Dependencies
299
+
300
+ - Updated @23blocks/jsonapi-codec to 1.0.4
301
+ - Updated @23blocks/contracts to 1.0.4
302
+
303
+ ## 1.0.3 (2025-12-14)
304
+
305
+ ### 🧱 Updated Dependencies
306
+
307
+ - Updated @23blocks/jsonapi-codec to 1.0.3
308
+ - Updated @23blocks/contracts to 1.0.3
309
+
310
+ ## 1.0.2 (2025-12-14)
311
+
312
+ ### 🧱 Updated Dependencies
313
+
314
+ - Updated @23blocks/jsonapi-codec to 1.0.2
315
+ - Updated @23blocks/contracts to 1.0.2
316
+
317
+ ## 1.0.1 (2025-12-14)
318
+
319
+ ### 🧱 Updated Dependencies
320
+
321
+ - Updated @23blocks/jsonapi-codec to 1.0.1
322
+ - Updated @23blocks/contracts to 1.0.1
323
+
324
+ # 1.0.0 (2025-12-13)
325
+
326
+ ### 🧱 Updated Dependencies
327
+
328
+ - Updated @23blocks/jsonapi-codec to 1.0.0
329
+ - Updated @23blocks/contracts to 1.0.0
330
+
331
+ ## 0.2.1 (2025-12-13)
332
+
333
+ ### 🧱 Updated Dependencies
334
+
335
+ - Updated @23blocks/jsonapi-codec to 0.1.2
336
+ - Updated @23blocks/contracts to 0.1.2
337
+
338
+ ## 0.2.0 (2025-12-13)
339
+
340
+ ### 🚀 Features
341
+
342
+ - add all block packages with React and Angular bindings ([bbeecf7](https://github.com/23blocks-OS/frontend-sdk/commit/bbeecf7))
343
+
344
+ ### 🧱 Updated Dependencies
345
+
346
+ - Updated @23blocks/jsonapi-codec to 0.1.1
347
+ - Updated @23blocks/contracts to 0.1.1
348
+
349
+ ### ❤️ Thank You
350
+
351
+ - Claude Opus 4.5
352
+ - Juan Pelaez
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @23blocks/block-forms
2
2
 
3
- Forms block for the 23blocks SDK - dynamic forms, schemas, and submissions.
3
+ Forms block for the 23blocks SDK - dynamic forms, schemas, submissions, landings, surveys, appointments, subscriptions, referrals, and mail templates.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@23blocks/block-forms.svg)](https://www.npmjs.com/package/@23blocks/block-forms)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -16,9 +16,18 @@ npm install @23blocks/block-forms @23blocks/transport-http
16
16
  This package provides form building and submission functionality including:
17
17
 
18
18
  - **Forms** - Form definitions and configurations
19
- - **Form Schemas** - Field definitions and validations
20
- - **Form Instances** - Individual form submissions
21
- - **Form Sets** - Groups of related forms
19
+ - **Form Schemas** - Field definitions with datasource configuration
20
+ - **Form Schema Versions** - Published schema versions
21
+ - **Form Instances** - App form assignments with responses
22
+ - **Form Sets** - Groups of related form schemas with auto-assignment
23
+ - **Landings** - Landing page form submissions
24
+ - **Surveys** - Survey form submissions with magic link support
25
+ - **Appointments** - Appointment scheduling with location and assignment
26
+ - **Subscriptions** - Newsletter and subscription management
27
+ - **Referrals** - Referral tracking with source attribution
28
+ - **Mail Templates** - Email template configuration
29
+ - **Application Forms** - Public form submission and draft workflows
30
+ - **CRM Sync** - Synchronize form data with CRM
22
31
 
23
32
  ## Quick Start
24
33
 
@@ -41,14 +50,13 @@ const forms = createFormsBlock(transport, {
41
50
  // List forms
42
51
  const { data: formList } = await forms.forms.list();
43
52
 
44
- // Submit a form
45
- const submission = await forms.formInstances.submit({
46
- formId: 'form-id',
47
- data: {
48
- name: 'John Doe',
49
- email: 'john@example.com',
50
- message: 'Hello!',
51
- },
53
+ // Create a landing submission
54
+ await forms.landings.create({
55
+ firstName: 'John',
56
+ lastName: 'Doe',
57
+ email: 'john@example.com',
58
+ phoneNumber: '+1234567890',
59
+ message: 'Hello!',
52
60
  });
53
61
  ```
54
62
 
@@ -59,7 +67,7 @@ const submission = await forms.formInstances.submit({
59
67
  ```typescript
60
68
  // List forms
61
69
  const { data: formList } = await forms.forms.list({
62
- limit: 20,
70
+ perPage: 20,
63
71
  status: 'active',
64
72
  });
65
73
 
@@ -68,10 +76,12 @@ const form = await forms.forms.get('form-id');
68
76
 
69
77
  // Create form
70
78
  const newForm = await forms.forms.create({
79
+ code: 'contact-form',
71
80
  name: 'Contact Form',
72
81
  description: 'Contact us form',
73
- status: 'active',
74
- schemaId: 'schema-id',
82
+ formType: 'landing',
83
+ sendConfirmationMail: true,
84
+ requireOtpVerification: false,
75
85
  });
76
86
 
77
87
  // Update form
@@ -88,97 +98,51 @@ await forms.forms.delete('form-id');
88
98
 
89
99
  ```typescript
90
100
  // List schemas
91
- const { data: schemas } = await forms.formSchemas.list();
92
-
93
- // Get schema by ID
94
- const schema = await forms.formSchemas.get('schema-id');
101
+ const { data: schemas } = await forms.formSchemas.list({
102
+ formUniqueId: 'form-id',
103
+ });
95
104
 
96
105
  // Create schema
97
106
  const newSchema = await forms.formSchemas.create({
107
+ formUniqueId: 'form-id',
98
108
  name: 'Contact Schema',
99
- fields: [
100
- {
101
- name: 'name',
102
- type: 'text',
103
- label: 'Your Name',
104
- required: true,
105
- validation: { minLength: 2, maxLength: 100 },
106
- },
107
- {
108
- name: 'email',
109
- type: 'email',
110
- label: 'Email Address',
111
- required: true,
112
- },
113
- {
114
- name: 'message',
115
- type: 'textarea',
116
- label: 'Message',
117
- required: true,
118
- validation: { minLength: 10, maxLength: 1000 },
119
- },
120
- {
121
- name: 'priority',
122
- type: 'select',
123
- label: 'Priority',
124
- options: ['low', 'medium', 'high'],
125
- defaultValue: 'medium',
126
- },
127
- ],
109
+ formFields: {
110
+ fields: [
111
+ { name: 'name', type: 'text', required: true },
112
+ { name: 'email', type: 'email', required: true },
113
+ ],
114
+ },
115
+ datasource: {},
128
116
  });
129
117
 
130
118
  // Update schema
131
119
  await forms.formSchemas.update('schema-id', {
132
- fields: [
133
- // updated fields
134
- ],
120
+ formFields: { /* updated fields */ },
135
121
  });
136
-
137
- // Delete schema
138
- await forms.formSchemas.delete('schema-id');
139
122
  ```
140
123
 
141
- ### formInstances - Form Submissions
124
+ ### formInstances - App Form Instances
142
125
 
143
126
  ```typescript
144
- // List submissions
145
- const { data: submissions } = await forms.formInstances.list({
146
- formId: 'form-id',
147
- status: 'submitted',
127
+ // List instances
128
+ const { data: instances } = await forms.formInstances.list({
129
+ userUniqueId: 'user-id',
130
+ status: 'active',
148
131
  });
149
132
 
150
- // Get submission by ID
151
- const submission = await forms.formInstances.get('instance-id');
152
-
153
- // Create a draft instance
154
- const draft = await forms.formInstances.create({
155
- formId: 'form-id',
156
- data: {
157
- name: 'John',
158
- },
159
- status: 'draft',
133
+ // Create an instance (assignment)
134
+ const instance = await forms.formInstances.create('form-id', {
135
+ assignedToEmail: 'user@example.com',
136
+ assignedToName: 'John Doe',
137
+ assignedByName: 'Admin',
138
+ expiresAt: '2025-12-31',
160
139
  });
161
140
 
162
- // Update draft
141
+ // Update instance
163
142
  await forms.formInstances.update('instance-id', {
164
- data: {
165
- name: 'John Doe',
166
- email: 'john@example.com',
167
- },
168
- });
169
-
170
- // Submit form
171
- const submitted = await forms.formInstances.submit({
172
- formId: 'form-id',
173
- data: {
174
- name: 'John Doe',
175
- email: 'john@example.com',
176
- message: 'Hello, I have a question...',
177
- },
143
+ responses: [{ fieldId: 'name', value: 'John Doe' }],
144
+ status: 'completed',
178
145
  });
179
-
180
- // Delete submission
181
- await forms.formInstances.delete('instance-id');
182
146
  ```
183
147
 
184
148
  ### formSets - Form Set Management
@@ -187,30 +151,60 @@ await forms.formInstances.delete('instance-id');
187
151
  // List form sets
188
152
  const { data: sets } = await forms.formSets.list();
189
153
 
190
- // Get form set by ID
191
- const formSet = await forms.formSets.get('set-id');
192
-
193
154
  // Create form set
194
155
  const newSet = await forms.formSets.create({
156
+ code: 'onboarding',
195
157
  name: 'Onboarding Forms',
196
158
  description: 'Forms required for new user onboarding',
197
- formReferences: [
198
- { formId: 'form-1', order: 1, required: true },
199
- { formId: 'form-2', order: 2, required: false },
200
- { formId: 'form-3', order: 3, required: true },
159
+ enforceSequential: true,
160
+ expirationDays: 30,
161
+ formSetItemsAttributes: [
162
+ { formSchemaUniqueId: 'schema-1', displayOrder: 1, required: true },
163
+ { formSchemaUniqueId: 'schema-2', displayOrder: 2, required: false },
201
164
  ],
202
165
  });
203
166
 
204
- // Update form set
205
- await forms.formSets.update('set-id', {
206
- formReferences: [
207
- { formId: 'form-1', order: 1, required: true },
208
- { formId: 'form-2', order: 2, required: true },
209
- ],
167
+ // Match form set
168
+ const match = await forms.formSets.match({
169
+ userUniqueId: 'user-id',
170
+ category: 'onboarding',
210
171
  });
211
172
 
212
- // Delete form set
213
- await forms.formSets.delete('set-id');
173
+ // Auto-assign form set
174
+ await forms.formSets.autoAssign({
175
+ userUniqueId: 'user-id',
176
+ formSetUniqueId: 'set-id',
177
+ assignedByName: 'System',
178
+ });
179
+ ```
180
+
181
+ ### landings - Landing Form Submissions
182
+
183
+ ```typescript
184
+ const landing = await forms.landings.create({
185
+ firstName: 'John',
186
+ lastName: 'Doe',
187
+ email: 'john@example.com',
188
+ phoneNumber: '+1234567890',
189
+ message: 'I am interested in your product',
190
+ source: 'website',
191
+ });
192
+ ```
193
+
194
+ ### appointments - Appointment Scheduling
195
+
196
+ ```typescript
197
+ const appointment = await forms.appointments.create({
198
+ firstName: 'John',
199
+ lastName: 'Doe',
200
+ email: 'john@example.com',
201
+ phoneNumber: '+1234567890',
202
+ startAt: '2025-06-15T10:00:00Z',
203
+ endAt: '2025-06-15T11:00:00Z',
204
+ locationName: 'Main Office',
205
+ locationAddress: '123 Main St',
206
+ assignedToName: 'Dr. Smith',
207
+ });
214
208
  ```
215
209
 
216
210
  ## Types
@@ -219,57 +213,32 @@ await forms.formSets.delete('set-id');
219
213
  import type {
220
214
  Form,
221
215
  FormSchema,
216
+ FormSchemaVersion,
222
217
  FormInstance,
223
218
  FormSet,
224
- FormReference,
219
+ FormSetItem,
220
+ Landing,
221
+ Survey,
222
+ Appointment,
223
+ Subscription,
224
+ Referral,
225
+ MailTemplate,
225
226
  CreateFormRequest,
226
227
  CreateFormSchemaRequest,
227
228
  CreateFormInstanceRequest,
228
- SubmitFormInstanceRequest,
229
229
  CreateFormSetRequest,
230
230
  } from '@23blocks/block-forms';
231
231
  ```
232
232
 
233
- ### Form
234
-
235
- | Property | Type | Description |
236
- |----------|------|-------------|
237
- | `id` | `string` | Form ID |
238
- | `uniqueId` | `string` | Unique identifier |
239
- | `name` | `string` | Form name |
240
- | `description` | `string` | Form description |
241
- | `status` | `string` | active, inactive, archived |
242
- | `schemaId` | `string` | Associated schema ID |
243
- | `schema` | `FormSchema` | Schema details |
244
-
245
- ### FormSchema
246
-
247
- | Property | Type | Description |
248
- |----------|------|-------------|
249
- | `id` | `string` | Schema ID |
250
- | `name` | `string` | Schema name |
251
- | `fields` | `Field[]` | Field definitions |
252
- | `validations` | `object` | Form-level validations |
253
-
254
- ### FormInstance
255
-
256
- | Property | Type | Description |
257
- |----------|------|-------------|
258
- | `id` | `string` | Instance ID |
259
- | `formId` | `string` | Parent form ID |
260
- | `data` | `object` | Submitted data |
261
- | `status` | `string` | draft, submitted, approved, rejected |
262
- | `submittedAt` | `Date` | Submission timestamp |
263
-
264
233
  ## Error Handling
265
234
 
266
235
  ```typescript
267
236
  import { isBlockErrorException, ErrorCodes } from '@23blocks/contracts';
268
237
 
269
238
  try {
270
- await forms.formInstances.submit({
271
- formId: 'form-id',
272
- data: { name: '' }, // Invalid - name is required
239
+ await forms.landings.create({
240
+ firstName: 'John',
241
+ email: 'john@example.com',
273
242
  });
274
243
  } catch (error) {
275
244
  if (isBlockErrorException(error)) {