Webapp manifest

A webapp manifest is a JSON structure used to build webapps. The target audience for this is developers. In an ideal world developers should be able to build any application by constructing a webapp manifest.

Root level

{
  "version": "2.0",
  "schema": {
    // ...
  }
}
Variable
Required
Description

version

Yes

Signifies which parser to use for this manifest. Valid values are "1.0" and "2.0". Version 2.0 is recommended for new projects.

schema

Yes

Contents of the manifest.

Schema level

{
  "config": {
    "initial_screen": "start",
    "currency_template": "(currency) (amount, 1.2-2, ',', ' ')",
    "date_format": "DD/MM/YYYY",
    "default_values": {
      "data.loss_enabled": true
    },
    "overwrite_values": {
      "data.theft_enabled": true
    },
    "computed_values": {
      "data.policy_start_date": {
        "value": {
          "type": "jsonlogic",
          "schema": {
            "var": "active_policy.quote.customer_input.start_date"
          }
        }
      }
    },
    "requests": [
      {
        "type": "quote"
      },
      {
        "type": "policy",
        "field_definition": [
          {
            "path": "data",
            "name": "optin1",
            "validation": "accepted"
          }
        ]
      },
      {
        "type": "payment"
      }
    ]
  },
  "layout": {
    // ...
  },
  "flow": [
    {
      // ...
    }
  ]
}
Variable
Required
Example
Description

config.initial_screen

Yes

"start"

Unique identifier (path) of the initial screen.

config.currency_template

No

"(currency) (amount, 1.2-2, ',', ' ')"

See currency configuration article for more information.

config.date_format

No

"DD/MM/YYYY"

See date configuration article for more information.

config.default_values

No

{"field":"value"}

Object of default values applied to the form. See default values for special syntax options.

config.overwrite_values

No

{"field":"value"}

Overwrite input state values.

config.computed_values

No

{"field":{"value":{...}}}

Computes values and applies them into input state. See computed values guide for more information.

config.requests

No

[{ ... }]

An array of requests that should be performed for this webapp along with frontend specific field definition (validation rules). If, for example, there are some frontend only specific validation rules, they should be defined here. Other, both backend and frontend validation rules should be defined in the root field definition object (it's not stored in the manifest). More on this in the api requests guide.

config.scroll_into_view_on_edit

No

true

When user clicks "edit" from a summary screen, scroll to the field being edited. Defaults to true.

config.content_key

No

{ "insurer_name": "content.key" }

Global content keys used by components (for example, PayPal content keys). Keys map to content entries in translations.

config.flow_finish_events

No

["policy_purchase"]

Events that mark the flow as finished. When any listed event fires, the flow is treated as complete.

config.update_offer_on_changes

No

false

Automatically update an existing offer when form data changes. Defaults to false. See offers guide for more information.

layout

No

{"custom":{"components":[ ... ]}}

Definitions of the layouts that can be used in webapp flow. See layout guide for more information.

flow

Yes

[{ ... }]

An array of component definitions. See building the flow article for more information.

Default Values

The default_values config allows you to set initial values for form fields. Values can be static or use special syntax for dynamic values.

Static Values

Dynamic Date Values

Use the date: prefix to set date fields dynamically. The value after date: is a date expression.

Basic expressions:

Syntax
Description

date:today

Current date

date:now

Current date and time (ISO datetime format)

date:tomorrow

Tomorrow's date

date:yesterday

Yesterday's date

Relative calculations:

Syntax
Description

date:today +1 day

1 day from today

date:today -7 days

7 days ago

date:today +1 month

1 month from today

date:today -3 months

3 months ago

date:today +1 year

1 year from today

date:1 day from now

1 day from now

date:2 months ago

2 months ago

date:5 years from now

5 years from now

Month boundaries:

Syntax
Description

date:start of current month

First day of current month

date:end of current month

Last day of current month

date:start of next month

First day of next month

date:end of next month

Last day of next month

Year references:

Syntax
Description

date:this year

January 1st of current year

date:next year

January 1st of next year

date:last year

January 1st of last year

Example:

JsonLogic Values

Default values can also be computed dynamically using JsonLogic. This is useful when the default value depends on other input or state.

The JsonLogic expression has access to all standard namespaces including input, quote, policy, flags, etc.

Last updated