@stackshift-ui/webriq-form 7.0.0-beta.0 → 7.0.0-beta.3
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/chunk-RP6RJFAO.mjs +70 -0
- package/package.json +4 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/webriq-form.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var WebriQForm = class extends React.Component {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super(props);
|
|
7
|
+
this.loadWebriQFormScript = this.loadWebriQFormScript.bind(this);
|
|
8
|
+
}
|
|
9
|
+
componentDidMount() {
|
|
10
|
+
var _a;
|
|
11
|
+
if (window && !window.isWebriQFormLoaded) {
|
|
12
|
+
this.loadWebriQFormScript();
|
|
13
|
+
}
|
|
14
|
+
if (window && window.isWebriQFormLoaded) {
|
|
15
|
+
(_a = window.webriqFormRefresh) == null ? void 0 : _a.call(window);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
loadWebriQFormScript() {
|
|
19
|
+
var _a;
|
|
20
|
+
const webriqFormScript = document.getElementById("webriqform");
|
|
21
|
+
if (!webriqFormScript) {
|
|
22
|
+
const script = document.createElement("script");
|
|
23
|
+
script.type = "text/javascript";
|
|
24
|
+
script.id = "webriqform";
|
|
25
|
+
script.defer = true;
|
|
26
|
+
script.src = this.props.scriptSrc || "https://pagebuilderforms.webriq.com/js/initReactForms";
|
|
27
|
+
document.body.appendChild(script);
|
|
28
|
+
const headScript = document.getElementsByTagName("script")[0];
|
|
29
|
+
(_a = headScript.parentNode) == null ? void 0 : _a.insertBefore(script, headScript);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
componentWillUnmount() {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const { unmountScript } = this.props;
|
|
35
|
+
const webriqFormScript = document.getElementById("webriqform");
|
|
36
|
+
if (webriqFormScript && unmountScript) {
|
|
37
|
+
(_a = webriqFormScript.parentNode) == null ? void 0 : _a.removeChild(webriqFormScript);
|
|
38
|
+
}
|
|
39
|
+
if (window && unmountScript) {
|
|
40
|
+
window.isWebriQFormLoaded = false;
|
|
41
|
+
}
|
|
42
|
+
const webriqFormRecaptcha = document.getElementById("webriqFormRecaptcha");
|
|
43
|
+
if (webriqFormRecaptcha && unmountScript) {
|
|
44
|
+
(_b = webriqFormRecaptcha.parentNode) == null ? void 0 : _b.removeChild(webriqFormRecaptcha);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
const { id, name, className, ...rest } = this.props;
|
|
49
|
+
const formId = this.props.formId || this.props["data-form-id"];
|
|
50
|
+
let redirectURL = this.props.redirectUrl || this.props["data-thankyou-url"] || "/thank-you";
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"form",
|
|
53
|
+
{
|
|
54
|
+
name,
|
|
55
|
+
id,
|
|
56
|
+
className,
|
|
57
|
+
method: "POST",
|
|
58
|
+
"data-form-id": formId,
|
|
59
|
+
"data-thankyou-url": redirectURL,
|
|
60
|
+
webriq: "true",
|
|
61
|
+
...rest,
|
|
62
|
+
children: this.props.children
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
WebriQForm
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/webriq-form",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "7.0.0-beta.
|
|
4
|
+
"version": "7.0.0-beta.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"@stackshift-ui/typescript-config": "6.0.10"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stackshift-ui/scripts": "6.1.0-beta.
|
|
37
|
-
"@stackshift-ui/system": "6.1.0-beta.
|
|
36
|
+
"@stackshift-ui/scripts": "6.1.0-beta.2",
|
|
37
|
+
"@stackshift-ui/system": "6.1.0-beta.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@types/react": "16.8 - 19",
|
|
41
41
|
"next": "10 - 14",
|
|
42
42
|
"react": "16.8 - 19",
|
|
43
43
|
"react-dom": "16.8 - 19",
|
|
44
|
-
"@stackshift-ui/system": ">=6.1.0-beta.
|
|
44
|
+
"@stackshift-ui/system": ">=6.1.0-beta.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"next": {
|