@vesant-sdk/fraud 0.1.3 → 0.2.0-dev.284f68d

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
@@ -23,7 +23,7 @@ const fraud = new FraudClient({
23
23
 
24
24
  const result = await fraud.scoreEvent({
25
25
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
26
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
26
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
27
27
  event_type: '$transaction',
28
28
  transaction_id: '674a1b2c3d4e5f6789012345',
29
29
  transaction_type: TransactionType.Deposit,
@@ -55,19 +55,19 @@ Types such as `$verification` appear in the Vesant dashboard but are **not** acc
55
55
  | Field | Wire | Notes |
56
56
  |-------|------|-------|
57
57
  | `customer_id` | top-level | Required |
58
- | `sift_user_id` | top-level | Required, stable and case-sensitive |
58
+ | `user_reference` | top-level | Required, stable and case-sensitive |
59
59
  | `session_id` | `metadata.$session_id` | Strongly recommended on every event |
60
60
  | `user_email` | `metadata.$user_email` | Account/login/transaction flows |
61
61
  | `name` | `metadata.$name` | Account create/update baseline |
62
62
  | `phone` | `metadata.$phone` | Account create/update baseline |
63
63
  | `payment_methods` | `metadata.$payment_methods` | Account baseline (array); SDK normalizes tenant-friendly shapes before wire |
64
- | `sift_payment_method` | `metadata.$payment_method` | Sift payment object on transactions |
64
+ | `payment_method_details` | `metadata.$payment_method` | Structured payment object on transactions |
65
65
  | `billing_address` | `metadata.$billing_address` | Nested keys prefixed with `$` on the wire |
66
66
  | `app` | `metadata.$app` | Mobile clients |
67
67
  | `ip_address`, `device_id`, `user_agent` | top-level | Optional |
68
- | `metadata` | `metadata` | Plain Vesant rule signals and optional `$…` Sift pass-through |
68
+ | `metadata` | `metadata` | Plain Vesant rule signals and optional `$…` reserved-key pass-through |
69
69
 
70
- Prefer typed fields for common Sift keys. Typed fields win if the same key appears in `metadata`.
70
+ Prefer typed fields for common reserved keys. Typed fields win if the same key appears in `metadata`.
71
71
 
72
72
  ### Rule signals (SDK-supplied)
73
73
 
@@ -79,7 +79,7 @@ Prefer typed fields for common Sift keys. Typed fields win if the same key appea
79
79
 
80
80
  Do **not** send `new_device_added`, `email_changed`, `customer_age_years`, or `kyc_status` — Vesant derives or ignores these server-side.
81
81
 
82
- ### Event-specific Sift fields
82
+ ### Event-specific reserved fields
83
83
 
84
84
  Typed on the request and normalized into `metadata.$*` on the wire:
85
85
 
@@ -99,7 +99,7 @@ Inspect the wire body with `buildScoreRequestPreview(request)`.
99
99
  ```typescript
100
100
  await fraud.scoreEvent({
101
101
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
102
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
102
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
103
103
  event_type: '$create_account',
104
104
  ip_address: '198.51.100.101',
105
105
  user_agent:
@@ -131,7 +131,7 @@ await fraud.scoreEvent({
131
131
  ```typescript
132
132
  await fraud.scoreEvent({
133
133
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
134
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
134
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
135
135
  event_type: '$login',
136
136
  ip_address: '192.168.1.10',
137
137
  device_id: 'device_abcd1234',
@@ -153,7 +153,7 @@ Bank account linked (e.g. ACH / open banking):
153
153
  ```typescript
154
154
  await fraud.scoreEvent({
155
155
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
156
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
156
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
157
157
  event_type: '$update_account',
158
158
  session_id: 'sess_update_001',
159
159
  user_email: 'user@example.com',
@@ -178,7 +178,7 @@ Crypto wallet updated:
178
178
  ```typescript
179
179
  await fraud.scoreEvent({
180
180
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
181
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
181
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
182
182
  event_type: '$update_account',
183
183
  payment_methods: [
184
184
  {
@@ -197,13 +197,13 @@ await fraud.scoreEvent({
197
197
 
198
198
  ### Payment method normalization
199
199
 
200
- The SDK normalizes `payment_methods` and `sift_payment_method` before wire emit (on by default). Tenants can send internal shapes; invalid Sift keys are mapped or moved to plain metadata.
200
+ The SDK normalizes `payment_methods` and `payment_method_details` before wire emit (on by default). Tenants can send internal shapes; invalid keys are mapped or moved to plain metadata.
201
201
 
202
- | Mistake | Sift error | SDK fix |
202
+ | Mistake | Wire error | SDK fix |
203
203
  |---------|------------|---------|
204
204
  | `payment_type: '$bank_account'` | Invalid `$payment_type` | Auto-mapped to `$electronic_fund_transfer` |
205
205
  | `account_number_last4` | Unknown field | Auto-mapped to `account_number_last5` |
206
- | `account_id` on payment_method | Unknown field | Moved to `metadata.linkmoney_account_id` |
206
+ | `account_id` on payment_method | Unknown field | Moved to `metadata.payment_method_account_id` |
207
207
  | `wallet_address_last4` on payment_method | Unknown field | Moved to metadata |
208
208
 
209
209
  Inspect wire output before production:
@@ -219,9 +219,9 @@ Pre-normalize yourself? Set `skip_payment_method_normalization: true` on the req
219
219
 
220
220
  ```typescript
221
221
  import {
222
- normalizeSiftPaymentMethods,
223
- normalizeSiftPaymentType,
224
- toSiftAccountNumberLast5,
222
+ normalizePaymentMethods,
223
+ normalizePaymentType,
224
+ toAccountNumberLast5,
225
225
  } from '@vesant-sdk/fraud';
226
226
  ```
227
227
 
@@ -230,7 +230,7 @@ import {
230
230
  ```typescript
231
231
  await fraud.scoreEvent({
232
232
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
233
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
233
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
234
234
  event_type: '$transaction',
235
235
  transaction_id: '674a1b2c3d4e5f6789012345',
236
236
  transaction_type: TransactionType.Deposit,
@@ -256,7 +256,7 @@ await fraud.scoreEvent({
256
256
  ```typescript
257
257
  await fraud.scoreEvent({
258
258
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
259
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
259
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
260
260
  event_type: '$create_order',
261
261
  amount: 1230000,
262
262
  currency_code: 'USD',
@@ -298,7 +298,7 @@ import { WagerStatus } from '@vesant-sdk/fraud';
298
298
 
299
299
  await fraud.scoreEvent({
300
300
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
301
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
301
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
302
302
  event_type: '$wager',
303
303
  transaction_id: '674a1b2c3d4e5f6789012346',
304
304
  wager_type: 'spread',
@@ -321,7 +321,7 @@ import { ChargebackReason, ChargebackState } from '@vesant-sdk/fraud';
321
321
 
322
322
  await fraud.scoreEvent({
323
323
  customer_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
324
- sift_user_id: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
324
+ user_reference: '0b54b190-1dc7-232d-b80e-0d2eb573ff47',
325
325
  event_type: '$chargeback',
326
326
  transaction_id: '674a1b2c3d4e5f6789012345',
327
327
  order_id: 'LM-ORD-20240519-88421',
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import { RiskLevel, Timestamp, BaseClient, RequestOptions } from '@vesant-sdk/co
3
3
  /**
4
4
  * Fraud event type unions aligned with fraud-service support matrix.
5
5
  */
6
- /** Events that run Sift scoring + rule engine */
6
+ /** Events that run engine scoring + rule evaluation */
7
7
  type ScoredFraudEventType = '$create_account' | '$create_order' | '$login' | '$logout' | '$update_account' | '$update_password' | '$transaction' | '$wager';
8
8
  /** Feedback-only; no meaningful fraud score in response */
9
9
  type ChargebackFraudEventType = '$chargeback';
@@ -25,11 +25,11 @@ type FraudEventType = SupportedFraudEventType | (typeof PLANNED_FRAUD_EVENT_TYPE
25
25
  declare function isPlannedFraudEventType(eventType: string): eventType is (typeof PLANNED_FRAUD_EVENT_TYPES)[number];
26
26
  declare function isSupportedFraudEventType(eventType: string): eventType is SupportedFraudEventType;
27
27
 
28
+ declare const TransactionTypeValues: readonly ["$sale", "$authorize", "$capture", "$void", "$refund", "$deposit", "$withdrawal", "$transfer", "$buy", "$sell", "$send", "$receive"];
28
29
  /**
29
- * Sift-aligned enum types and const objects for fraud scoring requests.
30
+ * Enum types and const objects for fraud scoring requests.
30
31
  */
31
- type SiftTransactionType = '$sale' | '$authorize' | '$capture' | '$void' | '$refund' | '$deposit' | '$withdrawal' | '$transfer' | '$buy' | '$sell' | '$send' | '$receive';
32
- declare const SiftTransactionTypeValues: readonly ["$sale", "$authorize", "$capture", "$void", "$refund", "$deposit", "$withdrawal", "$transfer", "$buy", "$sell", "$send", "$receive"];
32
+ type TransactionType = '$sale' | '$authorize' | '$capture' | '$void' | '$refund' | '$deposit' | '$withdrawal' | '$transfer' | '$buy' | '$sell' | '$send' | '$receive';
33
33
  declare const TransactionType: {
34
34
  readonly Sale: "$sale";
35
35
  readonly Authorize: "$authorize";
@@ -44,8 +44,8 @@ declare const TransactionType: {
44
44
  readonly Send: "$send";
45
45
  readonly Receive: "$receive";
46
46
  };
47
- type SiftChargebackState = '$received' | '$accepted' | '$disputed' | '$won' | '$lost';
48
- declare const SiftChargebackStateValues: readonly ["$received", "$accepted", "$disputed", "$won", "$lost"];
47
+ declare const ChargebackStateValues: readonly ["$received", "$accepted", "$disputed", "$won", "$lost"];
48
+ type ChargebackState = '$received' | '$accepted' | '$disputed' | '$won' | '$lost';
49
49
  declare const ChargebackState: {
50
50
  readonly Received: "$received";
51
51
  readonly Accepted: "$accepted";
@@ -53,8 +53,8 @@ declare const ChargebackState: {
53
53
  readonly Won: "$won";
54
54
  readonly Lost: "$lost";
55
55
  };
56
- type SiftChargebackReason = '$fraud' | '$duplicate' | '$product_not_received' | '$product_unacceptable' | '$authorization' | '$consumer_disputes' | '$processing_errors' | '$cancel_subscription' | '$friendly_fraud' | '$ach_return' | '$ach_reversal' | '$other';
57
- declare const SiftChargebackReasonValues: readonly ["$fraud", "$duplicate", "$product_not_received", "$product_unacceptable", "$authorization", "$consumer_disputes", "$processing_errors", "$cancel_subscription", "$friendly_fraud", "$ach_return", "$ach_reversal", "$other"];
56
+ declare const ChargebackReasonValues: readonly ["$fraud", "$duplicate", "$product_not_received", "$product_unacceptable", "$authorization", "$consumer_disputes", "$processing_errors", "$cancel_subscription", "$friendly_fraud", "$ach_return", "$ach_reversal", "$other"];
57
+ type ChargebackReason = '$fraud' | '$duplicate' | '$product_not_received' | '$product_unacceptable' | '$authorization' | '$consumer_disputes' | '$processing_errors' | '$cancel_subscription' | '$friendly_fraud' | '$ach_return' | '$ach_reversal' | '$other';
58
58
  declare const ChargebackReason: {
59
59
  readonly Fraud: "$fraud";
60
60
  readonly Duplicate: "$duplicate";
@@ -69,43 +69,43 @@ declare const ChargebackReason: {
69
69
  readonly AchReversal: "$ach_reversal";
70
70
  readonly Other: "$other";
71
71
  };
72
- type SiftLoginStatus = '$success' | '$failure';
73
- declare const SiftLoginStatusValues: readonly ["$success", "$failure"];
72
+ declare const LoginStatusValues: readonly ["$success", "$failure"];
73
+ type LoginStatus = '$success' | '$failure';
74
74
  declare const LoginStatus: {
75
75
  readonly Success: "$success";
76
76
  readonly Failure: "$failure";
77
77
  };
78
- type SiftLoginFailureReason = '$account_unknown' | '$account_suspended' | '$account_disabled' | '$wrong_password';
79
- declare const SiftLoginFailureReasonValues: readonly ["$account_unknown", "$account_suspended", "$account_disabled", "$wrong_password"];
80
- type SiftPasswordUpdateReason = '$user_update' | '$forgot_password' | '$forced_reset';
81
- declare const SiftPasswordUpdateReasonValues: readonly ["$user_update", "$forgot_password", "$forced_reset"];
78
+ type LoginFailureReason = '$account_unknown' | '$account_suspended' | '$account_disabled' | '$wrong_password';
79
+ declare const LoginFailureReasonValues: readonly ["$account_unknown", "$account_suspended", "$account_disabled", "$wrong_password"];
80
+ declare const PasswordUpdateReasonValues: readonly ["$user_update", "$forgot_password", "$forced_reset"];
81
+ type PasswordUpdateReason = '$user_update' | '$forgot_password' | '$forced_reset';
82
82
  declare const PasswordUpdateReason: {
83
83
  readonly UserUpdate: "$user_update";
84
84
  readonly ForgotPassword: "$forgot_password";
85
85
  readonly ForcedReset: "$forced_reset";
86
86
  };
87
- type SiftPasswordUpdateStatus = '$pending' | '$success' | '$failure';
88
- declare const SiftPasswordUpdateStatusValues: readonly ["$pending", "$success", "$failure"];
87
+ declare const PasswordUpdateStatusValues: readonly ["$pending", "$success", "$failure"];
88
+ type PasswordUpdateStatus = '$pending' | '$success' | '$failure';
89
89
  declare const PasswordUpdateStatus: {
90
90
  readonly Pending: "$pending";
91
91
  readonly Success: "$success";
92
92
  readonly Failure: "$failure";
93
93
  };
94
- type SiftWagerStatus = '$accept' | '$cancel';
95
- declare const SiftWagerStatusValues: readonly ["$accept", "$cancel"];
94
+ declare const WagerStatusValues: readonly ["$accept", "$cancel"];
95
+ type WagerStatus = '$accept' | '$cancel';
96
96
  declare const WagerStatus: {
97
97
  readonly Accept: "$accept";
98
98
  readonly Cancel: "$cancel";
99
99
  };
100
- type SiftTransactionStatus = '$success' | '$failure' | '$pending';
101
- declare const SiftTransactionStatusValues: readonly ["$success", "$failure", "$pending"];
100
+ declare const TransactionStatusValues: readonly ["$success", "$failure", "$pending"];
101
+ type TransactionStatus = '$success' | '$failure' | '$pending';
102
102
  declare const TransactionStatus: {
103
103
  readonly Success: "$success";
104
104
  readonly Failure: "$failure";
105
105
  readonly Pending: "$pending";
106
106
  };
107
- type SiftPaymentType = '$cash' | '$check' | '$credit_card' | '$crypto_currency' | '$debit_card' | '$digital_wallet' | '$electronic_fund_transfer' | '$financing' | '$gift_card' | '$invoice' | '$in_app_purchase' | '$money_order' | '$points' | '$prepaid_card' | '$store_credit' | '$third_party_processor' | '$voucher' | '$sepa_credit' | '$sepa_instant_credit' | '$sepa_direct_debit' | '$ach_credit' | '$ach_debit' | '$wire_credit' | '$wire_debit';
108
- declare const SiftPaymentTypeValues: readonly ["$cash", "$check", "$credit_card", "$crypto_currency", "$debit_card", "$digital_wallet", "$electronic_fund_transfer", "$financing", "$gift_card", "$invoice", "$in_app_purchase", "$money_order", "$points", "$prepaid_card", "$store_credit", "$third_party_processor", "$voucher", "$sepa_credit", "$sepa_instant_credit", "$sepa_direct_debit", "$ach_credit", "$ach_debit", "$wire_credit", "$wire_debit"];
107
+ declare const PaymentTypeValues: readonly ["$cash", "$check", "$credit_card", "$crypto_currency", "$debit_card", "$digital_wallet", "$electronic_fund_transfer", "$financing", "$gift_card", "$invoice", "$in_app_purchase", "$money_order", "$points", "$prepaid_card", "$store_credit", "$third_party_processor", "$voucher", "$sepa_credit", "$sepa_instant_credit", "$sepa_direct_debit", "$ach_credit", "$ach_debit", "$wire_credit", "$wire_debit"];
108
+ type PaymentType = '$cash' | '$check' | '$credit_card' | '$crypto_currency' | '$debit_card' | '$digital_wallet' | '$electronic_fund_transfer' | '$financing' | '$gift_card' | '$invoice' | '$in_app_purchase' | '$money_order' | '$points' | '$prepaid_card' | '$store_credit' | '$third_party_processor' | '$voucher' | '$sepa_credit' | '$sepa_instant_credit' | '$sepa_direct_debit' | '$ach_credit' | '$ach_debit' | '$wire_credit' | '$wire_debit';
109
109
  declare const PaymentType: {
110
110
  readonly Cash: "$cash";
111
111
  readonly Check: "$check";
@@ -132,8 +132,8 @@ declare const PaymentType: {
132
132
  readonly WireCredit: "$wire_credit";
133
133
  readonly WireDebit: "$wire_debit";
134
134
  };
135
- type SiftWalletType = '$crypto' | '$digital' | '$fiat';
136
- declare const SiftWalletTypeValues: readonly ["$crypto", "$digital", "$fiat"];
135
+ declare const WalletTypeValues: readonly ["$crypto", "$digital", "$fiat"];
136
+ type WalletType = '$crypto' | '$digital' | '$fiat';
137
137
  declare const WalletType: {
138
138
  readonly Crypto: "$crypto";
139
139
  readonly Digital: "$digital";
@@ -143,10 +143,10 @@ type FraudRiskLevel = 'low' | 'medium' | 'high' | 'critical';
143
143
 
144
144
  /**
145
145
  * Metadata for fraud score requests.
146
- * Plain keys are Vesant rule signals; $-prefixed keys are Sift pass-through (or set via typed fields).
146
+ * Plain keys are Vesant rule signals; $-prefixed keys are reserved pass-through (or set via typed fields).
147
147
  */
148
148
  interface FraudRuleSignalMetadata {
149
- /** Rule signal payment method (e.g. "$credit_card"), not Sift $payment_method object */
149
+ /** Rule signal payment method (e.g. "$credit_card"), not the reserved $payment_method object */
150
150
  payment_method?: string;
151
151
  country?: string;
152
152
  /** Customer date of birth, ISO 8601 (YYYY-MM-DD). Useful on onboarding ($create_account). */
@@ -167,11 +167,11 @@ interface FraudRuleSignalMetadata {
167
167
  days_since_last_activity?: number;
168
168
  hours_since_account_creation?: number;
169
169
  }
170
- /** Extra Sift fields forwarded verbatim in metadata (e.g. $referrer_user_id, $promotions). */
171
- type SiftPassThroughMetadata = Record<`$${string}`, unknown>;
172
- type FraudCustomMetadata = FraudRuleSignalMetadata & SiftPassThroughMetadata & Record<string, unknown>;
170
+ /** Extra reserved fields forwarded verbatim in metadata (e.g. $referrer_user_id, $promotions). */
171
+ type ReservedMetadata = Record<`$${string}`, unknown>;
172
+ type FraudCustomMetadata = FraudRuleSignalMetadata & ReservedMetadata & Record<string, unknown>;
173
173
  /** Maps typed request fields to metadata keys they populate (typed values win on normalize). */
174
- declare const TYPED_SIFT_METADATA_KEYS: Readonly<Record<string, string>>;
174
+ declare const TYPED_METADATA_KEYS: Readonly<Record<string, string>>;
175
175
  declare function findMetadataConflictWithTypedFields(metadata: FraudCustomMetadata, request: Record<string, unknown>): string | undefined;
176
176
 
177
177
  /**
@@ -204,9 +204,9 @@ declare const UPDATE_ACCOUNT_RULE_SIGNAL_KEYS: readonly ["two_fa_enabled", "two_
204
204
  declare const TRANSACTION_RULE_SIGNAL_KEYS: readonly ["payment_method", "is_first_deposit", "cumulative_deposit_amount", "deposit_count", "failed_deposit_count", "is_first_withdrawal", "withdrawal_method_differs", "cumulative_withdrawal_amount", "withdrawal_count", "hours_since_last_deposit", "days_since_last_activity", "hours_since_account_creation"];
205
205
 
206
206
  /**
207
- * Sift-aligned structured fields normalized into metadata.$* on the wire.
207
+ * Reserved structured fields normalized into metadata.$* on the wire.
208
208
  */
209
- interface SiftBillingAddress {
209
+ interface BillingAddress {
210
210
  name?: string;
211
211
  phone?: string;
212
212
  address_1?: string;
@@ -217,7 +217,7 @@ interface SiftBillingAddress {
217
217
  zipcode?: string;
218
218
  [key: string]: unknown;
219
219
  }
220
- interface SiftPaymentMethod {
220
+ interface PaymentMethod {
221
221
  payment_type?: string;
222
222
  payment_gateway?: string;
223
223
  card_bin?: string;
@@ -235,28 +235,28 @@ interface SiftPaymentMethod {
235
235
  paypal_payer_id?: string;
236
236
  paypal_payer_email?: string;
237
237
  /**
238
- * @deprecated Not a Sift field — use account_number_last5. Stripped by normalizeSiftPaymentMethod.
238
+ * @deprecated Not a recognized field — use account_number_last5. Stripped by normalizePaymentMethod.
239
239
  */
240
240
  account_number_last4?: string;
241
241
  /**
242
- * @deprecated Not a Sift field — moved to metadata by normalizeSiftPaymentMethod.
242
+ * @deprecated Not a recognized field — moved to metadata by normalizePaymentMethod.
243
243
  */
244
244
  account_id?: string | number;
245
245
  /**
246
- * @deprecated Not a Sift field — moved to metadata by normalizeSiftPaymentMethod.
246
+ * @deprecated Not a recognized field — moved to metadata by normalizePaymentMethod.
247
247
  */
248
248
  wallet_address_last4?: string;
249
249
  /**
250
- * @deprecated Not a Sift field — moved to metadata by normalizeSiftPaymentMethod.
250
+ * @deprecated Not a recognized field — moved to metadata by normalizePaymentMethod.
251
251
  */
252
252
  crypto_currency?: string;
253
253
  /**
254
- * @deprecated Not a Sift field — moved to metadata by normalizeSiftPaymentMethod.
254
+ * @deprecated Not a recognized field — moved to metadata by normalizePaymentMethod.
255
255
  */
256
256
  network?: string;
257
257
  [key: string]: unknown;
258
258
  }
259
- interface SiftApp {
259
+ interface AppInfo {
260
260
  os?: string;
261
261
  os_version?: string;
262
262
  device_manufacturer?: string;
@@ -267,7 +267,7 @@ interface SiftApp {
267
267
  client_language?: string;
268
268
  [key: string]: unknown;
269
269
  }
270
- interface SiftBrowser {
270
+ interface BrowserInfo {
271
271
  user_agent?: string;
272
272
  accept_language?: string;
273
273
  content_language?: string;
@@ -281,8 +281,8 @@ interface SiftBrowser {
281
281
  interface FraudScoreRequestBase {
282
282
  /** Tenant customer UUID or stable ID */
283
283
  customer_id: string;
284
- /** Sift $user_id — typically stable per customer */
285
- sift_user_id: string;
284
+ /** Scoring-engine user reference — typically stable per customer */
285
+ user_reference: string;
286
286
  ip_address?: string;
287
287
  device_id?: string;
288
288
  user_agent?: string;
@@ -294,22 +294,22 @@ interface FraudScoreRequestBase {
294
294
  name?: string;
295
295
  /** Maps to metadata.$phone */
296
296
  phone?: string;
297
- /** Maps to metadata.$payment_method (Sift object) — typically on transactions */
298
- sift_payment_method?: SiftPaymentMethod;
299
- /** Maps to metadata.$payment_methods (Sift array) — account create/update baseline */
300
- payment_methods?: SiftPaymentMethod[];
297
+ /** Maps to metadata.$payment_method (reserved object) — typically on transactions */
298
+ payment_method_details?: PaymentMethod;
299
+ /** Maps to metadata.$payment_methods (reserved array) — account create/update baseline */
300
+ payment_methods?: PaymentMethod[];
301
301
  /** Maps to metadata.$billing_address */
302
- billing_address?: SiftBillingAddress;
302
+ billing_address?: BillingAddress;
303
303
  /** Maps to metadata.$app */
304
- app?: SiftApp;
304
+ app?: AppInfo;
305
305
  /**
306
- * Plain Vesant rule signals and optional $-prefixed Sift pass-through keys.
307
- * Prefer typed fields for common Sift keys ($session_id, $user_email, etc.).
306
+ * Plain Vesant rule signals and optional $-prefixed reserved pass-through keys.
307
+ * Prefer typed fields for common reserved keys ($session_id, $user_email, etc.).
308
308
  */
309
309
  metadata?: FraudCustomMetadata;
310
310
  /**
311
- * When true, payment_methods / sift_payment_method are passed through without
312
- * Sift field normalization (for tenants sending pre-normalized wire keys).
311
+ * When true, payment_methods / payment_method_details are passed through without
312
+ * field normalization (for tenants sending pre-normalized wire keys).
313
313
  */
314
314
  skip_payment_method_normalization?: boolean;
315
315
  }
@@ -318,8 +318,8 @@ interface CreateAccountScoreRequest extends FraudScoreRequestBase {
318
318
  }
319
319
  interface LoginScoreRequest extends FraudScoreRequestBase, LoginRuleSignals {
320
320
  event_type: '$login';
321
- login_status?: SiftLoginStatus;
322
- login_failure_reason?: SiftLoginFailureReason;
321
+ login_status?: LoginStatus;
322
+ login_failure_reason?: LoginFailureReason;
323
323
  }
324
324
  interface LogoutScoreRequest extends FraudScoreRequestBase {
325
325
  event_type: '$logout';
@@ -332,17 +332,17 @@ interface UpdateAccountScoreRequest extends FraudScoreRequestBase, UpdateAccount
332
332
  interface UpdatePasswordScoreRequest extends FraudScoreRequestBase {
333
333
  event_type: '$update_password';
334
334
  /** Defaults to $user_update on the wire when omitted */
335
- password_reason?: SiftPasswordUpdateReason;
335
+ password_reason?: PasswordUpdateReason;
336
336
  /** Defaults to $success on the wire when omitted */
337
- password_status?: SiftPasswordUpdateStatus;
337
+ password_status?: PasswordUpdateStatus;
338
338
  }
339
339
  interface TransactionScoreRequest extends FraudScoreRequestBase, TransactionRuleSignals {
340
340
  event_type: '$transaction';
341
341
  amount: number;
342
342
  currency: string;
343
343
  transaction_id?: string;
344
- transaction_type?: SiftTransactionType;
345
- transaction_status?: SiftTransactionStatus;
344
+ transaction_type?: TransactionType;
345
+ transaction_status?: TransactionStatus;
346
346
  decline_category?: string;
347
347
  transfer_recipient_user_id?: string;
348
348
  }
@@ -355,9 +355,9 @@ interface CreateOrderScoreRequest extends FraudScoreRequestBase {
355
355
  amount: number;
356
356
  currency_code: string;
357
357
  exchange_rate?: unknown;
358
- payment_methods?: SiftPaymentMethod[];
359
- billing_address?: SiftBillingAddress;
360
- shipping_address?: SiftBillingAddress;
358
+ payment_methods?: PaymentMethod[];
359
+ billing_address?: BillingAddress;
360
+ shipping_address?: BillingAddress;
361
361
  expedited_shipping?: boolean;
362
362
  shipping_method?: '$electronic' | '$physical' | (string & Record<string, never>);
363
363
  shipping_carrier?: string;
@@ -366,14 +366,14 @@ interface CreateOrderScoreRequest extends FraudScoreRequestBase {
366
366
  site_country?: string;
367
367
  site_domain?: string;
368
368
  ip?: string;
369
- browser?: SiftBrowser;
370
- app?: SiftApp;
369
+ browser?: BrowserInfo;
370
+ app?: AppInfo;
371
371
  }
372
372
  interface WagerScoreRequest extends FraudScoreRequestBase {
373
373
  event_type: '$wager';
374
374
  transaction_id: string;
375
375
  wager_type: string;
376
- wager_status: SiftWagerStatus;
376
+ wager_status: WagerStatus;
377
377
  amount: number;
378
378
  currency: string;
379
379
  wager_event_type?: string;
@@ -384,8 +384,8 @@ interface ChargebackScoreRequest extends FraudScoreRequestBase {
384
384
  event_type: ChargebackFraudEventType;
385
385
  transaction_id?: string;
386
386
  order_id?: string;
387
- chargeback_state?: SiftChargebackState;
388
- chargeback_reason?: SiftChargebackReason;
387
+ chargeback_state?: ChargebackState;
388
+ chargeback_reason?: ChargebackReason;
389
389
  ach_return_code?: string;
390
390
  }
391
391
  type FraudScoreRequest = CreateAccountScoreRequest | LoginScoreRequest | LogoutScoreRequest | UpdateAccountScoreRequest | UpdatePasswordScoreRequest | TransactionScoreRequest | CreateOrderScoreRequest | WagerScoreRequest | ChargebackScoreRequest;
@@ -471,7 +471,7 @@ interface FraudAlertCallbackEvent {
471
471
  reference: string;
472
472
  /** Tenant customer ID the decision applies to. */
473
473
  customer_id: string;
474
- /** Originating Sift event type (`$create_account`, `$transaction`, …). */
474
+ /** Originating fraud event type (`$create_account`, `$transaction`, …). */
475
475
  source_event_type: SupportedFraudEventType | (string & Record<string, never>);
476
476
  decision: FraudDecision;
477
477
  risk_level: RiskLevel;
@@ -511,28 +511,28 @@ declare function normalizeScoreRequestForApi(request: FraudScoreRequest): Record
511
511
  declare function buildScoreRequestPreview(request: FraudScoreRequest): Record<string, unknown>;
512
512
 
513
513
  /**
514
- * Maps tenant-internal payment type signals to Sift-valid $payment_type values.
514
+ * Maps tenant-internal payment type signals to valid $payment_type values.
515
515
  * Returns undefined when the value cannot be mapped.
516
516
  */
517
- declare function normalizeSiftPaymentType(value: string | undefined): SiftPaymentType | undefined;
517
+ declare function normalizePaymentType(value: string | undefined): PaymentType | undefined;
518
518
  /**
519
- * Normalizes last-4/last-5 account digits for Sift $account_number_last5.
519
+ * Normalizes last-4/last-5 account digits for $account_number_last5.
520
520
  */
521
- declare function toSiftAccountNumberLast5(value: unknown): string | undefined;
521
+ declare function toAccountNumberLast5(value: unknown): string | undefined;
522
522
  type NormalizePaymentMethodResult = {
523
- method: SiftPaymentMethod;
523
+ method: PaymentMethod;
524
524
  metadataExtras?: Record<string, unknown>;
525
525
  };
526
526
  /**
527
- * Normalizes a single payment method object for Sift wire format.
527
+ * Normalizes a single payment method object for the wire format.
528
528
  */
529
- declare function normalizeSiftPaymentMethod(raw: Record<string, unknown>): NormalizePaymentMethodResult | null;
529
+ declare function normalizePaymentMethod(raw: Record<string, unknown>): NormalizePaymentMethodResult | null;
530
530
  /**
531
531
  * Normalizes payment method arrays and aggregates stripped metadata.
532
532
  */
533
- declare function normalizeSiftPaymentMethods(methods: SiftPaymentMethod[] | undefined): {
534
- payment_methods?: SiftPaymentMethod[];
533
+ declare function normalizePaymentMethods(methods: PaymentMethod[] | undefined): {
534
+ payment_methods?: PaymentMethod[];
535
535
  metadata?: Record<string, unknown>;
536
536
  };
537
537
 
538
- export { CHARGEBACK_FRAUD_EVENT_TYPE, type ChargebackFraudEventType, ChargebackReason, type ChargebackScoreRequest, type ChargebackScoreResponseData, ChargebackState, type CreateAccountScoreRequest, type CreateOrderScoreRequest, type FraudAlertCallbackEvent, type FraudCallbackTrigger, FraudClient, type FraudCustomMetadata, type FraudDecision, type FraudEventType, type FraudReactionType, type FraudRiskLevel, type FraudRuleSignalMetadata, type FraudScoreRequest, type FraudScoreRequestBase, type FraudScoreResponseData, type FraudScoreResponseEnvelope, type FraudScoreResponseMetadata, LOGIN_RULE_SIGNAL_KEYS, type LoginRuleSignals, type LoginScoreRequest, LoginStatus, type LogoutScoreRequest, PLANNED_FRAUD_EVENT_TYPES, PasswordUpdateReason, PasswordUpdateStatus, PaymentType, type PlannedFraudEventType, SCORED_FRAUD_EVENT_TYPES, SUPPORTED_FRAUD_EVENT_TYPES, type ScoredFraudEventType, type ScoredFraudScoreRequest, type SiftApp, type SiftBillingAddress, type SiftBrowser, type SiftChargebackReason, SiftChargebackReasonValues, type SiftChargebackState, SiftChargebackStateValues, type SiftLoginFailureReason, SiftLoginFailureReasonValues, type SiftLoginStatus, SiftLoginStatusValues, type SiftPassThroughMetadata, type SiftPasswordUpdateReason, SiftPasswordUpdateReasonValues, type SiftPasswordUpdateStatus, SiftPasswordUpdateStatusValues, type SiftPaymentMethod, type SiftPaymentType, SiftPaymentTypeValues, type SiftTransactionStatus, SiftTransactionStatusValues, type SiftTransactionType, SiftTransactionTypeValues, type SiftWagerStatus, SiftWagerStatusValues, type SiftWalletType, SiftWalletTypeValues, type SupportedFraudEventType, TRANSACTION_RULE_SIGNAL_KEYS, TYPED_SIFT_METADATA_KEYS, type TenantAction, type TransactionRuleSignals, type TransactionScoreRequest, TransactionStatus, TransactionType, UPDATE_ACCOUNT_RULE_SIGNAL_KEYS, type UpdateAccountRuleSignals, type UpdateAccountScoreRequest, type UpdatePasswordScoreRequest, type WagerScoreRequest, WagerStatus, WalletType, buildScoreRequestPreview, findMetadataConflictWithTypedFields, isFraudAlertCallbackEvent, isPlannedFraudEventType, isSupportedFraudEventType, normalizeScoreRequestForApi, normalizeSiftPaymentMethod, normalizeSiftPaymentMethods, normalizeSiftPaymentType, toSiftAccountNumberLast5, validateScoreRequest };
538
+ export { type AppInfo, type BillingAddress, type BrowserInfo, CHARGEBACK_FRAUD_EVENT_TYPE, type ChargebackFraudEventType, ChargebackReason, ChargebackReasonValues, type ChargebackScoreRequest, type ChargebackScoreResponseData, ChargebackState, ChargebackStateValues, type CreateAccountScoreRequest, type CreateOrderScoreRequest, type FraudAlertCallbackEvent, type FraudCallbackTrigger, FraudClient, type FraudCustomMetadata, type FraudDecision, type FraudEventType, type FraudReactionType, type FraudRiskLevel, type FraudRuleSignalMetadata, type FraudScoreRequest, type FraudScoreRequestBase, type FraudScoreResponseData, type FraudScoreResponseEnvelope, type FraudScoreResponseMetadata, LOGIN_RULE_SIGNAL_KEYS, type LoginFailureReason, LoginFailureReasonValues, type LoginRuleSignals, type LoginScoreRequest, LoginStatus, LoginStatusValues, type LogoutScoreRequest, PLANNED_FRAUD_EVENT_TYPES, PasswordUpdateReason, PasswordUpdateReasonValues, PasswordUpdateStatus, PasswordUpdateStatusValues, type PaymentMethod, PaymentType, PaymentTypeValues, type PlannedFraudEventType, type ReservedMetadata, SCORED_FRAUD_EVENT_TYPES, SUPPORTED_FRAUD_EVENT_TYPES, type ScoredFraudEventType, type ScoredFraudScoreRequest, type SupportedFraudEventType, TRANSACTION_RULE_SIGNAL_KEYS, TYPED_METADATA_KEYS, type TenantAction, type TransactionRuleSignals, type TransactionScoreRequest, TransactionStatus, TransactionStatusValues, TransactionType, TransactionTypeValues, UPDATE_ACCOUNT_RULE_SIGNAL_KEYS, type UpdateAccountRuleSignals, type UpdateAccountScoreRequest, type UpdatePasswordScoreRequest, type WagerScoreRequest, WagerStatus, WagerStatusValues, WalletType, WalletTypeValues, buildScoreRequestPreview, findMetadataConflictWithTypedFields, isFraudAlertCallbackEvent, isPlannedFraudEventType, isSupportedFraudEventType, normalizePaymentMethod, normalizePaymentMethods, normalizePaymentType, normalizeScoreRequestForApi, toAccountNumberLast5, validateScoreRequest };