UNPKG

react-wufoo-embed

Version:
1 lines 10.8 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.ReactWufooEmbed=e()}}(function(){return function e(t,n,r){function o(u,a){if(!n[u]){if(!t[u]){var f="function"==typeof require&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[u]={exports:{}};t[u][0].call(c.exports,function(e){var n=t[u][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],2:[function(e,t,n){"use strict";function r(e,t,n,r,i,u,a,f){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,u,a,f],l=0;s=new Error(t.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};t.exports=r},{}],3:[function(e,t,n){"use strict";var r=e("./emptyFunction"),o=r;t.exports=o},{"./emptyFunction":1}],4:[function(e,t,n){"use strict";function r(e,t,n,r,o){}t.exports=r},{"./lib/ReactPropTypesSecret":8,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],5:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("./lib/ReactPropTypesSecret");t.exports=function(){function e(e,t,n,r,u,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},{"./lib/ReactPropTypesSecret":8,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],6:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("fbjs/lib/warning"),u=e("./lib/ReactPropTypesSecret"),a=e("./checkPropTypes");t.exports=function(e,t){function n(e){var t=e&&(P&&e[P]||e[k]);if("function"==typeof t)return t}function f(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function s(e){this.message=e,this.stack=""}function c(e){function n(n,r,i,a,f,c,l){if(a=a||E,c=c||i,l!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else;return null==r[i]?n?new s(null===r[i]?"The "+f+" `"+c+"` is marked as required "+("in `"+a+"`, but its value is `null`."):"The "+f+" `"+c+"` is marked as required in "+("`"+a+"`, but its value is `undefined`.")):null:e(r,i,a,f,c)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function l(e){function t(t,n,r,o,i,u){var a=t[n],f=O(a);if(f!==e){var c=x(a);return new s("Invalid "+o+" `"+i+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return c(t)}function p(){return c(r.thatReturnsNull)}function d(e){function t(t,n,r,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var f=O(a);return new s("Invalid "+o+" `"+i+"` of type "+("`"+f+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,o,i+"["+c+"]",u);if(l instanceof Error)return l}return null}return c(t)}function y(){function t(t,n,r,o,i){var u=t[n];if(!e(u)){var a=O(u);return new s("Invalid "+o+" `"+i+"` of type "+("`"+a+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return c(t)}function b(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var u=e.name||E,a=S(t[n]);return new s("Invalid "+o+" `"+i+"` of type "+("`"+a+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return c(t)}function h(e){function t(t,n,r,o,i){for(var u=t[n],a=0;a<e.length;a++)if(f(u,e[a]))return null;var c=JSON.stringify(e);return new s("Invalid "+o+" `"+i+"` of value `"+u+"` "+("supplied to `"+r+"`, expected one of "+c+"."))}return Array.isArray(e)?c(t):r.thatReturnsNull}function v(e){function t(t,n,r,o,i){if("function"!=typeof e)return new s("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],f=O(a);if("object"!==f)return new s("Invalid "+o+" `"+i+"` of type "+("`"+f+"` supplied to `"+r+"`, expected an object."));for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,o,i+"."+c,u);if(l instanceof Error)return l}return null}return c(t)}function m(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){var f=e[a];if(null==f(t,n,r,o,i,u))return null}return new s("Invalid "+o+" `"+i+"` supplied to "+("`"+r+"`."))}if(!Array.isArray(e))return r.thatReturnsNull;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",R(o),n),r.thatReturnsNull}return c(t)}function g(){function e(e,t,n,r,o){return T(e[t])?null:new s("Invalid "+r+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return c(e)}function w(e){function t(t,n,r,o,i){var a=t[n],f=O(a);if("object"!==f)return new s("Invalid "+o+" `"+i+"` of type `"+f+"` "+("supplied to `"+r+"`, expected `object`."));for(var c in e){var l=e[c];if(l){var p=l(a,c,r,o,i+"."+c,u);if(p)return p}}return null}return c(t)}function T(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(T);if(null===t||e(t))return!0;var r=n(t);if(!r)return!1;var o,i=r.call(t);if(r!==t.entries){for(;!(o=i.next()).done;)if(!T(o.value))return!1}else for(;!(o=i.next()).done;){var u=o.value;if(u&&!T(u[1]))return!1}return!0;default:return!1}}function j(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function O(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":j(t,e)?"symbol":t}function x(e){if("undefined"==typeof e||null===e)return""+e;var t=O(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function R(e){var t=x(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function S(e){return e.constructor&&e.constructor.name?e.constructor.name:E}var P="function"==typeof Symbol&&Symbol.iterator,k="@@iterator",E="<<anonymous>>",_={array:l("array"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:p(),arrayOf:d,element:y(),instanceOf:b,node:g(),objectOf:v,oneOf:h,oneOfType:m,shape:w};return s.prototype=Error.prototype,_.checkPropTypes=a,_.PropTypes=_,_}},{"./checkPropTypes":4,"./lib/ReactPropTypesSecret":8,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],7:[function(e,t,n){t.exports=e("./factoryWithThrowingShims")()},{"./factoryWithThrowingShims":5,"./factoryWithTypeCheckers":6}],8:[function(e,t,n){"use strict";var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=r},{}],9:[function(e,t,n){(function(r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e,t,n){for(var r=!0;r;){var o=e,i=t,u=n;r=!1,null===o&&(o=Function.prototype);var a=Object.getOwnPropertyDescriptor(o,i);if(void 0!==a){if("value"in a)return a.value;var f=a.get;if(void 0===f)return;return f.call(u)}var s=Object.getPrototypeOf(o);if(null===s)return;e=s,t=i,n=u,r=!0,a=s=void 0}},s="undefined"!=typeof window?window.React:"undefined"!=typeof r?r.React:null,c=o(s),l=e("prop-types"),p=o(l),d=function(e){function t(e){i(this,t),f(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.getSrc=this.getSrc.bind(this),this.embedForm=this.embedForm.bind(this),this.runScript=this.runScript.bind(this),this.createScript=this.createScript.bind(this)}return u(t,e),a(t,[{key:"getSrc",value:function(){return"https://www."+this.props.host+this.props.embedJs}},{key:"embedForm",value:function(){var e=this,t=void 0,n=this.readyState;if(!n||"complete"===n||"loaded"===n)try{t=new window.WufooForm,t.initialize(e.props),t.display()}catch(r){throw r}}},{key:"runScript",value:function(){return"function"!=typeof window.WufooForm?this.createScript():this.embedForm()}},{key:"createScript",value:function(){var e=this,t=document.createElement("script");t.src=this.getSrc(),t.onload=t.onreadystatechange=function(){return e.embedForm()};var n=document.getElementsByTagName("script")[0],r=n.parentNode;return r.insertBefore(t,n),n}},{key:"componentDidUpdate",value:function(){this.runScript()}},{key:"componentDidMount",value:function(){this.runScript()}},{key:"render",value:function(){return c["default"].createElement("div",{id:"wufoo-"+this.props.formHash})}}]),t}(c["default"].Component);d.propTypes={async:p["default"].bool,autoResize:p["default"].bool,defaultValues:p["default"].string,embedJs:p["default"].string,formHash:p["default"].string.isRequired,header:p["default"].oneOf(["show","hide"]),height:p["default"].string,host:p["default"].string,ssl:p["default"].bool,userName:p["default"].string.isRequired},d.defaultProps={async:!0,autoResize:!0,embedJs:"/scripts/embed/form.js",defaultValues:"",formHash:"",header:"show",height:"0",host:"wufoo.com",ssl:!0,userName:""},n["default"]=d,t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":7}]},{},[9])(9)});