@formio/js 5.0.0-rc.53 → 5.0.0-rc.54
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/InlineEmbed.d.ts +7 -0
- package/lib/cjs/InlineEmbed.js +109 -0
- package/lib/cjs/formio.embed.d.ts +1 -2
- package/lib/cjs/formio.embed.js +2 -100
- package/lib/mjs/InlineEmbed.d.ts +7 -0
- package/lib/mjs/InlineEmbed.js +105 -0
- package/lib/mjs/formio.embed.d.ts +1 -2
- package/lib/mjs/formio.embed.js +2 -99
- package/package.json +8 -4
- package/sdk.d.ts +1 -0
- package/utils.d.ts +1 -0
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
/*! @license DOMPurify 3.1.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.3/LICENSE */
|
24
24
|
|
25
|
-
/*! formiojs v5.0.0-rc.
|
25
|
+
/*! formiojs v5.0.0-rc.54 | https://unpkg.com/formiojs@5.0.0-rc.54/LICENSE.txt */
|
26
26
|
|
27
27
|
/**
|
28
28
|
* @license
|
package/embed.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/cjs/InlineEmbed';
|
package/form.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/cjs/formio.form';
|
@@ -0,0 +1,109 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Formio = exports.embed = void 0;
|
4
|
+
const Embed_1 = require("./Embed");
|
5
|
+
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
|
6
|
+
/**
|
7
|
+
* Inline embed a form within a webpage.
|
8
|
+
* @param {*} config - Configuration to configure how the inline embed is rendered.
|
9
|
+
*/
|
10
|
+
function embed(config = {}) {
|
11
|
+
const scripts = document.getElementsByTagName('script');
|
12
|
+
config = Object.assign({}, window.FormioConfig || {}, config);
|
13
|
+
let thisScript = null;
|
14
|
+
let i = scripts.length;
|
15
|
+
const scriptName = config.scriptName || 'formio.embed.';
|
16
|
+
while (i--) {
|
17
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
18
|
+
thisScript = scripts[i];
|
19
|
+
break;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
if (thisScript) {
|
23
|
+
const query = {};
|
24
|
+
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
25
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
26
|
+
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
27
|
+
});
|
28
|
+
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
29
|
+
scriptSrc.pop();
|
30
|
+
if (config.formioPath) {
|
31
|
+
config.formioPath(scriptSrc);
|
32
|
+
}
|
33
|
+
scriptSrc = scriptSrc.join('/');
|
34
|
+
const debug = (query.debug === 'true' || query.debug === '1');
|
35
|
+
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
36
|
+
Embed_1.Formio.config = Object.assign({
|
37
|
+
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
|
38
|
+
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
|
39
|
+
cdn: query.cdn,
|
40
|
+
class: (query.class || 'formio-form-wrapper'),
|
41
|
+
src: query.src,
|
42
|
+
form: null,
|
43
|
+
submission: null,
|
44
|
+
project: query.project,
|
45
|
+
base: query.base || 'https://api.form.io',
|
46
|
+
submit: query.submit,
|
47
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
48
|
+
template: query.template,
|
49
|
+
debug: debug,
|
50
|
+
config: {},
|
51
|
+
redirect: (query.return || query.redirect),
|
52
|
+
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
53
|
+
success: query.success || 'Thank you for your submission!',
|
54
|
+
before: null,
|
55
|
+
after: null
|
56
|
+
}, config);
|
57
|
+
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
58
|
+
if (form) {
|
59
|
+
Embed_1.Formio.debug('Embedding Configuration', config);
|
60
|
+
if (Embed_1.Formio.config.addPremiumLib) {
|
61
|
+
Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
|
62
|
+
}
|
63
|
+
// The id for this embedded form.
|
64
|
+
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
65
|
+
Embed_1.Formio.debug('Creating form element');
|
66
|
+
const element = Embed_1.Formio.createElement('div', {
|
67
|
+
'id': Embed_1.Formio.config.id,
|
68
|
+
class: Embed_1.Formio.config.class
|
69
|
+
});
|
70
|
+
// insertAfter doesn't exist, but effect is identical.
|
71
|
+
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
72
|
+
Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
|
73
|
+
if (Embed_1.Formio.config.submit) {
|
74
|
+
instance.nosubmit = true;
|
75
|
+
}
|
76
|
+
// Configure a redirect.
|
77
|
+
instance.on('submit', (submission) => {
|
78
|
+
Embed_1.Formio.debug("on('submit')", submission);
|
79
|
+
if (Embed_1.Formio.config.submit) {
|
80
|
+
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
81
|
+
const headers = {
|
82
|
+
'content-type': 'application/json'
|
83
|
+
};
|
84
|
+
const token = Embed_1.Formio.FormioClass.getToken();
|
85
|
+
if (token) {
|
86
|
+
headers['x-jwt-token'] = token;
|
87
|
+
}
|
88
|
+
Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
|
89
|
+
body: JSON.stringify(submission),
|
90
|
+
headers: headers,
|
91
|
+
method: 'POST',
|
92
|
+
mode: 'cors',
|
93
|
+
})
|
94
|
+
.then(resp => resp.json())
|
95
|
+
.then(submission => Embed_1.Formio.submitDone(instance, submission));
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
Embed_1.Formio.submitDone(instance, submission);
|
99
|
+
}
|
100
|
+
});
|
101
|
+
});
|
102
|
+
}
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
// Show an error if the script cannot be found.
|
106
|
+
document.write('<span>Could not locate the Embedded form.</span>');
|
107
|
+
}
|
108
|
+
}
|
109
|
+
exports.embed = embed;
|
@@ -1,2 +1 @@
|
|
1
|
-
export {
|
2
|
-
import { Formio } from './Embed';
|
1
|
+
export {};
|
package/lib/cjs/formio.embed.js
CHANGED
@@ -1,102 +1,4 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
|
6
|
-
const scripts = document.getElementsByTagName('script');
|
7
|
-
const config = window.FormioConfig || {};
|
8
|
-
let thisScript = null;
|
9
|
-
let i = scripts.length;
|
10
|
-
const scriptName = config.scriptName || 'formio.embed.';
|
11
|
-
while (i--) {
|
12
|
-
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
13
|
-
thisScript = scripts[i];
|
14
|
-
break;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
if (thisScript) {
|
18
|
-
const query = {};
|
19
|
-
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
20
|
-
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
21
|
-
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
22
|
-
});
|
23
|
-
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
24
|
-
scriptSrc.pop();
|
25
|
-
if (config.formioPath) {
|
26
|
-
config.formioPath(scriptSrc);
|
27
|
-
}
|
28
|
-
scriptSrc = scriptSrc.join('/');
|
29
|
-
const debug = (query.debug === 'true' || query.debug === '1');
|
30
|
-
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
31
|
-
Embed_1.Formio.config = Object.assign({
|
32
|
-
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
|
33
|
-
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
|
34
|
-
cdn: query.cdn,
|
35
|
-
class: (query.class || 'formio-form-wrapper'),
|
36
|
-
src: query.src,
|
37
|
-
form: null,
|
38
|
-
submission: null,
|
39
|
-
project: query.project,
|
40
|
-
base: query.base || 'https://api.form.io',
|
41
|
-
submit: query.submit,
|
42
|
-
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
43
|
-
template: query.template,
|
44
|
-
debug: debug,
|
45
|
-
config: {},
|
46
|
-
redirect: (query.return || query.redirect),
|
47
|
-
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
48
|
-
success: query.success || 'Thank you for your submission!',
|
49
|
-
before: null,
|
50
|
-
after: null
|
51
|
-
}, config);
|
52
|
-
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
53
|
-
if (form) {
|
54
|
-
Embed_1.Formio.debug('Embedding Configuration', config);
|
55
|
-
if (Embed_1.Formio.config.addPremiumLib) {
|
56
|
-
Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
|
57
|
-
}
|
58
|
-
// The id for this embedded form.
|
59
|
-
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
60
|
-
Embed_1.Formio.debug('Creating form element');
|
61
|
-
const element = Embed_1.Formio.createElement('div', {
|
62
|
-
'id': Embed_1.Formio.config.id,
|
63
|
-
class: Embed_1.Formio.config.class
|
64
|
-
});
|
65
|
-
// insertAfter doesn't exist, but effect is identical.
|
66
|
-
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
67
|
-
Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
|
68
|
-
if (Embed_1.Formio.config.submit) {
|
69
|
-
instance.nosubmit = true;
|
70
|
-
}
|
71
|
-
// Configure a redirect.
|
72
|
-
instance.on('submit', (submission) => {
|
73
|
-
Embed_1.Formio.debug("on('submit')", submission);
|
74
|
-
if (Embed_1.Formio.config.submit) {
|
75
|
-
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
76
|
-
const headers = {
|
77
|
-
'content-type': 'application/json'
|
78
|
-
};
|
79
|
-
const token = Embed_1.Formio.FormioClass.getToken();
|
80
|
-
if (token) {
|
81
|
-
headers['x-jwt-token'] = token;
|
82
|
-
}
|
83
|
-
Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
|
84
|
-
body: JSON.stringify(submission),
|
85
|
-
headers: headers,
|
86
|
-
method: 'POST',
|
87
|
-
mode: 'cors',
|
88
|
-
})
|
89
|
-
.then(resp => resp.json())
|
90
|
-
.then(submission => Embed_1.Formio.submitDone(instance, submission));
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
Embed_1.Formio.submitDone(instance, submission);
|
94
|
-
}
|
95
|
-
});
|
96
|
-
});
|
97
|
-
}
|
98
|
-
}
|
99
|
-
else {
|
100
|
-
// Show an error if the script cannot be found.
|
101
|
-
document.write('<span>Could not locate the Embedded form.</span>');
|
102
|
-
}
|
3
|
+
const InlineEmbed_1 = require("./InlineEmbed");
|
4
|
+
(0, InlineEmbed_1.embed)();
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import { Formio } from './Embed';
|
2
|
+
/**
|
3
|
+
* Inline embed a form within a webpage.
|
4
|
+
* @param {*} config - Configuration to configure how the inline embed is rendered.
|
5
|
+
*/
|
6
|
+
export function embed(config = {}) {
|
7
|
+
const scripts = document.getElementsByTagName('script');
|
8
|
+
config = Object.assign({}, window.FormioConfig || {}, config);
|
9
|
+
let thisScript = null;
|
10
|
+
let i = scripts.length;
|
11
|
+
const scriptName = config.scriptName || 'formio.embed.';
|
12
|
+
while (i--) {
|
13
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
14
|
+
thisScript = scripts[i];
|
15
|
+
break;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
if (thisScript) {
|
19
|
+
const query = {};
|
20
|
+
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
21
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
22
|
+
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
23
|
+
});
|
24
|
+
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
25
|
+
scriptSrc.pop();
|
26
|
+
if (config.formioPath) {
|
27
|
+
config.formioPath(scriptSrc);
|
28
|
+
}
|
29
|
+
scriptSrc = scriptSrc.join('/');
|
30
|
+
const debug = (query.debug === 'true' || query.debug === '1');
|
31
|
+
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
32
|
+
Formio.config = Object.assign({
|
33
|
+
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
|
34
|
+
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
|
35
|
+
cdn: query.cdn,
|
36
|
+
class: (query.class || 'formio-form-wrapper'),
|
37
|
+
src: query.src,
|
38
|
+
form: null,
|
39
|
+
submission: null,
|
40
|
+
project: query.project,
|
41
|
+
base: query.base || 'https://api.form.io',
|
42
|
+
submit: query.submit,
|
43
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
44
|
+
template: query.template,
|
45
|
+
debug: debug,
|
46
|
+
config: {},
|
47
|
+
redirect: (query.return || query.redirect),
|
48
|
+
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
49
|
+
success: query.success || 'Thank you for your submission!',
|
50
|
+
before: null,
|
51
|
+
after: null
|
52
|
+
}, config);
|
53
|
+
const form = (Formio.config.form || Formio.config.src);
|
54
|
+
if (form) {
|
55
|
+
Formio.debug('Embedding Configuration', config);
|
56
|
+
if (Formio.config.addPremiumLib) {
|
57
|
+
Formio.config.addPremiumLib(Formio.config, scriptSrc);
|
58
|
+
}
|
59
|
+
// The id for this embedded form.
|
60
|
+
Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
61
|
+
Formio.debug('Creating form element');
|
62
|
+
const element = Formio.createElement('div', {
|
63
|
+
'id': Formio.config.id,
|
64
|
+
class: Formio.config.class
|
65
|
+
});
|
66
|
+
// insertAfter doesn't exist, but effect is identical.
|
67
|
+
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
68
|
+
Formio.createForm(element, form, Formio.config.config).then((instance) => {
|
69
|
+
if (Formio.config.submit) {
|
70
|
+
instance.nosubmit = true;
|
71
|
+
}
|
72
|
+
// Configure a redirect.
|
73
|
+
instance.on('submit', (submission) => {
|
74
|
+
Formio.debug("on('submit')", submission);
|
75
|
+
if (Formio.config.submit) {
|
76
|
+
Formio.debug(`Sending submission to ${Formio.config.submit}`);
|
77
|
+
const headers = {
|
78
|
+
'content-type': 'application/json'
|
79
|
+
};
|
80
|
+
const token = Formio.FormioClass.getToken();
|
81
|
+
if (token) {
|
82
|
+
headers['x-jwt-token'] = token;
|
83
|
+
}
|
84
|
+
Formio.FormioClass.fetch(Formio.config.submit, {
|
85
|
+
body: JSON.stringify(submission),
|
86
|
+
headers: headers,
|
87
|
+
method: 'POST',
|
88
|
+
mode: 'cors',
|
89
|
+
})
|
90
|
+
.then(resp => resp.json())
|
91
|
+
.then(submission => Formio.submitDone(instance, submission));
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
Formio.submitDone(instance, submission);
|
95
|
+
}
|
96
|
+
});
|
97
|
+
});
|
98
|
+
}
|
99
|
+
}
|
100
|
+
else {
|
101
|
+
// Show an error if the script cannot be found.
|
102
|
+
document.write('<span>Could not locate the Embedded form.</span>');
|
103
|
+
}
|
104
|
+
}
|
105
|
+
export { Formio };
|
@@ -1,2 +1 @@
|
|
1
|
-
export {
|
2
|
-
import { Formio } from './Embed';
|
1
|
+
export {};
|
package/lib/mjs/formio.embed.js
CHANGED
@@ -1,99 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
const config = window.FormioConfig || {};
|
4
|
-
let thisScript = null;
|
5
|
-
let i = scripts.length;
|
6
|
-
const scriptName = config.scriptName || 'formio.embed.';
|
7
|
-
while (i--) {
|
8
|
-
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
9
|
-
thisScript = scripts[i];
|
10
|
-
break;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
if (thisScript) {
|
14
|
-
const query = {};
|
15
|
-
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
16
|
-
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
17
|
-
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
18
|
-
});
|
19
|
-
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
20
|
-
scriptSrc.pop();
|
21
|
-
if (config.formioPath) {
|
22
|
-
config.formioPath(scriptSrc);
|
23
|
-
}
|
24
|
-
scriptSrc = scriptSrc.join('/');
|
25
|
-
const debug = (query.debug === 'true' || query.debug === '1');
|
26
|
-
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
27
|
-
Formio.config = Object.assign({
|
28
|
-
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
|
29
|
-
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
|
30
|
-
cdn: query.cdn,
|
31
|
-
class: (query.class || 'formio-form-wrapper'),
|
32
|
-
src: query.src,
|
33
|
-
form: null,
|
34
|
-
submission: null,
|
35
|
-
project: query.project,
|
36
|
-
base: query.base || 'https://api.form.io',
|
37
|
-
submit: query.submit,
|
38
|
-
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
39
|
-
template: query.template,
|
40
|
-
debug: debug,
|
41
|
-
config: {},
|
42
|
-
redirect: (query.return || query.redirect),
|
43
|
-
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
44
|
-
success: query.success || 'Thank you for your submission!',
|
45
|
-
before: null,
|
46
|
-
after: null
|
47
|
-
}, config);
|
48
|
-
const form = (Formio.config.form || Formio.config.src);
|
49
|
-
if (form) {
|
50
|
-
Formio.debug('Embedding Configuration', config);
|
51
|
-
if (Formio.config.addPremiumLib) {
|
52
|
-
Formio.config.addPremiumLib(Formio.config, scriptSrc);
|
53
|
-
}
|
54
|
-
// The id for this embedded form.
|
55
|
-
Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
56
|
-
Formio.debug('Creating form element');
|
57
|
-
const element = Formio.createElement('div', {
|
58
|
-
'id': Formio.config.id,
|
59
|
-
class: Formio.config.class
|
60
|
-
});
|
61
|
-
// insertAfter doesn't exist, but effect is identical.
|
62
|
-
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
63
|
-
Formio.createForm(element, form, Formio.config.config).then((instance) => {
|
64
|
-
if (Formio.config.submit) {
|
65
|
-
instance.nosubmit = true;
|
66
|
-
}
|
67
|
-
// Configure a redirect.
|
68
|
-
instance.on('submit', (submission) => {
|
69
|
-
Formio.debug("on('submit')", submission);
|
70
|
-
if (Formio.config.submit) {
|
71
|
-
Formio.debug(`Sending submission to ${Formio.config.submit}`);
|
72
|
-
const headers = {
|
73
|
-
'content-type': 'application/json'
|
74
|
-
};
|
75
|
-
const token = Formio.FormioClass.getToken();
|
76
|
-
if (token) {
|
77
|
-
headers['x-jwt-token'] = token;
|
78
|
-
}
|
79
|
-
Formio.FormioClass.fetch(Formio.config.submit, {
|
80
|
-
body: JSON.stringify(submission),
|
81
|
-
headers: headers,
|
82
|
-
method: 'POST',
|
83
|
-
mode: 'cors',
|
84
|
-
})
|
85
|
-
.then(resp => resp.json())
|
86
|
-
.then(submission => Formio.submitDone(instance, submission));
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
Formio.submitDone(instance, submission);
|
90
|
-
}
|
91
|
-
});
|
92
|
-
});
|
93
|
-
}
|
94
|
-
}
|
95
|
-
else {
|
96
|
-
// Show an error if the script cannot be found.
|
97
|
-
document.write('<span>Could not locate the Embedded form.</span>');
|
98
|
-
}
|
99
|
-
export { Formio };
|
1
|
+
import { embed } from './InlineEmbed';
|
2
|
+
embed();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.0.0-rc.
|
3
|
+
"version": "5.0.0-rc.54",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -21,14 +21,18 @@
|
|
21
21
|
"require": "./lib/cjs/formio.form.js"
|
22
22
|
},
|
23
23
|
"./embed": {
|
24
|
-
"import": "./lib/cjs/
|
25
|
-
"require": "./lib/cjs/
|
24
|
+
"import": "./lib/cjs/InlineEmbed.js",
|
25
|
+
"require": "./lib/cjs/InlineEmbed.js"
|
26
26
|
},
|
27
27
|
"./dist/*": "./dist/*"
|
28
28
|
},
|
29
29
|
"files": [
|
30
30
|
"dist",
|
31
|
-
"lib"
|
31
|
+
"lib",
|
32
|
+
"embed.d.ts",
|
33
|
+
"form.d.ts",
|
34
|
+
"sdk.d.ts",
|
35
|
+
"utils.d.ts"
|
32
36
|
],
|
33
37
|
"pre-commit": [
|
34
38
|
"lint"
|
package/sdk.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/cjs/Formio';
|
package/utils.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/cjs/utils';
|