summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/content-src/asrouter/schemas/FxMSCommon.schema.json
blob: 51dbd3efa652ded51318755ef8c7c0938a2dd80b (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
{
  "description": "Common elements used across FxMS schemas",
  "$id": "file:///FxMSCommon.schema.json",
  "$defs": {
    "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."
        },
        "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": "#/$defs/localizedText"
        }
      ]
    }
  }
}