@verdocs/js-sdk 4.1.15 → 4.1.16

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/index.mjs CHANGED
@@ -793,9 +793,231 @@ var globalThis_1 = (function () {
793
793
 
794
794
  var globalThis$1 = /*@__PURE__*/getDefaultExportFromCjs(globalThis_1);
795
795
 
796
+ /**
797
+ * Authenticate to Verdocs.
798
+ *
799
+ * ```typescript
800
+ * import {authenticate, VerdocsEndpoint} from '@verdocs/js-sdk';
801
+ *
802
+ * // Client-side call, suitable for Web and mobile apps:
803
+ * const {access_token} = await Auth.authenticate({ username: 'test@test.com', password: 'PASSWORD', grant_type:'password' });
804
+ * VerdocsEndpoint.getDefault().setAuthToken(access_token);
805
+ *
806
+ * // Server-side call, suitable for server apps. NEVER EXPOSE client_secret IN FRONT-END CODE:
807
+ * const {access_token} = await Auth.authenticate({ client_id: '...', client_secret: '...', grant_type:'client_credentials' });
808
+ * VerdocsEndpoint.getDefault().setAuthToken(access_token);
809
+ * ```
810
+ */
811
+ const authenticate = (endpoint, params) => endpoint.api //
812
+ .post('/v2/oauth2/token', params)
813
+ .then((r) => r.data);
814
+ /**
815
+ * If called before the session expires, this will refresh the caller's session and tokens.
816
+ *
817
+ * ```typescript
818
+ * import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
819
+ *
820
+ * const {accessToken} = await Auth.refreshTokens();
821
+ * VerdocsEndpoint.setAuthToken(accessToken);
822
+ * ```
823
+ */
824
+ const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_type: 'refresh_token', refresh_token: refreshToken });
825
+ /**
826
+ * Update the caller's password when the old password is known (typically for logged-in users).
827
+ *
828
+ * ```typescript
829
+ * import {changePassword} from '@verdocs/js-sdk';
830
+ *
831
+ * const {status, message} = await changePassword({ email, oldPassword, newPassword });
832
+ * if (status !== 'OK') {
833
+ * window.alert(`Password reset error: ${message}`);
834
+ * }
835
+ * ```
836
+ */
837
+ const changePassword = (endpoint, params) => endpoint.api //
838
+ .post('/v2/users/change-password', params)
839
+ .then((r) => r.data);
840
+ /**
841
+ * Request a password reset, when the old password is not known (typically in login forms).
842
+ *
843
+ * ```typescript
844
+ * import {resetPassword} from '@verdocs/js-sdk';
845
+ *
846
+ * const {success} = await resetPassword({ email });
847
+ * if (status !== 'OK') {
848
+ * window.alert(`Please check your email for instructions on how to reset your password.`);
849
+ * }
850
+ * ```
851
+ */
852
+ const resetPassword = (endpoint, params) => endpoint.api //
853
+ .post('/v2/users/reset-password', params)
854
+ .then((r) => r.data);
855
+ /**
856
+ * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
857
+ * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
858
+ * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
859
+ * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
860
+ * "anonymous" mode while verification is being performed.
861
+ *
862
+ * ```typescript
863
+ * import {resendVerification} from '@verdocs/js-sdk';
864
+ *
865
+ * const result = await resendVerification();
866
+ * ```
867
+ */
868
+ const verifyEmail = (endpoint, email, code) => endpoint.api //
869
+ .post('/v2/users/verify-email', { email, code })
870
+ .then((r) => r.data);
871
+ /**
872
+ * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
873
+ * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
874
+ * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
875
+ * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
876
+ * "anonymous" mode while verification is being performed.
877
+ *
878
+ * ```typescript
879
+ * import {resendVerification} from '@verdocs/js-sdk';
880
+ *
881
+ * const result = await resendVerification();
882
+ * ```
883
+ */
884
+ const resendVerification = (endpoint, accessToken) => endpoint.api //
885
+ .post('/v2/users/resend-verification', {}, accessToken ? { headers: { Authorization: `Bearer ${accessToken}` } } : {})
886
+ .then((r) => r.data);
887
+
888
+ const getNotifications = async (endpoint) => endpoint.api //
889
+ .get('/v2/notifications')
890
+ .then((r) => r.data);
891
+
892
+ /**
893
+ * Get the user's available profiles. The current profile will be marked with `current: true`.
894
+ *
895
+ * ```typescript
896
+ * import {getProfiles} from '@verdocs/js-sdk';
897
+ *
898
+ * const profiles = await getProfiles();
899
+ * ```
900
+ */
901
+ const getProfiles = (endpoint) => endpoint.api //
902
+ .get('/v2/profiles')
903
+ .then((r) => r.data);
904
+ /**
905
+ * Get the user's available profiles. The current profile will be marked with `current: true`.
906
+ *
907
+ * ```typescript
908
+ * import {getCurrentProfile} from '@verdocs/js-sdk';
909
+ *
910
+ * const profiles = await getCurrentProfile(VerdocsEndpoint.getDefault());
911
+ * ```
912
+ */
913
+ const getCurrentProfile = (endpoint) => endpoint.api //
914
+ .get('/v2/profiles')
915
+ .then((r) => (r.data || []).find((profile) => profile.current));
916
+ /**
917
+ * Get a profile. The caller must have admin access to the given profile.
918
+ *
919
+ * ```typescript
920
+ * import {getProfile} from '@verdocs/js-sdk';
921
+ *
922
+ * const profile = await getProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
923
+ * ```
924
+ */
925
+ const getProfile = (endpoint, profileId) => endpoint.api //
926
+ .get(`/v2/profiles/${profileId}`)
927
+ .then((r) => r.data);
928
+ /**
929
+ * Switch the caller's "current" profile. The current profile is used for permissions checking
930
+ * and profile_id field settings for most operations in Verdocs. It is important to select the
931
+ * appropropriate profile before calling other API functions.
932
+ *
933
+ * ```typescript
934
+ * import {switchProfile} from '@verdocs/js-sdk';
935
+ *
936
+ * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
937
+ * ```
938
+ */
939
+ const switchProfile = (endpoint, profileId) => endpoint.api //
940
+ .post(`/v2/profiles/${profileId}/switch`)
941
+ .then((r) => r.data);
942
+ /**
943
+ * Update a profile. For future expansion, the profile ID to update is required, but currently
944
+ * this must also be the "current" profile for the caller.
945
+ *
946
+ * ```typescript
947
+ * import {updateProfile} from '@verdocs/js-sdk/Users';
948
+ *
949
+ * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
950
+ * ```
951
+ */
952
+ const updateProfile = (endpoint, profileId, params) => endpoint.api //
953
+ .patch(`/v2/profiles/${profileId}`, params)
954
+ .then((r) => r.data);
955
+ /**
956
+ * Delete a profile. If the requested profile is the caller's curent profile, the next
957
+ * available profile will be selected.
958
+ *
959
+ * ```typescript
960
+ * import {deleteProfile} from '@verdocs/js-sdk';
961
+ *
962
+ * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
963
+ * ```
964
+ */
965
+ const deleteProfile = (endpoint, profileId) => endpoint.api //
966
+ .delete(`/v2/profiles/${profileId}`)
967
+ .then((r) => r.data);
968
+ /**
969
+ * Create a new user account. Note that there are two registration paths for creation:
970
+ * - Get invited to an organization, by an admin or owner of that org.
971
+ * - Created a new organization. The caller will become the first owner of the new org.
972
+ *
973
+ * This endpoint is for the second path, so an organization name is required. It is NOT
974
+ * required to be unique because it is very common for businesses to have the same names,
975
+ * without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
976
+ *
977
+ * The new profile will automatically be set as the user's "current" profile, and new
978
+ * session tokens will be returned to the caller. However, the caller's email may not yet
979
+ * be verified. In that case, the caller will not yet be able to call other endpoints in
980
+ * the Verdocs API. The caller will need to check their email for a verification code,
981
+ * which should be submitted via the `verifyEmail` endpoint.
982
+ *
983
+ * ```typescript
984
+ * import {createProfile} from '@verdocs/js-sdk';
985
+ *
986
+ * const newSession = await createProfile(VerdocsEndpoint.getDefault(), {
987
+ * orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
988
+ * });
989
+ * ```
990
+ */
991
+ const createProfile = (endpoint, params) => endpoint.api //
992
+ .post('/v2/profiles', params)
993
+ .then((r) => r.data);
994
+ /**
995
+ * Update the caller's profile photo. This can only be called for the user's "current" profile.
996
+ *
997
+ * ```typescript
998
+ * import {uploadProfilePhoto} from '@verdocs/js-sdk';
999
+ *
1000
+ * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
1001
+ * ```
1002
+ */
1003
+ const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
1004
+ const formData = new FormData();
1005
+ formData.append('picture', file, file.name);
1006
+ return endpoint.api //
1007
+ .patch(`/v2/profiles/${profileId}`, formData, {
1008
+ timeout: 120000,
1009
+ onUploadProgress: (event) => {
1010
+ const total = event.total || 1;
1011
+ const loaded = event.loaded || 0;
1012
+ onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
1013
+ },
1014
+ })
1015
+ .then((r) => r.data);
1016
+ };
1017
+
796
1018
  // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
797
1019
  // Also see globalThis for comments about why we're doing this in the first place.
798
- const ENDPOINT_KEY = Symbol.for('vƒbaseerdocs-default-endpoint');
1020
+ const ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
799
1021
  const requestLogger = (r) => {
800
1022
  // tslint:disable-next-line
801
1023
  console.debug(`[JS-SDK] ${r.method.toUpperCase()} ${r.baseURL}${r.url}`, r.data ? JSON.stringify(r.data) : '');
@@ -843,6 +1065,13 @@ class VerdocsEndpoint {
843
1065
  * with Envelopes.
844
1066
  */
845
1067
  session = null;
1068
+ /**
1069
+ * The current user's profile, if known. Note that while sessions are loaded and handled synchronously,
1070
+ * profiles are loaded asynchronously and may not be available immediately after a session is loaded.
1071
+ * To ensure both are available, developers should subscribe to the `onSessionChanged` event, which
1072
+ * will not be fired until the profile is loaded and verified.
1073
+ */
1074
+ profile = null;
846
1075
  api;
847
1076
  /**
848
1077
  * Create a new VerdocsEndpoint to call Verdocs platform services.
@@ -1061,7 +1290,17 @@ class VerdocsEndpoint {
1061
1290
  this.api.defaults.headers.common.signer = `Bearer ${token}`;
1062
1291
  }
1063
1292
  localStorage.setItem(this.sessionStorageKey(), token);
1064
- this.notifySessionListeners();
1293
+ getCurrentProfile(this)
1294
+ .then((r) => {
1295
+ window?.console?.debug('[JS_SDK] Loaded profile', r);
1296
+ this.profile = r || null;
1297
+ this.notifySessionListeners();
1298
+ })
1299
+ .catch((e) => {
1300
+ this.profile = null;
1301
+ window?.console?.warn('Unable to load profile', e);
1302
+ this.notifySessionListeners();
1303
+ });
1065
1304
  return this;
1066
1305
  }
1067
1306
  /**
@@ -1082,6 +1321,7 @@ class VerdocsEndpoint {
1082
1321
  delete this.api.defaults.headers.common.Authorization;
1083
1322
  delete this.api.defaults.headers.common.signer;
1084
1323
  this.session = null;
1324
+ this.profile = null;
1085
1325
  this.token = null;
1086
1326
  this.notifySessionListeners();
1087
1327
  return this;
@@ -1093,6 +1333,7 @@ class VerdocsEndpoint {
1093
1333
  localStorage.removeItem(this.sessionStorageKey());
1094
1334
  delete this.api.defaults.headers.common.Authorization;
1095
1335
  this.session = null;
1336
+ this.profile = null;
1096
1337
  this.token = null;
1097
1338
  this.notifySessionListeners();
1098
1339
  return this;
@@ -1100,7 +1341,7 @@ class VerdocsEndpoint {
1100
1341
  notifySessionListeners() {
1101
1342
  this.sessionListeners.forEach((listener) => {
1102
1343
  try {
1103
- listener(this, this.session);
1344
+ listener(this, this.session, this.profile);
1104
1345
  }
1105
1346
  catch (e) {
1106
1347
  // NOOP
@@ -1120,8 +1361,8 @@ class VerdocsEndpoint {
1120
1361
  };
1121
1362
  }
1122
1363
  /**
1123
- * Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
1124
- * or component starts.
1364
+ * Load a persisted session from localStorage. Typically called once after the endpoint is configured
1365
+ * when the app or component starts.
1125
1366
  */
1126
1367
  loadSession() {
1127
1368
  const token = localStorage.getItem(this.sessionStorageKey());
@@ -2625,227 +2866,5 @@ const isValidRoleName = (value, roles) => roles.findIndex((role) => role.name ==
2625
2866
  const TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;
2626
2867
  const isValidTag = (value, tags) => TagRegEx.test(value) || tags.findIndex((tag) => tag === value) !== -1;
2627
2868
 
2628
- /**
2629
- * Authenticate to Verdocs.
2630
- *
2631
- * ```typescript
2632
- * import {authenticate, VerdocsEndpoint} from '@verdocs/js-sdk';
2633
- *
2634
- * // Client-side call, suitable for Web and mobile apps:
2635
- * const {access_token} = await Auth.authenticate({ username: 'test@test.com', password: 'PASSWORD', grant_type:'password' });
2636
- * VerdocsEndpoint.getDefault().setAuthToken(access_token);
2637
- *
2638
- * // Server-side call, suitable for server apps. NEVER EXPOSE client_secret IN FRONT-END CODE:
2639
- * const {access_token} = await Auth.authenticate({ client_id: '...', client_secret: '...', grant_type:'client_credentials' });
2640
- * VerdocsEndpoint.getDefault().setAuthToken(access_token);
2641
- * ```
2642
- */
2643
- const authenticate = (endpoint, params) => endpoint.api //
2644
- .post('/v2/oauth2/token', params)
2645
- .then((r) => r.data);
2646
- /**
2647
- * If called before the session expires, this will refresh the caller's session and tokens.
2648
- *
2649
- * ```typescript
2650
- * import {Auth, VerdocsEndpoint} from '@verdocs/js-sdk';
2651
- *
2652
- * const {accessToken} = await Auth.refreshTokens();
2653
- * VerdocsEndpoint.setAuthToken(accessToken);
2654
- * ```
2655
- */
2656
- const refreshToken = (endpoint, refreshToken) => authenticate(endpoint, { grant_type: 'refresh_token', refresh_token: refreshToken });
2657
- /**
2658
- * Update the caller's password when the old password is known (typically for logged-in users).
2659
- *
2660
- * ```typescript
2661
- * import {changePassword} from '@verdocs/js-sdk';
2662
- *
2663
- * const {status, message} = await changePassword({ email, oldPassword, newPassword });
2664
- * if (status !== 'OK') {
2665
- * window.alert(`Password reset error: ${message}`);
2666
- * }
2667
- * ```
2668
- */
2669
- const changePassword = (endpoint, params) => endpoint.api //
2670
- .post('/v2/users/change-password', params)
2671
- .then((r) => r.data);
2672
- /**
2673
- * Request a password reset, when the old password is not known (typically in login forms).
2674
- *
2675
- * ```typescript
2676
- * import {resetPassword} from '@verdocs/js-sdk';
2677
- *
2678
- * const {success} = await resetPassword({ email });
2679
- * if (status !== 'OK') {
2680
- * window.alert(`Please check your email for instructions on how to reset your password.`);
2681
- * }
2682
- * ```
2683
- */
2684
- const resetPassword = (endpoint, params) => endpoint.api //
2685
- .post('/v2/users/reset-password', params)
2686
- .then((r) => r.data);
2687
- /**
2688
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
2689
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
2690
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
2691
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
2692
- * "anonymous" mode while verification is being performed.
2693
- *
2694
- * ```typescript
2695
- * import {resendVerification} from '@verdocs/js-sdk';
2696
- *
2697
- * const result = await resendVerification();
2698
- * ```
2699
- */
2700
- const verifyEmail = (endpoint, email, code) => endpoint.api //
2701
- .post('/v2/users/verify-email', { email, code })
2702
- .then((r) => r.data);
2703
- /**
2704
- * Resend the email verification request. Note that to prevent certain forms of abuse, the email address is not
2705
- * a parameter here. Instead, the caller must be authenticated as the (unverified) user. To simplify this process,
2706
- * the access token to be used may be passed directly as a parameter here. This avoids the need to set it as the
2707
- * active token on an endpoint, which may be inconvenient in workflows where it is preferable to keep the user in
2708
- * "anonymous" mode while verification is being performed.
2709
- *
2710
- * ```typescript
2711
- * import {resendVerification} from '@verdocs/js-sdk';
2712
- *
2713
- * const result = await resendVerification();
2714
- * ```
2715
- */
2716
- const resendVerification = (endpoint, accessToken) => endpoint.api //
2717
- .post('/v2/users/resend-verification', {}, accessToken ? { headers: { Authorization: `Bearer ${accessToken}` } } : {})
2718
- .then((r) => r.data);
2719
-
2720
- const getNotifications = async (endpoint) => endpoint.api //
2721
- .get('/v2/notifications')
2722
- .then((r) => r.data);
2723
-
2724
- /**
2725
- * Get the user's available profiles. The current profile will be marked with `current: true`.
2726
- *
2727
- * ```typescript
2728
- * import {getProfiles} from '@verdocs/js-sdk';
2729
- *
2730
- * const profiles = await getProfiles();
2731
- * ```
2732
- */
2733
- const getProfiles = (endpoint) => endpoint.api //
2734
- .get('/v2/profiles')
2735
- .then((r) => r.data);
2736
- /**
2737
- * Get the user's available profiles. The current profile will be marked with `current: true`.
2738
- *
2739
- * ```typescript
2740
- * import {getCurrentProfile} from '@verdocs/js-sdk';
2741
- *
2742
- * const profiles = await getCurrentProfile(VerdocsEndpoint.getDefault());
2743
- * ```
2744
- */
2745
- const getCurrentProfile = (endpoint) => endpoint.api //
2746
- .get('/v2/profiles')
2747
- .then((r) => (r.data || []).find((profile) => profile.current));
2748
- /**
2749
- * Get a profile. The caller must have admin access to the given profile.
2750
- *
2751
- * ```typescript
2752
- * import {getProfile} from '@verdocs/js-sdk';
2753
- *
2754
- * const profile = await getProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2755
- * ```
2756
- */
2757
- const getProfile = (endpoint, profileId) => endpoint.api //
2758
- .get(`/v2/profiles/${profileId}`)
2759
- .then((r) => r.data);
2760
- /**
2761
- * Switch the caller's "current" profile. The current profile is used for permissions checking
2762
- * and profile_id field settings for most operations in Verdocs. It is important to select the
2763
- * appropropriate profile before calling other API functions.
2764
- *
2765
- * ```typescript
2766
- * import {switchProfile} from '@verdocs/js-sdk';
2767
- *
2768
- * const newProfile = await switchProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2769
- * ```
2770
- */
2771
- const switchProfile = (endpoint, profileId) => endpoint.api //
2772
- .post(`/v2/profiles/${profileId}/switch`)
2773
- .then((r) => r.data);
2774
- /**
2775
- * Update a profile. For future expansion, the profile ID to update is required, but currently
2776
- * this must also be the "current" profile for the caller.
2777
- *
2778
- * ```typescript
2779
- * import {updateProfile} from '@verdocs/js-sdk/Users';
2780
- *
2781
- * const newProfile = await updateProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2782
- * ```
2783
- */
2784
- const updateProfile = (endpoint, profileId, params) => endpoint.api //
2785
- .patch(`/v2/profiles/${profileId}`, params)
2786
- .then((r) => r.data);
2787
- /**
2788
- * Delete a profile. If the requested profile is the caller's curent profile, the next
2789
- * available profile will be selected.
2790
- *
2791
- * ```typescript
2792
- * import {deleteProfile} from '@verdocs/js-sdk';
2793
- *
2794
- * await deleteProfile(VerdocsEndpoint.getDefault(), 'PROFILEID');
2795
- * ```
2796
- */
2797
- const deleteProfile = (endpoint, profileId) => endpoint.api //
2798
- .delete(`/v2/profiles/${profileId}`)
2799
- .then((r) => r.data);
2800
- /**
2801
- * Create a new user account. Note that there are two registration paths for creation:
2802
- * - Get invited to an organization, by an admin or owner of that org.
2803
- * - Created a new organization. The caller will become the first owner of the new org.
2804
- *
2805
- * This endpoint is for the second path, so an organization name is required. It is NOT
2806
- * required to be unique because it is very common for businesses to have the same names,
2807
- * without conflicting (e.g. "Delta" could be Delta Faucet or Delta Airlines).
2808
- *
2809
- * The new profile will automatically be set as the user's "current" profile, and new
2810
- * session tokens will be returned to the caller. However, the caller's email may not yet
2811
- * be verified. In that case, the caller will not yet be able to call other endpoints in
2812
- * the Verdocs API. The caller will need to check their email for a verification code,
2813
- * which should be submitted via the `verifyEmail` endpoint.
2814
- *
2815
- * ```typescript
2816
- * import {createProfile} from '@verdocs/js-sdk';
2817
- *
2818
- * const newSession = await createProfile(VerdocsEndpoint.getDefault(), {
2819
- * orgName: 'NEW ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
2820
- * });
2821
- * ```
2822
- */
2823
- const createProfile = (endpoint, params) => endpoint.api //
2824
- .post('/v2/profiles', params)
2825
- .then((r) => r.data);
2826
- /**
2827
- * Update the caller's profile photo. This can only be called for the user's "current" profile.
2828
- *
2829
- * ```typescript
2830
- * import {uploadProfilePhoto} from '@verdocs/js-sdk';
2831
- *
2832
- * await uploadProfilePhoto((VerdocsEndpoint.getDefault(), profileId, file);
2833
- * ```
2834
- */
2835
- const updateProfilePhoto = (endpoint, profileId, file, onUploadProgress) => {
2836
- const formData = new FormData();
2837
- formData.append('picture', file, file.name);
2838
- return endpoint.api //
2839
- .patch(`/v2/profiles/${profileId}`, formData, {
2840
- timeout: 120000,
2841
- onUploadProgress: (event) => {
2842
- const total = event.total || 1;
2843
- const loaded = event.loaded || 0;
2844
- onUploadProgress?.(Math.floor((loaded * 100) / (total || 1)), loaded, total || 1);
2845
- },
2846
- })
2847
- .then((r) => r.data);
2848
- };
2849
-
2850
2869
  export { AtoB, Countries, VerdocsEndpoint, acceptOrganizationInvitation, addGroupMember, addTemplateTag, authenticate, blobToBase64, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, convertToE164, createApiKey, createEnvelope, createEnvelopeReminder, createField, createGroup, createInitials, createOrganizationInvitation, createProfile, createSignature, createTag, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateReminder, createTemplateRole, createTemplatev2, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, deleteApiKey, deleteEnvelopeFieldAttachment, deleteEnvelopeReminder, deleteField, deleteGroupMember, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteSignature, deleteTemplate, deleteTemplateDocument, deleteTemplateReminder, deleteTemplateRole, deleteTemplateTag, downloadBlob, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientChangeOwner, envelopeRecipientDecline, envelopeRecipientPrepare, envelopeRecipientSubmit, envelopeRecipientUpdateName, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getAllTags, getApiKeys, getCountryByCode, getCurrentProfile, getDocumentDownloadLink, getDocumentPreviewLink, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentPageDisplayUri, getEnvelopeFile, getEnvelopeRecipients, getEnvelopeReminder, getEnvelopesByTemplateId, getEnvelopesSummary, getFieldAttachment, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStatus, getMatchingCountry, getNextRecipient, getNotifications, getOrganization, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getPlusOneCountry, getProfile, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getSignature, getSignatures, getSignerToken, getSigningSession, getStars, getTag, getTemplate, getTemplateDocument, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentThumbnail, getTemplateDocuments, getTemplateOwnerInfo, getTemplateReminder, getTemplateRole, getTemplateRoleFields, getTemplateRoles, getTemplateTags, getTemplates, getTemplatesSummary, getValidator, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidPhone, isValidRoleName, isValidTag, listEnvelopes, listTemplates, nameToRGBA, recipientCanAct, recipientHasAction, refreshToken, rescale, resendInvitation, resendOrganizationInvitation, resendVerification, resetPassword, rotateApiKey, searchEnvelopes, searchTemplates, sendDelegate, setWebhooks, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, throttledGetEnvelope, throttledGetTemplate, timePeriod, toggleStar, updateApiKey, updateEnvelopeField, updateEnvelopeFieldInitials, updateEnvelopeFieldSignature, updateEnvelopeReminder, updateField, updateGroup, updateOrganization, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateReminder, updateTemplateRole, uploadEnvelopeFieldAttachment, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail };
2851
2870
  //# sourceMappingURL=index.mjs.map