diff --git a/MIGRATION.md b/MIGRATION.md index 9e0bb56ef4..dba8638e9e 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -2,6 +2,61 @@ These guides below are provided to ease the transition of existing applications using the Onfido SDK from one version to another that introduces breaking API changes. +## `2.8.0` -> `3.0.0` + +### Breaking changes + +- Removed support for `buttonId`. From this version you will need to create a function that launches the SDK when a trigger element (ie a button) is clicked. + +### Example of old behaviour +```html + + + + +
+ +``` + +### Example of new behaviour +```html + + + + + +
+ +``` + ## `1.1.0` -> `2.0.0` ### Breaking changes diff --git a/README.md b/README.md index 5db20d2e60..c582fa53a1 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,35 @@ A number of options are available to allow you to customise the SDK: Turns the SDK into a modal, which fades the background and puts the SDK into a contained box. + Example: + ```javascript + + + + + +
+ + ``` + - **`isModalOpen {Boolean} optional`** In case `useModal` is set to `true`, this defines whether the modal is open or closed. diff --git a/dist/onfido.min.js b/dist/onfido.min.js index 929742287d..a5bdab5743 100644 --- a/dist/onfido.min.js +++ b/dist/onfido.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Onfido=t():e.Onfido=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n=window.webpackJsonpOnfido;window.webpackJsonpOnfido=function(t,r,i){for(var a,s,c=0,u=[];c2;)T.push(arguments[i]);for(t&&null!=t.children&&(T.length||T.push(t.children),delete t.children);T.length;)if((r=T.pop())&&void 0!==r.pop)for(i=r.length;i--;)T.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r+="":"string"!=typeof r&&(o=!1)),o&&n?a[a.length-1]+=r:a===O?a=[r]:a.push(r),n=o;var s=new function(){};return s.nodeName=e,s.children=a,s.attributes=null==t?void 0:t,s.key=null==t?void 0:t.key,void 0!==E.vnode&&E.vnode(s),s}function o(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){return r(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function a(e){!e._dirty&&(e._dirty=!0)&&1==D.push(e)&&(E.debounceRendering||P)(s)}function s(){var e,t=D;for(D=[];e=t.pop();)e._dirty&&w(e)}function c(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&u(e,t.nodeName):n||e._componentConstructor===t.nodeName}function u(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function l(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function d(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===N.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var a=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,p,a):e.removeEventListener(t,p,a),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e)!function(e,t,n){try{e[t]=n}catch(e){}}(e,t,null==r?"":r),null!=r&&!1!==r||e.removeAttribute(t);else{var s=o&&t!==(t=t.replace(/^xlink\:?/,""));null==r||!1===r?s?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(s?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function p(e){return this._listeners[e.type](E.event&&E.event(e)||e)}function h(){for(var e;e=M.pop();)E.afterMount&&E.afterMount(e),e.componentDidMount&&e.componentDidMount()}function m(e,t,n,r,o,i){A++||(j=null!=o&&void 0!==o.ownerSVGElement,I=null!=e&&!("__preactattr_"in e));var a=v(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--A||(I=!1,i||h()),a}function v(e,t,n,r,o){var i=e,a=j;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),y(e,!0))),i.__preactattr_=!0,i;var s=t.nodeName;if("function"==typeof s)return function(e,t,n,r){var o=e&&e._component,i=o,a=e,s=o&&e._componentConstructor===t.nodeName,c=s,u=l(t);for(;o&&!c&&(o=o._parentComponent);)c=o.constructor===t.nodeName;o&&c&&(!r||o._component)?(k(o,u,3,n,r),e=o.base):(i&&!s&&(C(i),e=a=null),o=b(t.nodeName,u,n),e&&!o.nextBase&&(o.nextBase=e,a=null),k(o,u,1,n,r),e=o.base,a&&e!==a&&(a._component=null,y(a,!1)));return e}(e,t,n,r);if(j="svg"===s||"foreignObject"!==s&&j,s+="",(!e||!u(e,s))&&(i=function(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}(s,j),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),y(e,!0)}var p=i.firstChild,h=i.__preactattr_,m=t.children;if(null==h){h=i.__preactattr_={};for(var g=i.attributes,_=g.length;_--;)h[g[_].name]=g[_].value}return!I&&m&&1===m.length&&"string"==typeof m[0]&&null!=p&&void 0!==p.splitText&&null==p.nextSibling?p.nodeValue!=m[0]&&(p.nodeValue=m[0]):(m&&m.length||null!=p)&&function(e,t,n,r,o){var i,a,s,u,l,d=e.childNodes,p=[],h={},m=0,g=0,b=d.length,_=0,k=t?t.length:0;if(0!==b)for(var w=0;w".concat(e,""),"application/xml");return(0,t.default)(r.firstChild.childNodes).map(function(e){return e.nodeType===document.TEXT_NODE?e.textContent:n({type:e.tagName,text:e.textContent})})};e.currentSeconds=function(){return Math.floor(Date.now()/1e3)};e.currentMilliseconds=function(){return(new Date).getTime()}})},function(e,t,n){"use strict";function r(){return null}function o(e,t,r){var o=t&&t._preactCompatRendered&&t._preactCompatRendered.base;o&&o.parentNode!==t&&(o=null),o||(o=t.children[0]);for(var i=t.childNodes.length;i--;)t.childNodes[i]!==o&&t.removeChild(t.childNodes[i]);var a=n.i(P.render)(e,t,o);return t&&(t._preactCompatRendered=a&&(a._component||{base:a})),"function"==typeof r&&r(),a&&a._component||a}function i(e,t,r,i){var a=o(n.i(P.h)(W,{context:e.context},t),r);return i&&i(a),a._component||a.base}function a(e){var t=e._preactCompatRendered&&e._preactCompatRendered.base;return!(!t||t.parentNode!==e)&&(n.i(P.render)(n.i(P.h)(r),e,t),!0)}function s(e){return l.bind(null,e)}function c(e,t){for(var n=t||0;n0;)r[o]=arguments[o+2];if(!p(e))return e;var i=e.attributes||e.props,a=[n.i(P.h)(e.nodeName||e.type,i,e.children||i&&i.children),t];return r&&r.length?a.push(r):t&&t.children&&a.push(t.children),f(P.cloneElement.apply(void 0,a))}function p(e){return e&&(e instanceof U||e.$$typeof===M)}function h(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function m(e,t){for(var n in e)if(!(n in t))return!0;for(var r in t)if(e[r]!==t[r])return!0;return!1}function v(e){return e&&e.base||e}function y(){}function g(e){function t(e,t){!function(e){for(var t in e){var n=e[t];"function"!=typeof n||n.__bound||j.hasOwnProperty(t)||((e[t]=n.bind(e)).__bound=!0)}}(this),S.call(this,e,t,R),k.call(this,e,t)}return(e=h({constructor:t},e)).mixins&&function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=_(t[n].concat(e[n]||H),"getDefaultProps"===n||"getInitialState"===n||"getChildContext"===n))}(e,function(e){for(var t={},n=0;n1?r-1:0),s=1;s0}})},function(e,t,n){e.exports=n(111)},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(25).f,o=n(29),i=n(16)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=n(346)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,r)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())},function(e,t,n){var r,o,i;!function(a,s){o=[t,n(33),n(39),n(311)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i)}(0,function(e,t,r,o){"use strict";var i=n(0);Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"includes",{enumerable:!0,get:function(){return o.default}}),e.isOnfidoHostname=e.includesRegex=e.randomId=e.humanCase=e.startCase=e.snakeCase=e.kebabCase=e.camelCase=e.upperCase=e.lowerCase=void 0,o=i(o);var a=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},s=/([A-Z])/g,c=function(e){return e.replace(s," $1").split(" ")},u=(0,t.compose)(r.cleanFalsy,r.flatten),l=/[^\s_\-]+/g,f=function(e){return(e||"").toLowerCase()};e.lowerCase=f;e.upperCase=function(e){return(e||"").toUpperCase()};var d=function(e){return u(((e||"").match(l)||[]).map(c)).map(f)};e.camelCase=function(e){return d(e).reduce(function(e,n,r){return"".concat(e).concat((r>0?a:t.identity)(n))},"")};e.kebabCase=function(e){return d(e).join("-")};e.snakeCase=function(e){return d(e).join("_")};e.startCase=function(e){return d(e).map(a).join(" ")};e.humanCase=function(e){return a(d(e).join(" "))};e.randomId=function(){return Math.random().toString(36).substring(7)};var p=function(e,t){return!!e.match(t)};e.includesRegex=p;e.isOnfidoHostname=function(e){return p(e,/^https:\/\/[A-Za-z0-9\.]*\.?onfido\.com$/g)}})},function(e,t,n){var r,o,i;!function(a,s){o=[t,n(3),n(9),n(7),n(5),n(6),n(12),n(1),n(73),n(168)],void 0===(i="function"==typeof(r=s)?r.apply(t,o):r)||(e.exports=i)}(0,function(e,t,r,o,i,a,s,c,u,l){"use strict";var f=n(17),d=n(0);Object.defineProperty(e,"__esModule",{value:!0}),e.ToggleFullScreen=e.withFullScreenAction=e.withFullScreenState=void 0,t=d(t),r=d(r),o=d(o),i=d(i),a=d(a),s=f(s);var p=function(e){function n(){return(0,t.default)(this,n),(0,o.default)(this,(0,i.default)(n).apply(this,arguments))}return(0,a.default)(n,c.Component),(0,r.default)(n,[{key:"componentDidMount",value:function(){this.props.setFullScreen(!0)}},{key:"componentWillUnmount",value:function(){this.props.setFullScreen(!1)}},{key:"render",value:function(){return null}}]),n}(),h=(0,u.connect)(function(e){return{isFullScreen:e.globals.isFullScreen}});e.withFullScreenState=h;var m=(0,u.connect)(null,function(e){return{setFullScreen:function(t){return e((0,l.setFullScreen)(t))}}});e.withFullScreenAction=m;var v=m(p);e.ToggleFullScreen=v})},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(27),o=n(132),i=n(52),a=n(55)("IE_PROTO"),s=function(){},c=function(){var e,t=n(67)("iframe"),r=i.length;for(t.style.display="none",n(103).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("