@smileid/web-components 11.0.3 → 11.2.0
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/README.md +61 -0
- package/dist/components/smart-camera-web/src/README.md +0 -1
- package/dist/esm/{DocumentCaptureScreens-C5BhNB-0.js → DocumentCaptureScreens-BbtA-WkX.js} +199 -193
- package/dist/esm/DocumentCaptureScreens-BbtA-WkX.js.map +1 -0
- package/dist/esm/{EndUserConsent-D4fd1ovG.js → EndUserConsent-HVufMamg.js} +65 -63
- package/dist/esm/EndUserConsent-HVufMamg.js.map +1 -0
- package/dist/esm/{Navigation-CTjK6tLU.js → Navigation-B-dqPkZj.js} +17 -9
- package/dist/esm/Navigation-B-dqPkZj.js.map +1 -0
- package/dist/esm/{SelfieCaptureScreens-KoQpCxtc.js → SelfieCaptureScreens-ChAMfKi3.js} +3274 -3329
- package/dist/esm/SelfieCaptureScreens-ChAMfKi3.js.map +1 -0
- package/dist/esm/{TotpConsent-CQU5jQi4.js → TotpConsent-XxR8TNxy.js} +13 -9
- package/dist/esm/TotpConsent-XxR8TNxy.js.map +1 -0
- package/dist/esm/combobox.js +20 -19
- package/dist/esm/combobox.js.map +1 -1
- package/dist/esm/document.js +1 -1
- package/dist/esm/end-user-consent.js +1 -1
- package/dist/esm/index-B_ozpejI.js +1360 -0
- package/dist/esm/index-B_ozpejI.js.map +1 -0
- package/dist/esm/localisation.js +21 -0
- package/dist/esm/localisation.js.map +1 -0
- package/dist/esm/main.js +34 -17
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/navigation.js +1 -1
- package/dist/esm/{package-B-UwEdv7.js → package-u3FEJ3Fm.js} +25 -40
- package/dist/esm/package-u3FEJ3Fm.js.map +1 -0
- package/dist/esm/selfie.js +1 -1
- package/dist/esm/smart-camera-web.js +32 -23
- package/dist/esm/smart-camera-web.js.map +1 -1
- package/dist/esm/totp-consent.js +1 -1
- package/dist/package.json +1 -1
- package/dist/smart-camera-web.js +144 -160
- package/dist/smart-camera-web.js.map +1 -1
- package/dist/src/components/combobox/src/index.js +424 -1
- package/dist/src/components/document/src/index.js +1422 -1
- package/dist/src/components/end-user-consent/src/index.js +1573 -1
- package/dist/src/components/selfie/src/index.js +1220 -1
- package/dist/src/components/signature-pad/src/index.js +787 -1
- package/dist/src/components/smart-camera-web/src/SmartCameraWeb.js +2753 -1
- package/dist/src/components/totp-consent/src/index.js +1292 -1
- package/dist/types/combobox.d.ts +2 -2
- package/dist/types/document.d.ts +2 -2
- package/dist/types/end-user-consent.d.ts +2 -2
- package/dist/types/locale.d.ts +19 -0
- package/dist/types/localisation.d.ts +21 -0
- package/dist/types/main.d.ts +35 -26
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/selfie.d.ts +2 -2
- package/dist/types/signature-pad.d.ts +2 -2
- package/dist/types/smart-camera-web.d.ts +2 -2
- package/dist/types/totp-consent.d.ts +2 -2
- package/lib/components/camera-permission/CameraPermission.js +9 -4
- package/lib/components/combobox/src/Combobox.js +4 -2
- package/lib/components/document/src/DocumentCaptureScreens.js +4 -3
- package/lib/components/document/src/DocumentCaptureScreens.stories.js +37 -13
- package/lib/components/document/src/document-capture/DocumentCapture.js +23 -17
- package/lib/components/document/src/document-capture/DocumentCapture.stories.js +11 -2
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.js +19 -14
- package/lib/components/document/src/document-capture-instructions/DocumentCaptureInstructions.stories.js +14 -5
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.js +14 -10
- package/lib/components/document/src/document-capture-review/DocumentCaptureReview.stories.js +14 -5
- package/lib/components/end-user-consent/src/EndUserConsent.js +30 -29
- package/lib/components/end-user-consent/src/EndUserConsent.stories.js +12 -2
- package/lib/components/navigation/src/Navigation.js +15 -2
- package/lib/components/navigation/src/Navigation.stories.js +20 -4
- package/lib/components/selfie/src/SelfieCaptureScreens.js +12 -8
- package/lib/components/selfie/src/SelfieCaptureScreens.stories.js +16 -4
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.js +25 -18
- package/lib/components/selfie/src/selfie-capture/SelfieCapture.stories.js +19 -7
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.js +19 -14
- package/lib/components/selfie/src/selfie-capture-instructions/SelfieCaptureInstructions.stories.js +14 -5
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.js +13 -8
- package/lib/components/selfie/src/selfie-capture-review/SelfieCaptureReview.stories.js +14 -5
- package/lib/components/selfie/src/selfie-capture-wrapper/SelfieCaptureWrapper.tsx +98 -47
- package/lib/components/selfie/src/smartselfie-capture/SmartSelfieCapture.tsx +2 -2
- package/lib/components/selfie/src/smartselfie-capture/components/CaptureControls.tsx +5 -2
- package/lib/components/selfie/src/smartselfie-capture/hooks/useCamera.ts +4 -4
- package/lib/components/selfie/src/smartselfie-capture/hooks/useFaceCapture.ts +6 -5
- package/lib/components/selfie/src/smartselfie-capture/utils/alertMessages.ts +11 -9
- package/lib/components/selfie/src/smartselfie-capture/utils/imageCapture.ts +3 -1
- package/lib/components/signature-pad/package.json +1 -1
- package/lib/components/smart-camera-web/src/SmartCameraWeb.js +9 -1
- package/lib/components/totp-consent/src/TotpConsent.js +8 -3
- package/lib/domain/camera/src/SmartCamera.js +7 -22
- package/lib/domain/constants/src/Constants.js +28 -0
- package/lib/domain/file-upload/src/SmartFileUpload.js +9 -10
- package/lib/domain/localisation/index.js +456 -0
- package/package.json +13 -7
- package/dist/esm/DocumentCaptureScreens-C5BhNB-0.js.map +0 -1
- package/dist/esm/EndUserConsent-D4fd1ovG.js.map +0 -1
- package/dist/esm/Navigation-CTjK6tLU.js.map +0 -1
- package/dist/esm/SelfieCaptureScreens-KoQpCxtc.js.map +0 -1
- package/dist/esm/TotpConsent-CQU5jQi4.js.map +0 -1
- package/dist/esm/package-B-UwEdv7.js.map +0 -1
|
@@ -1,4 +1,1295 @@
|
|
|
1
|
-
(()=>{var O=Object.create;var E=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var T=(m,o)=>()=>(o||m((o={exports:{}}).exports,o),o.exports);var q=(m,o,u,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of D(o))!N.call(m,i)&&i!==u&&E(m,i,{get:()=>o[i],enumerable:!(f=C(o,i))||f.enumerable});return m};var F=(m,o,u)=>(u=m!=null?O(B(m)):{},q(o||!m||!m.__esModule?E(u,"default",{value:m,enumerable:!0}):u,m));var k=T((v,x)=>{(function(m,o,u){"use strict";var f=function(e,t,r){r=i.extend({},i.options,r);var s=i.runValidations(e,t,r),a,n;if(s.some(function(l){return i.isPromise(l.error)}))throw new Error("Use validate.async if you want support for promises");return f.processValidationResults(s,r)},i=f;i.extend=function(e){return[].slice.call(arguments,1).forEach(function(t){for(var r in t)e[r]=t[r]}),e},i.extend(f,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var e=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(e+="+"+i.version.metadata),e}},Promise:typeof Promise<"u"?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(e,t,r){var s=[],a,n,l,d,c,h,p;(i.isDomElement(e)||i.isJqueryElement(e))&&(e=i.collectFormValues(e));for(a in t){l=i.getDeepObjectValue(e,a),d=i.result(t[a],l,e,a,r,t);for(n in d){if(c=i.validators[n],!c)throw p=i.format("Unknown validator %{name}",{name:n}),new Error(p);h=d[n],h=i.result(h,l,e,a,r,t),h&&s.push({attribute:a,value:l,validator:n,globalOptions:r,attributes:e,options:h,error:c.call(c,l,h,a,e,r)})}}return s},processValidationResults:function(e,t){e=i.pruneEmptyErrors(e,t),e=i.expandMultipleErrors(e,t),e=i.convertErrorMessages(e,t);var r=t.format||"grouped";if(typeof i.formatters[r]=="function")e=i.formatters[r](e);else throw new Error(i.format("Unknown format %{format}",t));return i.isEmpty(e)?void 0:e},async:function(e,t,r){r=i.extend({},i.async.options,r);var s=r.wrapErrors||function(n){return n};r.cleanAttributes!==!1&&(e=i.cleanAttributes(e,t));var a=i.runValidations(e,t,r);return new i.Promise(function(n,l){i.waitForResults(a).then(function(){var d=i.processValidationResults(a,r);d?l(new s(d,r,e,t)):n(e)},function(d){l(d)})})},single:function(e,t,r){return r=i.extend({},i.single.options,r,{format:"flat",fullMessages:!1}),i({single:e},{single:t},r)},waitForResults:function(e){return e.reduce(function(t,r){return i.isPromise(r.error)?t.then(function(){return r.error.then(function(s){r.error=s||null})}):t},new i.Promise(function(t){t()}))},result:function(e){var t=[].slice.call(arguments,1);return typeof e=="function"&&(e=e.apply(null,t)),e},isNumber:function(e){return typeof e=="number"&&!isNaN(e)},isFunction:function(e){return typeof e=="function"},isInteger:function(e){return i.isNumber(e)&&e%1===0},isBoolean:function(e){return typeof e=="boolean"},isObject:function(e){return e===Object(e)},isDate:function(e){return e instanceof Date},isDefined:function(e){return e!=null},isPromise:function(e){return!!e&&i.isFunction(e.then)},isJqueryElement:function(e){return e&&i.isString(e.jquery)},isDomElement:function(e){return!e||!e.querySelectorAll||!e.querySelector?!1:i.isObject(document)&&e===document?!0:typeof HTMLElement=="object"?e instanceof HTMLElement:e&&typeof e=="object"&&e!==null&&e.nodeType===1&&typeof e.nodeName=="string"},isEmpty:function(e){var t;if(!i.isDefined(e))return!0;if(i.isFunction(e))return!1;if(i.isString(e))return i.EMPTY_STRING_REGEXP.test(e);if(i.isArray(e))return e.length===0;if(i.isDate(e))return!1;if(i.isObject(e)){for(t in e)return!1;return!0}return!1},format:i.extend(function(e,t){return i.isString(e)?e.replace(i.format.FORMAT_REGEXP,function(r,s,a){return s==="%"?"%{"+a+"}":String(t[a])}):e},{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(e){return i.isNumber(e)?e*100%1===0?""+e:parseFloat(Math.round(e*100)/100).toFixed(2):i.isArray(e)?e.map(function(t){return i.prettify(t)}).join(", "):i.isObject(e)?i.isDefined(e.toString)?e.toString():JSON.stringify(e):(e=""+e,e.replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,function(t,r,s){return""+r+" "+s.toLowerCase()}).toLowerCase())},stringifyValue:function(e,t){var r=t&&t.prettify||i.prettify;return r(e)},isString:function(e){return typeof e=="string"},isArray:function(e){return{}.toString.call(e)==="[object Array]"},isHash:function(e){return i.isObject(e)&&!i.isArray(e)&&!i.isFunction(e)},contains:function(e,t){return i.isDefined(e)?i.isArray(e)?e.indexOf(t)!==-1:t in e:!1},unique:function(e){return i.isArray(e)?e.filter(function(t,r,s){return s.indexOf(t)==r}):e},forEachKeyInKeypath:function(e,t,r){if(i.isString(t)){var s="",a,n=!1;for(a=0;a<t.length;++a)switch(t[a]){case".":n?(n=!1,s+="."):(e=r(e,s,!1),s="");break;case"\\":n?(n=!1,s+="\\"):n=!0;break;default:n=!1,s+=t[a];break}return r(e,s,!0)}},getDeepObjectValue:function(e,t){if(i.isObject(e))return i.forEachKeyInKeypath(e,t,function(r,s){if(i.isObject(r))return r[s]})},collectFormValues:function(e,t){var r={},s,a,n,l,d,c;if(i.isJqueryElement(e)&&(e=e[0]),!e)return r;for(t=t||{},l=e.querySelectorAll("input[name], textarea[name]"),s=0;s<l.length;++s)if(n=l.item(s),!i.isDefined(n.getAttribute("data-ignored"))){var h=n.name.replace(/\./g,"\\\\.");c=i.sanitizeFormValue(n.value,t),n.type==="number"?c=c?+c:null:n.type==="checkbox"?n.attributes.value?n.checked||(c=r[h]||null):c=n.checked:n.type==="radio"&&(n.checked||(c=r[h]||null)),r[h]=c}for(l=e.querySelectorAll("select[name]"),s=0;s<l.length;++s)if(n=l.item(s),!i.isDefined(n.getAttribute("data-ignored"))){if(n.multiple){c=[];for(a in n.options)d=n.options[a],d&&d.selected&&c.push(i.sanitizeFormValue(d.value,t))}else{var p=typeof n.options[n.selectedIndex]<"u"?n.options[n.selectedIndex].value:"";c=i.sanitizeFormValue(p,t)}r[n.name]=c}return r},sanitizeFormValue:function(e,t){return t.trim&&i.isString(e)&&(e=e.trim()),t.nullify!==!1&&e===""?null:e},capitalize:function(e){return i.isString(e)?e[0].toUpperCase()+e.slice(1):e},pruneEmptyErrors:function(e){return e.filter(function(t){return!i.isEmpty(t.error)})},expandMultipleErrors:function(e){var t=[];return e.forEach(function(r){i.isArray(r.error)?r.error.forEach(function(s){t.push(i.extend({},r,{error:s}))}):t.push(r)}),t},convertErrorMessages:function(e,t){t=t||{};var r=[],s=t.prettify||i.prettify;return e.forEach(function(a){var n=i.result(a.error,a.value,a.attribute,a.options,a.attributes,a.globalOptions);if(!i.isString(n)){r.push(a);return}n[0]==="^"?n=n.slice(1):t.fullMessages!==!1&&(n=i.capitalize(s(a.attribute))+" "+n),n=n.replace(/\\\^/g,"^"),n=i.format(n,{value:i.stringifyValue(a.value,t)}),r.push(i.extend({},a,{error:n}))}),r},groupErrorsByAttribute:function(e){var t={};return e.forEach(function(r){var s=t[r.attribute];s?s.push(r):t[r.attribute]=[r]}),t},flattenErrorsToArray:function(e){return e.map(function(t){return t.error}).filter(function(t,r,s){return s.indexOf(t)===r})},cleanAttributes:function(e,t){function r(n,l,d){return i.isObject(n[l])?n[l]:n[l]=d?!0:{}}function s(n){var l={},d,c;for(c in n)n[c]&&i.forEachKeyInKeypath(l,c,r);return l}function a(n,l){if(!i.isObject(n))return n;var d=i.extend({},n),c,h;for(h in n)c=l[h],i.isObject(c)?d[h]=a(d[h],c):c||delete d[h];return d}return!i.isObject(t)||!i.isObject(e)?{}:(t=s(t),a(e,t))},exposeModule:function(e,t,r,s,a){r?(s&&s.exports&&(r=s.exports=e),r.validate=e):(t.validate=e,e.isFunction(a)&&a.amd&&a([],function(){return e}))},warn:function(e){typeof console<"u"&&console.warn&&console.warn("[validate.js] "+e)},error:function(e){typeof console<"u"&&console.error&&console.error("[validate.js] "+e)}}),f.validators={presence:function(e,t){if(t=i.extend({},this.options,t),t.allowEmpty!==!1?!i.isDefined(e):i.isEmpty(e))return t.message||this.message||"can't be blank"},length:function(e,t,r){if(i.isDefined(e)){t=i.extend({},this.options,t);var s=t.is,a=t.maximum,n=t.minimum,l=t.tokenizer||function(p){return p},d,c=[];e=l(e);var h=e.length;if(!i.isNumber(h))return t.message||this.notValid||"has an incorrect length";if(i.isNumber(s)&&h!==s&&(d=t.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",c.push(i.format(d,{count:s}))),i.isNumber(n)&&h<n&&(d=t.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",c.push(i.format(d,{count:n}))),i.isNumber(a)&&h>a&&(d=t.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",c.push(i.format(d,{count:a}))),c.length>0)return t.message||c}},numericality:function(e,t,r,s,a){if(i.isDefined(e)){t=i.extend({},this.options,t);var n=[],l,d,c={greaterThan:function(g,b){return g>b},greaterThanOrEqualTo:function(g,b){return g>=b},equalTo:function(g,b){return g===b},lessThan:function(g,b){return g<b},lessThanOrEqualTo:function(g,b){return g<=b},divisibleBy:function(g,b){return g%b===0}},h=t.prettify||a&&a.prettify||i.prettify;if(i.isString(e)&&t.strict){var p="^-?(0|[1-9]\\d*)";if(t.onlyInteger||(p+="(\\.\\d+)?"),p+="$",!new RegExp(p).test(e))return t.message||t.notValid||this.notValid||this.message||"must be a valid number"}if(t.noStrings!==!0&&i.isString(e)&&!i.isEmpty(e)&&(e=+e),!i.isNumber(e))return t.message||t.notValid||this.notValid||this.message||"is not a number";if(t.onlyInteger&&!i.isInteger(e))return t.message||t.notInteger||this.notInteger||this.message||"must be an integer";for(l in c)if(d=t[l],i.isNumber(d)&&!c[l](e,d)){var y="not"+i.capitalize(l),M=t[y]||this[y]||this.message||"must be %{type} %{count}";n.push(i.format(M,{count:d,type:h(l)}))}if(t.odd&&e%2!==1&&n.push(t.notOdd||this.notOdd||this.message||"must be odd"),t.even&&e%2!==0&&n.push(t.notEven||this.notEven||this.message||"must be even"),n.length)return t.message||n}},datetime:i.extend(function(e,t){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(e)){t=i.extend({},this.options,t);var r,s=[],a=t.earliest?this.parse(t.earliest,t):NaN,n=t.latest?this.parse(t.latest,t):NaN;if(e=this.parse(e,t),isNaN(e)||t.dateOnly&&e%864e5!==0)return r=t.notValid||t.message||this.notValid||"must be a valid date",i.format(r,{value:arguments[0]});if(!isNaN(a)&&e<a&&(r=t.tooEarly||t.message||this.tooEarly||"must be no earlier than %{date}",r=i.format(r,{value:this.format(e,t),date:this.format(a,t)}),s.push(r)),!isNaN(n)&&e>n&&(r=t.tooLate||t.message||this.tooLate||"must be no later than %{date}",r=i.format(r,{date:this.format(n,t),value:this.format(e,t)}),s.push(r)),s.length)return i.unique(s)}},{parse:null,format:null}),date:function(e,t){return t=i.extend({},t,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,e,t)},format:function(e,t){(i.isString(t)||t instanceof RegExp)&&(t={pattern:t}),t=i.extend({},this.options,t);var r=t.message||this.message||"is invalid",s=t.pattern,a;if(i.isDefined(e)&&(!i.isString(e)||(i.isString(s)&&(s=new RegExp(t.pattern,t.flags)),a=s.exec(e),!a||a[0].length!=e.length)))return r},inclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),!i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is not included in the list";return i.format(r,{value:e})}},exclusion:function(e,t){if(i.isDefined(e)&&(i.isArray(t)&&(t={within:t}),t=i.extend({},this.options,t),!!i.contains(t.within,e))){var r=t.message||this.message||"^%{value} is restricted";return i.isString(t.within[e])&&(e=t.within[e]),i.format(r,{value:e})}},email:i.extend(function(e,t){t=i.extend({},this.options,t);var r=t.message||this.message||"is not a valid email";if(i.isDefined(e)&&(!i.isString(e)||!this.PATTERN.exec(e)))return r},{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(e,t,r,s,a){if(i.isDefined(e)){i.isString(t)&&(t={attribute:t}),t=i.extend({},this.options,t);var n=t.message||this.message||"is not equal to %{attribute}";if(i.isEmpty(t.attribute)||!i.isString(t.attribute))throw new Error("The attribute must be a non empty string");var l=i.getDeepObjectValue(s,t.attribute),d=t.comparator||function(h,p){return h===p},c=t.prettify||a&&a.prettify||i.prettify;if(!d(e,l,t,r,s))return i.format(n,{attribute:c(t.attribute)})}},url:function(e,t){if(i.isDefined(e)){t=i.extend({},this.options,t);var r=t.message||this.message||"is not a valid url",s=t.schemes||this.schemes||["http","https"],a=t.allowLocal||this.allowLocal||!1,n=t.allowDataUrl||this.allowDataUrl||!1;if(!i.isString(e))return r;var l="^(?:(?:"+s.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",d="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(a?d+="?":l+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",l+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+d+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",n){var c="\\w+\\/[-+.\\w]+(?:;[\\w=]+)*",h="[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*",p="data:(?:"+c+")?(?:;base64)?,"+h;l="(?:"+l+")|(?:^"+p+"$)"}var y=new RegExp(l,"i");if(!y.exec(e))return r}},type:i.extend(function(e,t,r,s,a){if(i.isString(t)&&(t={type:t}),!!i.isDefined(e)){var n=i.extend({},this.options,t),l=n.type;if(!i.isDefined(l))throw new Error("No type was specified");var d;if(i.isFunction(l)?d=l:d=this.types[l],!i.isFunction(d))throw new Error("validate.validators.type.types."+l+" must be a function.");if(!d(e,n,r,s,a)){var c=t.message||this.messages[l]||this.message||n.message||(i.isFunction(l)?"must be of the correct type":"must be of type %{type}");return i.isFunction(c)&&(c=c(e,t,r,s,a)),i.format(c,{attribute:i.prettify(r),type:l})}}},{types:{object:function(e){return i.isObject(e)&&!i.isArray(e)},array:i.isArray,integer:i.isInteger,number:i.isNumber,string:i.isString,date:i.isDate,boolean:i.isBoolean},messages:{}})},f.formatters={detailed:function(e){return e},flat:i.flattenErrorsToArray,grouped:function(e){var t;e=i.groupErrorsByAttribute(e);for(t in e)e[t]=i.flattenErrorsToArray(e[t]);return e},constraint:function(e){var t;e=i.groupErrorsByAttribute(e);for(t in e)e[t]=e[t].map(function(r){return r.validator}).sort();return e}},f.exposeModule(f,this,m,o,u)}).call(v,typeof v<"u"?v:null,typeof x<"u"?x:null,typeof define<"u"?define:null)});var A=F(k(),1);function S(m,o){return fetch(m,{body:JSON.stringify(o),cache:"no-cache",headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",mode:"cors"})}function _(){return"\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n :host {\n --flow-space: 1.5rem;\n\n --color-dark: #404040;\n --color-grey: #555B69;\n\n --color-success: #1EB244;\n --color-failure: #FFEDEB;\n --color-failure-tint: #F86B58;\n\n --color-richblue: #043C93;\n --color-theme: ".concat(this.themeColor,";\n\n --color-active: #2D2B2A;\n --color-default: #001096;\n --color-disabled: #848282;\n }\n\n html {\n font-family: 'DM Sans', sans-serif;\n }\n\n [hidden] {\n display: none !important;\n }\n\n [disabled] {\n cursor: not-allowed !important;\n }\n\n .visually-hidden {\n border: 0;\n clip: rect(1px 1px 1px 1px);\n clip: rect(1px, 1px, 1px, 1px);\n height: auto;\n margin: 0;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n\n .color-dark {\n color: var(--color-dark);\n }\n\n .color-grey {\n color: var(--color-grey);\n }\n\n .flow > * + * {\n margin-top: var(--flow-space);\n }\n\n .center {\n margin-left: auto;\n margin-right: auto;\n\n text-align: center;\n }\n\n h1 {\n font-size: 1.5rem;\n font-weight: 700;\n }\n\n button, input, select, textarea {\n font: inherit\n }\n\n label,\n input,\n select,\n textarea {\n --flow-space: .5rem;\n display: block;\n width: 100%;\n }\n\n input,\n select,\n textarea {\n border: 1px solid #d1d8d6;\n border-radius: .5rem;\n padding: .75rem 1rem;\n }\n\n button {\n --button-color: var(--color-default);\n --flow-space: 3rem;\n -webkit-appearance: none;\n -moz-appearance: none;\n align-items: center;\n appearance: none;\n background-color: transparent;\n border-radius: 2.5rem;\n border: none;\n color: #ffffff;\n cursor: pointer;\n display: inline-flex;\n font-size: 20px;\n font-weight: 500;\n inline-size: 100%;\n justify-content: center;\n letter-spacing: .05ch;\n line-height: 1;\n padding: 1rem 2.5rem;\n text-align: center;\n text-decoration: none;\n }\n\n button[data-variant='solid'] {\n background-color: var(--button-color);\n border: 2px solid var(--button-color);\n }\n\n button[data-variant='outline'] {\n color: var(--button-color);\n border: 2px solid var(--button-color);\n }\n\n button[data-variant='ghost'] {\n color: var(--button-color);\n }\n\n button:hover,\n button:focus,\n button:active {\n --button-color: var(--color-active);\n }\n\n button:disabled {\n --button-color: var(--color-disabled);\n }\n\n button[data-type='icon'] {\n height: 2rem;\n padding: 0;\n width: 2rem;\n background: transparent;\n }\n\n input {\n font: inherit;\n }\n\n fieldset {\n margin: 0;\n border: none;\n }\n\n .font-weight:bold {\n font-weight: bold;\n }\n\n .justify-right {\n justify-content: end !important;\n }\n .nav {\n display: flex;\n justify-content: space-between;\n }\n\n .back-wrapper {\n display: flex;\n align-items: center;\n }\n\n .back-button-text {\n font-size: 11px;\n line-height: 11px;\n color: ").concat(this.themeColor||"rgb(21, 31, 114)",';\n }\n\n #error,\n .validation-message {\n color: red;\n text-transform: capitalize;\n }\n\n .input-group {\n --flow-space: 1.5rem;\n text-align: initial;\n }\n\n .input-radio {\n --flow-space: 1.5rem;\n background-color: #F8F8F8;\n border-radius: .5rem;\n padding: .625rem 1rem;\n display: flex;\n align-items: center;\n }\n\n .otp-mode {\n display: flex;\n align-items: center;\n text-align: initial;\n }\n\n .otp-mode :first-child {\n margin: 0;\n margin-inline-end: 1rem;\n }\n\n .otp-mode :nth-child(2n) {\n --flow-space: .5rem;\n }\n\n .input-radio [type=\'radio\'] {\n border-radius: 50%;\n inline-size: 2rem;\n block-size: 2rem;\n margin-inline-end: .5rem;\n background-color: white;\n border: .125rem solid #f5f5f5;\n }\n\n #totp-token {\n block-size: 3rem;\n inline-size: 20rem;\n max-inline-size: 100%;\n background-color: #F5F5F5;\n border: none;\n border-bottom: 2px solid #2F718D;\n font-size: 1.5rem;\n text-align: center;\n font-weight: 700;\n letter-spacing: 2rem;\n padding: .5rem 1rem;\n margin-inline: auto;\n }\n\n @keyframes spin {\n 0% {\n transform: translate3d(-50%, -50%, 0) rotate(0deg);\n }\n 100% {\n transform: translate3d(-50%, -50%, 0) rotate(360deg);\n }\n }\n\n .spinner {\n animation: 1.5s linear infinite spin;\n animation-play-state: inherit;\n border: solid 5px #cfd0d1;\n border-bottom-color: var(--color-active);\n border-radius: 50%;\n content: "";\n display: block;\n height: 25px;\n width: 25px;\n will-change: transform;\n position: relative;\n top: .675rem;\n left: 1.25rem;\n }\n </style>\n\n <div class=\'flow center\' id=\'id-entry\'>\n <div class="nav">\n <div class="back-wrapper">\n <button type=\'button\' data-type=\'icon\' id="back-button" class="back-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="').concat(this.themeColor,'" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>\n </svg>\n </button>\n <div class="back-button-text">Back</div>\n </div>\n <button data-type=\'icon\' type=\'button\' class=\'close-iframe\'>\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="#91190F" d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"/>\n </svg>\n <span class=\'visually-hidden\'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n Enter your ').concat(this.idTypeLabel,"\n </h1>\n\n <form name='id-entry-form' class='flow' novalidate style='--flow-space: 5.5rem'>\n <div id='id-number' class=\"input-group flow\">\n <label class='required' for=\"id_number\">\n ").concat(this.idTypeLabel,"\n </label>\n\n <input aria-required='true' id=\"id_number\" name=\"id_number\"\n maxlength='11' placeholder='' />\n\n <p>\n <small>").concat(this.idHint,'</small>\n </p>\n </div>\n\n <button data-variant=\'solid\' id=\'query-otp-modes\' type=\'submit\'>\n <span class=\'text\'>Continue</span>\n <svg aria-hidden=\'true\' width="25" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7 12h11m0 0-4.588-4M18 12l-4.588 4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n <span hidden class=\'spinner\'></span>\n </button>\n </form>\n </div>\n\n <div hidden class=\'flow center\' id=\'select-mode\'>\n <div class="nav">\n <div class="back-wrapper">\n <button type=\'button\' data-type=\'icon\' id="back-to-entry-button" class="back-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="').concat(this.themeColor,"\" d=\"M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z\"/>\n </svg>\n </button>\n <div class=\"back-button-text\">Back</div>\n </div>\n <button data-type='icon' type='button' class='close-iframe'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\">\n <path fill=\"#DBDBC4\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z\" opacity=\".4\"/>\n <path fill=\"#91190F\" d=\"m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z\"/>\n </svg>\n <span class='visually-hidden'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n Select contact method\n </h1>\n\n <form name='select-mode-form' novalidate style='--flow-space: 4.25rem' id='otp-entry' class='flow center'>\n <fieldset class='flow center'>\n <legend class='flow' style='--flow-space: 1.5rem'>\n <p>\n NIBSS, the data custodian of BVN, \n will send you a One-Time Password (OTP) \n </p>\n\n <p>\n <small>\n The request will be from Chams Plc, who is NIBSS' technical partner.\n </small>\n </p>\n </legend>\n\n <div class='flow center'>\n ").concat(this.modes.length?this.modes.map(m=>'<label class=\'input-radio\'>\n <input type="radio" id="" name="mode" value="'.concat(Object.keys(m)[0],"\">\n <div class='otp-mode'>\n ").concat(Object.keys(m)[0].includes("sms")?'\n <svg xmlns="http://www.w3.org/2000/svg" width="29" height="37" fill="none">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.697 24.12c4.914 0 7.37 0 8.897-1.652 1.527-1.651 1.527-4.31 1.527-9.625 0-5.316 0-7.974-1.527-9.625-1.526-1.651-3.983-1.651-8.897-1.651h-5.211c-4.914 0-7.37 0-8.897 1.651-1.527 1.651-1.527 4.31-1.527 9.625 0 5.316 0 7.974 1.527 9.625.85.92 1.991 1.328 3.685 1.508"/>\n <g filter="url(#sms)">\n <path stroke="#2F718D" stroke-linecap="round" stroke-width="2" d="M16.697 24.12c-1.61 0-3.384.703-5.005 1.613-2.602 1.462-3.903 2.193-4.545 1.727-.64-.465-.52-1.91-.277-4.799l.055-.656" shape-rendering="crispEdges"/>\n </g>\n <defs>\n <filter id="sms" width="20.023" height="15.595" x="1.675" y="21.005" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>\n <feOffset dy="4"/>\n <feGaussianBlur stdDeviation="2"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_404"/>\n <feBlend in="SourceGraphic" in2="effect1_dropShadow_2_404" result="shape"/>\n </filter>\n </defs>\n </svg>\n ':'\n <svg xmlns="http://www.w3.org/2000/svg" width="35" height="24" fill="none">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.062 4.367c0-1.437 1.221-2.603 2.727-2.603h21.815c1.506 0 2.727 1.166 2.727 2.603v15.62c0 1.438-1.221 2.604-2.727 2.604H6.789c-1.506 0-2.727-1.166-2.727-2.604V4.367Z"/>\n <g filter="url(#message)">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m5.426 3.066 8.647 7.338c2.067 1.754 5.18 1.754 7.247 0l8.648-7.338" shape-rendering="crispEdges"/>\n </g>\n <defs>\n <filter id="message" width="34.042" height="18.154" x=".676" y="2.316" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>\n <feOffset dy="4"/>\n <feGaussianBlur stdDeviation="2"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_394"/>\n <feBlend in="SourceGraphic" in2="effect1_dropShadow_2_394" result="shape"/>\n </filter>\n </defs>\n </svg>\n ',"\n <div class='flow'>\n <p>\n ").concat(Object.values(m)[0],"\n </p>\n <p>\n <small>\n An OTP will be sent by ").concat(Object.keys(m)[0].includes("sms")?"sms":"email"," to verify your identity\n </small>\n </p>\n </div>\n </div>\n </label>")).join("\n"):"No modes yet","\n </div>\n </fieldset>\n\n <button data-variant='ghost' id='contact-methods-outdated' style='--flow-space: .5rem' class='' type='button'>\n I am no longer using any of these options\n </button>\n\n <button data-variant='solid' id='select-otp-mode' type='submit'>\n <span class='text'>Continue</span>\n <svg aria-hidden='true' width=\"25\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 12h11m0 0-4.588-4M18 12l-4.588 4\" stroke=\"#fff\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span hidden class='spinner'></span>\n </button>\n </form>\n </div>\n\n <div hidden class='flow center' id='otp-verification'>\n <div class=\"nav justify-right\">\n <button data-type='icon' type='button' class='close-iframe'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\">\n <path fill=\"#DBDBC4\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z\" opacity=\".4\"/>\n <path fill=\"#91190F\" d=\"m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z\"/>\n </svg>\n <span class='visually-hidden'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n OTP Verification\n </h1>\n\n <div style='--flow-space: 4.25rem' id='otp-entry'>\n <form name='otp-submission-form' novalidate style='--flow-space: 1.5rem' class='flow center'>\n <label for='totp-token'>\n Enter the OTP sent to <span class='font-weight:bold'>").concat(this.selectedOtpDeliveryMode,"</span>\n </label>\n <input type='text' id='totp-token' maxlength='6' inputmode='numeric' autocomplete='one-time-code' />\n\n <p>\n Didn't receive the OTP").concat(this.selectedOtpDeliveryMode?" at <span class='font-weight:bold'>".concat(this.selectedOtpDeliveryMode,"</span>?"):"?","\n </p>\n\n <button style='--flow-space: .5rem' data-variant='ghost' class='try-another-method' type='button'>\n Try another contact method\n </button>\n\n <button data-variant='solid' id='submit-otp' type='submit'>\n <span class='text'>Submit</span>\n <svg aria-hidden='true' width=\"25\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 12h11m0 0-4.588-4M18 12l-4.588 4\" stroke=\"#fff\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span hidden class='spinner'></span>\n </button>\n </form>\n </div>\n </div>\n ")}var w=class extends HTMLElement{constructor(){super(),this.templateString=_.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.modes=[],this["otp-delivery-mode"]="",this.queryOtpModes=this.queryOtpModes.bind(this),this.selectOtpMode=this.selectOtpMode.bind(this),this.submitOtp=this.submitOtp.bind(this),this.switchContactMethod=this.switchContactMethod.bind(this),this.handleTotpConsentGrant=this.handleTotpConsentGrant.bind(this),this.handleTotpConsentContactMethodsOutdated=this.handleTotpConsentContactMethodsOutdated.bind(this),this.pages=[]}static get observedAttributes(){return["modes","otp-delivery-mode"]}attributeChangedCallback(o){switch(o){case"modes":case"otp-delivery-mode":{let u=document.createElement("template");u.innerHTML=this.render();let f=u.content.cloneNode(!0).querySelector("#".concat(this.activeScreen.id));f.hidden=!1,this.shadowRoot.replaceChild(f,this.activeScreen),this.setUpEventListeners(),this.setActiveScreen(f);break}default:break}}setUpEventListeners(){this.idEntryScreen=this.shadowRoot.querySelector("#id-entry"),this.selectModeScreen=this.shadowRoot.querySelector("#select-mode"),this.otpVerificationScreen=this.shadowRoot.querySelector("#otp-verification"),this.activeScreen||(this.activeScreen=this.idEntryScreen),this.queryOtpModesButton=this.idEntryScreen.querySelector("#query-otp-modes"),this.backButton=this.idEntryScreen.querySelector("#back-button"),this.selectOtpModeButton=this.selectModeScreen.querySelector("#select-otp-mode"),this.entryBackbutton=this.selectModeScreen.querySelector("#back-to-entry-button"),this.contactMethodsOutdatedButton=this.selectModeScreen.querySelector("#contact-methods-outdated"),this.submitOtpButton=this.otpVerificationScreen.querySelector("#submit-otp"),this.switchContactMethodButton=this.otpVerificationScreen.querySelector(".try-another-method");let o=this.shadowRoot.querySelectorAll(".close-iframe");this.idNumberInput=this.idEntryScreen.querySelector("#id_number"),this.modeInputs=this.selectModeScreen.querySelectorAll('[name="mode"]'),this.otpInput=this.otpVerificationScreen.querySelector("#totp-token"),this.queryOtpModesButton.addEventListener("click",u=>this.queryOtpModes(u)),this.selectOtpModeButton.addEventListener("click",u=>this.selectOtpMode(u)),this.submitOtpButton.addEventListener("click",u=>this.submitOtp(u)),this.switchContactMethodButton.addEventListener("click",u=>this.switchContactMethod(u)),this.contactMethodsOutdatedButton.addEventListener("click",u=>this.handleTotpConsentContactMethodsOutdated(u)),this.entryBackbutton.addEventListener("click",()=>{this.handleBackClick()}),this.backButton.addEventListener("click",()=>{this.handleBackClick()}),o.forEach(u=>{u.addEventListener("click",()=>{this.closeWindow()},!1)})}closeWindow(){let o=window.parent;[o.parent,o].forEach(u=>{u.postMessage("SmileIdentity::Close","*")})}handleBackClick(){let o=this.pages.pop();o?this.setActiveScreen(o):this.dispatchEvent(new CustomEvent("end-user-consent.totp.cancelled",{}))}connectedCallback(){let o=document.createElement("template");o.innerHTML=this.render(),this.shadowRoot.appendChild(o.content.cloneNode(!0)),this.setUpEventListeners()}switchContactMethod(){this.queryOtpModes()}resetForm(){this.activeScreen.querySelectorAll("[aria-invalid]").forEach(f=>f.removeAttribute("aria-invalid")),this.activeScreen.querySelectorAll(".validation-message").forEach(f=>f.remove())}handleIdNumberValidationErrors(o){Object.keys(o).forEach(f=>{let i=this.activeScreen.querySelector("#".concat(f));i.setAttribute("aria-invalid","true"),i.setAttribute("aria-describedby","".concat(f,"-hint"));let e=document.createElement("div");e.setAttribute("id","".concat(f,"-hint")),e.setAttribute("class","validation-message"),e.textContent=o[f][0],i.insertAdjacentElement("afterend",e)})}handleActiveScreenErrors(o){let u=this.activeScreen.querySelector('[type="submit"]'),f=document.createElement("div");f.setAttribute("class","validation-message"),f.textContent=o,u.insertAdjacentElement("beforebegin",f)}validateIdNumber(o){let u={id_number:{format:new RegExp(this.idRegex),presence:{allowEmpty:!1,message:"is required"}}},f=(0,A.default)({id_number:o},u);return f&&this.handleIdNumberValidationErrors(f),f}async queryOtpModes(o){o&&(o.preventDefault(),this.resetForm());let u=this.validateIdNumber(this.idNumberInput.value);if(localStorage.setItem("idNumber",this.idNumberInput.value||this.idNumber),!u){let f={country:this.country,id_number:this.idNumber,id_type:this.idType,partner_id:this.partnerId,token:this.token},i="".concat(this.baseUrl,"/totp_consent");try{this.toggleLoading();let e=await S(i,f),t=await e.json();this.toggleLoading(),e.ok?(this.sessionId=t.session_id,this.modes=t.modes,this.setActiveScreen(this.selectModeScreen),this.setAttribute("modes",t.modes)):this.handleActiveScreenErrors(t.error)}catch(e){this.toggleLoading(),this.handleActiveScreenErrors(e.message)}}}async selectOtpMode(o){o.preventDefault(),this.resetForm(),this.mode=Array.prototype.find.call(this.modeInputs,i=>i.checked).value;let u={country:this.country,id_number:this.idNumber,id_type:this.idType,mode:this.mode,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},f="".concat(this.baseUrl,"/totp_consent/mode");try{this.toggleLoading();let i=await S(f,u),e=await i.json();this.toggleLoading(),i.ok?(this.selectedOtpDeliveryMode=this.modes.filter(t=>t[this.mode])[0][this.mode],this.setActiveScreen(this.otpVerificationScreen),this.setAttribute("otp-delivery-mode",this.selectedOtpDeliveryMode)):this.handleActiveScreenErrors(e.error)}catch(i){this.toggleLoading(),this.handleActiveScreenErrors(i.message)}}async submitOtp(o){o.preventDefault(),this.resetForm(),this.otp=this.otpInput.value;let u={country:this.country,id_number:this.idNumber,id_type:this.idType,otp:this.otp,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},f="".concat(this.baseUrl,"/totp_consent/otp");try{this.toggleLoading();let i=await S(f,u),e=await i.json();this.toggleLoading(),i.ok?this.handleTotpConsentGrant(o):this.handleActiveScreenErrors(e.error)}catch(i){this.toggleLoading(),this.handleActiveScreenErrors(i.message)}}toggleLoading(){let o=this.activeScreen.querySelector('button[type="submit"]'),u=o.querySelector(".text"),f=o.querySelector("svg"),i=o.querySelector(".spinner");o.toggleAttribute("disabled"),u.toggleAttribute("hidden"),f.toggleAttribute("hidden"),i.toggleAttribute("hidden")}setActiveScreen(o){this.activeScreen.hidden=!0,o.hidden=!1,this.activeScreen=o}get baseUrl(){return this.getAttribute("base-url")}get country(){return this.getAttribute("country")}get idHint(){return this.getAttribute("id-hint")||"Your BVN should be 11 digits long"}get idNumber(){return localStorage.getItem("idNumber")}get idRegex(){return this.getAttribute("id-regex")}get idType(){return this.getAttribute("id-type")}get idTypeLabel(){return this.getAttribute("id-type-label")}get partnerId(){return this.getAttribute("partner-id")}get partnerName(){return this.getAttribute("partner-name")}get token(){return this.getAttribute("token")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideBack(){return this.hasAttribute("hide-back")}get showNavigation(){return this.hasAttribute("show-navigation")}handleTotpConsentGrant(){let o=new CustomEvent("end-user-consent.totp.granted",{detail:{consented:{contact_information:!0,document_information:!0,personal_details:!0},id_number:this.idNumber,session_id:this.sessionId}});this.dispatchEvent(o)}handleTotpConsentContactMethodsOutdated(){let o="end-user-consent.totp.denied.contact-methods-outdated",u=new CustomEvent(o,{detail:{data:{id_number:this.idNumber,session_id:this.sessionId},message:o}});this.dispatchEvent(u)}};"customElements"in window&&!window.customElements.get("totp-consent")&&window.customElements.define("totp-consent",w);})();
|
|
1
|
+
(() => {
|
|
2
|
+
var O = Object.create;
|
|
3
|
+
var E = Object.defineProperty;
|
|
4
|
+
var C = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var D = Object.getOwnPropertyNames;
|
|
6
|
+
var B = Object.getPrototypeOf,
|
|
7
|
+
N = Object.prototype.hasOwnProperty;
|
|
8
|
+
var T = (m, o) => () => (o || m((o = { exports: {} }).exports, o), o.exports);
|
|
9
|
+
var q = (m, o, u, f) => {
|
|
10
|
+
if ((o && typeof o == 'object') || typeof o == 'function')
|
|
11
|
+
for (let i of D(o))
|
|
12
|
+
!N.call(m, i) &&
|
|
13
|
+
i !== u &&
|
|
14
|
+
E(m, i, {
|
|
15
|
+
get: () => o[i],
|
|
16
|
+
enumerable: !(f = C(o, i)) || f.enumerable,
|
|
17
|
+
});
|
|
18
|
+
return m;
|
|
19
|
+
};
|
|
20
|
+
var F = (m, o, u) => (
|
|
21
|
+
(u = m != null ? O(B(m)) : {}),
|
|
22
|
+
q(
|
|
23
|
+
o || !m || !m.__esModule
|
|
24
|
+
? E(u, 'default', { value: m, enumerable: !0 })
|
|
25
|
+
: u,
|
|
26
|
+
m,
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
var k = T((v, x) => {
|
|
30
|
+
(function (m, o, u) {
|
|
31
|
+
'use strict';
|
|
32
|
+
var f = function (e, t, r) {
|
|
33
|
+
r = i.extend({}, i.options, r);
|
|
34
|
+
var s = i.runValidations(e, t, r),
|
|
35
|
+
a,
|
|
36
|
+
n;
|
|
37
|
+
if (
|
|
38
|
+
s.some(function (l) {
|
|
39
|
+
return i.isPromise(l.error);
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
throw new Error(
|
|
43
|
+
'Use validate.async if you want support for promises',
|
|
44
|
+
);
|
|
45
|
+
return f.processValidationResults(s, r);
|
|
46
|
+
},
|
|
47
|
+
i = f;
|
|
48
|
+
((i.extend = function (e) {
|
|
49
|
+
return (
|
|
50
|
+
[].slice.call(arguments, 1).forEach(function (t) {
|
|
51
|
+
for (var r in t) e[r] = t[r];
|
|
52
|
+
}),
|
|
53
|
+
e
|
|
54
|
+
);
|
|
55
|
+
}),
|
|
56
|
+
i.extend(f, {
|
|
57
|
+
version: {
|
|
58
|
+
major: 0,
|
|
59
|
+
minor: 13,
|
|
60
|
+
patch: 1,
|
|
61
|
+
metadata: null,
|
|
62
|
+
toString: function () {
|
|
63
|
+
var e = i.format('%{major}.%{minor}.%{patch}', i.version);
|
|
64
|
+
return (
|
|
65
|
+
i.isEmpty(i.version.metadata) ||
|
|
66
|
+
(e += '+' + i.version.metadata),
|
|
67
|
+
e
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
Promise: typeof Promise < 'u' ? Promise : null,
|
|
72
|
+
EMPTY_STRING_REGEXP: /^\s*$/,
|
|
73
|
+
runValidations: function (e, t, r) {
|
|
74
|
+
var s = [],
|
|
75
|
+
a,
|
|
76
|
+
n,
|
|
77
|
+
l,
|
|
78
|
+
d,
|
|
79
|
+
c,
|
|
80
|
+
h,
|
|
81
|
+
p;
|
|
82
|
+
(i.isDomElement(e) || i.isJqueryElement(e)) &&
|
|
83
|
+
(e = i.collectFormValues(e));
|
|
84
|
+
for (a in t) {
|
|
85
|
+
((l = i.getDeepObjectValue(e, a)),
|
|
86
|
+
(d = i.result(t[a], l, e, a, r, t)));
|
|
87
|
+
for (n in d) {
|
|
88
|
+
if (((c = i.validators[n]), !c))
|
|
89
|
+
throw (
|
|
90
|
+
(p = i.format('Unknown validator %{name}', { name: n })),
|
|
91
|
+
new Error(p)
|
|
92
|
+
);
|
|
93
|
+
((h = d[n]),
|
|
94
|
+
(h = i.result(h, l, e, a, r, t)),
|
|
95
|
+
h &&
|
|
96
|
+
s.push({
|
|
97
|
+
attribute: a,
|
|
98
|
+
value: l,
|
|
99
|
+
validator: n,
|
|
100
|
+
globalOptions: r,
|
|
101
|
+
attributes: e,
|
|
102
|
+
options: h,
|
|
103
|
+
error: c.call(c, l, h, a, e, r),
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return s;
|
|
108
|
+
},
|
|
109
|
+
processValidationResults: function (e, t) {
|
|
110
|
+
((e = i.pruneEmptyErrors(e, t)),
|
|
111
|
+
(e = i.expandMultipleErrors(e, t)),
|
|
112
|
+
(e = i.convertErrorMessages(e, t)));
|
|
113
|
+
var r = t.format || 'grouped';
|
|
114
|
+
if (typeof i.formatters[r] == 'function') e = i.formatters[r](e);
|
|
115
|
+
else throw new Error(i.format('Unknown format %{format}', t));
|
|
116
|
+
return i.isEmpty(e) ? void 0 : e;
|
|
117
|
+
},
|
|
118
|
+
async: function (e, t, r) {
|
|
119
|
+
r = i.extend({}, i.async.options, r);
|
|
120
|
+
var s =
|
|
121
|
+
r.wrapErrors ||
|
|
122
|
+
function (n) {
|
|
123
|
+
return n;
|
|
124
|
+
};
|
|
125
|
+
r.cleanAttributes !== !1 && (e = i.cleanAttributes(e, t));
|
|
126
|
+
var a = i.runValidations(e, t, r);
|
|
127
|
+
return new i.Promise(function (n, l) {
|
|
128
|
+
i.waitForResults(a).then(
|
|
129
|
+
function () {
|
|
130
|
+
var d = i.processValidationResults(a, r);
|
|
131
|
+
d ? l(new s(d, r, e, t)) : n(e);
|
|
132
|
+
},
|
|
133
|
+
function (d) {
|
|
134
|
+
l(d);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
single: function (e, t, r) {
|
|
140
|
+
return (
|
|
141
|
+
(r = i.extend({}, i.single.options, r, {
|
|
142
|
+
format: 'flat',
|
|
143
|
+
fullMessages: !1,
|
|
144
|
+
})),
|
|
145
|
+
i({ single: e }, { single: t }, r)
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
waitForResults: function (e) {
|
|
149
|
+
return e.reduce(
|
|
150
|
+
function (t, r) {
|
|
151
|
+
return i.isPromise(r.error)
|
|
152
|
+
? t.then(function () {
|
|
153
|
+
return r.error.then(function (s) {
|
|
154
|
+
r.error = s || null;
|
|
155
|
+
});
|
|
156
|
+
})
|
|
157
|
+
: t;
|
|
158
|
+
},
|
|
159
|
+
new i.Promise(function (t) {
|
|
160
|
+
t();
|
|
161
|
+
}),
|
|
162
|
+
);
|
|
163
|
+
},
|
|
164
|
+
result: function (e) {
|
|
165
|
+
var t = [].slice.call(arguments, 1);
|
|
166
|
+
return (typeof e == 'function' && (e = e.apply(null, t)), e);
|
|
167
|
+
},
|
|
168
|
+
isNumber: function (e) {
|
|
169
|
+
return typeof e == 'number' && !isNaN(e);
|
|
170
|
+
},
|
|
171
|
+
isFunction: function (e) {
|
|
172
|
+
return typeof e == 'function';
|
|
173
|
+
},
|
|
174
|
+
isInteger: function (e) {
|
|
175
|
+
return i.isNumber(e) && e % 1 === 0;
|
|
176
|
+
},
|
|
177
|
+
isBoolean: function (e) {
|
|
178
|
+
return typeof e == 'boolean';
|
|
179
|
+
},
|
|
180
|
+
isObject: function (e) {
|
|
181
|
+
return e === Object(e);
|
|
182
|
+
},
|
|
183
|
+
isDate: function (e) {
|
|
184
|
+
return e instanceof Date;
|
|
185
|
+
},
|
|
186
|
+
isDefined: function (e) {
|
|
187
|
+
return e != null;
|
|
188
|
+
},
|
|
189
|
+
isPromise: function (e) {
|
|
190
|
+
return !!e && i.isFunction(e.then);
|
|
191
|
+
},
|
|
192
|
+
isJqueryElement: function (e) {
|
|
193
|
+
return e && i.isString(e.jquery);
|
|
194
|
+
},
|
|
195
|
+
isDomElement: function (e) {
|
|
196
|
+
return !e || !e.querySelectorAll || !e.querySelector
|
|
197
|
+
? !1
|
|
198
|
+
: i.isObject(document) && e === document
|
|
199
|
+
? !0
|
|
200
|
+
: typeof HTMLElement == 'object'
|
|
201
|
+
? e instanceof HTMLElement
|
|
202
|
+
: e &&
|
|
203
|
+
typeof e == 'object' &&
|
|
204
|
+
e !== null &&
|
|
205
|
+
e.nodeType === 1 &&
|
|
206
|
+
typeof e.nodeName == 'string';
|
|
207
|
+
},
|
|
208
|
+
isEmpty: function (e) {
|
|
209
|
+
var t;
|
|
210
|
+
if (!i.isDefined(e)) return !0;
|
|
211
|
+
if (i.isFunction(e)) return !1;
|
|
212
|
+
if (i.isString(e)) return i.EMPTY_STRING_REGEXP.test(e);
|
|
213
|
+
if (i.isArray(e)) return e.length === 0;
|
|
214
|
+
if (i.isDate(e)) return !1;
|
|
215
|
+
if (i.isObject(e)) {
|
|
216
|
+
for (t in e) return !1;
|
|
217
|
+
return !0;
|
|
218
|
+
}
|
|
219
|
+
return !1;
|
|
220
|
+
},
|
|
221
|
+
format: i.extend(
|
|
222
|
+
function (e, t) {
|
|
223
|
+
return i.isString(e)
|
|
224
|
+
? e.replace(i.format.FORMAT_REGEXP, function (r, s, a) {
|
|
225
|
+
return s === '%' ? '%{' + a + '}' : String(t[a]);
|
|
226
|
+
})
|
|
227
|
+
: e;
|
|
228
|
+
},
|
|
229
|
+
{ FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g },
|
|
230
|
+
),
|
|
231
|
+
prettify: function (e) {
|
|
232
|
+
return i.isNumber(e)
|
|
233
|
+
? (e * 100) % 1 === 0
|
|
234
|
+
? '' + e
|
|
235
|
+
: parseFloat(Math.round(e * 100) / 100).toFixed(2)
|
|
236
|
+
: i.isArray(e)
|
|
237
|
+
? e
|
|
238
|
+
.map(function (t) {
|
|
239
|
+
return i.prettify(t);
|
|
240
|
+
})
|
|
241
|
+
.join(', ')
|
|
242
|
+
: i.isObject(e)
|
|
243
|
+
? i.isDefined(e.toString)
|
|
244
|
+
? e.toString()
|
|
245
|
+
: JSON.stringify(e)
|
|
246
|
+
: ((e = '' + e),
|
|
247
|
+
e
|
|
248
|
+
.replace(/([^\s])\.([^\s])/g, '$1 $2')
|
|
249
|
+
.replace(/\\+/g, '')
|
|
250
|
+
.replace(/[_-]/g, ' ')
|
|
251
|
+
.replace(/([a-z])([A-Z])/g, function (t, r, s) {
|
|
252
|
+
return '' + r + ' ' + s.toLowerCase();
|
|
253
|
+
})
|
|
254
|
+
.toLowerCase());
|
|
255
|
+
},
|
|
256
|
+
stringifyValue: function (e, t) {
|
|
257
|
+
var r = (t && t.prettify) || i.prettify;
|
|
258
|
+
return r(e);
|
|
259
|
+
},
|
|
260
|
+
isString: function (e) {
|
|
261
|
+
return typeof e == 'string';
|
|
262
|
+
},
|
|
263
|
+
isArray: function (e) {
|
|
264
|
+
return {}.toString.call(e) === '[object Array]';
|
|
265
|
+
},
|
|
266
|
+
isHash: function (e) {
|
|
267
|
+
return i.isObject(e) && !i.isArray(e) && !i.isFunction(e);
|
|
268
|
+
},
|
|
269
|
+
contains: function (e, t) {
|
|
270
|
+
return i.isDefined(e)
|
|
271
|
+
? i.isArray(e)
|
|
272
|
+
? e.indexOf(t) !== -1
|
|
273
|
+
: t in e
|
|
274
|
+
: !1;
|
|
275
|
+
},
|
|
276
|
+
unique: function (e) {
|
|
277
|
+
return i.isArray(e)
|
|
278
|
+
? e.filter(function (t, r, s) {
|
|
279
|
+
return s.indexOf(t) == r;
|
|
280
|
+
})
|
|
281
|
+
: e;
|
|
282
|
+
},
|
|
283
|
+
forEachKeyInKeypath: function (e, t, r) {
|
|
284
|
+
if (i.isString(t)) {
|
|
285
|
+
var s = '',
|
|
286
|
+
a,
|
|
287
|
+
n = !1;
|
|
288
|
+
for (a = 0; a < t.length; ++a)
|
|
289
|
+
switch (t[a]) {
|
|
290
|
+
case '.':
|
|
291
|
+
n ? ((n = !1), (s += '.')) : ((e = r(e, s, !1)), (s = ''));
|
|
292
|
+
break;
|
|
293
|
+
case '\\':
|
|
294
|
+
n ? ((n = !1), (s += '\\')) : (n = !0);
|
|
295
|
+
break;
|
|
296
|
+
default:
|
|
297
|
+
((n = !1), (s += t[a]));
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
return r(e, s, !0);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
getDeepObjectValue: function (e, t) {
|
|
304
|
+
if (i.isObject(e))
|
|
305
|
+
return i.forEachKeyInKeypath(e, t, function (r, s) {
|
|
306
|
+
if (i.isObject(r)) return r[s];
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
collectFormValues: function (e, t) {
|
|
310
|
+
var r = {},
|
|
311
|
+
s,
|
|
312
|
+
a,
|
|
313
|
+
n,
|
|
314
|
+
l,
|
|
315
|
+
d,
|
|
316
|
+
c;
|
|
317
|
+
if ((i.isJqueryElement(e) && (e = e[0]), !e)) return r;
|
|
318
|
+
for (
|
|
319
|
+
t = t || {},
|
|
320
|
+
l = e.querySelectorAll('input[name], textarea[name]'),
|
|
321
|
+
s = 0;
|
|
322
|
+
s < l.length;
|
|
323
|
+
++s
|
|
324
|
+
)
|
|
325
|
+
if (
|
|
326
|
+
((n = l.item(s)), !i.isDefined(n.getAttribute('data-ignored')))
|
|
327
|
+
) {
|
|
328
|
+
var h = n.name.replace(/\./g, '\\\\.');
|
|
329
|
+
((c = i.sanitizeFormValue(n.value, t)),
|
|
330
|
+
n.type === 'number'
|
|
331
|
+
? (c = c ? +c : null)
|
|
332
|
+
: n.type === 'checkbox'
|
|
333
|
+
? n.attributes.value
|
|
334
|
+
? n.checked || (c = r[h] || null)
|
|
335
|
+
: (c = n.checked)
|
|
336
|
+
: n.type === 'radio' && (n.checked || (c = r[h] || null)),
|
|
337
|
+
(r[h] = c));
|
|
338
|
+
}
|
|
339
|
+
for (
|
|
340
|
+
l = e.querySelectorAll('select[name]'), s = 0;
|
|
341
|
+
s < l.length;
|
|
342
|
+
++s
|
|
343
|
+
)
|
|
344
|
+
if (
|
|
345
|
+
((n = l.item(s)), !i.isDefined(n.getAttribute('data-ignored')))
|
|
346
|
+
) {
|
|
347
|
+
if (n.multiple) {
|
|
348
|
+
c = [];
|
|
349
|
+
for (a in n.options)
|
|
350
|
+
((d = n.options[a]),
|
|
351
|
+
d &&
|
|
352
|
+
d.selected &&
|
|
353
|
+
c.push(i.sanitizeFormValue(d.value, t)));
|
|
354
|
+
} else {
|
|
355
|
+
var p =
|
|
356
|
+
typeof n.options[n.selectedIndex] < 'u'
|
|
357
|
+
? n.options[n.selectedIndex].value
|
|
358
|
+
: '';
|
|
359
|
+
c = i.sanitizeFormValue(p, t);
|
|
360
|
+
}
|
|
361
|
+
r[n.name] = c;
|
|
362
|
+
}
|
|
363
|
+
return r;
|
|
364
|
+
},
|
|
365
|
+
sanitizeFormValue: function (e, t) {
|
|
366
|
+
return (
|
|
367
|
+
t.trim && i.isString(e) && (e = e.trim()),
|
|
368
|
+
t.nullify !== !1 && e === '' ? null : e
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
capitalize: function (e) {
|
|
372
|
+
return i.isString(e) ? e[0].toUpperCase() + e.slice(1) : e;
|
|
373
|
+
},
|
|
374
|
+
pruneEmptyErrors: function (e) {
|
|
375
|
+
return e.filter(function (t) {
|
|
376
|
+
return !i.isEmpty(t.error);
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
expandMultipleErrors: function (e) {
|
|
380
|
+
var t = [];
|
|
381
|
+
return (
|
|
382
|
+
e.forEach(function (r) {
|
|
383
|
+
i.isArray(r.error)
|
|
384
|
+
? r.error.forEach(function (s) {
|
|
385
|
+
t.push(i.extend({}, r, { error: s }));
|
|
386
|
+
})
|
|
387
|
+
: t.push(r);
|
|
388
|
+
}),
|
|
389
|
+
t
|
|
390
|
+
);
|
|
391
|
+
},
|
|
392
|
+
convertErrorMessages: function (e, t) {
|
|
393
|
+
t = t || {};
|
|
394
|
+
var r = [],
|
|
395
|
+
s = t.prettify || i.prettify;
|
|
396
|
+
return (
|
|
397
|
+
e.forEach(function (a) {
|
|
398
|
+
var n = i.result(
|
|
399
|
+
a.error,
|
|
400
|
+
a.value,
|
|
401
|
+
a.attribute,
|
|
402
|
+
a.options,
|
|
403
|
+
a.attributes,
|
|
404
|
+
a.globalOptions,
|
|
405
|
+
);
|
|
406
|
+
if (!i.isString(n)) {
|
|
407
|
+
r.push(a);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
(n[0] === '^'
|
|
411
|
+
? (n = n.slice(1))
|
|
412
|
+
: t.fullMessages !== !1 &&
|
|
413
|
+
(n = i.capitalize(s(a.attribute)) + ' ' + n),
|
|
414
|
+
(n = n.replace(/\\\^/g, '^')),
|
|
415
|
+
(n = i.format(n, { value: i.stringifyValue(a.value, t) })),
|
|
416
|
+
r.push(i.extend({}, a, { error: n })));
|
|
417
|
+
}),
|
|
418
|
+
r
|
|
419
|
+
);
|
|
420
|
+
},
|
|
421
|
+
groupErrorsByAttribute: function (e) {
|
|
422
|
+
var t = {};
|
|
423
|
+
return (
|
|
424
|
+
e.forEach(function (r) {
|
|
425
|
+
var s = t[r.attribute];
|
|
426
|
+
s ? s.push(r) : (t[r.attribute] = [r]);
|
|
427
|
+
}),
|
|
428
|
+
t
|
|
429
|
+
);
|
|
430
|
+
},
|
|
431
|
+
flattenErrorsToArray: function (e) {
|
|
432
|
+
return e
|
|
433
|
+
.map(function (t) {
|
|
434
|
+
return t.error;
|
|
435
|
+
})
|
|
436
|
+
.filter(function (t, r, s) {
|
|
437
|
+
return s.indexOf(t) === r;
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
cleanAttributes: function (e, t) {
|
|
441
|
+
function r(n, l, d) {
|
|
442
|
+
return i.isObject(n[l]) ? n[l] : (n[l] = d ? !0 : {});
|
|
443
|
+
}
|
|
444
|
+
function s(n) {
|
|
445
|
+
var l = {},
|
|
446
|
+
d,
|
|
447
|
+
c;
|
|
448
|
+
for (c in n) n[c] && i.forEachKeyInKeypath(l, c, r);
|
|
449
|
+
return l;
|
|
450
|
+
}
|
|
451
|
+
function a(n, l) {
|
|
452
|
+
if (!i.isObject(n)) return n;
|
|
453
|
+
var d = i.extend({}, n),
|
|
454
|
+
c,
|
|
455
|
+
h;
|
|
456
|
+
for (h in n)
|
|
457
|
+
((c = l[h]),
|
|
458
|
+
i.isObject(c) ? (d[h] = a(d[h], c)) : c || delete d[h]);
|
|
459
|
+
return d;
|
|
460
|
+
}
|
|
461
|
+
return !i.isObject(t) || !i.isObject(e)
|
|
462
|
+
? {}
|
|
463
|
+
: ((t = s(t)), a(e, t));
|
|
464
|
+
},
|
|
465
|
+
exposeModule: function (e, t, r, s, a) {
|
|
466
|
+
r
|
|
467
|
+
? (s && s.exports && (r = s.exports = e), (r.validate = e))
|
|
468
|
+
: ((t.validate = e),
|
|
469
|
+
e.isFunction(a) &&
|
|
470
|
+
a.amd &&
|
|
471
|
+
a([], function () {
|
|
472
|
+
return e;
|
|
473
|
+
}));
|
|
474
|
+
},
|
|
475
|
+
warn: function (e) {
|
|
476
|
+
typeof console < 'u' &&
|
|
477
|
+
console.warn &&
|
|
478
|
+
console.warn('[validate.js] ' + e);
|
|
479
|
+
},
|
|
480
|
+
error: function (e) {
|
|
481
|
+
typeof console < 'u' &&
|
|
482
|
+
console.error &&
|
|
483
|
+
console.error('[validate.js] ' + e);
|
|
484
|
+
},
|
|
485
|
+
}),
|
|
486
|
+
(f.validators = {
|
|
487
|
+
presence: function (e, t) {
|
|
488
|
+
if (
|
|
489
|
+
((t = i.extend({}, this.options, t)),
|
|
490
|
+
t.allowEmpty !== !1 ? !i.isDefined(e) : i.isEmpty(e))
|
|
491
|
+
)
|
|
492
|
+
return t.message || this.message || "can't be blank";
|
|
493
|
+
},
|
|
494
|
+
length: function (e, t, r) {
|
|
495
|
+
if (i.isDefined(e)) {
|
|
496
|
+
t = i.extend({}, this.options, t);
|
|
497
|
+
var s = t.is,
|
|
498
|
+
a = t.maximum,
|
|
499
|
+
n = t.minimum,
|
|
500
|
+
l =
|
|
501
|
+
t.tokenizer ||
|
|
502
|
+
function (p) {
|
|
503
|
+
return p;
|
|
504
|
+
},
|
|
505
|
+
d,
|
|
506
|
+
c = [];
|
|
507
|
+
e = l(e);
|
|
508
|
+
var h = e.length;
|
|
509
|
+
if (!i.isNumber(h))
|
|
510
|
+
return t.message || this.notValid || 'has an incorrect length';
|
|
511
|
+
if (
|
|
512
|
+
(i.isNumber(s) &&
|
|
513
|
+
h !== s &&
|
|
514
|
+
((d =
|
|
515
|
+
t.wrongLength ||
|
|
516
|
+
this.wrongLength ||
|
|
517
|
+
'is the wrong length (should be %{count} characters)'),
|
|
518
|
+
c.push(i.format(d, { count: s }))),
|
|
519
|
+
i.isNumber(n) &&
|
|
520
|
+
h < n &&
|
|
521
|
+
((d =
|
|
522
|
+
t.tooShort ||
|
|
523
|
+
this.tooShort ||
|
|
524
|
+
'is too short (minimum is %{count} characters)'),
|
|
525
|
+
c.push(i.format(d, { count: n }))),
|
|
526
|
+
i.isNumber(a) &&
|
|
527
|
+
h > a &&
|
|
528
|
+
((d =
|
|
529
|
+
t.tooLong ||
|
|
530
|
+
this.tooLong ||
|
|
531
|
+
'is too long (maximum is %{count} characters)'),
|
|
532
|
+
c.push(i.format(d, { count: a }))),
|
|
533
|
+
c.length > 0)
|
|
534
|
+
)
|
|
535
|
+
return t.message || c;
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
numericality: function (e, t, r, s, a) {
|
|
539
|
+
if (i.isDefined(e)) {
|
|
540
|
+
t = i.extend({}, this.options, t);
|
|
541
|
+
var n = [],
|
|
542
|
+
l,
|
|
543
|
+
d,
|
|
544
|
+
c = {
|
|
545
|
+
greaterThan: function (g, b) {
|
|
546
|
+
return g > b;
|
|
547
|
+
},
|
|
548
|
+
greaterThanOrEqualTo: function (g, b) {
|
|
549
|
+
return g >= b;
|
|
550
|
+
},
|
|
551
|
+
equalTo: function (g, b) {
|
|
552
|
+
return g === b;
|
|
553
|
+
},
|
|
554
|
+
lessThan: function (g, b) {
|
|
555
|
+
return g < b;
|
|
556
|
+
},
|
|
557
|
+
lessThanOrEqualTo: function (g, b) {
|
|
558
|
+
return g <= b;
|
|
559
|
+
},
|
|
560
|
+
divisibleBy: function (g, b) {
|
|
561
|
+
return g % b === 0;
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
h = t.prettify || (a && a.prettify) || i.prettify;
|
|
565
|
+
if (i.isString(e) && t.strict) {
|
|
566
|
+
var p = '^-?(0|[1-9]\\d*)';
|
|
567
|
+
if (
|
|
568
|
+
(t.onlyInteger || (p += '(\\.\\d+)?'),
|
|
569
|
+
(p += '$'),
|
|
570
|
+
!new RegExp(p).test(e))
|
|
571
|
+
)
|
|
572
|
+
return (
|
|
573
|
+
t.message ||
|
|
574
|
+
t.notValid ||
|
|
575
|
+
this.notValid ||
|
|
576
|
+
this.message ||
|
|
577
|
+
'must be a valid number'
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (
|
|
581
|
+
(t.noStrings !== !0 &&
|
|
582
|
+
i.isString(e) &&
|
|
583
|
+
!i.isEmpty(e) &&
|
|
584
|
+
(e = +e),
|
|
585
|
+
!i.isNumber(e))
|
|
586
|
+
)
|
|
587
|
+
return (
|
|
588
|
+
t.message ||
|
|
589
|
+
t.notValid ||
|
|
590
|
+
this.notValid ||
|
|
591
|
+
this.message ||
|
|
592
|
+
'is not a number'
|
|
593
|
+
);
|
|
594
|
+
if (t.onlyInteger && !i.isInteger(e))
|
|
595
|
+
return (
|
|
596
|
+
t.message ||
|
|
597
|
+
t.notInteger ||
|
|
598
|
+
this.notInteger ||
|
|
599
|
+
this.message ||
|
|
600
|
+
'must be an integer'
|
|
601
|
+
);
|
|
602
|
+
for (l in c)
|
|
603
|
+
if (((d = t[l]), i.isNumber(d) && !c[l](e, d))) {
|
|
604
|
+
var y = 'not' + i.capitalize(l),
|
|
605
|
+
M =
|
|
606
|
+
t[y] ||
|
|
607
|
+
this[y] ||
|
|
608
|
+
this.message ||
|
|
609
|
+
'must be %{type} %{count}';
|
|
610
|
+
n.push(i.format(M, { count: d, type: h(l) }));
|
|
611
|
+
}
|
|
612
|
+
if (
|
|
613
|
+
(t.odd &&
|
|
614
|
+
e % 2 !== 1 &&
|
|
615
|
+
n.push(
|
|
616
|
+
t.notOdd || this.notOdd || this.message || 'must be odd',
|
|
617
|
+
),
|
|
618
|
+
t.even &&
|
|
619
|
+
e % 2 !== 0 &&
|
|
620
|
+
n.push(
|
|
621
|
+
t.notEven || this.notEven || this.message || 'must be even',
|
|
622
|
+
),
|
|
623
|
+
n.length)
|
|
624
|
+
)
|
|
625
|
+
return t.message || n;
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
datetime: i.extend(
|
|
629
|
+
function (e, t) {
|
|
630
|
+
if (!i.isFunction(this.parse) || !i.isFunction(this.format))
|
|
631
|
+
throw new Error(
|
|
632
|
+
'Both the parse and format functions needs to be set to use the datetime/date validator',
|
|
633
|
+
);
|
|
634
|
+
if (i.isDefined(e)) {
|
|
635
|
+
t = i.extend({}, this.options, t);
|
|
636
|
+
var r,
|
|
637
|
+
s = [],
|
|
638
|
+
a = t.earliest ? this.parse(t.earliest, t) : NaN,
|
|
639
|
+
n = t.latest ? this.parse(t.latest, t) : NaN;
|
|
640
|
+
if (
|
|
641
|
+
((e = this.parse(e, t)),
|
|
642
|
+
isNaN(e) || (t.dateOnly && e % 864e5 !== 0))
|
|
643
|
+
)
|
|
644
|
+
return (
|
|
645
|
+
(r =
|
|
646
|
+
t.notValid ||
|
|
647
|
+
t.message ||
|
|
648
|
+
this.notValid ||
|
|
649
|
+
'must be a valid date'),
|
|
650
|
+
i.format(r, { value: arguments[0] })
|
|
651
|
+
);
|
|
652
|
+
if (
|
|
653
|
+
(!isNaN(a) &&
|
|
654
|
+
e < a &&
|
|
655
|
+
((r =
|
|
656
|
+
t.tooEarly ||
|
|
657
|
+
t.message ||
|
|
658
|
+
this.tooEarly ||
|
|
659
|
+
'must be no earlier than %{date}'),
|
|
660
|
+
(r = i.format(r, {
|
|
661
|
+
value: this.format(e, t),
|
|
662
|
+
date: this.format(a, t),
|
|
663
|
+
})),
|
|
664
|
+
s.push(r)),
|
|
665
|
+
!isNaN(n) &&
|
|
666
|
+
e > n &&
|
|
667
|
+
((r =
|
|
668
|
+
t.tooLate ||
|
|
669
|
+
t.message ||
|
|
670
|
+
this.tooLate ||
|
|
671
|
+
'must be no later than %{date}'),
|
|
672
|
+
(r = i.format(r, {
|
|
673
|
+
date: this.format(n, t),
|
|
674
|
+
value: this.format(e, t),
|
|
675
|
+
})),
|
|
676
|
+
s.push(r)),
|
|
677
|
+
s.length)
|
|
678
|
+
)
|
|
679
|
+
return i.unique(s);
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
{ parse: null, format: null },
|
|
683
|
+
),
|
|
684
|
+
date: function (e, t) {
|
|
685
|
+
return (
|
|
686
|
+
(t = i.extend({}, t, { dateOnly: !0 })),
|
|
687
|
+
i.validators.datetime.call(i.validators.datetime, e, t)
|
|
688
|
+
);
|
|
689
|
+
},
|
|
690
|
+
format: function (e, t) {
|
|
691
|
+
((i.isString(t) || t instanceof RegExp) && (t = { pattern: t }),
|
|
692
|
+
(t = i.extend({}, this.options, t)));
|
|
693
|
+
var r = t.message || this.message || 'is invalid',
|
|
694
|
+
s = t.pattern,
|
|
695
|
+
a;
|
|
696
|
+
if (
|
|
697
|
+
i.isDefined(e) &&
|
|
698
|
+
(!i.isString(e) ||
|
|
699
|
+
(i.isString(s) && (s = new RegExp(t.pattern, t.flags)),
|
|
700
|
+
(a = s.exec(e)),
|
|
701
|
+
!a || a[0].length != e.length))
|
|
702
|
+
)
|
|
703
|
+
return r;
|
|
704
|
+
},
|
|
705
|
+
inclusion: function (e, t) {
|
|
706
|
+
if (
|
|
707
|
+
i.isDefined(e) &&
|
|
708
|
+
(i.isArray(t) && (t = { within: t }),
|
|
709
|
+
(t = i.extend({}, this.options, t)),
|
|
710
|
+
!i.contains(t.within, e))
|
|
711
|
+
) {
|
|
712
|
+
var r =
|
|
713
|
+
t.message ||
|
|
714
|
+
this.message ||
|
|
715
|
+
'^%{value} is not included in the list';
|
|
716
|
+
return i.format(r, { value: e });
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
exclusion: function (e, t) {
|
|
720
|
+
if (
|
|
721
|
+
i.isDefined(e) &&
|
|
722
|
+
(i.isArray(t) && (t = { within: t }),
|
|
723
|
+
(t = i.extend({}, this.options, t)),
|
|
724
|
+
!!i.contains(t.within, e))
|
|
725
|
+
) {
|
|
726
|
+
var r = t.message || this.message || '^%{value} is restricted';
|
|
727
|
+
return (
|
|
728
|
+
i.isString(t.within[e]) && (e = t.within[e]),
|
|
729
|
+
i.format(r, { value: e })
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
email: i.extend(
|
|
734
|
+
function (e, t) {
|
|
735
|
+
t = i.extend({}, this.options, t);
|
|
736
|
+
var r = t.message || this.message || 'is not a valid email';
|
|
737
|
+
if (i.isDefined(e) && (!i.isString(e) || !this.PATTERN.exec(e)))
|
|
738
|
+
return r;
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
PATTERN:
|
|
742
|
+
/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i,
|
|
743
|
+
},
|
|
744
|
+
),
|
|
745
|
+
equality: function (e, t, r, s, a) {
|
|
746
|
+
if (i.isDefined(e)) {
|
|
747
|
+
(i.isString(t) && (t = { attribute: t }),
|
|
748
|
+
(t = i.extend({}, this.options, t)));
|
|
749
|
+
var n =
|
|
750
|
+
t.message || this.message || 'is not equal to %{attribute}';
|
|
751
|
+
if (i.isEmpty(t.attribute) || !i.isString(t.attribute))
|
|
752
|
+
throw new Error('The attribute must be a non empty string');
|
|
753
|
+
var l = i.getDeepObjectValue(s, t.attribute),
|
|
754
|
+
d =
|
|
755
|
+
t.comparator ||
|
|
756
|
+
function (h, p) {
|
|
757
|
+
return h === p;
|
|
758
|
+
},
|
|
759
|
+
c = t.prettify || (a && a.prettify) || i.prettify;
|
|
760
|
+
if (!d(e, l, t, r, s))
|
|
761
|
+
return i.format(n, { attribute: c(t.attribute) });
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
url: function (e, t) {
|
|
765
|
+
if (i.isDefined(e)) {
|
|
766
|
+
t = i.extend({}, this.options, t);
|
|
767
|
+
var r = t.message || this.message || 'is not a valid url',
|
|
768
|
+
s = t.schemes || this.schemes || ['http', 'https'],
|
|
769
|
+
a = t.allowLocal || this.allowLocal || !1,
|
|
770
|
+
n = t.allowDataUrl || this.allowDataUrl || !1;
|
|
771
|
+
if (!i.isString(e)) return r;
|
|
772
|
+
var l = '^(?:(?:' + s.join('|') + ')://)(?:\\S+(?::\\S*)?@)?(?:',
|
|
773
|
+
d = '(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))';
|
|
774
|
+
if (
|
|
775
|
+
(a
|
|
776
|
+
? (d += '?')
|
|
777
|
+
: (l +=
|
|
778
|
+
'(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})'),
|
|
779
|
+
(l +=
|
|
780
|
+
'(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*' +
|
|
781
|
+
d +
|
|
782
|
+
')(?::\\d{2,5})?(?:[/?#]\\S*)?$'),
|
|
783
|
+
n)
|
|
784
|
+
) {
|
|
785
|
+
var c = '\\w+\\/[-+.\\w]+(?:;[\\w=]+)*',
|
|
786
|
+
h = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*",
|
|
787
|
+
p = 'data:(?:' + c + ')?(?:;base64)?,' + h;
|
|
788
|
+
l = '(?:' + l + ')|(?:^' + p + '$)';
|
|
789
|
+
}
|
|
790
|
+
var y = new RegExp(l, 'i');
|
|
791
|
+
if (!y.exec(e)) return r;
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
type: i.extend(
|
|
795
|
+
function (e, t, r, s, a) {
|
|
796
|
+
if ((i.isString(t) && (t = { type: t }), !!i.isDefined(e))) {
|
|
797
|
+
var n = i.extend({}, this.options, t),
|
|
798
|
+
l = n.type;
|
|
799
|
+
if (!i.isDefined(l)) throw new Error('No type was specified');
|
|
800
|
+
var d;
|
|
801
|
+
if (
|
|
802
|
+
(i.isFunction(l) ? (d = l) : (d = this.types[l]),
|
|
803
|
+
!i.isFunction(d))
|
|
804
|
+
)
|
|
805
|
+
throw new Error(
|
|
806
|
+
'validate.validators.type.types.' +
|
|
807
|
+
l +
|
|
808
|
+
' must be a function.',
|
|
809
|
+
);
|
|
810
|
+
if (!d(e, n, r, s, a)) {
|
|
811
|
+
var c =
|
|
812
|
+
t.message ||
|
|
813
|
+
this.messages[l] ||
|
|
814
|
+
this.message ||
|
|
815
|
+
n.message ||
|
|
816
|
+
(i.isFunction(l)
|
|
817
|
+
? 'must be of the correct type'
|
|
818
|
+
: 'must be of type %{type}');
|
|
819
|
+
return (
|
|
820
|
+
i.isFunction(c) && (c = c(e, t, r, s, a)),
|
|
821
|
+
i.format(c, { attribute: i.prettify(r), type: l })
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
types: {
|
|
828
|
+
object: function (e) {
|
|
829
|
+
return i.isObject(e) && !i.isArray(e);
|
|
830
|
+
},
|
|
831
|
+
array: i.isArray,
|
|
832
|
+
integer: i.isInteger,
|
|
833
|
+
number: i.isNumber,
|
|
834
|
+
string: i.isString,
|
|
835
|
+
date: i.isDate,
|
|
836
|
+
boolean: i.isBoolean,
|
|
837
|
+
},
|
|
838
|
+
messages: {},
|
|
839
|
+
},
|
|
840
|
+
),
|
|
841
|
+
}),
|
|
842
|
+
(f.formatters = {
|
|
843
|
+
detailed: function (e) {
|
|
844
|
+
return e;
|
|
845
|
+
},
|
|
846
|
+
flat: i.flattenErrorsToArray,
|
|
847
|
+
grouped: function (e) {
|
|
848
|
+
var t;
|
|
849
|
+
e = i.groupErrorsByAttribute(e);
|
|
850
|
+
for (t in e) e[t] = i.flattenErrorsToArray(e[t]);
|
|
851
|
+
return e;
|
|
852
|
+
},
|
|
853
|
+
constraint: function (e) {
|
|
854
|
+
var t;
|
|
855
|
+
e = i.groupErrorsByAttribute(e);
|
|
856
|
+
for (t in e)
|
|
857
|
+
e[t] = e[t]
|
|
858
|
+
.map(function (r) {
|
|
859
|
+
return r.validator;
|
|
860
|
+
})
|
|
861
|
+
.sort();
|
|
862
|
+
return e;
|
|
863
|
+
},
|
|
864
|
+
}),
|
|
865
|
+
f.exposeModule(f, this, m, o, u));
|
|
866
|
+
}).call(
|
|
867
|
+
v,
|
|
868
|
+
typeof v < 'u' ? v : null,
|
|
869
|
+
typeof x < 'u' ? x : null,
|
|
870
|
+
typeof define < 'u' ? define : null,
|
|
871
|
+
);
|
|
872
|
+
});
|
|
873
|
+
var A = F(k(), 1);
|
|
874
|
+
function S(m, o) {
|
|
875
|
+
return fetch(m, {
|
|
876
|
+
body: JSON.stringify(o),
|
|
877
|
+
cache: 'no-cache',
|
|
878
|
+
headers: {
|
|
879
|
+
Accept: 'application/json',
|
|
880
|
+
'Content-Type': 'application/json',
|
|
881
|
+
},
|
|
882
|
+
method: 'POST',
|
|
883
|
+
mode: 'cors',
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
function _() {
|
|
887
|
+
return '\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n :host {\n --flow-space: 1.5rem;\n\n --color-dark: #404040;\n --color-grey: #555B69;\n\n --color-success: #1EB244;\n --color-failure: #FFEDEB;\n --color-failure-tint: #F86B58;\n\n --color-richblue: #043C93;\n --color-theme: '
|
|
888
|
+
.concat(
|
|
889
|
+
this.themeColor,
|
|
890
|
+
";\n\n --color-active: #2D2B2A;\n --color-default: #001096;\n --color-disabled: #848282;\n }\n\n html {\n font-family: 'DM Sans', sans-serif;\n }\n\n [hidden] {\n display: none !important;\n }\n\n [disabled] {\n cursor: not-allowed !important;\n }\n\n .visually-hidden {\n border: 0;\n clip: rect(1px 1px 1px 1px);\n clip: rect(1px, 1px, 1px, 1px);\n height: auto;\n margin: 0;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n\n .color-dark {\n color: var(--color-dark);\n }\n\n .color-grey {\n color: var(--color-grey);\n }\n\n .flow > * + * {\n margin-top: var(--flow-space);\n }\n\n .center {\n margin-left: auto;\n margin-right: auto;\n\n text-align: center;\n }\n\n h1 {\n font-size: 1.5rem;\n font-weight: 700;\n }\n\n button, input, select, textarea {\n font: inherit\n }\n\n label,\n input,\n select,\n textarea {\n --flow-space: .5rem;\n display: block;\n width: 100%;\n }\n\n input,\n select,\n textarea {\n border: 1px solid #d1d8d6;\n border-radius: .5rem;\n padding: .75rem 1rem;\n }\n\n button {\n --button-color: var(--color-default);\n --flow-space: 3rem;\n -webkit-appearance: none;\n -moz-appearance: none;\n align-items: center;\n appearance: none;\n background-color: transparent;\n border-radius: 2.5rem;\n border: none;\n color: #ffffff;\n cursor: pointer;\n display: inline-flex;\n font-size: 20px;\n font-weight: 500;\n inline-size: 100%;\n justify-content: center;\n letter-spacing: .05ch;\n line-height: 1;\n padding: 1rem 2.5rem;\n text-align: center;\n text-decoration: none;\n }\n\n button[data-variant='solid'] {\n background-color: var(--button-color);\n border: 2px solid var(--button-color);\n }\n\n button[data-variant='outline'] {\n color: var(--button-color);\n border: 2px solid var(--button-color);\n }\n\n button[data-variant='ghost'] {\n color: var(--button-color);\n }\n\n button:hover,\n button:focus,\n button:active {\n --button-color: var(--color-active);\n }\n\n button:disabled {\n --button-color: var(--color-disabled);\n }\n\n button[data-type='icon'] {\n height: 2rem;\n padding: 0;\n width: 2rem;\n background: transparent;\n }\n\n input {\n font: inherit;\n }\n\n fieldset {\n margin: 0;\n border: none;\n }\n\n .font-weight:bold {\n font-weight: bold;\n }\n\n .justify-right {\n justify-content: end !important;\n }\n .nav {\n display: flex;\n justify-content: space-between;\n }\n\n .back-wrapper {\n display: flex;\n align-items: center;\n }\n\n .back-button-text {\n font-size: 11px;\n line-height: 11px;\n color: ",
|
|
891
|
+
)
|
|
892
|
+
.concat(
|
|
893
|
+
this.themeColor || 'rgb(21, 31, 114)',
|
|
894
|
+
';\n }\n\n #error,\n .validation-message {\n color: red;\n text-transform: capitalize;\n }\n\n .input-group {\n --flow-space: 1.5rem;\n text-align: initial;\n }\n\n .input-radio {\n --flow-space: 1.5rem;\n background-color: #F8F8F8;\n border-radius: .5rem;\n padding: .625rem 1rem;\n display: flex;\n align-items: center;\n }\n\n .otp-mode {\n display: flex;\n align-items: center;\n text-align: initial;\n }\n\n .otp-mode :first-child {\n margin: 0;\n margin-inline-end: 1rem;\n }\n\n .otp-mode :nth-child(2n) {\n --flow-space: .5rem;\n }\n\n .input-radio [type=\'radio\'] {\n border-radius: 50%;\n inline-size: 2rem;\n block-size: 2rem;\n margin-inline-end: .5rem;\n background-color: white;\n border: .125rem solid #f5f5f5;\n }\n\n #totp-token {\n block-size: 3rem;\n inline-size: 20rem;\n max-inline-size: 100%;\n background-color: #F5F5F5;\n border: none;\n border-bottom: 2px solid #2F718D;\n font-size: 1.5rem;\n text-align: center;\n font-weight: 700;\n letter-spacing: 2rem;\n padding: .5rem 1rem;\n margin-inline: auto;\n }\n\n @keyframes spin {\n 0% {\n transform: translate3d(-50%, -50%, 0) rotate(0deg);\n }\n 100% {\n transform: translate3d(-50%, -50%, 0) rotate(360deg);\n }\n }\n\n .spinner {\n animation: 1.5s linear infinite spin;\n animation-play-state: inherit;\n border: solid 5px #cfd0d1;\n border-bottom-color: var(--color-active);\n border-radius: 50%;\n content: "";\n display: block;\n height: 25px;\n width: 25px;\n will-change: transform;\n position: relative;\n top: .675rem;\n left: 1.25rem;\n }\n </style>\n\n <div class=\'flow center\' id=\'id-entry\'>\n <div class="nav">\n <div class="back-wrapper">\n <button type=\'button\' data-type=\'icon\' id="back-button" class="back-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="',
|
|
895
|
+
)
|
|
896
|
+
.concat(
|
|
897
|
+
this.themeColor,
|
|
898
|
+
'" d="M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z"/>\n </svg>\n </button>\n <div class="back-button-text">Back</div>\n </div>\n <button data-type=\'icon\' type=\'button\' class=\'close-iframe\'>\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="#91190F" d="m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z"/>\n </svg>\n <span class=\'visually-hidden\'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n Enter your ',
|
|
899
|
+
)
|
|
900
|
+
.concat(
|
|
901
|
+
this.idTypeLabel,
|
|
902
|
+
"\n </h1>\n\n <form name='id-entry-form' class='flow' novalidate style='--flow-space: 5.5rem'>\n <div id='id-number' class=\"input-group flow\">\n <label class='required' for=\"id_number\">\n ",
|
|
903
|
+
)
|
|
904
|
+
.concat(
|
|
905
|
+
this.idTypeLabel,
|
|
906
|
+
"\n </label>\n\n <input aria-required='true' id=\"id_number\" name=\"id_number\"\n maxlength='11' placeholder='' />\n\n <p>\n <small>",
|
|
907
|
+
)
|
|
908
|
+
.concat(
|
|
909
|
+
this.idHint,
|
|
910
|
+
'</small>\n </p>\n </div>\n\n <button data-variant=\'solid\' id=\'query-otp-modes\' type=\'submit\'>\n <span class=\'text\'>Continue</span>\n <svg aria-hidden=\'true\' width="25" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M7 12h11m0 0-4.588-4M18 12l-4.588 4" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n <span hidden class=\'spinner\'></span>\n </button>\n </form>\n </div>\n\n <div hidden class=\'flow center\' id=\'select-mode\'>\n <div class="nav">\n <div class="back-wrapper">\n <button type=\'button\' data-type=\'icon\' id="back-to-entry-button" class="back-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">\n <path fill="#DBDBC4" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z" opacity=".4"/>\n <path fill="',
|
|
911
|
+
)
|
|
912
|
+
.concat(
|
|
913
|
+
this.themeColor,
|
|
914
|
+
"\" d=\"M15.5 11.25h-5.19l1.72-1.72c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-3 3c-.29.29-.29.77 0 1.06l3 3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-1.72-1.72h5.19c.41 0 .75-.34.75-.75s-.34-.75-.75-.75Z\"/>\n </svg>\n </button>\n <div class=\"back-button-text\">Back</div>\n </div>\n <button data-type='icon' type='button' class='close-iframe'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\">\n <path fill=\"#DBDBC4\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z\" opacity=\".4\"/>\n <path fill=\"#91190F\" d=\"m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z\"/>\n </svg>\n <span class='visually-hidden'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n Select contact method\n </h1>\n\n <form name='select-mode-form' novalidate style='--flow-space: 4.25rem' id='otp-entry' class='flow center'>\n <fieldset class='flow center'>\n <legend class='flow' style='--flow-space: 1.5rem'>\n <p>\n NIBSS, the data custodian of BVN, \n will send you a One-Time Password (OTP) \n </p>\n\n <p>\n <small>\n The request will be from Chams Plc, who is NIBSS' technical partner.\n </small>\n </p>\n </legend>\n\n <div class='flow center'>\n ",
|
|
915
|
+
)
|
|
916
|
+
.concat(
|
|
917
|
+
this.modes.length
|
|
918
|
+
? this.modes
|
|
919
|
+
.map((m) =>
|
|
920
|
+
'<label class=\'input-radio\'>\n <input type="radio" id="" name="mode" value="'
|
|
921
|
+
.concat(
|
|
922
|
+
Object.keys(m)[0],
|
|
923
|
+
"\">\n <div class='otp-mode'>\n ",
|
|
924
|
+
)
|
|
925
|
+
.concat(
|
|
926
|
+
Object.keys(m)[0].includes('sms')
|
|
927
|
+
? '\n <svg xmlns="http://www.w3.org/2000/svg" width="29" height="37" fill="none">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.697 24.12c4.914 0 7.37 0 8.897-1.652 1.527-1.651 1.527-4.31 1.527-9.625 0-5.316 0-7.974-1.527-9.625-1.526-1.651-3.983-1.651-8.897-1.651h-5.211c-4.914 0-7.37 0-8.897 1.651-1.527 1.651-1.527 4.31-1.527 9.625 0 5.316 0 7.974 1.527 9.625.85.92 1.991 1.328 3.685 1.508"/>\n <g filter="url(#sms)">\n <path stroke="#2F718D" stroke-linecap="round" stroke-width="2" d="M16.697 24.12c-1.61 0-3.384.703-5.005 1.613-2.602 1.462-3.903 2.193-4.545 1.727-.64-.465-.52-1.91-.277-4.799l.055-.656" shape-rendering="crispEdges"/>\n </g>\n <defs>\n <filter id="sms" width="20.023" height="15.595" x="1.675" y="21.005" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>\n <feOffset dy="4"/>\n <feGaussianBlur stdDeviation="2"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_404"/>\n <feBlend in="SourceGraphic" in2="effect1_dropShadow_2_404" result="shape"/>\n </filter>\n </defs>\n </svg>\n '
|
|
928
|
+
: '\n <svg xmlns="http://www.w3.org/2000/svg" width="35" height="24" fill="none">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.062 4.367c0-1.437 1.221-2.603 2.727-2.603h21.815c1.506 0 2.727 1.166 2.727 2.603v15.62c0 1.438-1.221 2.604-2.727 2.604H6.789c-1.506 0-2.727-1.166-2.727-2.604V4.367Z"/>\n <g filter="url(#message)">\n <path stroke="#2F718D" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m5.426 3.066 8.647 7.338c2.067 1.754 5.18 1.754 7.247 0l8.648-7.338" shape-rendering="crispEdges"/>\n </g>\n <defs>\n <filter id="message" width="34.042" height="18.154" x=".676" y="2.316" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse">\n <feFlood flood-opacity="0" result="BackgroundImageFix"/>\n <feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>\n <feOffset dy="4"/>\n <feGaussianBlur stdDeviation="2"/>\n <feComposite in2="hardAlpha" operator="out"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>\n <feBlend in2="BackgroundImageFix" result="effect1_dropShadow_2_394"/>\n <feBlend in="SourceGraphic" in2="effect1_dropShadow_2_394" result="shape"/>\n </filter>\n </defs>\n </svg>\n ',
|
|
929
|
+
"\n <div class='flow'>\n <p>\n ",
|
|
930
|
+
)
|
|
931
|
+
.concat(
|
|
932
|
+
Object.values(m)[0],
|
|
933
|
+
'\n </p>\n <p>\n <small>\n An OTP will be sent by ',
|
|
934
|
+
)
|
|
935
|
+
.concat(
|
|
936
|
+
Object.keys(m)[0].includes('sms') ? 'sms' : 'email',
|
|
937
|
+
' to verify your identity\n </small>\n </p>\n </div>\n </div>\n </label>',
|
|
938
|
+
),
|
|
939
|
+
)
|
|
940
|
+
.join('\n')
|
|
941
|
+
: 'No modes yet',
|
|
942
|
+
"\n </div>\n </fieldset>\n\n <button data-variant='ghost' id='contact-methods-outdated' style='--flow-space: .5rem' class='' type='button'>\n I am no longer using any of these options\n </button>\n\n <button data-variant='solid' id='select-otp-mode' type='submit'>\n <span class='text'>Continue</span>\n <svg aria-hidden='true' width=\"25\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 12h11m0 0-4.588-4M18 12l-4.588 4\" stroke=\"#fff\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span hidden class='spinner'></span>\n </button>\n </form>\n </div>\n\n <div hidden class='flow center' id='otp-verification'>\n <div class=\"nav justify-right\">\n <button data-type='icon' type='button' class='close-iframe'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\">\n <path fill=\"#DBDBC4\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z\" opacity=\".4\"/>\n <path fill=\"#91190F\" d=\"m13.06 12 2.3-2.3c.29-.29.29-.77 0-1.06a.754.754 0 0 0-1.06 0l-2.3 2.3-2.3-2.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l2.3 2.3-2.3 2.3c-.29.29-.29.77 0 1.06.15.15.34.22.53.22s.38-.07.53-.22l2.3-2.3 2.3 2.3c.15.15.34.22.53.22s.38-.07.53-.22c.29-.29.29-.77 0-1.06l-2.3-2.3Z\"/>\n </svg>\n <span class='visually-hidden'>Close SmileIdentity Verification frame</span>\n </button>\n </div>\n <h1>\n OTP Verification\n </h1>\n\n <div style='--flow-space: 4.25rem' id='otp-entry'>\n <form name='otp-submission-form' novalidate style='--flow-space: 1.5rem' class='flow center'>\n <label for='totp-token'>\n Enter the OTP sent to <span class='font-weight:bold'>",
|
|
943
|
+
)
|
|
944
|
+
.concat(
|
|
945
|
+
this.selectedOtpDeliveryMode,
|
|
946
|
+
"</span>\n </label>\n <input type='text' id='totp-token' maxlength='6' inputmode='numeric' autocomplete='one-time-code' />\n\n <p>\n Didn't receive the OTP",
|
|
947
|
+
)
|
|
948
|
+
.concat(
|
|
949
|
+
this.selectedOtpDeliveryMode
|
|
950
|
+
? " at <span class='font-weight:bold'>".concat(
|
|
951
|
+
this.selectedOtpDeliveryMode,
|
|
952
|
+
'</span>?',
|
|
953
|
+
)
|
|
954
|
+
: '?',
|
|
955
|
+
"\n </p>\n\n <button style='--flow-space: .5rem' data-variant='ghost' class='try-another-method' type='button'>\n Try another contact method\n </button>\n\n <button data-variant='solid' id='submit-otp' type='submit'>\n <span class='text'>Submit</span>\n <svg aria-hidden='true' width=\"25\" height=\"24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 12h11m0 0-4.588-4M18 12l-4.588 4\" stroke=\"#fff\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span hidden class='spinner'></span>\n </button>\n </form>\n </div>\n </div>\n ",
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
var w = class extends HTMLElement {
|
|
959
|
+
constructor() {
|
|
960
|
+
(super(),
|
|
961
|
+
(this.templateString = _.bind(this)),
|
|
962
|
+
(this.render = () => this.templateString()),
|
|
963
|
+
this.attachShadow({ mode: 'open' }),
|
|
964
|
+
(this.modes = []),
|
|
965
|
+
(this['otp-delivery-mode'] = ''),
|
|
966
|
+
(this.queryOtpModes = this.queryOtpModes.bind(this)),
|
|
967
|
+
(this.selectOtpMode = this.selectOtpMode.bind(this)),
|
|
968
|
+
(this.submitOtp = this.submitOtp.bind(this)),
|
|
969
|
+
(this.switchContactMethod = this.switchContactMethod.bind(this)),
|
|
970
|
+
(this.handleTotpConsentGrant = this.handleTotpConsentGrant.bind(this)),
|
|
971
|
+
(this.handleTotpConsentContactMethodsOutdated =
|
|
972
|
+
this.handleTotpConsentContactMethodsOutdated.bind(this)),
|
|
973
|
+
(this.pages = []));
|
|
974
|
+
}
|
|
975
|
+
static get observedAttributes() {
|
|
976
|
+
return ['modes', 'otp-delivery-mode'];
|
|
977
|
+
}
|
|
978
|
+
attributeChangedCallback(o) {
|
|
979
|
+
switch (o) {
|
|
980
|
+
case 'modes':
|
|
981
|
+
case 'otp-delivery-mode': {
|
|
982
|
+
let u = document.createElement('template');
|
|
983
|
+
u.innerHTML = this.render();
|
|
984
|
+
let f = u.content
|
|
985
|
+
.cloneNode(!0)
|
|
986
|
+
.querySelector('#'.concat(this.activeScreen.id));
|
|
987
|
+
((f.hidden = !1),
|
|
988
|
+
this.shadowRoot.replaceChild(f, this.activeScreen),
|
|
989
|
+
this.setUpEventListeners(),
|
|
990
|
+
this.setActiveScreen(f));
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
default:
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
setUpEventListeners() {
|
|
998
|
+
((this.idEntryScreen = this.shadowRoot.querySelector('#id-entry')),
|
|
999
|
+
(this.selectModeScreen = this.shadowRoot.querySelector('#select-mode')),
|
|
1000
|
+
(this.otpVerificationScreen =
|
|
1001
|
+
this.shadowRoot.querySelector('#otp-verification')),
|
|
1002
|
+
this.activeScreen || (this.activeScreen = this.idEntryScreen),
|
|
1003
|
+
(this.queryOtpModesButton =
|
|
1004
|
+
this.idEntryScreen.querySelector('#query-otp-modes')),
|
|
1005
|
+
(this.backButton = this.idEntryScreen.querySelector('#back-button')),
|
|
1006
|
+
(this.selectOtpModeButton =
|
|
1007
|
+
this.selectModeScreen.querySelector('#select-otp-mode')),
|
|
1008
|
+
(this.entryBackbutton = this.selectModeScreen.querySelector(
|
|
1009
|
+
'#back-to-entry-button',
|
|
1010
|
+
)),
|
|
1011
|
+
(this.contactMethodsOutdatedButton =
|
|
1012
|
+
this.selectModeScreen.querySelector('#contact-methods-outdated')),
|
|
1013
|
+
(this.submitOtpButton =
|
|
1014
|
+
this.otpVerificationScreen.querySelector('#submit-otp')),
|
|
1015
|
+
(this.switchContactMethodButton =
|
|
1016
|
+
this.otpVerificationScreen.querySelector('.try-another-method')));
|
|
1017
|
+
let o = this.shadowRoot.querySelectorAll('.close-iframe');
|
|
1018
|
+
((this.idNumberInput = this.idEntryScreen.querySelector('#id_number')),
|
|
1019
|
+
(this.modeInputs =
|
|
1020
|
+
this.selectModeScreen.querySelectorAll('[name="mode"]')),
|
|
1021
|
+
(this.otpInput =
|
|
1022
|
+
this.otpVerificationScreen.querySelector('#totp-token')),
|
|
1023
|
+
this.queryOtpModesButton.addEventListener('click', (u) =>
|
|
1024
|
+
this.queryOtpModes(u),
|
|
1025
|
+
),
|
|
1026
|
+
this.selectOtpModeButton.addEventListener('click', (u) =>
|
|
1027
|
+
this.selectOtpMode(u),
|
|
1028
|
+
),
|
|
1029
|
+
this.submitOtpButton.addEventListener('click', (u) =>
|
|
1030
|
+
this.submitOtp(u),
|
|
1031
|
+
),
|
|
1032
|
+
this.switchContactMethodButton.addEventListener('click', (u) =>
|
|
1033
|
+
this.switchContactMethod(u),
|
|
1034
|
+
),
|
|
1035
|
+
this.contactMethodsOutdatedButton.addEventListener('click', (u) =>
|
|
1036
|
+
this.handleTotpConsentContactMethodsOutdated(u),
|
|
1037
|
+
),
|
|
1038
|
+
this.entryBackbutton.addEventListener('click', () => {
|
|
1039
|
+
this.handleBackClick();
|
|
1040
|
+
}),
|
|
1041
|
+
this.backButton.addEventListener('click', () => {
|
|
1042
|
+
this.handleBackClick();
|
|
1043
|
+
}),
|
|
1044
|
+
o.forEach((u) => {
|
|
1045
|
+
u.addEventListener(
|
|
1046
|
+
'click',
|
|
1047
|
+
() => {
|
|
1048
|
+
this.closeWindow();
|
|
1049
|
+
},
|
|
1050
|
+
!1,
|
|
1051
|
+
);
|
|
1052
|
+
}));
|
|
1053
|
+
}
|
|
1054
|
+
closeWindow() {
|
|
1055
|
+
let o = window.parent;
|
|
1056
|
+
[o.parent, o].forEach((u) => {
|
|
1057
|
+
u.postMessage('SmileIdentity::Close', '*');
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
handleBackClick() {
|
|
1061
|
+
let o = this.pages.pop();
|
|
1062
|
+
o
|
|
1063
|
+
? this.setActiveScreen(o)
|
|
1064
|
+
: this.dispatchEvent(
|
|
1065
|
+
new CustomEvent('end-user-consent.totp.cancelled', {}),
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
connectedCallback() {
|
|
1069
|
+
let o = document.createElement('template');
|
|
1070
|
+
((o.innerHTML = this.render()),
|
|
1071
|
+
this.shadowRoot.appendChild(o.content.cloneNode(!0)),
|
|
1072
|
+
this.setUpEventListeners());
|
|
1073
|
+
}
|
|
1074
|
+
switchContactMethod() {
|
|
1075
|
+
this.queryOtpModes();
|
|
1076
|
+
}
|
|
1077
|
+
resetForm() {
|
|
1078
|
+
(this.activeScreen
|
|
1079
|
+
.querySelectorAll('[aria-invalid]')
|
|
1080
|
+
.forEach((f) => f.removeAttribute('aria-invalid')),
|
|
1081
|
+
this.activeScreen
|
|
1082
|
+
.querySelectorAll('.validation-message')
|
|
1083
|
+
.forEach((f) => f.remove()));
|
|
1084
|
+
}
|
|
1085
|
+
handleIdNumberValidationErrors(o) {
|
|
1086
|
+
Object.keys(o).forEach((f) => {
|
|
1087
|
+
let i = this.activeScreen.querySelector('#'.concat(f));
|
|
1088
|
+
(i.setAttribute('aria-invalid', 'true'),
|
|
1089
|
+
i.setAttribute('aria-describedby', ''.concat(f, '-hint')));
|
|
1090
|
+
let e = document.createElement('div');
|
|
1091
|
+
(e.setAttribute('id', ''.concat(f, '-hint')),
|
|
1092
|
+
e.setAttribute('class', 'validation-message'),
|
|
1093
|
+
(e.textContent = o[f][0]),
|
|
1094
|
+
i.insertAdjacentElement('afterend', e));
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
handleActiveScreenErrors(o) {
|
|
1098
|
+
let u = this.activeScreen.querySelector('[type="submit"]'),
|
|
1099
|
+
f = document.createElement('div');
|
|
1100
|
+
(f.setAttribute('class', 'validation-message'),
|
|
1101
|
+
(f.textContent = o),
|
|
1102
|
+
u.insertAdjacentElement('beforebegin', f));
|
|
1103
|
+
}
|
|
1104
|
+
validateIdNumber(o) {
|
|
1105
|
+
let u = {
|
|
1106
|
+
id_number: {
|
|
1107
|
+
format: new RegExp(this.idRegex),
|
|
1108
|
+
presence: { allowEmpty: !1, message: 'is required' },
|
|
1109
|
+
},
|
|
1110
|
+
},
|
|
1111
|
+
f = (0, A.default)({ id_number: o }, u);
|
|
1112
|
+
return (f && this.handleIdNumberValidationErrors(f), f);
|
|
1113
|
+
}
|
|
1114
|
+
async queryOtpModes(o) {
|
|
1115
|
+
o && (o.preventDefault(), this.resetForm());
|
|
1116
|
+
let u = this.validateIdNumber(this.idNumberInput.value);
|
|
1117
|
+
if (
|
|
1118
|
+
(localStorage.setItem(
|
|
1119
|
+
'idNumber',
|
|
1120
|
+
this.idNumberInput.value || this.idNumber,
|
|
1121
|
+
),
|
|
1122
|
+
!u)
|
|
1123
|
+
) {
|
|
1124
|
+
let f = {
|
|
1125
|
+
country: this.country,
|
|
1126
|
+
id_number: this.idNumber,
|
|
1127
|
+
id_type: this.idType,
|
|
1128
|
+
partner_id: this.partnerId,
|
|
1129
|
+
token: this.token,
|
|
1130
|
+
},
|
|
1131
|
+
i = ''.concat(this.baseUrl, '/totp_consent');
|
|
1132
|
+
try {
|
|
1133
|
+
this.toggleLoading();
|
|
1134
|
+
let e = await S(i, f),
|
|
1135
|
+
t = await e.json();
|
|
1136
|
+
(this.toggleLoading(),
|
|
1137
|
+
e.ok
|
|
1138
|
+
? ((this.sessionId = t.session_id),
|
|
1139
|
+
(this.modes = t.modes),
|
|
1140
|
+
this.setActiveScreen(this.selectModeScreen),
|
|
1141
|
+
this.setAttribute('modes', t.modes))
|
|
1142
|
+
: this.handleActiveScreenErrors(t.error));
|
|
1143
|
+
} catch (e) {
|
|
1144
|
+
(this.toggleLoading(), this.handleActiveScreenErrors(e.message));
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
async selectOtpMode(o) {
|
|
1149
|
+
(o.preventDefault(),
|
|
1150
|
+
this.resetForm(),
|
|
1151
|
+
(this.mode = Array.prototype.find.call(
|
|
1152
|
+
this.modeInputs,
|
|
1153
|
+
(i) => i.checked,
|
|
1154
|
+
).value));
|
|
1155
|
+
let u = {
|
|
1156
|
+
country: this.country,
|
|
1157
|
+
id_number: this.idNumber,
|
|
1158
|
+
id_type: this.idType,
|
|
1159
|
+
mode: this.mode,
|
|
1160
|
+
partner_id: this.partnerId,
|
|
1161
|
+
session_id: this.sessionId,
|
|
1162
|
+
token: this.token,
|
|
1163
|
+
},
|
|
1164
|
+
f = ''.concat(this.baseUrl, '/totp_consent/mode');
|
|
1165
|
+
try {
|
|
1166
|
+
this.toggleLoading();
|
|
1167
|
+
let i = await S(f, u),
|
|
1168
|
+
e = await i.json();
|
|
1169
|
+
(this.toggleLoading(),
|
|
1170
|
+
i.ok
|
|
1171
|
+
? ((this.selectedOtpDeliveryMode = this.modes.filter(
|
|
1172
|
+
(t) => t[this.mode],
|
|
1173
|
+
)[0][this.mode]),
|
|
1174
|
+
this.setActiveScreen(this.otpVerificationScreen),
|
|
1175
|
+
this.setAttribute(
|
|
1176
|
+
'otp-delivery-mode',
|
|
1177
|
+
this.selectedOtpDeliveryMode,
|
|
1178
|
+
))
|
|
1179
|
+
: this.handleActiveScreenErrors(e.error));
|
|
1180
|
+
} catch (i) {
|
|
1181
|
+
(this.toggleLoading(), this.handleActiveScreenErrors(i.message));
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
async submitOtp(o) {
|
|
1185
|
+
(o.preventDefault(), this.resetForm(), (this.otp = this.otpInput.value));
|
|
1186
|
+
let u = {
|
|
1187
|
+
country: this.country,
|
|
1188
|
+
id_number: this.idNumber,
|
|
1189
|
+
id_type: this.idType,
|
|
1190
|
+
otp: this.otp,
|
|
1191
|
+
partner_id: this.partnerId,
|
|
1192
|
+
session_id: this.sessionId,
|
|
1193
|
+
token: this.token,
|
|
1194
|
+
},
|
|
1195
|
+
f = ''.concat(this.baseUrl, '/totp_consent/otp');
|
|
1196
|
+
try {
|
|
1197
|
+
this.toggleLoading();
|
|
1198
|
+
let i = await S(f, u),
|
|
1199
|
+
e = await i.json();
|
|
1200
|
+
(this.toggleLoading(),
|
|
1201
|
+
i.ok
|
|
1202
|
+
? this.handleTotpConsentGrant(o)
|
|
1203
|
+
: this.handleActiveScreenErrors(e.error));
|
|
1204
|
+
} catch (i) {
|
|
1205
|
+
(this.toggleLoading(), this.handleActiveScreenErrors(i.message));
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
toggleLoading() {
|
|
1209
|
+
let o = this.activeScreen.querySelector('button[type="submit"]'),
|
|
1210
|
+
u = o.querySelector('.text'),
|
|
1211
|
+
f = o.querySelector('svg'),
|
|
1212
|
+
i = o.querySelector('.spinner');
|
|
1213
|
+
(o.toggleAttribute('disabled'),
|
|
1214
|
+
u.toggleAttribute('hidden'),
|
|
1215
|
+
f.toggleAttribute('hidden'),
|
|
1216
|
+
i.toggleAttribute('hidden'));
|
|
1217
|
+
}
|
|
1218
|
+
setActiveScreen(o) {
|
|
1219
|
+
((this.activeScreen.hidden = !0),
|
|
1220
|
+
(o.hidden = !1),
|
|
1221
|
+
(this.activeScreen = o));
|
|
1222
|
+
}
|
|
1223
|
+
get baseUrl() {
|
|
1224
|
+
return this.getAttribute('base-url');
|
|
1225
|
+
}
|
|
1226
|
+
get country() {
|
|
1227
|
+
return this.getAttribute('country');
|
|
1228
|
+
}
|
|
1229
|
+
get idHint() {
|
|
1230
|
+
return (
|
|
1231
|
+
this.getAttribute('id-hint') || 'Your BVN should be 11 digits long'
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
get idNumber() {
|
|
1235
|
+
return localStorage.getItem('idNumber');
|
|
1236
|
+
}
|
|
1237
|
+
get idRegex() {
|
|
1238
|
+
return this.getAttribute('id-regex');
|
|
1239
|
+
}
|
|
1240
|
+
get idType() {
|
|
1241
|
+
return this.getAttribute('id-type');
|
|
1242
|
+
}
|
|
1243
|
+
get idTypeLabel() {
|
|
1244
|
+
return this.getAttribute('id-type-label');
|
|
1245
|
+
}
|
|
1246
|
+
get partnerId() {
|
|
1247
|
+
return this.getAttribute('partner-id');
|
|
1248
|
+
}
|
|
1249
|
+
get partnerName() {
|
|
1250
|
+
return this.getAttribute('partner-name');
|
|
1251
|
+
}
|
|
1252
|
+
get token() {
|
|
1253
|
+
return this.getAttribute('token');
|
|
1254
|
+
}
|
|
1255
|
+
get themeColor() {
|
|
1256
|
+
return this.getAttribute('theme-color') || '#001096';
|
|
1257
|
+
}
|
|
1258
|
+
get hideBack() {
|
|
1259
|
+
return this.hasAttribute('hide-back');
|
|
1260
|
+
}
|
|
1261
|
+
get showNavigation() {
|
|
1262
|
+
return this.hasAttribute('show-navigation');
|
|
1263
|
+
}
|
|
1264
|
+
handleTotpConsentGrant() {
|
|
1265
|
+
let o = new CustomEvent('end-user-consent.totp.granted', {
|
|
1266
|
+
detail: {
|
|
1267
|
+
consented: {
|
|
1268
|
+
contact_information: !0,
|
|
1269
|
+
document_information: !0,
|
|
1270
|
+
personal_details: !0,
|
|
1271
|
+
},
|
|
1272
|
+
id_number: this.idNumber,
|
|
1273
|
+
session_id: this.sessionId,
|
|
1274
|
+
},
|
|
1275
|
+
});
|
|
1276
|
+
this.dispatchEvent(o);
|
|
1277
|
+
}
|
|
1278
|
+
handleTotpConsentContactMethodsOutdated() {
|
|
1279
|
+
let o = 'end-user-consent.totp.denied.contact-methods-outdated',
|
|
1280
|
+
u = new CustomEvent(o, {
|
|
1281
|
+
detail: {
|
|
1282
|
+
data: { id_number: this.idNumber, session_id: this.sessionId },
|
|
1283
|
+
message: o,
|
|
1284
|
+
},
|
|
1285
|
+
});
|
|
1286
|
+
this.dispatchEvent(u);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
'customElements' in window &&
|
|
1290
|
+
!window.customElements.get('totp-consent') &&
|
|
1291
|
+
window.customElements.define('totp-consent', w);
|
|
1292
|
+
})();
|
|
2
1293
|
/*! Bundled license information:
|
|
3
1294
|
|
|
4
1295
|
validate.js/validate.js:
|