@transmitsecurity/platform-web-sdk 2.3.2-beta-26093939905.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/drs.d.ts CHANGED
@@ -24,6 +24,18 @@ type LightweightPayload = {
24
24
  type TransactionType = 'purchase' | 'bill_payment' | 'mobile_recharge' | 'money_transfer' | 'credit_transfer' | 'credit_redemption' | 'top_up' | 'withdrawal' | 'investment' | 'loan' | 'refund' | 'other';
25
25
  type TransactionMethod = 'bank_account' | 'wire' | 'card' | 'p2p' | 'wallet';
26
26
  type AvsMatchLevel = 'none' | 'postal' | 'street' | 'full' | 'unknown';
27
+ /** The outcome of an action reported via {@link TSAccountProtection.reportActionResult} */
28
+ type ActionResult = "success" | "failure" | "incomplete";
29
+ /** Type of challenge presented to the user, when a challenge was recommended for the action */
30
+ type ChallengeType = "sms_otp" | "email_otp" | "totp" | "push_otp" | "voice_otp" | "idv" | "captcha" | "password" | "passkey";
31
+ interface ActionResultOptions {
32
+ /** Identifier containing sensitive user data. Mosaic will encrypt and securely store this data. */
33
+ privateUserIdentifier?: string;
34
+ /** Type of challenge used when a challenge was recommended for this action. */
35
+ challengeType?: ChallengeType;
36
+ /** Opaque identifier of the user in your system. */
37
+ userId?: string;
38
+ }
27
39
  interface ActionResponse {
28
40
  /** The token return by the SDK when the action was reported */
29
41
  actionToken?: string;
@@ -216,11 +228,17 @@ declare class TSAccountProtection {
216
228
  /** @ignore */
217
229
  getActions(): Promise<string[]>;
218
230
  getSessionToken(): Promise<any>;
231
+ /**
232
+ * Returns the lightweight (citadel) device payload to be forwarded to citadel via the caller's backend.
233
+ * The response from citadel includes a `deviceId` that must be passed back via {@link setDeviceId}
234
+ * — the server may issue a new one or rotate it, and the SDK only persists it when told to.
235
+ */
219
236
  getPayload(): Promise<LightweightPayload>;
220
237
  clearQueue(): void;
221
238
  /**
222
239
  * Sets the deviceId for lightweight mode (citadel).
223
- * Should be called after receiving deviceId from backend on first request.
240
+ * Should be called after every response from citadel the server may rotate the deviceId
241
+ * (e.g. after schema validation), so always propagate the returned value back into the SDK.
224
242
  * @param deviceId - The JWT deviceId returned from citadel backend
225
243
  */
226
244
  setDeviceId(deviceId: string): void;
@@ -246,6 +264,16 @@ declare class TSAccountProtection {
246
264
  * @returns Indicates if the call succeeded
247
265
  */
248
266
  setAuthenticatedUser(userId: string, options?: {}): Promise<boolean>;
267
+ /**
268
+ * Reports the result of an action for which a recommendation was previously issued.
269
+ * This includes whether the user successfully completed the action and, when applicable,
270
+ * the type of challenge that was presented.
271
+ * @param actionToken The token returned when the action was triggered by {@link TSAccountProtection.triggerActionEvent}
272
+ * @param result The outcome of the action
273
+ * @param options Additional context associated with the action result
274
+ * @returns Indicates if the call succeeded
275
+ */
276
+ reportActionResult(actionToken: string, result: ActionResult, options?: ActionResultOptions): Promise<boolean>;
249
277
  /**
250
278
  * Clears the user context for all subsequent events in the browser session
251
279
  * @param options Reserved for future use
@@ -275,6 +303,16 @@ declare const triggerActionEvent: TSAccountProtection['triggerActionEvent'];
275
303
  * @returns Indicates if the call succeeded
276
304
  */
277
305
  declare const setAuthenticatedUser: TSAccountProtection['setAuthenticatedUser'];
306
+ /**
307
+ * Reports the result of an action for which a recommendation was previously issued.
308
+ * This includes whether the user successfully completed the action and, when applicable,
309
+ * the type of challenge that was presented.
310
+ * @param actionToken The token returned when the action was triggered by triggerActionEvent()
311
+ * @param result The outcome of the action ("success" | "failure" | "incomplete")
312
+ * @param options Additional context associated with the action result
313
+ * @returns Indicates if the call succeeded
314
+ */
315
+ declare const reportActionResult: TSAccountProtection['reportActionResult'];
278
316
  /**
279
317
  * Clears the user context for all subsequent events in the browser session
280
318
  * @param options Reserved for future use
@@ -310,4 +348,4 @@ declare const __internal: {
310
348
  declare const PACKAGE_VERSION: string;
311
349
  declare function initialize(config: any): void;
312
350
 
313
- export { ActionEventOptions, ActionResponse, LightweightPayload, PACKAGE_VERSION, __internal, clearUser, getActions, getPayload, getSecureSessionToken, getSessionToken, initialize, setAuthenticatedUser, setDeviceId, triggerActionEvent };
351
+ export { ActionEventOptions, ActionResponse, ActionResultOptions, LightweightPayload, PACKAGE_VERSION, __internal, clearUser, getActions, getPayload, getSecureSessionToken, getSessionToken, initialize, reportActionResult, setAuthenticatedUser, setDeviceId, triggerActionEvent };