webext-schema 4.1.3 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -620,31 +620,35 @@ export const setSessionWindowValue = async (key, value, windowId) => {
620
620
  /**
621
621
  * clear storage
622
622
  *
623
+ * @param {string} area - storage area
623
624
  * @returns {void}
624
625
  */
625
- export const clearStorage = async () => {
626
+ export const clearStorage = async (area = 'local') => {
626
627
  const isGranted = await isPermissionGranted({
627
628
  permissions: ['storage']
628
629
  });
629
- if (isGranted) {
630
+ const areas = ['local', 'session', 'sync'];
631
+ if (isGranted && areas.includes(area)) {
630
632
  const { storage } = browser;
631
- await storage.local.clear();
633
+ await storage[area]?.clear();
632
634
  }
633
635
  };
634
636
 
635
637
  /**
636
638
  * get all storage
637
639
  *
640
+ * @param {string} area - storage area
638
641
  * @returns {object} - stored data
639
642
  */
640
- export const getAllStorage = async () => {
643
+ export const getAllStorage = async (area = 'local') => {
641
644
  const isGranted = await isPermissionGranted({
642
645
  permissions: ['storage']
643
646
  });
647
+ const areas = ['local', 'managed', 'session', 'sync'];
644
648
  let data;
645
- if (isGranted) {
649
+ if (isGranted && areas.includes(area)) {
646
650
  const { storage } = browser;
647
- data = await storage.local.get();
651
+ data = await storage[area]?.get();
648
652
  }
649
653
  return data || null;
650
654
  };
@@ -653,16 +657,18 @@ export const getAllStorage = async () => {
653
657
  * get storage
654
658
  *
655
659
  * @param {*} key - key
660
+ * @param {string} area - storage area
656
661
  * @returns {object} - stored data
657
662
  */
658
- export const getStorage = async key => {
663
+ export const getStorage = async (key, area = 'local') => {
659
664
  const isGranted = await isPermissionGranted({
660
665
  permissions: ['storage']
661
666
  });
667
+ const areas = ['local', 'managed', 'session', 'sync'];
662
668
  let data;
663
- if (isGranted) {
669
+ if (isGranted && areas.includes(area)) {
664
670
  const { storage } = browser;
665
- data = await storage.local.get(key);
671
+ data = await storage[area]?.get(key);
666
672
  }
667
673
  return data || null;
668
674
  };
@@ -671,15 +677,17 @@ export const getStorage = async key => {
671
677
  * remove storage
672
678
  *
673
679
  * @param {*} key - key
680
+ * @param {string} area - storage area
674
681
  * @returns {void}
675
682
  */
676
- export const removeStorage = async key => {
683
+ export const removeStorage = async (key, area = 'local') => {
677
684
  const isGranted = await isPermissionGranted({
678
685
  permissions: ['storage']
679
686
  });
680
- if (isGranted) {
687
+ const areas = ['local', 'session', 'sync'];
688
+ if (isGranted && areas.includes(area)) {
681
689
  const { storage } = browser;
682
- await storage.local.remove(key);
690
+ await storage[area]?.remove(key);
683
691
  }
684
692
  };
685
693
 
@@ -687,15 +695,17 @@ export const removeStorage = async key => {
687
695
  * set storage
688
696
  *
689
697
  * @param {object} obj - object to store
698
+ * @param {string} area - storage area
690
699
  * @returns {void}
691
700
  */
692
- export const setStorage = async obj => {
701
+ export const setStorage = async (obj, area = 'local') => {
693
702
  const isGranted = await isPermissionGranted({
694
703
  permissions: ['storage']
695
704
  });
696
- if (isGranted && obj) {
705
+ const areas = ['local', 'session', 'sync'];
706
+ if (isGranted && obj && areas.includes(area)) {
697
707
  const { storage } = browser;
698
- await storage.local.set(obj);
708
+ await storage[area]?.set(obj);
699
709
  }
700
710
  };
701
711
 
@@ -844,8 +854,12 @@ export const getActiveTabId = async windowId => {
844
854
  if (!Number.isInteger(windowId)) {
845
855
  windowId = windows.WINDOW_ID_CURRENT;
846
856
  }
847
- const { id } = await getActiveTab(windowId);
848
- return id;
857
+ const tab = await getActiveTab(windowId);
858
+ let tabId;
859
+ if (tab) {
860
+ tabId = tab.id;
861
+ }
862
+ return Number.isInteger(tabId) ? tabId : null;
849
863
  };
850
864
 
851
865
  /**
package/package.json CHANGED
@@ -38,15 +38,15 @@
38
38
  "devDependencies": {
39
39
  "c8": "^7.12.0",
40
40
  "chai": "^4.3.6",
41
- "eslint": "^8.21.0",
41
+ "eslint": "^8.22.0",
42
42
  "eslint-config-standard": "^17.0.0",
43
43
  "eslint-plugin-import": "^2.26.0",
44
- "eslint-plugin-jsdoc": "^39.3.4",
44
+ "eslint-plugin-jsdoc": "^39.3.6",
45
45
  "eslint-plugin-node": "^11.1.0",
46
46
  "eslint-plugin-promise": "^6.0.0",
47
47
  "mocha": "^10.0.0",
48
48
  "nock": "^13.2.9",
49
49
  "npm-run-all": "^4.1.5"
50
50
  },
51
- "version": "4.1.3"
51
+ "version": "4.2.0"
52
52
  }
@@ -9620,6 +9620,154 @@
9620
9620
  ]
9621
9621
  }
9622
9622
  ],
9623
+ "declarative_net_request.json": [
9624
+ {
9625
+ "namespace": "manifest",
9626
+ "types": [
9627
+ {
9628
+ "$extend": "Permission",
9629
+ "choices": [
9630
+ {
9631
+ "type": "string",
9632
+ "enum": [
9633
+ "declarativeNetRequest"
9634
+ ],
9635
+ "min_manifest_version": 3
9636
+ }
9637
+ ]
9638
+ },
9639
+ {
9640
+ "$extend": "PermissionNoPrompt",
9641
+ "choices": [
9642
+ {
9643
+ "type": "string",
9644
+ "enum": [
9645
+ "declarativeNetRequestFeedback",
9646
+ "declarativeNetRequestWithHostAccess"
9647
+ ],
9648
+ "min_manifest_version": 3
9649
+ }
9650
+ ]
9651
+ }
9652
+ ]
9653
+ },
9654
+ {
9655
+ "namespace": "declarativeNetRequest",
9656
+ "description": "Use the declarativeNetRequest API to block or modify network requests by specifying declarative rules.",
9657
+ "permissions": [
9658
+ "declarativeNetRequest",
9659
+ "declarativeNetRequestWithHostAccess"
9660
+ ],
9661
+ "types": [
9662
+ {
9663
+ "id": "ResourceType",
9664
+ "type": "string",
9665
+ "description": "How the requested resource will be used. Comparable to the webRequest.ResourceType type.",
9666
+ "enum": [
9667
+ "main_frame",
9668
+ "sub_frame",
9669
+ "stylesheet",
9670
+ "script",
9671
+ "image",
9672
+ "object",
9673
+ "object_subrequest",
9674
+ "xmlhttprequest",
9675
+ "xslt",
9676
+ "ping",
9677
+ "beacon",
9678
+ "xml_dtd",
9679
+ "font",
9680
+ "media",
9681
+ "websocket",
9682
+ "csp_report",
9683
+ "imageset",
9684
+ "web_manifest",
9685
+ "speculative",
9686
+ "other"
9687
+ ]
9688
+ },
9689
+ {
9690
+ "id": "MatchedRule",
9691
+ "type": "object",
9692
+ "properties": {
9693
+ "ruleId": {
9694
+ "type": "integer",
9695
+ "description": "A matching rule's ID."
9696
+ },
9697
+ "rulesetId": {
9698
+ "type": "string",
9699
+ "description": "ID of the Ruleset this rule belongs to."
9700
+ }
9701
+ }
9702
+ }
9703
+ ],
9704
+ "functions": [
9705
+ {
9706
+ "name": "testMatchOutcome",
9707
+ "type": "function",
9708
+ "description": "Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request.",
9709
+ "permissions": [
9710
+ "declarativeNetRequestFeedback"
9711
+ ],
9712
+ "async": "callback",
9713
+ "parameters": [
9714
+ {
9715
+ "name": "request",
9716
+ "type": "object",
9717
+ "description": "The details of the request to test.",
9718
+ "properties": {
9719
+ "url": {
9720
+ "type": "string",
9721
+ "description": "The URL of the hypothetical request."
9722
+ },
9723
+ "initiator": {
9724
+ "type": "string",
9725
+ "description": "The initiator URL (if any) for the hypothetical request.",
9726
+ "optional": true
9727
+ },
9728
+ "method": {
9729
+ "type": "string",
9730
+ "description": "Standard HTTP method of the hypothetical request.",
9731
+ "optional": true,
9732
+ "default": "get"
9733
+ },
9734
+ "type": {
9735
+ "$ref": "ResourceType",
9736
+ "description": "The resource type of the hypothetical request."
9737
+ },
9738
+ "tabId": {
9739
+ "type": "integer",
9740
+ "description": "The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. Default is -1, meaning that the request isn't related to a tab.",
9741
+ "optional": true,
9742
+ "default": -1
9743
+ }
9744
+ }
9745
+ },
9746
+ {
9747
+ "name": "callback",
9748
+ "type": "function",
9749
+ "description": "Called with the details of matched rules.",
9750
+ "parameters": [
9751
+ {
9752
+ "name": "result",
9753
+ "type": "object",
9754
+ "properties": {
9755
+ "matchedRules": {
9756
+ "type": "array",
9757
+ "description": "The rules (if any) that match the hypothetical request.",
9758
+ "items": {
9759
+ "$ref": "MatchedRule"
9760
+ }
9761
+ }
9762
+ }
9763
+ }
9764
+ ]
9765
+ }
9766
+ ]
9767
+ }
9768
+ ]
9769
+ }
9770
+ ],
9623
9771
  "dns.json": [
9624
9772
  {
9625
9773
  "namespace": "manifest",
@@ -11577,7 +11725,6 @@
11577
11725
  "enum": [
11578
11726
  "java",
11579
11727
  "js",
11580
- "leaf",
11581
11728
  "mainthreadio",
11582
11729
  "fileio",
11583
11730
  "fileioall",
@@ -3991,64 +3991,79 @@
3991
3991
  {
3992
3992
  "namespace": "manifest",
3993
3993
  "types": [
3994
+ {
3995
+ "id": "ActionManifest",
3996
+ "type": "object",
3997
+ "additionalProperties": {
3998
+ "$ref": "UnrecognizedProperty"
3999
+ },
4000
+ "properties": {
4001
+ "default_label": {
4002
+ "type": "string",
4003
+ "description": "The label of the action, defaults to its title. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback.",
4004
+ "optional": true,
4005
+ "preprocess": "localize"
4006
+ },
4007
+ "default_title": {
4008
+ "type": "string",
4009
+ "description": "The title of the action. This shows up in the tooltip and the label. Defaults to the add-on name.",
4010
+ "optional": true,
4011
+ "preprocess": "localize"
4012
+ },
4013
+ "default_icon": {
4014
+ "$ref": "IconPath",
4015
+ "description": "The icon for the action.",
4016
+ "optional": true
4017
+ },
4018
+ "theme_icons": {
4019
+ "type": "array",
4020
+ "optional": true,
4021
+ "minItems": 1,
4022
+ "items": {
4023
+ "$ref": "ThemeIcons"
4024
+ },
4025
+ "description": "Specifies dark and light icons to be used with themes. The ``light`` icon is used on dark backgrounds and vice versa. **Note:** The default theme uses the ``default_icon`` for light backgrounds (if specified)."
4026
+ },
4027
+ "default_popup": {
4028
+ "type": "string",
4029
+ "format": "relativeUrl",
4030
+ "optional": true,
4031
+ "description": "The html document to be opened as a popup when the user clicks on the action's icon.",
4032
+ "preprocess": "localize"
4033
+ },
4034
+ "browser_style": {
4035
+ "type": "boolean",
4036
+ "optional": true,
4037
+ "description": "Enable browser styles. See the `MDN documentation on browser styles <https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles>`__ for more information.",
4038
+ "default": false
4039
+ },
4040
+ "default_area": {
4041
+ "description": "Defines the location the action will appear. The default location is ``maintoolbar``.",
4042
+ "type": "string",
4043
+ "enum": [
4044
+ "maintoolbar",
4045
+ "tabstoolbar"
4046
+ ],
4047
+ "optional": true
4048
+ }
4049
+ }
4050
+ },
4051
+ {
4052
+ "$extend": "WebExtensionManifest",
4053
+ "properties": {
4054
+ "action": {
4055
+ "min_manifest_version": 3,
4056
+ "$ref": "ActionManifest",
4057
+ "optional": true
4058
+ }
4059
+ }
4060
+ },
3994
4061
  {
3995
4062
  "$extend": "WebExtensionManifest",
3996
4063
  "properties": {
3997
4064
  "browser_action": {
3998
- "type": "object",
3999
- "additionalProperties": {
4000
- "$ref": "UnrecognizedProperty"
4001
- },
4002
- "properties": {
4003
- "default_label": {
4004
- "type": "string",
4005
- "description": "The label of the browserAction, defaults to its title. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback.",
4006
- "optional": true,
4007
- "preprocess": "localize"
4008
- },
4009
- "default_title": {
4010
- "type": "string",
4011
- "description": "The title of the browserAction. This shows up in the tooltip and the label. Defaults to the add-on name.",
4012
- "optional": true,
4013
- "preprocess": "localize"
4014
- },
4015
- "default_icon": {
4016
- "$ref": "IconPath",
4017
- "description": "The icon for the messageDisplayAction.",
4018
- "optional": true
4019
- },
4020
- "theme_icons": {
4021
- "type": "array",
4022
- "optional": true,
4023
- "minItems": 1,
4024
- "items": {
4025
- "$ref": "ThemeIcons"
4026
- },
4027
- "description": "Specifies dark and light icons to be used with themes. The ``light`` icon is used on dark backgrounds and vice versa. **Note:** The default theme uses the ``default_icon`` for light backgrounds (if specified)."
4028
- },
4029
- "default_popup": {
4030
- "type": "string",
4031
- "format": "relativeUrl",
4032
- "optional": true,
4033
- "description": "The html document to be opened as a popup when the user clicks on the browserAction's icon.",
4034
- "preprocess": "localize"
4035
- },
4036
- "browser_style": {
4037
- "type": "boolean",
4038
- "optional": true,
4039
- "description": "Enable browser styles. See the `MDN documentation on browser styles <https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles>`__ for more information.",
4040
- "default": false
4041
- },
4042
- "default_area": {
4043
- "description": "Defines the location the browserAction will appear. The default location is ``maintoolbar``.",
4044
- "type": "string",
4045
- "enum": [
4046
- "maintoolbar",
4047
- "tabstoolbar"
4048
- ],
4049
- "optional": true
4050
- }
4051
- },
4065
+ "max_manifest_version": 2,
4066
+ "$ref": "ActionManifest",
4052
4067
  "optional": true
4053
4068
  }
4054
4069
  }
@@ -4056,11 +4071,13 @@
4056
4071
  ]
4057
4072
  },
4058
4073
  {
4059
- "namespace": "browserAction",
4060
- "description": "Use a browserAction to put an icon in the mail window toolbar. In addition to its icon, a browserAction can also have a tooltip, a badge, and a popup. This namespace is called browserAction for compatibility with browser WebExtensions.",
4074
+ "namespace": "action",
4075
+ "description": "Use an action to put an icon in the mail window toolbar. In addition to its icon, an action can also have a tooltip, a badge, and a popup.",
4061
4076
  "permissions": [
4077
+ "manifest:action",
4062
4078
  "manifest:browser_action"
4063
4079
  ],
4080
+ "min_manifest_version": 3,
4064
4081
  "types": [
4065
4082
  {
4066
4083
  "id": "Details",
@@ -4144,7 +4161,7 @@
4144
4161
  {
4145
4162
  "name": "setTitle",
4146
4163
  "type": "function",
4147
- "description": "Sets the title of the browserAction. This shows up in the tooltip and the label. Defaults to the add-on name.",
4164
+ "description": "Sets the title of the action. This shows up in the tooltip and the label. Defaults to the add-on name.",
4148
4165
  "async": "callback",
4149
4166
  "parameters": [
4150
4167
  {
@@ -4161,7 +4178,7 @@
4161
4178
  "type": "null"
4162
4179
  }
4163
4180
  ],
4164
- "description": "The string the browserAction should display as its label and when moused over."
4181
+ "description": "The string the action should display as its label and when moused over."
4165
4182
  }
4166
4183
  }
4167
4184
  },
@@ -4176,7 +4193,7 @@
4176
4193
  {
4177
4194
  "name": "getTitle",
4178
4195
  "type": "function",
4179
- "description": "Gets the title of the browserAction.",
4196
+ "description": "Gets the title of the action.",
4180
4197
  "async": "callback",
4181
4198
  "parameters": [
4182
4199
  {
@@ -4198,7 +4215,7 @@
4198
4215
  {
4199
4216
  "name": "setLabel",
4200
4217
  "type": "function",
4201
- "description": "Sets the label of the browserAction, defaults to its title. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback.",
4218
+ "description": "Sets the label of the action, defaults to its title. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback.",
4202
4219
  "async": "callback",
4203
4220
  "parameters": [
4204
4221
  {
@@ -4215,7 +4232,7 @@
4215
4232
  "type": "null"
4216
4233
  }
4217
4234
  ],
4218
- "description": "The string the browserAction should use as label. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback."
4235
+ "description": "The string the action should use as label. Can be set to an empty string to not display any label. If the containing toolbar is configured to display text only, the title will be used as fallback."
4219
4236
  }
4220
4237
  }
4221
4238
  },
@@ -4230,7 +4247,7 @@
4230
4247
  {
4231
4248
  "name": "getLabel",
4232
4249
  "type": "function",
4233
- "description": "Gets the label of the browserAction.",
4250
+ "description": "Gets the label of the action.",
4234
4251
  "async": "callback",
4235
4252
  "parameters": [
4236
4253
  {
@@ -4252,7 +4269,7 @@
4252
4269
  {
4253
4270
  "name": "setIcon",
4254
4271
  "type": "function",
4255
- "description": "Sets the icon for the browserAction. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
4272
+ "description": "Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
4256
4273
  "async": "callback",
4257
4274
  "parameters": [
4258
4275
  {
@@ -4297,7 +4314,7 @@
4297
4314
  {
4298
4315
  "name": "setPopup",
4299
4316
  "type": "function",
4300
- "description": "Sets the html document to be opened as a popup when the user clicks on the browserAction's icon.",
4317
+ "description": "Sets the html document to be opened as a popup when the user clicks on the action's icon.",
4301
4318
  "async": "callback",
4302
4319
  "parameters": [
4303
4320
  {
@@ -4329,7 +4346,7 @@
4329
4346
  {
4330
4347
  "name": "getPopup",
4331
4348
  "type": "function",
4332
- "description": "Gets the html document set as the popup for this browserAction.",
4349
+ "description": "Gets the html document set as the popup for this action.",
4333
4350
  "async": "callback",
4334
4351
  "parameters": [
4335
4352
  {
@@ -4351,7 +4368,7 @@
4351
4368
  {
4352
4369
  "name": "setBadgeText",
4353
4370
  "type": "function",
4354
- "description": "Sets the badge text for the browserAction. The badge is displayed on top of the icon.",
4371
+ "description": "Sets the badge text for the action. The badge is displayed on top of the icon.",
4355
4372
  "async": "callback",
4356
4373
  "parameters": [
4357
4374
  {
@@ -4383,7 +4400,7 @@
4383
4400
  {
4384
4401
  "name": "getBadgeText",
4385
4402
  "type": "function",
4386
- "description": "Gets the badge text of the browserAction. If no tab nor window is specified, the global badge text is returned.",
4403
+ "description": "Gets the badge text of the action. If no tab nor window is specified, the global badge text is returned.",
4387
4404
  "async": "callback",
4388
4405
  "parameters": [
4389
4406
  {
@@ -4440,7 +4457,7 @@
4440
4457
  {
4441
4458
  "name": "getBadgeBackgroundColor",
4442
4459
  "type": "function",
4443
- "description": "Gets the background color of the browserAction.",
4460
+ "description": "Gets the background color of the action.",
4444
4461
  "async": "callback",
4445
4462
  "parameters": [
4446
4463
  {
@@ -4462,7 +4479,7 @@
4462
4479
  {
4463
4480
  "name": "enable",
4464
4481
  "type": "function",
4465
- "description": "Enables the browserAction for a tab. By default, a browserAction is enabled.",
4482
+ "description": "Enables the action for a tab. By default, an action is enabled.",
4466
4483
  "async": "callback",
4467
4484
  "parameters": [
4468
4485
  {
@@ -4470,7 +4487,7 @@
4470
4487
  "optional": true,
4471
4488
  "name": "tabId",
4472
4489
  "minimum": 0,
4473
- "description": "The id of the tab for which you want to modify the browserAction."
4490
+ "description": "The id of the tab for which you want to modify the action."
4474
4491
  },
4475
4492
  {
4476
4493
  "type": "function",
@@ -4483,7 +4500,7 @@
4483
4500
  {
4484
4501
  "name": "disable",
4485
4502
  "type": "function",
4486
- "description": "Disables the browserAction for a tab.",
4503
+ "description": "Disables the action for a tab.",
4487
4504
  "async": "callback",
4488
4505
  "parameters": [
4489
4506
  {
@@ -4491,7 +4508,7 @@
4491
4508
  "optional": true,
4492
4509
  "name": "tabId",
4493
4510
  "minimum": 0,
4494
- "description": "The id of the tab for which you want to modify the browserAction."
4511
+ "description": "The id of the tab for which you want to modify the action."
4495
4512
  },
4496
4513
  {
4497
4514
  "type": "function",
@@ -4504,7 +4521,7 @@
4504
4521
  {
4505
4522
  "name": "isEnabled",
4506
4523
  "type": "function",
4507
- "description": "Checks whether the browserAction is enabled.",
4524
+ "description": "Checks whether the action is enabled.",
4508
4525
  "async": "callback",
4509
4526
  "parameters": [
4510
4527
  {
@@ -4536,7 +4553,7 @@
4536
4553
  {
4537
4554
  "name": "onClicked",
4538
4555
  "type": "function",
4539
- "description": "Fired when a browserAction icon is clicked. This event will not fire if the browserAction has a popup. This is a user input event handler. For asynchronous listeners some `restrictions <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions>`__ apply.",
4556
+ "description": "Fired when an action icon is clicked. This event will not fire if the action has a popup. This is a user input event handler. For asynchronous listeners some `restrictions <https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/User_actions>`__ apply.",
4540
4557
  "parameters": [
4541
4558
  {
4542
4559
  "name": "tab",
@@ -4550,6 +4567,15 @@
4550
4567
  ]
4551
4568
  }
4552
4569
  ]
4570
+ },
4571
+ {
4572
+ "namespace": "browserAction",
4573
+ "permissions": [
4574
+ "manifest:action",
4575
+ "manifest:browser_action"
4576
+ ],
4577
+ "max_manifest_version": 2,
4578
+ "$import": "action"
4553
4579
  }
4554
4580
  ],
4555
4581
  "chrome_settings_overrides.json": [
@@ -5621,6 +5647,91 @@
5621
5647
  }
5622
5648
  }
5623
5649
  },
5650
+ {
5651
+ "name": "onAfterSend",
5652
+ "type": "function",
5653
+ "description": "Fired when sending a message succeeded or failed.",
5654
+ "permissions": [
5655
+ "compose"
5656
+ ],
5657
+ "parameters": [
5658
+ {
5659
+ "name": "tab",
5660
+ "$ref": "tabs.Tab"
5661
+ },
5662
+ {
5663
+ "name": "sendInfo",
5664
+ "type": "object",
5665
+ "properties": {
5666
+ "mode": {
5667
+ "type": "string",
5668
+ "description": "The used send mode.",
5669
+ "enum": [
5670
+ "sendNow",
5671
+ "sendLater"
5672
+ ]
5673
+ },
5674
+ "error": {
5675
+ "type": "string",
5676
+ "description": "An error description, if sending the message failed.",
5677
+ "optional": true
5678
+ },
5679
+ "headerMessageId": {
5680
+ "type": "string",
5681
+ "description": "The header messageId of the outgoing message. Only included for actually sent messages.",
5682
+ "optional": true
5683
+ },
5684
+ "messages": {
5685
+ "type": "array",
5686
+ "items": {
5687
+ "$ref": "messages.MessageHeader"
5688
+ },
5689
+ "description": "Copies of the sent message. The number of created copies depends on the applied file carbon copy configuration (fcc)."
5690
+ }
5691
+ }
5692
+ }
5693
+ ]
5694
+ },
5695
+ {
5696
+ "name": "onAfterSave",
5697
+ "type": "function",
5698
+ "description": "Fired when saving a message as draft or template succeeded or failed.",
5699
+ "permissions": [
5700
+ "compose"
5701
+ ],
5702
+ "parameters": [
5703
+ {
5704
+ "name": "tab",
5705
+ "$ref": "tabs.Tab"
5706
+ },
5707
+ {
5708
+ "name": "saveInfo",
5709
+ "type": "object",
5710
+ "properties": {
5711
+ "mode": {
5712
+ "type": "string",
5713
+ "description": "The used save mode.",
5714
+ "enum": [
5715
+ "draft",
5716
+ "template"
5717
+ ]
5718
+ },
5719
+ "error": {
5720
+ "type": "string",
5721
+ "description": "An error description, if saving the message failed.",
5722
+ "optional": true
5723
+ },
5724
+ "messages": {
5725
+ "type": "array",
5726
+ "items": {
5727
+ "$ref": "messages.MessageHeader"
5728
+ },
5729
+ "description": "The saved message(s). The number of saved messages depends on the applied file carbon copy configuration (fcc)."
5730
+ }
5731
+ }
5732
+ }
5733
+ ]
5734
+ },
5624
5735
  {
5625
5736
  "name": "onAttachmentAdded",
5626
5737
  "type": "function",