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

@pinwheel/react-modal

Package Overview
Dependencies
Maintainers
47
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinwheel/react-modal - npm Package Compare versions

Comparing version 2.3.6 to 2.3.7

20

dist/index.d.ts
/// <reference types="react" />
export declare const SDK_VERSION: SemverObject;
export declare type LinkResult = {
export type LinkResult = {
accountId: string;

@@ -16,3 +16,3 @@ job: string;

*/
export declare type ErrorType = 'clientError' | 'systemError' | 'networkError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken';
export type ErrorType = 'clientError' | 'systemError' | 'networkError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken';
/**

@@ -22,3 +22,3 @@ * @deprecated The type should not be used as it clashes with the native JS `Error` object.

*/
export declare type Error = {
export type Error = {
type: PinwheelErrorType;

@@ -29,6 +29,6 @@ code: string;

};
export declare type PinwheelErrorType = ErrorType;
export declare type PinwheelError = Error;
export declare type EmptyPayloadObject = Record<string, never>;
export declare type EventPayload = {
export type PinwheelErrorType = ErrorType;
export type PinwheelError = Error;
export type EmptyPayloadObject = Record<string, never>;
export type EventPayload = {
selectedEmployerId: string;

@@ -48,3 +48,3 @@ selectedEmployerName: string;

} | PinwheelError | EmptyPayloadObject | undefined;
export declare type SemverObject = {
export type SemverObject = {
major: number;

@@ -55,3 +55,3 @@ minor: number;

declare const EVENT_NAMES: readonly ["open", "select_employer", "select_platform", "incorrect_platform_given", "login_attempt", "login", "input_amount", "exit", "success", "error"];
export declare type EventName = typeof EVENT_NAMES[number];
export type EventName = typeof EVENT_NAMES[number];
interface PinwheelPublicOpenOptions {

@@ -68,3 +68,3 @@ linkToken: string;

}
export declare type PinwheelModalProps = PinwheelPublicOpenOptions & {
export type PinwheelModalProps = PinwheelPublicOpenOptions & {
open?: boolean;

@@ -71,0 +71,0 @@ _srcUrl?: string;

@@ -0,114 +1,115 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
return target;
};
return _extends.apply(this, arguments);
n.default = e;
return Object.freeze(n);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
/******************************************************************************
Copyright (c) Microsoft Corporation.
return target;
}
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
var _require$version$spli = require('../package.json').version.split('.').map(Number),
major = _require$version$spli[0],
minor = _require$version$spli[1],
patch = _require$version$spli[2];
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var SDK_VERSION = {
major: major,
minor: minor,
patch: patch
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var addScriptTag = function addScriptTag(loadCb, url) {
var tag = document.createElement('script');
tag.async = true;
tag.type = 'application/javascript';
tag.src = url || "https://cdn.getpinwheel.com/pinwheel-v" + major + "." + minor + ".js";
document.body.appendChild(tag);
tag.addEventListener('load', function () {
return loadCb();
});
return tag;
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
var PinwheelModal = function PinwheelModal(_ref) {
var open = _ref.open,
_srcUrl = _ref._srcUrl,
_modalSessionIdOverride = _ref._modalSessionIdOverride,
props = _objectWithoutPropertiesLoose(_ref, ["open", "_srcUrl", "_modalSessionIdOverride"]);
var _React$useState = React.useState(false),
loaded = _React$useState[0],
setLoaded = _React$useState[1];
var _React$useState2 = React.useState(false),
showing = _React$useState2[0],
setShowing = _React$useState2[1];
var _React$useState3 = React.useState(),
tag = _React$useState3[0],
setTag = _React$useState3[1];
React.useEffect(function () {
delete window['Pinwheel'];
setLoaded(false);
var els = document.querySelectorAll('.pinwheel-portal');
els.forEach(function (e) {
var _e$parentNode;
return (_e$parentNode = e.parentNode) === null || _e$parentNode === void 0 ? void 0 : _e$parentNode.removeChild(e);
});
var newTag = addScriptTag(function () {
return setLoaded(true);
}, _srcUrl);
setTag(newTag);
}, [_srcUrl, setLoaded]);
React.useEffect(function () {
if (tag && tag.parentNode) tag.parentNode.removeChild(tag);
}, [_srcUrl]);
React.useEffect(function () {
if (!loaded) return;
if (open && !showing) {
Pinwheel.open(_extends({}, props, {
_versionOverride: SDK_VERSION,
_sdkOverride: 'react',
_modalSessionIdOverride: _modalSessionIdOverride
}));
setShowing(true);
} else if (!open && showing) {
Pinwheel.close();
setShowing(false);
}
}, [open, showing, setShowing, loaded]);
return React.createElement("div", null);
// import pck from '../package.json'
var _a = [2, 3, 6], major = _a[0], minor = _a[1], patch = _a[2]; // (pck.version as string).split('.').map(Number)
var SDK_VERSION = { major: major, minor: minor, patch: patch };
// eslint-disable-next-line @typescript-eslint/ban-types
var addScriptTag = function (loadCb, url) {
var tag = document.createElement('script');
tag.async = true;
tag.type = 'application/javascript';
tag.src = url || "https://cdn.getpinwheel.com/pinwheel-v".concat(major, ".").concat(minor, ".js");
document.body.appendChild(tag);
tag.addEventListener('load', function () { return loadCb(); });
return tag;
};
var PinwheelModal = function (_a) {
var open = _a.open, _srcUrl = _a._srcUrl,
// @ts-ignore
_modalSessionIdOverride = _a._modalSessionIdOverride, props = __rest(_a, ["open", "_srcUrl", "_modalSessionIdOverride"]);
var _b = React__namespace.useState(false), loaded = _b[0], setLoaded = _b[1];
var _c = React__namespace.useState(false), showing = _c[0], setShowing = _c[1];
var _d = React__namespace.useState(), tag = _d[0], setTag = _d[1];
React__namespace.useEffect(function () {
// eslint-disable-next-line dot-notation
delete window['Pinwheel'];
setLoaded(false);
var els = document.querySelectorAll('.pinwheel-portal');
els.forEach(function (e) { var _a; return (_a = e.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(e); });
var newTag = addScriptTag(function () { return setLoaded(true); }, _srcUrl);
setTag(newTag);
}, [_srcUrl, setLoaded]);
React__namespace.useEffect(function () {
if (tag && tag.parentNode)
tag.parentNode.removeChild(tag);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [_srcUrl]);
React__namespace.useEffect(function () {
if (!loaded)
return;
if (open && !showing) {
Pinwheel.open(__assign(__assign({ _versionOverride: SDK_VERSION, _sdkOverride: 'react' }, props), { _modalSessionIdOverride: _modalSessionIdOverride }));
setShowing(true);
}
else if (!open && showing) {
Pinwheel.close();
setShowing(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open, showing, setShowing, loaded]);
return React__namespace.createElement("div", null);
};
exports.SDK_VERSION = SDK_VERSION;
exports.default = PinwheelModal;
//# sourceMappingURL=index.js.map

@@ -1,114 +0,91 @@

import { useState, useEffect, createElement } from 'react';
import * as React from 'react';
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
/******************************************************************************
Copyright (c) Microsoft Corporation.
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
return target;
};
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
return _extends.apply(this, arguments);
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
var _require$version$spli = require('../package.json').version.split('.').map(Number),
major = _require$version$spli[0],
minor = _require$version$spli[1],
patch = _require$version$spli[2];
var SDK_VERSION = {
major: major,
minor: minor,
patch: patch
// import pck from '../package.json'
var _a = [2, 3, 6], major = _a[0], minor = _a[1], patch = _a[2]; // (pck.version as string).split('.').map(Number)
var SDK_VERSION = { major: major, minor: minor, patch: patch };
// eslint-disable-next-line @typescript-eslint/ban-types
var addScriptTag = function (loadCb, url) {
var tag = document.createElement('script');
tag.async = true;
tag.type = 'application/javascript';
tag.src = url || "https://cdn.getpinwheel.com/pinwheel-v".concat(major, ".").concat(minor, ".js");
document.body.appendChild(tag);
tag.addEventListener('load', function () { return loadCb(); });
return tag;
};
var addScriptTag = function addScriptTag(loadCb, url) {
var tag = document.createElement('script');
tag.async = true;
tag.type = 'application/javascript';
tag.src = url || "https://cdn.getpinwheel.com/pinwheel-v" + major + "." + minor + ".js";
document.body.appendChild(tag);
tag.addEventListener('load', function () {
return loadCb();
});
return tag;
var PinwheelModal = function (_a) {
var open = _a.open, _srcUrl = _a._srcUrl,
// @ts-ignore
_modalSessionIdOverride = _a._modalSessionIdOverride, props = __rest(_a, ["open", "_srcUrl", "_modalSessionIdOverride"]);
var _b = React.useState(false), loaded = _b[0], setLoaded = _b[1];
var _c = React.useState(false), showing = _c[0], setShowing = _c[1];
var _d = React.useState(), tag = _d[0], setTag = _d[1];
React.useEffect(function () {
// eslint-disable-next-line dot-notation
delete window['Pinwheel'];
setLoaded(false);
var els = document.querySelectorAll('.pinwheel-portal');
els.forEach(function (e) { var _a; return (_a = e.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(e); });
var newTag = addScriptTag(function () { return setLoaded(true); }, _srcUrl);
setTag(newTag);
}, [_srcUrl, setLoaded]);
React.useEffect(function () {
if (tag && tag.parentNode)
tag.parentNode.removeChild(tag);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [_srcUrl]);
React.useEffect(function () {
if (!loaded)
return;
if (open && !showing) {
Pinwheel.open(__assign(__assign({ _versionOverride: SDK_VERSION, _sdkOverride: 'react' }, props), { _modalSessionIdOverride: _modalSessionIdOverride }));
setShowing(true);
}
else if (!open && showing) {
Pinwheel.close();
setShowing(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open, showing, setShowing, loaded]);
return React.createElement("div", null);
};
var PinwheelModal = function PinwheelModal(_ref) {
var open = _ref.open,
_srcUrl = _ref._srcUrl,
_modalSessionIdOverride = _ref._modalSessionIdOverride,
props = _objectWithoutPropertiesLoose(_ref, ["open", "_srcUrl", "_modalSessionIdOverride"]);
var _React$useState = useState(false),
loaded = _React$useState[0],
setLoaded = _React$useState[1];
var _React$useState2 = useState(false),
showing = _React$useState2[0],
setShowing = _React$useState2[1];
var _React$useState3 = useState(),
tag = _React$useState3[0],
setTag = _React$useState3[1];
useEffect(function () {
delete window['Pinwheel'];
setLoaded(false);
var els = document.querySelectorAll('.pinwheel-portal');
els.forEach(function (e) {
var _e$parentNode;
return (_e$parentNode = e.parentNode) === null || _e$parentNode === void 0 ? void 0 : _e$parentNode.removeChild(e);
});
var newTag = addScriptTag(function () {
return setLoaded(true);
}, _srcUrl);
setTag(newTag);
}, [_srcUrl, setLoaded]);
useEffect(function () {
if (tag && tag.parentNode) tag.parentNode.removeChild(tag);
}, [_srcUrl]);
useEffect(function () {
if (!loaded) return;
if (open && !showing) {
Pinwheel.open(_extends({}, props, {
_versionOverride: SDK_VERSION,
_sdkOverride: 'react',
_modalSessionIdOverride: _modalSessionIdOverride
}));
setShowing(true);
} else if (!open && showing) {
Pinwheel.close();
setShowing(false);
}
}, [open, showing, setShowing, loaded]);
return createElement("div", null);
};
export default PinwheelModal;
export { SDK_VERSION };
//# sourceMappingURL=index.modern.js.map
export { SDK_VERSION, PinwheelModal as default };
{
"name": "@pinwheel/react-modal",
"version": "2.3.6",
"version": "2.3.7",
"description": "React package for Pinwheel modal",

@@ -15,10 +15,6 @@ "author": "roscioli",

"scripts": {
"build": "microbundle-crl --no-compress --format modern,cjs",
"start": "microbundle-crl watch --no-compress --format modern,cjs",
"prepare": "run-s build",
"test": "run-s test:unit test:lint test:build",
"test:build": "run-s build",
"test:lint": "eslint .",
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"lint": "eslint src --ext .ts,.tsx",
"start": "cd example && npm install && npm run start",
"test": "cd example && npm install && npm run test",
"predeploy": "cd example && npm install && npm run build",

@@ -31,3 +27,9 @@ "deploy": "gh-pages -d example/build"

"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@pinwheel/eslint-config": "^1.0.0-alpha.2",
"@rollup/plugin-typescript": "^10.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^9.5.0",

@@ -39,24 +41,18 @@ "@testing-library/user-event": "^7.2.1",

"@types/react-dom": "^17.0.9",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.7.0",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.2.0",
"microbundle-crl": "^0.13.10",
"npm-run-all": "^4.1.5",
"css-loader": "^6.7.2",
"eslint": "^8.28.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"prettier": "^2.0.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^3.4.1",
"typescript": "^3.7.5"
"rollup": "^3.5.0",
"rollup-plugin-import-css": "^3.1.0",
"style-loader": "^3.3.1",
"ts-loader": "^9.4.2",
"typescript": "^4.9.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
},

@@ -63,0 +59,0 @@ "files": [

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