@pga/react-intercom
Advanced tools
Comparing version 0.1.8 to 0.2.1
@@ -6,4 +6,4 @@ # Change Log | ||
<a name="0.1.8"></a> | ||
## [0.1.8](https://github.com/pgahq/pga-common/compare/@pga/react-intercom@0.1.7...@pga/react-intercom@0.1.8) (2022-08-10) | ||
<a name="0.2.1"></a> | ||
## [0.2.1](https://github.com/pgahq/pga-common/compare/@pga/react-intercom@0.1.7...@pga/react-intercom@0.2.1) (2023-06-15) | ||
@@ -10,0 +10,0 @@ |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'babel-runtime/helpers/extends', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/inherits', 'react', 'react-router'], factory); | ||
define(['exports', 'babel-runtime/helpers/extends', 'babel-runtime/helpers/classCallCheck', 'babel-runtime/helpers/createClass', 'babel-runtime/helpers/possibleConstructorReturn', 'babel-runtime/helpers/inherits', 'react', 'react-router', './useIntercom'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('babel-runtime/helpers/extends'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/inherits'), require('react'), require('react-router')); | ||
factory(exports, require('babel-runtime/helpers/extends'), require('babel-runtime/helpers/classCallCheck'), require('babel-runtime/helpers/createClass'), require('babel-runtime/helpers/possibleConstructorReturn'), require('babel-runtime/helpers/inherits'), require('react'), require('react-router'), require('./useIntercom')); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global._extends, global.classCallCheck, global.createClass, global.possibleConstructorReturn, global.inherits, global.react, global.reactRouter); | ||
factory(mod.exports, global._extends, global.classCallCheck, global.createClass, global.possibleConstructorReturn, global.inherits, global.react, global.reactRouter, global.useIntercom); | ||
global.index = mod.exports; | ||
} | ||
})(this, function (exports, _extends2, _classCallCheck2, _createClass2, _possibleConstructorReturn2, _inherits2, _react, _reactRouter) { | ||
})(this, function (exports, _extends2, _classCallCheck2, _createClass2, _possibleConstructorReturn2, _inherits2, _react, _reactRouter, _useIntercom) { | ||
'use strict'; | ||
@@ -20,3 +20,3 @@ | ||
}); | ||
exports.Intercom = exports.IntercomAPI = undefined; | ||
exports.useIntercom = exports.Intercom = exports.IntercomAPI = undefined; | ||
@@ -35,2 +35,4 @@ var _extends3 = _interopRequireDefault(_extends2); | ||
var _useIntercom2 = _interopRequireDefault(_useIntercom); | ||
function _interopRequireDefault(obj) { | ||
@@ -102,2 +104,3 @@ return obj && obj.__esModule ? obj : { | ||
exports.default = (0, _reactRouter.withRouter)(Intercom); | ||
exports.useIntercom = _useIntercom2.default; | ||
}); |
{ | ||
"name": "@pga/react-intercom", | ||
"version": "0.1.8", | ||
"version": "0.2.1", | ||
"description": "React Intercom Component", | ||
@@ -12,2 +12,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@testing-library/react-hooks": "^5.1.3", | ||
"babel-cli": "^6.26.0", | ||
@@ -14,0 +15,0 @@ "babel-core": "^6.26.3", |
@@ -0,1 +1,2 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
import React from 'react' | ||
@@ -6,9 +7,22 @@ import { mount } from 'enzyme' | ||
describe('IntercomAPI', () => { | ||
it(`should call Intercom method with provided args`, () => { | ||
const objArg = { some: 'object' } | ||
beforeEach(() => { | ||
window.Intercom = jest.fn() | ||
}) | ||
IntercomAPI('boot', objArg) | ||
afterEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
expect(window.Intercom).toHaveBeenCalledWith('boot', objArg) | ||
it('should warn if Intercom is not initialized', () => { | ||
window.Intercom = undefined | ||
console.warn = jest.fn() | ||
IntercomAPI() | ||
expect(console.warn).toHaveBeenCalled() | ||
}) | ||
it('should call the Intercom API with custom arguments', () => { | ||
IntercomAPI('update', { key: 'value' }) | ||
expect(window.Intercom).toHaveBeenCalledWith('update', { key: 'value' }) | ||
}) | ||
}) | ||
@@ -15,0 +29,0 @@ |
import React from 'react' | ||
import { withRouter } from 'react-router' | ||
import useIntercom from './useIntercom' | ||
@@ -32,1 +33,3 @@ export const IntercomAPI = (...args) => { | ||
export default withRouter(Intercom) | ||
export { useIntercom } |
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
15232
10
312
0
17