@transmitsecurity/platform-web-sdk 2.2.0 → 2.3.1

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/ido.d.ts CHANGED
@@ -51,6 +51,10 @@ interface StartJourneyOptions {
51
51
  * Should client-server communication be double encrypted? Defaults to false.
52
52
  */
53
53
  encrypted?: boolean;
54
+ /**
55
+ * An optional admin debug token to be passed to the Journey.
56
+ */
57
+ adminDebugToken?: string;
54
58
  }
55
59
  /**
56
60
  * @interface
@@ -61,6 +65,10 @@ interface StartSsoJourneyOptions {
61
65
  * Should client-server communication be double encrypted? Defaults to false.
62
66
  */
63
67
  encrypted?: boolean;
68
+ /**
69
+ * An optional admin debug token to be passed to the Journey.
70
+ */
71
+ adminDebugToken?: string;
64
72
  }
65
73
  /**
66
74
  * @enum
@@ -217,7 +225,7 @@ declare enum IdoServiceResponseType {
217
225
  /**
218
226
  * @enum
219
227
  * @description The enum for the Journey step ID, used when the journey step is a predefined typed action.
220
- * The actions that do not use this are "Get Information from Client" and "Login Form" which allow the journey author to define a custom ID.
228
+ * The actions that do not use this are "Collect information" and "Login Form" which allow the journey author to define a custom ID.
221
229
  * See also {@link IdoServiceResponse.journeyStepId}.
222
230
  */
223
231
  declare enum IdoJourneyActionType {
@@ -244,7 +252,7 @@ declare enum IdoJourneyActionType {
244
252
  * }
245
253
  * }
246
254
  * ```
247
- * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
255
+ * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
248
256
  */
249
257
  Information = "action:information",
250
258
  /**
@@ -254,7 +262,7 @@ declare enum IdoJourneyActionType {
254
262
  *
255
263
  * The {@link IdoServiceResponse} object does not include any data.
256
264
  *
257
- * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
265
+ * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
258
266
  */
259
267
  DebugBreak = "action:debug_break",
260
268
  /**
@@ -263,7 +271,7 @@ declare enum IdoJourneyActionType {
263
271
  * The {@link IdoServiceResponse} object includes information that can be presented as a QR to scan by another device.
264
272
  * The response will remain the same while the cross session message was not consumed by the journey executed by the other device.
265
273
  *
266
- * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
274
+ * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
267
275
  */
268
276
  WaitForAnotherDevice = "action:wait_for_another_device",
269
277
  /**
@@ -291,7 +299,7 @@ declare enum IdoJourneyActionType {
291
299
  /**
292
300
  * @description `journeyStepId` for WebAuthn Registration action.
293
301
  *
294
- * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.webauthn.register()`
302
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `webauthn.register()`
295
303
  * ```json
296
304
  * {
297
305
  * "data": {
@@ -303,10 +311,10 @@ declare enum IdoJourneyActionType {
303
311
  * }
304
312
  * ```
305
313
  *
306
- * Before responding, activate `tsPlatform.webauthn.register()` to obtain the `webauthn_encoded_result` value.
314
+ * Before responding, activate `webauthn.register()` to obtain the `webauthn_encoded_result` value.
307
315
  * This will present the user with the WebAuthn registration UI. Use the result to send the client response:
308
316
  * ```json
309
- * tsPlatform.ido.submitClientResponse(
317
+ * ido.submitClientResponse(
310
318
  * ClientResponseOptionType.ClientInput,
311
319
  * {
312
320
  * "webauthn_encoded_result": "<WEBAUTHN_ENCODED_RESULT_FROM_SDK>"
@@ -315,9 +323,9 @@ declare enum IdoJourneyActionType {
315
323
  */
316
324
  WebAuthnRegistration = "action:webauthn_registration",
317
325
  /**
318
- * @description `journeyStepId` for instructing the use of DRS trigger action, as part of the Risk Recommendation journey step.
326
+ * @description `journeyStepId` for instructing the use of Fraud Prevention trigger action, as part of the Risk Recommendation journey step.
319
327
  *
320
- * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.drs.triggerActionEvent()`
328
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `drs.triggerActionEvent()`
321
329
  * ```json
322
330
  * {
323
331
  * "data": {
@@ -327,13 +335,13 @@ declare enum IdoJourneyActionType {
327
335
  * },
328
336
  * }
329
337
  * ```
330
- * Before responding, activate `tsPlatform.drs.triggerActionEvent()` to obtain the `action_token` value. This is a silent action, and does not require user interaction.
338
+ * Before responding, activate `drs.triggerActionEvent()` to obtain the `action_token` value. This is a silent action, and does not require user interaction.
331
339
  * Use the result to send the client response:
332
340
  * ```json
333
- * tsPlatform.ido.submitClientResponse(
341
+ * ido.submitClientResponse(
334
342
  * ClientResponseOptionType.ClientInput,
335
343
  * {
336
- * "action_token": "<DRS action token>"
344
+ * "action_token": "<Fraud Prevention action token>"
337
345
  * })
338
346
  * ```
339
347
  */
@@ -356,12 +364,12 @@ declare enum IdoJourneyActionType {
356
364
  * }
357
365
  * ```
358
366
  * Use this data to redirect the user to the identity verification endpoint.
359
- * Since this redirects to a different page, make sure you store the SDK state by calling `tsPlatform.ido.serializeState()`, and saving the response data in the session storage.
360
- * After the user completes the identity verification, you can restore the SDK state and continue the journey, by calling `tsPlatform.ido.restoreFromSerializedState()` with the stored state.
367
+ * Since this redirects to a different page, make sure you store the SDK state by calling `ido.serializeState()`, and saving the response data in the session storage.
368
+ * After the user completes the identity verification, you can restore the SDK state and continue the journey, by calling `ido.restoreFromSerializedState()` with the stored state.
361
369
  *
362
370
  * Once done, send the following client response:
363
371
  * ```json
364
- * tsPlatform.ido.submitClientResponse(
372
+ * ido.submitClientResponse(
365
373
  * ClientResponseOptionType.ClientInput,
366
374
  * {
367
375
  * "payload": {
@@ -394,7 +402,7 @@ declare enum IdoJourneyActionType {
394
402
  *
395
403
  * - For simple submit of OTP passcode:
396
404
  * ```json
397
- * tsPlatform.ido.submitClientResponse(
405
+ * ido.submitClientResponse(
398
406
  * ClientResponseOptionType.ClientInput,
399
407
  * {
400
408
  * "passcode": "<passcode>"
@@ -402,7 +410,7 @@ declare enum IdoJourneyActionType {
402
410
  * ```
403
411
  *
404
412
  * - In Order to request resend of OTP (restart the action):
405
- * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
413
+ * `ido.submitClientResponse(ClientResponseOptionType.Resend)`
406
414
  *
407
415
  */
408
416
  EmailOTPAuthentication = "transmit_platform_email_otp_authentication",
@@ -428,7 +436,7 @@ declare enum IdoJourneyActionType {
428
436
  *
429
437
  * - For simple submit of OTP passcode:
430
438
  * ```json
431
- * tsPlatform.ido.submitClientResponse(
439
+ * ido.submitClientResponse(
432
440
  * ClientResponseOptionType.ClientInput,
433
441
  * {
434
442
  * "passcode": "<passcode>"
@@ -436,7 +444,7 @@ declare enum IdoJourneyActionType {
436
444
  * ```
437
445
  *
438
446
  * - In Order to request resend of OTP (restart the action):
439
- * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
447
+ * `ido.submitClientResponse(ClientResponseOptionType.Resend)`
440
448
  *
441
449
  */
442
450
  SmsOTPAuthentication = "transmit_platform_sms_otp_authentication",
@@ -462,7 +470,7 @@ declare enum IdoJourneyActionType {
462
470
  *
463
471
  * - For simple submit of OTP passcode:
464
472
  * ```json
465
- * tsPlatform.ido.submitClientResponse(
473
+ * ido.submitClientResponse(
466
474
  * ClientResponseOptionType.ClientInput,
467
475
  * {
468
476
  * "passcode": "<passcode>"
@@ -470,7 +478,7 @@ declare enum IdoJourneyActionType {
470
478
  * ```
471
479
  *
472
480
  * - In Order to request resend of OTP (restart the action):
473
- * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
481
+ * `ido.submitClientResponse(ClientResponseOptionType.Resend)`
474
482
  *
475
483
  */
476
484
  GenericOTPAuthentication = "transmit_platform_generic_otp_authentication",
@@ -492,7 +500,7 @@ declare enum IdoJourneyActionType {
492
500
  * The user should use this to register the TOTP secret in their authenticator app.
493
501
  * Once the user has completed the registration, send the following empty client response:
494
502
  * ```json
495
- * tsPlatform.ido.submitClientResponse(
503
+ * ido.submitClientResponse(
496
504
  * ClientResponseOptionType.ClientInput
497
505
  * )
498
506
  * ```
@@ -521,7 +529,7 @@ declare enum IdoJourneyActionType {
521
529
  *
522
530
  * - For simple submit of validation passcode:
523
531
  * ```json
524
- * tsPlatform.ido.submitClientResponse(
532
+ * ido.submitClientResponse(
525
533
  * ClientResponseOptionType.ClientInput,
526
534
  * {
527
535
  * "passcode": "<passcode>"
@@ -529,7 +537,7 @@ declare enum IdoJourneyActionType {
529
537
  * ```
530
538
  *
531
539
  * - In Order to request resend of OTP (restart the action):
532
- * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
540
+ * `ido.submitClientResponse(ClientResponseOptionType.Resend)`
533
541
  *
534
542
  */
535
543
  EmailValidation = "transmit_platform_email_validation",
@@ -554,7 +562,7 @@ declare enum IdoJourneyActionType {
554
562
  *
555
563
  * - For simple submit of validation passcode:
556
564
  * ```json
557
- * tsPlatform.ido.submitClientResponse(
565
+ * ido.submitClientResponse(
558
566
  * ClientResponseOptionType.ClientInput,
559
567
  * {
560
568
  * "passcode": "<passcode>"
@@ -562,7 +570,7 @@ declare enum IdoJourneyActionType {
562
570
  * ```
563
571
  *
564
572
  * - In Order to request resend of OTP (restart the action):
565
- * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
573
+ * `ido.submitClientResponse(ClientResponseOptionType.Resend)`
566
574
  *
567
575
  */
568
576
  SmsValidation = "transmit_platform_sms_validation",
@@ -591,7 +599,7 @@ declare enum IdoJourneyActionType {
591
599
  *
592
600
  * - For submitting the TOTP code:
593
601
  * ```json
594
- * tsPlatform.ido.submitClientResponse(
602
+ * ido.submitClientResponse(
595
603
  * ClientResponseOptionType.ClientInput,
596
604
  * {
597
605
  * "totp_code": "<6_DIGIT_TOTP_CODE>"
@@ -624,7 +632,7 @@ declare enum IdoJourneyActionType {
624
632
  *
625
633
  * Once done, send the following client response:
626
634
  * ```json
627
- * tsPlatform.ido.submitClientResponse(
635
+ * ido.submitClientResponse(
628
636
  * ClientResponseOptionType.ClientInput,
629
637
  * {
630
638
  * "idp_response" : {
@@ -655,16 +663,16 @@ declare enum IdoJourneyActionType {
655
663
  * }
656
664
  * }
657
665
  * ```
658
- * Before responding, call `tsPlatform.webauthn.approve.modal()` to obtain the `webauthn_encoded_result` value.
666
+ * Before responding, call `webauthn.approve.modal()` to obtain the `webauthn_encoded_result` value.
659
667
  * ```javascript
660
- * const result = await tsPlatform.webauthn.approve.modal(
668
+ * const result = await webauthn.approve.modal(
661
669
  * response.data.approval_data // Transaction details to be approved
662
670
  * );
663
671
  * ```
664
672
  *
665
673
  * Then submit the result:
666
674
  * ```javascript
667
- * tsPlatform.ido.submitClientResponse(
675
+ * ido.submitClientResponse(
668
676
  * ClientResponseOptionType.ClientInput,
669
677
  * {
670
678
  * "webauthn_encoded_result": result
@@ -708,7 +716,7 @@ declare enum IdoJourneyActionType {
708
716
  *
709
717
  * For organization selection, send the following client response:
710
718
  * ```javascript
711
- * tsPlatform.ido.submitClientResponse(
719
+ * ido.submitClientResponse(
712
720
  * ClientResponseOptionType.ClientInput,
713
721
  * {
714
722
  * "organization_id": "<ORGANIZATION_ID>"
@@ -743,7 +751,7 @@ declare enum IdoJourneyActionType {
743
751
  *
744
752
  * For device selection, send the following client response:
745
753
  * ```javascript
746
- * tsPlatform.ido.submitClientResponse(
754
+ * ido.submitClientResponse(
747
755
  * ClientResponseOptionType.ClientInput,
748
756
  * {
749
757
  * "selected_device_code": "<DEVICE_CODE>"
@@ -775,17 +783,17 @@ declare enum IdoJourneyActionType {
775
783
  * ```javascript
776
784
  * // The application should implement its own polling mechanism
777
785
  * // and call this method periodically to check the status
778
- * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput)
786
+ * ido.submitClientResponse(ClientResponseOptionType.ClientInput)
779
787
  * ```
780
788
  *
781
789
  * - To cancel the authentication:
782
790
  * ```javascript
783
- * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Cancel)
791
+ * ido.submitClientResponse(ClientResponseOptionType.Cancel)
784
792
  * ```
785
793
  *
786
794
  * - To resend the push notification:
787
795
  * ```javascript
788
- * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)
796
+ * ido.submitClientResponse(ClientResponseOptionType.Resend)
789
797
  * ```
790
798
  *
791
799
  * Note: The application is responsible for implementing the polling mechanism
@@ -796,7 +804,98 @@ declare enum IdoJourneyActionType {
796
804
  * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain
797
805
  * relevant error codes that can be used to handle various failure scenarios.
798
806
  */
799
- MobileApproveAuthentication = "transmit_platform_mobile_approve_authentication"
807
+ MobileApproveAuthentication = "transmit_platform_mobile_approve_authentication",
808
+ /**
809
+ * @description `journeyStepId` for a selfie acquisition action.
810
+ * This action instructs the client to acquire a selfie image from the user, typically as part of an identity verification or face authentication process.
811
+ *
812
+ * Data received in the {@link IdoServiceResponse} object:
813
+ * ```json
814
+ * {
815
+ * "data": {
816
+ * "start_token": "<START_TOKEN>", // Optional: used to start an identity verification session if required
817
+ * "acquisition_id": "<ACQUISITION_ID>" // Required: ID needed to start selfie capture
818
+ * }
819
+ * }
820
+ * ```
821
+ *
822
+ * To perform the selfie acquisition:
823
+ * 1. If a `start_token` is present, initialize the IDV SDK session:
824
+ * ```javascript
825
+ * if (response.data.start_token !== undefined) {
826
+ * await idv.start(response.data.start_token);
827
+ * }
828
+ * ```
829
+ * 2. Run the selfie acquisition by calling the IDV SDK's `captureSelfie()` method:
830
+ * ```javascript
831
+ * await idv.captureSelfie({ acquisitionId: response.data.acquisition_id });
832
+ * ```
833
+ *
834
+ * After acquiring the selfie, the client response does not need to include any data:
835
+ * ```javascript
836
+ * ido.submitClientResponse(ClientResponseOptionType.ClientInput);
837
+ * ```
838
+ *
839
+ * If an error occurs while capturing the selfie, the client should handle error states and inform the user
840
+ * and/or retry as appropriate according to application requirements.
841
+ *
842
+ * For deeper understanding and more implementation details, refer to the IDV SDK documentation:
843
+ * {@link https://developer.transmitsecurity.com/sdk-ref/idvsdk/overview IDV SDK Reference}
844
+ */
845
+ SelfieAcquisition = "transmit_platform_selfie_acquisition",
846
+ /**
847
+ * @description `journeyStepId` for a document acquisition action.
848
+ * This action instructs the client to acquire a document image from the user, typically as part of an identity verification or face authentication process.
849
+ *
850
+ * Data received in the {@link IdoServiceResponse} object:
851
+ * ```json
852
+ * {
853
+ * "data": {
854
+ * "start_token": "<START_TOKEN>", // Optional: used to start an identity verification session if required
855
+ * "acquisition_id": "<ACQUISITION_ID>" // Required: ID needed to start document capture
856
+ * }
857
+ * }
858
+ * ```
859
+ *
860
+ * To perform the document acquisition:
861
+ * 1. If a `start_token` is present, initialize the IDV SDK session:
862
+ * ```javascript
863
+ * if (response.data.start_token !== undefined) {
864
+ * await idv.start(response.data.start_token);
865
+ * }
866
+ * ```
867
+ * 2. Run the document acquisition by calling the IDV SDK's `captureDocument()` method:
868
+ * ```javascript
869
+ * await idv.captureDocument({ acquisitionId: response.data.acquisition_id });
870
+ * ```
871
+ *
872
+ * After acquiring the document, the client response does not need to include any data:
873
+ * ```javascript
874
+ * ido.submitClientResponse(ClientResponseOptionType.ClientInput);
875
+ * ```
876
+ *
877
+ * If an error occurs while capturing the document, the client should handle error states and inform the user
878
+ * and/or retry as appropriate according to application requirements.
879
+ *
880
+ * For deeper understanding and more implementation details, refer to the IDV SDK documentation:
881
+ * {@link https://developer.transmitsecurity.com/sdk-ref/idvsdk/overview IDV SDK Reference}
882
+ */
883
+ DocumentAcquisition = "transmit_platform_document_acquisition",
884
+ /**
885
+ * @description `journeyStepId` for IDV recommendation action.
886
+ *
887
+ * When this action is received, it indicates that identity verification (IDV) processing is being performed asynchronously on the backend.
888
+ * The client is responsible for implementing a polling mechanism: keep calling
889
+ * `ido.submitClientResponse(ClientResponseOptionType.ClientInput)` in a loop until the server responds with a new action or returns an error.
890
+ *
891
+ * Note: No data is provided by the server in the {@link IdoServiceResponse} object for this action at any time.
892
+ *
893
+ * It is recommended to show a blocking UI element (such as a loader or progress indicator) while polling,
894
+ * to inform the user that processing is ongoing.
895
+ *
896
+ * This process can take a couple of seconds. The recommended polling interval is every 1 second.
897
+ */
898
+ WaitForIdvRecommendations = "transmit_platform_idv_recommendation"
800
899
  }
801
900
  /**
802
901
  * @interface
@@ -818,7 +917,7 @@ interface IdoServiceResponse {
818
917
  readonly errorData?: IdoSdkError;
819
918
  /**
820
919
  * @description Contains the Journey step ID, allowing the client side to choose the correct handler and UI.
821
- * This will be either a form ID for the "Get Information from Client" and "Login Form" journey steps,
920
+ * This will be either a form ID for the "Collect information" and "Login Form" journey steps,
822
921
  * or one of {@link IdoJourneyActionType} for other actions.
823
922
  */
824
923
  readonly journeyStepId?: IdoJourneyActionType | string;
@@ -852,7 +951,8 @@ interface IdoSdk {
852
951
  * @throws {@link ErrorCode.InvalidInitOptions} in case of invalid init options.
853
952
  * @example
854
953
  * // Initialize an instance of the Identity Orchestration SDK using the unified SDK
855
- * await window.tsPlatform.initialize({
954
+ * import { initialize } from '@transmitsecurity/platform-web-sdk';
955
+ * initialize({
856
956
  * clientId: 'my-client-id',
857
957
  * ido: { serverPath: 'https://api.transmitsecurity.io/ido'}
858
958
  * });
@@ -869,7 +969,7 @@ interface IdoSdk {
869
969
  * @example
870
970
  * // Start a Journey with the id 'my-journey-id'
871
971
  * try {
872
- * const idoResponse = await window.tsPlatform.ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' });
972
+ * const idoResponse = await ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' });
873
973
  * // Handle Journey response
874
974
  * } catch(error) {
875
975
  * switch(sdkError.errorCode) ...
@@ -886,7 +986,7 @@ interface IdoSdk {
886
986
  * @example
887
987
  * // Start a Journey with the Interaction ID '2456E855-05A0-4992-85C1-A2519CBB4AA7'
888
988
  * try {
889
- * const idoResponse = await window.tsPlatform.ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7');
989
+ * const idoResponse = await ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7');
890
990
  * // Handle Journey response
891
991
  * } catch(error) {
892
992
  * switch(sdkError.errorCode) ...
@@ -915,7 +1015,7 @@ interface IdoSdk {
915
1015
  *
916
1016
  * // Submit the client input. The data inside the JSON correspond to the expected fields from the Journey step.
917
1017
  * try {
918
- * const idoResponse = await window.tsPlatform.ido.submitClientResponse(selectedInputOption, {
1018
+ * const idoResponse = await ido.submitClientResponse(selectedInputOption, {
919
1019
  * 'userEmail': 'user@input.email',
920
1020
  * 'userPhone': '111-222-3333',
921
1021
  * });
@@ -932,7 +1032,7 @@ interface IdoSdk {
932
1032
  serializeState(): string;
933
1033
  /**
934
1034
  * @description Restores the SDK state from a serialized state, can be used to recover from page redirects or refresh.
935
- * The application code also receives the latest communication from the orchestration server.
1035
+ * The application code also receives the latest communication from the Mosaic server.
936
1036
  * @param state - The state to restore from.
937
1037
  * @returns The last {@link IdoServiceResponse} that was received before the state was saved.
938
1038
  * @throws {@link ErrorCode.InvalidState} - Throws error if the provided state string is invalid.
@@ -940,15 +1040,18 @@ interface IdoSdk {
940
1040
  restoreFromSerializedState(state: string): IdoServiceResponse;
941
1041
  /**
942
1042
  * @description This method will generate a debug PIN
943
- * const debugPin = await sdk.generateDebugPin();
944
- * console.log(`Debug PIN: ${debugPin}`); // Output: Debug PIN: 1234
1043
+ * const debugPin = await ido.generateDebugPin();
1044
+ * console.log(`Debug PIN: ${debugPin}`); // Output: Debug PIN: 1234
945
1045
  */
946
1046
  generateDebugPin(): Promise<string>;
947
1047
  }
948
1048
 
949
1049
  declare module "@transmit-security/web-sdk-common/dist/module-metadata/module-metadata" {
950
1050
  interface initConfigParams {
951
- ido?: IdoInitOptions;
1051
+ ido?: {
1052
+ serverPath?: string;
1053
+ [key: string]: any;
1054
+ };
952
1055
  }
953
1056
  }
954
1057