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