@evervault/react
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,2 +0,2 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var r="object"==typeof exports?e(require("react")):e(t.react);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(e,r){e.exports=t},function(t,e,r){var n=r(14)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e){function r(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var u=t.apply(e,n);function a(t){r(u,o,i,a,c,"next",t)}function c(t){r(u,o,i,a,c,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(){return t.exports=r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.exports.__esModule=!0,t.exports.default=t.exports,r.apply(this,arguments)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(8),o=r(9),i=r(10),u=r(12);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(13);t.exports=function(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)r=u[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"EvervaultContext",(function(){return g})),r.d(e,"EvervaultProvider",(function(){return b})),r.d(e,"EvervaultInput",(function(){return E})),r.d(e,"useEvervault",(function(){return _}));var n=r(3),o=r.n(n),i=r(4),u=r.n(i),a=r(5),c=r.n(a),f=r(2),s=r.n(f),l=r(1),p=r.n(l),d=r(0),v=r.n(d),h=/^https:\/\/js\.evervault\.com\/v2\/?(\?.*)?$/,y=null,x=function(){return null!==y?y:y=new Promise((function(t,e){if("undefined"!=typeof window)if(window.Evervault&&console.warn("Evervault has already been loaded"),window.Evervault)t(window.Evervault);else try{var r=m();r?console.warn("Evervault has already been loaded"):r||(r=function(){var t=document.createElement("script");t.src="https://js.evervault.com/v2";var e=document.head||document.body;if(!e)throw new Error("Expected document.body not to be null. Evervault.js requires a <body> element.");return e.appendChild(t),t}()),r.addEventListener("load",(function(){window.Evervault?t(window.Evervault):e(new Error("Evervault.js not available"))})),r.addEventListener("error",(function(){e(new Error("Failed to load Evervault.js"))}))}catch(t){return void e(t)}else t(null)}))},m=function(){for(var t=document.querySelectorAll<HTMLScriptElement>'script[src^="'.concat("https://js.evervault.com/v2",'"]'),e=0;e<t.length;e++){var r=t[e];if(h.test(r.src))return r}return null},w=function(){var t=s()(p.a.mark((function t(){var e,r;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=Promise.resolve().then((function(){return x()})),r=!1,e.catch((function(t){r||console.warn(t)})),r=!0,t.abrupt("return",e.then((function(){if("undefined"!=typeof window)return window.Evervault})));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),g=v.a.createContext(void 0),b=function(t){var e=t.teamId,r=t.appId,n=t.customConfig,i=t.children,a=c()(t,["teamId","appId","customConfig","children"]);if("undefined"==typeof window)return v.a.createElement(g.Provider,null,i);var f=v.a.useState(void 0),s=u()(f,2),l=s[0],p=s[1];return v.a.useEffect((function(){w().then((function(t){return p(new t(e,r,n))}))}),[w]),v.a.createElement(g.Provider,o()({},a,{value:l}),i)},E=function(e){var r=e.onChange,n=e.config;t.evInputsCount=t.evInputsCount?t.evInputsCount+1:1;var o="encryptedInput-".concat(t.evInputsCount);if("undefined"==typeof window)return v.a.createElement("div",{id:o});var i=_(),u=function(){var t=s()(p.a.mark((function t(){var e;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null==(e=null==i?void 0:i.inputs(o,n))||e.on("change",function(){var t=s()(p.a.mark((function t(e){return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:"function"==typeof r&&r(e);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return v.a.useEffect((function(){u()}),[i]),v.a.createElement("div",{id:o})};function _(){if("undefined"!=typeof window){if("function"!=typeof v.a.useContext)throw new Error("You must use React >= 16.8 in order to use useEvervault()");return v.a.useContext(g)}}}.call(this,r(7))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(11);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=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.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(15).default;function o(){"use strict"; | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,i=r.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),u=new L(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return M()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=_(u,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=p(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d={};function v(){}function h(){}function y(){}var x={};s(x,a,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(S([])));w&&w!==r&&i.call(w,a)&&(x=w);var g=y.prototype=v.prototype=Object.create(x);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){var r;this._invoke=function(o,u){function a(){return new e((function(r,a){!function r(o,u,a,c){var f=p(t[o],t,u);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==n(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(f.arg)}(o,u,r,a)}))}return r=r?r.then(a,a):a()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=p(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:M}}function M(){return{value:void 0,done:!0}}return h.prototype=y,s(g,"constructor",y),s(y,"constructor",h),h.displayName=s(y,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,f,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},b(E.prototype),s(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},b(g),s(g,f,"Generator"),s(g,a,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],u=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}])})); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var r="object"==typeof exports?e(require("react")):e(t.react);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(e,r){e.exports=t},function(t,e,r){var n=r(14)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e){function r(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var u=t.apply(e,n);function a(t){r(u,o,i,a,c,"next",t)}function c(t){r(u,o,i,a,c,"throw",t)}a(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(){return t.exports=r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.exports.__esModule=!0,t.exports.default=t.exports,r.apply(this,arguments)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(8),o=r(9),i=r(10),u=r(12);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||u()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(13);t.exports=function(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)r=u[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"EvervaultContext",(function(){return g})),r.d(e,"EvervaultProvider",(function(){return b})),r.d(e,"EvervaultInput",(function(){return E})),r.d(e,"useEvervault",(function(){return _}));var n=r(3),o=r.n(n),i=r(4),u=r.n(i),a=r(5),c=r.n(a),s=r(2),f=r.n(s),l=r(1),p=r.n(l),d=r(0),v=r.n(d),h=/^https:\/\/js\.evervault\.com\/v2\/?(\?.*)?$/,y=null,x=function(){return null!==y?y:y=new Promise((function(t,e){if("undefined"!=typeof window)if(window.Evervault&&console.warn("Evervault has already been loaded"),window.Evervault)t(window.Evervault);else try{var r=m();r?console.warn("Evervault has already been loaded"):r||(r=function(){var t=document.createElement("script");t.src="https://js.evervault.com/v2";var e=document.head||document.body;if(!e)throw new Error("Expected document.body not to be null. Evervault.js requires a <body> element.");return e.appendChild(t),t}()),r.addEventListener("load",(function(){window.Evervault?t(window.Evervault):e(new Error("Evervault.js not available"))})),r.addEventListener("error",(function(){e(new Error("Failed to load Evervault.js"))}))}catch(t){return void e(t)}else t(null)}))},m=function(){for(var t=document.querySelectorAll<HTMLScriptElement>'script[src^="'.concat("https://js.evervault.com/v2",'"]'),e=0;e<t.length;e++){var r=t[e];if(h.test(r.src))return r}return null},w=function(){var t=f()(p.a.mark((function t(){var e,r;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=Promise.resolve().then((function(){return x()})),r=!1,e.catch((function(t){r||console.warn(t)})),r=!0,t.abrupt("return",e.then((function(){if("undefined"!=typeof window)return window.Evervault})));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),g=v.a.createContext(void 0),b=function(t){var e=t.teamId,r=t.appId,n=t.customConfig,i=t.children,a=c()(t,["teamId","appId","customConfig","children"]);if("undefined"==typeof window)return v.a.createElement(g.Provider,null,i);var s=v.a.useState(void 0),f=u()(s,2),l=f[0],p=f[1];return v.a.useEffect((function(){w().then((function(t){return p(new t(e,r,n))}))}),[w]),v.a.createElement(g.Provider,o()({},a,{value:l}),i)},E=function(e){var r=e.onChange,n=e.config,o=e.onInputsLoad;t.evInputsCount=t.evInputsCount?t.evInputsCount+1:1;var i="encryptedInput-".concat(t.evInputsCount);if("undefined"==typeof window)return v.a.createElement("div",{id:i});var u=_(),a=function(){var t=f()(p.a.mark((function t(){var e;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null==(e=null==u?void 0:u.inputs(i,n))||e.on("change",function(){var t=f()(p.a.mark((function t(e){return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:"function"==typeof r&&r(e);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o&&null!=(null==e?void 0:e.isInputsLoading)&&e.isInputsLoading instanceof Promise&&e.isInputsLoading.then((function(){return o()}));case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return v.a.useEffect((function(){a()}),[u]),v.a.createElement("div",{id:i})};function _(){if("undefined"!=typeof window){if("function"!=typeof v.a.useContext)throw new Error("You must use React >= 16.8 in order to use useEvervault()");return v.a.useContext(g)}}}.call(this,r(7))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(11);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=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.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){var n=r(15).default;function o(){"use strict"; | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,i=r.hasOwnProperty,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),u=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=_(u,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=p(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d={};function v(){}function h(){}function y(){}var x={};f(x,a,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(S([])));w&&w!==r&&i.call(w,a)&&(x=w);var g=y.prototype=v.prototype=Object.create(x);function b(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){var r;this._invoke=function(o,u){function a(){return new e((function(r,a){!function r(o,u,a,c){var s=p(t[o],t,u);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==n(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}(o,u,r,a)}))}return r=r?r.then(a,a):a()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=p(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=y,f(g,"constructor",y),f(y,"constructor",h),h.displayName=f(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,f(t,s,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},b(E.prototype),f(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new E(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},b(g),f(g,s,"Generator"),f(g,a,(function(){return this})),f(g,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return u.type="throw",u.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],u=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}])})); |
@@ -136,3 +136,3 @@ /** @format */ | ||
export const EvervaultInput = ({ onChange, config }) => { | ||
export const EvervaultInput = ({ onChange, config, onInputsLoad }) => { | ||
global.evInputsCount = global.evInputsCount ? global.evInputsCount + 1 : 1; | ||
@@ -154,2 +154,6 @@ const encryptedInputId = `encryptedInput-${global.evInputsCount}`; | ||
}); | ||
if(onInputsLoad && encryptedInput?.isInputsLoading != null && encryptedInput.isInputsLoading instanceof Promise) { | ||
encryptedInput.isInputsLoading.then(() => onInputsLoad()); | ||
} | ||
} | ||
@@ -156,0 +160,0 @@ |
{ | ||
"name": "@evervault/react", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "React package for the Evervault SDK", | ||
@@ -5,0 +5,0 @@ "main": "./build/lib/index.js", |
@@ -11,3 +11,3 @@ [![Evervault](https://evervault.com/evervault.svg)](https://evervault.com/) | ||
For full installation support, [book time here](https://calendly.com/evervault/cages-onboarding). | ||
For full installation support, [book time here](https://calendly.com/evervault/support). | ||
@@ -89,3 +89,3 @@ ## Documentation | ||
```javascript | ||
evervault.inputs(id: String, theme: String); | ||
evervault.inputs(id: String, config: Object); | ||
``` | ||
@@ -96,4 +96,32 @@ | ||
| id | string | Id of the element in which the Evervault Inputs iFrame should be embedded | | ||
| theme | string | Optional theme for styling Inputs, currently supported: minimal | | ||
| config | Object | A config object for custom styling. | | ||
#### config | ||
| Parameter | Type | Description | | ||
| -------------------------- | ------ | ---------------------------------------------------------------------------------- | | ||
| theme | String | The base styling for Inputs. Currently supports default, minimal and material. | | ||
| height | String | The height of the Evervault Inputs iframe. | | ||
| primaryColor | String | The main theme color. | | ||
| labelColor | String | The color CSS property applied to the input labels. | | ||
| inputBorderColor | String | The border-color CSS property applied to inputs. | | ||
| inputTextColor | String | The color CSS property applied to inputs. | | ||
| inputBackgroundColor | String | The color CSS property applied to the ::placeholder CSS pseudo-element for inputs. | | ||
| inputBorderRadius | String | The border-radius CSS property applied to inputs. | | ||
| inputHeight | String | The height CSS property applied to inputs. | | ||
| cardNumberLabel | String | The label for the card number input | | ||
| expirationDateLabel | String | The label for the expiration date input | | ||
| securityCodeLabel | String | The label for the security code input | | ||
| expirationDatePlaceholder | String | The placeholder shown for the expiration date input | | ||
| invalidCardNumberLabel | String | The message shown on an invalid card number | | ||
| invalidExpirationDateLabel | String | The message shown on an invalid expiration date | | ||
| invalidSecurityCodeLabel | String | The message shown on an invalid security code | | ||
| fontUrl | String | Load a custom font with the Google Fonts API | | ||
| fontFamily | String | Set the font-family for the fontUrl | | ||
| inputFontSize | String | Set the font-size property of the input attribute | | ||
| inputBoxShadow | String | Set the box-shadow property of the input attribute | | ||
| labelFontSize | String | Set the font-size property of the label attribute | | ||
| labelWeight | String | Set the font-weight property of the label attribute | | ||
| disableCVV | Boolean | If true the CVV field will not be displayed | | ||
#### Retrieving card data | ||
@@ -151,2 +179,20 @@ | ||
#### Localization | ||
The iFrame can be localized on initialization by providing a set of labels in the [config](#config). The labels can then be updated as required using the `setLabels` method. | ||
```javascript | ||
await inputs.setLabels({}); | ||
``` | ||
| Parameter | Type | Description | | ||
| -------------------------- | ------ | --------------------------------------------------- | | ||
| cardNumberLabel | String | The label for the card number input | | ||
| expirationDateLabel | String | The label for the expiration date input | | ||
| securityCodeLabel | String | The label for the security code input | | ||
| expirationDatePlaceholder | String | The placeholder shown for the expiration date input | | ||
| invalidCardNumberLabel | String | The message shown on an invalid card number | | ||
| invalidExpirationDateLabel | String | The message shown on an invalid expiration date | | ||
| invalidSecurityCodeLabel | String | The message shown on an invalid security code | | ||
## Contributing | ||
@@ -153,0 +199,0 @@ |
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
34939
206
201