Browser Storage Component

Estimated Reading Time:  12 minutes

Overview

The Browser Storage component lets you add, edit, delete, and retrieve data in an end-user's End-users, also known as Express Users, are the individuals accessing an application through Express View. In most cases, end-users are the customers using the product. browser. The component stores data using the Link Out IconIndexedDB API (application programming interface) call. IndexedDB is a large storage system for encrypting and storing data in a browser. As the name suggests, this API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. call lets you store large amounts of structured, indexed information locally. The API call also lets you filter and search this indexed information.

Data stored in a browser expires after 30 days. The expiration time resets when the end-user accesses the data.

NOTE  Only end-users can access the encrypted data stored on their browser.

You'll find the Browser Storage component in the Data & Event Processing group to the left of the Module Builder.

What You'll Learn

After completing this article, you’ll know when to use a Browser Storage component, and how to configure its settings.

About the Configuration Window

General

A static image displaying the Brower Storage component's configuration window.

Setting

Description

Property ID

A Property ID is the unique field ID used by Unqork to track and link components in your module.

The Property ID is how the software identifies your component. Using Property IDs lets you link components, creating logic-based configurations and API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. calls.

Property IDs must use camel case A naming convention for computer programming. Use camelCase for Property IDs, for example: newUser, lastName, & rdoButton. (stylized as camelCase) without spaces or punctuation.

Notes Note-Icon

Select this tab to display the component's Notes area. You can use notes to keep your teammates informed.

The Notes editor offers a semi-WYSIWYG (What You See is What You Get) content editor. Built to look like a word processor, this editor lets you create, edit, and format your notes. Notes save when saving the component.

Display Icon Display

Select this tab to manage your component's display settings.

Data Icon Data

Select this tab to manage your component's data settings.

Actions Icon Actions

Select this tab to manage your component's actions settings.

Advanced Icon Advanced

Select this tab to manage your component's advanced settings.

Field Tag Icon Field Tags

Assign components one-word labels to help organize, identify, and group the components in your application.

Consider an example from the API Specification Snippet: Field Tags are applied to Hidden components in the panelRequest and panelResponse Panels. The Field Tags identify the data type of parameters included in the API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. request and response. The API Docs Dashboard tool populates with information about each parameter’s data type, identified by the Field Tag.

Field Tags act as a type of Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. group and let you group components for configuration purposes. Field Tags let you target two or more components using a simple logic component.

For example, add the Field Tag tagForDecision to multiple components in your module. Open the Inputs table of a Decisions component and reference the tagForDecision Field Tag as the input of the Decisions component. The output of the Decisions component then affects all components with the tagForDecision Field Tag.

Save your Field Tags by pressing Enter (Return) or adding a comma after each entry.

Shortcuts Icon Shortcuts

Select this tab to open the list of supported keyboard shortcuts you can use in the component settings modal. Keyboard shortcuts include:

  • Cmd + S (Mac) / Ctrl + S (PC): Save and close the component settings modal.

  • Cmd + G (Mac) / Ctrl + G (PC): Opens a search window to find specific fields and settings in the component settings modal.

  • Tab: Tab to the next field or setting in the component settings modal. This keyboard shortcut tabs left to right and top to bottom.

  • Shift + Tab: Tab to the previous field or setting in the component settings modal. The keyboard shortcut tabs from right to left and bottom to top.

  • Enter (Return): When tabbing to a Tooltip Icon (tooltip), press Enter (Return) to display the field or setting tooltip. Press Enter (Return) again to hide the tooltip.

Additional keyboard shortcuts:

  • Drop-down menus: When you Tab to a settings drop-down, use the keyboard's Up-Arrow Icon (up)/ Down-Arrow icon (down) arrows to make a selection. Then, press Enter (Return) to confirm the selection.

Documentation IconDocumentation

Select this tab to access the component documentation in Unqork's In-Product Help.

Cancel

Click this button to undo any unsaved configuration changes and return to the canvas.

Save & Close

Click this button to save all settings as configured and return to the canvas.

Display Panel

A static image displaying the Browser Storage component's Configuration Window Display settings.(click image to expand)

Setting Description

Canvas Label Text

Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field.

User-friendly labels make your module more accessible. Keep labels short and descriptive (a word or two) using title case. For longer entries, use sentence case.

Data Panel

A static image displaying the Browser Storage component's configuration window Data settings.(click image to expand)

Setting Description

Interaction Type

The Browser Storage component has the following options:

  • Write: This interaction lets you create and update data in the IndexedDB object store. Use the component's Filters table when creating or updating information. If there's information you want updated, enter the Property ID of that information in the Filters table. The component filters on that Property ID and merges or overwrites the information. If there's no match to the Property ID, or the field is blank, the component creates a new submission.

  • Read: This interaction views filtered data. It also searches for individual offline submissions. To find offline data, use the suffix: /display/:formId/local/:namespace/:submissionId, like you do when searching for a specific submission ID. The Namespace is the unique identifier you created for your stored information.

  • Delete: This interaction deletes locally-stored data from the IndexedDB object.

TIP  To learn more about the IndexedDB API, view the following documentation: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

Namespace

A Namespace is required. This is a unique label applied to the information you store in the IndexedDB object. The Read, Write, and Delete interactions happen only to the data entered in the Namespace.

TIP  It's best practice to use your module's unique module ID in the Browser Storage component's Namespace. For example, inspections5ffddf6ae336b802494437c8, where 5ffddf6ae336b802494437c8 is the module ID of the front-end source module. The Namespace is where the source module stored its data on the browser.Only use Property IDs or grid syntax in Input Enter inputs components and actions you want the component to perform. and Output Enter outputs components and actions you want the component to perform. tables, unless referring to nested data in a Plug-In Component.

The Namespace field uses autocomplete to suggest Namespaces used elsewhere in the environment.

Data - Filters Table

A static image displaying the Browser Storage's Data Filter settings.(click image to expand)

Setting Description

Filters

The Browser Storage component's Filters table helps you find information stored in the browser's IndexedDB object store.

Property ID

This is the Property ID of the stored information. Mapping to this Property ID performs the Write, Read, and Delete operations to that data.

TIP  The Property ID entered must match the Property ID used in the input component. Remember, use camel case (stylized as camelCase) without spaces or punctuation.

Set Filter To

This drop-down lets you select how you want to compare the Filter’s Property ID to its Mapping. Your options are: =, <, or >.

Mapping

Mapping describes where in the stored data you're filtering. This mapping information tells the component what data to push to or call when triggered.

Required

If Checked Box Icon (checked), the end-user must enter a value in the field of this input component before the logic component fires.

By default, this setting is ☐ (unchecked).

Exclude

If Checked Box Icon (checked), the filter operation doesn't run when you trigger the Browser Storage component.

By default, this setting is ☐ (unchecked).

Optional

If Checked Box Icon (checked), or if the field has no value, the operation doesn't run when you trigger the Browser Storage component. By default, all inputs in the request body progress, even if the field is empty (null).

By default, this setting is ☐ (unchecked).

Replace

This setting is only available when the Interaction Type is set to Write. If this setting is (ON), the entire data object is replaced when you make changes. If this setting is (OFF), the new data merges into the data object.

By default, this setting is (OFF).

Data - Inputs Table

Input settings are only available for the Write operation.

A static image displaying the Browser Storage component's Data Inputs table.(click image to expand)

Setting Description

Property ID

This Property ID refers to your triggering component. Use this field to enter values that you send to the browser’s IndexedDB object store.

Mapping

API documentation includes mapping information. This mapping information tells the Browser Storage component which information to push or call from the browser's IndexedDB object store.

TIP  You can find the Unqork API documentation here: https://developers.unqork.io/.

Required

If Checked Box Icon (checked), the end-user must enter a value in the field of this input component before the logic component fires.

By default, this setting is ☐ (unchecked).

Exclude

If Checked Box Icon (checked), the component doesn't pass the field as part of the request body of the API call. The component still watches for changes to the value.

By default, this setting is ☐ (unchecked).

Optional

If Checked Box Icon (checked), and the field has no value, the operation doesn't run when triggered. By default, all inputs in the request body work, even if the field is empty (null).

By default, this setting is ☐ (unchecked).

Data - Outputs Table

A static image displaying the Browser Storage component's Data Outputs table.(click image to expand)

Setting Description

Property ID

This Property ID is where you want the component to send the data retrieved from your browser. For your logic component to recognize an output, you must enter the destination component's Property IDs.

TIP  The Property ID you enter must match the Property ID used in the output component. Remember, use camel case (stylized as camelCase) without spaces or punctuation.

Mapping

Map Property IDs according to API specifications. Mapping tells your component what to retrieve from the browser. For example, enter 0.data.storedExample to retrieve the first stored submission. The [0] represents your first saved record, [1] is the second, and so on.

Actions Panel

A static image displaying the Browser Storage component's Configuration Actions settings.(click image to expand)

Triggers

Setting Description

Post

Enter the Property ID of the component that you want to trigger after the Browser Storage component completes the API call. For example, triggering a component to display the data received from the Browser Storage component's API call.

Error

Enter the Property ID of a component that you want to trigger on the failure of the API call.

Advanced Panel

A static image displaying the Browser Storage component's Advanced settings.(click image to expand)

Setting Description

Disable Execution

If Disable Execution is set to (ON), the logic tied to this component does not execute. Use this to keep the component's settings, but disable the operations it performs.

By default, this setting is set to (OFF).

Set Debounce

The number of milliseconds that pass before the module loads this component. This is useful if you have a large module and you load several components at the same time.

NOTE  1,000 milliseconds = 1 second.

Adding a Browser Storage Component

First, configure a survey application for use offline. This survey has fields for a surveyor's name, the date surveyed, and other various criteria. This front-end module lets you input values that a Browser Storage unit writes to the browser cache.

To save you time, this module is prebuilt here: https://training.unqork.io/#/form/5ffddf6ae336b802494437c8/edit.

NOTE  This module is also set up for offline use at the module and environment levels.

This example assumes you have a module saved and with a title.

What You Need

In this lesson, you need:

Preconfiguration

Enabling Environment-Level Offline Access

To enable offline access at the Environment Level for your new module:

1. At the top right of the Unqork Designer Platform, click the Settings drop-down.
2. Click Administration.
3. Under Environment, select Environment Administration.
4. At the bottom of the page, set Enable Offline to Checked Box Icon (checked).

5. Click Save Changes.

Enabling Module-Level Offline Access

To enable offline access at the Module Level for your new module:

1. From the top-right corner of the Module Builder, click ···.
2. Click Settings.
3. Under Online Access, set Cache This Module to Allow for Offline Access to (ON).

4. Click Save.
5. Save your module.

TIP  To learn more about enabling offline access, view our Introduction to Offline Mode article.

Configuration

Configure the initGetOfflineSubmissions Initializer Component

The initGetOfflineSubmissions Radio Button component icon Initializer component triggers the readOfflineSubmissions Browser Storage Icon Browser Storage component to retrieve submission data from the browser.

1. Drag and drop an Radio Button component icon Initializer component onto your canvas.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text fields, enter initGetOfflineSubmissions.
3. From the component's configuration window, select Actions Icon Actions.
4. From the Trigger Type drop-down, select New Submission.
5. In the Outputs table, enter the following:
  Property ID Type Value

1

readOfflineSubmissions

trigger

GO

NOTE  This Property ID matches the Browser Storage component you set up next.

A static image displaying the Initializer component's Acction settings. The Trigger Type is set to New Submission and the  Outputs Table includes a row with the readOfflineSubmissions property ID.

6. Click Save & Close.

Configure the Browser Storage Component

To pull the data from your browser’s storage, use a Browser Storage Icon Browser Storage component. Select the Read interaction to view those offline submissions.

1. Drag and drop a Browser Storage Icon Browser Storage component onto your canvas, placing it below your initGetOfflineSubmissions Radio Button component icon Initializer component.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text fields, enter readOfflineSubmissions.
3. From the component's configuration window, select Data Icon Data.
4. Set the Interaction Type to Read.
5. In the Namespace field, enter inspections64838074792f7aa9e2e027bb.
6. In the Outputs table, enter the following:
  Property ID Mapping

1

hiddenOfflineSubmissions

 

NOTE  This Property ID matches the Hidden component you set up next.

A static image displaying the Browser Storage component's Data Settings. The Interaction type is set to Read, the Namespace is filled, and the Outputs table contains the hiddenOfflineSubmissions Property ID.

7. Click Save & Close.

Configure the Hidden Component

Add a Hidden component to store offline submissions made by the end-user End-users, also known as Express Users, are the individuals accessing an application through Express View. In most cases, end-users are the customers using the product..

1. Drag and drop a Hidden component onto the canvas, placing it below the readOfflineSubmissions Browser Storage Icon Browser Storage component.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text fields, enter hiddenOfflineSubmissions.
3. Click Save & Close.
4. Save your module.

Preview your module in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View., and open the DevTools console. Open the object to see the submission data created from the front-end source module.

Structure of a Browser Storage Component's Data

The IndexedDB stores data in an array of row objects. Each object contains the submission data collected in the front-end module.

A static image displaying the Data Structure of a Browser Storage object.

Resources