@bloque/sdk-compliance 0.4.1 → 0.6.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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{VerificationGateClient:()=>VerificationGateClient,mapVerificationFlow:()=>mapVerificationFlow,KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient,mapRequirementField:()=>mapRequirementField,TiersClient:()=>TiersClient,TosGateClient:()=>TosGateClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class KycClient extends sdk_core_namespaceObject.BaseClient{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person"}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageBase64:e.image_base64,imageSizeBytes:e.image_size_bytes}))}}}function mapRequirementField(e){return{key:e.key,label:e.label,type:e.type,required:e.required,options:e.options}}function mapRequirementStatus(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,fields:e.fields?.map(mapRequirementField),submittedAt:e.submitted_at}}function mapVerificationFlow(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,responseUrlField:e.response_url_field}}class TiersClient extends sdk_core_namespaceObject.BaseClient{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(mapRequirementStatus)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:mapVerificationFlow(t.verification_flow)}}}function mapAcceptance(e){return{id:e.id,identityUrn:e.identity_urn,documentVersionId:e.document_version_id,documentVersionLabel:e.document_version_label,documentHash:e.document_hash,acceptedAt:e.accepted_at,authAssurance:e.auth_assurance}}class TosGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,showHome:t.show_home}}async accept(e){let t={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:t,authorizationOverride:`Bearer ${e.token}`});return{acceptance:mapAcceptance(i.acceptance),returnUrl:i.return_url}}}function mapUploadIntent(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function mapRequirement(e){return{key:e.key,kind:e.kind,description:e.description,fields:e.fields?.map(mapRequirementField),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(mapUploadIntent)}}function mapDocumentToWire(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function mapAnswerToWire(e){return{requirement_key:e.requirementKey,values:e.values}}class VerificationGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(mapRequirement),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(mapDocumentToWire),answers:e.answers?.map(mapAnswerToWire)},i=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:i.return_url,documents:i.documents,answers:i.answers}}}class ComplianceClient extends sdk_core_namespaceObject.BaseClient{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new KycClient(this.httpClient),this.tiers=new TiersClient(this.httpClient),this.tosGate=new TosGateClient(this.httpClient),this.verificationGate=new VerificationGateClient(this.httpClient)}}for(var __rspack_i in exports.ComplianceClient=__webpack_exports__.ComplianceClient,exports.KycClient=__webpack_exports__.KycClient,exports.TiersClient=__webpack_exports__.TiersClient,exports.TosGateClient=__webpack_exports__.TosGateClient,exports.VerificationGateClient=__webpack_exports__.VerificationGateClient,exports.mapRequirementField=__webpack_exports__.mapRequirementField,exports.mapVerificationFlow=__webpack_exports__.mapVerificationFlow,__webpack_exports__)-1===["ComplianceClient","KycClient","TiersClient","TosGateClient","VerificationGateClient","mapRequirementField","mapVerificationFlow"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{VerificationGateClient:()=>VerificationGateClient,mapVerificationFlow:()=>mapVerificationFlow,KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient,mapRequirementField:()=>mapRequirementField,TiersClient:()=>TiersClient,TosGateClient:()=>TosGateClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class KycClient extends sdk_core_namespaceObject.BaseClient{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person"}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageBase64:e.image_base64,imageSizeBytes:e.image_size_bytes}))}}}function mapRequirementFieldOption(e){return"string"==typeof e?e:{value:e.value,label:{en:e.label.en,es:e.label.es}}}function mapRequirementField(e){return{key:e.key,label:e.label,description:e.description,type:e.type,required:e.required,options:e.options?.map(mapRequirementFieldOption),locale:e.locale}}function mapRequirementStatus(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,title:e.title,fields:e.fields?.map(mapRequirementField),requiresUpload:e.requires_upload,submittedAt:e.submitted_at}}function mapVerificationFlow(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,responseUrlField:e.response_url_field}}class TiersClient extends sdk_core_namespaceObject.BaseClient{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(mapRequirementStatus)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:mapVerificationFlow(t.verification_flow)}}}function mapAcceptance(e){return{id:e.id,identityUrn:e.identity_urn,documentVersionId:e.document_version_id,documentVersionLabel:e.document_version_label,documentHash:e.document_hash,acceptedAt:e.accepted_at,authAssurance:e.auth_assurance}}class TosGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,showHome:t.show_home,accentColor:t.accent_color}}async accept(e){let t={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:t,authorizationOverride:`Bearer ${e.token}`});return{acceptance:mapAcceptance(i.acceptance),returnUrl:i.return_url}}}function mapUploadIntent(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function mapRequirement(e){return{key:e.key,kind:e.kind,description:e.description,title:e.title,fields:e.fields?.map(mapRequirementField),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(mapUploadIntent)}}function mapDocumentToWire(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function mapAnswerToWire(e){return{requirement_key:e.requirementKey,values:e.values}}class VerificationGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(mapRequirement),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,title:e.title,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url,accentColor:t.accent_color}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(mapDocumentToWire),answers:e.answers?.map(mapAnswerToWire)},i=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:i.return_url,documents:i.documents,answers:i.answers}}}class ComplianceClient extends sdk_core_namespaceObject.BaseClient{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new KycClient(this.httpClient),this.tiers=new TiersClient(this.httpClient),this.tosGate=new TosGateClient(this.httpClient),this.verificationGate=new VerificationGateClient(this.httpClient)}}for(var __rspack_i in exports.ComplianceClient=__webpack_exports__.ComplianceClient,exports.KycClient=__webpack_exports__.KycClient,exports.TiersClient=__webpack_exports__.TiersClient,exports.TosGateClient=__webpack_exports__.TosGateClient,exports.VerificationGateClient=__webpack_exports__.VerificationGateClient,exports.mapRequirementField=__webpack_exports__.mapRequirementField,exports.mapVerificationFlow=__webpack_exports__.mapVerificationFlow,__webpack_exports__)-1===["ComplianceClient","KycClient","TiersClient","TosGateClient","VerificationGateClient","mapRequirementField","mapVerificationFlow"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person"}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageBase64:e.image_base64,imageSizeBytes:e.image_size_bytes}))}}}function n(e){return{key:e.key,label:e.label,type:e.type,required:e.required,options:e.options}}function i(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,fields:e.fields?.map(n),submittedAt:e.submitted_at}}function r(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,responseUrlField:e.response_url_field}}class s extends e{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(i)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:r(t.verification_flow)}}}class a extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,showHome:t.show_home}}async accept(e){var t;let n={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:n,authorizationOverride:`Bearer ${e.token}`});return{acceptance:{id:(t=i.acceptance).id,identityUrn:t.identity_urn,documentVersionId:t.document_version_id,documentVersionLabel:t.document_version_label,documentHash:t.document_hash,acceptedAt:t.accepted_at,authAssurance:t.auth_assurance},returnUrl:i.return_url}}}function o(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function u(e){return{key:e.key,kind:e.kind,description:e.description,fields:e.fields?.map(n),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(o)}}function c(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function l(e){return{requirement_key:e.requirementKey,values:e.values}}class d extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(u),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(c),answers:e.answers?.map(l)},n=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:n.return_url,documents:n.documents,answers:n.answers}}}class p extends e{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new t(this.httpClient),this.tiers=new s(this.httpClient),this.tosGate=new a(this.httpClient),this.verificationGate=new d(this.httpClient)}}export{p as ComplianceClient,t as KycClient,s as TiersClient,a as TosGateClient,d as VerificationGateClient,n as mapRequirementField,r as mapVerificationFlow};
1
+ import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person"}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageBase64:e.image_base64,imageSizeBytes:e.image_size_bytes}))}}}function n(e){return"string"==typeof e?e:{value:e.value,label:{en:e.label.en,es:e.label.es}}}function i(e){return{key:e.key,label:e.label,description:e.description,type:e.type,required:e.required,options:e.options?.map(n),locale:e.locale}}function r(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,title:e.title,fields:e.fields?.map(i),requiresUpload:e.requires_upload,submittedAt:e.submitted_at}}function s(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,responseUrlField:e.response_url_field}}class a extends e{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(r)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:s(t.verification_flow)}}}class o extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,showHome:t.show_home,accentColor:t.accent_color}}async accept(e){var t;let n={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:n,authorizationOverride:`Bearer ${e.token}`});return{acceptance:{id:(t=i.acceptance).id,identityUrn:t.identity_urn,documentVersionId:t.document_version_id,documentVersionLabel:t.document_version_label,documentHash:t.document_hash,acceptedAt:t.accepted_at,authAssurance:t.auth_assurance},returnUrl:i.return_url}}}function u(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function l(e){return{key:e.key,kind:e.kind,description:e.description,title:e.title,fields:e.fields?.map(i),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(u)}}function c(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function d(e){return{requirement_key:e.requirementKey,values:e.values}}class p extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(l),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,title:e.title,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url,accentColor:t.accent_color}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(c),answers:e.answers?.map(d)},n=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:n.return_url,documents:n.documents,answers:n.answers}}}class m extends e{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new t(this.httpClient),this.tiers=new a(this.httpClient),this.tosGate=new o(this.httpClient),this.verificationGate=new p(this.httpClient)}}export{m as ComplianceClient,t as KycClient,a as TiersClient,o as TosGateClient,p as VerificationGateClient,i as mapRequirementField,s as mapVerificationFlow};
@@ -61,6 +61,23 @@ export interface GetKycDocumentsResponse {
61
61
  documents_status: string;
62
62
  documents: ComplianceDocumentImage[];
63
63
  }
64
+ /**
65
+ * @internal
66
+ * A display label in both languages the hosted gates render in.
67
+ */
68
+ export interface LocalizedTextWire {
69
+ en: string;
70
+ es: string;
71
+ }
72
+ /**
73
+ * @internal
74
+ * A `select` field option with a stored `value` distinct from its
75
+ * localized display `label`.
76
+ */
77
+ export interface RequirementFieldOptionWire {
78
+ value: string;
79
+ label: LocalizedTextWire;
80
+ }
64
81
  /**
65
82
  * @internal
66
83
  * A form field a `document`/`manual_review` requirement may ask for.
@@ -68,9 +85,13 @@ export interface GetKycDocumentsResponse {
68
85
  export interface RequirementFieldWire {
69
86
  key: string;
70
87
  label: string;
88
+ description?: string;
71
89
  type: 'text' | 'number' | 'date' | 'select' | 'boolean';
72
90
  required?: boolean;
73
- options?: string[];
91
+ /** Legacy plain strings still appear alongside the newer localized
92
+ * option shape — both must be accepted. */
93
+ options?: (string | RequirementFieldOptionWire)[];
94
+ locale?: 'en' | 'es';
74
95
  }
75
96
  /**
76
97
  * @internal
@@ -81,7 +102,9 @@ export interface TierRequirementStatusWire {
81
102
  kind: string;
82
103
  status: 'satisfied' | 'not_satisfied' | 'expired' | 'revoked' | 'pending_review';
83
104
  description?: string;
105
+ title?: string;
84
106
  fields?: RequirementFieldWire[];
107
+ requires_upload?: boolean;
85
108
  submitted_at?: string;
86
109
  }
87
110
  /**
@@ -162,6 +185,7 @@ export interface TosGateInitResponse {
162
185
  csrf_token: string;
163
186
  return_url: string;
164
187
  show_home: boolean;
188
+ accent_color?: string;
165
189
  }
166
190
  /**
167
191
  * @internal
@@ -210,6 +234,7 @@ export interface VerificationRequirementWire {
210
234
  key: string;
211
235
  kind: string;
212
236
  description?: string;
237
+ title?: string;
213
238
  fields?: RequirementFieldWire[];
214
239
  uploadable: boolean;
215
240
  upload_intents?: VerificationUploadIntentWire[];
@@ -221,6 +246,7 @@ export interface VerificationRequirementWire {
221
246
  export interface PendingVerificationRequirementWire {
222
247
  key: string;
223
248
  description?: string;
249
+ title?: string;
224
250
  submitted_at?: string;
225
251
  }
226
252
  export interface VerificationGateInitResponse {
@@ -228,6 +254,7 @@ export interface VerificationGateInitResponse {
228
254
  pending_requirements?: PendingVerificationRequirementWire[];
229
255
  csrf_token: string;
230
256
  return_url: string;
257
+ accent_color?: string;
231
258
  }
232
259
  /**
233
260
  * @internal
@@ -7,13 +7,36 @@ export interface GetTierStatusParams {
7
7
  */
8
8
  urn: string;
9
9
  }
10
+ /** A display label in both languages the hosted gates render in. */
11
+ export interface LocalizedText {
12
+ en: string;
13
+ es: string;
14
+ }
15
+ /** A `select` field option with a stored `value` distinct from its
16
+ * localized display `label`. See {@link RequirementField.options}. */
17
+ export interface RequirementFieldOption {
18
+ value: string;
19
+ label: LocalizedText;
20
+ }
10
21
  export interface RequirementField {
11
22
  key: string;
12
23
  label: string;
24
+ /** Short help text rendered under the label, clarifying what's being asked. */
25
+ description?: string;
13
26
  type: 'text' | 'number' | 'date' | 'select' | 'boolean';
14
27
  required?: boolean;
15
- /** Only meaningful for `type: 'select'`. */
16
- options?: string[];
28
+ /** Only meaningful for `type: 'select'`. Supports legacy plain strings
29
+ * (rendered as-is, unlocalized — still emitted by older policy entries)
30
+ * or `{ value, label: { en, es } }` for a display label localized
31
+ * independently of the stored value. */
32
+ options?: (string | RequirementFieldOption)[];
33
+ /** Pins which side of a localized option's `label` to display,
34
+ * overriding the caller's own locale/language detection. Set on fields
35
+ * whose surrounding `label`/`description` are themselves authored in a
36
+ * single fixed language rather than localized, so the option list
37
+ * doesn't mix languages mid-form. Omit for a field whose label and
38
+ * options should track the same per-visitor language. */
39
+ locale?: 'en' | 'es';
17
40
  }
18
41
  export interface TierRequirementStatus {
19
42
  key: string;
@@ -24,8 +47,17 @@ export interface TierRequirementStatus {
24
47
  status: 'satisfied' | 'not_satisfied' | 'expired' | 'revoked' | 'pending_review';
25
48
  /** What this requirement means, for display without hardcoding key strings. */
26
49
  description?: string;
50
+ /** Human-readable title for the requirement's card, distinct from
51
+ * `description`. Falls back to a humanized version of `key` client-side
52
+ * when absent — older policy entries may not set it. */
53
+ title?: string;
27
54
  /** Only present for requirements that collect form answers. */
28
55
  fields?: RequirementField[];
56
+ /** When explicitly `false`, this requirement is form-only and must
57
+ * never be treated as uploadable regardless of `kind` (e.g. a
58
+ * form-only `manual_review` like a one-off questionnaire). Omitted or
59
+ * `true` means the usual kind-based uploadable default applies. */
60
+ requiresUpload?: boolean;
29
61
  /** ISO-8601 timestamp of the submission behind a `'pending_review'`
30
62
  * status, for a "submitted on X" line. */
31
63
  submittedAt?: string;
@@ -31,6 +31,13 @@ export interface TosGateInitResult {
31
31
  returnUrl: string;
32
32
  /** Whether the hosted page's intro screens should play before the document. */
33
33
  showHome: boolean;
34
+ /** The calling origin's `gate_accent_color` (a CSS hex color), if it has
35
+ * one configured — the same color the hosted page itself applies via
36
+ * `--accent`. `undefined` when the origin has none configured or it
37
+ * failed validation server-side (e.g. not a valid 3-/6-digit hex). Only
38
+ * useful if you're building your own UI around the gate rather than
39
+ * just opening `url` in a browser/webview. */
40
+ accentColor?: string;
34
41
  }
35
42
  export interface TosGateAcceptParams {
36
43
  /** The capability token returned by `start()`. */
@@ -31,8 +31,20 @@ export interface VerificationRequirement {
31
31
  /** e.g. `'document'` or `'manual_review'` — TOS/KYC never appear here (they have no upload/form). */
32
32
  kind: string;
33
33
  description?: string;
34
+ /** Human-readable title for the requirement's card, distinct from
35
+ * `description`. Falls back to a humanized version of `key` client-side
36
+ * when absent. */
37
+ title?: string;
34
38
  /** Only present for requirements that collect form answers. */
35
39
  fields?: RequirementField[];
40
+ /**
41
+ * Whether this requirement should collect a document upload. Already
42
+ * accounts for the policy's `requiresUpload` opt-out server-side — it's
43
+ * `false` for a `kind` that would otherwise default to uploadable but
44
+ * is actually form-only (e.g. a one-off questionnaire `manual_review`
45
+ * with no document to attach), so you don't need to hardcode which
46
+ * `kind`s are uploadable yourself.
47
+ */
36
48
  uploadable: boolean;
37
49
  /** One presigned upload URL per allowed content type, only when `uploadable`. */
38
50
  uploadIntents?: VerificationUploadIntent[];
@@ -43,6 +55,10 @@ export interface VerificationRequirement {
43
55
  export interface PendingVerificationRequirement {
44
56
  key: string;
45
57
  description?: string;
58
+ /** Human-readable title for the requirement's card, distinct from
59
+ * `description`. Falls back to a humanized version of `key` client-side
60
+ * when absent. */
61
+ title?: string;
46
62
  /** ISO-8601 timestamp of the submission. */
47
63
  submittedAt?: string;
48
64
  }
@@ -57,6 +73,10 @@ export interface VerificationGateInitResult {
57
73
  /** Single-use submit nonce — pass as `csrfToken` to `submit()`. */
58
74
  csrfToken: string;
59
75
  returnUrl: string;
76
+ /** The calling origin's `gate_accent_color` (a CSS hex color), if it has
77
+ * one configured — see {@link TosGateInitResult.accentColor} for the
78
+ * full explanation; both gates share the same origin-metadata source. */
79
+ accentColor?: string;
60
80
  }
61
81
  export interface SubmitDocumentConfirmation {
62
82
  requirementKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-compliance",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",
@@ -34,6 +34,6 @@
34
34
  "node": ">=22"
35
35
  },
36
36
  "dependencies": {
37
- "@bloque/sdk-core": "0.4.1"
37
+ "@bloque/sdk-core": "0.5.0"
38
38
  }
39
39
  }