react-hubspot-form
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,182 +0,91 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else { | ||
var a = factory(); | ||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; | ||
} | ||
})(typeof self !== 'undefined' ? self : this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
module.exports = __webpack_require__(1); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(3); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
let globalId = 0; | ||
let scriptLoaded = false; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
class HubspotForm extends __WEBPACK_IMPORTED_MODULE_0_react___default.a.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = {}; | ||
this.elId = globalId++; | ||
this.createForm = this.createForm.bind(this); | ||
this.createFormInterval = this.createFormInterval.bind(this); | ||
this.loadScript = this.loadScript.bind(this); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var globalId = 0; | ||
var scriptLoaded = false; | ||
var HubspotForm = function (_React$Component) { | ||
_inherits(HubspotForm, _React$Component); | ||
function HubspotForm(props) { | ||
_classCallCheck(this, HubspotForm); | ||
var _this = _possibleConstructorReturn(this, (HubspotForm.__proto__ || Object.getPrototypeOf(HubspotForm)).call(this, props)); | ||
_this.state = {}; | ||
_this.elId = globalId++; | ||
_this.createForm = _this.createForm.bind(_this); | ||
_this.createFormInterval = _this.createFormInterval.bind(_this); | ||
_this.loadScript = _this.loadScript.bind(_this); | ||
return _this; | ||
} | ||
createFormInterval() { | ||
if (!this.createForm()) { | ||
setTimeout(this.createForm, 1); | ||
_createClass(HubspotForm, [{ | ||
key: 'createFormInterval', | ||
value: function createFormInterval() { | ||
if (!this.createForm()) { | ||
setTimeout(this.createForm, 1); | ||
} | ||
} | ||
} | ||
createForm() { | ||
if (window.hbspt) { | ||
const options = _extends({}, this.props, { | ||
target: `#reactHubspotForm${this.elId}` | ||
}); | ||
window.hbspt.forms.create(options); | ||
return true; | ||
}, { | ||
key: 'createForm', | ||
value: function createForm() { | ||
if (window.hbspt) { | ||
var options = _extends({}, this.props, { | ||
target: '#reactHubspotForm' + this.elId | ||
}); | ||
window.hbspt.forms.create(options); | ||
return true; | ||
} | ||
} | ||
} | ||
loadScript() { | ||
scriptLoaded = true; | ||
const script = document.createElement('script'); | ||
script.onload = this.createForm; | ||
script.src = `//js.hsforms.net/forms/v2.js`; | ||
document.head.appendChild(script); | ||
} | ||
componentDidMount() { | ||
if (!scriptLoaded && !this.props.noScript) { | ||
this.loadScript(); | ||
} else { | ||
this.createFormInterval(); | ||
}, { | ||
key: 'loadScript', | ||
value: function loadScript() { | ||
scriptLoaded = true; | ||
var script = document.createElement('script'); | ||
script.onload = this.createForm; | ||
script.src = '//js.hsforms.net/forms/v2.js'; | ||
document.head.appendChild(script); | ||
} | ||
} | ||
render() { | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', { id: `reactHubspotForm${this.elId}` }); | ||
} | ||
} | ||
/* harmony export (immutable) */ __webpack_exports__["default"] = HubspotForm; | ||
module.exports = exports['default']; | ||
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2)(module))) | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports) { | ||
module.exports = function(originalModule) { | ||
if(!originalModule.webpackPolyfill) { | ||
var module = Object.create(originalModule); | ||
// module.parent = undefined by default | ||
if(!module.children) module.children = []; | ||
Object.defineProperty(module, "loaded", { | ||
enumerable: true, | ||
get: function() { | ||
return module.l; | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (!scriptLoaded && !this.props.noScript) { | ||
this.loadScript(); | ||
} else { | ||
this.createFormInterval(); | ||
} | ||
}); | ||
Object.defineProperty(module, "id", { | ||
enumerable: true, | ||
get: function() { | ||
return module.i; | ||
} | ||
}); | ||
Object.defineProperty(module, "exports", { | ||
enumerable: true, | ||
}); | ||
module.webpackPolyfill = 1; | ||
} | ||
return module; | ||
}; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('div', { id: 'reactHubspotForm' + this.elId }); | ||
} | ||
}]); | ||
return HubspotForm; | ||
}(_react2.default.Component); | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports) { | ||
exports.default = HubspotForm; | ||
module.exports = exports['default']; | ||
module.exports = require("react"); | ||
/***/ }) | ||
/******/ ]); | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-hubspot-form", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"keywords": [ | ||
@@ -18,3 +18,3 @@ "react", | ||
"analyze": "esca-scripts analyze --react --component --input ./src/index.js", | ||
"build": "esca-scripts build --input ./src/index.js --output ./dist/index.js --react --component", | ||
"build": "esca-scripts build --input ./src/index.js --output ./dist/index.js --react --component --babel", | ||
"dev": "esca-scripts dev ---input './dev/dev.js, ./dev/index.html' --react --browser", | ||
@@ -25,3 +25,3 @@ "prepublishOnly": "npm run build", | ||
"devDependencies": { | ||
"esca-scripts": "^0.12.1", | ||
"esca-scripts": "^0.13.1", | ||
"opn-cli": "^3.1.0", | ||
@@ -28,0 +28,0 @@ "react": "^16.1.1", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
247769
9
74
1