vesant-sdk 1.5.0 → 1.5.2

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 (66) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-3cBb_Pp-.d.ts → client-B8pFrXx_.d.ts} +9 -3
  3. package/dist/{client-DKqyESgT.d.mts → client-BZxzOidG.d.mts} +9 -3
  4. package/dist/{client-BQRONu8q.d.mts → client-CIon-bGS.d.mts} +1 -1
  5. package/dist/{client-BQRONu8q.d.ts → client-CIon-bGS.d.ts} +1 -1
  6. package/dist/compliance/index.d.mts +5 -5
  7. package/dist/compliance/index.d.ts +5 -5
  8. package/dist/compliance/index.js +3 -1
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +3 -1
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.d.mts +2 -2
  13. package/dist/decisions/index.d.ts +2 -2
  14. package/dist/decisions/index.js +3 -1
  15. package/dist/decisions/index.js.map +1 -1
  16. package/dist/decisions/index.mjs +3 -1
  17. package/dist/decisions/index.mjs.map +1 -1
  18. package/dist/geolocation/index.d.mts +4 -4
  19. package/dist/geolocation/index.d.ts +4 -4
  20. package/dist/geolocation/index.js +3 -1
  21. package/dist/geolocation/index.js.map +1 -1
  22. package/dist/geolocation/index.mjs +3 -1
  23. package/dist/geolocation/index.mjs.map +1 -1
  24. package/dist/index.d.mts +537 -9
  25. package/dist/index.d.ts +537 -9
  26. package/dist/index.js +274 -110
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +273 -108
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +3 -3
  31. package/dist/kyc/core.d.ts +3 -3
  32. package/dist/kyc/core.js +3 -1
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +3 -1
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +7 -3
  37. package/dist/kyc/index.d.ts +7 -3
  38. package/dist/kyc/index.js +3 -1
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +3 -1
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +4 -4
  43. package/dist/react.d.ts +4 -4
  44. package/dist/react.js +1 -1
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +1 -1
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +4 -4
  49. package/dist/risk-profile/index.d.ts +4 -4
  50. package/dist/risk-profile/index.js +3 -1
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +3 -1
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.d.mts +2 -2
  55. package/dist/scores/index.d.ts +2 -2
  56. package/dist/scores/index.js +3 -1
  57. package/dist/scores/index.js.map +1 -1
  58. package/dist/scores/index.mjs +3 -1
  59. package/dist/scores/index.mjs.map +1 -1
  60. package/dist/{types-_hsTA3Ez.d.mts → types-1RzYeSal.d.mts} +1 -1
  61. package/dist/{types-B1OzEQR3.d.mts → types-B4Ezqo7V.d.mts} +1 -1
  62. package/dist/{types-B1OzEQR3.d.ts → types-B4Ezqo7V.d.ts} +1 -1
  63. package/dist/{types-BnL66DB3.d.ts → types-X5Md_dD_.d.ts} +1 -1
  64. package/dist/webhooks/index.d.mts +1 -1
  65. package/dist/webhooks/index.d.ts +1 -1
  66. package/package.json +6 -1
package/dist/index.js CHANGED
@@ -242,7 +242,7 @@ var noopLogger = {
242
242
  };
243
243
 
244
244
  // src/core/version.ts
245
- var SDK_VERSION = "1.5.0";
245
+ var SDK_VERSION = "1.5.2";
246
246
 
247
247
  // src/shared/browser-utils.ts
248
248
  function generateUUID() {
@@ -530,6 +530,8 @@ var BaseClient = class {
530
530
  return new VesantError(message, "FORBIDDEN", 403);
531
531
  case 404:
532
532
  return new VesantError(message, "NOT_FOUND", 404);
533
+ case 409:
534
+ return new VesantError(message, "DUPLICATE_PROFILE", 409);
533
535
  case 429: {
534
536
  const retryAfter = data.retry_after || data.retryAfter;
535
537
  return new RateLimitError(retryAfter);
@@ -2838,152 +2840,315 @@ var KycClient = class extends BaseClient {
2838
2840
  // ============================================================================
2839
2841
  };
2840
2842
 
2841
- // src/decisions/client.ts
2842
- var DecisionsClient = class extends BaseClient {
2843
+ // src/tax/client.ts
2844
+ var TaxClient = class extends BaseClient {
2845
+ constructor(config) {
2846
+ const baseConfig = {
2847
+ baseURL: config.baseURL,
2848
+ tenantId: config.tenantId,
2849
+ apiKey: config.apiKey,
2850
+ headers: config.headers,
2851
+ timeout: config.timeout,
2852
+ retries: 3,
2853
+ debug: config.debug,
2854
+ environment: config.environment
2855
+ };
2856
+ super(baseConfig);
2857
+ }
2858
+ // ============================================================================
2859
+ // Tax Enable / Disable Configuration
2860
+ // ============================================================================
2843
2861
  /**
2844
- * Record a new decision for a customer.
2862
+ * Get the tax enabled/disabled state for the tenant
2863
+ *
2864
+ * @returns The current tax config (tax_enabled flag)
2865
+ *
2866
+ * @example
2867
+ * ```typescript
2868
+ * const config = await client.getTaxConfig();
2869
+ * console.log(`Tax enabled: ${config.tax_enabled}`);
2870
+ * ```
2845
2871
  */
2846
- async recordDecision(request, requestOptions) {
2847
- return this.requestWithRetry(
2848
- "/api/v1/decisions",
2849
- { method: "POST", body: JSON.stringify(request) },
2850
- void 0,
2851
- void 0,
2852
- requestOptions
2853
- );
2872
+ async getTaxConfig() {
2873
+ const res = await this.request("/api/v1/tax/config");
2874
+ return res.tax_config;
2854
2875
  }
2855
2876
  /**
2856
- * Get decisions for a customer.
2877
+ * Enable or disable tax compliance features for the tenant
2878
+ *
2879
+ * @param request - Object with tax_enabled boolean
2880
+ * @returns Updated tax config
2881
+ *
2882
+ * @example
2883
+ * ```typescript
2884
+ * // Enable tax
2885
+ * const config = await client.updateTaxConfig({ tax_enabled: true });
2886
+ *
2887
+ * // Disable tax
2888
+ * const config = await client.updateTaxConfig({ tax_enabled: false });
2889
+ * ```
2857
2890
  */
2858
- async getDecisions(customerId, filters, requestOptions) {
2859
- const queryString = this.buildQueryString({
2860
- customer_id: customerId,
2861
- ...filters
2891
+ async updateTaxConfig(request) {
2892
+ const res = await this.request("/api/v1/tax/config", {
2893
+ method: "PUT",
2894
+ body: JSON.stringify({ tax_config: request })
2862
2895
  });
2863
- return this.requestWithRetry(
2864
- `/api/v1/decisions${queryString}`,
2865
- { method: "GET" },
2866
- void 0,
2867
- void 0,
2868
- requestOptions
2869
- );
2896
+ return res.tax_config;
2870
2897
  }
2898
+ // ============================================================================
2899
+ // Solicitation Trigger Configuration
2900
+ // ============================================================================
2871
2901
  /**
2872
- * Get a specific decision by ID.
2902
+ * Get solicitation triggers for the tenant
2903
+ *
2904
+ * @returns List of solicitation triggers with their enabled state
2905
+ *
2906
+ * @example
2907
+ * ```typescript
2908
+ * const triggers = await client.getSolicitationTriggers();
2909
+ * triggers.forEach(t => console.log(`${t.label}: ${t.enabled}`));
2910
+ * ```
2873
2911
  */
2874
- async getDecision(decisionId, requestOptions) {
2875
- return this.requestWithRetry(
2876
- `/api/v1/decisions/${encodeURIComponent(decisionId)}`,
2877
- { method: "GET" },
2878
- void 0,
2879
- void 0,
2880
- requestOptions
2912
+ async getSolicitationTriggers() {
2913
+ const res = await this.request(
2914
+ "/api/v1/tax/solicitation/config"
2881
2915
  );
2916
+ return res.solicitation_triggers;
2882
2917
  }
2883
2918
  /**
2884
- * Apply a label to a customer.
2919
+ * Update solicitation triggers for the tenant
2920
+ *
2921
+ * @param triggers - Array of triggers with updated enabled/threshold values
2922
+ * @returns Updated triggers
2923
+ *
2924
+ * @example
2925
+ * ```typescript
2926
+ * const triggers = await client.updateSolicitationTriggers([
2927
+ * { type: 'first_withdrawal', enabled: true, label: 'First Withdrawal', description: '...' },
2928
+ * { type: 'threshold_based', enabled: true, label: 'Threshold', description: '...', threshold_amount: 600 },
2929
+ * ]);
2930
+ * ```
2885
2931
  */
2886
- async applyLabel(request, requestOptions) {
2887
- return this.requestWithRetry(
2888
- "/api/v1/labels",
2889
- { method: "POST", body: JSON.stringify(request) },
2890
- void 0,
2891
- void 0,
2892
- requestOptions
2932
+ async updateSolicitationTriggers(triggers) {
2933
+ const res = await this.request(
2934
+ "/api/v1/tax/solicitation/config",
2935
+ {
2936
+ method: "PUT",
2937
+ body: JSON.stringify({ solicitation_triggers: triggers })
2938
+ }
2893
2939
  );
2940
+ return res.solicitation_triggers;
2894
2941
  }
2942
+ // ============================================================================
2943
+ // Reminder Configuration
2944
+ // ============================================================================
2895
2945
  /**
2896
- * Remove a label from a customer.
2946
+ * Get the reminder configuration for the tenant
2947
+ *
2948
+ * @returns Reminder config (enabled, max_reminders, frequency_days)
2949
+ *
2950
+ * @example
2951
+ * ```typescript
2952
+ * const config = await client.getReminderConfig();
2953
+ * console.log(`Reminders enabled: ${config.enabled}, every ${config.frequency_days} days`);
2954
+ * ```
2897
2955
  */
2898
- async removeLabel(customerId, requestOptions) {
2899
- return this.requestWithRetry(
2900
- `/api/v1/labels/${encodeURIComponent(customerId)}`,
2901
- { method: "DELETE" },
2902
- void 0,
2903
- void 0,
2904
- requestOptions
2956
+ async getReminderConfig() {
2957
+ const res = await this.request(
2958
+ "/api/v1/tax/solicitation/reminder-config"
2905
2959
  );
2960
+ return res.reminder_config;
2906
2961
  }
2907
2962
  /**
2908
- * Get labels for a customer.
2963
+ * Update the reminder configuration for the tenant
2964
+ *
2965
+ * @param config - Reminder configuration to set
2966
+ * @returns Updated reminder config
2967
+ *
2968
+ * @example
2969
+ * ```typescript
2970
+ * const updated = await client.updateReminderConfig({
2971
+ * enabled: true,
2972
+ * max_reminders: 3,
2973
+ * frequency_days: 7,
2974
+ * });
2975
+ * ```
2909
2976
  */
2910
- async getLabels(customerId, requestOptions) {
2911
- const queryString = this.buildQueryString({ customer_id: customerId });
2912
- return this.requestWithRetry(
2913
- `/api/v1/labels${queryString}`,
2914
- { method: "GET" },
2915
- void 0,
2916
- void 0,
2917
- requestOptions
2977
+ async updateReminderConfig(config) {
2978
+ const res = await this.request(
2979
+ "/api/v1/tax/solicitation/reminder-config",
2980
+ {
2981
+ method: "PUT",
2982
+ body: JSON.stringify({ reminder_config: config })
2983
+ }
2918
2984
  );
2985
+ return res.reminder_config;
2919
2986
  }
2920
- };
2921
-
2922
- // src/scores/client.ts
2923
- var ScoresClient = class extends BaseClient {
2987
+ // ============================================================================
2988
+ // Tax Forms
2989
+ // ============================================================================
2924
2990
  /**
2925
- * Get the current risk score for a customer.
2991
+ * List tax forms with optional filters and pagination
2992
+ *
2993
+ * @param filters - Optional filters (customer_id, form_type, form_status, etc.)
2994
+ * @returns Paginated list of tax forms
2995
+ *
2996
+ * @example
2997
+ * ```typescript
2998
+ * const result = await client.listTaxForms({ form_type: 'W-9', form_status: 'Pending' });
2999
+ * console.log(`Found ${result.total} forms`);
3000
+ * ```
2926
3001
  */
2927
- async getScore(customerId, requestOptions) {
2928
- return this.requestWithRetry(
2929
- `/api/v1/scores/${encodeURIComponent(customerId)}`,
2930
- { method: "GET" },
2931
- void 0,
2932
- void 0,
2933
- requestOptions
2934
- );
3002
+ async listTaxForms(filters) {
3003
+ const params = {};
3004
+ if (filters) {
3005
+ if (filters.customer_id) params.customer_id = filters.customer_id;
3006
+ if (filters.form_type) params.form_type = filters.form_type;
3007
+ if (filters.form_status) params.form_status = filters.form_status;
3008
+ if (filters.tin_status) params.tin_status = filters.tin_status;
3009
+ if (filters.avalara_company_id) params.avalara_company_id = filters.avalara_company_id;
3010
+ if (filters.search) params.search = filters.search;
3011
+ if (filters.start_date) params.start_date = filters.start_date;
3012
+ if (filters.end_date) params.end_date = filters.end_date;
3013
+ if (filters.page) params.page = filters.page;
3014
+ if (filters.page_size) params.limit = filters.page_size;
3015
+ }
3016
+ return this.request(`/api/v1/tax/forms${this.buildQueryString(params)}`);
2935
3017
  }
2936
3018
  /**
2937
- * Get a detailed score breakdown for a customer.
3019
+ * Get a tax form by ID
3020
+ *
3021
+ * @param formId - Tax form UUID
3022
+ * @returns Tax form details
2938
3023
  */
2939
- async getScoreBreakdown(customerId, requestOptions) {
2940
- return this.requestWithRetry(
2941
- `/api/v1/scores/${encodeURIComponent(customerId)}/breakdown`,
2942
- { method: "GET" },
2943
- void 0,
2944
- void 0,
2945
- requestOptions
2946
- );
3024
+ async getTaxForm(formId) {
3025
+ return this.request(`/api/v1/tax/forms/${formId}`);
2947
3026
  }
2948
- };
2949
- var WorkflowClient = class extends BaseClient {
2950
3027
  /**
2951
- * Get the current workflow status for a customer.
3028
+ * Get lifecycle events for a tax form
3029
+ *
3030
+ * @param formId - Tax form UUID
3031
+ * @returns List of lifecycle events
2952
3032
  */
2953
- async getWorkflowStatus(customerId, requestOptions) {
2954
- return this.requestWithRetry(
2955
- `/api/v1/workflows/${encodeURIComponent(customerId)}/status`,
2956
- { method: "GET" },
2957
- void 0,
2958
- void 0,
2959
- requestOptions
3033
+ async getTaxFormLifecycleEvents(formId) {
3034
+ const res = await this.request(
3035
+ `/api/v1/tax/forms/${formId}/lifecycle`
2960
3036
  );
3037
+ return res.lifecycle_events;
2961
3038
  }
3039
+ // ============================================================================
3040
+ // Customer Tax Profile
3041
+ // ============================================================================
2962
3042
  /**
2963
- * List workflows with optional filters.
3043
+ * Get the full tax profile for a customer (all forms + lifecycle events)
3044
+ *
3045
+ * @param customerID - Customer ID
3046
+ * @returns Customer tax profile with all forms and events
3047
+ *
3048
+ * @example
3049
+ * ```typescript
3050
+ * const profile = await client.getCustomerTaxProfile('cust_123');
3051
+ * console.log(`Customer has ${profile.tax_forms.length} tax forms`);
3052
+ * ```
2964
3053
  */
2965
- async listWorkflows(filters, requestOptions) {
2966
- const queryString = this.buildQueryString(filters || {});
2967
- return this.requestWithRetry(
2968
- `/api/v1/workflows${queryString}`,
2969
- { method: "GET" },
2970
- void 0,
2971
- void 0,
2972
- requestOptions
2973
- );
3054
+ async getCustomerTaxProfile(customerID) {
3055
+ return this.request(`/api/v1/tax/profile/${customerID}`);
2974
3056
  }
3057
+ // ============================================================================
3058
+ // Tax Companies
3059
+ // ============================================================================
2975
3060
  /**
2976
- * Get a specific workflow by ID.
3061
+ * List Avalara tax companies for the tenant
3062
+ *
3063
+ * @param page - Page number (default: 1)
3064
+ * @param pageSize - Items per page (default: 20)
3065
+ * @returns Paginated list of tax companies
2977
3066
  */
2978
- async getWorkflow(workflowId, requestOptions) {
2979
- return this.requestWithRetry(
2980
- `/api/v1/workflows/${encodeURIComponent(workflowId)}`,
2981
- { method: "GET" },
2982
- void 0,
2983
- void 0,
2984
- requestOptions
3067
+ async listTaxCompanies(page, pageSize) {
3068
+ const params = {};
3069
+ if (page) params.page = page;
3070
+ if (pageSize) params.limit = pageSize;
3071
+ return this.request(
3072
+ `/api/v1/tax/companies${this.buildQueryString(params)}`
2985
3073
  );
2986
3074
  }
3075
+ /**
3076
+ * Get a tax company by ID
3077
+ *
3078
+ * @param companyId - Tax company UUID
3079
+ * @returns Tax company details
3080
+ */
3081
+ async getTaxCompany(companyId) {
3082
+ return this.request(`/api/v1/tax/companies/${companyId}`);
3083
+ }
3084
+ // ============================================================================
3085
+ // Utility Methods (inherited from BaseClient: healthCheck, updateConfig, getConfig, buildQueryString)
3086
+ // ============================================================================
3087
+ };
3088
+
3089
+ // src/transaction/client.ts
3090
+ var TransactionClient = class extends BaseClient {
3091
+ constructor(config) {
3092
+ super(config);
3093
+ }
3094
+ // ==========================================================================
3095
+ // Transaction creation
3096
+ // ==========================================================================
3097
+ /**
3098
+ * Submit a new transaction record to the monitoring service.
3099
+ *
3100
+ * The gateway endpoint is `POST /api/v1/tm/transactions` and returns 201
3101
+ * with no body on success. The SDK method resolves to `void` to reflect
3102
+ * that behaviour.
3103
+ *
3104
+ * @param request - Data required to create the transaction
3105
+ * @param requestOptions - Optional request options (e.g. AbortSignal)
3106
+ *
3107
+ * @example
3108
+ * ```ts
3109
+ * const client = new TransactionClient({
3110
+ * baseURL: process.env.API_GATEWAY_URL!,
3111
+ * tenantId: 'tenant-123',
3112
+ * apiKey: 'pk_test_...',
3113
+ * });
3114
+ *
3115
+ * await client.createTransaction({
3116
+ * tx_id: 'tx-1',
3117
+ * reference: 'ref-1',
3118
+ * tenant_id: 'tenant-123',
3119
+ * customer_id: 'cust-1',
3120
+ * transaction_type: 'deposit',
3121
+ * transaction_mode: 'ach',
3122
+ * amount: '100.00',
3123
+ * currency: 'USD',
3124
+ * status: 'pending',
3125
+ * source_account: 'acct-1',
3126
+ * destination_account: 'acct-2',
3127
+ * country: 'US',
3128
+ * ip_address: '10.0.0.1',
3129
+ * metadata: {},
3130
+ * benificiary_comment: '',
3131
+ * transaction_date: new Date().toISOString(),
3132
+ * });
3133
+ * ```
3134
+ */
3135
+ async createTransaction(request, requestOptions) {
3136
+ const data = await this.requestWithRetry("/api/v1/tm/transactions", {
3137
+ method: "POST",
3138
+ body: JSON.stringify(request)
3139
+ }, void 0, void 0, requestOptions);
3140
+ return data;
3141
+ }
3142
+ /**
3143
+ *
3144
+ * @param transactionId tx_id of the transaction
3145
+ * @param requestOptions optional request options (e.g. AbortSignal)
3146
+ */
3147
+ async getTransaction(transactionId, requestOptions) {
3148
+ await this.requestWithRetry(`/api/v1/tm/transactions/status/${transactionId}`, {
3149
+ method: "GET"
3150
+ }, void 0, void 0, requestOptions);
3151
+ }
2987
3152
  };
2988
3153
 
2989
3154
  // src/webhooks/handler.ts
@@ -3138,7 +3303,6 @@ exports.ComplianceBlockedError = ComplianceBlockedError;
3138
3303
  exports.ComplianceClient = ComplianceClient;
3139
3304
  exports.ComplianceError = ComplianceError;
3140
3305
  exports.DEFAULT_CURRENCY_RATES = DEFAULT_CURRENCY_RATES;
3141
- exports.DecisionsClient = DecisionsClient;
3142
3306
  exports.GeolocationClient = GeolocationClient;
3143
3307
  exports.KycClient = KycClient;
3144
3308
  exports.NetworkError = NetworkError;
@@ -3146,13 +3310,13 @@ exports.RateLimitError = RateLimitError;
3146
3310
  exports.RateLimitTracker = RateLimitTracker;
3147
3311
  exports.RiskProfileClient = RiskProfileClient;
3148
3312
  exports.SDK_VERSION = SDK_VERSION;
3149
- exports.ScoresClient = ScoresClient;
3150
3313
  exports.ServiceUnavailableError = ServiceUnavailableError;
3314
+ exports.TaxClient = TaxClient;
3151
3315
  exports.TimeoutError = TimeoutError;
3316
+ exports.TransactionClient = TransactionClient;
3152
3317
  exports.ValidationError = ValidationError;
3153
3318
  exports.VesantError = VesantError;
3154
3319
  exports.WebhookHandler = WebhookHandler;
3155
- exports.WorkflowClient = WorkflowClient;
3156
3320
  exports.createConsoleLogger = createConsoleLogger;
3157
3321
  exports.createNextWebhookHandler = createNextWebhookHandler;
3158
3322
  exports.createWebhookMiddleware = createWebhookMiddleware;