vesant-sdk 1.8.0-dev.2b9e28d → 1.8.0-dev.69578db

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.
Files changed (42) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-DUHC-68_.d.ts → client-4oLoc31v.d.ts} +1 -1
  3. package/dist/{client-5q4whhGu.d.mts → client-CJI8VO1i.d.mts} +1 -1
  4. package/dist/compliance/index.d.mts +2 -2
  5. package/dist/compliance/index.d.ts +2 -2
  6. package/dist/compliance/index.js +19 -3
  7. package/dist/compliance/index.js.map +1 -1
  8. package/dist/compliance/index.mjs +19 -3
  9. package/dist/compliance/index.mjs.map +1 -1
  10. package/dist/index.d.mts +3 -3
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +72 -14
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +71 -15
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/kyc/core.d.mts +2 -2
  17. package/dist/kyc/core.d.ts +2 -2
  18. package/dist/kyc/core.js +52 -11
  19. package/dist/kyc/core.js.map +1 -1
  20. package/dist/kyc/core.mjs +52 -12
  21. package/dist/kyc/core.mjs.map +1 -1
  22. package/dist/kyc/index.d.mts +156 -12
  23. package/dist/kyc/index.d.ts +156 -12
  24. package/dist/kyc/index.js +52 -11
  25. package/dist/kyc/index.js.map +1 -1
  26. package/dist/kyc/index.mjs +52 -12
  27. package/dist/kyc/index.mjs.map +1 -1
  28. package/dist/react.d.mts +21 -3
  29. package/dist/react.d.ts +21 -3
  30. package/dist/react.js +8 -1
  31. package/dist/react.js.map +1 -1
  32. package/dist/react.mjs +8 -1
  33. package/dist/react.mjs.map +1 -1
  34. package/dist/risk-profile/index.d.mts +16 -6
  35. package/dist/risk-profile/index.d.ts +16 -6
  36. package/dist/risk-profile/index.js +18 -2
  37. package/dist/risk-profile/index.js.map +1 -1
  38. package/dist/risk-profile/index.mjs +18 -3
  39. package/dist/risk-profile/index.mjs.map +1 -1
  40. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  41. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  42. package/package.json +1 -1
@@ -1522,17 +1522,27 @@ var RiskProfileClient = class extends BaseClient {
1522
1522
  /**
1523
1523
  * Update customer profile
1524
1524
  *
1525
+ * Omitted fields keep their stored values. When the tenant has the
1526
+ * **On Account Sensitive Action** KYC trigger enabled and the update changes
1527
+ * the customer's name, date of birth or residential address, Vesant applies
1528
+ * the other fields, holds the sensitive ones and answers `202` with a
1529
+ * {@link ProfileUpdateHeldResponse} instead of the profile. Narrow with
1530
+ * {@link isProfileUpdateHeld}, then request a `profile_change` submit link.
1531
+ *
1525
1532
  * @param profileId - Profile UUID
1526
1533
  * @param updates - Fields to update
1527
- * @returns Updated customer profile
1534
+ * @returns Updated customer profile, or the held change
1528
1535
  *
1529
1536
  * @example
1530
1537
  * ```typescript
1531
- * const updated = await client.updateProfile(profileId, {
1538
+ * const result = await client.updateProfile(profileId, {
1532
1539
  * location: 'New York, USA',
1533
1540
  * location_compliance: 'compliant',
1534
1541
  * last_recorded_activity: new Date().toISOString()
1535
1542
  * });
1543
+ * if (isProfileUpdateHeld(result)) {
1544
+ * // name / DOB / address held: start KYC with trigger_event 'profile_change'
1545
+ * }
1536
1546
  * ```
1537
1547
  */
1538
1548
  async updateProfile(profileId, updates, requestOptions) {
@@ -1572,6 +1582,11 @@ var RiskProfileClient = class extends BaseClient {
1572
1582
  }
1573
1583
  };
1574
1584
 
1585
+ // src/risk-profile/types.ts
1586
+ function isProfileUpdateHeld(result) {
1587
+ return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
1588
+ }
1589
+
1575
1590
  // src/compliance/types.ts
1576
1591
  var DEFAULT_CURRENCY_RATES = {
1577
1592
  USD: 1,
@@ -2027,11 +2042,12 @@ var ComplianceClient = class {
2027
2042
  if (profileResult) {
2028
2043
  profile = profileResult;
2029
2044
  if (!isBlocked && this.shouldUpdateProfile(profile, geoVerification.location.city)) {
2030
- profile = await this.riskClient.updateProfile(profile.id, {
2045
+ const updated = await this.riskClient.updateProfile(profile.id, {
2031
2046
  last_recorded_activity: (/* @__PURE__ */ new Date()).toISOString(),
2032
2047
  location: `${geoVerification.location.city}, ${geoVerification.location.country}`,
2033
2048
  location_compliance: geoVerification.is_compliant ? "compliant" : "non-compliant"
2034
2049
  }, requestOptions);
2050
+ profile = isProfileUpdateHeld(updated) ? updated.profile : updated;
2035
2051
  }
2036
2052
  } else {
2037
2053
  if (this.config.autoCreateProfiles && this.config.debug) {