New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cpa-integration

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpa-integration - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

build/CpaIntegration.d.ts

7

build/index.d.ts

@@ -1,3 +0,4 @@

export * from "./PrimeLead";
export * from "./SalesDoubler";
export * from "./LeadFactory";
export * from "./CpaIntegration";
export * from "./LeadInterface";
export * from "./ParserInterface";
export * from "./SalesDoublerParser";
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
module.exports = factory(require("axios"));
else if(typeof define === 'function' && define.amd)
define([], factory);
define(["axios"], factory);
else if(typeof exports === 'object')
exports["cpa-integration"] = factory();
exports["cpa-integration"] = factory(require("axios"));
else
root["cpa-integration"] = factory();
})(this, function() {
root["cpa-integration"] = factory(root["axios"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_axios__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -78,3 +78,3 @@ /******/ // The module cache

/***/ "./src/AbstractLead.ts":
/***/ "./src/CpaIntegration.ts":
/***/ (function(module, exports, __webpack_require__) {

@@ -88,210 +88,96 @@

});
exports.CpaIntegration = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _axios = __webpack_require__("axios");
var AbstractLead = exports.AbstractLead = function () {
function AbstractLead() {
_classCallCheck(this, AbstractLead);
}
var _axios2 = _interopRequireDefault(_axios);
_createClass(AbstractLead, [{
key: "url",
get: function get() {
var data = this.data;
return Object.keys(data).map(function (key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(data[key]);
}).join("&");
}
}, {
key: "cookie",
get: function get() {
return JSON.stringify(this.data);
}
}]);
var _SalesDoublerParser = __webpack_require__("./src/SalesDoublerParser.ts");
return AbstractLead;
}();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ }),
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/***/ "./src/AbstractLeadFactory.ts":
/***/ (function(module, exports, __webpack_require__) {
var CpaIntegration = exports.CpaIntegration = function () {
function CpaIntegration(url) {
_classCallCheck(this, CpaIntegration);
"use strict";
this.url = url;
}
_createClass(CpaIntegration, [{
key: "onLoad",
value: function onLoad(url) {
var lead = void 0;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
Object.defineProperty(exports, "__esModule", {
value: true
});
try {
for (var _iterator = CpaIntegration.parsers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var parser = _step.value;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
lead = parser(url.searchParams);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var AbstractLeadFactory = exports.AbstractLeadFactory = function AbstractLeadFactory() {
var _this = this;
_classCallCheck(this, AbstractLeadFactory);
this.fromUrl = function (url) {
var search = url.split("?")[1];
if (search === undefined) {
return undefined;
if (!lead) {
return;
}
localStorage.setItem(CpaIntegration.localStorageKey, JSON.stringify(lead));
}
var searchParams = new URLSearchParams(search);
return _this.fromQuery(searchParams);
};
this.fromCookie = function (cookie) {
var object = void 0;
try {
object = JSON.parse(cookie);
} catch (exception) {
return undefined;
}, {
key: "onLogin",
value: function onLogin() {
var lead = this.lead;
_axios2.default.post(this.url(lead.source), {
Lead: lead.config
}).then(function () {
return localStorage.removeItem(CpaIntegration.localStorageKey);
});
}
object.get = function (key) {
return object[key];
};
return _this.fromQuery(object);
};
};
/***/ }),
/***/ "./src/LeadFactory.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LeadFactory = undefined;
var _PrimeLeadLeadFactory = __webpack_require__("./src/PrimeLead/PrimeLeadLeadFactory.ts");
var _SalesDoublerLeadFactory = __webpack_require__("./src/SalesDoubler/SalesDoublerLeadFactory.ts");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var LeadFactory = exports.LeadFactory = function LeadFactory(factories) {
var _this = this;
_classCallCheck(this, LeadFactory);
this.fromUrl = function (url) {
return _this.factories.reduce(function (lead, factory) {
return lead || factory.fromUrl(url);
}, undefined);
};
this.fromCookie = function (cookie) {
return _this.factories.reduce(function (lead, factory) {
return lead || factory.fromCookie(cookie);
}, undefined);
};
if (factories === undefined) {
factories = [new _SalesDoublerLeadFactory.SalesDoublerLeadFactory(), new _PrimeLeadLeadFactory.PrimeLeadLeadFactory()];
}
this.factories = factories;
};
/***/ }),
/***/ "./src/PrimeLead/PrimeLeadLead.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PrimeLeadLead = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _PrimeLeadData = __webpack_require__("./src/data/PrimeLeadData.ts");
var _AbstractLead2 = __webpack_require__("./src/AbstractLead.ts");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var PrimeLeadLead = exports.PrimeLeadLead = function (_AbstractLead) {
_inherits(PrimeLeadLead, _AbstractLead);
function PrimeLeadLead(transactionId) {
_classCallCheck(this, PrimeLeadLead);
var _this = _possibleConstructorReturn(this, (PrimeLeadLead.__proto__ || Object.getPrototypeOf(PrimeLeadLead)).call(this));
_this.transactionId = transactionId;
return _this;
}
_createClass(PrimeLeadLead, [{
key: "data",
}, {
key: "lead",
get: function get() {
return _defineProperty({
utm_source: _PrimeLeadData.utmSource
}, _PrimeLeadData.transactionIdParam, this.transactionId);
var ls = localStorage.getItem(CpaIntegration.localStorageKey);
var lead = void 0;
try {
lead = JSON.parse(ls);
if ("object" !== (typeof lead === "undefined" ? "undefined" : _typeof(lead)) || !lead.hasOwnProperty("source") || !lead.hasOwnProperty("config")) {
localStorage.removeItem(CpaIntegration.localStorageKey);
return;
}
} catch (_a) {
return;
}
return lead;
}
}]);
return PrimeLeadLead;
}(_AbstractLead2.AbstractLead);
return CpaIntegration;
}();
/***/ }),
CpaIntegration.localStorageKey = "bobra.lead";
CpaIntegration.parsers = [_SalesDoublerParser.SalesDoublerParser];
/***/ "./src/PrimeLead/PrimeLeadLeadFactory.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PrimeLeadLeadFactory = undefined;
var _AbstractLeadFactory2 = __webpack_require__("./src/AbstractLeadFactory.ts");
var _PrimeLeadLead = __webpack_require__("./src/PrimeLead/PrimeLeadLead.ts");
var _PrimeLeadData = __webpack_require__("./src/data/PrimeLeadData.ts");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var PrimeLeadLeadFactory = exports.PrimeLeadLeadFactory = function (_AbstractLeadFactory) {
_inherits(PrimeLeadLeadFactory, _AbstractLeadFactory);
function PrimeLeadLeadFactory() {
_classCallCheck(this, PrimeLeadLeadFactory);
var _this = _possibleConstructorReturn(this, (PrimeLeadLeadFactory.__proto__ || Object.getPrototypeOf(PrimeLeadLeadFactory)).apply(this, arguments));
_this.fromQuery = function (query) {
if (query.get("utm_source") !== _PrimeLeadData.utmSource || !query.get(_PrimeLeadData.transactionIdParam)) {
return undefined;
}
return new _PrimeLeadLead.PrimeLeadLead(query.get(_PrimeLeadData.transactionIdParam));
};
return _this;
}
return PrimeLeadLeadFactory;
}(_AbstractLeadFactory2.AbstractLeadFactory);
/***/ }),
/***/ "./src/PrimeLead/index.ts":
/***/ "./src/SalesDoublerParser.ts":
/***/ (function(module, exports, __webpack_require__) {

@@ -303,83 +189,20 @@

Object.defineProperty(exports, "__esModule", {
value: true
});
var _PrimeLeadLead = __webpack_require__("./src/PrimeLead/PrimeLeadLead.ts");
Object.keys(_PrimeLeadLead).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _PrimeLeadLead[key];
}
});
});
var _PrimeLeadLeadFactory = __webpack_require__("./src/PrimeLead/PrimeLeadLeadFactory.ts");
Object.keys(_PrimeLeadLeadFactory).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _PrimeLeadLeadFactory[key];
}
});
});
/***/ }),
/***/ "./src/SalesDoubler/SalesDoublerLead.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SalesDoublerLead = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _SalesDoublerData = __webpack_require__("./src/data/SalesDoublerData.ts");
var _AbstractLead2 = __webpack_require__("./src/AbstractLead.ts");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var SalesDoublerLead = exports.SalesDoublerLead = function (_AbstractLead) {
_inherits(SalesDoublerLead, _AbstractLead);
function SalesDoublerLead(clickId) {
_classCallCheck(this, SalesDoublerLead);
var _this = _possibleConstructorReturn(this, (SalesDoublerLead.__proto__ || Object.getPrototypeOf(SalesDoublerLead)).call(this));
_this.clickId = clickId;
return _this;
var SalesDoublerParser = exports.SalesDoublerParser = function SalesDoublerParser(params) {
if (params.get("utm_source") !== "cpanet_salesdoubler" && !params.has("aff_sub")) {
return;
}
_createClass(SalesDoublerLead, [{
key: "data",
get: function get() {
return _defineProperty({
utm_source: _SalesDoublerData.utmSource
}, _SalesDoublerData.clickIdParam, this.clickId);
return {
source: "sales-douber",
config: {
clickId: params.get("aff_sub"),
aid: params.get("utm_campaign")
}
}]);
};
};
return SalesDoublerLead;
}(_AbstractLead2.AbstractLead);
/***/ }),
/***/ "./src/SalesDoubler/SalesDoublerLeadFactory.ts":
/***/ "./src/index.ts":
/***/ (function(module, exports, __webpack_require__) {

@@ -391,53 +214,8 @@

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SalesDoublerLeadFactory = undefined;
var _AbstractLeadFactory2 = __webpack_require__("./src/AbstractLeadFactory.ts");
var _SalesDoublerLead = __webpack_require__("./src/SalesDoubler/SalesDoublerLead.ts");
var _SalesDoublerData = __webpack_require__("./src/data/SalesDoublerData.ts");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var SalesDoublerLeadFactory = exports.SalesDoublerLeadFactory = function (_AbstractLeadFactory) {
_inherits(SalesDoublerLeadFactory, _AbstractLeadFactory);
function SalesDoublerLeadFactory() {
_classCallCheck(this, SalesDoublerLeadFactory);
var _this = _possibleConstructorReturn(this, (SalesDoublerLeadFactory.__proto__ || Object.getPrototypeOf(SalesDoublerLeadFactory)).apply(this, arguments));
_this.fromQuery = function (query) {
if (!query.get(_SalesDoublerData.clickIdParam) || query.get("utm_source") !== _SalesDoublerData.utmSource) {
return undefined;
}
return new _SalesDoublerLead.SalesDoublerLead(query.get(_SalesDoublerData.clickIdParam));
};
return _this;
}
return SalesDoublerLeadFactory;
}(_AbstractLeadFactory2.AbstractLeadFactory);
/***/ }),
/***/ "./src/SalesDoubler/index.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _SalesDoublerLead = __webpack_require__("./src/SalesDoubler/SalesDoublerLead.ts");
var _CpaIntegration = __webpack_require__("./src/CpaIntegration.ts");
Object.keys(_SalesDoublerLead).forEach(function (key) {
Object.keys(_CpaIntegration).forEach(function (key) {
if (key === "default" || key === "__esModule") return;

@@ -447,3 +225,3 @@ Object.defineProperty(exports, key, {

get: function get() {
return _SalesDoublerLead[key];
return _CpaIntegration[key];
}

@@ -453,5 +231,5 @@ });

var _SalesDoublerLeadFactory = __webpack_require__("./src/SalesDoubler/SalesDoublerLeadFactory.ts");
var _SalesDoublerParser = __webpack_require__("./src/SalesDoublerParser.ts");
Object.keys(_SalesDoublerLeadFactory).forEach(function (key) {
Object.keys(_SalesDoublerParser).forEach(function (key) {
if (key === "default" || key === "__esModule") return;

@@ -461,3 +239,3 @@ Object.defineProperty(exports, key, {

get: function get() {
return _SalesDoublerLeadFactory[key];
return _SalesDoublerParser[key];
}

@@ -469,84 +247,15 @@ });

/***/ "./src/data/PrimeLeadData.ts":
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("./src/index.ts");
Object.defineProperty(exports, "__esModule", {
value: true
});
var utmSource = exports.utmSource = "primelead";
var transactionIdParam = exports.transactionIdParam = "transaction_id";
/***/ }),
/***/ "./src/data/SalesDoublerData.ts":
/***/ (function(module, exports, __webpack_require__) {
/***/ "axios":
/***/ (function(module, exports) {
"use strict";
module.exports = require("axios");
Object.defineProperty(exports, "__esModule", {
value: true
});
var clickIdParam = exports.clickIdParam = "aff_sub";
var utmSource = exports.utmSource = "salesdoubler";
/***/ }),
/***/ "./src/index.ts":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _PrimeLead = __webpack_require__("./src/PrimeLead/index.ts");
Object.keys(_PrimeLead).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _PrimeLead[key];
}
});
});
var _SalesDoubler = __webpack_require__("./src/SalesDoubler/index.ts");
Object.keys(_SalesDoubler).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _SalesDoubler[key];
}
});
});
var _LeadFactory = __webpack_require__("./src/LeadFactory.ts");
Object.keys(_LeadFactory).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _LeadFactory[key];
}
});
});
/***/ }),
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__("./src/index.ts");
/***/ })

@@ -553,0 +262,0 @@

{
"name": "cpa-integration",
"version": "1.0.0",
"version": "2.0.0",
"description": "CPA Networks integration",

@@ -40,2 +40,3 @@ "private": false,

"awesome-typescript-loader": "^3.2.2",
"axios": "^0.18.0",
"babel-core": "^6.25.0",

@@ -65,3 +66,3 @@ "babel-loader": "^7.1.1",

"peerDependencies": {
"url-search-params-polyfill": "^2.0.1"
"axios": "^0.18.0"
},

@@ -68,0 +69,0 @@ "nyc": {

@@ -7,2 +7,9 @@ # CPA Integration

Front-end adaptation of [PHP Library](https://github.com/wearesho-team/cpa-integration)
## Installation
Using npm
```bash
npm i --save cpa-integration
```
## License
[MIT](./LICENSE)

@@ -9,2 +9,3 @@ {

"no-reference": true,
"array-type": false,
"curly": true,

@@ -11,0 +12,0 @@ "await-promise": true,

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