@azure/notification-hubs 1.2.4-alpha.20240628.1 → 1.2.4-alpha.20240704.1

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.
Files changed (100) hide show
  1. package/dist/api/notification-hubs.d.ts +0 -2
  2. package/dist/browser/api/clientContext.d.ts +0 -1
  3. package/dist/browser/api/clientContext.d.ts.map +1 -1
  4. package/dist/browser/api/internal/_client.d.ts +0 -1
  5. package/dist/browser/api/internal/_client.d.ts.map +1 -1
  6. package/dist/commonjs/api/beginSubmitNotificationHubJob.js +1 -2
  7. package/dist/commonjs/api/beginSubmitNotificationHubJob.js.map +1 -1
  8. package/dist/commonjs/api/cancelScheduledNotification.js +1 -2
  9. package/dist/commonjs/api/cancelScheduledNotification.js.map +1 -1
  10. package/dist/commonjs/api/clientContext.d.ts +0 -1
  11. package/dist/commonjs/api/clientContext.d.ts.map +1 -1
  12. package/dist/commonjs/api/clientContext.js +1 -2
  13. package/dist/commonjs/api/clientContext.js.map +1 -1
  14. package/dist/commonjs/api/createOrUpdateInstallation.js +1 -2
  15. package/dist/commonjs/api/createOrUpdateInstallation.js.map +1 -1
  16. package/dist/commonjs/api/createOrUpdateRegistration.js +1 -2
  17. package/dist/commonjs/api/createOrUpdateRegistration.js.map +1 -1
  18. package/dist/commonjs/api/createRegistration.js +1 -2
  19. package/dist/commonjs/api/createRegistration.js.map +1 -1
  20. package/dist/commonjs/api/createRegistrationId.js +1 -2
  21. package/dist/commonjs/api/createRegistrationId.js.map +1 -1
  22. package/dist/commonjs/api/deleteInstallation.js +1 -2
  23. package/dist/commonjs/api/deleteInstallation.js.map +1 -1
  24. package/dist/commonjs/api/deleteRegistration.js +1 -2
  25. package/dist/commonjs/api/deleteRegistration.js.map +1 -1
  26. package/dist/commonjs/api/getFeedbackContainerUrl.js +1 -2
  27. package/dist/commonjs/api/getFeedbackContainerUrl.js.map +1 -1
  28. package/dist/commonjs/api/getInstallation.js +1 -2
  29. package/dist/commonjs/api/getInstallation.js.map +1 -1
  30. package/dist/commonjs/api/getNotificationHubJob.js +1 -2
  31. package/dist/commonjs/api/getNotificationHubJob.js.map +1 -1
  32. package/dist/commonjs/api/getNotificationOutcomeDetails.js +1 -2
  33. package/dist/commonjs/api/getNotificationOutcomeDetails.js.map +1 -1
  34. package/dist/commonjs/api/getRegistration.js +1 -2
  35. package/dist/commonjs/api/getRegistration.js.map +1 -1
  36. package/dist/commonjs/api/internal/_client.d.ts +0 -1
  37. package/dist/commonjs/api/internal/_client.d.ts.map +1 -1
  38. package/dist/commonjs/api/internal/_client.js +4 -5
  39. package/dist/commonjs/api/internal/_client.js.map +1 -1
  40. package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js +1 -2
  41. package/dist/commonjs/api/internal/_createOrUpdateRegistrationDescription.js.map +1 -1
  42. package/dist/commonjs/api/internal/_listRegistrations.js +2 -3
  43. package/dist/commonjs/api/internal/_listRegistrations.js.map +1 -1
  44. package/dist/commonjs/api/listNotificationHubJobs.js +1 -2
  45. package/dist/commonjs/api/listNotificationHubJobs.js.map +1 -1
  46. package/dist/commonjs/api/listRegistrations.js +1 -2
  47. package/dist/commonjs/api/listRegistrations.js.map +1 -1
  48. package/dist/commonjs/api/listRegistrationsByChannel.js +1 -2
  49. package/dist/commonjs/api/listRegistrationsByChannel.js.map +1 -1
  50. package/dist/commonjs/api/listRegistrationsByTag.js +1 -2
  51. package/dist/commonjs/api/listRegistrationsByTag.js.map +1 -1
  52. package/dist/commonjs/api/scheduleNotification.js +1 -2
  53. package/dist/commonjs/api/scheduleNotification.js.map +1 -1
  54. package/dist/commonjs/api/sendNotification.js +1 -2
  55. package/dist/commonjs/api/sendNotification.js.map +1 -1
  56. package/dist/commonjs/api/submitNotificationHubJob.js +1 -2
  57. package/dist/commonjs/api/submitNotificationHubJob.js.map +1 -1
  58. package/dist/commonjs/api/updateInstallation.js +1 -2
  59. package/dist/commonjs/api/updateInstallation.js.map +1 -1
  60. package/dist/commonjs/api/updateRegistration.js +1 -2
  61. package/dist/commonjs/api/updateRegistration.js.map +1 -1
  62. package/dist/commonjs/auth/connectionStringUtils.js +2 -3
  63. package/dist/commonjs/auth/connectionStringUtils.js.map +1 -1
  64. package/dist/commonjs/auth/hmacSha256.js +1 -2
  65. package/dist/commonjs/auth/hmacSha256.js.map +1 -1
  66. package/dist/commonjs/models/installation.js +8 -9
  67. package/dist/commonjs/models/installation.js.map +1 -1
  68. package/dist/commonjs/models/notification.js +13 -14
  69. package/dist/commonjs/models/notification.js.map +1 -1
  70. package/dist/commonjs/models/notificationBodyBuilder.js +6 -7
  71. package/dist/commonjs/models/notificationBodyBuilder.js.map +1 -1
  72. package/dist/commonjs/models/registration.js +16 -17
  73. package/dist/commonjs/models/registration.js.map +1 -1
  74. package/dist/commonjs/models/tagExpressionBuilder.js +1 -2
  75. package/dist/commonjs/models/tagExpressionBuilder.js.map +1 -1
  76. package/dist/commonjs/serializers/notificationDetailsSerializer.js +1 -2
  77. package/dist/commonjs/serializers/notificationDetailsSerializer.js.map +1 -1
  78. package/dist/commonjs/serializers/notificationHubJobSerializer.js +3 -4
  79. package/dist/commonjs/serializers/notificationHubJobSerializer.js.map +1 -1
  80. package/dist/commonjs/serializers/notificationOutcomeSerializer.js +1 -2
  81. package/dist/commonjs/serializers/notificationOutcomeSerializer.js.map +1 -1
  82. package/dist/commonjs/utils/notificationUtils.js +1 -2
  83. package/dist/commonjs/utils/notificationUtils.js.map +1 -1
  84. package/dist/commonjs/utils/optionUtils.js +2 -3
  85. package/dist/commonjs/utils/optionUtils.js.map +1 -1
  86. package/dist/commonjs/utils/registrationUtils.js +1 -2
  87. package/dist/commonjs/utils/registrationUtils.js.map +1 -1
  88. package/dist/commonjs/utils/utils.js +11 -12
  89. package/dist/commonjs/utils/utils.js.map +1 -1
  90. package/dist/commonjs/utils/xmlUtils.js +5 -5
  91. package/dist/commonjs/utils/xmlUtils.js.map +1 -1
  92. package/dist/esm/api/clientContext.d.ts +0 -1
  93. package/dist/esm/api/clientContext.d.ts.map +1 -1
  94. package/dist/esm/api/internal/_client.d.ts +0 -1
  95. package/dist/esm/api/internal/_client.d.ts.map +1 -1
  96. package/dist/react-native/api/clientContext.d.ts +0 -1
  97. package/dist/react-native/api/clientContext.d.ts.map +1 -1
  98. package/dist/react-native/api/internal/_client.d.ts +0 -1
  99. package/dist/react-native/api/internal/_client.d.ts.map +1 -1
  100. package/package.json +5 -4
@@ -2,7 +2,14 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createBrowserInstallation = exports.createWindowsInstallation = exports.createXiaomiInstallation = exports.createFcmV1Installation = exports.createFcmLegacyInstallation = exports.createBaiduInstallation = exports.createAdmInstallation = exports.createAppleInstallation = void 0;
5
+ exports.createAppleInstallation = createAppleInstallation;
6
+ exports.createAdmInstallation = createAdmInstallation;
7
+ exports.createBaiduInstallation = createBaiduInstallation;
8
+ exports.createFcmLegacyInstallation = createFcmLegacyInstallation;
9
+ exports.createFcmV1Installation = createFcmV1Installation;
10
+ exports.createXiaomiInstallation = createXiaomiInstallation;
11
+ exports.createWindowsInstallation = createWindowsInstallation;
12
+ exports.createBrowserInstallation = createBrowserInstallation;
6
13
  /**
7
14
  * Creates an Apple based installation.
8
15
  * @param installation - A partial installation used to create the Apple installation.
@@ -11,7 +18,6 @@ exports.createBrowserInstallation = exports.createWindowsInstallation = exports.
11
18
  function createAppleInstallation(installation) {
12
19
  return Object.assign(Object.assign({}, installation), { platform: "apns" });
13
20
  }
14
- exports.createAppleInstallation = createAppleInstallation;
15
21
  /**
16
22
  * Creates an Amazon Device Messaging (ADM) based installation.
17
23
  * @param installation - A partial installation used to create the ADM installation.
@@ -20,7 +26,6 @@ exports.createAppleInstallation = createAppleInstallation;
20
26
  function createAdmInstallation(installation) {
21
27
  return Object.assign(Object.assign({}, installation), { platform: "adm" });
22
28
  }
23
- exports.createAdmInstallation = createAdmInstallation;
24
29
  /**
25
30
  * Creates a Baidu based installation.
26
31
  * @param installation - A partial installation used to create the Baidu installation.
@@ -29,7 +34,6 @@ exports.createAdmInstallation = createAdmInstallation;
29
34
  function createBaiduInstallation(installation) {
30
35
  return Object.assign(Object.assign({}, installation), { platform: "baidu" });
31
36
  }
32
- exports.createBaiduInstallation = createBaiduInstallation;
33
37
  /**
34
38
  * Creates a Firebase legacy HTTP based installation.
35
39
  * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.
@@ -38,7 +42,6 @@ exports.createBaiduInstallation = createBaiduInstallation;
38
42
  function createFcmLegacyInstallation(installation) {
39
43
  return Object.assign(Object.assign({}, installation), { platform: "gcm" });
40
44
  }
41
- exports.createFcmLegacyInstallation = createFcmLegacyInstallation;
42
45
  /**
43
46
  * Creates an Firebase V1 Cloud Messaging based installation.
44
47
  * @param installation - A partial installation used to create the Firebase V1 Cloud Messaging installation.
@@ -47,7 +50,6 @@ exports.createFcmLegacyInstallation = createFcmLegacyInstallation;
47
50
  function createFcmV1Installation(installation) {
48
51
  return Object.assign(Object.assign({}, installation), { platform: "fcmv1" });
49
52
  }
50
- exports.createFcmV1Installation = createFcmV1Installation;
51
53
  /**
52
54
  * Creates a Xiaomi based installation.
53
55
  * @param installation - A partial installation used to create the Xiaomi installation.
@@ -56,7 +58,6 @@ exports.createFcmV1Installation = createFcmV1Installation;
56
58
  function createXiaomiInstallation(installation) {
57
59
  return Object.assign(Object.assign({}, installation), { platform: "xiaomi" });
58
60
  }
59
- exports.createXiaomiInstallation = createXiaomiInstallation;
60
61
  /**
61
62
  * Creates a Windows Notification Services (WNS) based installation.
62
63
  * @param installation - A partial installation used to create the WNS installation.
@@ -65,7 +66,6 @@ exports.createXiaomiInstallation = createXiaomiInstallation;
65
66
  function createWindowsInstallation(installation) {
66
67
  return Object.assign(Object.assign({}, installation), { platform: "wns" });
67
68
  }
68
- exports.createWindowsInstallation = createWindowsInstallation;
69
69
  /**
70
70
  * Creates a Web Push based installation.
71
71
  * @param installation - A partial installation used to create the Web Push installation.
@@ -74,5 +74,4 @@ exports.createWindowsInstallation = createWindowsInstallation;
74
74
  function createBrowserInstallation(installation) {
75
75
  return Object.assign(Object.assign({}, installation), { platform: "browser" });
76
76
  }
77
- exports.createBrowserInstallation = createBrowserInstallation;
78
77
  //# sourceMappingURL=installation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/models/installation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAyDlC;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,MAAM,IAChB;AACJ,CAAC;AALD,0DAKC;AAYD;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,YAAqC;IACzE,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AALD,sDAKC;AAYD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AALD,0DAKC;AAYD;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAPD,kEAOC;AAYD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AALD,0DAKC;AAYD;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,QAAQ,IAClB;AACJ,CAAC;AAPD,4DAOC;AAYD;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAPD,8DAOC;AA0CD;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,YAAuC;IAEvC,uCACK,YAAY,KACf,QAAQ,EAAE,SAAS,IACnB;AACJ,CAAC;AAPD,8DAOC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents an installation for a device for Notification Hubs.\n */\nexport interface InstallationCommon {\n /**\n * The ID for the installation.\n */\n installationId: string;\n\n /**\n * The User ID for the installation used for targeting.\n */\n userId?: string;\n\n /**\n * The installation expiration time.\n */\n readonly expirationTime?: string;\n\n /**\n * The last update date of the installation.\n */\n readonly lastUpdate?: string;\n\n /**\n * The tags used for targeting this installation.\n */\n tags?: string[];\n\n /**\n * The templates for the installation.\n */\n templates?: Record<string, InstallationTemplate>;\n}\n\n/**\n * Represents an installation with a string based device token.\n */\nexport interface DeviceTokenInstallation extends InstallationCommon {\n /**\n * The push channel for a device.\n */\n pushChannel: string;\n}\n\n/**\n * Represents an Apple APNs based installation.\n */\nexport interface AppleInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"apns\";\n}\n\n/**\n * Creates an Apple based installation.\n * @param installation - A partial installation used to create the Apple installation.\n * @returns The newly created Apple installation.\n */\nexport function createAppleInstallation(installation: DeviceTokenInstallation): AppleInstallation {\n return {\n ...installation,\n platform: \"apns\",\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) based installation.\n */\nexport interface AdmInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates an Amazon Device Messaging (ADM) based installation.\n * @param installation - A partial installation used to create the ADM installation.\n * @returns The newly created ADM installation.\n */\nexport function createAdmInstallation(installation: DeviceTokenInstallation): AdmInstallation {\n return {\n ...installation,\n platform: \"adm\",\n };\n}\n\n/**\n * Represents a Baidu based installation.\n */\nexport interface BaiduInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a Baidu based installation.\n * @param installation - A partial installation used to create the Baidu installation.\n * @returns The newly created Baidu installation.\n */\nexport function createBaiduInstallation(installation: DeviceTokenInstallation): BaiduInstallation {\n return {\n ...installation,\n platform: \"baidu\",\n };\n}\n\n/**\n * Represents a Firebase Legacy HTTP installation.\n */\nexport interface FcmLegacyInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a Firebase legacy HTTP based installation.\n * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.\n * @returns The newly created Baidu installation.\n */\nexport function createFcmLegacyInstallation(\n installation: DeviceTokenInstallation,\n): FcmLegacyInstallation {\n return {\n ...installation,\n platform: \"gcm\",\n };\n}\n\n/**\n * Represents an Firebase V1 Cloud Messaging based installation.\n */\nexport interface FcmV1Installation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Creates an Firebase V1 Cloud Messaging based installation.\n * @param installation - A partial installation used to create the Firebase V1 Cloud Messaging installation.\n * @returns The newly created Firebase V1 Cloud Messaging installation.\n */\nexport function createFcmV1Installation(installation: DeviceTokenInstallation): FcmV1Installation {\n return {\n ...installation,\n platform: \"fcmv1\",\n };\n}\n\n/**\n * Represents a Xiaomi based installation.\n */\nexport interface XiaomiInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a Xiaomi based installation.\n * @param installation - A partial installation used to create the Xiaomi installation.\n * @returns The newly created Xiaomi installation.\n */\nexport function createXiaomiInstallation(\n installation: DeviceTokenInstallation,\n): XiaomiInstallation {\n return {\n ...installation,\n platform: \"xiaomi\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) based installation.\n */\nexport interface WindowsInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"wns\";\n}\n\n/**\n * Creates a Windows Notification Services (WNS) based installation.\n * @param installation - A partial installation used to create the WNS installation.\n * @returns The newly created WNS installation.\n */\nexport function createWindowsInstallation(\n installation: DeviceTokenInstallation,\n): WindowsInstallation {\n return {\n ...installation,\n platform: \"wns\",\n };\n}\n\n/**\n * Represents the push channel for a Browser Push installation.\n */\nexport interface BrowserPushChannel {\n /**\n * The P256DH for the browser push installation.\n */\n p256dh: string;\n\n /**\n * The auth secret for the browser push installation.\n */\n auth: string;\n\n /**\n * The endpoint URL for the browser push installation.\n */\n endpoint: string;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallationCommon extends InstallationCommon {\n /**\n * The push channel for the Web Push API.\n */\n pushChannel: BrowserPushChannel;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallation extends BrowserInstallationCommon {\n /**\n * The platform for the installation.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a Web Push based installation.\n * @param installation - A partial installation used to create the Web Push installation.\n * @returns The newly created Web Push installation.\n */\nexport function createBrowserInstallation(\n installation: BrowserInstallationCommon,\n): BrowserInstallation {\n return {\n ...installation,\n platform: \"browser\",\n };\n}\n\n/**\n * Represents the types of installations available in Notification Hubs.\n */\nexport type Installation =\n | AppleInstallation\n | AdmInstallation\n | BaiduInstallation\n | BrowserInstallation\n | FcmLegacyInstallation\n | FcmV1Installation\n | XiaomiInstallation\n | WindowsInstallation;\n\n/**\n * Represents an installation template.\n */\nexport interface InstallationTemplate {\n /**\n * The body for the installation template.\n */\n body: string;\n\n /**\n * Headers to include for the template send.\n */\n headers: Record<string, string>;\n\n /**\n * The tags to include for the template.\n */\n tags?: string[];\n}\n\n/**\n * Represents the JSON Patch types of add, remove and replace.\n */\nexport type JsonPatchOperation = \"add\" | \"remove\" | \"replace\";\n\n/**\n * Represents a patch operation.\n */\nexport interface JsonPatch {\n /**\n * The patch operation.\n */\n op: JsonPatchOperation;\n\n /**\n * The path for the patch operation.\n */\n path: string;\n\n /**\n * The value to add or replace for the operation.\n */\n value?: string;\n}\n\n/**\n * Represents the types of push channels available for Notification Hubs.\n */\nexport type PushHandle = BrowserPushChannel | string;\n"]}
1
+ {"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/models/installation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA8DlC,0DAKC;AAiBD,sDAKC;AAiBD,0DAKC;AAiBD,kEAOC;AAiBD,0DAKC;AAiBD,4DAOC;AAiBD,8DAOC;AA+CD,8DAOC;AA1MD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,MAAM,IAChB;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,YAAqC;IACzE,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,uCACK,YAAY,KACf,QAAQ,EAAE,OAAO,IACjB;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,QAAQ,IAClB;AACJ,CAAC;AAYD;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,YAAqC;IAErC,uCACK,YAAY,KACf,QAAQ,EAAE,KAAK,IACf;AACJ,CAAC;AA0CD;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,YAAuC;IAEvC,uCACK,YAAY,KACf,QAAQ,EAAE,SAAS,IACnB;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Represents an installation for a device for Notification Hubs.\n */\nexport interface InstallationCommon {\n /**\n * The ID for the installation.\n */\n installationId: string;\n\n /**\n * The User ID for the installation used for targeting.\n */\n userId?: string;\n\n /**\n * The installation expiration time.\n */\n readonly expirationTime?: string;\n\n /**\n * The last update date of the installation.\n */\n readonly lastUpdate?: string;\n\n /**\n * The tags used for targeting this installation.\n */\n tags?: string[];\n\n /**\n * The templates for the installation.\n */\n templates?: Record<string, InstallationTemplate>;\n}\n\n/**\n * Represents an installation with a string based device token.\n */\nexport interface DeviceTokenInstallation extends InstallationCommon {\n /**\n * The push channel for a device.\n */\n pushChannel: string;\n}\n\n/**\n * Represents an Apple APNs based installation.\n */\nexport interface AppleInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"apns\";\n}\n\n/**\n * Creates an Apple based installation.\n * @param installation - A partial installation used to create the Apple installation.\n * @returns The newly created Apple installation.\n */\nexport function createAppleInstallation(installation: DeviceTokenInstallation): AppleInstallation {\n return {\n ...installation,\n platform: \"apns\",\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) based installation.\n */\nexport interface AdmInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"adm\";\n}\n\n/**\n * Creates an Amazon Device Messaging (ADM) based installation.\n * @param installation - A partial installation used to create the ADM installation.\n * @returns The newly created ADM installation.\n */\nexport function createAdmInstallation(installation: DeviceTokenInstallation): AdmInstallation {\n return {\n ...installation,\n platform: \"adm\",\n };\n}\n\n/**\n * Represents a Baidu based installation.\n */\nexport interface BaiduInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a Baidu based installation.\n * @param installation - A partial installation used to create the Baidu installation.\n * @returns The newly created Baidu installation.\n */\nexport function createBaiduInstallation(installation: DeviceTokenInstallation): BaiduInstallation {\n return {\n ...installation,\n platform: \"baidu\",\n };\n}\n\n/**\n * Represents a Firebase Legacy HTTP installation.\n */\nexport interface FcmLegacyInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"gcm\";\n}\n\n/**\n * Creates a Firebase legacy HTTP based installation.\n * @param installation - A partial installation used to create the Firebase Legacy HTTP installation.\n * @returns The newly created Baidu installation.\n */\nexport function createFcmLegacyInstallation(\n installation: DeviceTokenInstallation,\n): FcmLegacyInstallation {\n return {\n ...installation,\n platform: \"gcm\",\n };\n}\n\n/**\n * Represents an Firebase V1 Cloud Messaging based installation.\n */\nexport interface FcmV1Installation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Creates an Firebase V1 Cloud Messaging based installation.\n * @param installation - A partial installation used to create the Firebase V1 Cloud Messaging installation.\n * @returns The newly created Firebase V1 Cloud Messaging installation.\n */\nexport function createFcmV1Installation(installation: DeviceTokenInstallation): FcmV1Installation {\n return {\n ...installation,\n platform: \"fcmv1\",\n };\n}\n\n/**\n * Represents a Xiaomi based installation.\n */\nexport interface XiaomiInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a Xiaomi based installation.\n * @param installation - A partial installation used to create the Xiaomi installation.\n * @returns The newly created Xiaomi installation.\n */\nexport function createXiaomiInstallation(\n installation: DeviceTokenInstallation,\n): XiaomiInstallation {\n return {\n ...installation,\n platform: \"xiaomi\",\n };\n}\n\n/**\n * Represents a Windows Notification Services (WNS) based installation.\n */\nexport interface WindowsInstallation extends DeviceTokenInstallation {\n /**\n * The platform for the installation.\n */\n platform: \"wns\";\n}\n\n/**\n * Creates a Windows Notification Services (WNS) based installation.\n * @param installation - A partial installation used to create the WNS installation.\n * @returns The newly created WNS installation.\n */\nexport function createWindowsInstallation(\n installation: DeviceTokenInstallation,\n): WindowsInstallation {\n return {\n ...installation,\n platform: \"wns\",\n };\n}\n\n/**\n * Represents the push channel for a Browser Push installation.\n */\nexport interface BrowserPushChannel {\n /**\n * The P256DH for the browser push installation.\n */\n p256dh: string;\n\n /**\n * The auth secret for the browser push installation.\n */\n auth: string;\n\n /**\n * The endpoint URL for the browser push installation.\n */\n endpoint: string;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallationCommon extends InstallationCommon {\n /**\n * The push channel for the Web Push API.\n */\n pushChannel: BrowserPushChannel;\n}\n\n/**\n * Represents a Browser/Web Push based installation.\n */\nexport interface BrowserInstallation extends BrowserInstallationCommon {\n /**\n * The platform for the installation.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a Web Push based installation.\n * @param installation - A partial installation used to create the Web Push installation.\n * @returns The newly created Web Push installation.\n */\nexport function createBrowserInstallation(\n installation: BrowserInstallationCommon,\n): BrowserInstallation {\n return {\n ...installation,\n platform: \"browser\",\n };\n}\n\n/**\n * Represents the types of installations available in Notification Hubs.\n */\nexport type Installation =\n | AppleInstallation\n | AdmInstallation\n | BaiduInstallation\n | BrowserInstallation\n | FcmLegacyInstallation\n | FcmV1Installation\n | XiaomiInstallation\n | WindowsInstallation;\n\n/**\n * Represents an installation template.\n */\nexport interface InstallationTemplate {\n /**\n * The body for the installation template.\n */\n body: string;\n\n /**\n * Headers to include for the template send.\n */\n headers: Record<string, string>;\n\n /**\n * The tags to include for the template.\n */\n tags?: string[];\n}\n\n/**\n * Represents the JSON Patch types of add, remove and replace.\n */\nexport type JsonPatchOperation = \"add\" | \"remove\" | \"replace\";\n\n/**\n * Represents a patch operation.\n */\nexport interface JsonPatch {\n /**\n * The patch operation.\n */\n op: JsonPatchOperation;\n\n /**\n * The path for the patch operation.\n */\n path: string;\n\n /**\n * The value to add or replace for the operation.\n */\n value?: string;\n}\n\n/**\n * Represents the types of push channels available for Notification Hubs.\n */\nexport type PushHandle = BrowserPushChannel | string;\n"]}
@@ -2,7 +2,19 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createWindowsRawNotification = exports.createWindowsToastNotification = exports.createWindowsTileNotification = exports.createWindowsBadgeNotification = exports.createWindowsNotification = exports.createTemplateNotification = exports.createXiaomiNotification = exports.createFcmV1Notification = exports.createFcmLegacyNotification = exports.createBrowserNotification = exports.createBaiduNotification = exports.createAdmNotification = exports.createAppleNotification = void 0;
5
+ exports.createAppleNotification = createAppleNotification;
6
+ exports.createAdmNotification = createAdmNotification;
7
+ exports.createBaiduNotification = createBaiduNotification;
8
+ exports.createBrowserNotification = createBrowserNotification;
9
+ exports.createFcmLegacyNotification = createFcmLegacyNotification;
10
+ exports.createFcmV1Notification = createFcmV1Notification;
11
+ exports.createXiaomiNotification = createXiaomiNotification;
12
+ exports.createTemplateNotification = createTemplateNotification;
13
+ exports.createWindowsNotification = createWindowsNotification;
14
+ exports.createWindowsBadgeNotification = createWindowsBadgeNotification;
15
+ exports.createWindowsTileNotification = createWindowsTileNotification;
16
+ exports.createWindowsToastNotification = createWindowsToastNotification;
17
+ exports.createWindowsRawNotification = createWindowsRawNotification;
6
18
  const tslib_1 = require("tslib");
7
19
  const Constants = tslib_1.__importStar(require("../utils/constants.js"));
8
20
  function isString(value) {
@@ -17,7 +29,6 @@ function createAppleNotification(notification) {
17
29
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
18
30
  return Object.assign(Object.assign({}, notification), { body, platform: "apple", contentType: Constants.JSON_CONTENT_TYPE });
19
31
  }
20
- exports.createAppleNotification = createAppleNotification;
21
32
  /**
22
33
  * Creates a notification to send to an Amazon Device Messaging device.
23
34
  * @param notification - A partial message used to create a message for Amazon Device Messaging.
@@ -27,7 +38,6 @@ function createAdmNotification(notification) {
27
38
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
28
39
  return Object.assign(Object.assign({}, notification), { body, platform: "adm", contentType: Constants.JSON_CONTENT_TYPE });
29
40
  }
30
- exports.createAdmNotification = createAdmNotification;
31
41
  /**
32
42
  * Creates a notification to send to a Baidu registered device.
33
43
  * @param notification - A partial message used to create a message for Baidu.
@@ -37,7 +47,6 @@ function createBaiduNotification(notification) {
37
47
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
38
48
  return Object.assign(Object.assign({}, notification), { body, platform: "baidu", contentType: Constants.JSON_CONTENT_TYPE });
39
49
  }
40
- exports.createBaiduNotification = createBaiduNotification;
41
50
  /**
42
51
  * Creates a notification to send to a browser.
43
52
  * @param notification - A partial message used to create a message for a browser.
@@ -47,7 +56,6 @@ function createBrowserNotification(notification) {
47
56
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
48
57
  return Object.assign(Object.assign({}, notification), { body, platform: "browser", contentType: Constants.JSON_CONTENT_TYPE });
49
58
  }
50
- exports.createBrowserNotification = createBrowserNotification;
51
59
  /**
52
60
  * Creates a notification to send to Firebase.
53
61
  * @param notification - A partial message used to create a message for Firebase.
@@ -57,7 +65,6 @@ function createFcmLegacyNotification(notification) {
57
65
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
58
66
  return Object.assign(Object.assign({}, notification), { body, platform: "gcm", contentType: Constants.JSON_CONTENT_TYPE });
59
67
  }
60
- exports.createFcmLegacyNotification = createFcmLegacyNotification;
61
68
  /**
62
69
  * Creates a notification to send to Firebase.
63
70
  * @param notification - A partial message used to create a message for Firebase.
@@ -67,7 +74,6 @@ function createFcmV1Notification(notification) {
67
74
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
68
75
  return Object.assign(Object.assign({}, notification), { body, platform: "fcmv1", contentType: Constants.JSON_CONTENT_TYPE });
69
76
  }
70
- exports.createFcmV1Notification = createFcmV1Notification;
71
77
  /**
72
78
  * Creates a notification to send to Xiaomi.
73
79
  * @param notification - A partial message used to create a message for Xiaomi.
@@ -77,7 +83,6 @@ function createXiaomiNotification(notification) {
77
83
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
78
84
  return Object.assign(Object.assign({}, notification), { body, platform: "xiaomi", contentType: Constants.JSON_CONTENT_TYPE });
79
85
  }
80
- exports.createXiaomiNotification = createXiaomiNotification;
81
86
  /**
82
87
  * Creates a template notification.
83
88
  * @param notification - A partial message used to be used for a template notification.
@@ -87,7 +92,6 @@ function createTemplateNotification(notification) {
87
92
  const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
88
93
  return Object.assign(Object.assign({}, notification), { body, platform: "template", contentType: Constants.JSON_CONTENT_TYPE });
89
94
  }
90
- exports.createTemplateNotification = createTemplateNotification;
91
95
  /**
92
96
  * Creates a notification to send to WNS.
93
97
  * @param notification - The WNS notification to send.
@@ -113,7 +117,6 @@ function createWindowsNotification(notification) {
113
117
  throw new Error(`Missing WNS type in headers`);
114
118
  }
115
119
  }
116
- exports.createWindowsNotification = createWindowsNotification;
117
120
  /**
118
121
  * Creates a badge message to send to WNS.
119
122
  * @param notification - A partial message used to create a badge message for WNS.
@@ -129,7 +132,6 @@ function createWindowsBadgeNotification(notification) {
129
132
  }
130
133
  return result;
131
134
  }
132
- exports.createWindowsBadgeNotification = createWindowsBadgeNotification;
133
135
  /**
134
136
  * Creates a tile message to send to WNS.
135
137
  * @param notification - A partial message used to create a tile message for WNS.
@@ -145,7 +147,6 @@ function createWindowsTileNotification(notification) {
145
147
  }
146
148
  return result;
147
149
  }
148
- exports.createWindowsTileNotification = createWindowsTileNotification;
149
150
  /**
150
151
  * Creates a toast message to send to WNS.
151
152
  * @param notification - A partial message used to create a toast message for WNS.
@@ -161,7 +162,6 @@ function createWindowsToastNotification(notification) {
161
162
  }
162
163
  return result;
163
164
  }
164
- exports.createWindowsToastNotification = createWindowsToastNotification;
165
165
  /**
166
166
  * Creates a notification to send to WNS in wns/raw format..
167
167
  * @param notification - A partial message used to create a message for WNS in XML format.
@@ -177,5 +177,4 @@ function createWindowsRawNotification(notification) {
177
177
  }
178
178
  return result;
179
179
  }
180
- exports.createWindowsRawNotification = createWindowsRawNotification;
181
180
  //# sourceMappingURL=notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,yEAAmD;AASnD,SAAS,QAAQ,CAAC,KA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C,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAlBD,wEAkBC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,YAAmC;IAEnC,MAAM,MAAM,mCACP,YAAY,KACf,QAAQ,EAAE,SAAS,EACnB,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAC3C,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;IAC9D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAlBD,oEAkBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Constants from \"../utils/constants.js\";\nimport {\n AdmNativeMessage,\n AppleNativeMessage,\n FirebaseLegacyNativeMessage,\n FirebaseV1NativeMessage,\n} from \"./notificationBodyBuilder.js\";\nimport { AppleHeaders, WindowsHeaders } from \"./notificationHeaderBuilder.js\";\n\nfunction isString(value: unknown): value is string {\n return typeof value === \"string\" || value instanceof String;\n}\n\n/**\n * Represents a notification that can be sent to a device.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * The common notification parameters to accept a string body or JSON body.\n */\nexport interface NotificationCommonParams {\n /**\n * The body for the push notification.\n */\n body: string | unknown;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Represents an Apple notification that can be sent to a device.\n */\nexport interface AppleNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AppleNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: AppleHeaders;\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(notification: AppleNotificationParams): AppleNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Represents an ADM notification that can be sent to a device.\n */\nexport interface AdmNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AdmNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(notification: AdmNotificationParams): AdmNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: NotificationCommonParams,\n): BrowserNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FcmLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Represents an Firebase Legacy notification that can be sent to a device.\n */\nexport interface FcmLegacyNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseLegacyNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmLegacyNotification(\n notification: FcmLegacyNotificationParams,\n): FcmLegacyNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Firebase V1 API notification that can be sent to a device.\n */\nexport interface FcmV1Notification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Represents an Firebase V1 notification that can be sent to a device.\n */\nexport interface FcmV1NotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseV1NativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmV1Notification(notification: FcmV1NotificationParams): FcmV1Notification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"fcmv1\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Xiaomi push notification.\n */\nexport interface XiaomiNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a notification to send to Xiaomi.\n * @param notification - A partial message used to create a message for Xiaomi.\n * @returns A newly created Xiaomi notification.\n */\nexport function createXiaomiNotification(\n notification: NotificationCommonParams,\n): XiaomiNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"xiaomi\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a template notification.\n * @param notification - A partial message used to be used for a template notification.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: NotificationCommonParams,\n): TemplateNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"windows\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Represents a WNS notification that can be sent to a device.\n */\nexport interface WnsNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: WindowsHeaders;\n}\n\n/**\n * Creates a notification to send to WNS.\n * @param notification - The WNS notification to send.\n * @returns A newly created WNS message.\n */\nexport function createWindowsNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n if (notification?.headers && notification.headers[\"X-WNS-Type\"]) {\n const wnsType = notification.headers[\"X-WNS-Type\"];\n switch (wnsType) {\n case Constants.WNS_TOAST:\n return createWindowsToastNotification(notification);\n case Constants.WNS_TITLE:\n return createWindowsTileNotification(notification);\n case Constants.WNS_BADGE:\n return createWindowsBadgeNotification(notification);\n case Constants.WNS_RAW:\n return createWindowsRawNotification(notification);\n default:\n throw new Error(`Invalid WNS type: ${wnsType}`);\n }\n } else {\n throw new Error(`Missing WNS type in headers`);\n }\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n }\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n }\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n }\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n }\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FcmLegacyNotification\n | FcmV1Notification\n | XiaomiNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqFlC,0DASC;AAgCD,sDASC;AAiBD,0DASC;AAiBD,8DAWC;AAgCD,kEAWC;AAgCD,0DASC;AAiBD,4DAWC;AAiBD,gEAWC;AA0CD,8DAoBC;AAOD,wEAkBC;AAOD,sEAkBC;AAOD,wEAkBC;AAOD,oEAkBC;;AAzeD,yEAAmD;AASnD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAmED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,YAAqC;IAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,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AAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;IAC9D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Constants from \"../utils/constants.js\";\nimport {\n AdmNativeMessage,\n AppleNativeMessage,\n FirebaseLegacyNativeMessage,\n FirebaseV1NativeMessage,\n} from \"./notificationBodyBuilder.js\";\nimport { AppleHeaders, WindowsHeaders } from \"./notificationHeaderBuilder.js\";\n\nfunction isString(value: unknown): value is string {\n return typeof value === \"string\" || value instanceof String;\n}\n\n/**\n * Represents a notification that can be sent to a device.\n */\nexport interface NotificationCommon {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * The common notification parameters to accept a string body or JSON body.\n */\nexport interface NotificationCommonParams {\n /**\n * The body for the push notification.\n */\n body: string | unknown;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, unknown>;\n}\n\n/**\n * Represents a JSON notification hub.\n */\nexport interface JsonNotification extends NotificationCommon {\n /**\n * The content type for the push notification.\n */\n contentType: \"application/json;charset=utf-8\";\n}\n\n/**\n * Represents an Apple APNs push notification.\n */\nexport interface AppleNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"apple\";\n}\n\n/**\n * Represents an Apple notification that can be sent to a device.\n */\nexport interface AppleNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AppleNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: AppleHeaders;\n}\n\n/**\n * Creates a notification to send to an Apple device.\n * @param notification - A partial message used to create a message for Apple.\n * @returns A newly created Apple.\n */\nexport function createAppleNotification(notification: AppleNotificationParams): AppleNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"apple\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Amazon Device Messaging (ADM) push notification.\n */\nexport interface AdmNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"adm\";\n}\n\n/**\n * Represents an ADM notification that can be sent to a device.\n */\nexport interface AdmNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | AdmNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to an Amazon Device Messaging device.\n * @param notification - A partial message used to create a message for Amazon Device Messaging.\n * @returns A newly created Amazon Device Messaging.\n */\nexport function createAdmNotification(notification: AdmNotificationParams): AdmNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"adm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Baidu push notification.\n */\nexport interface BaiduNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"baidu\";\n}\n\n/**\n * Creates a notification to send to a Baidu registered device.\n * @param notification - A partial message used to create a message for Baidu.\n * @returns A newly created Baidu.\n */\nexport function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"baidu\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Browser push notification.\n */\nexport interface BrowserNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"browser\";\n}\n\n/**\n * Creates a notification to send to a browser.\n * @param notification - A partial message used to create a message for a browser.\n * @returns A newly created Web Push browser.\n */\nexport function createBrowserNotification(\n notification: NotificationCommonParams,\n): BrowserNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"browser\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Firebase legacy HTTP push notification.\n */\nexport interface FcmLegacyNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"gcm\";\n}\n\n/**\n * Represents an Firebase Legacy notification that can be sent to a device.\n */\nexport interface FcmLegacyNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseLegacyNativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmLegacyNotification(\n notification: FcmLegacyNotificationParams,\n): FcmLegacyNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"gcm\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents an Firebase V1 API notification that can be sent to a device.\n */\nexport interface FcmV1Notification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"fcmv1\";\n}\n\n/**\n * Represents an Firebase V1 notification that can be sent to a device.\n */\nexport interface FcmV1NotificationParams {\n /**\n * The body for the push notification.\n */\n body: string | FirebaseV1NativeMessage;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Creates a notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase notification.\n */\nexport function createFcmV1Notification(notification: FcmV1NotificationParams): FcmV1Notification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"fcmv1\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a Xiaomi push notification.\n */\nexport interface XiaomiNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"xiaomi\";\n}\n\n/**\n * Creates a notification to send to Xiaomi.\n * @param notification - A partial message used to create a message for Xiaomi.\n * @returns A newly created Xiaomi notification.\n */\nexport function createXiaomiNotification(\n notification: NotificationCommonParams,\n): XiaomiNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"xiaomi\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents a template based push notification.\n */\nexport interface TemplateNotification extends JsonNotification {\n /**\n * The platform for the push notification.\n */\n platform: \"template\";\n}\n\n/**\n * Creates a template notification.\n * @param notification - A partial message used to be used for a template notification.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(\n notification: NotificationCommonParams,\n): TemplateNotification {\n const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);\n\n return {\n ...notification,\n body,\n platform: \"template\",\n contentType: Constants.JSON_CONTENT_TYPE,\n };\n}\n\n/**\n * Represents the possible WNS content-types.\n */\nexport type WindowsContentType = \"application/xml\" | \"application/octet-stream\";\n\n/**\n * Represents a Windows Notification Services (WNS) push notification.\n */\nexport interface WindowsNotification extends NotificationCommon {\n /**\n * The platform for the push notification.\n */\n platform: \"windows\";\n\n /**\n * The content type for the push notification.\n */\n contentType: WindowsContentType;\n}\n\n/**\n * Represents a WNS notification that can be sent to a device.\n */\nexport interface WnsNotificationParams {\n /**\n * The body for the push notification.\n */\n body: string;\n\n /**\n * The headers to include for the push notification.\n */\n headers?: WindowsHeaders;\n}\n\n/**\n * Creates a notification to send to WNS.\n * @param notification - The WNS notification to send.\n * @returns A newly created WNS message.\n */\nexport function createWindowsNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n if (notification?.headers && notification.headers[\"X-WNS-Type\"]) {\n const wnsType = notification.headers[\"X-WNS-Type\"];\n switch (wnsType) {\n case Constants.WNS_TOAST:\n return createWindowsToastNotification(notification);\n case Constants.WNS_TITLE:\n return createWindowsTileNotification(notification);\n case Constants.WNS_BADGE:\n return createWindowsBadgeNotification(notification);\n case Constants.WNS_RAW:\n return createWindowsRawNotification(notification);\n default:\n throw new Error(`Invalid WNS type: ${wnsType}`);\n }\n } else {\n throw new Error(`Missing WNS type in headers`);\n }\n}\n\n/**\n * Creates a badge message to send to WNS.\n * @param notification - A partial message used to create a badge message for WNS.\n * @returns A newly created WNS badge.\n */\nexport function createWindowsBadgeNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_BADGE;\n }\n\n return result;\n}\n\n/**\n * Creates a tile message to send to WNS.\n * @param notification - A partial message used to create a tile message for WNS.\n * @returns A newly created WNS tile.\n */\nexport function createWindowsTileNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TITLE;\n }\n\n return result;\n}\n\n/**\n * Creates a toast message to send to WNS.\n * @param notification - A partial message used to create a toast message for WNS.\n * @returns A newly created WNS toast.\n */\nexport function createWindowsToastNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.XML_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_TOAST;\n }\n\n return result;\n}\n\n/**\n * Creates a notification to send to WNS in wns/raw format..\n * @param notification - A partial message used to create a message for WNS in XML format.\n * @returns A newly created WNS message using XML.\n */\nexport function createWindowsRawNotification(\n notification: WnsNotificationParams,\n): WindowsNotification {\n const result: WindowsNotification = {\n ...notification,\n platform: \"windows\",\n contentType: Constants.STREAM_CONTENT_TYPE,\n };\n\n if (!result.headers) {\n result.headers = {};\n }\n\n if (!result.headers[Constants.WNS_TYPE_NAME]) {\n result.headers[Constants.WNS_TYPE_NAME] = Constants.WNS_RAW;\n }\n\n return result;\n}\n\n/**\n * Represents the possible push notification messages types.\n */\nexport type Notification =\n | AppleNotification\n | AdmNotification\n | BaiduNotification\n | BrowserNotification\n | FcmLegacyNotification\n | FcmV1Notification\n | XiaomiNotification\n | WindowsNotification\n | TemplateNotification;\n"]}
@@ -2,7 +2,12 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createWindowsBadgeNotificationBody = exports.createBaiduNotificationBody = exports.createAdmNotificationBody = exports.createFirebaseV1NotificationBody = exports.createFirebaseLegacyNotificationBody = exports.createAppleNotificationBody = void 0;
5
+ exports.createAppleNotificationBody = createAppleNotificationBody;
6
+ exports.createFirebaseLegacyNotificationBody = createFirebaseLegacyNotificationBody;
7
+ exports.createFirebaseV1NotificationBody = createFirebaseV1NotificationBody;
8
+ exports.createAdmNotificationBody = createAdmNotificationBody;
9
+ exports.createBaiduNotificationBody = createBaiduNotificationBody;
10
+ exports.createWindowsBadgeNotificationBody = createWindowsBadgeNotificationBody;
6
11
  const core_xml_1 = require("@azure/core-xml");
7
12
  /**
8
13
  * Creates an APNs native message to send to Notification Hubs.
@@ -13,7 +18,6 @@ const core_xml_1 = require("@azure/core-xml");
13
18
  function createAppleNotificationBody(nativeMessage) {
14
19
  return JSON.stringify(nativeMessage);
15
20
  }
16
- exports.createAppleNotificationBody = createAppleNotificationBody;
17
21
  /**
18
22
  * Creates a FcmLegacyNotification from a native Firebase payload.
19
23
  * @param nativeMessage - The native message payload to send to Notification Hubs.
@@ -22,7 +26,6 @@ exports.createAppleNotificationBody = createAppleNotificationBody;
22
26
  function createFirebaseLegacyNotificationBody(nativeMessage) {
23
27
  return JSON.stringify(nativeMessage);
24
28
  }
25
- exports.createFirebaseLegacyNotificationBody = createFirebaseLegacyNotificationBody;
26
29
  /**
27
30
  * Creates a FcmV1Notification from a native Firebase payload.
28
31
  * @param nativeMessage - The native message payload to send to Notification Hubs.
@@ -31,7 +34,6 @@ exports.createFirebaseLegacyNotificationBody = createFirebaseLegacyNotificationB
31
34
  function createFirebaseV1NotificationBody(nativeMessage) {
32
35
  return JSON.stringify(nativeMessage);
33
36
  }
34
- exports.createFirebaseV1NotificationBody = createFirebaseV1NotificationBody;
35
37
  /**
36
38
  * Creates a AdmNotification from a native ADM payload.
37
39
  * @param nativeMessage - The native message payload to send to Notification Hubs.
@@ -40,7 +42,6 @@ exports.createFirebaseV1NotificationBody = createFirebaseV1NotificationBody;
40
42
  function createAdmNotificationBody(nativeMessage) {
41
43
  return JSON.stringify(nativeMessage);
42
44
  }
43
- exports.createAdmNotificationBody = createAdmNotificationBody;
44
45
  /**
45
46
  * Creates a BaiduNotification from a native Baidu payload.
46
47
  * @param nativeMessage - The native message payload to send to Notification Hubs.
@@ -49,7 +50,6 @@ exports.createAdmNotificationBody = createAdmNotificationBody;
49
50
  function createBaiduNotificationBody(nativeMessage) {
50
51
  return JSON.stringify(nativeMessage);
51
52
  }
52
- exports.createBaiduNotificationBody = createBaiduNotificationBody;
53
53
  /**
54
54
  * Builds a WindowsNotification from a Windows Badge.
55
55
  * @param nativeMessage - The Windows Badge Message to build.
@@ -61,5 +61,4 @@ function createWindowsBadgeNotificationBody(nativeMessage) {
61
61
  };
62
62
  return (0, core_xml_1.stringifyXML)(badge, { rootName: "badge" });
63
63
  }
64
- exports.createWindowsBadgeNotificationBody = createWindowsBadgeNotificationBody;
65
64
  //# sourceMappingURL=notificationBodyBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notificationBodyBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBodyBuilder.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,8CAA+C;AAmM/C;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,aAAiC;IAC3E,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,kEAEC;AAyND;;;;GAIG;AACH,SAAgB,oCAAoC,CAClD,aAA0C;IAE1C,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAJD,oFAIC;AAubD;;;;GAIG;AACH,SAAgB,gCAAgC,CAC9C,aAA8C;IAE9C,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAJD,4EAIC;AAoJD;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,aAA+B;IACvE,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,8DAEC;AAyFD;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,aAAiC;IAC3E,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,kEAEC;AA8BD;;;;GAIG;AACH,SAAgB,kCAAkC,CAChD,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC;AARD,gFAQC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n \"launch-image\"?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n \"title-loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n \"title-loc-args\"?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n \"subtitle-loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n \"subtitle-loc-args\"?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n \"loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n \"loc-args\"?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The Apple specific push notification information.\n */\n aps?: AppleApsNativeMessage;\n}\n\n/**\n * Represents a native APNs APS message.\n */\nexport interface AppleApsNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n \"thread-id\"?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n \"content-available\"?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n \"mutable-content\"?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n \"target-content-id\"?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n \"interruption-level\"?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n \"relevance-score\"?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n \"filter-criteria\"?: string;\n\n /**\n * The UNIX timestamp that represents the date at which a Live Activity becomes stale, or out of date.\n */\n \"stale-date\"?: number;\n\n /**\n * The updated or final content for a Live Activity.\n */\n \"content-state\"?: Record<string, any>;\n\n /**\n * The UNIX timestamp that marks the time when you send the remote notification that updates or ends a Live Activity.\n */\n timestamp?: number;\n\n /**\n * The string that describes whether you update or end an ongoing Live Activity with the remote push notification. To update the Live Activity, use update. To end the Live Activity, use end.\n */\n events?: string;\n\n /**\n * The UNIX timestamp that represents the date at which the system ends a Live Activity and removes it from the Dynamic Island and the Lock Screen.\n */\n \"dismissal-date\"?: number;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function createAppleNotificationBody(nativeMessage: AppleNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registration_ids?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapse_key?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n content_available?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutable_content?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n time_to_live?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restricted_package_name?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dry_run?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n click_action?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n android_channel_id?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n}\n\n/**\n * Creates a FcmLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createFirebaseLegacyNotificationBody(\n nativeMessage: FirebaseLegacyNativeMessage,\n): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the Firebase V1 native message envelope.\n */\nexport interface FirebaseV1NativeMessageEnvelope {\n /**\n * The Firebase V1 native message.\n */\n message: FirebaseV1NativeMessage;\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase V1 interface.\n */\nexport interface FirebaseV1NativeMessage {\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, string>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?: FirebaseV1NativeNotification;\n\n /**\n * Android specific options for messages sent through FCM connection server.\n */\n android?: FirebaseV1AndroidConfig;\n\n /**\n * Webpush protocol options.\n */\n webpush?: FirebaseV1WebPushConfig;\n\n /**\n * APNs specific options.\n */\n apns?: FirebaseV1ApnsConfig;\n\n /**\n * FCM options.\n */\n fcm_options?: FirebaseV1FcmOptions;\n\n /**\n * Registration token to send a message to.\n */\n token?: string;\n\n /**\n * Topic name to send a message to, e.g. \"weather\".\n */\n topic?: string;\n\n /**\n * Condition to send a message to, e.g. \"'foo' in topics && 'bar' in topics\".\n */\n condition?: string;\n}\n\n/**\n * Represents a native FCM V1 notification message payload.\n */\nexport interface FirebaseV1NativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * Contains the URL of an image that is going to be downloaded on the device and displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Android specific options for messages sent through FCM connection server.\n */\nexport interface FirebaseV1AndroidConfig {\n /**\n * An identifier of a group of messages that can be collapsed, so that only the last message gets sent when delivery can be resumed.\n */\n collapse_key?: string;\n\n /**\n * Message priority. Can take \"normal\" and \"high\" values.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * How long (in seconds) the message should be kept in FCM storage if the device is offline.\n */\n ttl?: string;\n\n /**\n * Package name of the application where the registration token must match in order to receive the message.\n */\n restricted_package_name?: string;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, string>;\n\n /**\n * Notification to send to android devices.\n */\n notification?: FirebaseV1AndroidNotification;\n\n /**\n * Options for features provided by the FCM SDK for Android.\n */\n fcm_options?: FirebaseV1AndroidFcmOptions;\n\n /**\n * If set to true, messages will be allowed to be delivered to the app while the device is in direct boot mode.\n */\n direct_boot_ok?: boolean;\n}\n\n/**\n * Notification to send to android devices.\n */\nexport interface FirebaseV1AndroidNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n\n /**\n * The notification's channel id (new in Android O).\n */\n channel_id?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred.\n */\n event_time?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n local_only?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notification_priority?: number;\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n default_sound?: boolean;\n\n /**\n * If set to true, use the Android framework's default vibrate pattern for the notification.\n */\n default_vibrate_timings?: boolean;\n\n /**\n * If set to true, use the Android framework's default light settings for the notification.\n */\n default_light_settings?: boolean;\n\n /**\n * Set the vibration pattern to use.\n */\n vibrate_timings?: string[];\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number;\n\n /**\n * Sets the number of items this notification represents.\n */\n notification_count?: number;\n\n /**\n * Settings to control the notification's LED blinking rate and color if LED is available on the device.\n */\n light_settings?: {\n color: {\n red: number;\n green: number;\n blue: number;\n alpha: number;\n };\n light_on_duration: string;\n light_off_duration: string;\n };\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Options for features provided by the FCM SDK for Android.\n */\nexport interface FirebaseV1AndroidFcmOptions {\n /**\n * The label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\nexport interface FirebaseV1WebPushConfig {\n /**\n * A collection of WebPush protocol options.\n */\n headers?: Record<string, string>;\n\n /**\n * A collection of WebPush protocol options.\n */\n data?: Record<string, string>;\n\n /**\n * Web Notification options as a JSON object.\n */\n notification?: FirebaseV1WebPushNotification;\n\n /**\n * A collection of WebPush protocol options.\n */\n fcm_options?: FirebaseV1WebPushFcmOptions;\n}\n\n/**\n * Represents a Web Push notification payload.\n */\nexport interface FirebaseV1WebPushNotification {\n /**\n * An array of actions to display in the notification.\n */\n actions?: {\n action?: string;\n title?: string;\n icon?: string;\n }[];\n\n /**\n * Defines a title for the notification.\n */\n title?: string;\n\n /**\n * The body string of the notification\n */\n body?: string;\n\n /**\n * A string containing the URL of an icon to be displayed in the notification.\n */\n icon?: string;\n\n /**\n * A string containing the URL of an image to represent the notification when there is not enough space to display the notification itself such as for example, the Android Notification Bar.\n */\n badge?: string;\n\n /**\n * The notification's data.\n */\n data?: Record<string, string>;\n\n /**\n * The direction in which to display the notification.\n */\n dir?: \"auto\" | \"ltr\" | \"rtl\";\n\n /**\n * A string containing the URL of an image to be displayed in the notification.\n */\n image?: string;\n\n /**\n * The notification's language.\n */\n lang?: string;\n\n /**\n * A boolean value specifying whether the user should be notified after a new notification replaces an old one.\n */\n renotify?: boolean;\n\n /**\n * Indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.\n */\n requireInteraction?: boolean;\n\n /**\n * A boolean value specifying whether the notification is silent\n */\n silent?: boolean;\n\n /**\n * A string representing an identifying tag for the notification.\n */\n tag?: string;\n\n /**\n * A number representing the time at which a notification is created or applicable\n */\n timestamp?: number;\n\n /**\n * A vibration pattern for the device's vibration hardware to emit with the notification.\n */\n vibrate?: number[];\n}\n\n/**\n * Options for features provided by the FCM SDK for Web.\n */\nexport interface FirebaseV1WebPushFcmOptions {\n /**\n * The link to open when the user clicks on the notification.\n */\n link?: string;\n\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\n/**\n * Apple Push Notification Service specific options.\n */\nexport interface FirebaseV1ApnsConfig {\n /**\n * A collection of APNs headers.\n */\n headers?: Record<string, string>;\n\n /**\n * A collection of APNs headers.\n */\n payload?: AppleNativeMessage;\n\n /**\n * A collection of APNs headers.\n */\n fcm_options?: FirebaseV1ApnsFcmOptions;\n}\n\n/**\n * Options for features provided by the FCM SDK for iOS.\n */\nexport interface FirebaseV1ApnsFcmOptions {\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\nexport interface FirebaseV1FcmOptions {\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\n/**\n * Creates a FcmV1Notification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createFirebaseV1NotificationBody(\n nativeMessage: FirebaseV1NativeMessageEnvelope,\n): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n\n /**\n * The notification's channel id.\n */\n channel_id?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n event_time?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n local_only?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notification_priority?: number;\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n default_sound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number;\n\n /**\n * Sets the number of items this notification represents.\n */\n notification_count?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function createAdmNotificationBody(nativeMessage: AdmNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notification_builder_id?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notification_basic_style?: number;\n\n /**\n * Baidu Android open type.\n */\n open_type?: number;\n\n /**\n * Baidu Android net support option.\n */\n net_support?: number;\n\n /**\n * Baidu Android user confirm.\n */\n user_confirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkg_content?: string;\n\n /**\n * Baidu Android package version.\n */\n pkg_version?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n custom_content?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createBaiduNotificationBody(nativeMessage: BaiduNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns The WNS XML created with the badge information.\n */\nexport function createWindowsBadgeNotificationBody(\n nativeMessage: WindowsBadgeNativeMessage,\n): string {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return stringifyXML(badge, { rootName: \"badge\" });\n}\n"]}
1
+ {"version":3,"file":"notificationBodyBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationBodyBuilder.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA2MlC,kEAEC;AA8ND,oFAIC;AA4bD,4EAIC;AAyJD,8DAEC;AA8FD,kEAEC;AAmCD,gFAQC;AAnpCD,8CAA+C;AAmM/C;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,aAAiC;IAC3E,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAyND;;;;GAIG;AACH,SAAgB,oCAAoC,CAClD,aAA0C;IAE1C,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAubD;;;;GAIG;AACH,SAAgB,gCAAgC,CAC9C,aAA8C;IAE9C,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAoJD;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,aAA+B;IACvE,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAyFD;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,aAAiC;IAC3E,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AA8BD;;;;GAIG;AACH,SAAgB,kCAAkC,CAChD,aAAwC;IAExC,MAAM,KAAK,GAAG;QACZ,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;KAClC,CAAC;IAEF,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { stringifyXML } from \"@azure/core-xml\";\n\n/**\n * Represents what is in the APNs alert body.\n */\nexport interface AppleAlert {\n /**\n * The title of the notification. Apple Watch displays this string in the short look notification\n * interface. Specify a string that’s quickly understood by the user.\n */\n title?: string;\n\n /**\n * Additional information that explains the purpose of the notification.\n */\n subtitle?: string;\n\n /**\n * The content of the alert message.\n */\n body?: string;\n\n /**\n * The name of the launch image file to display. If the user chooses to launch your app,\n * the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.\n */\n \"launch-image\"?: string;\n\n /**\n * The key for a localized title string. Specify this key instead of the title key to retrieve\n * the title from your app’s Localizable.strings files. The value must contain the name of a key in your strings file.\n */\n \"title-loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by the title-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance\n * of the %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n \"title-loc-args\"?: string[];\n\n /**\n * The key for a localized subtitle string. Use this key, instead of the subtitle key, to\n * retrieve the subtitle from your app’s Localizable.strings file.\n * The value must contain the name of a key in your strings file.\n */\n \"subtitle-loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your title string.\n * Each %\\@ character in the string specified by subtitle-loc-key is replaced by a value\n * from this array. The first item in the array replaces the first instance of the\n * %\\@ character in the string, the second item replaces the second instance, and so on.\n */\n \"subtitle-loc-args\"?: string[];\n\n /**\n * The key for a localized message string. Use this key, instead of the body key, to\n * retrieve the message text from your app’s Localizable.strings file. The value must contain\n * the name of a key in your strings file.\n */\n \"loc-key\"?: string;\n\n /**\n * An array of strings containing replacement values for variables in your message text.\n * Each %\\@ character in the string specified by loc-key is replaced by a value from\n * this array. The first item in the array replaces the first instance of the %\\@ character\n * in the string, the second item replaces the second instance, and so on.\n */\n \"loc-args\"?: string[];\n}\n\n/**\n * Represents an APNs critical sound\n */\nexport interface AppleCriticalSound {\n /**\n * The critical alert flag. Set to 1 to enable the critical alert.\n */\n critical: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds folder\n * of your app’s container directory. Specify the string “default” to play the system sound.\n */\n name: string;\n\n /**\n * The volume for the critical alert’s sound. Set this to a value between 0 (silent) and 1 (full volume).\n */\n volume: number;\n}\n\n/**\n * Represents a native APNs message.\n */\nexport interface AppleNativeMessage extends Record<string, any> {\n /**\n * The Apple specific push notification information.\n */\n aps?: AppleApsNativeMessage;\n}\n\n/**\n * Represents a native APNs APS message.\n */\nexport interface AppleApsNativeMessage extends Record<string, any> {\n /**\n * The information for displaying an alert.\n */\n alert?: string | AppleAlert;\n\n /**\n * The number to display in a badge on your app’s icon.\n */\n badge?: number;\n\n /**\n * The name of a sound file in your app’s main bundle or in the Library/Sounds\n * folder of your app’s container directory. Specify the string “default” to\n * play the system sound. Use this key for regular notifications.\n * For critical alerts, use the sound dictionary instead.\n */\n sound?: string | AppleCriticalSound;\n\n /**\n * An app-specific identifier for grouping related notifications.\n */\n \"thread-id\"?: string;\n\n /**\n * The notification’s type.\n */\n category?: string;\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n \"content-available\"?: number;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n \"mutable-content\"?: number;\n\n /**\n * The identifier of the window brought forward.\n */\n \"target-content-id\"?: string;\n\n /**\n * The importance and delivery timing of a notification.\n */\n \"interruption-level\"?: \"passive\" | \"active\" | \"time-sensitive\" | \"critical\";\n\n /**\n * The relevance score, a number between 0 and 1, that the system uses to sort the\n * notifications from your app. The highest score gets featured in the notification summary.\n */\n \"relevance-score\"?: number;\n\n /**\n * The criteria the system evaluates to determine if it displays the notification in the current Focus.\n */\n \"filter-criteria\"?: string;\n\n /**\n * The UNIX timestamp that represents the date at which a Live Activity becomes stale, or out of date.\n */\n \"stale-date\"?: number;\n\n /**\n * The updated or final content for a Live Activity.\n */\n \"content-state\"?: Record<string, any>;\n\n /**\n * The UNIX timestamp that marks the time when you send the remote notification that updates or ends a Live Activity.\n */\n timestamp?: number;\n\n /**\n * The string that describes whether you update or end an ongoing Live Activity with the remote push notification. To update the Live Activity, use update. To end the Live Activity, use end.\n */\n events?: string;\n\n /**\n * The UNIX timestamp that represents the date at which the system ends a Live Activity and removes it from the Dynamic Island and the Lock Screen.\n */\n \"dismissal-date\"?: number;\n}\n\n/**\n * Creates an APNs native message to send to Notification Hubs.\n * @param nativeMessage - The Apple native message properties to set.\n * @param additionalProperties - Additional properties for Apple messages.\n * @returns An AppleNotification to send to Notification Hubs.\n */\nexport function createAppleNotificationBody(nativeMessage: AppleNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyNativeMessage {\n /**\n * The recipient of a message.\n */\n to?: string;\n\n /**\n * The recipient of a multicast message, a message sent to more than one registration token.\n */\n registration_ids?: string[];\n\n /**\n * A logical expression of conditions that determine the message target.\n */\n condition?: string;\n\n /**\n * Used to identify a group of messages.\n */\n collapse_key?: string;\n\n /**\n * The priority of the message.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * The background notification flag. To perform a silent background update,\n * specify the value 1 and don’t include the alert, badge, or sound keys in your payload.\n */\n content_available?: boolean;\n\n /**\n * The notification service app extension flag. If the value is 1, the system passes\n * the notification to your notification service app extension before delivery.\n */\n mutable_content?: number;\n\n /**\n * Specifies how long (in seconds) the message should be kept in FCM storage if the device is offline\n */\n time_to_live?: number;\n\n /**\n * The package name of the application where the registration tokens must match in order to receive the message.\n */\n restricted_package_name?: string;\n\n /**\n * When set to true, allows developers to test a request without actually sending a message.\n */\n dry_run?: boolean;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, any>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?:\n | FirebaseLegacyAppleNativePayload\n | FirebaseLegacyAndroidNativePayload\n | FirebaseLegacyWebNativePayload;\n}\n\n/**\n * Represents an APNs native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAppleNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * The value of the badge on the home screen app icon.\n */\n badge?: string;\n\n /**\n * The action associated with a user click on the notification which corresponds to the APNs category.\n */\n click_action?: string;\n\n /**\n * The notification's subtitle.\n */\n subtitle?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n}\n\n/**\n * Represents an Android native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyAndroidNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's channel ID.\n */\n android_channel_id?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n}\n\n/**\n * Represents an Web Push native payload for the Firebase Legacy HTTP interface.\n */\nexport interface FirebaseLegacyWebNativePayload {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The URL to use for the notification's icon.\n */\n icon?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n}\n\n/**\n * Creates a FcmLegacyNotification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createFirebaseLegacyNotificationBody(\n nativeMessage: FirebaseLegacyNativeMessage,\n): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the Firebase V1 native message envelope.\n */\nexport interface FirebaseV1NativeMessageEnvelope {\n /**\n * The Firebase V1 native message.\n */\n message: FirebaseV1NativeMessage;\n}\n\n/**\n * Represents the targets, options, and payload for HTTP JSON messages for the Firebase V1 interface.\n */\nexport interface FirebaseV1NativeMessage {\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, string>;\n\n /**\n * The predefined, user-visible key-value pairs of the notification payload.\n */\n notification?: FirebaseV1NativeNotification;\n\n /**\n * Android specific options for messages sent through FCM connection server.\n */\n android?: FirebaseV1AndroidConfig;\n\n /**\n * Webpush protocol options.\n */\n webpush?: FirebaseV1WebPushConfig;\n\n /**\n * APNs specific options.\n */\n apns?: FirebaseV1ApnsConfig;\n\n /**\n * FCM options.\n */\n fcm_options?: FirebaseV1FcmOptions;\n\n /**\n * Registration token to send a message to.\n */\n token?: string;\n\n /**\n * Topic name to send a message to, e.g. \"weather\".\n */\n topic?: string;\n\n /**\n * Condition to send a message to, e.g. \"'foo' in topics && 'bar' in topics\".\n */\n condition?: string;\n}\n\n/**\n * Represents a native FCM V1 notification message payload.\n */\nexport interface FirebaseV1NativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * Contains the URL of an image that is going to be downloaded on the device and displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Android specific options for messages sent through FCM connection server.\n */\nexport interface FirebaseV1AndroidConfig {\n /**\n * An identifier of a group of messages that can be collapsed, so that only the last message gets sent when delivery can be resumed.\n */\n collapse_key?: string;\n\n /**\n * Message priority. Can take \"normal\" and \"high\" values.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * How long (in seconds) the message should be kept in FCM storage if the device is offline.\n */\n ttl?: string;\n\n /**\n * Package name of the application where the registration token must match in order to receive the message.\n */\n restricted_package_name?: string;\n\n /**\n * Custom key-value pairs of the message's payload.\n */\n data?: Record<string, string>;\n\n /**\n * Notification to send to android devices.\n */\n notification?: FirebaseV1AndroidNotification;\n\n /**\n * Options for features provided by the FCM SDK for Android.\n */\n fcm_options?: FirebaseV1AndroidFcmOptions;\n\n /**\n * If set to true, messages will be allowed to be delivered to the app while the device is in direct boot mode.\n */\n direct_boot_ok?: boolean;\n}\n\n/**\n * Notification to send to android devices.\n */\nexport interface FirebaseV1AndroidNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n\n /**\n * The notification's channel id (new in Android O).\n */\n channel_id?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred.\n */\n event_time?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n local_only?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notification_priority?: number;\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n default_sound?: boolean;\n\n /**\n * If set to true, use the Android framework's default vibrate pattern for the notification.\n */\n default_vibrate_timings?: boolean;\n\n /**\n * If set to true, use the Android framework's default light settings for the notification.\n */\n default_light_settings?: boolean;\n\n /**\n * Set the vibration pattern to use.\n */\n vibrate_timings?: string[];\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number;\n\n /**\n * Sets the number of items this notification represents.\n */\n notification_count?: number;\n\n /**\n * Settings to control the notification's LED blinking rate and color if LED is available on the device.\n */\n light_settings?: {\n color: {\n red: number;\n green: number;\n blue: number;\n alpha: number;\n };\n light_on_duration: string;\n light_off_duration: string;\n };\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Options for features provided by the FCM SDK for Android.\n */\nexport interface FirebaseV1AndroidFcmOptions {\n /**\n * The label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\nexport interface FirebaseV1WebPushConfig {\n /**\n * A collection of WebPush protocol options.\n */\n headers?: Record<string, string>;\n\n /**\n * A collection of WebPush protocol options.\n */\n data?: Record<string, string>;\n\n /**\n * Web Notification options as a JSON object.\n */\n notification?: FirebaseV1WebPushNotification;\n\n /**\n * A collection of WebPush protocol options.\n */\n fcm_options?: FirebaseV1WebPushFcmOptions;\n}\n\n/**\n * Represents a Web Push notification payload.\n */\nexport interface FirebaseV1WebPushNotification {\n /**\n * An array of actions to display in the notification.\n */\n actions?: {\n action?: string;\n title?: string;\n icon?: string;\n }[];\n\n /**\n * Defines a title for the notification.\n */\n title?: string;\n\n /**\n * The body string of the notification\n */\n body?: string;\n\n /**\n * A string containing the URL of an icon to be displayed in the notification.\n */\n icon?: string;\n\n /**\n * A string containing the URL of an image to represent the notification when there is not enough space to display the notification itself such as for example, the Android Notification Bar.\n */\n badge?: string;\n\n /**\n * The notification's data.\n */\n data?: Record<string, string>;\n\n /**\n * The direction in which to display the notification.\n */\n dir?: \"auto\" | \"ltr\" | \"rtl\";\n\n /**\n * A string containing the URL of an image to be displayed in the notification.\n */\n image?: string;\n\n /**\n * The notification's language.\n */\n lang?: string;\n\n /**\n * A boolean value specifying whether the user should be notified after a new notification replaces an old one.\n */\n renotify?: boolean;\n\n /**\n * Indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.\n */\n requireInteraction?: boolean;\n\n /**\n * A boolean value specifying whether the notification is silent\n */\n silent?: boolean;\n\n /**\n * A string representing an identifying tag for the notification.\n */\n tag?: string;\n\n /**\n * A number representing the time at which a notification is created or applicable\n */\n timestamp?: number;\n\n /**\n * A vibration pattern for the device's vibration hardware to emit with the notification.\n */\n vibrate?: number[];\n}\n\n/**\n * Options for features provided by the FCM SDK for Web.\n */\nexport interface FirebaseV1WebPushFcmOptions {\n /**\n * The link to open when the user clicks on the notification.\n */\n link?: string;\n\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\n/**\n * Apple Push Notification Service specific options.\n */\nexport interface FirebaseV1ApnsConfig {\n /**\n * A collection of APNs headers.\n */\n headers?: Record<string, string>;\n\n /**\n * A collection of APNs headers.\n */\n payload?: AppleNativeMessage;\n\n /**\n * A collection of APNs headers.\n */\n fcm_options?: FirebaseV1ApnsFcmOptions;\n}\n\n/**\n * Options for features provided by the FCM SDK for iOS.\n */\nexport interface FirebaseV1ApnsFcmOptions {\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\nexport interface FirebaseV1FcmOptions {\n /**\n * Label associated with the message's analytics data.\n */\n analytics_label?: string;\n}\n\n/**\n * Creates a FcmV1Notification from a native Firebase payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createFirebaseV1NotificationBody(\n nativeMessage: FirebaseV1NativeMessageEnvelope,\n): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Describes ADM notification messages.\n */\nexport interface AdmNativeNotification {\n /**\n * The notification's title.\n */\n title?: string;\n\n /**\n * The notification's body text.\n */\n body?: string;\n\n /**\n * The notification's icon.\n */\n icon?: string;\n\n /**\n * The notification's icon color, expressed in #rrggbb format.\n */\n color?: string;\n\n /**\n * The sound to play when the device receives the notification. Supports \"default\" or the filename of a sound resource bundled in the app.\n */\n sound?: string;\n\n /**\n * Identifier used to replace existing notifications in the notification drawer.\n */\n tag?: string;\n\n /**\n * The action associated with a user click on the notification.\n */\n click_action?: string;\n\n /**\n * The key to the body string in the app's string resources to use to localize the body text to the user's current localization.\n */\n body_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in body_loc_key to use to localize the body text to the user's current localization.\n */\n body_loc_args?: string[];\n\n /**\n * The key to the title string in the app's string resources to use to localize the title text to the user's current localization.\n */\n title_loc_key?: string;\n\n /**\n * Variable string values to be used in place of the format specifiers in title_loc_key to use to localize the title text to the user's current localization.\n */\n title_loc_args?: string[];\n\n /**\n * The notification's channel id.\n */\n channel_id?: string;\n\n /**\n * Sets the \"ticker\" text, which is sent to accessibility services.\n */\n ticker?: string;\n\n /**\n * When set to false or unset, the notification is automatically dismissed when the user clicks it in the panel.\n */\n sticky?: boolean;\n\n /**\n * Set the time that the event in the notification occurred. Must be a timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. Example: \"2014-10-02T15:01:23.045123456Z\".\n */\n event_time?: string;\n\n /**\n * Set whether or not this notification is relevant only to the current device.\n */\n local_only?: boolean;\n\n /**\n * Set the relative priority for this notification.\n */\n notification_priority?: number;\n\n /**\n * If set to true, use the Android framework's default sound for the notification.\n */\n default_sound?: boolean;\n\n /**\n * Set the Notification.visibility of the notification.\n */\n visibility?: number;\n\n /**\n * Sets the number of items this notification represents.\n */\n notification_count?: number;\n\n /**\n * Contains the URL of an image that is going to be displayed in a notification.\n */\n image?: string;\n}\n\n/**\n * Represents a native ADM notification message payload.\n */\nexport interface AdmNativeMessage {\n /**\n * The notification payload to send with the message.\n */\n notification?: AdmNativeNotification;\n\n /**\n * The payload data to send with the message.\n */\n data?: Record<string, string>;\n\n /**\n * The priority of the msssage.\n */\n priority?: \"normal\" | \"high\";\n\n /**\n * This is an arbitrary string used to indicate that multiple messages are logically the same\n * and that ADM is allowed to drop previously enqueued messages in favor of this new one.\n */\n consolidationKey?: string;\n\n /**\n * The number of seconds that ADM should retain the message if the device is offline.\n */\n expiresAfter?: number;\n\n /**\n * This is a base-64-encoded MD5 checksum of the data parameter.\n */\n md5?: string;\n}\n\n/**\n * Creates a AdmNotification from a native ADM payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The AdmNotification to send to Notification Hubs.\n */\nexport function createAdmNotificationBody(nativeMessage: AdmNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the Baidu Apple native payload.\n */\nexport interface BaiduAppleNativePayload {\n /**\n * The alert string.\n */\n alert?: string;\n\n /**\n * The APNs sound to play.\n */\n sound?: string;\n\n /**\n * The APNs badge count.\n */\n badge?: number;\n}\n\n/**\n * Baidu Native Format:\n * https://stackoverflow.com/questions/42591815/customize-baidu-push-json-payload\n * http://www.tuicool.com/articles/ZnmANn\n */\nexport interface BaiduNativeMessage extends Record<string, any> {\n /**\n * Notification title for Android.\n */\n title?: string;\n\n /**\n * Baidu Notification description for Android.\n */\n description?: string;\n\n /**\n * Baidu Notification builder ID.\n */\n notification_builder_id?: number;\n\n /**\n * Baidu Notification Android basic style.\n */\n notification_basic_style?: number;\n\n /**\n * Baidu Android open type.\n */\n open_type?: number;\n\n /**\n * Baidu Android net support option.\n */\n net_support?: number;\n\n /**\n * Baidu Android user confirm.\n */\n user_confirm?: number;\n\n /**\n * Baidu Android URL.\n */\n url?: string;\n\n /**\n * Baidu Android package content.\n */\n pkg_content?: string;\n\n /**\n * Baidu Android package version.\n */\n pkg_version?: string;\n\n /**\n * Baidu Android custom content dictionary.\n */\n custom_content?: Record<string, any>;\n\n /**\n * Baidu APNs support.\n */\n aps?: BaiduAppleNativePayload;\n}\n\n/**\n * Creates a BaiduNotification from a native Baidu payload.\n * @param nativeMessage - The native message payload to send to Notification Hubs.\n * @returns The JSON body to send to Notification Hubs.\n */\nexport function createBaiduNotificationBody(nativeMessage: BaiduNativeMessage): string {\n return JSON.stringify(nativeMessage);\n}\n\n/**\n * Represents the types of Windows Badge Glyphs\n */\nexport type WindowsBadgeGlyphType =\n | \"none\"\n | \"activity\"\n | \"alarm\"\n | \"alert\"\n | \"attention\"\n | \"available\"\n | \"away\"\n | \"busy\"\n | \"error\"\n | \"newMessage\"\n | \"paused\"\n | \"playing\"\n | \"unavailable\";\n\n/**\n * Represents the Windows Badge Message\n */\nexport interface WindowsBadgeNativeMessage {\n /**\n * Either a numeric value or a string value that specifies a predefined badge glyph.\n */\n value: WindowsBadgeGlyphType | number;\n}\n\n/**\n * Builds a WindowsNotification from a Windows Badge.\n * @param nativeMessage - The Windows Badge Message to build.\n * @returns The WNS XML created with the badge information.\n */\nexport function createWindowsBadgeNotificationBody(\n nativeMessage: WindowsBadgeNativeMessage,\n): string {\n const badge = {\n $: { value: nativeMessage.value },\n };\n\n return stringifyXML(badge, { rootName: \"badge\" });\n}\n"]}