@rechat/sdk
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -1,1 +0,1 @@ | ||
var Rechat=function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var o=function(){function t(t){this._settings=t}return t.prototype.getLeadMetaDataFromUrl=function(){var t=new URLSearchParams(window.location.search);return["user_id","brand_id","ad_campaign_id","email_campaign_id"].reduce((function(n,r){var o,a;return e(e({},n),((o={})[r]=null!==(a=t.get("rechat_".concat(r)))&&void 0!==a?a:"",o))}),{})},Object.defineProperty(t.prototype,"ApiUrl",{get:function(){return"https://".concat(this._settings.sandbox?"boer.":"","api.rechat.com")},enumerable:!1,configurable:!0}),t.prototype.capture=function(t,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){fetch("".concat(n.ApiUrl,"/leads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({lead:o,metadata:e(e({},n.getLeadMetaDataFromUrl()),t)})}).then((function(t){return t.ok?r():Promise.reject(t)})).catch(a)}))]}))}))},t.prototype.form=function(t,n,r){var o=this;t.addEventListener("submit",(function(a){var i;a.preventDefault();var c=Object.values(t).reduce((function(t,n){var r;return n.name?e(e({},t),((r={})[n.name]=n.value,r)):t}),{});!1!==(null===(i=r.validate)||void 0===i?void 0:i.call(r,c))&&o.capture(n,c).then(r.onSuccess).catch(r.onError)}))},t}(),a=function(){function t(t){void 0===t&&(t={}),this._settings=t,this._leads=new o(t)}return Object.defineProperty(t.prototype,"Leads",{get:function(){return this._leads},enumerable:!1,configurable:!0}),t}();return t.Sdk=a,t}({}); | ||
var Rechat=function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var o=function(){function t(t){this._settings=t}return t.prototype.getLeadMetaDataFromUrl=function(){var t=new URLSearchParams(window.location.search);return["user_id","brand_id","ad_campaign_id","email_campaign_id"].reduce((function(n,r){var o,a;return e(e({},n),((o={})[r]=null!==(a=t.get("rechat_".concat(r)))&&void 0!==a?a:"",o))}),{})},Object.defineProperty(t.prototype,"ApiUrl",{get:function(){return"https://".concat(this._settings.sandbox?"boer.":"","api.rechat.com")},enumerable:!1,configurable:!0}),t.prototype.capture=function(t,o){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,a){fetch("".concat(n.ApiUrl,"/leads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({lead:o,metadata:e(e({},n.getLeadMetaDataFromUrl()),t)})}).then((function(t){return t.ok?r():a(t)}))}))]}))}))},t.prototype.form=function(t,n,r){var o=this;t.addEventListener("submit",(function(a){var i;a.preventDefault();var c=Object.values(t).reduce((function(t,n){var r;return n.name?e(e({},t),((r={})[n.name]=n.value,r)):t}),{});!1!==(null===(i=r.validate)||void 0===i?void 0:i.call(r,c))&&o.capture(n,c).then(r.onSuccess).catch(r.onError)}))},t}(),a=function(){function t(t){void 0===t&&(t={}),this._settings=t,this._leads=new o(t)}return Object.defineProperty(t.prototype,"Leads",{get:function(){return this._leads},enumerable:!1,configurable:!0}),t}();return t.Sdk=a,t}({}); |
@@ -1,1 +0,1 @@ | ||
var t=function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},t.apply(this,arguments)};function e(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var r=function(){function r(t){this._settings=t}return r.prototype.getLeadMetaDataFromUrl=function(){var e=new URLSearchParams(window.location.search);return["user_id","brand_id","ad_campaign_id","email_campaign_id"].reduce((function(n,r){var o,a;return t(t({},n),((o={})[r]=null!==(a=e.get("rechat_".concat(r)))&&void 0!==a?a:"",o))}),{})},Object.defineProperty(r.prototype,"ApiUrl",{get:function(){return"https://".concat(this._settings.sandbox?"boer.":"","api.rechat.com")},enumerable:!1,configurable:!0}),r.prototype.capture=function(r,o){return e(this,void 0,void 0,(function(){var e=this;return n(this,(function(n){return[2,new Promise((function(n,a){fetch("".concat(e.ApiUrl,"/leads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({lead:o,metadata:t(t({},e.getLeadMetaDataFromUrl()),r)})}).then((function(t){return t.ok?n():Promise.reject(t)})).catch(a)}))]}))}))},r.prototype.form=function(e,n,r){var o=this;e.addEventListener("submit",(function(a){var i;a.preventDefault();var c=Object.values(e).reduce((function(e,n){var r;return n.name?t(t({},e),((r={})[n.name]=n.value,r)):e}),{});!1!==(null===(i=r.validate)||void 0===i?void 0:i.call(r,c))&&o.capture(n,c).then(r.onSuccess).catch(r.onError)}))},r}(),o=function(){function t(t){void 0===t&&(t={}),this._settings=t,this._leads=new r(t)}return Object.defineProperty(t.prototype,"Leads",{get:function(){return this._leads},enumerable:!1,configurable:!0}),t}();export{r as LeadCapture,o as Sdk}; | ||
var t=function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},t.apply(this,arguments)};function e(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var r=function(){function r(t){this._settings=t}return r.prototype.getLeadMetaDataFromUrl=function(){var e=new URLSearchParams(window.location.search);return["user_id","brand_id","ad_campaign_id","email_campaign_id"].reduce((function(n,r){var o,a;return t(t({},n),((o={})[r]=null!==(a=e.get("rechat_".concat(r)))&&void 0!==a?a:"",o))}),{})},Object.defineProperty(r.prototype,"ApiUrl",{get:function(){return"https://".concat(this._settings.sandbox?"boer.":"","api.rechat.com")},enumerable:!1,configurable:!0}),r.prototype.capture=function(r,o){return e(this,void 0,void 0,(function(){var e=this;return n(this,(function(n){return[2,new Promise((function(n,a){fetch("".concat(e.ApiUrl,"/leads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({lead:o,metadata:t(t({},e.getLeadMetaDataFromUrl()),r)})}).then((function(t){return t.ok?n():a(t)}))}))]}))}))},r.prototype.form=function(e,n,r){var o=this;e.addEventListener("submit",(function(a){var i;a.preventDefault();var c=Object.values(e).reduce((function(e,n){var r;return n.name?t(t({},e),((r={})[n.name]=n.value,r)):e}),{});!1!==(null===(i=r.validate)||void 0===i?void 0:i.call(r,c))&&o.capture(n,c).then(r.onSuccess).catch(r.onError)}))},r}(),o=function(){function t(t){void 0===t&&(t={}),this._settings=t,this._leads=new r(t)}return Object.defineProperty(t.prototype,"Leads",{get:function(){return this._leads},enumerable:!1,configurable:!0}),t}();export{r as LeadCapture,o as Sdk}; |
{ | ||
"name": "@rechat/sdk", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.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
10202
75