BackgroundTaskMessagingExperiment.schema.json (11438B)
1 { 2 "$schema": "https://json-schema.org/draft/2019-09/schema", 3 "$id": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json", 4 "title": "Messaging Experiment", 5 "description": "A Firefox Messaging System message.", 6 "if": { 7 "type": "object", 8 "properties": { 9 "template": { 10 "const": "multi" 11 } 12 }, 13 "required": [ 14 "template" 15 ] 16 }, 17 "then": { 18 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/MultiMessage" 19 }, 20 "else": { 21 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/TemplatedMessage" 22 }, 23 "$defs": { 24 "ToastNotification": { 25 "$schema": "https://json-schema.org/draft/2019-09/schema", 26 "$id": "file:///ToastNotification.schema.json", 27 "title": "ToastNotification", 28 "description": "A template for toast notifications displayed by the Alert service.", 29 "allOf": [ 30 { 31 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/Message" 32 } 33 ], 34 "type": "object", 35 "properties": { 36 "content": { 37 "type": "object", 38 "properties": { 39 "title": { 40 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/localizableText", 41 "description": "Id of localized string or message override of toast notification title" 42 }, 43 "body": { 44 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/localizableText", 45 "description": "Id of localized string or message override of toast notification body" 46 }, 47 "icon_url": { 48 "description": "The URL of the image used as an icon of the toast notification.", 49 "type": "string", 50 "format": "moz-url-format" 51 }, 52 "image_url": { 53 "description": "The URL of an image to be displayed as part of the notification.", 54 "type": "string", 55 "format": "moz-url-format" 56 }, 57 "launch_url": { 58 "description": "The URL to launch when the notification or an action button is clicked.", 59 "type": "string", 60 "format": "moz-url-format" 61 }, 62 "launch_action": { 63 "type": "object", 64 "properties": { 65 "type": { 66 "type": "string", 67 "description": "The launch action to be performed when Firefox is launched." 68 }, 69 "data": { 70 "type": "object" 71 } 72 }, 73 "required": [ 74 "type" 75 ], 76 "additionalProperties": true 77 }, 78 "requireInteraction": { 79 "type": "boolean", 80 "description": "Whether the toast notification should remain active until the user clicks or dismisses it, rather than closing automatically." 81 }, 82 "tag": { 83 "type": "string", 84 "description": "An identifying tag for the toast notification." 85 }, 86 "data": { 87 "type": "object", 88 "description": "Arbitrary data associated with the toast notification." 89 }, 90 "actions": { 91 "type": "array", 92 "items": { 93 "type": "object", 94 "properties": { 95 "title": { 96 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/localizableText", 97 "description": "The action text to be shown to the user." 98 }, 99 "action": { 100 "type": "string", 101 "description": "Opaque identifer that identifies action." 102 }, 103 "iconURL": { 104 "type": "string", 105 "format": "uri", 106 "description": "URL of an icon to display with the action." 107 }, 108 "windowsSystemActivationType": { 109 "type": "boolean", 110 "description": "Whether to have Windows process the given `action`." 111 }, 112 "launch_action": { 113 "type": "object", 114 "properties": { 115 "type": { 116 "type": "string", 117 "description": "The launch action to be performed when Firefox is launched." 118 }, 119 "data": { 120 "type": "object" 121 } 122 }, 123 "required": [ 124 "type" 125 ], 126 "additionalProperties": true 127 } 128 }, 129 "required": [ 130 "action", 131 "title" 132 ], 133 "additionalProperties": true 134 } 135 } 136 }, 137 "additionalProperties": true, 138 "required": [ 139 "title", 140 "body" 141 ] 142 }, 143 "template": { 144 "type": "string", 145 "const": "toast_notification" 146 } 147 }, 148 "required": [ 149 "content", 150 "targeting", 151 "template", 152 "trigger" 153 ], 154 "additionalProperties": true 155 }, 156 "Message": { 157 "type": "object", 158 "properties": { 159 "id": { 160 "type": "string", 161 "description": "The message identifier" 162 }, 163 "groups": { 164 "description": "Array of preferences used to control `enabled` status of the group. If any is `false` the group is disabled.", 165 "type": "array", 166 "items": { 167 "type": "string", 168 "description": "Preference name" 169 } 170 }, 171 "template": { 172 "type": "string", 173 "description": "Which messaging template this message is using.", 174 "enum": [ 175 "toast_notification" 176 ] 177 }, 178 "frequency": { 179 "type": "object", 180 "description": "An object containing frequency cap information for a message.", 181 "properties": { 182 "lifetime": { 183 "type": "integer", 184 "description": "The maximum lifetime impressions for a message.", 185 "minimum": 1, 186 "maximum": 100 187 }, 188 "custom": { 189 "type": "array", 190 "description": "An array of custom frequency cap definitions.", 191 "items": { 192 "description": "A frequency cap definition containing time and max impression information", 193 "type": "object", 194 "properties": { 195 "period": { 196 "type": "integer", 197 "description": "Period of time in milliseconds (e.g. 86400000 for one day)" 198 }, 199 "cap": { 200 "type": "integer", 201 "description": "The maximum impressions for the message within the defined period.", 202 "minimum": 1, 203 "maximum": 100 204 } 205 }, 206 "required": [ 207 "period", 208 "cap" 209 ] 210 } 211 } 212 } 213 }, 214 "priority": { 215 "description": "The priority of the message. If there are two competing messages to show, the one with the highest priority will be shown", 216 "type": "integer" 217 }, 218 "order": { 219 "description": "The order in which messages should be shown. Messages will be shown in increasing order.", 220 "type": "integer" 221 }, 222 "targeting": { 223 "description": "A JEXL expression representing targeting information", 224 "type": "string" 225 }, 226 "trigger": { 227 "description": "An action to trigger potentially showing the message", 228 "type": "object", 229 "properties": { 230 "id": { 231 "type": "string", 232 "description": "A string identifying the trigger action" 233 }, 234 "params": { 235 "type": "array", 236 "description": "An optional array of string parameters for the trigger action", 237 "items": { 238 "anyOf": [ 239 { 240 "type": "integer" 241 }, 242 { 243 "type": "string" 244 } 245 ] 246 } 247 } 248 }, 249 "required": [ 250 "id" 251 ] 252 }, 253 "provider": { 254 "description": "An identifier for the provider of this message, such as \"cfr\" or \"preview\".", 255 "type": "string" 256 } 257 }, 258 "additionalProperties": true, 259 "dependentRequired": { 260 "content": [ 261 "id", 262 "template" 263 ], 264 "template": [ 265 "id", 266 "content" 267 ] 268 } 269 }, 270 "localizedText": { 271 "type": "object", 272 "properties": { 273 "string_id": { 274 "description": "Id of localized string to be rendered.", 275 "type": "string" 276 } 277 }, 278 "required": [ 279 "string_id" 280 ] 281 }, 282 "localizableText": { 283 "description": "Either a raw string or an object containing the string_id of the localized text", 284 "oneOf": [ 285 { 286 "type": "string", 287 "description": "The string to be rendered." 288 }, 289 { 290 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/localizedText" 291 } 292 ] 293 }, 294 "TemplatedMessage": { 295 "description": "An FxMS message of one of a variety of types.", 296 "type": "object", 297 "allOf": [ 298 { 299 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/Message" 300 }, 301 { 302 "if": { 303 "type": "object", 304 "properties": { 305 "template": { 306 "type": "string", 307 "enum": [ 308 "toast_notification" 309 ] 310 } 311 }, 312 "required": [ 313 "template" 314 ] 315 }, 316 "then": { 317 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/ToastNotification" 318 } 319 } 320 ] 321 }, 322 "MultiMessage": { 323 "description": "An object containing an array of messages.", 324 "type": "object", 325 "properties": { 326 "template": { 327 "type": "string", 328 "const": "multi" 329 }, 330 "messages": { 331 "type": "array", 332 "description": "An array of messages.", 333 "items": { 334 "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/TemplatedMessage" 335 } 336 } 337 }, 338 "required": [ 339 "template", 340 "messages" 341 ] 342 } 343 } 344 }