UNPKG

@privateid/cryptonets-web-sdk

Version:
339 lines 29.1 kB
import { LOGTYPE } from './types'; import { printLogs } from './utils'; export var callbakTypeEnum; (function (callbakTypeEnum) { callbakTypeEnum["isValid"] = "isValid"; callbakTypeEnum["predict"] = "predict"; callbakTypeEnum["enroll"] = "enroll"; callbakTypeEnum["frontScan"] = "frontScan"; callbakTypeEnum["passportScan"] = "passportScan"; callbakTypeEnum["documentScanNoFace"] = "documentScanNoFace"; callbakTypeEnum["backScan"] = "backScan"; callbakTypeEnum["faceLogin"] = "faceLogin"; callbakTypeEnum["faceISO"] = "faceISO"; callbakTypeEnum["delete"] = "delete"; callbakTypeEnum["documentOcr"] = "documentOcr"; callbakTypeEnum["continuousPredict"] = "continuousPredict"; callbakTypeEnum["ageEstimation"] = "ageEstimation"; callbakTypeEnum["faceCompare"] = "faceCompare"; callbakTypeEnum["faceCompareDocumentAndFace"] = "faceCompareDocumentAndFace"; })(callbakTypeEnum || (callbakTypeEnum = {})); export const createCallback = ({ type, callbackFunction, returnType, imageData, portrait }) => { const createCallbackIsValid = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); //, LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); //, LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); //, LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); const returnData = { call_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status, face_validation_status: (_c = (_b = returnValue.faces) === null || _b === void 0 ? void 0 : _b.faces[0]) === null || _c === void 0 ? void 0 : _c.face_validation_status, antispoof_status: (_e = (_d = returnValue.faces) === null || _d === void 0 ? void 0 : _d.faces[0]) === null || _e === void 0 ? void 0 : _e.antispoofing_status, face_detected: ((_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.faces) === null || _f === void 0 ? void 0 : _f.faces[0]) ? true : false }; if (operation === 'is_valid') { if (returnType && returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createCallbackEnroll = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); //, LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); //, LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); if (operation === 'enroll') { const returnData = { mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token, callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status, face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _c === void 0 ? void 0 : _c.face_validation_data) === null || _d === void 0 ? void 0 : _d.face_validation_status, antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _e === void 0 ? void 0 : _e.face_validation_data) === null || _f === void 0 ? void 0 : _f.antispoofing_status, encrypted_embeddings: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _g === void 0 ? void 0 : _g.encrypted_embeddings, best_image: { data: (_j = (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _h === void 0 ? void 0 : _h.best_face_image) === null || _j === void 0 ? void 0 : _j.data, width: (_l = (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _k === void 0 ? void 0 : _k.best_face_image) === null || _l === void 0 ? void 0 : _l.info.width, height: (_o = (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _m === void 0 ? void 0 : _m.best_face_image) === null || _o === void 0 ? void 0 : _o.info.height, }, guid: (_q = (_p = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _p === void 0 ? void 0 : _p.api_response) === null || _q === void 0 ? void 0 : _q.guid, puid: (_s = (_r = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _r === void 0 ? void 0 : _r.api_response) === null || _s === void 0 ? void 0 : _s.puid, enroll_performed: (_t = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _t === void 0 ? void 0 : _t.enroll_performed, score: (_v = (_u = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _u === void 0 ? void 0 : _u.api_response) === null || _v === void 0 ? void 0 : _v.score, message: (_x = (_w = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _w === void 0 ? void 0 : _w.api_response) === null || _x === void 0 ? void 0 : _x.message, api_status: (_z = (_y = returnValue === null || returnValue === void 0 ? void 0 : returnValue.enroll_onefa) === null || _y === void 0 ? void 0 : _y.api_response) === null || _z === void 0 ? void 0 : _z.status }; if (returnType && returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createCallbackPredict = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); //, LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); //, LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); //, LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); const returnData = { mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token, callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status, face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _c === void 0 ? void 0 : _c.face_validation_data) === null || _d === void 0 ? void 0 : _d.face_validation_status, antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _e === void 0 ? void 0 : _e.face_validation_data) === null || _f === void 0 ? void 0 : _f.antispoofing_status, api_status: (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _g === void 0 ? void 0 : _g.api_response) === null || _h === void 0 ? void 0 : _h.status, guid: (_k = (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _j === void 0 ? void 0 : _j.api_response) === null || _k === void 0 ? void 0 : _k.guid, puid: (_m = (_l = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _l === void 0 ? void 0 : _l.api_response) === null || _m === void 0 ? void 0 : _m.puid, score: (_p = (_o = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _o === void 0 ? void 0 : _o.api_response) === null || _p === void 0 ? void 0 : _p.score, message: (_r = (_q = returnValue === null || returnValue === void 0 ? void 0 : returnValue.predict_onefa) === null || _q === void 0 ? void 0 : _q.api_response) === null || _r === void 0 ? void 0 : _r.message, }; if (operation === 'predict') { if (returnType && returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createCallbackFrontDlScan = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { if (operation === 'document_model') { const returnValue = JSON.parse(response_str); const returnData = { callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status, doc_validation_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _b === void 0 ? void 0 : _b.document_data.document_validation_status, age_from_ocr_text: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _c === void 0 ? void 0 : _c.document_data) === null || _d === void 0 ? void 0 : _d.age_from_ocr_text, dob_from_ocr_text: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _e === void 0 ? void 0 : _e.document_data) === null || _f === void 0 ? void 0 : _f.dob_from_ocr_text, cropped_document: { data: (_j = (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _g === void 0 ? void 0 : _g.document_data) === null || _h === void 0 ? void 0 : _h.cropped_document_image) === null || _j === void 0 ? void 0 : _j.data, width: (_o = (_m = (_l = (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _k === void 0 ? void 0 : _k.document_data) === null || _l === void 0 ? void 0 : _l.cropped_document_image) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.width, height: (_s = (_r = (_q = (_p = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _p === void 0 ? void 0 : _p.document_data) === null || _q === void 0 ? void 0 : _q.cropped_document_image) === null || _r === void 0 ? void 0 : _r.info) === null || _s === void 0 ? void 0 : _s.height, }, cropped_mugshot: { data: (_u = (_t = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _t === void 0 ? void 0 : _t.cropped_face_image) === null || _u === void 0 ? void 0 : _u.data, width: (_x = (_w = (_v = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _v === void 0 ? void 0 : _v.cropped_face_image) === null || _w === void 0 ? void 0 : _w.info) === null || _x === void 0 ? void 0 : _x.width, height: (_0 = (_z = (_y = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _y === void 0 ? void 0 : _y.cropped_face_image) === null || _z === void 0 ? void 0 : _z.info) === null || _0 === void 0 ? void 0 : _0.height, }, guid: (_1 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _1 === void 0 ? void 0 : _1.guid, puid: (_2 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _2 === void 0 ? void 0 : _2.uuid, }; if (returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createCallbackBackDlScan = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { if (operation === 'is_valid_barcode') { const returnValue = JSON.parse(response_str); const returnData = { callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status, doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _b === void 0 ? void 0 : _b.document_barcode_data) === null || _c === void 0 ? void 0 : _c.status_message, barcode_detection_status: (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _d === void 0 ? void 0 : _d.document_barcode_data) === null || _e === void 0 ? void 0 : _e.bar_code_detection_status, cropped_document: { data: (_h = (_g = (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _f === void 0 ? void 0 : _f.document_data) === null || _g === void 0 ? void 0 : _g.cropped_document_image) === null || _h === void 0 ? void 0 : _h.data, width: (_m = (_l = (_k = (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _j === void 0 ? void 0 : _j.document_data) === null || _k === void 0 ? void 0 : _k.cropped_document_image) === null || _l === void 0 ? void 0 : _l.info) === null || _m === void 0 ? void 0 : _m.width, height: (_r = (_q = (_p = (_o = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _o === void 0 ? void 0 : _o.document_data) === null || _p === void 0 ? void 0 : _p.cropped_document_image) === null || _q === void 0 ? void 0 : _q.info) === null || _r === void 0 ? void 0 : _r.height, }, cropped_barcode: { data: (_u = (_t = (_s = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _s === void 0 ? void 0 : _s.document_barcode_data) === null || _t === void 0 ? void 0 : _t.cropped_barcode_image) === null || _u === void 0 ? void 0 : _u.data, width: (_y = (_x = (_w = (_v = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _v === void 0 ? void 0 : _v.document_barcode_data) === null || _w === void 0 ? void 0 : _w.cropped_barcode_image) === null || _x === void 0 ? void 0 : _x.info) === null || _y === void 0 ? void 0 : _y.width, height: (_2 = (_1 = (_0 = (_z = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _z === void 0 ? void 0 : _z.document_barcode_data) === null || _0 === void 0 ? void 0 : _0.cropped_barcode_image) === null || _1 === void 0 ? void 0 : _1.info) === null || _2 === void 0 ? void 0 : _2.height, }, barcode_data: (_4 = (_3 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.barcode) === null || _3 === void 0 ? void 0 : _3.document_barcode_data) === null || _4 === void 0 ? void 0 : _4.barcode_data, barcode_scan: true, }; if (returnType && returnType === 'all') { callback(returnValue); } else { callback(returnData); } } else if (operation === 'scan_doc_with_no_face') { const returnValue = JSON.parse(response_str); const returnData = { callback_status: (_5 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _5 === void 0 ? void 0 : _5.return_status, doc_validation_status: (_6 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _6 === void 0 ? void 0 : _6.document_data.document_validation_status, cropped_document: { data: (_9 = (_8 = (_7 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _7 === void 0 ? void 0 : _7.document_data) === null || _8 === void 0 ? void 0 : _8.cropped_document_image) === null || _9 === void 0 ? void 0 : _9.data, width: (_13 = (_12 = (_11 = (_10 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _10 === void 0 ? void 0 : _10.document_data) === null || _11 === void 0 ? void 0 : _11.cropped_document_image) === null || _12 === void 0 ? void 0 : _12.info) === null || _13 === void 0 ? void 0 : _13.width, height: (_17 = (_16 = (_15 = (_14 = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _14 === void 0 ? void 0 : _14.document_data) === null || _15 === void 0 ? void 0 : _15.cropped_document_image) === null || _16 === void 0 ? void 0 : _16.info) === null || _17 === void 0 ? void 0 : _17.height, }, barcode_scan: false, }; if (returnType && returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createCallbackDelete = ({ callback }) => (operation, id, response_str) => { const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); const returnData = { call_status: returnValue.call_status.return_status, delete_status: returnValue.user_delete.status, delete_message: returnValue.user_delete.message, }; if (operation === 'delete') { callback(returnData); } } }; const createCallbackPredictAge = ({ callback, portrait, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); const returnData = { mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token, face_validation_status: (_d = (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.ages) === null || _b === void 0 ? void 0 : _b.ages[0]) === null || _c === void 0 ? void 0 : _c.face_validation) === null || _d === void 0 ? void 0 : _d.face_validation_status, antispoof_status: (_g = (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.ages) === null || _e === void 0 ? void 0 : _e.ages[0]) === null || _f === void 0 ? void 0 : _f.face_validation) === null || _g === void 0 ? void 0 : _g.antispoofing_status, age: (_j = (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.ages) === null || _h === void 0 ? void 0 : _h.ages[0]) === null || _j === void 0 ? void 0 : _j.estimated_age, call_status: (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _k === void 0 ? void 0 : _k.return_status, }; if (operation === 'estimate_age') { if (returnType && returnType === 'all') { callback(Object.assign(Object.assign({}, returnValue), { portrait })); } else { callback(Object.assign(Object.assign({}, returnData), { portrait })); } } } }; const createCallbackCompareDocumentAndFace = ({ callback, returnType }) => (operation, id, response_str) => { const isResponse = response_str.length > 0; printLogs('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : '', LOGTYPE.LOG); printLogs('[JS RESPONSE]: operation', operation || 'null', LOGTYPE.LOG); printLogs('[JS RESPONSE]: id', id || 'null', LOGTYPE.LOG); if (isResponse) { if (operation === 'compare_mugshot_and_face') { const returnValue = JSON.parse(response_str); const returnData = { image_a_face_validation_status: returnValue.face_compare.a_face_validation_status, image_b_face_validation_status: returnValue.face_compare.b_face_validation_status, call_status: returnValue.call_status.return_status, compare_score: returnValue.face_compare.conf_score, compare_status: returnValue.face_compare.result, }; if (returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; const createResultFaceISO = ({ callback, portrait, returnType }) => (operation, id, response_str) => { const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { const returnValue = JSON.parse(response_str); if (operation === 'face_iso') { callback(Object.assign(Object.assign({}, returnValue), { portrait })); } } }; const createCallbackScanDocumentNoFace = ({ callback, returnType }) => (operation, id, response_str) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; const isResponse = response_str.length > 0; console.log('================[JS RESPONSE]: response_str', isResponse ? JSON.parse(response_str) : ''); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: operation', operation || 'null'); // , LOGTYPE.LOG); console.log('[JS RESPONSE]: id', id || 'null'); // , LOGTYPE.LOG); if (isResponse) { if (operation === 'scan_doc_with_no_face') { const returnValue = JSON.parse(response_str); const returnData = { callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status, doc_validation_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _b === void 0 ? void 0 : _b.document_data.document_validation_status, cropped_document: { data: (_e = (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _c === void 0 ? void 0 : _c.document_data) === null || _d === void 0 ? void 0 : _d.cropped_document_image) === null || _e === void 0 ? void 0 : _e.data, width: (_j = (_h = (_g = (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _f === void 0 ? void 0 : _f.document_data) === null || _g === void 0 ? void 0 : _g.cropped_document_image) === null || _h === void 0 ? void 0 : _h.info) === null || _j === void 0 ? void 0 : _j.width, height: (_o = (_m = (_l = (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.doc_face) === null || _k === void 0 ? void 0 : _k.document_data) === null || _l === void 0 ? void 0 : _l.cropped_document_image) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.height, }, }; if (returnType === 'all') { callback(returnValue); } else { callback(returnData); } } } }; switch (type) { case callbakTypeEnum.isValid: return createCallbackIsValid({ callback: callbackFunction }); case callbakTypeEnum.enroll: return createCallbackEnroll({ callback: callbackFunction }); case callbakTypeEnum.predict: return createCallbackPredict({ callback: callbackFunction }); case callbakTypeEnum.faceLogin: return createCallbackPredict({ callback: callbackFunction }); case callbakTypeEnum.continuousPredict: return createCallbackPredict({ callback: callbackFunction }); case callbakTypeEnum.delete: return createCallbackDelete({ callback: callbackFunction }); case callbakTypeEnum.frontScan: return createCallbackFrontDlScan({ callback: callbackFunction }); case callbakTypeEnum.backScan: return createCallbackBackDlScan({ callback: callbackFunction, returnType }); case callbakTypeEnum.documentScanNoFace: return createCallbackScanDocumentNoFace({ callback: callbackFunction, returnType }); case callbakTypeEnum.documentOcr: return; case callbakTypeEnum.passportScan: return createCallbackFrontDlScan({ callback: callbackFunction, returnType }); case callbakTypeEnum.faceISO: return createResultFaceISO({ callback: callbackFunction, returnType, portrait }); case callbakTypeEnum.ageEstimation: return createCallbackPredictAge({ callback: callbackFunction, portrait, returnType }); case callbakTypeEnum.faceCompareDocumentAndFace: return createCallbackCompareDocumentAndFace({ callback: callbackFunction }); default: return null; } }; //# sourceMappingURL=createCallback.js.map