@azure/notification-hubs 1.1.2-alpha.20240320.1 → 1.2.0-alpha.20240326.2

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.
@@ -28,7 +28,8 @@ export function createAdmNotification(notification) {
28
28
  * @returns A newly created Baidu.
29
29
  */
30
30
  export function createBaiduNotification(notification) {
31
- return Object.assign(Object.assign({}, notification), { platform: "baidu", contentType: Constants.JSON_CONTENT_TYPE });
31
+ const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
32
+ return Object.assign(Object.assign({}, notification), { body, platform: "baidu", contentType: Constants.JSON_CONTENT_TYPE });
32
33
  }
33
34
  /**
34
35
  * Creates a notification to send to a browser.
@@ -36,7 +37,8 @@ export function createBaiduNotification(notification) {
36
37
  * @returns A newly created Web Push browser.
37
38
  */
38
39
  export function createBrowserNotification(notification) {
39
- return Object.assign(Object.assign({}, notification), { platform: "browser", contentType: Constants.JSON_CONTENT_TYPE });
40
+ const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
41
+ return Object.assign(Object.assign({}, notification), { body, platform: "browser", contentType: Constants.JSON_CONTENT_TYPE });
40
42
  }
41
43
  /**
42
44
  * Creates a notification to send to Firebase.
@@ -62,15 +64,17 @@ export function createFcmV1Notification(notification) {
62
64
  * @returns A newly created Xiaomi notification.
63
65
  */
64
66
  export function createXiaomiNotification(notification) {
65
- return Object.assign(Object.assign({}, notification), { platform: "xiaomi", contentType: Constants.JSON_CONTENT_TYPE });
67
+ const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
68
+ return Object.assign(Object.assign({}, notification), { body, platform: "xiaomi", contentType: Constants.JSON_CONTENT_TYPE });
66
69
  }
67
70
  /**
68
- * Creates a notification to send to Firebase.
69
- * @param notification - A partial message used to create a message for Firebase.
71
+ * Creates a template notification.
72
+ * @param notification - A partial message used to be used for a template notification.
70
73
  * @returns A newly created Firebase.
71
74
  */
72
75
  export function createTemplateNotification(notification) {
73
- return Object.assign(Object.assign({}, notification), { platform: "template", contentType: Constants.JSON_CONTENT_TYPE });
76
+ const body = isString(notification.body) ? notification.body : JSON.stringify(notification.body);
77
+ return Object.assign(Object.assign({}, notification), { body, platform: "template", contentType: Constants.JSON_CONTENT_TYPE });
74
78
  }
75
79
  /**
76
80
  * Creates a notification to send to WNS.
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AASnD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAoDD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAqC;IAC3E,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjG,uCACK,YAAY,KACf,IAAI,EACJ,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AA2BD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAmC;IACvE,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjG,uCACK,YAAY,KACf,IAAI,EACJ,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,iBAAiB,IACxC;AACJ,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAgC;IACtE,uCACK,YAAY,KACf,QAAQ,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,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, string | undefined>;\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 | undefined>;\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: NotificationCommon): BaiduNotification {\n return {\n ...notification,\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(notification: NotificationCommon): BrowserNotification {\n return {\n ...notification,\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 | undefined>;\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 Legacy 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 | undefined>;\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(notification: NotificationCommon): XiaomiNotification {\n return {\n ...notification,\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 notification to send to Firebase.\n * @param notification - A partial message used to create a message for Firebase.\n * @returns A newly created Firebase.\n */\nexport function createTemplateNotification(notification: NotificationCommon): TemplateNotification {\n return {\n ...notification,\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":[],"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,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,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","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 +1 @@
1
- {"version":3,"file":"notificationHeaderBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationHeaderBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Describes the types of APNs pushes.\n */\nexport type ApnsPushTypes =\n | \"alert\"\n | \"background\"\n | \"voip\"\n | \"complication\"\n | \"fileprovider\"\n | \"mdm\"\n | \"location\"\n | \"liveactivity\"\n | \"pushtotalk\";\n\n/**\n * The list of APNs specific headers.\n */\nexport interface AppleHeaders extends Record<string, string | undefined> {\n /**\n * The value of this header must accurately reflect the contents of your notification’s payload.\n */\n \"apns-push-type\"?: ApnsPushTypes;\n /**\n * A canonical UUID that’s the unique ID for the notification.\n */\n \"apns-id\"?: string;\n /**\n * The date at which the notification is no longer valid. This value is a UNIX epoch expressed in seconds (UTC).\n */\n \"apns-expiration\"?: string;\n /**\n * The priority of the notification. If you omit this header, APNs sets the notification priority to 10.\n */\n \"apns-priority\"?: \"5\" | \"10\";\n /**\n * The topic for the notification. In general, the topic is your app’s bundle ID/app ID.\n */\n \"apns-topic\"?: string;\n /**\n * An identifier you use to merge multiple notifications into a single notification for the user.\n */\n \"apns-collapse-id\"?: string;\n}\n\n/**\n * The list of WNS specific types.\n */\nexport type WnsTypes = \"wns/toast\" | \"wns/badge\" | \"wns/tile\" | \"wns/raw\";\n\n/**\n * List of WNS specific headers.\n */\nexport interface WindowsHeaders extends Record<string, string | undefined> {\n /**\n * The header specifies whether this is a tile, toast, badge, or raw notification.\n */\n \"X-WNS-Type\"?: WnsTypes;\n}\n"]}
1
+ {"version":3,"file":"notificationHeaderBuilder.js","sourceRoot":"","sources":["../../../src/models/notificationHeaderBuilder.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Describes the types of APNs pushes.\n */\nexport type ApnsPushTypes =\n | \"alert\"\n | \"background\"\n | \"voip\"\n | \"complication\"\n | \"fileprovider\"\n | \"mdm\"\n | \"location\"\n | \"liveactivity\"\n | \"pushtotalk\";\n\n/**\n * The list of APNs specific headers.\n */\nexport interface AppleHeaders extends Record<string, unknown> {\n /**\n * The value of this header must accurately reflect the contents of your notification’s payload.\n */\n \"apns-push-type\"?: ApnsPushTypes;\n /**\n * A canonical UUID that’s the unique ID for the notification.\n */\n \"apns-id\"?: string;\n /**\n * The date at which the notification is no longer valid. This value is a UNIX epoch expressed in seconds (UTC).\n */\n \"apns-expiration\"?: string;\n /**\n * The priority of the notification. If you omit this header, APNs sets the notification priority to 10.\n */\n \"apns-priority\"?: \"5\" | \"10\";\n /**\n * The topic for the notification. In general, the topic is your app’s bundle ID/app ID.\n */\n \"apns-topic\"?: string;\n /**\n * An identifier you use to merge multiple notifications into a single notification for the user.\n */\n \"apns-collapse-id\"?: string;\n}\n\n/**\n * The list of WNS specific types.\n */\nexport type WnsTypes = \"wns/toast\" | \"wns/badge\" | \"wns/tile\" | \"wns/raw\";\n\n/**\n * List of WNS specific headers.\n */\nexport interface WindowsHeaders extends Record<string, unknown> {\n /**\n * The header specifies whether this is a tile, toast, badge, or raw notification.\n */\n \"X-WNS-Type\"?: WnsTypes;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- export const SDK_VERSION = "1.1.2";
3
+ export const SDK_VERSION = "1.2.0";
4
4
  export const JSON_CONTENT_TYPE = "application/json;charset=utf-8";
5
5
  export const XML_CONTENT_TYPE = "application/xml";
6
6
  export const STREAM_CONTENT_TYPE = "application/octet-stream";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.1.2\";\n\nexport const JSON_CONTENT_TYPE = \"application/json;charset=utf-8\";\nexport const XML_CONTENT_TYPE = \"application/xml\";\nexport const STREAM_CONTENT_TYPE = \"application/octet-stream\";\n\nexport const WNS_TYPE_NAME = \"X-WNS-Type\";\nexport const WNS_RAW = \"wns/raw\";\nexport const WNS_BADGE = \"wns/badge\";\nexport const WNS_TITLE = \"wns/tile\";\nexport const WNS_TOAST = \"wns/toast\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const SDK_VERSION: string = \"1.2.0\";\n\nexport const JSON_CONTENT_TYPE = \"application/json;charset=utf-8\";\nexport const XML_CONTENT_TYPE = \"application/xml\";\nexport const STREAM_CONTENT_TYPE = \"application/octet-stream\";\n\nexport const WNS_TYPE_NAME = \"X-WNS-Type\";\nexport const WNS_RAW = \"wns/raw\";\nexport const WNS_BADGE = \"wns/badge\";\nexport const WNS_TITLE = \"wns/tile\";\nexport const WNS_TOAST = \"wns/toast\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/notification-hubs",
3
- "version": "1.1.2-alpha.20240320.1",
3
+ "version": "1.2.0-alpha.20240326.2",
4
4
  "description": "Azure Notification Hubs SDK for JavaScript",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.cjs",
@@ -156,7 +156,7 @@ export declare interface AdmNotificationParams {
156
156
  /**
157
157
  * The headers to include for the push notification.
158
158
  */
159
- headers?: Record<string, string | undefined>;
159
+ headers?: Record<string, string>;
160
160
  }
161
161
 
162
162
  /**
@@ -371,7 +371,7 @@ export declare interface AppleCriticalSound {
371
371
  /**
372
372
  * The list of APNs specific headers.
373
373
  */
374
- export declare interface AppleHeaders extends Record<string, string | undefined> {
374
+ export declare interface AppleHeaders extends Record<string, unknown> {
375
375
  /**
376
376
  * The value of this header must accurately reflect the contents of your notification’s payload.
377
377
  */
@@ -850,7 +850,7 @@ export declare function createBaiduInstallation(installation: DeviceTokenInstall
850
850
  * @param notification - A partial message used to create a message for Baidu.
851
851
  * @returns A newly created Baidu.
852
852
  */
853
- export declare function createBaiduNotification(notification: NotificationCommon): BaiduNotification;
853
+ export declare function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification;
854
854
 
855
855
  /**
856
856
  * Creates a BaiduNotification from a native Baidu payload.
@@ -885,7 +885,7 @@ export declare function createBrowserInstallation(installation: BrowserInstallat
885
885
  * @param notification - A partial message used to create a message for a browser.
886
886
  * @returns A newly created Web Push browser.
887
887
  */
888
- export declare function createBrowserNotification(notification: NotificationCommon): BrowserNotification;
888
+ export declare function createBrowserNotification(notification: NotificationCommonParams): BrowserNotification;
889
889
 
890
890
  /**
891
891
  * Creates a Web Push registration description.
@@ -979,11 +979,11 @@ export declare function createFirebaseV1NotificationBody(nativeMessage: Firebase
979
979
  export declare function createTagExpression(tags: string[]): string;
980
980
 
981
981
  /**
982
- * Creates a notification to send to Firebase.
983
- * @param notification - A partial message used to create a message for Firebase.
982
+ * Creates a template notification.
983
+ * @param notification - A partial message used to be used for a template notification.
984
984
  * @returns A newly created Firebase.
985
985
  */
986
- export declare function createTemplateNotification(notification: NotificationCommon): TemplateNotification;
986
+ export declare function createTemplateNotification(notification: NotificationCommonParams): TemplateNotification;
987
987
 
988
988
  /**
989
989
  * Creates a badge message to send to WNS.
@@ -1060,7 +1060,7 @@ export declare function createXiaomiInstallation(installation: DeviceTokenInstal
1060
1060
  * @param notification - A partial message used to create a message for Xiaomi.
1061
1061
  * @returns A newly created Xiaomi notification.
1062
1062
  */
1063
- export declare function createXiaomiNotification(notification: NotificationCommon): XiaomiNotification;
1063
+ export declare function createXiaomiNotification(notification: NotificationCommonParams): XiaomiNotification;
1064
1064
 
1065
1065
  /**
1066
1066
  * Creates a Xiaomi registration description.
@@ -1137,7 +1137,7 @@ export declare interface FcmLegacyNotificationParams {
1137
1137
  /**
1138
1138
  * The headers to include for the push notification.
1139
1139
  */
1140
- headers?: Record<string, string | undefined>;
1140
+ headers?: Record<string, string>;
1141
1141
  }
1142
1142
 
1143
1143
  /**
@@ -1161,7 +1161,7 @@ export declare interface FcmV1Notification extends JsonNotification {
1161
1161
  }
1162
1162
 
1163
1163
  /**
1164
- * Represents an Firebase Legacy notification that can be sent to a device.
1164
+ * Represents an Firebase V1 notification that can be sent to a device.
1165
1165
  */
1166
1166
  export declare interface FcmV1NotificationParams {
1167
1167
  /**
@@ -1171,7 +1171,7 @@ export declare interface FcmV1NotificationParams {
1171
1171
  /**
1172
1172
  * The headers to include for the push notification.
1173
1173
  */
1174
- headers?: Record<string, string | undefined>;
1174
+ headers?: Record<string, string>;
1175
1175
  }
1176
1176
 
1177
1177
  /**
@@ -1978,7 +1978,21 @@ export declare interface NotificationCommon {
1978
1978
  /**
1979
1979
  * The headers to include for the push notification.
1980
1980
  */
1981
- headers?: Record<string, string | undefined>;
1981
+ headers?: Record<string, unknown>;
1982
+ }
1983
+
1984
+ /**
1985
+ * The common notification parameters to accept a string body or JSON body.
1986
+ */
1987
+ export declare interface NotificationCommonParams {
1988
+ /**
1989
+ * The body for the push notification.
1990
+ */
1991
+ body: string | unknown;
1992
+ /**
1993
+ * The headers to include for the push notification.
1994
+ */
1995
+ headers?: Record<string, unknown>;
1982
1996
  }
1983
1997
 
1984
1998
  /**
@@ -2592,7 +2606,7 @@ export declare type WindowsContentType = "application/xml" | "application/octet-
2592
2606
  /**
2593
2607
  * List of WNS specific headers.
2594
2608
  */
2595
- export declare interface WindowsHeaders extends Record<string, string | undefined> {
2609
+ export declare interface WindowsHeaders extends Record<string, unknown> {
2596
2610
  /**
2597
2611
  * The header specifies whether this is a tile, toast, badge, or raw notification.
2598
2612
  */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.42.3"
8
+ "packageVersion": "7.43.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -11,7 +11,20 @@ export interface NotificationCommon {
11
11
  /**
12
12
  * The headers to include for the push notification.
13
13
  */
14
- headers?: Record<string, string | undefined>;
14
+ headers?: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * The common notification parameters to accept a string body or JSON body.
18
+ */
19
+ export interface NotificationCommonParams {
20
+ /**
21
+ * The body for the push notification.
22
+ */
23
+ body: string | unknown;
24
+ /**
25
+ * The headers to include for the push notification.
26
+ */
27
+ headers?: Record<string, unknown>;
15
28
  }
16
29
  /**
17
30
  * Represents a JSON notification hub.
@@ -70,7 +83,7 @@ export interface AdmNotificationParams {
70
83
  /**
71
84
  * The headers to include for the push notification.
72
85
  */
73
- headers?: Record<string, string | undefined>;
86
+ headers?: Record<string, string>;
74
87
  }
75
88
  /**
76
89
  * Creates a notification to send to an Amazon Device Messaging device.
@@ -92,7 +105,7 @@ export interface BaiduNotification extends JsonNotification {
92
105
  * @param notification - A partial message used to create a message for Baidu.
93
106
  * @returns A newly created Baidu.
94
107
  */
95
- export declare function createBaiduNotification(notification: NotificationCommon): BaiduNotification;
108
+ export declare function createBaiduNotification(notification: NotificationCommonParams): BaiduNotification;
96
109
  /**
97
110
  * Represents a Browser push notification.
98
111
  */
@@ -107,7 +120,7 @@ export interface BrowserNotification extends JsonNotification {
107
120
  * @param notification - A partial message used to create a message for a browser.
108
121
  * @returns A newly created Web Push browser.
109
122
  */
110
- export declare function createBrowserNotification(notification: NotificationCommon): BrowserNotification;
123
+ export declare function createBrowserNotification(notification: NotificationCommonParams): BrowserNotification;
111
124
  /**
112
125
  * Represents a Firebase legacy HTTP push notification.
113
126
  */
@@ -128,7 +141,7 @@ export interface FcmLegacyNotificationParams {
128
141
  /**
129
142
  * The headers to include for the push notification.
130
143
  */
131
- headers?: Record<string, string | undefined>;
144
+ headers?: Record<string, string>;
132
145
  }
133
146
  /**
134
147
  * Creates a notification to send to Firebase.
@@ -146,7 +159,7 @@ export interface FcmV1Notification extends JsonNotification {
146
159
  platform: "fcmv1";
147
160
  }
148
161
  /**
149
- * Represents an Firebase Legacy notification that can be sent to a device.
162
+ * Represents an Firebase V1 notification that can be sent to a device.
150
163
  */
151
164
  export interface FcmV1NotificationParams {
152
165
  /**
@@ -156,7 +169,7 @@ export interface FcmV1NotificationParams {
156
169
  /**
157
170
  * The headers to include for the push notification.
158
171
  */
159
- headers?: Record<string, string | undefined>;
172
+ headers?: Record<string, string>;
160
173
  }
161
174
  /**
162
175
  * Creates a notification to send to Firebase.
@@ -178,7 +191,7 @@ export interface XiaomiNotification extends JsonNotification {
178
191
  * @param notification - A partial message used to create a message for Xiaomi.
179
192
  * @returns A newly created Xiaomi notification.
180
193
  */
181
- export declare function createXiaomiNotification(notification: NotificationCommon): XiaomiNotification;
194
+ export declare function createXiaomiNotification(notification: NotificationCommonParams): XiaomiNotification;
182
195
  /**
183
196
  * Represents a template based push notification.
184
197
  */
@@ -189,11 +202,11 @@ export interface TemplateNotification extends JsonNotification {
189
202
  platform: "template";
190
203
  }
191
204
  /**
192
- * Creates a notification to send to Firebase.
193
- * @param notification - A partial message used to create a message for Firebase.
205
+ * Creates a template notification.
206
+ * @param notification - A partial message used to be used for a template notification.
194
207
  * @returns A newly created Firebase.
195
208
  */
196
- export declare function createTemplateNotification(notification: NotificationCommon): TemplateNotification;
209
+ export declare function createTemplateNotification(notification: NotificationCommonParams): TemplateNotification;
197
210
  /**
198
211
  * Represents the possible WNS content-types.
199
212
  */
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAM9E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;OAEG;IACH,WAAW,EAAE,gCAAgC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAElC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,uBAAuB,GAAG,iBAAiB,CAShG;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAEhC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAA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BAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,CAAC"}
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/models/notification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAM9E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;OAEG;IACH,WAAW,EAAE,gCAAgC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAElC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,uBAAuB,GAAG,iBAAiB,CAShG;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC;CACjB;AAED;;GAEG;AACH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AC1C,YAAY,EAAE,qBAAqB,GAClC,mBAAmB,CAgBrB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,CAAC"}
@@ -5,7 +5,7 @@ export type ApnsPushTypes = "alert" | "background" | "voip" | "complication" | "
5
5
  /**
6
6
  * The list of APNs specific headers.
7
7
  */
8
- export interface AppleHeaders extends Record<string, string | undefined> {
8
+ export interface AppleHeaders extends Record<string, unknown> {
9
9
  /**
10
10
  * The value of this header must accurately reflect the contents of your notification’s payload.
11
11
  */
@@ -38,7 +38,7 @@ export type WnsTypes = "wns/toast" | "wns/badge" | "wns/tile" | "wns/raw";
38
38
  /**
39
39
  * List of WNS specific headers.
40
40
  */
41
- export interface WindowsHeaders extends Record<string, string | undefined> {
41
+ export interface WindowsHeaders extends Record<string, unknown> {
42
42
  /**
43
43
  * The header specifies whether this is a tile, toast, badge, or raw notification.
44
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"notificationHeaderBuilder.d.ts","sourceRoot":"","sources":["../../../src/models/notificationHeaderBuilder.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,YAAY,GACZ,MAAM,GACN,cAAc,GACd,cAAc,GACd,KAAK,GACL,UAAU,GACV,cAAc,GACd,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACtE;;OAEG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB"}
1
+ {"version":3,"file":"notificationHeaderBuilder.d.ts","sourceRoot":"","sources":["../../../src/models/notificationHeaderBuilder.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,YAAY,GACZ,MAAM,GACN,cAAc,GACd,cAAc,GACd,KAAK,GACL,UAAU,GACV,cAAc,GACd,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D;;OAEG;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB"}