@23blocks/block-forms 3.1.4 → 3.1.5

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/dist/index.esm.js CHANGED
@@ -981,6 +981,15 @@ function createMailTemplatesService(transport, _config) {
981
981
  };
982
982
  }
983
983
 
984
+ /**
985
+ * Parse verification status from API response
986
+ */ function parseVerificationStatus(value) {
987
+ const status = parseString(value);
988
+ if (status === 'pending' || status === 'verified') {
989
+ return status;
990
+ }
991
+ return undefined;
992
+ }
984
993
  const applicationFormMapper = {
985
994
  type: 'public_form',
986
995
  map: (resource)=>{
@@ -996,10 +1005,27 @@ const applicationFormMapper = {
996
1005
  status: parseStatus(resource.attributes['status']),
997
1006
  payload: resource.attributes['payload'],
998
1007
  createdAt: parseDate(resource.attributes['created_at']),
999
- updatedAt: parseDate(resource.attributes['updated_at'])
1008
+ updatedAt: parseDate(resource.attributes['updated_at']),
1009
+ // OTP Verification fields
1010
+ verificationStatus: parseVerificationStatus(resource.attributes['verification_status']),
1011
+ assignedToName: parseString(resource.attributes['assigned_to_name']),
1012
+ maskedEmail: parseString(resource.attributes['masked_email']),
1013
+ otpSent: resource.attributes['otp_sent'] !== undefined ? parseBoolean(resource.attributes['otp_sent']) : undefined,
1014
+ formName: parseString(resource.attributes['form_name'])
1000
1015
  };
1001
1016
  }
1002
1017
  };
1018
+ /**
1019
+ * Map send-otp response (non-JSON:API format)
1020
+ */ function mapSendOtpResponse(response) {
1021
+ var _parseString, _parseString1;
1022
+ return {
1023
+ message: (_parseString = parseString(response['message'])) != null ? _parseString : '',
1024
+ maskedEmail: (_parseString1 = parseString(response['masked_email'])) != null ? _parseString1 : '',
1025
+ expiresIn: parseNumber(response['expires_in']),
1026
+ sentCount: parseNumber(response['sent_count'])
1027
+ };
1028
+ }
1003
1029
  const applicationFormResponseMapper = {
1004
1030
  type: 'form_response',
1005
1031
  map: (resource)=>{
@@ -1040,6 +1066,16 @@ function createApplicationFormsService(transport, _config) {
1040
1066
  }
1041
1067
  });
1042
1068
  return decodeOne(response, applicationFormResponseMapper);
1069
+ },
1070
+ async sendOtp (urlId) {
1071
+ const response = await transport.post(`/${urlId}/forms/public/send-otp`, {});
1072
+ return mapSendOtpResponse(response);
1073
+ },
1074
+ async verifyOtp (urlId, data) {
1075
+ const response = await transport.post(`/${urlId}/forms/public/verify-otp`, {
1076
+ code: data.code
1077
+ });
1078
+ return decodeOne(response, applicationFormMapper);
1043
1079
  }
1044
1080
  };
1045
1081
  }
@@ -1161,4 +1197,4 @@ const formsBlockMetadata = {
1161
1197
  ]
1162
1198
  };
1163
1199
 
1164
- export { applicationFormMapper, appointmentMapper, createApplicationFormsService, createAppointmentsService, createCrmSyncService, createFormInstancesService, createFormSchemaVersionsService, createFormSchemasService, createFormSetsService, createFormsBlock, createFormsService, createLandingsService, createMailTemplatesService, createReferralsService, createSubscriptionsService, createSurveysService, formInstanceMapper, formMapper, formSchemaMapper, formSchemaVersionMapper, formSetMapper, formsBlockMetadata, landingMapper, mailTemplateMapper, referralMapper, subscriptionMapper, surveyMapper };
1200
+ export { applicationFormMapper, appointmentMapper, createApplicationFormsService, createAppointmentsService, createCrmSyncService, createFormInstancesService, createFormSchemaVersionsService, createFormSchemasService, createFormSetsService, createFormsBlock, createFormsService, createLandingsService, createMailTemplatesService, createReferralsService, createSubscriptionsService, createSurveysService, formInstanceMapper, formMapper, formSchemaMapper, formSchemaVersionMapper, formSetMapper, formsBlockMetadata, landingMapper, mailTemplateMapper, mapSendOtpResponse, referralMapper, subscriptionMapper, surveyMapper };
@@ -11,9 +11,9 @@ export type { Appointment, CreateAppointmentRequest, UpdateAppointmentRequest, L
11
11
  export type { Survey, SurveyStatus, CreateSurveyRequest, UpdateSurveyRequest, UpdateSurveyStatusRequest, ListSurveysParams, } from './lib/types/survey';
12
12
  export type { Referral, CreateReferralRequest, UpdateReferralRequest, ListReferralsParams, } from './lib/types/referral';
13
13
  export type { MailTemplate, CreateMailTemplateRequest, UpdateMailTemplateRequest, ListMailTemplatesParams, } from './lib/types/mail-template';
14
- export type { ApplicationForm, ApplicationFormSubmission, ApplicationFormDraft, ApplicationFormResponse, } from './lib/types/application-form';
14
+ export type { ApplicationForm, ApplicationFormSubmission, ApplicationFormDraft, ApplicationFormResponse, VerificationStatus, SendOtpResponse, VerifyOtpRequest, OtpErrorCode, OtpError, } from './lib/types/application-form';
15
15
  export type { CrmSyncResult, CrmSyncBatchRequest, CrmSyncBatchResult, CrmConnectionStatus, CrmSyncStatus, } from './lib/types/crm-sync';
16
16
  export type { FormsService, FormSchemasService, FormSchemaVersionsService, FormInstancesService, FormSetsService, LandingsService, SubscriptionsService, AppointmentsService, SurveysService, ReferralsService, MailTemplatesService, ApplicationFormsService, CrmSyncService, } from './lib/services';
17
17
  export { createFormsService, createFormSchemasService, createFormSchemaVersionsService, createFormInstancesService, createFormSetsService, createLandingsService, createSubscriptionsService, createAppointmentsService, createSurveysService, createReferralsService, createMailTemplatesService, createApplicationFormsService, createCrmSyncService, } from './lib/services';
18
- export { formMapper, formSchemaMapper, formSchemaVersionMapper, formInstanceMapper, formSetMapper, landingMapper, subscriptionMapper, appointmentMapper, surveyMapper, referralMapper, mailTemplateMapper, applicationFormMapper, } from './lib/mappers';
18
+ export { formMapper, formSchemaMapper, formSchemaVersionMapper, formInstanceMapper, formSetMapper, landingMapper, subscriptionMapper, appointmentMapper, surveyMapper, referralMapper, mailTemplateMapper, applicationFormMapper, mapSendOtpResponse, } from './lib/mappers';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOtE,YAAY,EACV,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,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,mBAAmB,EACnB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAM9B,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,+BAA+B,EAC/B,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOtE,YAAY,EACV,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,E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B,EACvB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,+BAA+B,EAC/B,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
@@ -1,5 +1,9 @@
1
1
  import type { ResourceMapper } from '@23blocks/jsonapi-codec';
2
- import type { ApplicationForm, ApplicationFormResponse } from '../types/application-form';
2
+ import type { ApplicationForm, ApplicationFormResponse, SendOtpResponse } from '../types/application-form';
3
3
  export declare const applicationFormMapper: ResourceMapper<ApplicationForm>;
4
+ /**
5
+ * Map send-otp response (non-JSON:API format)
6
+ */
7
+ export declare function mapSendOtpResponse(response: Record<string, unknown>): SendOtpResponse;
4
8
  export declare const applicationFormResponseMapper: ResourceMapper<ApplicationFormResponse>;
5
9
  //# sourceMappingURL=application-form.mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-form.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/application-form.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,eAAe,CAejE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC,uBAAuB,CAYjF,CAAC"}
1
+ {"version":3,"file":"application-form.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/application-form.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAsB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAc/H,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,eAAe,CAuBjE,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAOrF;AAED,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC,uBAAuB,CAYjF,CAAC"}
@@ -9,6 +9,6 @@ export * from './appointment.mapper';
9
9
  export * from './survey.mapper';
10
10
  export * from './referral.mapper';
11
11
  export * from './mail-template.mapper';
12
- export * from './application-form.mapper';
12
+ export { applicationFormMapper, applicationFormResponseMapper, mapSendOtpResponse } from './application-form.mapper';
13
13
  export * from './utils';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACrH,cAAc,SAAS,CAAC"}
@@ -1,9 +1,37 @@
1
1
  import type { Transport } from '@23blocks/contracts';
2
- import type { ApplicationForm, ApplicationFormSubmission, ApplicationFormDraft, ApplicationFormResponse } from '../types/application-form';
2
+ import type { ApplicationForm, ApplicationFormSubmission, ApplicationFormDraft, ApplicationFormResponse, SendOtpResponse, VerifyOtpRequest } from '../types/application-form';
3
3
  export interface ApplicationFormsService {
4
+ /**
5
+ * Get public form via magic link
6
+ * If OTP verification is required, returns form with verificationStatus: 'pending'
7
+ * and limited fields (no schema/uiSchema until verified)
8
+ */
4
9
  get(urlId: string): Promise<ApplicationForm>;
10
+ /**
11
+ * Submit a completed form
12
+ * Requires OTP verification if form has OTP enabled
13
+ */
5
14
  submit(urlId: string, data: ApplicationFormSubmission): Promise<ApplicationFormResponse>;
15
+ /**
16
+ * Save form as draft
17
+ * Requires OTP verification if form has OTP enabled
18
+ */
6
19
  draft(urlId: string, data: ApplicationFormDraft): Promise<ApplicationFormResponse>;
20
+ /**
21
+ * Send OTP verification code to user's email
22
+ * @throws Error with code RATE_LIMITED if called too frequently (60s cooldown)
23
+ * @throws Error with code ALREADY_VERIFIED if form is already verified
24
+ * @throws Error with code OTP_NOT_REQUIRED if form doesn't require OTP
25
+ */
26
+ sendOtp(urlId: string): Promise<SendOtpResponse>;
27
+ /**
28
+ * Verify OTP code and get full form access
29
+ * On success, returns full form with schema and fields
30
+ * @throws Error with code INVALID_CODE if code is wrong (includes attemptsRemaining)
31
+ * @throws Error with code CODE_EXPIRED if code has expired (10 min lifetime)
32
+ * @throws Error with code ATTEMPTS_EXCEEDED if max attempts (5) reached
33
+ */
34
+ verifyOtp(urlId: string, data: VerifyOtpRequest): Promise<ApplicationForm>;
7
35
  }
8
36
  export declare function createApplicationFormsService(transport: Transport, _config: {
9
37
  appId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"application-forms.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/application-forms.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzF,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACpF;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,CA2BvH"}
1
+ {"version":3,"file":"application-forms.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/application-forms.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7C;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEzF;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,CAuCvH"}
@@ -1,4 +1,12 @@
1
1
  import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ /**
3
+ * Verification status for OTP-protected forms
4
+ */
5
+ export type VerificationStatus = 'pending' | 'verified';
6
+ /**
7
+ * Application form retrieved via magic link (public access)
8
+ * When OTP verification is required but not completed, only verification-related fields are populated.
9
+ */
2
10
  export interface ApplicationForm extends IdentityCore {
3
11
  formUniqueId: string;
4
12
  title?: string;
@@ -8,6 +16,16 @@ export interface ApplicationForm extends IdentityCore {
8
16
  settings?: Record<string, unknown>;
9
17
  status: EntityStatus;
10
18
  payload?: Record<string, unknown>;
19
+ /** Current verification status - 'pending' requires OTP, 'verified' means full access */
20
+ verificationStatus?: VerificationStatus;
21
+ /** Name of the user assigned to fill the form (visible even when pending) */
22
+ assignedToName?: string;
23
+ /** Masked email address for display (e.g., "j***e@e***e.com") */
24
+ maskedEmail?: string;
25
+ /** Whether an OTP has already been sent */
26
+ otpSent?: boolean;
27
+ /** Form name for display during verification */
28
+ formName?: string;
11
29
  }
12
30
  export interface ApplicationFormSubmission {
13
31
  data: Record<string, unknown>;
@@ -24,4 +42,34 @@ export interface ApplicationFormResponse extends IdentityCore {
24
42
  submittedAt?: Date;
25
43
  payload?: Record<string, unknown>;
26
44
  }
45
+ /**
46
+ * Response from sending an OTP code
47
+ */
48
+ export interface SendOtpResponse {
49
+ message: string;
50
+ maskedEmail: string;
51
+ expiresIn: number;
52
+ sentCount: number;
53
+ }
54
+ /**
55
+ * Request to verify an OTP code
56
+ */
57
+ export interface VerifyOtpRequest {
58
+ code: string;
59
+ }
60
+ /**
61
+ * OTP error codes returned by the API
62
+ */
63
+ export type OtpErrorCode = 'OTP_NOT_REQUIRED' | 'ALREADY_VERIFIED' | 'RATE_LIMITED' | 'CODE_REQUIRED' | 'INVALID_CODE' | 'CODE_EXPIRED' | 'ATTEMPTS_EXCEEDED' | 'OTP_REQUIRED';
64
+ /**
65
+ * Extended error information for OTP operations
66
+ */
67
+ export interface OtpError {
68
+ code: OtpErrorCode;
69
+ message: string;
70
+ /** Seconds to wait before retrying (for RATE_LIMITED errors) */
71
+ retryAfter?: number;
72
+ /** Remaining verification attempts (for INVALID_CODE errors) */
73
+ attemptsRemaining?: number;
74
+ }
27
75
  //# sourceMappingURL=application-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-form.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/application-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM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;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,cAAc,GACd,cAAc,GACd,mBAAmB,GACnB,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/block-forms",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "Forms block for 23blocks SDK - dynamic forms, schemas, submissions, and form management",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",