@personare/react-freshdesk-widget
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r=t("object"==typeof exports?require("react"):e.react);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,function(e){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}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(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),f=o(p),d=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e));return r.renderPopUp=r.renderPopUp.bind(r),r.renderWithChildren=r.renderWithChildren.bind(r),r.renderIncorporated=r.renderIncorporated.bind(r),r}return u(t,e),s(t,[{key:"componentWillUnmount",value:function(){function e(){var e=this.props.type;"pop-up"===e&&window.FreshWidget.destroy()}return e}()},{key:"getFreshdeskWidgetSDK",value:function(){function e(e){var t=document.createElement("script");t.src="https://s3.amazonaws.com/assets.freshdesk.com/widget/freshwidget.js",t.type="text/javascript",t.onload=e,document.body.appendChild(t)}return e}()},{key:"getAlignmentByPositionLabel",value:function(){function e(e){var t={left:4,right:2,top:1,bottom:3};return t[e]}return e}()},{key:"renderWithChildren",value:function(){function e(){var e=this,t=this.props,r=t.url,o=t.formTitle,n=t.formHeight,i=t.submitThanks,u="&widgetType=popup&formTitle="+o+"&submitThanks="+i,s={utf8:"✓",widgetType:"popup",url:r,formTitle:o,formHeight:n,submitThanks:i,queryString:u,offset:"-3000px"},p=function(){function t(){e.getFreshdeskWidgetSDK(function(){window.FreshWidget.init("",s),setTimeout(function(){window.FreshWidget.create(),window.FreshWidget.show()},100)})}return t}(),d=f["default"].cloneElement(this.props.children,{onClick:p.bind(this)});return f["default"].createElement("div",null,d)}return e}()},{key:"renderPopUp",value:function(){function e(){var e=this.props,t=e.url,r=e.buttonType,o=e.buttonText,n=e.buttonColor,i=e.buttonBackgroundColor,u=e.buttonBackgroundImage,s=e.buttonPosition,p=e.buttonOffset,d=e.formTitle,a=e.submitThanks,l=e.formHeight,c="&widgetType=popup&formTitle="+d+"&submitThanks="+a,h={utf8:"✓",widgetType:"popup",alignment:this.getAlignmentByPositionLabel(s),offset:p,buttonBg:i,backgroundImage:u,url:t,buttonType:r,buttonText:o,buttonColor:n,submitThanks:a,formHeight:l,formTitle:d,queryString:c};return this.getFreshdeskWidgetSDK(function(){return window.FreshWidget.init("",h)}),f["default"].createElement("div",{id:"freshdesk"})}return e}()},{key:"renderIncorporated",value:function(){function e(){var e=this.props,t=e.url,r=e.formTitle,o=e.formHeight,n=e.submitThanks,i=t+"/widgets/feedback_widget/new?",u=["widgetType=embedded","screenshot=no","formTitle="+r,"formHeight="+o,"submitThanks="+n].join("&");return f["default"].createElement("div",null,f["default"].createElement("iframe",{className:"freshwidget-embedded-form",frameBorder:"0",id:"freshwidget-embedded-form",src:i+u,scrolling:"no",height:o,width:"100%"}))}return e}()},{key:"render",value:function(){function e(){var e=this.props.type;if("incorporated"===e)return this.renderIncorporated();var t=f["default"].Children.count(this.props.children)>=1;return t?this.renderWithChildren():this.renderPopUp()}return e}()}]),t}(p.Component);d.propTypes={url:p.PropTypes.string.isRequired,type:p.PropTypes.oneOf(["pop-up","incorporated"]),buttonType:p.PropTypes.oneOf(["text","image"]),buttonText:p.PropTypes.string,buttonColor:p.PropTypes.string,buttonBackgroundColor:p.PropTypes.string,buttonBackgroundImage:p.PropTypes.string,buttonPosition:p.PropTypes.oneOf(["left","right","top","bottom"]),buttonOffset:p.PropTypes.string,formTitle:p.PropTypes.string,submitThanks:p.PropTypes.string,formHeight:p.PropTypes.string,children:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.node),p.PropTypes.node])},d.defaultProps={type:"incorporated",formTitle:"Help and support",submitThanks:"Thank you, one of our representatives will respond to you soon! =)",formHeight:"500px",buttonType:"text",buttonText:"Support",buttonColor:"white",buttonBackgroundColor:"#015453",buttonPosition:"top",buttonOffset:"235px",children:null},t["default"]=d},function(t,r){t.exports=e}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r=t("object"==typeof exports?require("react"):e.react);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,function(e){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}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(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(1),f=o(p),d=function(e){function t(e){n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.renderPopUp=r.renderPopUp.bind(r),r.renderWithChildren=r.renderWithChildren.bind(r),r.renderIncorporated=r.renderIncorporated.bind(r),r}return u(t,e),s(t,[{key:"componentWillUnmount",value:function(){function e(){var e=this.props.type;"pop-up"===e&&window.FreshWidget.destroy()}return e}()},{key:"getFreshdeskWidgetSDK",value:function(){function e(e){var t=document.createElement("script");t.src="https://s3.amazonaws.com/assets.freshdesk.com/widget/freshwidget.js",t.type="text/javascript",t.onload=e,document.body.appendChild(t)}return e}()},{key:"getAlignmentByPositionLabel",value:function(){function e(e){var t={left:4,right:2,top:1,bottom:3};return t[e]}return e}()},{key:"renderWithChildren",value:function(){function e(){var e=this,t=this.props,r=t.url,o=t.formTitle,n=t.formHeight,i=t.submitThanks,u="&widgetType=popup&formTitle="+o+"&submitThanks="+i,s={utf8:"✓",widgetType:"popup",url:r,formTitle:o,formHeight:n,submitThanks:i,queryString:u,offset:"-3000px"},p=function(){function t(){e.getFreshdeskWidgetSDK(function(){window.FreshWidget.init("",s),setTimeout(function(){window.FreshWidget.create(),window.FreshWidget.show()},100)})}return t}(),d=f.default.cloneElement(this.props.children,{onClick:p.bind(this)});return f.default.createElement("div",null,d)}return e}()},{key:"renderPopUp",value:function(){function e(){var e=this.props,t=e.url,r=e.buttonType,o=e.buttonText,n=e.buttonColor,i=e.buttonBackgroundColor,u=e.buttonBackgroundImage,s=e.buttonPosition,p=e.buttonOffset,d=e.formTitle,a=e.submitThanks,l=e.formHeight,c="&widgetType=popup&formTitle="+d+"&submitThanks="+a,h={utf8:"✓",widgetType:"popup",alignment:this.getAlignmentByPositionLabel(s),offset:p,buttonBg:i,backgroundImage:u,url:t,buttonType:r,buttonText:o,buttonColor:n,submitThanks:a,formHeight:l,formTitle:d,queryString:c};return this.getFreshdeskWidgetSDK(function(){return window.FreshWidget.init("",h)}),f.default.createElement("div",{id:"freshdesk"})}return e}()},{key:"renderIncorporated",value:function(){function e(){var e=this.props,t=e.url,r=e.formTitle,o=e.formHeight,n=e.submitThanks,i=t+"/widgets/feedback_widget/new?",u=["widgetType=embedded","screenshot=no","formTitle="+r,"formHeight="+o,"submitThanks="+n].join("&");return f.default.createElement("div",null,f.default.createElement("iframe",{className:"freshwidget-embedded-form",frameBorder:"0",id:"freshwidget-embedded-form",src:i+u,scrolling:"no",height:o,width:"100%"}))}return e}()},{key:"render",value:function(){function e(){var e=this.props.type;if("incorporated"===e)return this.renderIncorporated();var t=f.default.Children.count(this.props.children)>=1;return t?this.renderWithChildren():this.renderPopUp()}return e}()}]),t}(p.Component);d.propTypes={url:p.PropTypes.string.isRequired,type:p.PropTypes.oneOf(["pop-up","incorporated"]),buttonType:p.PropTypes.oneOf(["text","image"]),buttonText:p.PropTypes.string,buttonColor:p.PropTypes.string,buttonBackgroundColor:p.PropTypes.string,buttonBackgroundImage:p.PropTypes.string,buttonPosition:p.PropTypes.oneOf(["left","right","top","bottom"]),buttonOffset:p.PropTypes.string,formTitle:p.PropTypes.string,submitThanks:p.PropTypes.string,formHeight:p.PropTypes.string,children:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.node),p.PropTypes.node])},d.defaultProps={type:"incorporated",formTitle:"Help and support",submitThanks:"Thank you, one of our representatives will respond to you soon! =)",formHeight:"500px",buttonType:"text",buttonText:"Support",buttonColor:"white",buttonBackgroundColor:"#015453",buttonPosition:"top",buttonOffset:"235px",children:null},t.default=d},function(t,r){t.exports=e}])}); |
{ | ||
"name": "@personare/react-freshdesk-widget", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A component of React for use the Freshdesk Widget", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-freshdesk-widget.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
364148