Purpose:

Launch a target resource - a URL or a file attachment (EPC resource) - in the host applications native document viewer

Sample Usage:

import host from '@elliemae/em-ssf-guest'

...

let resource = {
  target: {
    entityId: "{{EPC_RESOURCE_ID}}",
    entityType: "urn:elli:skydrive"
  }
}

// Or, let resource = "{{URL_FOR_TARGET_RESOURCE}}"

async function openModal(resource) {
  try {
    const applicationObject = await host.getObject('application')
    const success = await applicationObject.openModal(resource)

    console.log(success)
  } catch (error) {
    console.log({error})
  }
}

openModal(resource)
import host from '@elliemae/em-ssf-guest'

...

let resource = {
  target: {
    entityId: "{{EPC_RESOURCE_ID}}",
    entityType: "urn:elli:skydrive"
  }
}

// Or, let resource = "{{URL_FOR_TARGET_RESOURCE}}"

host.getObject('application')
  .then(
    (applicationObject) => {
      applicationObject.openModal(resource)
        .then(
          (success) => {
                console.log(success)
            }
          }
        )
        .catch(
          (error) => {
            console.log({error})
          }
        )
    }
  )
  .catch(
    (error) => {
      console.log({error})
    }
  )

Interface:

Input:

Type: Object

An object containing a reference to the target resource to be launched in the host applications modal document viewer. The target may refer to an accessible resource on the internet (a URL), or to an EPC resource object. If referring to an EPC resource object received in a transaction request, or relayed back in a transaction response, map the objects id field to the entityId field as illustrated above.

Attribute

Description

`$.target`

string or object - required

Can either be a string value, containing a valid URL to be launched in the new browser, or an object containing a reference to an EPC resource

The next two attributes are only required if you are passing a reference to an EPC resource

`$.target.entityId`

string - conditionally required

Needed if trying to launch an EPC resource - this is the id for the resource that you either received as a request attachment, or relayed back as a response attachment.

`$.target.entityType`

string - conditionally required

Needed if trying to launch an EPC resource - represents the type of resource. All EPC resources are of type urn:elli:skydrive - so you can simply treat this as a constant in your application.

Renders:

The host applications document viewer, displaying the specified target resource.

Returns:

Type: Promise

==> Resolved

String

"success"

==> Rejected

An error is raised, containing a message attribute with details on the error that occurred

{
  message: "{{ERROR_DETAILS}}"
}