My Documents Component

Revision as of 08:02, 8 November 2024 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Intro

This component renders a number of documents based on the document assignments for a given contact user.

3B Portals Compatibility

This component is fully compatible with 3B Portals

Implementation

Portals

Drag and drop the component on any page. You can customize the component properties from the Traits Manager.

Visualforce Pages

You can embed the user-documents component in a Visualforce Page using the following syntax:

<!-- Load Supporting Components and Global Functions -->
<script src="{!URLFOR($Resource.b3o__GeneralUtils, 'index.js')}" defer="true" type="module"></script>

<!-- This Component -->
<script src="{!URLFOR($Resource.b3o__MyDocuments, 'index.js')}" defer="true" type="module"></script>

<user-documents></user-documents>

<script> 
    const globals = {
        sessionId: '{!GETSESSIONID()}',
        siteUrl: '{!$Site.baseUrl}',
        useREST: false,
        router: b3o.GlobalRemotingRouter
    };
    window['globals'] = globals;
</script>

External Websites

You can embed the user-documents component in a wordpress/custom sites using the following syntax:

<!-- Make sure to point the beginning of the URL to your guest site endpoint -->
<!-- Load Supporting Components and Global Functions -->
<script src=".../b3o__GeneralUtils/index.js" defer="true" type="module"></script>

<!-- This Component -->
<script src=".../b3o__MyDocuments/index.js" defer="true" type="module"></script>

<user-documents></user-documents>

<script> 
    const globals = {
        siteUrl: '.../Onboarding/',
        useREST: true
    };
    window['globals'] = globals;
</script>

Options

Attributes

user-id - this is the contact id. Required

app-id - this is a contextual application id. If provided, we will render only the documents linked to the contextual application.

doc-pack-id - this is the document pack id. If provided, will render only the documents associated with that document pack. If the contact doesn't have a document assignment for the provided document pack, then we will create a new one. If app-id is also provided, the new document assignment will be linked to the application record

URL Params

userId or just id - the contact id

appId or applicationId - the application record id

dpId or docPackId - the document pack id

Notice that attributes will always override URL params and you can mix and match

Closing the Modal

Custom embedded pages can cause a document modal close by issuing an iframe post event from the page/visualforce page like so:

window.parent.postMessage(
    {
        event_id: 'x3b_close_modal',
        data: {
        }
    },
    "*"
);