react-hubspot-form
Advanced tools
Comparing version 1.0.5 to 1.1.1
@@ -41,4 +41,3 @@ 'use strict'; | ||
_this.createForm = _this.createForm.bind(_this); | ||
_this.createFormInterval = _this.createFormInterval.bind(_this); | ||
_this.loadScript = _this.loadScript.bind(_this); | ||
_this.findFormElement = _this.findFormElement.bind(_this); | ||
return _this; | ||
@@ -48,9 +47,2 @@ } | ||
_createClass(HubspotForm, [{ | ||
key: 'createFormInterval', | ||
value: function createFormInterval() { | ||
if (!this.createForm()) { | ||
setTimeout(this.createForm, 1); | ||
} | ||
} | ||
}, { | ||
key: 'createForm', | ||
@@ -63,3 +55,6 @@ value: function createForm() { | ||
window.hbspt.forms.create(options); | ||
this.findFormElement(); | ||
return true; | ||
} else { | ||
setTimeout(this.createForm, 1); | ||
} | ||
@@ -77,2 +72,12 @@ } | ||
}, { | ||
key: 'findFormElement', | ||
value: function findFormElement() { | ||
var form = this.el.querySelector('form'); | ||
if (form) { | ||
form.addEventListener('submit', this.props.onSubmit); | ||
} else { | ||
setTimeout(this.findFormElement, 1); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
@@ -83,3 +88,3 @@ value: function componentDidMount() { | ||
} else { | ||
this.createFormInterval(); | ||
this.createForm(); | ||
} | ||
@@ -101,2 +106,6 @@ } | ||
HubspotForm.defaultProps = { | ||
onSubmit: function onSubmit() {} | ||
}; | ||
exports.default = HubspotForm; | ||
@@ -103,0 +112,0 @@ module.exports = exports['default']; |
{ | ||
"name": "react-hubspot-form", | ||
"version": "1.0.5", | ||
"version": "1.1.1", | ||
"keywords": [ | ||
@@ -21,2 +21,3 @@ "react", | ||
"prepublishOnly": "npm run build", | ||
"test": "echo 'no test'", | ||
"travis": "opn https://travis-ci.org/escaladesports/react-hubspot-form/branches" | ||
@@ -23,0 +24,0 @@ }, |
@@ -28,3 +28,4 @@ # react-hubspot-form | ||
portalId='your_portal_id' | ||
formId='your_form_id' | ||
formId='your_form_id' | ||
onSubmit={() => console.log('Submit!')} | ||
/> | ||
@@ -31,0 +32,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
248659
87
35
2