Online Help Center > SendSafely APIs

SendSafelyDropzone.v2.js

The SendSafely Dropzone allows end users to upload end-to-end encrypted files and secure messages to a given set of recipients

SendSafelyDropzone(dropzoneId, domElements, secureLinkElement, threadIdElement)
Return Type: Constructor
The only constructor for the library.
Parameters:
NameTypeDescription
dropzoneId String The Dropzone ID used to connect to SendSafely
domElements Array of HTMLElements An array of HTML DOM elements specifying where the Dropzone should be injected
secureLinkElement HTMLElement An HTML DOM element representing the field where the secure link will be automatically inserted. Only required if the disableAutoSubmit flag is not set.
threadIdElement HTMLElement An HTML DOM element representing the field where the package id will be automatically inserted, to share with the end user for reference upon successful submission.
Raised Events: N/A

initialize()
Return Type: void
Initialize the Dropzone. Calling the initialize function will create and inject a new Dropzone into the domElements specified in the constructor.
Parameters: N/A
Raised Events: N/A

finalizePackage(callback)
Return Type: void
Asynchronous function to manually finalize a package once all files have been uploaded. Only call this function when the disableAutoSubmit flag has been manually set.
Parameters:
NameTypeDescription
callback function A callback function containing the secure link
Raised Events: N/A

ongoingUploadsCallback(hasOngoingUpload, iFramesWithOngoingUploads)
Return Type: void
Callback function invoked for information about ongoing uploads
Parameters:
NameTypeDescription
hasOngoingUpload Boolean Indicates whether there are ongoing uploads
iFramesWithOngoingUploads Array An array of iFrame parent element IDs that have ongoing uploads
Raised Events: N/A

fileUploadedCallback(N/A)
Return Type: void
Allows setting custom callback function that executes for each file successfully uploaded.
Parameters:
NameTypeDescription
N/A Object The callback will be passed an object that exposes the fileId and fileName properties of the uploaded file.
Raised Events: N/A

fileRemovedCallback(N/A)
Return Type: void
Allows setting custom callback function that executes for each file removed.
Parameters:
NameTypeDescription
N/A Object The callback will be passed an object that exposes the fileId of the removed file.
Raised Events: N/A

isBrowserSupported()
Return Type: boolean
Checks that the script can run in the end user's browser. Should return true for any modern browser.
Parameters: N/A
Raised Events: N/A

setUnconfirmedSender(unconfirmedSender)
Return Type: void
Sends a command to set an unconfirmed sender's information.
Parameters:
NameTypeDescription
unconfirmedSender string The information to be set about the unconfirmed sender.
Raised Events: N/A

setPackageLabel(packageLabel)
Return Type: void
Sets the label for the Dropzone package
Parameters:
NameTypeDescription
packageLabel string The label for the Dropzone package
Raised Events: N/A

addMessage(message)
Return Type: void
Sends a command to set a package's message
Parameters:
NameTypeDescription
message string The text of the message
Raised Events: N/A

hasOngoingUploads(callback)
Return Type: void
Checks for ongoing uploads across all iframes, triggering a callback with the results
Parameters:
NameTypeDescription
callback function callback function executed, conveying status of any ongoing uploads
Raised Events: N/A

Additional properties
NameTypeDescription
url The URL to which the API will connect. Defaults to https://app.sendsafely.com. Normally, you will only need to change this if your organization instance is hosted outside outside of the US (i.e., https://my-app.sendsafely.co.uk)
iframeParentElementIds An array of ids of the parent elements into which Dropzone iframes will be inserted. No need to read or change.
INJECTED_TEXT Text to be included in the field where the secure link is inserted. The secure link will be inserted into the {url} section. Defaults to '\n\nThis ticket includes a secure attachment. Use this link to access the attached files:\n {url}'
FILE_ROW_CLASSES Classes to apply to file rows. Defaults to an empty string.
PROGRESS_CLASSES Classes to apply to progress bar. Defaults to an empty string.
UPLOAD_PERCENTAGE_CLASS Class to apply to upload percentage. Defaults to an empty string.
FAILURE_CLASS Class to apply to failure message. Defaults to 'alert-danger'
DROPZONE_TEXT Text that appears in Dropzone file upload input. Defaults to 'Drag files here or click to add file'
FILES_NOT_DONE_WARNING Text that appears when user attempts a Dropzone submission before packageCode has been generated. Defaults to 'Please wait until all files are done uploading'
STILL_WORKING_MESSAGE Text that appears when user attempts a Dropzone submission before keycode encryption has completed. Defaults to 'Still working...wait a few seconds and try again.'
FILE_COMPLETED_TEXT Text that appears when a file upload has finished. Defaults to 'Completed'
INFO_CLASS Class to apply to info alert. Defaults to 'alert-info'
WIDTH Specify the width of the Dropzone. Defaults to 100% but can be set to any percent or pixel value.
HEIGHT Specify the height of the Dropzone. Defaults to 100% but can be set to any percent or pixel value.
BACKGROUND_COLOR Specify the background color of the Dropzone.
DROP_TEXT_COLOR Specify the text color used within the Dropzone.
logoPath The URL to the SendSafely logo that appears in the Dropzone file upload box.
disableAutoSubmit Disable or enable auto submit. If auto submit is enabled, the finalizePackage function will automatically be called when a form on the page is submitted. If disabled, the user will have to call that function manually.
hasUploadedFiles Read-only Boolean that indicates whether files have been uploaded. Defaults to false.
packageIsFinalized Read-only Boolean that indicates whether the Dropzone package has been finalized. Defaults to false.
nbrOfFilesAttached Read-only integer that reflects the number of files uploaded to the Dropzone packages. Defaults to 0.
noKeycodeUrl Variable that stores the link to a Dropzone package that lacks keycodes. Defaults to undefined.
unconfirmedSender The unverified email address of the Dropzone submitter. When logged into the SendSafely web portal and viewing the package, this option will show the unverified email address of the user that submitted the files.
packageLabel The label for the Dropzone package. Typically, the name of the submitter, case ID, ticket number, etc. Defaults to undefined.
filePrefix Property added to the message object created by the iframeOnLoadFuction. Defaults to undefined.
invokeDropzoneConnectors Boolean value that determines whether to invoke a webhook, if this Dropzone uses a webhook for notifications. Defaults to false.
ongoingUploads An array of objects that expose the iframeParentElementId and ongoingUploads properties. Defaults to an empty array.