@idscan/onboarding 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/src/@types/Api/Responses.d.ts +1 -0
- package/dist/@types/src/@types/enums.d.ts +6 -0
- package/dist/@types/src/Wrapper.d.ts +1 -1
- package/dist/@types/src/modules/Validation.d.ts +1 -0
- package/dist/js/wrapper.js +1 -1
- package/dist/networks/Face-chunk.js +1 -1
- package/dist/networks/GeneralTypeDetectionYolo-chunk.js +1 -1
- package/dist/networks/PDF-chunk.js +1 -1
- package/package.json +2 -2
- package/readme.md +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[9],{7358:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var r=n(4554),i=n(813),o=n(4328),c=n(7286),u=n(8417),a=n(6955),l=n(528),s=n(683),f=n(6960);function
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[9],{7358:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});var r=n(4554),i=n(813),o=n(4328),c=n(7286),u=n(8417),a=n(6955),l=n(528),s=n(683),f=n(6960);function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t,n,r,i,o,c){try{var u=e[o](c),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,i)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(t){var i=y(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!=((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof t?d(e):t;var n}(this,n)}}var m={confidence:.5,predictConfidence:.9,classes:["BACKS_MRZ","BACKS_MRZPDF","BACKS_NO","BACKS_PDF","BCC","CAC","DLIC","EA","GC","IID","MID_NEW","MID_OLD","PASSP","PC","VA","VHC","FACE"],inputImageWidth:320,inputImageHeight:224,inputTensorSize:[1,224,320,3],inputTensorName:"image_input",outputTensorSize:[1,21,1470],outputTensorName:"yolov10",predictLength:6,padding:0},w=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(o,e);var t,n,r=g(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.z.WASM,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),b(d(e=r.call(this,t,n,c)),"canvasSize",{width:1,height:1}),b(d(e),"documentPredictLabelIndex",5),b(d(e),"documentPredictConfidenceIndex",4),e}return t=o,n=[{key:"setSizes",value:function(e){var t=e.height,n=e.width;this.canvasSize.width=n,this.canvasSize.height=t}},{key:"findHighestConfidencePredict",value:function(e,t){var n=this,r=Array.from({length:e.length/t.predictLength},(function(n,r){return e.slice(r*t.predictLength,(r+1)*t.predictLength)})).filter((function(e){return e[n.documentPredictConfidenceIndex]>t.predictConfidence})).slice(0,2);return{documentPredict:r.find((function(e){return t.classes[e[n.documentPredictLabelIndex]]!==t.classes[16]})),facePredict:r.find((function(e){return t.classes[e[n.documentPredictLabelIndex]]===t.classes[16]}))}}},{key:"predictFromImage",value:function(e,t,n){var r,i=this;return(r=function(){var r,o,c,u,a,f,d,h;return function(e,t){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}(this,(function(p){switch(p.label){case 0:return i.loading?[2,{}]:(i.loading=!0,r=n?function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){b(e,t,n[t])}))}return e}({},m,n):m,o=i.createSrc(e,"angles-input-canvas"),c=t||(0,l.vL)("general-type-canvas",{width:r.inputImageWidth,height:r.inputImageHeight}),u=(0,l.RT)({width:c.width,height:c.height},{width:o.width,height:o.height},r.padding),(a=c.getContext("2d")).fillStyle="rgb(114, 114, 114)",a.fillRect(0,0,c.width,c.width),a.drawImage(o,u.x,u.y,u.width,u.height),f=(0,s.vG)(a.getImageData(0,0,c.width,c.height),s.eQ.WITHOUT),[4,i.predict(f,r)]);case 1:return d=p.sent(),h=i.findHighestConfidencePredict(d.Identity.cpuData,r),i.setSizes(c),[2,i.interpret(h,u,r.padding,r)]}}))},function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function c(e){h(o,n,i,c,u,"next",e)}function u(e){h(o,n,i,c,u,"throw",e)}c(void 0)}))})()}},{key:"interpret",value:function(e,t,n,r){var i=e.documentPredict,o=e.facePredict,c={side:"None",bbox:{topLeft:{x:0,y:0},bottomRight:{x:1,y:1}},perimeterInPercents:{width:0,height:0},isDocumentInsideFrame:!1,isHasFaceOnDocument:!1};if(i){c.side=r.classes[i[5]];var u=i.slice(0,4);c.bbox.topLeft.x=u[0],c.bbox.topLeft.y=u[1],c.bbox.bottomRight.x=u[2],c.bbox.bottomRight.y=u[3];var a=(0,f.Bo)(c.bbox,t,n);c.isDocumentInsideFrame=a.isInside,c.perimeterInPercents.width=+((u[2]-u[0])/t.width*100).toFixed(3),c.perimeterInPercents.height=+((u[3]-u[1])/t.height*100).toFixed(),o&&(c.isHasFaceOnDocument=!0)}return this.loading=!1,c}},{key:"predict",value:function(e,t){var n=new u.es("uint8",e,t.inputTensorSize),r=b({},t.inputTensorName,n);return this.session.run(r)}}],n&&p(t.prototype,n),o}(a.Z);function P(e,t,n,r,i,o,c){try{var u=e[o](c),a=u.value}catch(e){return void n(e)}u.done?t(a):Promise.resolve(a).then(r,i)}const x=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function c(e){P(o,r,i,c,u,"next",e)}function u(e){P(o,r,i,c,u,"throw",e)}c(void 0)}))}}((function(){var e;return function(e,t){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}(this,(function(t){return e=new w("".concat(r.t.JZ),i.z.WASM,o.Z.networkUrl),c.Z.setModule("model","generalTypeDetectionYolo",e),[2,[e.initialize.bind(e)]]}))}))}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,l=(s=a((function(e){var r,t,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw s=u.sent(),console.error("Error loading and decompressing worker file:",s),s;case 3:return[2]}}))})),function(e){return s.apply(this,arguments)}),c=function(){var e=a((function(e){var r;return u(this,(function(t){switch(t.label){case 0:return[4,l(e)];case 1:return r=t.sent(),[2,new Worker(r)]}}))}));return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>m});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function u(e){a(i,n,o,u,s,"next",e)}function s(e){a(i,n,o,u,s,"throw",e)}u(void 0)}))}}function s(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}(e,r)||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 f(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var d,p,h=function(){function e(r,t,n){var o=this;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"module",void 0),l(this,"handle",null),l(this,"bw",0),l(this,"bh",0),l(this,"src",null),l(this,"out",null),l(this,"isAllocate",!1),l(this,"worker",void 0),l(this,"isProcessing",!1),l(this,"isInitialized",!1),l(this,"successCount",0),l(this,"pdfCapturedCount",0),l(this,"src2",null),l(this,"locations",null),l(this,"pdfCount",0),l(this,"geometry",void 0),l(this,"minPDFframes",1),l(this,"cropSizes",void 0),l(this,"canvasSizes",void 0),l(this,"privateErrorId",0),this.worker=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}var r,t;return r=e,(t=[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[o.l.Detected,o.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===o.l.LicenseKeyHasExpired&&(e=0),this.errorId===o.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach((function(e){var t=c(e,2),o=t[0],i=t[1],a=Math.trunc(i),u=o[0],s=+o[1]-1;n[s]||(n[s]={x:0,y:0}),"x"===u?n[s].x=r.canvasSizes.width*a/r.bw:n[s].y=r.canvasSizes.height*a/r.bh}));var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),l=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&l<=100&&l>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return u((function(){var t,n;return f(this,(function(i){switch(i.label){case 0:return r.isProcessing?[2,{}]:(t={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},r.isInitialized?(r.isProcessing=!0,[4,r.readPDF(e)]):[2,t]);case 1:return(n=i.sent()).error?(r.isProcessing=!1,t.error=n,[2,t]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCapturedCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.image=e,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t])}}))}))()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;r.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=r.errorId?r.licenseError():null;t(u||i)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var r=this;return u((function(){return f(this,(function(t){return[2,new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){var s;r.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var l=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(l)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(r.prototype,t),e}(),y=t(7286),v=t(4550);function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function w(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}const m=(d=function(e){var r,t,o,i;return function(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find((function(e){var r=function(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?b(e,r):void 0}}(e,r)||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.")}()}(e,2);return r[0],r[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new h(o,r,t),y.Z.setModule("module","pdf",i),[2]}}))},p=function(){var e=this,r=arguments;return new Promise((function(t,n){var o=d.apply(e,r);function i(e){w(o,t,n,i,a,"next",e)}function a(e){w(o,t,n,i,a,"throw",e)}i(void 0)}))},function(e){return p.apply(this,arguments)})}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,l=(s=a((function(e){var r,t,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw s=u.sent(),console.error("Error loading and decompressing worker file:",s),s;case 3:return[2]}}))})),function(e){return s.apply(this,arguments)}),c=function(){var e=a((function(e){var r;return u(this,(function(t){switch(t.label){case 0:return[4,l(e)];case 1:return r=t.sent(),[2,new Worker(r)]}}))}));return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>m});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);function u(e){a(i,n,o,u,s,"next",e)}function s(e){a(i,n,o,u,s,"throw",e)}u(void 0)}))}}function s(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}(e,r)||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 f(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var d,p,h=function(){function e(r,t,n){var o=this;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"module",void 0),l(this,"handle",null),l(this,"bw",0),l(this,"bh",0),l(this,"src",null),l(this,"out",null),l(this,"isAllocate",!1),l(this,"worker",void 0),l(this,"isProcessing",!1),l(this,"isInitialized",!1),l(this,"successCount",0),l(this,"pdfCapturedCount",0),l(this,"src2",null),l(this,"locations",null),l(this,"pdfCount",0),l(this,"geometry",void 0),l(this,"minPDFframes",1),l(this,"cropSizes",void 0),l(this,"canvasSizes",void 0),l(this,"privateErrorId",0),this.worker=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}var r,t;return r=e,(t=[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[o.l.Detected,o.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===o.l.LicenseKeyHasExpired&&(e=0),this.errorId===o.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach((function(e){var t=c(e,2),o=t[0],i=t[1],a=Math.trunc(i),u=o[0],s=+o[1]-1;n[s]||(n[s]={x:0,y:0}),"x"===u?n[s].x=r.canvasSizes.width*a/r.bw:n[s].y=r.canvasSizes.height*a/r.bh}));var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),l=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&l<=100&&l>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return u((function(){var t,n;return f(this,(function(i){switch(i.label){case 0:return r.isProcessing?[2,{}]:(t={status:!1,predict:!1,touch:!1,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},r.isInitialized?(r.isProcessing=!0,[4,r.readPDF(e)]):[2,t]);case 1:return(n=i.sent()).error?(r.isProcessing=!1,t.error=n,[2,t]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCapturedCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t])}}))}))()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;r.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=r.errorId?r.licenseError():null;t(u||i)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var r=this;return u((function(){return f(this,(function(t){return[2,new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){var s;r.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var l=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(l)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(r.prototype,t),e}(),y=t(7286),v=t(4550);function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function w(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}const m=(d=function(e){var r,t,o,i;return function(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}(this,(function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find((function(e){var r=function(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(e){if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?b(e,r):void 0}}(e,r)||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.")}()}(e,2);return r[0],r[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new h(o,r,t),y.Z.setModule("module","pdf",i),[2]}}))},p=function(){var e=this,r=arguments;return new Promise((function(t,n){var o=d.apply(e,r);function i(e){w(o,t,n,i,a,"next",e)}function a(e){w(o,t,n,i,a,"throw",e)}i(void 0)}))},function(e){return p.apply(this,arguments)})}}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idscan/onboarding",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Wrapper of the IDVC library for DIVE Online.",
|
|
5
5
|
"main": "dist/js/wrapper.js",
|
|
6
6
|
"types": "dist/@types/src/Wrapper.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"minor": "npm version minor"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@idscan/idvc2": "
|
|
23
|
+
"@idscan/idvc2": "2.12.2",
|
|
24
24
|
"core-js": "^3.30.0",
|
|
25
25
|
"qrcode": "^1.5.1",
|
|
26
26
|
"regenerator-runtime": "^0.13.11"
|
package/readme.md
CHANGED
|
@@ -52,11 +52,10 @@ new CopyWebpackPlugin ([
|
|
|
52
52
|
])
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
1.3. Import the library
|
|
55
|
+
1.3. Import the library to your project.
|
|
56
56
|
|
|
57
57
|
```javascript
|
|
58
58
|
import DVSOIDVC from '@idscan/onboarding';
|
|
59
|
-
import '@idscan/onboarding/dist/css/onboarding.css';
|
|
60
59
|
```
|
|
61
60
|
## Initialization
|
|
62
61
|
|
|
@@ -110,6 +109,8 @@ Available fields:
|
|
|
110
109
|
|
|
111
110
|
**callbacks** (object) - Object with callback hooks. Available hooks:
|
|
112
111
|
|
|
112
|
+
- **onCaptureTimeout** - Callback-function which will be called after the user failed to capture the document from the camera in the time specified by the 'captureTimeout' option.
|
|
113
|
+
|
|
113
114
|
- **onChange** - Callback-function which will be called after change one step. The returnable value is the object with the type and the image.
|
|
114
115
|
|
|
115
116
|
- **onCameraError** - Callback-function which is invoked in case if the camera is not available. The response value is the object with the error code and the message.
|
|
@@ -178,6 +179,14 @@ btn.addEventListener('click', () => {
|
|
|
178
179
|
|
|
179
180
|
## Version history
|
|
180
181
|
|
|
182
|
+
- **2.7.2**
|
|
183
|
+
- feat: css import from idvc module was removed
|
|
184
|
+
- Updated IDVC component
|
|
185
|
+
|
|
186
|
+
- **2.7.1**
|
|
187
|
+
- feat: Changed successful verification message
|
|
188
|
+
- feat: Changed attempts limit text
|
|
189
|
+
|
|
181
190
|
- **2.7.0**
|
|
182
191
|
- feat: Added possibility to load IDVC web library from cdn, for this you need to set 'useCDN' option to true
|
|
183
192
|
- feat: A new option 'IDVCDownloadVersion' was added. It allows to select the IDVC version number which will be loaded, the value is a string in npm version format, e.g. '2.10.0'. Also, 'latest' value is available - in this case the current IDVC version will be loaded
|