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