Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rechat/sdk

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rechat/sdk - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

esm/index.all.d.ts

2

dist/rechat.min.js

@@ -1,1 +0,1 @@

var Rechat=function(t){"use strict";var n=function(){return n=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},n.apply(this,arguments)};function e(t,n,e,r){return new(e||(e=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(a,u)}c((r=r.apply(t,n||[])).next())}))}function r(t,n){var e,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(e=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(t,a)}catch(t){u=[6,t],r=0}finally{e=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}"function"==typeof SuppressedError&&SuppressedError;var o=function(){function t(t){this._settings=t}return t.prototype.capture=function(t,o){return e(this,void 0,void 0,(function(){return r(this,(function(e){return[2,new Promise((function(e,r){fetch("https://api.rechat.com/leads/channels/".concat(t.channel_id,"/webhook"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n(n({},o),{lead:t}))}).then((function(){return e()})).catch(r)}))]}))}))},t.prototype.form=function(t,e,r){var o=this;t.addEventListener("submit",(function(i){var a;i.preventDefault();var u=Object.values(t).reduce((function(t,e){var r;return e.name?n(n({},t),((r={})[e.name]=e.value,r)):t}),{});!1!==(null===(a=r.validate)||void 0===a?void 0:a.call(r,u))&&o.capture(e,u).then(r.onSuccess).catch(r.onError)}))},t}(),i=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=i,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 a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},e.apply(this,arguments)};function n(t,e,n,r){return new(n||(n=Promise))((function(a,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,u)}c((r=r.apply(t,e||[])).next())}))}function r(t,e){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&u[0]?r.return:u[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,u[1])).done)return a;switch(r=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=e.call(t,i)}catch(t){u=[6,t],r=0}finally{n=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}"function"==typeof SuppressedError&&SuppressedError;var a=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 a,o;return e(e({},n),((a={})[r]=null!==(o=t.get("rechat_".concat(r)))&&void 0!==o?o:"",a))}),{})},t.prototype.capture=function(t,a){return n(this,void 0,void 0,(function(){var n=this;return r(this,(function(r){return[2,new Promise((function(r,o){fetch("https://api.rechat.com/leads",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({lead:a,metadata:e(e({},n.getLeadMetaDataFromUrl()),t)})}).then((function(){return r()})).catch(o)}))]}))}))},t.prototype.form=function(t,n,r){var a=this;t.addEventListener("submit",(function(o){var i;o.preventDefault();var u=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,u))&&a.capture(n,u).then(r.onSuccess).catch(r.onError)}))},t}(),o=function(){function t(t){void 0===t&&(t={}),this._settings=t,this._leads=new a(t)}return Object.defineProperty(t.prototype,"Leads",{get:function(){return this._leads},enumerable:!1,configurable:!0}),t}();return t.Sdk=o,t}({});
{
"name": "@rechat/sdk",
"version": "0.1.5",
"version": "0.2.0",
"description": "",
"main": "index.js",
"scripts": {
"clean:sdk": "rimraf umd",
"clean:sdk": "rimraf umd && rimraf esm",
"clean:docs": "rimraf api",

@@ -16,2 +16,4 @@ "build:docs": "npm run clean:docs && typedoc --readme README.md && npm run docs:examples",

"license": "ISC",
"homepage": "https://rechat.com",
"readmeFilename": "README.md",
"publishConfig": {

@@ -39,2 +41,4 @@ "access": "public"

"type": "module",
"typings": "esm/index.all.d.ts",
"module": "esm/index.all.js",
"unpkg": "dist/rechat.min.js",

@@ -44,2 +48,3 @@ "sideEffects": false,

"dist",
"esm",
"LICENSE",

@@ -46,0 +51,0 @@ "README"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc