@spritz-finance/api-client 0.4.16 → 0.4.17

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 CHANGED
@@ -283,12 +283,25 @@ When a user's verification fails, Spritz now provides additional metadata to hel
283
283
 
284
284
  The verification metadata is available when a verification has failed and includes:
285
285
 
286
- - **`failureReason`**: The specific reason why the verification failed (e.g., `DuplicateIdentity`)
286
+ - **`failureReason`**: The specific reason why the verification failed
287
287
  - **`details.matchedEmail`**: For duplicate identity failures, shows the email of the matched user (only if created through the same integration)
288
288
 
289
+ #### Verification Failure Reasons
290
+
291
+ The following verification failure reasons may be returned:
292
+
293
+ - **`verify_sms`**: SMS verification failed
294
+ - **`documentary_verification`**: Document verification failed
295
+ - **`risk_check`**: Risk assessment check failed
296
+ - **`kyc_check`**: KYC (Know Your Customer) check failed
297
+ - **`watchlist_screening`**: Watchlist screening check failed
298
+ - **`selfie_check`**: Selfie verification check failed
299
+ - **`address_invalid`**: Provided address is invalid
300
+ - **`duplicate_identity`**: Identity already exists in the system
301
+
289
302
  #### Duplicate Identity Handling
290
303
 
291
- When a verification fails due to `DuplicateIdentity`, the system detects that the user has already been verified under a different account. The `matchedEmail` field helps determine:
304
+ When a verification fails due to `duplicate_identity`, the system detects that the user has already been verified under a different account. The `matchedEmail` field helps determine:
292
305
 
293
306
  - **If `matchedEmail` is populated**: The duplicate user was created through your integration
294
307
  - **If `matchedEmail` is `null`**: The duplicate user was created through a different integration (e.g., the main Spritz app)
@@ -298,9 +311,9 @@ This allows you to provide appropriate guidance to your users:
298
311
  ```typescript
299
312
  const userData = await client.user.getCurrentUser()
300
313
 
301
- if (userData.verificationMetadata?.failureReason === 'DuplicateIdentity') {
314
+ if (userData.verificationMetadata?.failureReason === 'duplicate_identity') {
302
315
  const matchedEmail = userData.verificationMetadata.details.matchedEmail
303
-
316
+
304
317
  if (matchedEmail) {
305
318
  // User exists within your integration
306
319
  console.log(`This identity is already verified with account: ${matchedEmail}`)
@@ -528,7 +528,7 @@ query CurrentUser {
528
528
  ...VerificationFragment
529
529
  }
530
530
  }
531
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var kv={};function Dv(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return kv[t]?!1:(kv[t]=!0,!0)})}En.definitions=En.definitions.concat(Dv(lr.definitions)),En.definitions=En.definitions.concat(Dv(si.definitions));function fr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){fr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){fr(u,n)}),e.definitions&&e.definitions.forEach(function(u){fr(u,n)})}var Fs={};(function(){En.definitions.forEach(function(n){if(n.name){var t=new Set;fr(n,t),Fs[n.name.value]=t}})})();function Bv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function qb(e,n){var t={kind:e.kind,definitions:[Bv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Bv(e,o);s&&t.definitions.push(s)}),t}qb(En,"CurrentUser");var Mb=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(Mb||{});function Gb(e=nt.INITIALIZED){switch(e){case nt.FAILED:return"failed";case nt.ACTIVE:return"verified";case nt.DISABLED:return"disabled";case nt.RETRY:return"failed";default:return"not_started"}}function Jb(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Gb(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}class Kb{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:En});return Jb(n)}async retryFailedVerification(){return await this.client.query({query:Bt}),this.getCurrentUser()}async getVerificationToken(){return(await this.client.query({query:ar})).getKycLinkToken}}var ci={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};ci.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
531
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var kv={};function Dv(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return kv[t]?!1:(kv[t]=!0,!0)})}En.definitions=En.definitions.concat(Dv(lr.definitions)),En.definitions=En.definitions.concat(Dv(si.definitions));function fr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){fr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){fr(u,n)}),e.definitions&&e.definitions.forEach(function(u){fr(u,n)})}var Fs={};(function(){En.definitions.forEach(function(n){if(n.name){var t=new Set;fr(n,t),Fs[n.name.value]=t}})})();function Bv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function qb(e,n){var t={kind:e.kind,definitions:[Bv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Bv(e,o);s&&t.definitions.push(s)}),t}qb(En,"CurrentUser");var Mb=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(Mb||{}),Gb=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(Gb||{});function Jb(e=nt.INITIALIZED){switch(e){case nt.FAILED:return"failed";case nt.ACTIVE:return"verified";case nt.DISABLED:return"disabled";case nt.RETRY:return"failed";default:return"not_started"}}function Kb(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Jb(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}class Hb{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:En});return Kb(n)}async retryFailedVerification(){return await this.client.query({query:Bt}),this.getCurrentUser()}async getVerificationToken(){return(await this.client.query({query:ar})).getKycLinkToken}}var ci={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};ci.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
532
532
  id
533
533
  name
534
534
  userId
@@ -558,24 +558,24 @@ query CurrentUser {
558
558
  address
559
559
  }
560
560
  }
561
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function mr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){mr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){mr(u,n)}),e.definitions&&e.definitions.forEach(function(u){mr(u,n)})}var Ns={};(function(){ci.definitions.forEach(function(n){if(n.name){var t=new Set;mr(n,t),Ns[n.name.value]=t}})})();function Sv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Hb(e,n){var t={kind:e.kind,definitions:[Sv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ns[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ns[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Sv(e,o);s&&t.definitions.push(s)}),t}Hb(ci,"VirtualDebitCardFragment");var St={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateUSVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createUSVirtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:166}};St.loc.source={body:`#import "../queries/virtualDebitCardFragment.graphql"
561
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function mr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){mr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){mr(u,n)}),e.definitions&&e.definitions.forEach(function(u){mr(u,n)})}var Ns={};(function(){ci.definitions.forEach(function(n){if(n.name){var t=new Set;mr(n,t),Ns[n.name.value]=t}})})();function Sv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Qb(e,n){var t={kind:e.kind,definitions:[Sv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ns[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ns[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Sv(e,o);s&&t.definitions.push(s)}),t}Qb(ci,"VirtualDebitCardFragment");var St={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateUSVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createUSVirtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:166}};St.loc.source={body:`#import "../queries/virtualDebitCardFragment.graphql"
562
562
 
563
563
  mutation CreateUSVirtualDebitCard {
564
564
  createUSVirtualDebitCard {
565
565
  ...VirtualDebitCardFragment
566
566
  }
567
567
  }
568
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var wv={};function Qb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return wv[t]?!1:(wv[t]=!0,!0)})}St.definitions=St.definitions.concat(Qb(ci.definitions));function vr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){vr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){vr(u,n)}),e.definitions&&e.definitions.forEach(function(u){vr(u,n)})}var Ts={};(function(){St.definitions.forEach(function(n){if(n.name){var t=new Set;vr(n,t),Ts[n.name.value]=t}})})();function _v(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Wb(e,n){var t={kind:e.kind,definitions:[_v(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ts[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ts[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=_v(e,o);s&&t.definitions.push(s)}),t}Wb(St,"CreateUSVirtualDebitCard");var wt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"UserVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"virtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:142}};wt.loc.source={body:`#import "./virtualDebitCardFragment.graphql"
568
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var wv={};function Wb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return wv[t]?!1:(wv[t]=!0,!0)})}St.definitions=St.definitions.concat(Wb(ci.definitions));function vr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){vr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){vr(u,n)}),e.definitions&&e.definitions.forEach(function(u){vr(u,n)})}var Ts={};(function(){St.definitions.forEach(function(n){if(n.name){var t=new Set;vr(n,t),Ts[n.name.value]=t}})})();function _v(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Yb(e,n){var t={kind:e.kind,definitions:[_v(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ts[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ts[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=_v(e,o);s&&t.definitions.push(s)}),t}Yb(St,"CreateUSVirtualDebitCard");var wt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"UserVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"virtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:142}};wt.loc.source={body:`#import "./virtualDebitCardFragment.graphql"
569
569
 
570
570
  query UserVirtualDebitCard {
571
571
  virtualDebitCard {
572
572
  ...VirtualDebitCardFragment
573
573
  }
574
574
  }
575
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Av={};function Yb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Av[t]?!1:(Av[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Yb(ci.definitions));function pr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Cv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Xb(e,n){var t={kind:e.kind,definitions:[Cv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Cv(e,o);s&&t.definitions.push(s)}),t}Xb(wt,"UserVirtualDebitCard");const ek={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},nk=(e,n)=>ek[e]?.(n)??null;class tk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=nk(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class ik{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&th())throw new Error(`It seems you're operating within a browser environment.
575
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Av={};function Xb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Av[t]?!1:(Av[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Xb(ci.definitions));function pr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Cv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function ek(e,n){var t={kind:e.kind,definitions:[Cv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Cv(e,o);s&&t.definitions.push(s)}),t}ek(wt,"UserVirtualDebitCard");const nk={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},tk=(e,n)=>nk[e]?.(n)??null;class ik{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=tk(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class uk{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&th())throw new Error(`It seems you're operating within a browser environment.
576
576
 
577
577
  By default, this is deactivated due to the potential risk of exposing your confidential integrator credentials.
578
578
  If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
579
579
 
580
580
  SpritzApiClient.initialize({ apiKey, dangerouslyAllowBrowser: true });
581
- `)}static initialize({environment:n=gr.Sandbox,apiKey:t,integrationKey:u,dangerouslyAllowBrowser:i=!1}){const r=new Ps(n,t,u,i);return r.init(),r}init(){this.client=new bh({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new Kb(this.client),this.bankAccount=new k1(this.client),this.debitCard=new P1(this.client),this.paymentRequest=new Pb(this.client),this.payment=new uE(this.client),this.onrampPayment=new Q1(this.client),this.virtualCard=new tk(this.client),this.bill=new $1(this.client),this.institution=new q1(this.client),this.webhook=new ik(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var $v=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))($v||{});exports.AmountMode=om,exports.BankAccountSubType=sm,exports.BankAccountType=et,exports.BillType=cm,exports.DebitCardNetwork=lm,exports.Environment=gr,exports.PayableAccountType=fm,exports.PaymentDeliveryMethod=mm,exports.PaymentNetwork=$v,exports.PaymentRequestStatus=dm,exports.PaymentStatus=vm,exports.SpritzApiClient=Ps,exports.VirtualCardType=xo;
581
+ `)}static initialize({environment:n=gr.Sandbox,apiKey:t,integrationKey:u,dangerouslyAllowBrowser:i=!1}){const r=new Ps(n,t,u,i);return r.init(),r}init(){this.client=new bh({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new Hb(this.client),this.bankAccount=new k1(this.client),this.debitCard=new P1(this.client),this.paymentRequest=new Pb(this.client),this.payment=new uE(this.client),this.onrampPayment=new Q1(this.client),this.virtualCard=new ik(this.client),this.bill=new $1(this.client),this.institution=new q1(this.client),this.webhook=new uk(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var $v=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))($v||{});exports.AmountMode=om,exports.BankAccountSubType=sm,exports.BankAccountType=et,exports.BillType=cm,exports.DebitCardNetwork=lm,exports.Environment=gr,exports.PayableAccountType=fm,exports.PaymentDeliveryMethod=mm,exports.PaymentNetwork=$v,exports.PaymentRequestStatus=dm,exports.PaymentStatus=vm,exports.SpritzApiClient=Ps,exports.VirtualCardType=xo;
@@ -104,7 +104,7 @@ declare enum PaymentStatus {
104
104
  /**
105
105
  * The reason for a verification failure
106
106
  */
107
- declare enum VerificationFailureReason {
107
+ declare enum VerificationFailureReason$1 {
108
108
  AddressInvalid = "AddressInvalid",
109
109
  DocumentVerification = "DocumentVerification",
110
110
  DuplicateIdentity = "DuplicateIdentity",
@@ -337,7 +337,7 @@ interface CurrentUser_verification_identity_verificationMetadata_details {
337
337
  }
338
338
  interface CurrentUser_verification_identity_verificationMetadata {
339
339
  __typename: 'VerificationMetadata';
340
- failureReason: VerificationFailureReason | null;
340
+ failureReason: VerificationFailureReason$1 | null;
341
341
  details: CurrentUser_verification_identity_verificationMetadata_details | null;
342
342
  }
343
343
  interface CurrentUser_verification_identity {
@@ -1079,7 +1079,7 @@ interface UserVerification_verification_identity_verificationMetadata_details {
1079
1079
  }
1080
1080
  interface UserVerification_verification_identity_verificationMetadata {
1081
1081
  __typename: 'VerificationMetadata';
1082
- failureReason: VerificationFailureReason | null;
1082
+ failureReason: VerificationFailureReason$1 | null;
1083
1083
  details: UserVerification_verification_identity_verificationMetadata_details | null;
1084
1084
  }
1085
1085
  interface UserVerification_verification_identity {
@@ -1146,7 +1146,7 @@ interface VerificationFragment_identity_verificationMetadata_details {
1146
1146
  }
1147
1147
  interface VerificationFragment_identity_verificationMetadata {
1148
1148
  __typename: 'VerificationMetadata';
1149
- failureReason: VerificationFailureReason | null;
1149
+ failureReason: VerificationFailureReason$1 | null;
1150
1150
  details: VerificationFragment_identity_verificationMetadata_details | null;
1151
1151
  }
1152
1152
  interface VerificationFragment_identity {
@@ -1674,6 +1674,16 @@ declare class PaymentRequestService {
1674
1674
  }>;
1675
1675
  }
1676
1676
 
1677
+ declare enum VerificationFailureReason {
1678
+ VerifySms = "verify_sms",
1679
+ DocumentVerification = "documentary_verification",
1680
+ RiskCheck = "risk_check",
1681
+ KycCheck = "kyc_check",
1682
+ WatchlistScreening = "watchlist_screening",
1683
+ SelfieCheck = "selfie_check",
1684
+ AddressInvalid = "address_invalid",
1685
+ DuplicateIdentity = "duplicate_identity"
1686
+ }
1677
1687
  declare enum VerificationStatus {
1678
1688
  NotStarted = "not_started",
1679
1689
  Verified = "verified",
@@ -1715,7 +1725,7 @@ declare class UserService {
1715
1725
  verifiedCountry: string | null;
1716
1726
  canRetryVerification: boolean;
1717
1727
  verificationMetadata: {
1718
- failureReason: VerificationFailureReason.DuplicateIdentity;
1728
+ failureReason: VerificationFailureReason;
1719
1729
  details: {
1720
1730
  matchedEmail: string | null;
1721
1731
  };
@@ -1727,7 +1737,7 @@ declare class UserService {
1727
1737
  verifiedCountry: string | null;
1728
1738
  canRetryVerification: boolean;
1729
1739
  verificationMetadata: {
1730
- failureReason: VerificationFailureReason.DuplicateIdentity;
1740
+ failureReason: VerificationFailureReason;
1731
1741
  details: {
1732
1742
  matchedEmail: string | null;
1733
1743
  };
@@ -528,7 +528,7 @@ query CurrentUser {
528
528
  ...VerificationFragment
529
529
  }
530
530
  }
531
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var bv={};function kv(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return bv[t]?!1:(bv[t]=!0,!0)})}En.definitions=En.definitions.concat(kv(lr.definitions)),En.definitions=En.definitions.concat(kv(si.definitions));function fr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){fr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){fr(u,n)}),e.definitions&&e.definitions.forEach(function(u){fr(u,n)})}var Fs={};(function(){En.definitions.forEach(function(n){if(n.name){var t=new Set;fr(n,t),Fs[n.name.value]=t}})})();function Dv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Mb(e,n){var t={kind:e.kind,definitions:[Dv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Dv(e,o);s&&t.definitions.push(s)}),t}Mb(En,"CurrentUser");var Gb=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(Gb||{});function Jb(e=nt.INITIALIZED){switch(e){case nt.FAILED:return"failed";case nt.ACTIVE:return"verified";case nt.DISABLED:return"disabled";case nt.RETRY:return"failed";default:return"not_started"}}function Kb(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Jb(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}class Hb{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:En});return Kb(n)}async retryFailedVerification(){return await this.client.query({query:Bt}),this.getCurrentUser()}async getVerificationToken(){return(await this.client.query({query:ar})).getKycLinkToken}}var ci={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};ci.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
531
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var bv={};function kv(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return bv[t]?!1:(bv[t]=!0,!0)})}En.definitions=En.definitions.concat(kv(lr.definitions)),En.definitions=En.definitions.concat(kv(si.definitions));function fr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){fr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){fr(u,n)}),e.definitions&&e.definitions.forEach(function(u){fr(u,n)})}var Fs={};(function(){En.definitions.forEach(function(n){if(n.name){var t=new Set;fr(n,t),Fs[n.name.value]=t}})})();function Dv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Mb(e,n){var t={kind:e.kind,definitions:[Dv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Fs[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Fs[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Dv(e,o);s&&t.definitions.push(s)}),t}Mb(En,"CurrentUser");var Gb=(e=>(e.VerifySms="verify_sms",e.DocumentVerification="documentary_verification",e.RiskCheck="risk_check",e.KycCheck="kyc_check",e.WatchlistScreening="watchlist_screening",e.SelfieCheck="selfie_check",e.AddressInvalid="address_invalid",e.DuplicateIdentity="duplicate_identity",e))(Gb||{}),Jb=(e=>(e.NotStarted="not_started",e.Verified="verified",e.Failed="failed",e.Disabled="disabled",e))(Jb||{});function Kb(e=nt.INITIALIZED){switch(e){case nt.FAILED:return"failed";case nt.ACTIVE:return"verified";case nt.DISABLED:return"disabled";case nt.RETRY:return"failed";default:return"not_started"}}function Hb(e){const n=e?.me??null;if(!n)return null;const t=e?.verification??null,u=t?.identity?.verificationMetadata??null,i=u?.details?.matchedEmail??null,r=u?.failureReason?{failureReason:u.failureReason,details:{matchedEmail:i}}:null;return{...n,verificationStatus:Kb(t?.identity?.status),verificationUrl:t?.identity?.verificationUrl??null,verifiedCountry:t?.identity?.country??null,canRetryVerification:t?.identity?.canRetry??!1,verificationMetadata:r}}class Qb{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/validate-key",body:n})}async getCurrentUser(){const n=await this.client.query({query:En});return Hb(n)}async retryFailedVerification(){return await this.client.query({query:Bt}),this.getCurrentUser()}async getVerificationToken(){return(await this.client.query({query:ar})).getKycLinkToken}}var ci={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:469}};ci.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
532
532
  id
533
533
  name
534
534
  userId
@@ -558,24 +558,24 @@ query CurrentUser {
558
558
  address
559
559
  }
560
560
  }
561
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function mr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){mr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){mr(u,n)}),e.definitions&&e.definitions.forEach(function(u){mr(u,n)})}var Ns={};(function(){ci.definitions.forEach(function(n){if(n.name){var t=new Set;mr(n,t),Ns[n.name.value]=t}})})();function Bv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Qb(e,n){var t={kind:e.kind,definitions:[Bv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ns[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ns[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Bv(e,o);s&&t.definitions.push(s)}),t}Qb(ci,"VirtualDebitCardFragment");var St={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateUSVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createUSVirtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:166}};St.loc.source={body:`#import "../queries/virtualDebitCardFragment.graphql"
561
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function mr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){mr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){mr(u,n)}),e.definitions&&e.definitions.forEach(function(u){mr(u,n)})}var Ns={};(function(){ci.definitions.forEach(function(n){if(n.name){var t=new Set;mr(n,t),Ns[n.name.value]=t}})})();function Bv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Wb(e,n){var t={kind:e.kind,definitions:[Bv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ns[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ns[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Bv(e,o);s&&t.definitions.push(s)}),t}Wb(ci,"VirtualDebitCardFragment");var St={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateUSVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createUSVirtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:166}};St.loc.source={body:`#import "../queries/virtualDebitCardFragment.graphql"
562
562
 
563
563
  mutation CreateUSVirtualDebitCard {
564
564
  createUSVirtualDebitCard {
565
565
  ...VirtualDebitCardFragment
566
566
  }
567
567
  }
568
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Sv={};function Wb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Sv[t]?!1:(Sv[t]=!0,!0)})}St.definitions=St.definitions.concat(Wb(ci.definitions));function vr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){vr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){vr(u,n)}),e.definitions&&e.definitions.forEach(function(u){vr(u,n)})}var Ts={};(function(){St.definitions.forEach(function(n){if(n.name){var t=new Set;vr(n,t),Ts[n.name.value]=t}})})();function wv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Yb(e,n){var t={kind:e.kind,definitions:[wv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ts[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ts[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=wv(e,o);s&&t.definitions.push(s)}),t}Yb(St,"CreateUSVirtualDebitCard");var wt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"UserVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"virtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:142}};wt.loc.source={body:`#import "./virtualDebitCardFragment.graphql"
568
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Sv={};function Yb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Sv[t]?!1:(Sv[t]=!0,!0)})}St.definitions=St.definitions.concat(Yb(ci.definitions));function vr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){vr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){vr(u,n)}),e.definitions&&e.definitions.forEach(function(u){vr(u,n)})}var Ts={};(function(){St.definitions.forEach(function(n){if(n.name){var t=new Set;vr(n,t),Ts[n.name.value]=t}})})();function wv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Xb(e,n){var t={kind:e.kind,definitions:[wv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Ts[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Ts[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=wv(e,o);s&&t.definitions.push(s)}),t}Xb(St,"CreateUSVirtualDebitCard");var wt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"UserVirtualDebitCard"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"virtualDebitCard"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"VirtualDebitCardFragment"},directives:[]}]}}]}}],loc:{start:0,end:142}};wt.loc.source={body:`#import "./virtualDebitCardFragment.graphql"
569
569
 
570
570
  query UserVirtualDebitCard {
571
571
  virtualDebitCard {
572
572
  ...VirtualDebitCardFragment
573
573
  }
574
574
  }
575
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var _v={};function Xb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return _v[t]?!1:(_v[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Xb(ci.definitions));function pr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Av(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function ek(e,n){var t={kind:e.kind,definitions:[Av(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Av(e,o);s&&t.definitions.push(s)}),t}ek(wt,"UserVirtualDebitCard");const nk={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},tk=(e,n)=>nk[e]?.(n)??null;class ik{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=tk(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class uk{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&ih())throw new Error(`It seems you're operating within a browser environment.
575
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var _v={};function ek(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return _v[t]?!1:(_v[t]=!0,!0)})}wt.definitions=wt.definitions.concat(ek(ci.definitions));function pr(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Av(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function nk(e,n){var t={kind:e.kind,definitions:[Av(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Av(e,o);s&&t.definitions.push(s)}),t}nk(wt,"UserVirtualDebitCard");const tk={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},ik=(e,n)=>tk[e]?.(n)??null;class uk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=ik(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class rk{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&ih())throw new Error(`It seems you're operating within a browser environment.
576
576
 
577
577
  By default, this is deactivated due to the potential risk of exposing your confidential integrator credentials.
578
578
  If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
579
579
 
580
580
  SpritzApiClient.initialize({ apiKey, dangerouslyAllowBrowser: true });
581
- `)}static initialize({environment:n=gr.Sandbox,apiKey:t,integrationKey:u,dangerouslyAllowBrowser:i=!1}){const r=new Ps(n,t,u,i);return r.init(),r}init(){this.client=new kh({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new Hb(this.client),this.bankAccount=new D1(this.client),this.debitCard=new R1(this.client),this.paymentRequest=new Rb(this.client),this.payment=new rE(this.client),this.onrampPayment=new W1(this.client),this.virtualCard=new ik(this.client),this.bill=new x1(this.client),this.institution=new M1(this.client),this.webhook=new uk(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var Cv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Cv||{});export{am as AmountMode,om as BankAccountSubType,et as BankAccountType,sm as BillType,cm as DebitCardNetwork,gr as Environment,dm as PayableAccountType,fm as PaymentDeliveryMethod,Cv as PaymentNetwork,lm as PaymentRequestStatus,mm as PaymentStatus,Ps as SpritzApiClient,xo as VirtualCardType};
581
+ `)}static initialize({environment:n=gr.Sandbox,apiKey:t,integrationKey:u,dangerouslyAllowBrowser:i=!1}){const r=new Ps(n,t,u,i);return r.init(),r}init(){this.client=new kh({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new Qb(this.client),this.bankAccount=new D1(this.client),this.debitCard=new R1(this.client),this.paymentRequest=new Rb(this.client),this.payment=new rE(this.client),this.onrampPayment=new W1(this.client),this.virtualCard=new uk(this.client),this.bill=new x1(this.client),this.institution=new M1(this.client),this.webhook=new rk(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var Cv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(Cv||{});export{am as AmountMode,om as BankAccountSubType,et as BankAccountType,sm as BillType,cm as DebitCardNetwork,gr as Environment,dm as PayableAccountType,fm as PaymentDeliveryMethod,Cv as PaymentNetwork,lm as PaymentRequestStatus,mm as PaymentStatus,Ps as SpritzApiClient,xo as VirtualCardType};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/api-client",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "description": "Typescript library for interacting with the Spritz Finance API",
5
5
  "type": "module",
6
6
  "main": "dist/spritz-api-client.cjs",