UNPKG

@satisfactor/web-integration-angular

Version:

This package helps you integrate the satisfaction survey into any website implemented in angular

16 lines (14 loc) 3.66 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("@satisfactor/web-integration-angular",["exports","@angular/core"],t):t(((e=e||self).satisfactor=e.satisfactor||{},e.satisfactor["web-integration-angular"]={}),e.ng.core)}(this,(function(e,t){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function n(e,t,n,o){var r,i=arguments.length,s=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(i<3?r(s):i>3?r(t,n,s):r(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}var o=function(){function e(){}return e.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e=n([t.Injectable({providedIn:"root"})],e)}(),r=function(){function e(e,t,n,o,r){this.id=e,this.name=void 0!==t?t:null,this.email=void 0!==n?n:null,this.cellPhone=void 0!==o?o:null,this.company=void 0!==r?r:null}return e.prototype.isValid=function(){return void 0!==this.id},e}(),i=function(){function e(){}return e.prototype.loadScript=function(){if(console.log(this.userSurvey),console.log(this.projectToken),this.userSurvey instanceof r&&this.userSurvey.isValid()){var e=document.createElement("script");e.type="text/javascript",e.innerHTML='!function(){window.satisfactor=window.satisfactor||function(){(window.satisfactor.value=window.satisfactor.value||[]).push(arguments)};var e=document.createElement("script"),t=document.getElementsByTagName("script")[0].parentNode;e.async=1,e.src="https://app.satisfactor.io/js/nps.min.js",t.appendChild(e);var s=document.createElement("link"),a=document.getElementsByTagName("head")[0];s.type="text/css",s.rel="stylesheet",s.href="https://app.satisfactor.io/css/nps.min.css",a.appendChild(s)}();\n satisfactor({\n token: "'+this.projectToken+'",\n userId: "'+this.userSurvey.id+'",\n traits: {\n name: "'+this.userSurvey.name+'",\n email: "'+this.userSurvey.email+'",\n cell_phone: "'+this.userSurvey.cellPhone+'",\n company: "'+this.userSurvey.company+'"\n }\n });',document.getElementsByTagName("body")[0].appendChild(e)}},e.prototype.ngOnInit=function(){this.loadScript()},n([t.Input()],e.prototype,"userSurvey",void 0),n([t.Input()],e.prototype,"projectToken",void 0),e=n([t.Component({selector:"satisfactor",template:""})],e)}(),s=function(){function e(){}return e=n([t.NgModule({declarations:[i],imports:[],exports:[i]})],e)}();e.SatisfactorComponent=i,e.SatisfactorModule=s,e.SatisfactorService=o,e.UserSurveyModel=r,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=satisfactor-web-integration-angular.umd.min.js.map