@verdocs/js-sdk 5.0.15 → 5.0.17

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.d.mts CHANGED
@@ -689,30 +689,34 @@ interface IRecipient {
689
689
  created_at: string;
690
690
  updated_at: string;
691
691
  last_attempt_at?: string;
692
+ /** The type of authentication required for this recipient. */
693
+ auth_method?: TRecipientAuthMethod;
692
694
  /**
693
- * If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
694
- * created from this template. For privacy reasons, this field will only be visible to the creator
695
- * of the envelope and the recipient referenced.
696
- */
697
- kba_method?: TKBAMethod;
698
- /**
699
- * If KBA is set to "PIN" this will be set to the PIN code required. For security reasons, this
695
+ * If auth_method is set to "passcode" this is the passcode required. For security reasons, this
700
696
  * field will only be visible to the creator of the envelope.
701
697
  */
702
- kba_pin?: string | null;
698
+ passcode?: string | null;
703
699
  /**
704
- * If KBA has been completed successfully, this will be set to true. For privacy reasons, this
705
- * field will only be visible to the creator of the envelope and the recipient referenced.
700
+ * If SMS-based authentication is used, the phone number to which one-time codes should be sent.
701
+ * NOTE: This may be different from the phone number used for notifications, but leaving it blank
702
+ * will trigger an error rather than defaulting to the notifications phone number to avoid mistaken
703
+ * assumptions (e.g. if SMS notifications are not enabled for the organization, but SMS authentication
704
+ * is).
706
705
  */
707
- kba_completed?: boolean;
706
+ phone_auth?: string;
708
707
  /**
709
- * If KBA has been completed (or partially successfully, this will contain metadata related to
710
- * the questions and answers from the process. For privacy reasons, this field will only be visible
711
- * to the recipient referenced.
708
+ * If authentication has been completed successfully, this will be set to 'complete'. This is a union type
709
+ * to allow for future expansion with authentication modules that may require multiple steps.
712
710
  */
713
- kba_details?: Record<string, any>;
711
+ auth_step?: TRecipientAuthStep | null;
714
712
  envelope?: IEnvelope;
715
713
  profile?: IProfile;
714
+ /**
715
+ * Only returned in creation/getEnvelopeById requests by the creator. May be used for in-person signing. Note that
716
+ * signing sessions started with this key will be marked as "In App" authenticated. For higher authentication levels,
717
+ * e.g. email, the signer must follow a link send via the appropriate channel (email).
718
+ */
719
+ in_app_key?: string;
716
720
  }
717
721
  /**
718
722
  * A placeholder for an individual recipient, CC, or other party in a signing flow. Roles may be "known" or "unknown."
@@ -746,12 +750,6 @@ interface IRole {
746
750
  */
747
751
  order: number;
748
752
  delegator: boolean | null;
749
- /**
750
- * If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
751
- * created from this template. Note that KBA details may not be specified here. They must be unique to
752
- * each individual recipient and therefore cannot be set as defaults in the template.
753
- */
754
- kba_method: TKBAMethod;
755
753
  }
756
754
  interface ISignature {
757
755
  id: string;
@@ -959,8 +957,9 @@ type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certi
959
957
  type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
960
958
  type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
961
959
  type TTemplateVisibility = "private" | "shared" | "public";
962
- type TKBAMethod = "pin" | "kba" | "id" | "sms" | "" | null;
963
960
  type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
961
+ type TRecipientAuthMethod = "kba" | "passcode" | "sms" | "id" | "kba_id" | null;
962
+ type TRecipientAuthStep = "complete" | null;
964
963
  declare const FIELD_TYPES: TFieldType[];
965
964
  declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
966
965
  declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
@@ -1227,26 +1226,29 @@ interface ICreateEnvelopeRecipient {
1227
1226
  delegator?: boolean;
1228
1227
  /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
1229
1228
  message?: string;
1230
- /** To enable KBA for the recipient, set to 'pin' or 'identity'. */
1231
- kba_method?: "pin" | "identity" | null;
1232
- /** If PIN-based KBA is used, the PIN to challenge the user to enter. */
1233
- kba_pin?: string;
1229
+ /** To enable authentication for the recipient, set to 'pin' or 'identity'. */
1230
+ auth_method?: TRecipientAuthMethod;
1231
+ /** If Passcode-based authentication is used, the passcode to challenge the user to enter. */
1232
+ passcode?: string;
1233
+ /**
1234
+ * If SMS-based authentication is used, the phone number to which one-time codes should be sent.
1235
+ * NOTE: This may be different from the phone number used for notifications, but leaving it blank
1236
+ * will trigger an error rather than defaulting to the notifications phone number to avoid mistaken
1237
+ * assumptions (e.g. if SMS notifications are not enabled for the organization, but SMS authentication
1238
+ * is).
1239
+ */
1240
+ phone_auth?: string;
1234
1241
  /*
1235
- * Pre-fill data for the recipient, if known. NOTE: If address and zip are both provided, an initial ID query
1236
- * will be made for the recipient. If questions are returned immediately, the first challenge will be skipped and
1237
- * the recipient will be immediately shown those questions, instead.
1242
+ * Pre-fill data for the recipient, if known. NOTE: Even when pre-filling these fields for a recipient, if
1243
+ * KBA is enabled, the recipient must be provided with the option to confirm those details before proceeding,
1244
+ * provide at least one data point themselves (typically date of birth). Providing every value here will
1245
+ trigger an error.
1238
1246
  */
1239
1247
  address?: string;
1240
1248
  city?: string;
1241
1249
  state?: string;
1242
1250
  zip?: string;
1243
- ssn_last_4?: string;
1244
- /**
1245
- * Only returned in creation/getEnvelopeById requests by the creator. May be used for in-person signing. Note that
1246
- * signing sessions started with this key will be marked as "In App" authenticated. For higher authentication levels,
1247
- * e.g. email, the signer must follow a link send via the appropriate channel (email).
1248
- */
1249
- in_app_key?: string;
1251
+ dob?: string;
1250
1252
  }
1251
1253
  interface ISignerTokenResponse {
1252
1254
  /**
@@ -3338,6 +3340,7 @@ declare function nameToRGBA(str: string): string | undefined;
3338
3340
  */
3339
3341
  declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
3340
3342
  declare const formatShortTimeAgo: (val: any) => string;
3343
+ declare const collapseEntitlements: (entitlements: IEntitlement[]) => Partial<Record<TEntitlement, IEntitlement>>;
3341
3344
  declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
3342
3345
  declare function getRLeft(x: number, ratio: number): number;
3343
3346
  declare function getRValue(y: number, ratio: number): number;
@@ -3433,4 +3436,4 @@ declare const decodeJWTBody: (token: string) => any;
3433
3436
  * the presence of the `document_id` field, which will only be present for signing sessions.
3434
3437
  */
3435
3438
  declare const decodeAccessTokenBody: (token: string) => TSession;
3436
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, TEntitlement, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
3439
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
package/dist/index.d.ts CHANGED
@@ -689,30 +689,34 @@ interface IRecipient {
689
689
  created_at: string;
690
690
  updated_at: string;
691
691
  last_attempt_at?: string;
692
+ /** The type of authentication required for this recipient. */
693
+ auth_method?: TRecipientAuthMethod;
692
694
  /**
693
- * If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
694
- * created from this template. For privacy reasons, this field will only be visible to the creator
695
- * of the envelope and the recipient referenced.
696
- */
697
- kba_method?: TKBAMethod;
698
- /**
699
- * If KBA is set to "PIN" this will be set to the PIN code required. For security reasons, this
695
+ * If auth_method is set to "passcode" this is the passcode required. For security reasons, this
700
696
  * field will only be visible to the creator of the envelope.
701
697
  */
702
- kba_pin?: string | null;
698
+ passcode?: string | null;
703
699
  /**
704
- * If KBA has been completed successfully, this will be set to true. For privacy reasons, this
705
- * field will only be visible to the creator of the envelope and the recipient referenced.
700
+ * If SMS-based authentication is used, the phone number to which one-time codes should be sent.
701
+ * NOTE: This may be different from the phone number used for notifications, but leaving it blank
702
+ * will trigger an error rather than defaulting to the notifications phone number to avoid mistaken
703
+ * assumptions (e.g. if SMS notifications are not enabled for the organization, but SMS authentication
704
+ * is).
706
705
  */
707
- kba_completed?: boolean;
706
+ phone_auth?: string;
708
707
  /**
709
- * If KBA has been completed (or partially successfully, this will contain metadata related to
710
- * the questions and answers from the process. For privacy reasons, this field will only be visible
711
- * to the recipient referenced.
708
+ * If authentication has been completed successfully, this will be set to 'complete'. This is a union type
709
+ * to allow for future expansion with authentication modules that may require multiple steps.
712
710
  */
713
- kba_details?: Record<string, any>;
711
+ auth_step?: TRecipientAuthStep | null;
714
712
  envelope?: IEnvelope;
715
713
  profile?: IProfile;
714
+ /**
715
+ * Only returned in creation/getEnvelopeById requests by the creator. May be used for in-person signing. Note that
716
+ * signing sessions started with this key will be marked as "In App" authenticated. For higher authentication levels,
717
+ * e.g. email, the signer must follow a link send via the appropriate channel (email).
718
+ */
719
+ in_app_key?: string;
716
720
  }
717
721
  /**
718
722
  * A placeholder for an individual recipient, CC, or other party in a signing flow. Roles may be "known" or "unknown."
@@ -746,12 +750,6 @@ interface IRole {
746
750
  */
747
751
  order: number;
748
752
  delegator: boolean | null;
749
- /**
750
- * If set, "KBA required" will carry through to automatically enable the same setting in Envelopes
751
- * created from this template. Note that KBA details may not be specified here. They must be unique to
752
- * each individual recipient and therefore cannot be set as defaults in the template.
753
- */
754
- kba_method: TKBAMethod;
755
753
  }
756
754
  interface ISignature {
757
755
  id: string;
@@ -959,8 +957,9 @@ type TEnvelopeUpdateResult = Omit<IEnvelope, "histories" | "recipients" | "certi
959
957
  type TFieldType = "signature" | "initial" | "checkbox" | "radio" | "textbox" | "timestamp" | "date" | "dropdown" | "textarea" | "attachment" | "payment";
960
958
  type TWebhookEvent = "envelope_created" | "envelope_completed" | "envelope_canceled" | "envelope_updated" | "template_created" | "template_updated" | "template_deleted" | "template_used";
961
959
  type TTemplateVisibility = "private" | "shared" | "public";
962
- type TKBAMethod = "pin" | "kba" | "id" | "sms" | "" | null;
963
960
  type TEntitlement = "envelope" | "kba_auth" | "passcode_auth" | "sms_auth" | "kba_id_auth" | "id_auth";
961
+ type TRecipientAuthMethod = "kba" | "passcode" | "sms" | "id" | "kba_id" | null;
962
+ type TRecipientAuthStep = "complete" | null;
964
963
  declare const FIELD_TYPES: TFieldType[];
965
964
  declare const DEFAULT_FIELD_WIDTHS: Record<TFieldType, number>;
966
965
  declare const DEFAULT_FIELD_HEIGHTS: Record<TFieldType, number>;
@@ -1227,26 +1226,29 @@ interface ICreateEnvelopeRecipient {
1227
1226
  delegator?: boolean;
1228
1227
  /** A custom message to include in the email or SMS invitation. May be left blank for a default message. */
1229
1228
  message?: string;
1230
- /** To enable KBA for the recipient, set to 'pin' or 'identity'. */
1231
- kba_method?: "pin" | "identity" | null;
1232
- /** If PIN-based KBA is used, the PIN to challenge the user to enter. */
1233
- kba_pin?: string;
1229
+ /** To enable authentication for the recipient, set to 'pin' or 'identity'. */
1230
+ auth_method?: TRecipientAuthMethod;
1231
+ /** If Passcode-based authentication is used, the passcode to challenge the user to enter. */
1232
+ passcode?: string;
1233
+ /**
1234
+ * If SMS-based authentication is used, the phone number to which one-time codes should be sent.
1235
+ * NOTE: This may be different from the phone number used for notifications, but leaving it blank
1236
+ * will trigger an error rather than defaulting to the notifications phone number to avoid mistaken
1237
+ * assumptions (e.g. if SMS notifications are not enabled for the organization, but SMS authentication
1238
+ * is).
1239
+ */
1240
+ phone_auth?: string;
1234
1241
  /*
1235
- * Pre-fill data for the recipient, if known. NOTE: If address and zip are both provided, an initial ID query
1236
- * will be made for the recipient. If questions are returned immediately, the first challenge will be skipped and
1237
- * the recipient will be immediately shown those questions, instead.
1242
+ * Pre-fill data for the recipient, if known. NOTE: Even when pre-filling these fields for a recipient, if
1243
+ * KBA is enabled, the recipient must be provided with the option to confirm those details before proceeding,
1244
+ * provide at least one data point themselves (typically date of birth). Providing every value here will
1245
+ trigger an error.
1238
1246
  */
1239
1247
  address?: string;
1240
1248
  city?: string;
1241
1249
  state?: string;
1242
1250
  zip?: string;
1243
- ssn_last_4?: string;
1244
- /**
1245
- * Only returned in creation/getEnvelopeById requests by the creator. May be used for in-person signing. Note that
1246
- * signing sessions started with this key will be marked as "In App" authenticated. For higher authentication levels,
1247
- * e.g. email, the signer must follow a link send via the appropriate channel (email).
1248
- */
1249
- in_app_key?: string;
1251
+ dob?: string;
1250
1252
  }
1251
1253
  interface ISignerTokenResponse {
1252
1254
  /**
@@ -3338,6 +3340,7 @@ declare function nameToRGBA(str: string): string | undefined;
3338
3340
  */
3339
3341
  declare function getRoleColor(name: string, roles: TRole[], index?: number): string | undefined;
3340
3342
  declare const formatShortTimeAgo: (val: any) => string;
3343
+ declare const collapseEntitlements: (entitlements: IEntitlement[]) => Partial<Record<TEntitlement, IEntitlement>>;
3341
3344
  declare function getRTop(y: number, fieldHeight: number, iTextHeight: number, yRatio: number): number;
3342
3345
  declare function getRLeft(x: number, ratio: number): number;
3343
3346
  declare function getRValue(y: number, ratio: number): number;
@@ -3433,4 +3436,4 @@ declare const decodeJWTBody: (token: string) => any;
3433
3436
  * the presence of the `document_id` field, which will only be present for signing sessions.
3434
3437
  */
3435
3438
  declare const decodeAccessTokenBody: (token: string) => TSession;
3436
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TKBAMethod, TEntitlement, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
3439
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, getDocumentDownloadLink, getDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, updateEnvelopeFieldSignature, updateEnvelopeFieldInitials, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, updateRecipient, envelopeRecipientSubmit, envelopeRecipientDecline, envelopeRecipientChangeOwner, envelopeRecipientAgree, envelopeRecipientUpdateName, envelopeRecipientPrepare, startSigningSession, getInPersonLink, sendDelegate, resendInvitation, userIsEnvelopeOwner, userIsEnvelopeRecipient, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, getSignatures, getSignature, deleteSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipient, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientSubmitParams, IUpdateRecipientDeclineParams, IUpdateRecipientClaimEnvelope, IUpdateRecipientStatus, IUpdateRecipientAgreedParams, IUpdateRecipientNameParams, IUpdateRecipientPrepareParams, ICreateEnvelopeReminderRequest, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, getStars, toggleStar, addTemplateTag, getTemplateTags, deleteTemplateTag, createTag, getTag, getAllTags, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, getTemplateDocuments, getTemplateDocument, createTemplateDocument, deleteTemplateDocument, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, getValidators, getValidator, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
package/dist/index.js CHANGED
@@ -232,6 +232,19 @@ const formatShortTimeAgo = (val) => {
232
232
  return `${timeDiff}S`;
233
233
  };
234
234
 
235
+ const collapseEntitlements = (entitlements) => {
236
+ const now = new Date();
237
+ const activeEntitlements = {};
238
+ entitlements.forEach((entitlement) => {
239
+ const start = new Date(entitlement.starts_at);
240
+ const end = new Date(entitlement.ends_at);
241
+ if (now >= start && now <= end && !activeEntitlements[entitlement.feature]) {
242
+ activeEntitlements[entitlement.feature] = entitlement;
243
+ }
244
+ });
245
+ return activeEntitlements;
246
+ };
247
+
235
248
  function getRTop(y, fieldHeight, iTextHeight, yRatio) {
236
249
  return iTextHeight - (y + fieldHeight) * yRatio;
237
250
  }
@@ -2683,17 +2696,8 @@ const getActiveEntitlements = async (endpoint) => {
2683
2696
  if (!endpoint.session) {
2684
2697
  throw new Error('No active session');
2685
2698
  }
2686
- const now = new Date();
2687
- const allEntitlements = await getEntitlements(endpoint);
2688
- const activeEntitlements = {};
2689
- allEntitlements.forEach((entitlement) => {
2690
- const start = new Date(entitlement.starts_at);
2691
- const end = new Date(entitlement.ends_at);
2692
- if (now >= start && now <= end && !activeEntitlements[entitlement.feature]) {
2693
- activeEntitlements[entitlement.feature] = entitlement;
2694
- }
2695
- });
2696
- return activeEntitlements;
2699
+ const entitlements = await getEntitlements(endpoint);
2700
+ return collapseEntitlements(entitlements);
2697
2701
  };
2698
2702
 
2699
2703
  /**
@@ -3594,6 +3598,7 @@ exports.canPerformTemplateAction = canPerformTemplateAction;
3594
3598
  exports.cancelEnvelope = cancelEnvelope;
3595
3599
  exports.capitalize = capitalize;
3596
3600
  exports.changePassword = changePassword;
3601
+ exports.collapseEntitlements = collapseEntitlements;
3597
3602
  exports.convertToE164 = convertToE164;
3598
3603
  exports.createApiKey = createApiKey;
3599
3604
  exports.createEnvelope = createEnvelope;