{ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "file:///InfoBar.schema.json", "title": "InfoBar", "description": "A template with an image, test and buttons.", "allOf": [{ "$ref": "file:///FxMSCommon.schema.json#/$defs/Message" }], "type": "object", "properties": { "content": { "type": "object", "properties": { "type": { "type": "string", "description": "Specifies where the message should appear and persist: 'global' (persists across tabs in the current window), 'tab' (only visible in the current tab), or 'universal' (visible across all tabs and windows, current and future).", "enum": ["global", "tab", "universal"] }, "text": { "description": "Either a single localizableText, or an array of raw strings and/or localizableText objects. localizableText can contain an optional href property for the text to be rendered as a link.", "oneOf": [ { "$ref": "#/$defs/plainText" }, { "allOf": [ { "allOf": [ { "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText" }, { "not": { "required": ["href"] } }, { "type": "object", "description": "Additional arguments, only a `where` override is currently allowed", "properties": { "args": { "type": "object", "description": "Where to open ('tab', 'tabshifted', 'current', etc.)", "properties": { "where": { "type": "string", "description": "Where to open - e.g. 'tab', 'window', etc." } }, "additionalProperties": false } }, "additionalProperties": true } ] } ] }, { "$ref": "#/$defs/localizableTextWithHref" }, { "$ref": "#/$defs/rawTextWithHref" }, { "type": "array", "items": { "oneOf": [ { "$ref": "#/$defs/plainText" }, { "allOf": [ { "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText" }, { "not": { "required": ["href"] } } ] }, { "$ref": "#/$defs/localizableTextWithHref" }, { "$ref": "#/$defs/rawTextWithHref" } ] } } ] }, "priority": { "description": "Infobar priority level https://searchfox.org/mozilla-central/rev/3aef835f6cb12e607154d56d68726767172571e4/toolkit/content/widgets/notificationbox.js#387", "type": "number", "minumum": 0, "exclusiveMaximum": 10 }, "dismissable": { "description": "Should the infobar include an X dismiss button, defaults to true", "type": "boolean" }, "dismissOnPrefChange": { "description": "If set, one or more prefs to observe. The infobar will automatically dismiss when any of these prefs is set for the first time or when its value changes.", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true } ] }, "impression_action": { "oneOf": [ { "$ref": "#/$defs/impressionActionItem" }, { "type": "object", "properties": { "type": { "const": "MULTI_ACTION" }, "orderedExecution": { "type": "boolean" }, "data": { "type": "object", "properties": { "actions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/impressionActionItem" } } }, "required": ["actions"], "additionalProperties": false } }, "required": ["type", "data"], "additionalProperties": false } ] }, "dismiss_action": { "description": "Optional Special Message Action dispatched via dispatchUserAction when the user dismisses the infobar (X button). Any action type is allowed, including MULTI_ACTION, which SpecialMessageActions unpacks natively.", "type": "object", "properties": { "type": { "type": "string", "description": "SpecialMessageActions action type" }, "data": { "type": "object" } }, "required": ["type"], "additionalProperties": true }, "canReplace": { "description": "IDs of other infobar messages this infobar may replace", "type": "array", "items": { "type": "string" }, "minItems": 1 }, "buttons": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "A stable identifier for this button, reported as `event_context.source` on click telemetry. Defaults to `button_` when omitted." }, "label": { "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText", "description": "The text label of the button." }, "primary": { "type": "boolean", "description": "Is this the primary button?" }, "accessKey": { "type": "string", "description": "Keyboard shortcut letter." }, "action": { "type": "object", "properties": { "dismiss": { "type": "boolean", "description": "Should the infobar be dismissed when the action is dispatched, defaults to true" }, "type": { "type": "string", "description": "Action dispatched by the button." }, "data": { "type": "object" } }, "required": ["type"], "additionalProperties": true }, "supportPage": { "type": "string", "description": "A page title on SUMO to link to" } }, "required": ["label", "action"], "additionalProperties": true } }, "linkUrls": { "description": "Map of Fluent data-l10n-name keys to real URLs", "type": "object", "additionalProperties": { "$ref": "#/$defs/linkUrl" } }, "linkActions": { "description": "Map of Fluent data-l10n-name keys to a Special Message Action dispatched when the link is clicked (in addition to opening the URL).", "type": "object", "additionalProperties": { "type": "object", "properties": { "type": { "type": "string", "description": "SpecialMessageActions action type" }, "data": { "type": "object" }, "dismiss": { "type": "boolean", "description": "If true, dismiss the infobar after handling this link's action. Defaults to false." } }, "required": ["type"] } }, "style": { "description": "Optional CSS overrides for this infobar. Currently, only `background-color` and `font-size` may be set. `background-color` will only apply when the user does not prefer high-contrast.", "type": "object", "properties": { "background-color": { "type": "string", "description": "Any valid CSS color or light-dark() expression." }, "font-size": { "type": "string", "description": "Any valid CSS font-size value - rem units recommended to ensure size is relative to the system font size." } }, "additionalProperties": false } }, "additionalProperties": true, "required": ["text", "buttons"] }, "template": { "type": "string", "const": "infobar" } }, "additionalProperties": true, "required": ["targeting", "trigger"], "$defs": { "plainText": { "description": "Plain text (no HTML allowed)", "type": "string" }, "linkUrl": { "description": "Target for links or buttons", "type": "string", "format": "uri" }, "localizableTextWithHref": { "description": "Everything a localizableText allows, plus a required href", "allOf": [ { "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText" }, { "type": "object", "properties": { "href": { "$ref": "#/$defs/linkUrl" } }, "required": ["href"], "additionalProperties": true } ] }, "rawTextWithHref": { "description": "A literal text chunk that must include href", "type": "object", "properties": { "raw": { "type": "string" }, "href": { "$ref": "#/$defs/linkUrl" } }, "required": ["raw", "href"], "additionalProperties": false }, "impressionActionItem": { "type": "object", "properties": { "type": { "const": "SET_PREF" }, "once": { "type": "boolean", "description": "If true, only fire on first impression." }, "data": { "type": "object", "properties": { "pref": { "type": "object", "properties": { "name": { "type": "string" }, "value": {} }, "required": ["name"] } }, "required": ["pref"], "additionalProperties": false } }, "required": ["type", "data"], "additionalProperties": false } } }