@unvired/turboforms-embed-sdk 2.0.22 → 2.0.24
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/README.md +12 -12
- package/dist/turboforms.esm.js +10 -10
- package/dist/turboforms.html +1 -1
- package/dist/turboforms.js +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,9 +31,9 @@ npm install unvired-forms-sdk
|
|
|
31
31
|
<div id="form-container"></div>
|
|
32
32
|
|
|
33
33
|
<script type="module">
|
|
34
|
-
import {
|
|
34
|
+
import { loadForms } from './dist/unvired-forms-sdk.js';
|
|
35
35
|
|
|
36
|
-
const formInstance =
|
|
36
|
+
const formInstance = loadForms({
|
|
37
37
|
formsData: formTemplateData,
|
|
38
38
|
submissionData: preFillData || {},
|
|
39
39
|
eventCallback: function (event) {
|
|
@@ -71,7 +71,7 @@ npm install unvired-forms-sdk
|
|
|
71
71
|
|
|
72
72
|
```jsx
|
|
73
73
|
import React, { useRef, useEffect } from 'react';
|
|
74
|
-
import {
|
|
74
|
+
import { loadForms } from 'unvired-forms-sdk';
|
|
75
75
|
|
|
76
76
|
const UnviredForm = ({ formData, onSubmit, onBack }) => {
|
|
77
77
|
const containerRef = useRef(null);
|
|
@@ -79,7 +79,7 @@ const UnviredForm = ({ formData, onSubmit, onBack }) => {
|
|
|
79
79
|
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
if (containerRef.current && formData) {
|
|
82
|
-
formInstanceRef.current =
|
|
82
|
+
formInstanceRef.current = loadForms({
|
|
83
83
|
formsData: formData,
|
|
84
84
|
submissionData: {},
|
|
85
85
|
eventCallback: (event) => {
|
|
@@ -119,7 +119,7 @@ export default UnviredForm;
|
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
121
|
import { Component, ElementRef, ViewChild, Input, Output, EventEmitter } from '@angular/core';
|
|
122
|
-
import {
|
|
122
|
+
import { loadForms, FormEvent } from 'unvired-forms-sdk';
|
|
123
123
|
|
|
124
124
|
@Component({
|
|
125
125
|
selector: 'app-unvired-form',
|
|
@@ -133,7 +133,7 @@ export class UnviredFormComponent {
|
|
|
133
133
|
|
|
134
134
|
ngOnInit() {
|
|
135
135
|
if (this.formData) {
|
|
136
|
-
|
|
136
|
+
loadForms({
|
|
137
137
|
formsData: this.formData,
|
|
138
138
|
submissionData: {},
|
|
139
139
|
eventCallback: (event: FormEvent) => {
|
|
@@ -165,8 +165,8 @@ export class UnviredFormComponent {
|
|
|
165
165
|
```javascript
|
|
166
166
|
// In your Cordova app's main JavaScript file
|
|
167
167
|
document.addEventListener('deviceready', function() {
|
|
168
|
-
import('./js/unvired-forms-sdk.js').then(({
|
|
169
|
-
const formInstance =
|
|
168
|
+
import('./js/unvired-forms-sdk.js').then(({ loadForms }) => {
|
|
169
|
+
const formInstance = loadForms({
|
|
170
170
|
formsData: formTemplateData,
|
|
171
171
|
submissionData: {},
|
|
172
172
|
eventCallback: function (event) {
|
|
@@ -198,7 +198,7 @@ document.addEventListener('deviceready', function() {
|
|
|
198
198
|
|
|
199
199
|
## 📋 API Reference
|
|
200
200
|
|
|
201
|
-
###
|
|
201
|
+
### loadFormsParams
|
|
202
202
|
|
|
203
203
|
| Property | Type | Required | Description |
|
|
204
204
|
|----------|------|----------|-------------|
|
|
@@ -356,10 +356,10 @@ You can listen for this event in your host application and call `preInitialize()
|
|
|
356
356
|
|
|
357
357
|
## 🔧 Form Instance Methods
|
|
358
358
|
|
|
359
|
-
The `
|
|
359
|
+
The `loadForms` function returns a FormInstance object with the following methods:
|
|
360
360
|
|
|
361
361
|
```javascript
|
|
362
|
-
const formInstance =
|
|
362
|
+
const formInstance = loadForms(params);
|
|
363
363
|
|
|
364
364
|
// Send actions to the form
|
|
365
365
|
formInstance.sendAction({
|
|
@@ -423,7 +423,7 @@ formInstance.sendAction({
|
|
|
423
423
|
The SDK provides comprehensive error handling with specific error codes:
|
|
424
424
|
|
|
425
425
|
```javascript
|
|
426
|
-
|
|
426
|
+
loadForms({
|
|
427
427
|
// ... other params
|
|
428
428
|
eventCallback: function(event) {
|
|
429
429
|
if (event.type === 'ERROR') {
|