@transmitsecurity/platform-web-sdk 1.18.2 → 2.0.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
@@ -13,36 +13,27 @@ type EventResponse = {
13
13
  type Recommendation = {
14
14
  type: RecommendationType;
15
15
  };
16
+ type LightweightPayload = {
17
+ clientId: string;
18
+ deviceId: string;
19
+ userId: string | null;
20
+ sdkPlatform: 'mobile_web' | 'desktop_web';
21
+ events: Array<Record<string, unknown>>;
22
+ };
16
23
 
17
24
  interface ActionResponse {
18
- /** The token return by the SDK when the action was reported */
19
25
  actionToken?: string;
20
26
  }
21
27
  interface InitOptions {
22
- /** Opaque identifier of the user in your system */
23
28
  userId?: string;
24
29
  }
25
- /**
26
- * Initial parameters for SDK
27
- */
28
30
  interface ConstructorOptions {
29
- /** Print logs to console */
30
31
  verbose?: boolean;
31
- /** Your server URL
32
- *
33
- * Default value is https://collect.riskid.security */
34
- serverPath?: string;
35
- /** Enable session token fetching
36
- *
37
- * Default value is false */
32
+ serverPath: string;
38
33
  enableSessionToken?: boolean;
39
- /** First party server url for the identifiers migration
40
- *
41
- * Default value is undefined */
42
34
  firstPartyMigrationUrl?: string;
43
- /** @internal
44
- * Internal flag indicating this web_sdk instance has its own clientId separate from the Platform SDK root-level clientId */
45
35
  hasOwnClientId?: boolean;
36
+ tier?: 'standard' | 'lightweight';
46
37
  }
47
38
  interface TransactionData {
48
39
  amount: number;
@@ -63,27 +54,12 @@ interface TransactionData {
63
54
  };
64
55
  }
65
56
  interface ActionEventOptions {
66
- /** Any ID that could help relate the action with external context or session */
67
57
  correlationId?: string;
68
- /** User ID of the not yet authenticated user, used to enhance risk and
69
- * trust assessments. Once the user is authenticated,
70
- * {@link TSAccountProtection.setAuthenticatedUser} should be called. */
71
58
  claimedUserId?: string;
72
- /**
73
- * The reported claimedUserId type (if provided), should not contain PII unless it is hashed.
74
- * Supported values: email, phone_number, account_id, ssn, national_id, passport_number, drivers_license_number, other.
75
- */
76
59
  claimedUserIdType?: string;
77
- /**
78
- * A transaction data-points object for transaction-monitoring
79
- */
80
60
  transactionData?: TransactionData;
81
- /**
82
- * Custom attributes matching the schema previously defined in the Admin Portal
83
- */
84
61
  customAttributes?: Record<string, string | number | boolean>;
85
62
  /**
86
- * The fields below are supported for Enterprise-IAM sdk usage actions, added `ignore` for avoiding preseting this attribute in the docs
87
63
  * @ignore
88
64
  */
89
65
  publicKey?: string;
@@ -120,6 +96,7 @@ declare class TSAccountProtection {
120
96
  private identifiersMigrationEnabled;
121
97
  private firstPartyMigrationUrl;
122
98
  private hasOwnClientId;
99
+ private tier;
123
100
  private validationManager;
124
101
  private storageManager;
125
102
  private eventsManager;
@@ -132,62 +109,34 @@ declare class TSAccountProtection {
132
109
  private logsReporter;
133
110
  private options;
134
111
  private clientId;
135
- /**
136
- *
137
- Creates a new Account Protection SDK instance with your client context
138
- @param clientId Your AccountProtection client identifier
139
- @param options SDK configuration options
140
- */
141
- constructor(clientId: string, options?: ConstructorOptions);
112
+ constructor(clientId: string, options: ConstructorOptions);
142
113
  /** @ignore */
143
114
  constructor(serverPath: string, clientId: string);
144
115
  private generateDisabledToken;
145
116
  /**
146
117
  * @ignore
147
- * @returns List of loaded actions that can be invoked
148
118
  */
149
119
  get actions(): string[];
150
120
  /** @ignore */
151
121
  getActions(): Promise<string[]>;
152
122
  getSessionToken(): Promise<any>;
153
- /**
154
- * Initializes the AccountProtection SDK, which starts automatically tracking and submitting info of the user journey
155
- * @param options Init options
156
- * @returns Indicates if the call succeeded
157
- */
123
+ getPayload(): Promise<LightweightPayload>;
124
+ clearQueue(): void;
158
125
  init(options?: InitOptions | string): Promise<boolean>;
159
126
  private isInitialized;
160
- /**
161
- * Reports a user action event to the SDK
162
- * @param actionType Type of user action event that was predefined in the Transmit Security server
163
- * @returns Indicates if the call succeeded
164
- */
165
127
  triggerActionEvent(actionType: string, options?: ActionEventOptions): Promise<ActionResponse>;
166
128
  /**
167
129
  * @ignore
168
130
  */
169
131
  identifyUser(userId: string): Promise<boolean>;
170
132
  private updateUserId;
133
+ setAuthenticatedUser(userId: string, options?: {}): Promise<boolean>;
134
+ clearUser(options?: {}): Promise<boolean>;
171
135
  /**
172
136
  * @ignore
173
137
  */
174
138
  unidentifiedUser(): Promise<boolean>;
175
- /**
176
- * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared)
177
- * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
178
- * @param userId Opaque identifier of the user in your system
179
- * @param options Reserved for future use
180
- * @returns Indicates if the call succeeded
181
- */
182
- setAuthenticatedUser(userId: string, options?: {}): Promise<boolean>;
183
- /** @ignore */
184
- setUser(userId: string, _options?: {}): Promise<boolean>;
185
- /**
186
- * Clears the user context for all subsequent events in the browser session
187
- * @param options Reserved for future use
188
- * @returns Indicates if the call succeeded
189
- */
190
- clearUser(options?: {}): Promise<boolean>;
139
+ getSecureSessionToken(actionType?: string | null, expirationSeconds?: number): Promise<string>;
191
140
  }
192
141
 
193
142
  declare module '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata' {
@@ -205,8 +154,6 @@ declare module '@transmit-security/web-sdk-common/dist/module-metadata/module-me
205
154
  * @returns Indicates if the call succeeded
206
155
  */
207
156
  declare const triggerActionEvent: TSAccountProtection['triggerActionEvent'];
208
- /** @ignore */
209
- declare const setUser: TSAccountProtection['setUser'];
210
157
  /**
211
158
  * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared)
212
159
  * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
@@ -222,13 +169,18 @@ declare const setAuthenticatedUser: TSAccountProtection['setAuthenticatedUser'];
222
169
  */
223
170
  declare const clearUser: TSAccountProtection['clearUser'];
224
171
  /** @ignore */
225
- declare const identifyUser: TSAccountProtection['identifyUser'];
226
- /** @ignore */
227
- declare const unidentifiedUser: TSAccountProtection['unidentifiedUser'];
228
- /** @ignore */
229
172
  declare const getActions: TSAccountProtection['getActions'];
230
173
  /** @ignore */
231
174
  declare const getSessionToken: TSAccountProtection['getSessionToken'];
175
+ /**
176
+ * Gets a secure session token that is signed with the device's private key
177
+ * @param actionType Optional action type to include in the token payload (default: null)
178
+ * @param expirationSeconds Optional expiration time in seconds (default: 300 seconds / 5 minutes)
179
+ * @returns A JWT-like token containing the backend session token and device information, signed with the device's private key
180
+ */
181
+ declare const getSecureSessionToken: TSAccountProtection['getSecureSessionToken'];
182
+ /** @ignore */
183
+ declare const getPayload: TSAccountProtection['getPayload'];
232
184
  /** @ignore */
233
185
  declare const __internal: {
234
186
  getDeviceId(): string;
@@ -239,4 +191,4 @@ declare const __internal: {
239
191
  declare const PACKAGE_VERSION: string;
240
192
  declare function initialize(config: any): void;
241
193
 
242
- export { ActionEventOptions, ActionResponse, PACKAGE_VERSION, __internal, clearUser, getActions, getSessionToken, identifyUser, initialize, setAuthenticatedUser, setUser, triggerActionEvent, unidentifiedUser };
194
+ export { ActionEventOptions, ActionResponse, LightweightPayload, PACKAGE_VERSION, __internal, clearUser, getActions, getPayload, getSecureSessionToken, getSessionToken, initialize, setAuthenticatedUser, triggerActionEvent };