react-plaid-link
Advanced tools
Comparing version 3.2.1 to 3.2.2
# Changelog | ||
## 3.2.2 | ||
- Bump react-script-hook to 1.5.0 to fix 'error loading plaid' msg (#217) | ||
## 3.2.1 | ||
@@ -4,0 +8,0 @@ |
@@ -52,3 +52,3 @@ /// <reference types="react" /> | ||
type PlaidLinkOnSuccess = (public_token: string, metadata: PlaidLinkOnSuccessMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; // The following event names are stable and will not be deprecated or changed | ||
// The following event names are stable and will not be deprecated or changed | ||
@@ -82,3 +82,6 @@ declare enum PlaidLinkStableEvent { | ||
onEvent?: PlaidLinkOnEvent; | ||
} | ||
} /** | ||
* @deprecated Public key integrations are deprecated and should not be used. | ||
* https://plaid.com/docs/link/link-token-migration-guide/ | ||
*/ | ||
/** | ||
@@ -129,3 +132,4 @@ * @deprecated Public key integrations are deprecated and should not be used. | ||
receivedRedirectUri?: string; | ||
}; | ||
}; // Either the publicKey or the token field must be configured. The publicKey | ||
// is deprecated so prefer to initialize Link with a Link Token instead. | ||
// Either the publicKey or the token field must be configured. The publicKey | ||
@@ -132,0 +136,0 @@ // is deprecated so prefer to initialize Link with a Link Token instead. |
@@ -52,3 +52,3 @@ /// <reference types="react" /> | ||
type PlaidLinkOnSuccess = (public_token: string, metadata: PlaidLinkOnSuccessMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; // The following event names are stable and will not be deprecated or changed | ||
// The following event names are stable and will not be deprecated or changed | ||
@@ -82,3 +82,6 @@ declare enum PlaidLinkStableEvent { | ||
onEvent?: PlaidLinkOnEvent; | ||
} | ||
} /** | ||
* @deprecated Public key integrations are deprecated and should not be used. | ||
* https://plaid.com/docs/link/link-token-migration-guide/ | ||
*/ | ||
/** | ||
@@ -129,3 +132,4 @@ * @deprecated Public key integrations are deprecated and should not be used. | ||
receivedRedirectUri?: string; | ||
}; | ||
}; // Either the publicKey or the token field must be configured. The publicKey | ||
// is deprecated so prefer to initialize Link with a Link Token instead. | ||
// Either the publicKey or the token field must be configured. The publicKey | ||
@@ -132,0 +136,0 @@ // is deprecated so prefer to initialize Link with a Link Token instead. |
@@ -101,3 +101,3 @@ import react, { useState, useEffect } from 'react'; | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); | ||
@@ -187,18 +187,18 @@ if (_i == null) return; | ||
var _c = react.useState(Boolean(src)), | ||
var _c = (0, react.useState)(Boolean(src)), | ||
loading = _c[0], | ||
setLoading = _c[1]; | ||
var _d = react.useState(null), | ||
var _d = (0, react.useState)(null), | ||
error = _d[0], | ||
setError = _d[1]; | ||
react.useEffect(function () { | ||
(0, react.useEffect)(function () { | ||
if (!isBrowser || !src) return; | ||
if (checkForExisting) { | ||
var existing = document.querySelectorAll("script[src=\"" + src + "\"]"); | ||
var existing = document.querySelector("script[src=\"" + src + "\"]"); | ||
if (existing.length > 0) { | ||
setLoading(false); | ||
if (existing) { | ||
setLoading(existing.getAttribute('data-status') === 'loading'); | ||
return; | ||
@@ -210,2 +210,3 @@ } | ||
scriptEl.setAttribute('src', src); | ||
scriptEl.setAttribute('data-status', 'loading'); | ||
Object.keys(attributes).forEach(function (key) { | ||
@@ -220,2 +221,3 @@ if (scriptEl[key] === undefined) { | ||
var handleLoad = function () { | ||
scriptEl.setAttribute('data-status', 'ready'); | ||
setLoading(false); | ||
@@ -225,2 +227,3 @@ }; | ||
var handleError = function (error) { | ||
scriptEl.setAttribute('data-status', 'error'); | ||
setError(error); | ||
@@ -249,5 +252,12 @@ }; | ||
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
@@ -259,3 +269,3 @@ | ||
get: function () { | ||
return useScript_1.default; | ||
return __importDefault(useScript_1).default; | ||
} | ||
@@ -262,0 +272,0 @@ }); |
@@ -108,3 +108,3 @@ 'use strict'; | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); | ||
@@ -194,18 +194,18 @@ if (_i == null) return; | ||
var _c = react__default.useState(Boolean(src)), | ||
var _c = (0, react__default.useState)(Boolean(src)), | ||
loading = _c[0], | ||
setLoading = _c[1]; | ||
var _d = react__default.useState(null), | ||
var _d = (0, react__default.useState)(null), | ||
error = _d[0], | ||
setError = _d[1]; | ||
react__default.useEffect(function () { | ||
(0, react__default.useEffect)(function () { | ||
if (!isBrowser || !src) return; | ||
if (checkForExisting) { | ||
var existing = document.querySelectorAll("script[src=\"" + src + "\"]"); | ||
var existing = document.querySelector("script[src=\"" + src + "\"]"); | ||
if (existing.length > 0) { | ||
setLoading(false); | ||
if (existing) { | ||
setLoading(existing.getAttribute('data-status') === 'loading'); | ||
return; | ||
@@ -217,2 +217,3 @@ } | ||
scriptEl.setAttribute('src', src); | ||
scriptEl.setAttribute('data-status', 'loading'); | ||
Object.keys(attributes).forEach(function (key) { | ||
@@ -227,2 +228,3 @@ if (scriptEl[key] === undefined) { | ||
var handleLoad = function () { | ||
scriptEl.setAttribute('data-status', 'ready'); | ||
setLoading(false); | ||
@@ -232,2 +234,3 @@ }; | ||
var handleError = function (error) { | ||
scriptEl.setAttribute('data-status', 'error'); | ||
setError(error); | ||
@@ -256,5 +259,12 @@ }; | ||
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
@@ -266,3 +276,3 @@ | ||
get: function () { | ||
return useScript_1.default; | ||
return __importDefault(useScript_1).default; | ||
} | ||
@@ -269,0 +279,0 @@ }); |
@@ -52,3 +52,3 @@ /// <reference types="react" /> | ||
type PlaidLinkOnSuccess = (public_token: string, metadata: PlaidLinkOnSuccessMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; // The following event names are stable and will not be deprecated or changed | ||
// The following event names are stable and will not be deprecated or changed | ||
@@ -82,3 +82,6 @@ declare enum PlaidLinkStableEvent { | ||
onEvent?: PlaidLinkOnEvent; | ||
} | ||
} /** | ||
* @deprecated Public key integrations are deprecated and should not be used. | ||
* https://plaid.com/docs/link/link-token-migration-guide/ | ||
*/ | ||
/** | ||
@@ -129,3 +132,4 @@ * @deprecated Public key integrations are deprecated and should not be used. | ||
receivedRedirectUri?: string; | ||
}; | ||
}; // Either the publicKey or the token field must be configured. The publicKey | ||
// is deprecated so prefer to initialize Link with a Link Token instead. | ||
// Either the publicKey or the token field must be configured. The publicKey | ||
@@ -132,0 +136,0 @@ // is deprecated so prefer to initialize Link with a Link Token instead. |
@@ -107,3 +107,3 @@ (function (global, factory) { | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); | ||
@@ -193,18 +193,18 @@ if (_i == null) return; | ||
var _c = react__default.useState(Boolean(src)), | ||
var _c = (0, react__default.useState)(Boolean(src)), | ||
loading = _c[0], | ||
setLoading = _c[1]; | ||
var _d = react__default.useState(null), | ||
var _d = (0, react__default.useState)(null), | ||
error = _d[0], | ||
setError = _d[1]; | ||
react__default.useEffect(function () { | ||
(0, react__default.useEffect)(function () { | ||
if (!isBrowser || !src) return; | ||
if (checkForExisting) { | ||
var existing = document.querySelectorAll("script[src=\"" + src + "\"]"); | ||
var existing = document.querySelector("script[src=\"" + src + "\"]"); | ||
if (existing.length > 0) { | ||
setLoading(false); | ||
if (existing) { | ||
setLoading(existing.getAttribute('data-status') === 'loading'); | ||
return; | ||
@@ -216,2 +216,3 @@ } | ||
scriptEl.setAttribute('src', src); | ||
scriptEl.setAttribute('data-status', 'loading'); | ||
Object.keys(attributes).forEach(function (key) { | ||
@@ -226,2 +227,3 @@ if (scriptEl[key] === undefined) { | ||
var handleLoad = function () { | ||
scriptEl.setAttribute('data-status', 'ready'); | ||
setLoading(false); | ||
@@ -231,2 +233,3 @@ }; | ||
var handleError = function (error) { | ||
scriptEl.setAttribute('data-status', 'error'); | ||
setError(error); | ||
@@ -255,5 +258,12 @@ }; | ||
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
@@ -265,3 +275,3 @@ | ||
get: function () { | ||
return useScript_1.default; | ||
return __importDefault(useScript_1).default; | ||
} | ||
@@ -268,0 +278,0 @@ }); |
@@ -52,3 +52,3 @@ /// <reference types="react" /> | ||
type PlaidLinkOnSuccess = (public_token: string, metadata: PlaidLinkOnSuccessMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; | ||
type PlaidLinkOnExit = (error: null | PlaidLinkError, metadata: PlaidLinkOnExitMetadata) => void; // The following event names are stable and will not be deprecated or changed | ||
// The following event names are stable and will not be deprecated or changed | ||
@@ -82,3 +82,6 @@ declare enum PlaidLinkStableEvent { | ||
onEvent?: PlaidLinkOnEvent; | ||
} | ||
} /** | ||
* @deprecated Public key integrations are deprecated and should not be used. | ||
* https://plaid.com/docs/link/link-token-migration-guide/ | ||
*/ | ||
/** | ||
@@ -129,3 +132,4 @@ * @deprecated Public key integrations are deprecated and should not be used. | ||
receivedRedirectUri?: string; | ||
}; | ||
}; // Either the publicKey or the token field must be configured. The publicKey | ||
// is deprecated so prefer to initialize Link with a Link Token instead. | ||
// Either the publicKey or the token field must be configured. The publicKey | ||
@@ -132,0 +136,0 @@ // is deprecated so prefer to initialize Link with a Link Token instead. |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).PlaidLink={},e.React)}(this,(function(e,t){"use strict";var n="default"in t?t.default:t;function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],l=!0,a=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);l=!0);}catch(e){a=!0,o=e}finally{try{l||null==n.return||n.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function d(e,t){return e(t={exports:{}},t.exports),t.exports}var s=d((function(e,t){var r=c&&c.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.src,i=e.checkForExisting,l=void 0!==i&&i,a=r(e,["src","checkForExisting"]),u=n.useState(Boolean(t)),c=u[0],f=u[1],d=n.useState(null),s=d[0],p=d[1];return n.useEffect((function(){if(o&&t){if(l)if(document.querySelectorAll('script[src="'+t+'"]').length>0)return void f(!1);var e=document.createElement("script");e.setAttribute("src",t),Object.keys(a).forEach((function(t){void 0===e[t]?e.setAttribute(t,a[t]):e[t]=a[t]}));var n=function(){f(!1)},r=function(e){p(e)};return e.addEventListener("load",n),e.addEventListener("error",r),document.body.appendChild(e),function(){e.removeEventListener("load",n),e.removeEventListener("error",r)}}}),[t]),[c,s]};var o="undefined"!=typeof window&&void 0!==window.document}));f(s);var p,y=f(d((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s.default}})}))),b=function(e){var t={plaid:null,open:!1,onExitCallback:null};if("undefined"==typeof window||!window.Plaid)throw new Error("Plaid not loaded");var n,r,l,a,u=(n=e,r="publicKey",l="key",a={},delete Object.assign(a,n,i({},l,n[r]))[r],a);t.plaid=window.Plaid.create(o(o({},u),{},{onExit:function(e,n){t.open=!1,u.onExit&&u.onExit(e,n),t.onExitCallback&&t.onExitCallback()}}));return{open:function(){t.plaid&&(t.open=!0,t.onExitCallback=null,t.plaid.open())},exit:function(e,n){t.open&&t.plaid?(t.onExitCallback=n,t.plaid.exit(e),e&&e.force&&(t.open=!1)):n&&n()},destroy:function(){t.plaid&&(t.plaid.destroy(),t.plaid=null)}}},O=function(){},v=function(e){var n=a(y({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),2),r=n[0],i=n[1],l=a(t.useState(null),2),u=l[0],c=l[1],f=a(t.useState(!1),2),d=f[0],s=f[1],p=(e.product||[]).slice().sort().join(",");return t.useEffect((function(){if(!r){if(!i&&window.Plaid){null!=u&&u.exit({force:!0},(function(){return u.destroy()}));var t=b(o(o({},e),{},{onLoad:function(){s(!0),e.onLoad&&e.onLoad()}}));return c(t),function(){return t.exit({force:!0},(function(){return t.destroy()}))}}console.error("Error loading Plaid",i)}}),[r,i,e.token,p]),{error:i,ready:null!=u&&(!r||d),exit:u?u.exit:O,open:u?u.open:O}},E=["children","style","className"],m=function(e){var t=e.children,r=e.style,i=e.className,a=l(e,E),u=v(o({},a)),c=u.error,f=u.open;return n.createElement("button",{disabled:Boolean(c),type:"button",className:i,style:o({padding:"6px 4px",outline:"none",background:"#FFFFFF",border:"2px solid #F1F1F1",borderRadius:"4px"},r),onClick:function(){return f()}},t)};m.displayName="PlaidLink",(p=e.PlaidLinkStableEvent||(e.PlaidLinkStableEvent={})).OPEN="OPEN",p.EXIT="EXIT",p.HANDOFF="HANDOFF",p.SELECT_INSTITUTION="SELECT_INSTITUTION",p.ERROR="ERROR",e.PlaidLink=m,e.usePlaidLink=v,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).PlaidLink={},e.React)}(this,(function(e,t){"use strict";var n="default"in t?t.default:t;function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f(e,t){return e(t={exports:{}},t.exports),t.exports}var s=f((function(e,t){var r=c&&c.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.src,i=e.checkForExisting,a=void 0!==i&&i,l=r(e,["src","checkForExisting"]),u=(0,n.useState)(Boolean(t)),c=u[0],d=u[1],f=(0,n.useState)(null),s=f[0],p=f[1];return(0,n.useEffect)((function(){if(o&&t){if(a){var e=document.querySelector('script[src="'+t+'"]');if(e)return void d("loading"===e.getAttribute("data-status"))}var n=document.createElement("script");n.setAttribute("src",t),n.setAttribute("data-status","loading"),Object.keys(l).forEach((function(e){void 0===n[e]?n.setAttribute(e,l[e]):n[e]=l[e]}));var r=function(){n.setAttribute("data-status","ready"),d(!1)},i=function(e){n.setAttribute("data-status","error"),p(e)};return n.addEventListener("load",r),n.addEventListener("error",i),document.body.appendChild(n),function(){n.removeEventListener("load",r),n.removeEventListener("error",i)}}}),[t]),[c,s]};var o="undefined"!=typeof window&&void 0!==window.document}));d(s);var p,b=d(f((function(e,t){var n=c&&c.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n(s).default}})}))),y=function(e){var t={plaid:null,open:!1,onExitCallback:null};if("undefined"==typeof window||!window.Plaid)throw new Error("Plaid not loaded");var n,r,a,l,u=(n=e,r="publicKey",a="key",l={},delete Object.assign(l,n,i({},a,n[r]))[r],l);t.plaid=window.Plaid.create(o(o({},u),{},{onExit:function(e,n){t.open=!1,u.onExit&&u.onExit(e,n),t.onExitCallback&&t.onExitCallback()}}));return{open:function(){t.plaid&&(t.open=!0,t.onExitCallback=null,t.plaid.open())},exit:function(e,n){t.open&&t.plaid?(t.onExitCallback=n,t.plaid.exit(e),e&&e.force&&(t.open=!1)):n&&n()},destroy:function(){t.plaid&&(t.plaid.destroy(),t.plaid=null)}}},O=function(){},v=function(e){var n=l(b({src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",checkForExisting:!0}),2),r=n[0],i=n[1],a=l(t.useState(null),2),u=a[0],c=a[1],d=l(t.useState(!1),2),f=d[0],s=d[1],p=(e.product||[]).slice().sort().join(",");return t.useEffect((function(){if(!r){if(!i&&window.Plaid){null!=u&&u.exit({force:!0},(function(){return u.destroy()}));var t=y(o(o({},e),{},{onLoad:function(){s(!0),e.onLoad&&e.onLoad()}}));return c(t),function(){return t.exit({force:!0},(function(){return t.destroy()}))}}console.error("Error loading Plaid",i)}}),[r,i,e.token,p]),{error:i,ready:null!=u&&(!r||f),exit:u?u.exit:O,open:u?u.open:O}},E=["children","style","className"],m=function(e){var t=e.children,r=e.style,i=e.className,l=a(e,E),u=v(o({},l)),c=u.error,d=u.open;return n.createElement("button",{disabled:Boolean(c),type:"button",className:i,style:o({padding:"6px 4px",outline:"none",background:"#FFFFFF",border:"2px solid #F1F1F1",borderRadius:"4px"},r),onClick:function(){return d()}},t)};m.displayName="PlaidLink",(p=e.PlaidLinkStableEvent||(e.PlaidLinkStableEvent={})).OPEN="OPEN",p.EXIT="EXIT",p.HANDOFF="HANDOFF",p.SELECT_INSTITUTION="SELECT_INSTITUTION",p.ERROR="ERROR",e.PlaidLink=m,e.usePlaidLink=v,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "react-plaid-link", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "A React component for Plaid Link", | ||
@@ -47,3 +47,3 @@ "registry": "https://registry.npmjs.org", | ||
"prop-types": "^15.7.2", | ||
"react-script-hook": "1.3.0" | ||
"react-script-hook": "1.5.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "peerDependencies": { |
96384
2138
+ Addedreact-script-hook@1.5.0(transitive)
- Removedreact-script-hook@1.3.0(transitive)
Updatedreact-script-hook@1.5.0