@verdocs/js-sdk 4.2.7 → 4.2.9

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
@@ -1420,21 +1420,6 @@ const createEnvelope = async (endpoint, request) => endpoint.api //
1420
1420
  const getEnvelopesSummary = async (endpoint, page) => endpoint.api //
1421
1421
  .post('/envelopes/summary', { page })
1422
1422
  .then((r) => r.data);
1423
- /**
1424
- * Get a signing session for an Envelope.
1425
- */
1426
- const getSigningSession = async (endpoint, params) => {
1427
- window.console.log('[JS_SDK] getSigningSession', params, endpoint.api);
1428
- return endpoint.api //
1429
- .get(`/envelopes/${params.envelopeId}/recipients/${encodeURIComponent(params.roleId)}/invitation/${params.inviteCode}`)
1430
- .then((r) => {
1431
- // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
1432
- const signerToken = r.headers?.signer_token || '';
1433
- const session = decodeAccessTokenBody(signerToken);
1434
- endpoint.setToken(signerToken);
1435
- return { recipient: r.data, session, signerToken };
1436
- });
1437
- };
1438
1423
  /**
1439
1424
  * Get the list of recipients for an Envelope.
1440
1425
  */
@@ -1649,10 +1634,23 @@ const envelopeRecipientUpdateName = (endpoint, envelopeId, roleName, fullName) =
1649
1634
  */
1650
1635
  const envelopeRecipientPrepare = (endpoint, envelopeId, roleName, recipients) => updateRecipient(endpoint, envelopeId, roleName, { action: 'prepare', recipients });
1651
1636
  /**
1652
- * Get a signing token.
1637
+ * Get a signing session for an Envelope. Note that this should generally be called with a NON-default
1638
+ * endpoint.
1639
+ */
1640
+ const getSigningSession = async (endpoint, envelope_id, role_name, key) => {
1641
+ return endpoint.api //
1642
+ .post(`/v2/sign/start/${envelope_id}/${encodeURIComponent(role_name)}/${key}`)
1643
+ .then((r) => {
1644
+ endpoint.setToken(r.data.access_token);
1645
+ return r.data;
1646
+ });
1647
+ };
1648
+ /**
1649
+ * Get a signing token for in-person signing. Authentication is required. This should be called
1650
+ * by the logged-in user who wants to sign.
1653
1651
  */
1654
- const getSignerToken = (endpoint, envelopeId, roleName) => endpoint.api //
1655
- .get(`/envelopes/${envelopeId}/recipients/${encodeURIComponent(roleName)}/signer-token`)
1652
+ const getSignerToken = (endpoint, envelope_id, role_name) => endpoint.api //
1653
+ .get(`/envelopes/${envelope_id}/recipients/${encodeURIComponent(role_name)}/signer-token`)
1656
1654
  .then((r) => r.data);
1657
1655
  /**
1658
1656
  * Get an in-person signing link.