@ua/capacitor-airship 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/UaCapacitorAirship.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/airship/capacitor/AirshipCapacitorVersion.kt +1 -1
- package/android/src/main/java/com/airship/capacitor/AirshipPlugin.kt +34 -25
- package/dist/esm/AirshipMessageCenter.d.ts +7 -0
- package/dist/esm/AirshipMessageCenter.js +9 -0
- package/dist/esm/AirshipMessageCenter.js.map +1 -1
- package/dist/esm/AirshipPush.d.ts +5 -2
- package/dist/esm/AirshipPush.js +3 -2
- package/dist/esm/AirshipPush.js.map +1 -1
- package/dist/esm/types.d.ts +34 -3
- package/dist/esm/types.js +29 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/plugin.cjs.js +41 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +41 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/AirshipCapacitorVersion.swift +1 -1
- package/ios/Plugin/AirshipPlugin.swift +18 -2
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.ios.deployment_target = '14.0'
|
|
14
14
|
s.dependency 'Capacitor'
|
|
15
15
|
s.swift_version = '5.1'
|
|
16
|
-
s.dependency "AirshipFrameworkProxy", "
|
|
16
|
+
s.dependency "AirshipFrameworkProxy", "8.1.0"
|
|
17
17
|
s.default_subspecs = ["Bootloader", "Plugin"]
|
|
18
18
|
|
|
19
19
|
|
package/android/build.gradle
CHANGED
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
android:label="@string/ua_message_center_title"
|
|
15
15
|
android:launchMode="singleTask"
|
|
16
16
|
android:exported="false">
|
|
17
|
+
<intent-filter>
|
|
18
|
+
<action android:name="com.urbanairship.VIEW_RICH_PUSH_INBOX" />
|
|
19
|
+
<data android:scheme="message" />
|
|
20
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
21
|
+
</intent-filter>
|
|
22
|
+
|
|
17
23
|
<intent-filter>
|
|
18
24
|
<action android:name="com.urbanairship.VIEW_RICH_PUSH_INBOX" />
|
|
19
25
|
<category android:name="android.intent.category.DEFAULT" />
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package com.airship.capacitor
|
|
2
2
|
|
|
3
3
|
import android.os.Build
|
|
4
|
-
import com.getcapacitor.JSArray
|
|
5
4
|
import com.getcapacitor.JSObject
|
|
6
5
|
import com.getcapacitor.Plugin
|
|
7
6
|
import com.getcapacitor.PluginCall
|
|
@@ -14,6 +13,7 @@ import com.urbanairship.actions.ActionResult
|
|
|
14
13
|
import com.urbanairship.android.framework.proxy.EventType
|
|
15
14
|
import com.urbanairship.android.framework.proxy.events.EventEmitter
|
|
16
15
|
import com.urbanairship.android.framework.proxy.proxies.AirshipProxy
|
|
16
|
+
import com.urbanairship.android.framework.proxy.proxies.EnableUserNotificationsArgs
|
|
17
17
|
import com.urbanairship.android.framework.proxy.proxies.FeatureFlagProxy
|
|
18
18
|
import com.urbanairship.json.JsonList
|
|
19
19
|
import com.urbanairship.json.JsonMap
|
|
@@ -67,7 +67,7 @@ class AirshipPlugin : Plugin() {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
private fun notifyPendingEvents() {
|
|
70
|
-
EventType.
|
|
70
|
+
EventType.entries.forEach { eventType ->
|
|
71
71
|
EventEmitter.shared().processPending(listOf(eventType)) { event ->
|
|
72
72
|
val name = EVENT_NAME_MAP[event.type]
|
|
73
73
|
if (hasListeners(name)) {
|
|
@@ -118,9 +118,17 @@ class AirshipPlugin : Plugin() {
|
|
|
118
118
|
|
|
119
119
|
// Push
|
|
120
120
|
"push#setUserNotificationsEnabled" -> call.resolveResult(method) { proxy.push.setUserNotificationsEnabled(arg.requireBoolean()) }
|
|
121
|
-
"push#enableUserNotifications" -> call.
|
|
121
|
+
"push#enableUserNotifications" -> call.resolveSuspending(method) {
|
|
122
|
+
val options = if (arg.isNull) {
|
|
123
|
+
null
|
|
124
|
+
} else {
|
|
125
|
+
EnableUserNotificationsArgs.fromJson(arg)
|
|
126
|
+
}
|
|
127
|
+
proxy.push.enableUserPushNotifications(options)
|
|
128
|
+
}
|
|
129
|
+
|
|
122
130
|
"push#isUserNotificationsEnabled" -> call.resolveResult(method) { proxy.push.isUserNotificationsEnabled() }
|
|
123
|
-
"push#getNotificationStatus" -> call.
|
|
131
|
+
"push#getNotificationStatus" -> call.resolveSuspending(method) { proxy.push.getNotificationStatus() }
|
|
124
132
|
"push#getActiveNotifications" -> call.resolveResult(method) {
|
|
125
133
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
126
134
|
proxy.push.getActiveNotifications()
|
|
@@ -171,6 +179,8 @@ class AirshipPlugin : Plugin() {
|
|
|
171
179
|
"messageCenter#dismiss" -> call.resolveResult(method) { proxy.messageCenter.dismiss() }
|
|
172
180
|
"messageCenter#display" -> call.resolveResult(method) { proxy.messageCenter.display(arg.string) }
|
|
173
181
|
"messageCenter#showMessageView" -> call.resolveResult(method) { proxy.messageCenter.showMessageView(arg.requireString()) }
|
|
182
|
+
"messageCenter#showMessageCenter" -> call.resolveResult(method) { proxy.messageCenter.showMessageCenter(arg.string) }
|
|
183
|
+
|
|
174
184
|
"messageCenter#markMessageRead" -> call.resolveResult(method) { proxy.messageCenter.markMessageRead(arg.requireString()) }
|
|
175
185
|
"messageCenter#deleteMessage" -> call.resolveResult(method) { proxy.messageCenter.deleteMessage(arg.requireString()) }
|
|
176
186
|
"messageCenter#getUnreadMessageCount" -> call.resolveResult(method) { proxy.messageCenter.getUnreadMessagesCount() }
|
|
@@ -225,28 +235,14 @@ class AirshipPlugin : Plugin() {
|
|
|
225
235
|
}
|
|
226
236
|
|
|
227
237
|
// Feature Flag
|
|
228
|
-
"featureFlagManager#flag" -> call.
|
|
229
|
-
|
|
230
|
-
try {
|
|
231
|
-
val flag = proxy.featureFlagManager.flag(arg.requireString())
|
|
232
|
-
resolveCallback(flag, null)
|
|
233
|
-
} catch (e: Exception) {
|
|
234
|
-
resolveCallback(null, e)
|
|
235
|
-
}
|
|
236
|
-
}
|
|
238
|
+
"featureFlagManager#flag" -> call.resolveSuspending(method) {
|
|
239
|
+
proxy.featureFlagManager.flag(arg.requireString())
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
"featureFlagManager#trackInteraction" -> {
|
|
240
|
-
call.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
val featureFlagProxy = FeatureFlagProxy(arg)
|
|
244
|
-
proxy.featureFlagManager.trackInteraction(flag = featureFlagProxy)
|
|
245
|
-
resolveCallback(null, null)
|
|
246
|
-
} catch (e: Exception) {
|
|
247
|
-
resolveCallback(null, e)
|
|
248
|
-
}
|
|
249
|
-
}
|
|
243
|
+
call.resolveSuspending(method) {
|
|
244
|
+
val featureFlagProxy = FeatureFlagProxy(arg)
|
|
245
|
+
proxy.featureFlagManager.trackInteraction(flag = featureFlagProxy)
|
|
250
246
|
}
|
|
251
247
|
}
|
|
252
248
|
|
|
@@ -262,14 +258,27 @@ internal fun PluginCall.resolveResult(method: String, function: () -> Any?) {
|
|
|
262
258
|
resolveDeferred(method) { callback -> callback(function(), null) }
|
|
263
259
|
}
|
|
264
260
|
|
|
261
|
+
internal suspend fun PluginCall.resolveSuspending(method: String, function: suspend () -> Any?) {
|
|
262
|
+
try {
|
|
263
|
+
when (val result = function()) {
|
|
264
|
+
is Unit -> {
|
|
265
|
+
this.resolve(JSObject())
|
|
266
|
+
}
|
|
267
|
+
else -> {
|
|
268
|
+
this.resolve(jsonMapOf("value" to result).toJSObject())
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
} catch (e: Exception) {
|
|
272
|
+
this.reject(method, e)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
265
276
|
internal fun <T> PluginCall.resolveDeferred(method: String, function: ((T?, Exception?) -> Unit) -> Unit) {
|
|
266
277
|
try {
|
|
267
278
|
function { result, error ->
|
|
268
279
|
if (error != null) {
|
|
269
280
|
this.reject(method, error)
|
|
270
281
|
} else {
|
|
271
|
-
|
|
272
|
-
|
|
273
282
|
try {
|
|
274
283
|
when (result) {
|
|
275
284
|
is Unit -> {
|
|
@@ -54,6 +54,13 @@ export declare class AirshipMessageCenter {
|
|
|
54
54
|
* @returns A promise.
|
|
55
55
|
*/
|
|
56
56
|
showMessageView(messageId: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Overlays the message center regardless if auto launch Message Center is enabled or not.
|
|
59
|
+
*
|
|
60
|
+
* @param messageId Optional message Id.
|
|
61
|
+
* @returns A promise.
|
|
62
|
+
*/
|
|
63
|
+
showMessageCenter(messageId?: string): Promise<void>;
|
|
57
64
|
/**
|
|
58
65
|
* Refreshes the messages.
|
|
59
66
|
* @returns A promise. Will reject if the list fails to refresh or if
|
|
@@ -67,6 +67,15 @@ export class AirshipMessageCenter {
|
|
|
67
67
|
showMessageView(messageId) {
|
|
68
68
|
return this.plugin.perform('messageCenter#showMessageView', messageId);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Overlays the message center regardless if auto launch Message Center is enabled or not.
|
|
72
|
+
*
|
|
73
|
+
* @param messageId Optional message Id.
|
|
74
|
+
* @returns A promise.
|
|
75
|
+
*/
|
|
76
|
+
showMessageCenter(messageId) {
|
|
77
|
+
return this.plugin.perform('messageCenter#showMessageCenter', messageId);
|
|
78
|
+
}
|
|
70
79
|
/**
|
|
71
80
|
* Refreshes the messages.
|
|
72
81
|
* @returns A promise. Will reject if the list fails to refresh or if
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirshipMessageCenter.js","sourceRoot":"","sources":["../../src/AirshipMessageCenter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQxC;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAC/B,YAA6B,MAA4B;QAA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oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACI,SAAS,CACd,QAAoD;QAEpD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC3E,CAAC;CAEF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type {\n InboxMessage,\n DisplayMessageCenterEvent,\n MessageCenterUpdatedEvent,\n} from './types';\n\n/**\n * Airship Message Center\n */\nexport class AirshipMessageCenter {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Gets the unread count.\n * @returns A promise with the result.\n */\n public getUnreadCount(): Promise<number> {\n return this.plugin.perform('messageCenter#getUnreadCount');\n }\n\n /**\n * Gets the inbox messages.\n * @returns A promise with the result.\n */\n public getMessages(): Promise<InboxMessage[]> {\n return this.plugin.perform('messageCenter#getMessages');\n }\n\n /**\n * Marks a message as read.\n * @param messageId The message Id.\n * @returns A promise. Will reject if the message is not\n * found or if takeOff is not called.\n */\n public markMessageRead(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#markMessageRead', messageId);\n }\n\n /**\n * Deletes a message.\n * @param messageId The message Id.\n * @returns A promise. Will reject if the message is not\n * found or if takeOff is not called.\n */\n public deleteMessage(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#deleteMessage', messageId);\n }\n\n /**\n * Dismisses the OOTB message center if displayed.\n * @returns A promise.\n */\n public dismiss(): Promise<void> {\n return this.plugin.perform('messageCenter#dismiss');\n }\n\n /**\n * Requests to display the Message Center.\n *\n * Will either emit an event to display the\n * Message Center if auto launch message center\n * is disabled, or display the OOTB message center.\n * @param messageId Optional message Id.\n * @returns A promise.\n */\n public display(messageId?: string): Promise<void> {\n return this.plugin.perform('messageCenter#display', messageId);\n }\n\n /** \n * Overlays the message view. Should be used to display the actual\n * message body in a custom Message Center.\n * \n * @param messageId The message Id.\n * @returns A promise.\n */\n public showMessageView(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#showMessageView', messageId);\n }\n\n /**\n * Refreshes the messages.\n * @returns A promise. Will reject if the list fails to refresh or if\n * takeOff is not called yet.\n */\n public refreshMessages(): Promise<void> {\n return this.plugin.perform('messageCenter#refreshMessages');\n }\n\n /**\n * Enables or disables showing the OOTB UI when requested to display by either\n * `display` or by a notification with a Message Center action.\n * @param autoLaunch true to show OOTB UI, false to emit events.\n */\n public setAutoLaunchDefaultMessageCenter(autoLaunch: boolean): Promise<void> {\n return this.plugin.perform(\n 'messageCenter#setAutoLaunchDefaultMessageCenter',\n autoLaunch,\n );\n }\n\n /**\n * Adds a display message center listener.\n */\n public onDisplay(\n listener: (event: DisplayMessageCenterEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.DisplayMessageCenter, listener);\n }\n\n /**\n * Adds a message center list updated listener.\n */\n public onUpdated(\n listener: (event: MessageCenterUpdatedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.MessageCenterUpdated, listener);\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AirshipMessageCenter.js","sourceRoot":"","sources":["../../src/AirshipMessageCenter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQxC;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAC/B,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D;;;OAGG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,SAAiB;QACtC,OAAO,I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,CAAC;IAC3E,CAAC;CAEF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type {\n InboxMessage,\n DisplayMessageCenterEvent,\n MessageCenterUpdatedEvent,\n} from './types';\n\n/**\n * Airship Message Center\n */\nexport class AirshipMessageCenter {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Gets the unread count.\n * @returns A promise with the result.\n */\n public getUnreadCount(): Promise<number> {\n return this.plugin.perform('messageCenter#getUnreadCount');\n }\n\n /**\n * Gets the inbox messages.\n * @returns A promise with the result.\n */\n public getMessages(): Promise<InboxMessage[]> {\n return this.plugin.perform('messageCenter#getMessages');\n }\n\n /**\n * Marks a message as read.\n * @param messageId The message Id.\n * @returns A promise. Will reject if the message is not\n * found or if takeOff is not called.\n */\n public markMessageRead(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#markMessageRead', messageId);\n }\n\n /**\n * Deletes a message.\n * @param messageId The message Id.\n * @returns A promise. Will reject if the message is not\n * found or if takeOff is not called.\n */\n public deleteMessage(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#deleteMessage', messageId);\n }\n\n /**\n * Dismisses the OOTB message center if displayed.\n * @returns A promise.\n */\n public dismiss(): Promise<void> {\n return this.plugin.perform('messageCenter#dismiss');\n }\n\n /**\n * Requests to display the Message Center.\n *\n * Will either emit an event to display the\n * Message Center if auto launch message center\n * is disabled, or display the OOTB message center.\n * @param messageId Optional message Id.\n * @returns A promise.\n */\n public display(messageId?: string): Promise<void> {\n return this.plugin.perform('messageCenter#display', messageId);\n }\n\n /** \n * Overlays the message view. Should be used to display the actual\n * message body in a custom Message Center.\n * \n * @param messageId The message Id.\n * @returns A promise.\n */\n public showMessageView(messageId: string): Promise<void> {\n return this.plugin.perform('messageCenter#showMessageView', messageId);\n }\n\n /** \n * Overlays the message center regardless if auto launch Message Center is enabled or not.\n * \n * @param messageId Optional message Id.\n * @returns A promise.\n */\n public showMessageCenter(messageId?: string): Promise<void> {\n return this.plugin.perform('messageCenter#showMessageCenter', messageId);\n }\n\n /**\n * Refreshes the messages.\n * @returns A promise. Will reject if the list fails to refresh or if\n * takeOff is not called yet.\n */\n public refreshMessages(): Promise<void> {\n return this.plugin.perform('messageCenter#refreshMessages');\n }\n\n /**\n * Enables or disables showing the OOTB UI when requested to display by either\n * `display` or by a notification with a Message Center action.\n * @param autoLaunch true to show OOTB UI, false to emit events.\n */\n public setAutoLaunchDefaultMessageCenter(autoLaunch: boolean): Promise<void> {\n return this.plugin.perform(\n 'messageCenter#setAutoLaunchDefaultMessageCenter',\n autoLaunch,\n );\n }\n\n /**\n * Adds a display message center listener.\n */\n public onDisplay(\n listener: (event: DisplayMessageCenterEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.DisplayMessageCenter, listener);\n }\n\n /**\n * Adds a message center list updated listener.\n */\n public onUpdated(\n listener: (event: MessageCenterUpdatedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.MessageCenterUpdated, listener);\n }\n\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
2
|
import type { AirshipPluginWrapper } from './AirshipPlugin';
|
|
3
|
-
import type { Android, iOS, NotificationResponseEvent, PushNotificationStatus, PushNotificationStatusChangedEvent, PushPayload, PushReceivedEvent, PushTokenReceivedEvent } from './types';
|
|
3
|
+
import type { Android, iOS, NotificationResponseEvent, PushNotificationStatus, PushNotificationStatusChangedEvent, PushPayload, PushReceivedEvent, PushTokenReceivedEvent, PromptPermissionFallback } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Airship Push.
|
|
6
6
|
*/
|
|
@@ -32,9 +32,12 @@ export declare class AirshipPush {
|
|
|
32
32
|
isUserNotificationsEnabled(): Promise<boolean>;
|
|
33
33
|
/**
|
|
34
34
|
* Enables user notifications.
|
|
35
|
+
* @param options Optional options.
|
|
35
36
|
* @returns A promise with the permission result.
|
|
36
37
|
*/
|
|
37
|
-
enableUserNotifications(
|
|
38
|
+
enableUserNotifications(options?: {
|
|
39
|
+
fallback?: PromptPermissionFallback;
|
|
40
|
+
}): Promise<boolean>;
|
|
38
41
|
/**
|
|
39
42
|
* Gets the notification status.
|
|
40
43
|
* @returns A promise with the result.
|
package/dist/esm/AirshipPush.js
CHANGED
|
@@ -29,10 +29,11 @@ export class AirshipPush {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Enables user notifications.
|
|
32
|
+
* @param options Optional options.
|
|
32
33
|
* @returns A promise with the permission result.
|
|
33
34
|
*/
|
|
34
|
-
enableUserNotifications() {
|
|
35
|
-
return this.plugin.perform('push#enableUserNotifications');
|
|
35
|
+
enableUserNotifications(options) {
|
|
36
|
+
return this.plugin.perform('push#enableUserNotifications', options);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Gets the notification status.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirshipPush.js","sourceRoot":"","sources":["../../src/AirshipPush.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC;;GAEG;AACH,MAAM,OAAO,WAAW;IAWtB,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;QACvD,IAAI,CAAC,GAAG,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;OAQG;IACI,2BAA2B,CAAC,OAAgB;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACI,0BAA0B;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC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C,uBAAuB,EAAE,SAAS,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,2BAA2B,CAChC,QAAyE;QAEzE,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,wCAAwC,EAAE,QAAQ,CAAC,CAAC;IAC/F,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D;;;;OAIG;IACI,4BAA4B,CAAC,OAAe;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,2CAA2C,EAC3C,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAC1B,MAAkC;QAElC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oCAAoC,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED;;;;OAIG;IACI,iCAAiC,CAAC,OAAgB;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,gDAAgD,EAChD,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type {\n Android,\n iOS,\n NotificationResponseEvent,\n PushNotificationStatus,\n PushNotificationStatusChangedEvent,\n PushPayload,\n PushReceivedEvent,\n PushTokenReceivedEvent,\n} from './types';\n\n/**\n * Airship Push.\n */\nexport class AirshipPush {\n /**\n * iOS only push methods.\n */\n public readonly iOS: AirshipPushIOS;\n\n /**\n * Android only push methods.\n */\n public readonly android: AirshipPushAndroid;\n\n constructor(private readonly plugin: AirshipPluginWrapper) {\n this.iOS = new AirshipPushIOS(plugin);\n this.android = new AirshipPushAndroid(plugin);\n }\n\n /**\n * Enables/disables notifications on Airship.\n *\n * When enabled, it will cause the user to be prompted for\n * the permission on platforms that support it.\n * To get the result of the prompt, use `enableUserNotifications`.\n * @param enabled true to enable, false to disable\n * @returns A promise.\n */\n public setUserNotificationsEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#setUserNotificationsEnabled', enabled);\n }\n\n /**\n * Checks if user notifications are enabled or not on Airship.\n * @returns A promise with the result.\n */\n public isUserNotificationsEnabled(): Promise<boolean> {\n return this.plugin.perform('push#isUserNotificationsEnabled');\n }\n\n /**\n * Enables user notifications.\n * @returns A promise with the permission result.\n */\n public enableUserNotifications(): Promise<boolean> {\n return this.plugin.perform('push#enableUserNotifications');\n }\n\n /**\n * Gets the notification status.\n * @returns A promise with the result.\n */\n public getNotificationStatus(): Promise<PushNotificationStatus> {\n return this.plugin.perform('push#getNotificationStatus');\n }\n\n /**\n * Gets the registration token if generated.\n * Use the event EventType.PushTokenReceived to be notified\n * when available.\n * @returns A promise with the result.\n */\n public getPushToken(): Promise<string | null | undefined> {\n return this.plugin.perform('push#getPushToken');\n }\n\n /**\n * Gets the list of active notifications.\n *\n * On Android, this list only includes notifications\n * sent through Airship.\n * @returns A promise with the result.\n */\n public getActiveNotifications(): Promise<PushPayload[]> {\n return this.plugin.perform('push#getActiveNotifications');\n }\n\n /**\n * Clears all notifications for the app.\n * @returns A promise with the result.\n */\n public clearNotifications(): Promise<void> {\n return this.plugin.perform('push#clearNotifications');\n }\n\n /**\n * Clears a specific notification.\n *\n * On Android, you can use this method to clear\n * notifications outside of Airship, The identifier is in\n * the format of <tag>:<id>.\n * @param identifier The identifier.\n * @returns A promise with the result.\n */\n public clearNotification(identifier: string): Promise<void> {\n return this.plugin.perform('push#clearNotification', identifier);\n }\n\n /**\n * Adds a notification response event listener.\n */\n public onNotificationResponse(\n listener: (event: NotificationResponseEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.NotificationResponse, listener);\n }\n\n /**\n * Adds a push received event listener.\n */\n public onPushReceived(\n listener: (event: PushReceivedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushReceived, listener);\n }\n\n /**\n * Adds a notification status changed event listener.\n */\n public onNotificationStatusChanged(\n listener: (event: PushNotificationStatusChangedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushNotificationStatusChangedStatus, listener);\n }\n\n /**\n * Adds a notification status changed event listener.\n */\n public onPushTokenReceived(\n listener: (event: PushTokenReceivedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushTokenReceived, listener);\n }\n}\n\n/**\n * iOS Push.\n */\nexport class AirshipPushIOS {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Sets the foreground presentation options.\n * @param options The foreground options.\n * @returns A promise.\n */\n public setForegroundPresentationOptions(\n options: iOS.ForegroundPresentationOption[],\n ): Promise<void> {\n return this.plugin.perform(\n 'push#ios#setForegroundPresentationOptions',\n options,\n );\n }\n\n /**\n * Sets the notification options.\n * @param options The notification options.\n * @returns A promise.\n */\n public setNotificationOptions(\n options: iOS.NotificationOption[],\n ): Promise<void> {\n return this.plugin.perform('push#ios#setNotificationOptions', options);\n }\n\n /**\n * Checks if autobadge is enabled.\n * @returns A promise with the result.\n */\n public isAutobadgeEnabled(): Promise<boolean> {\n return this.plugin.perform('push#ios#isAutobadgeEnabled');\n }\n\n /**\n * Enables/disables autobadge.\n * @param enabled true to enable, false to disable.\n * @returns A promise.\n */\n public setAutobadgeEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#ios#setAutobadgeEnabled', enabled);\n }\n\n /**\n * Set the badge number.\n * @param badge The badge number.\n * @returns A promise.\n */\n public setBadgeNumber(badge: number): Promise<void> {\n return this.plugin.perform('push#ios#setBadgeNumber', badge);\n }\n\n /**\n * Gets the badge number.\n * @returns A promise with the result.\n */\n public getBadgeNumber(): Promise<number> {\n return this.plugin.perform('push#ios#getBadgeNumber');\n }\n\n /**\n * Enables/disables quiet time.\n *\n * @param enabled true to enable, false to disable\n * @returns A promise with the result.\n */\n public setQuietTimeEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#ios#setQuietTimeEnabled', enabled);\n }\n\n /**\n * Checks if quiet time is enabled or not.\n * @returns A promise with the result.\n */\n public isQuietTimeEnabled(): Promise<void> {\n return this.plugin.perform('push#ios#isQuietTimeEnabled');\n }\n\n /**\n * Sets quiet time.\n *\n * @param quietTime The quiet time.\n * @returns A promise with the result.\n */\n public setQuietTime(quietTime: iOS.QuietTime): Promise<void> {\n return this.plugin.perform('push#ios#setQuietTime', quietTime);\n }\n\n /**\n * Gets the quiet time settings.\n *\n * @returns A promise with the result.\n */\n public getQuietTime(): Promise<iOS.QuietTime | null | undefined> {\n return this.plugin.perform('push#ios#getQuietTime');\n }\n\n /**\n * Adds a authorized settings changed event listener.\n */\n public onAuthorizedSettingsChanged(\n listener: (event: iOS.AuthorizedNotificationSettingsChangedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.IOSAuthorizedNotificationSettingsChanged, listener);\n }\n}\n\n/**\n * Android Push.\n */\nexport class AirshipPushAndroid {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Checks if a notification category/channel is enabled.\n * @param channel The channel name.\n * @returns A promise with the result.\n */\n public isNotificationChannelEnabled(channel: string): Promise<boolean> {\n return this.plugin.perform(\n 'push#android#isNotificationChannelEnabled',\n channel,\n );\n }\n\n /**\n * Sets the notification config.\n * @param config The notification config.\n * @returns A promise with the result.\n */\n public setNotificationConfig(\n config: Android.NotificationConfig,\n ): Promise<void> {\n return this.plugin.perform('push#android#setNotificationConfig', config);\n }\n\n /**\n * Enables/disables showing notifications in the foreground.\n * @param enabled true to enable, false to disable.\n * @returns A promise with the result.\n */\n public setForegroundNotificationsEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform(\n 'push#android#setForegroundNotificationsEnab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AAkC;QAElC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oCAAoC,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED;;;;OAIG;IACI,iCAAiC,CAAC,OAAgB;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,gDAAgD,EAChD,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type {\n Android,\n iOS,\n NotificationResponseEvent,\n PushNotificationStatus,\n PushNotificationStatusChangedEvent,\n PushPayload,\n PushReceivedEvent,\n PushTokenReceivedEvent,\n PromptPermissionFallback\n} from './types';\n\n/**\n * Airship Push.\n */\nexport class AirshipPush {\n /**\n * iOS only push methods.\n */\n public readonly iOS: AirshipPushIOS;\n\n /**\n * Android only push methods.\n */\n public readonly android: AirshipPushAndroid;\n\n constructor(private readonly plugin: AirshipPluginWrapper) {\n this.iOS = new AirshipPushIOS(plugin);\n this.android = new AirshipPushAndroid(plugin);\n }\n\n /**\n * Enables/disables notifications on Airship.\n *\n * When enabled, it will cause the user to be prompted for\n * the permission on platforms that support it.\n * To get the result of the prompt, use `enableUserNotifications`.\n * @param enabled true to enable, false to disable\n * @returns A promise.\n */\n public setUserNotificationsEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#setUserNotificationsEnabled', enabled);\n }\n\n /**\n * Checks if user notifications are enabled or not on Airship.\n * @returns A promise with the result.\n */\n public isUserNotificationsEnabled(): Promise<boolean> {\n return this.plugin.perform('push#isUserNotificationsEnabled');\n }\n\n /**\n * Enables user notifications.\n * @param options Optional options.\n * @returns A promise with the permission result.\n */\n public enableUserNotifications(options?: {\n fallback?: PromptPermissionFallback\n }): Promise<boolean> {\n return this.plugin.perform('push#enableUserNotifications', options);\n }\n\n /**\n * Gets the notification status.\n * @returns A promise with the result.\n */\n public getNotificationStatus(): Promise<PushNotificationStatus> {\n return this.plugin.perform('push#getNotificationStatus');\n }\n\n /**\n * Gets the registration token if generated.\n * Use the event EventType.PushTokenReceived to be notified\n * when available.\n * @returns A promise with the result.\n */\n public getPushToken(): Promise<string | null | undefined> {\n return this.plugin.perform('push#getPushToken');\n }\n\n /**\n * Gets the list of active notifications.\n *\n * On Android, this list only includes notifications\n * sent through Airship.\n * @returns A promise with the result.\n */\n public getActiveNotifications(): Promise<PushPayload[]> {\n return this.plugin.perform('push#getActiveNotifications');\n }\n\n /**\n * Clears all notifications for the app.\n * @returns A promise with the result.\n */\n public clearNotifications(): Promise<void> {\n return this.plugin.perform('push#clearNotifications');\n }\n\n /**\n * Clears a specific notification.\n *\n * On Android, you can use this method to clear\n * notifications outside of Airship, The identifier is in\n * the format of <tag>:<id>.\n * @param identifier The identifier.\n * @returns A promise with the result.\n */\n public clearNotification(identifier: string): Promise<void> {\n return this.plugin.perform('push#clearNotification', identifier);\n }\n\n /**\n * Adds a notification response event listener.\n */\n public onNotificationResponse(\n listener: (event: NotificationResponseEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.NotificationResponse, listener);\n }\n\n /**\n * Adds a push received event listener.\n */\n public onPushReceived(\n listener: (event: PushReceivedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushReceived, listener);\n }\n\n /**\n * Adds a notification status changed event listener.\n */\n public onNotificationStatusChanged(\n listener: (event: PushNotificationStatusChangedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushNotificationStatusChangedStatus, listener);\n }\n\n /**\n * Adds a notification status changed event listener.\n */\n public onPushTokenReceived(\n listener: (event: PushTokenReceivedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.PushTokenReceived, listener);\n }\n}\n\n/**\n * iOS Push.\n */\nexport class AirshipPushIOS {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Sets the foreground presentation options.\n * @param options The foreground options.\n * @returns A promise.\n */\n public setForegroundPresentationOptions(\n options: iOS.ForegroundPresentationOption[],\n ): Promise<void> {\n return this.plugin.perform(\n 'push#ios#setForegroundPresentationOptions',\n options,\n );\n }\n\n /**\n * Sets the notification options.\n * @param options The notification options.\n * @returns A promise.\n */\n public setNotificationOptions(\n options: iOS.NotificationOption[],\n ): Promise<void> {\n return this.plugin.perform('push#ios#setNotificationOptions', options);\n }\n\n /**\n * Checks if autobadge is enabled.\n * @returns A promise with the result.\n */\n public isAutobadgeEnabled(): Promise<boolean> {\n return this.plugin.perform('push#ios#isAutobadgeEnabled');\n }\n\n /**\n * Enables/disables autobadge.\n * @param enabled true to enable, false to disable.\n * @returns A promise.\n */\n public setAutobadgeEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#ios#setAutobadgeEnabled', enabled);\n }\n\n /**\n * Set the badge number.\n * @param badge The badge number.\n * @returns A promise.\n */\n public setBadgeNumber(badge: number): Promise<void> {\n return this.plugin.perform('push#ios#setBadgeNumber', badge);\n }\n\n /**\n * Gets the badge number.\n * @returns A promise with the result.\n */\n public getBadgeNumber(): Promise<number> {\n return this.plugin.perform('push#ios#getBadgeNumber');\n }\n\n /**\n * Enables/disables quiet time.\n *\n * @param enabled true to enable, false to disable\n * @returns A promise with the result.\n */\n public setQuietTimeEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform('push#ios#setQuietTimeEnabled', enabled);\n }\n\n /**\n * Checks if quiet time is enabled or not.\n * @returns A promise with the result.\n */\n public isQuietTimeEnabled(): Promise<void> {\n return this.plugin.perform('push#ios#isQuietTimeEnabled');\n }\n\n /**\n * Sets quiet time.\n *\n * @param quietTime The quiet time.\n * @returns A promise with the result.\n */\n public setQuietTime(quietTime: iOS.QuietTime): Promise<void> {\n return this.plugin.perform('push#ios#setQuietTime', quietTime);\n }\n\n /**\n * Gets the quiet time settings.\n *\n * @returns A promise with the result.\n */\n public getQuietTime(): Promise<iOS.QuietTime | null | undefined> {\n return this.plugin.perform('push#ios#getQuietTime');\n }\n\n /**\n * Adds a authorized settings changed event listener.\n */\n public onAuthorizedSettingsChanged(\n listener: (event: iOS.AuthorizedNotificationSettingsChangedEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.IOSAuthorizedNotificationSettingsChanged, listener);\n }\n}\n\n/**\n * Android Push.\n */\nexport class AirshipPushAndroid {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Checks if a notification category/channel is enabled.\n * @param channel The channel name.\n * @returns A promise with the result.\n */\n public isNotificationChannelEnabled(channel: string): Promise<boolean> {\n return this.plugin.perform(\n 'push#android#isNotificationChannelEnabled',\n channel,\n );\n }\n\n /**\n * Sets the notification config.\n * @param config The notification config.\n * @returns A promise with the result.\n */\n public setNotificationConfig(\n config: Android.NotificationConfig,\n ): Promise<void> {\n return this.plugin.perform('push#android#setNotificationConfig', config);\n }\n\n /**\n * Enables/disables showing notifications in the foreground.\n * @param enabled true to enable, false to disable.\n * @returns A promise with the result.\n */\n public setForegroundNotificationsEnabled(enabled: boolean): Promise<void> {\n return this.plugin.perform(\n 'push#android#setForegroundNotificationsEnabled',\n enabled,\n );\n }\n}\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export interface PushReceivedEvent {
|
|
|
24
24
|
*/
|
|
25
25
|
pushPayload: PushPayload;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Indicates whether the push was received when the application was in the background or foreground.
|
|
28
|
+
*/
|
|
29
29
|
isForeground: boolean;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -91,6 +91,37 @@ export interface PushNotificationStatus {
|
|
|
91
91
|
isPushTokenRegistered: boolean;
|
|
92
92
|
isOptedIn: boolean;
|
|
93
93
|
isUserOptedIn: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The notification permission status.
|
|
96
|
+
*/
|
|
97
|
+
notificationPermissionStatus: PermissionStatus;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Enum of permission status.
|
|
101
|
+
*/
|
|
102
|
+
export declare enum PermissionStatus {
|
|
103
|
+
/**
|
|
104
|
+
* Permission is granted.
|
|
105
|
+
*/
|
|
106
|
+
Granted = "granted",
|
|
107
|
+
/**
|
|
108
|
+
* Permission is denied.
|
|
109
|
+
*/
|
|
110
|
+
Denied = "denied",
|
|
111
|
+
/**
|
|
112
|
+
* Permission has not yet been requested.
|
|
113
|
+
*/
|
|
114
|
+
NotDetermined = "not_determined"
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Fallback when prompting for permission and the permission is
|
|
118
|
+
* already denied on iOS or is denied silently on Android.
|
|
119
|
+
*/
|
|
120
|
+
export declare enum PromptPermissionFallback {
|
|
121
|
+
/**
|
|
122
|
+
* Take the user to the system settings to enable the permission.
|
|
123
|
+
*/
|
|
124
|
+
SystemSettings = "systemSettings"
|
|
94
125
|
}
|
|
95
126
|
/**
|
|
96
127
|
* Event fired when the notification status changes.
|
|
@@ -376,7 +407,7 @@ export interface ConfigEnvironment {
|
|
|
376
407
|
* and redacting logs with string interpolation. `public` will log all configured log levels to the console
|
|
377
408
|
* without redacting any of the log lines.
|
|
378
409
|
*/
|
|
379
|
-
logPrivacyLevel
|
|
410
|
+
logPrivacyLevel?: 'private' | 'public';
|
|
380
411
|
};
|
|
381
412
|
}
|
|
382
413
|
/**
|
package/dist/esm/types.js
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum of permission status.
|
|
3
|
+
*/
|
|
4
|
+
export var PermissionStatus;
|
|
5
|
+
(function (PermissionStatus) {
|
|
6
|
+
/**
|
|
7
|
+
* Permission is granted.
|
|
8
|
+
*/
|
|
9
|
+
PermissionStatus["Granted"] = "granted";
|
|
10
|
+
/**
|
|
11
|
+
* Permission is denied.
|
|
12
|
+
*/
|
|
13
|
+
PermissionStatus["Denied"] = "denied";
|
|
14
|
+
/**
|
|
15
|
+
* Permission has not yet been requested.
|
|
16
|
+
*/
|
|
17
|
+
PermissionStatus["NotDetermined"] = "not_determined";
|
|
18
|
+
})(PermissionStatus || (PermissionStatus = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Fallback when prompting for permission and the permission is
|
|
21
|
+
* already denied on iOS or is denied silently on Android.
|
|
22
|
+
*/
|
|
23
|
+
export var PromptPermissionFallback;
|
|
24
|
+
(function (PromptPermissionFallback) {
|
|
25
|
+
/**
|
|
26
|
+
* Take the user to the system settings to enable the permission.
|
|
27
|
+
*/
|
|
28
|
+
PromptPermissionFallback["SystemSettings"] = "systemSettings";
|
|
29
|
+
})(PromptPermissionFallback || (PromptPermissionFallback = {}));
|
|
1
30
|
/**
|
|
2
31
|
* iOS options
|
|
3
32
|
*/
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAmNA;;GAEG;AACH,MAAM,KAAW,GAAG,CAwKnB;AAxKD,WAAiB,GAAG;IA0BlB;;OAEG;IACH,IAAY,kBA6BX;IA7BD,WAAY,kBAAkB;QAC5B;;WAEG;QACH,qCAAe,CAAA;QACf;;WAEG;QACH,qCAAe,CAAA;QACf;;WAEG;QACH,qCAAe,CAAA;QACf;;WAEG;QACH,0CAAoB,CAAA;QACpB;;WAEG;QACH,sDAAgC,CAAA;QAChC;;WAEG;QACH,4FAAsE,CAAA;QACtE;;WAEG;QACH,iDAA2B,CAAA;IAC7B,CAAC,EA7BW,kBAAkB,GAAlB,sBAAkB,KAAlB,sBAAkB,QA6B7B;IAED;;OAEG;IACH,IAAY,4BAqBX;IArBD,WAAY,4BAA4B;QACtC;;WAEG;QACH,+CAAe,CAAA;QACf;;WAEG;QACH,+CAAe,CAAA;QAEf;;;WAGG;QACH,6CAAa,CAAA;QAEb;;;WAGG;QACH,iDAAiB,CAAA;IACnB,CAAC,EArBW,4BAA4B,GAA5B,gCAA4B,K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AY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,gCAAW,CAAA;IACX,gCAAW,CAAA;IACX,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B","sourcesContent":["export type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonObject\n | JsonArray;\n\nexport type JsonObject = {\n [key: string]: JsonValue;\n};\n\nexport type JsonArray = JsonValue[];\n\nexport interface ChannelCreatedEvent {\n /**\n * The channel ID.\n */\n channelId: string;\n}\n\nexport interface PushTokenReceivedEvent {\n /**\n * The push token.\n */\n pushToken: string;\n}\n\n/**\n * Event fired when a push is received.\n */\nexport interface PushReceivedEvent {\n /**\n * The push payload.\n */\n pushPayload: PushPayload;\n\n /**\n * Indicates whether the push was received when the application was in the background or foreground.\n */\n isForeground: boolean;\n}\n\n/**\n * The push payload.\n */\nexport interface PushPayload {\n /**\n * The alert.\n */\n alert?: string;\n /**\n * The title.\n */\n title?: string;\n /**\n * The subtitle.\n */\n subtitle?: string;\n /**\n * The notification ID.\n */\n notificationId?: string;\n /**\n * The notification extras.\n */\n extras: JsonObject;\n}\n\n/**\n * Event fired when the user initiates a notification response.\n */\nexport interface NotificationResponseEvent {\n /**\n * The push notification.\n */\n pushPayload: PushPayload;\n\n /**\n * The action button ID, if available.\n */\n actionId?: string;\n\n /**\n * Indicates whether the response was a foreground action.\n * This value is always if the user taps the main notification,\n * otherwise it is defined by the notification action button.\n */\n isForeground: boolean;\n}\n\n/**\n * Push notification status.\n */\nexport interface PushNotificationStatus {\n /**\n * If user notifications are enabled on [Airship.push].\n */\n isUserNotificationsEnabled: boolean;\n\n /**\n * If notifications are allowed at the system level for the application.\n */\n areNotificationsAllowed: boolean;\n\n /**\n * If the push feature is enabled on [Airship.privacyManager].\n */\n isPushPrivacyFeatureEnabled: boolean;\n\n /*\n * If push registration was able to generate a token.\n */\n isPushTokenRegistered: boolean;\n\n /*\n * If Airship is able to send and display a push notification.\n */\n isOptedIn: boolean;\n\n /*\n * Checks for isUserNotificationsEnabled, areNotificationsAllowed, and isPushPrivacyFeatureEnabled. If this flag\n * is true but `isOptedIn` is false, that means push token was not able to be registered.\n */\n isUserOptedIn: boolean;\n}\n\n/**\n * Event fired when the notification status changes.\n */\nexport interface PushNotificationStatusChangedEvent {\n /**\n * The push notification status.\n */\n status: PushNotificationStatus;\n}\n\n/**\n * Event fired when the Message Center is updated.\n */\nexport interface MessageCenterUpdatedEvent {\n /**\n * The unread message count.\n */\n messageUnreadCount: number;\n /**\n * The total message count.\n */\n messageCount: number;\n}\n\n/**\n * Event fired when the Message Center is requested to be displayed.\n */\nexport interface DisplayMessageCenterEvent {\n /**\n * The message ID, if available.\n */\n messageId?: string;\n}\n\n/**\n * Event fired when a deep link is opened.\n */\nexport interface DeepLinkEvent {\n /**\n * The deep link string.\n */\n deepLink: string;\n}\n\n/**\n * Event fired when a preference center is requested to be displayed.\n */\nexport interface DisplayPreferenceCenterEvent {\n /**\n * The preference center Id.\n */\n preferenceCenterId: string;\n}\n\n/**\n * Custom event\n */\nexport interface CustomEvent {\n /**\n * Event name\n */\n eventName: string;\n /**\n * Event value\n */\n eventValue?: number;\n /**\n * Event properties\n */\n properties: JsonObject;\n /**\n * Transaction ID\n */\n transactionId?: string;\n /**\n * Interaction ID\n */\n interactionId?: string;\n /**\n * Interaction type\n */\n interactionType?: string;\n}\n\n/**\n * iOS options\n */\nexport namespace iOS {\n /**\n * Quiet time\n */\n export interface QuietTime {\n /**\n * Start hour. Must be 0-23.\n */\n startHour: number;\n\n /**\n * Start minute. Must be 0-59.\n */\n startMinute: number;\n\n /**\n * End hour. Must be 0-23.\n */\n endHour: number;\n\n /**\n * End minute. Must be 0-59.\n */\n endMinute: number;\n }\n\n /**\n * Enum of notification options. iOS only.\n */\n export enum NotificationOption {\n /**\n * Alerts.\n */\n Alert = 'alert',\n /**\n * Sounds.\n */\n Sound = 'sound',\n /**\n * Badges.\n */\n Badge = 'badge',\n /**\n * Car play.\n */\n CarPlay = 'car_play',\n /**\n * Critical Alert.\n */\n CriticalAlert = 'critical_alert',\n /**\n * Provides app notification settings.\n */\n ProvidesAppNotificationSettings = 'provides_app_notification_settings',\n /**\n * Provisional.\n */\n Provisional = 'provisional',\n }\n\n /**\n * Enum of foreground notification options.\n */\n export enum ForegroundPresentationOption {\n /**\n * Play the sound associated with the notification.\n */\n Sound = 'sound',\n /**\n * Apply the notification's badge value to the app’s icon.\n */\n Badge = 'badge',\n\n /**\n * Show the notification in Notification Center. On iOS 13 an older,\n * this will also show the notification as a banner.\n */\n List = 'list',\n\n /**\n * Present the notification as a banner. On iOS 13 an older,\n * this will also show the notification in the Notification Center.\n */\n Banner = 'banner',\n }\n\n /**\n * Enum of authorized notification options.\n */\n export enum AuthorizedNotificationSetting {\n /**\n * Alerts.\n */\n Alert = 'alert',\n /**\n * Sounds.\n */\n Sound = 'sound',\n /**\n * Badges.\n */\n Badge = 'badge',\n /**\n * CarPlay.\n */\n CarPlay = 'car_play',\n /**\n * Lock screen.\n */\n LockScreen = 'lock_screen',\n /**\n * Notification center.\n */\n NotificationCenter = 'notification_center',\n /**\n * Critical alert.\n */\n CriticalAlert = 'critical_alert',\n /**\n * Announcement.\n */\n Announcement = 'announcement',\n /**\n * Scheduled delivery.\n */\n ScheduledDelivery = 'scheduled_delivery',\n /**\n * Time sensitive.\n */\n TimeSensitive = 'time_sensitive',\n }\n\n /**\n * Enum of authorized status.\n */\n export enum AuthorizedNotificationStatus {\n /**\n * Not determined.\n */\n NotDetermined = 'not_determined',\n\n /**\n * Denied.\n */\n Denied = 'denied',\n\n /**\n * Authorized.\n */\n Authorized = 'authorized',\n\n /**\n * Provisional.\n */\n Provisional = 'provisional',\n\n /**\n * Ephemeral.\n */\n Ephemeral = 'ephemeral',\n }\n\n export interface AuthorizedNotificationSettingsChangedEvent {\n /**\n * Authorized settings.\n */\n authorizedSettings: AuthorizedNotificationSetting[];\n }\n}\n\n\nexport namespace Android {\n /**\n * Android notification config.\n */\n export interface NotificationConfig {\n /**\n * The icon resource name.\n */\n icon?: string;\n /**\n * The large icon resource name.\n */\n largeIcon?: string;\n /**\n * The default android notification channel ID.\n */\n defaultChannelId?: string;\n /**\n * The accent color. Must be a hex value #AARRGGBB.\n */\n accentColor?: string;\n }\n}\n\n\n/**\n * Airship config environment\n */\nexport interface ConfigEnvironment {\n /**\n * App key.\n */\n appKey: string;\n\n /**\n * App secret.\n */\n appSecret: string;\n\n /**\n * Optional log level.\n */\n logLevel?: LogLevel;\n\n /**\n * Optional iOS config\n */\n ios?: {\n /**\n * Log privacy level. By default it logs at `private`, not logging anything lower than info to the console\n * and redacting logs with string interpolation. `public` will log all configured log levels to the console\n * without redacting any of the log lines.\n */\n logPrivacyLevel: \"private\" | \"public\"\n }\n}\n\n/**\n * Possible sites.\n */\nexport type Site = 'us' | 'eu';\n\n/**\n * Log levels.\n */\nexport type LogLevel =\n | 'verbose'\n | 'debug'\n | 'info'\n | 'warning'\n | 'error'\n | 'none';\n\n/**\n * Airship config\n */\nexport interface AirshipConfig {\n /**\n * Default environment.\n */\n default?: ConfigEnvironment;\n\n /**\n * Development environment. Overrides default environment if inProduction is false.\n */\n development?: ConfigEnvironment;\n\n /**\n * Production environment. Overrides default environment if inProduction is true.\n */\n production?: ConfigEnvironment;\n\n /**\n * Cloud site.\n */\n site?: Site;\n\n /**\n * Switches the environment from development or production. If the value is not\n * set, Airship will determine the value at runtime.\n */\n inProduction?: boolean;\n\n /**\n * URL allow list.\n */\n urlAllowList?: string[];\n\n /**\n * URL allow list for open URL scope.\n */\n urlAllowListScopeOpenUrl?: string[];\n\n /**\n * URL allow list for JS bridge injection.\n */\n urlAllowListScopeJavaScriptInterface?: string[];\n\n /**\n * Enables delayed channel creation.\n * Deprecated. Use the Private Manager to disable all features instead.\n */\n isChannelCreationDelayEnabled?: boolean;\n\n /**\n * Initial config URL for custom Airship domains. The URL\n * should also be added to the urlAllowList.\n */\n initialConfigUrl?: string;\n\n /**\n * Enabled features. Defaults to all.\n */\n enabledFeatures?: Feature[];\n\n /**\n * Enables channel capture feature.\n * This config is enabled by default.\n */\n isChannelCaptureEnabled?: boolean;\n\n /**\n * Whether to suppress console error messages about missing allow list entries during takeOff.\n * This config is disabled by default.\n */\n suppressAllowListError?: boolean;\n\n /**\n * Pauses In-App Automation on launch.\n */\n autoPauseInAppAutomationOnLaunch?: boolean;\n\n /**\n * iOS config.\n */\n ios?: {\n /**\n * itunesId for rate app and app store deep links.\n */\n itunesId?: string;\n };\n\n /**\n * Android config.\n */\n android?: {\n /**\n * App store URI\n */\n appStoreUri?: string;\n\n /**\n * Fcm app name if using multiple FCM projects.\n */\n fcmFirebaseAppName?: string;\n\n /**\n * Notification config.\n */\n notificationConfig?: Android.NotificationConfig;\n };\n}\n\n/**\n * Enum of authorized Features.\n */\nexport enum Feature {\n InAppAutomation = 'in_app_automation',\n MessageCenter = 'message_center',\n Push = 'push',\n // No longer used\n Chat = 'chat',\n Analytics = 'analytics',\n TagsAndAttributes = 'tags_and_attributes',\n Contacts = 'contacts',\n // No longer used\n Location = 'location',\n}\n\n/**\n * All available features.\n */\nexport const FEATURES_ALL = Object.values(Feature);\n\n/**\n * Subscription Scope types.\n */\nexport enum SubscriptionScope {\n App = 'app',\n Web = 'web',\n Sms = 'sms',\n Email = 'email',\n}\n\nexport interface InboxMessage {\n /**\n * The message ID. Needed to display, mark as read, or delete the message.\n */\n id: string;\n /**\n * The message title.\n */\n title: string;\n /**\n * The message sent date in milliseconds.\n */\n sentDate: number;\n /**\n * Optional - The icon url for the message.\n */\n listIconUrl: string;\n /**\n * The unread / read status of the message.\n */\n isRead: boolean;\n /**\n * String to String map of any message extras.\n */\n extras: Record<string, string>;\n}\n\n// ---\n// See: https://github.com/urbanairship/web-push-sdk/blob/master/src/remote-data/preference-center.ts\n// ---\n\n/**\n * A preference center definition.\n *\n * @typedef {object} PreferenceCenter\n * @property {string} id the ID of the preference center\n * @property {Array<PreferenceCenter.CommonSection>} sections a list of sections\n * @property {?CommonDisplay} display display information\n */\nexport type PreferenceCenter = {\n id: string;\n sections: Section[];\n display?: CommonDisplay;\n};\n\n/**\n * Preference center display information.\n * @typedef {object} CommonDisplay\n * @property {string} name\n * @property {?string} description\n */\nexport type CommonDisplay = {\n name: string;\n description?: string;\n};\n\nexport type Icon = {\n icon: string;\n};\n\nexport type IconDisplay = CommonDisplay & Partial<Icon>;\n\nexport interface ItemBase {\n type: unknown;\n id: string;\n display: CommonDisplay;\n conditions?: Condition[];\n}\n\n/**\n * A channel subscription item.\n * @typedef {object} ChannelSubscriptionItem\n * @memberof PreferenceCenter\n * @property {\"channel_subscription\"} type\n * @property {string} id the item identifier\n * @property {?CommonDisplay} display display information\n * @property {string} subscription_id the subscription list id\n */\nexport interface ChannelSubscriptionItem extends ItemBase {\n type: 'channel_subscription';\n subscription_id: string;\n}\n\nexport interface ContactSubscriptionGroupItem extends ItemBase {\n type: 'contact_subscription_group';\n id: string;\n subscription_id: string;\n components: ContactSubscriptionGroupItemComponent[];\n}\n\nexport interface ContactSubscriptionGroupItemComponent {\n scopes: SubscriptionScope[];\n display: Omit<CommonDisplay, 'description'>;\n}\n\nexport interface ContactSubscriptionItem extends ItemBase {\n type: 'contact_subscription';\n scopes: SubscriptionScope[];\n subscription_id: string;\n}\n\nexport interface AlertItem extends ItemBase {\n type: 'alert';\n display: IconDisplay;\n button?: Button;\n}\n\nexport interface ConditionBase {\n type: unknown;\n}\n\nexport interface NotificationOptInCondition extends ConditionBase {\n type: 'notification_opt_in';\n when_status: 'opt_in' | 'opt_out';\n}\n\nexport type Condition = NotificationOptInCondition;\n\n// Changed from `unknown` in spec\nexport type Actions = {\n [key: string]: JsonValue;\n};\n\nexport interface Button {\n text: string;\n content_description?: string;\n actions: Actions;\n}\n\nexport interface SectionBase {\n type: unknown;\n id: string;\n display?: CommonDisplay;\n items: Item[];\n}\n\n/**\n * @typedef {object} CommonSection\n * @memberof PreferenceCenter\n * @property {\"section\"} type\n * @property {string} id the section identifier\n * @property {?CommonDisplay} display display information\n * @property {Array<PreferenceCenter.ChannelSubscriptionItem>} items list of\n * section items\n */\nexport interface CommonSection extends SectionBase {\n type: 'section';\n}\n\nexport interface LabeledSectionBreak extends SectionBase {\n type: 'labeled_section_break';\n items: never;\n}\n\nexport type Item =\n | ChannelSubscriptionItem\n | ContactSubscriptionGroupItem\n | ContactSubscriptionItem\n | AlertItem;\n\nexport type Section = CommonSection | LabeledSectionBreak;\n\n/**\n * An interface representing the eligibility status of a flag, and optional\n * variables associated with the flag.\n */\nexport interface FeatureFlag {\n /**\n * A boolean representing flag eligibility; will be `true` if the current\n * contact is eligible for the flag.\n */\n readonly isEligible: boolean;\n /**\n * A variables associated with the flag, if any. Will be `null` if no data\n * is associated with the flag, or if the flag does not exist.\n */\n readonly variables: unknown | null;\n /**\n * A boolean representing if the flag exists or not. For ease of use and\n * deployment, asking for a flag by any name will return a `FeatureFlag`\n * interface, even if the flag was not found to exist. However this property\n * may be checked to determine if the flag was actually resolved to a known\n * flag name.\n */\n readonly exists: boolean;\n\n /**\n * Reporting Metadata, the shape of which is private and not to be relied\n * upon. When not provided, an interaction cannot be tracked on the flag.\n * @ignore\n */\n readonly _internal: unknown;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAoIA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,uCAAmB,CAAA;IAEnB;;OAEG;IACH,qCAAiB,CAAA;IAEjB;;OAEG;IACH,oDAAgC,CAAA;AAClC,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC;;OAEG;IACH,6DAAiC,CAAA;AACnC,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAsFD;;GAEG;AACH,MAAM,KAAW,GAAG,CAwKnB;AAxKD,WAAiB,GAAG;IA0BlB;;OAEG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,CAAA;IACzB,CAAC,EAzBW,4BAA4B,GAA5B,gCAA4B,KAA5B,gCAA4B,QAyBvC;AAQH,CAAC,EAxKgB,GAAG,KAAH,GAAG,QAwKnB;AAwLD;;GAEG;AACH,MAAM,CAAN,IAAY,OAWX;AAXD,WAAY,OAAO;IACjB,gDAAqC,CAAA;IACrC,2CAAgC,CAAA;IAChC,wBAAa,CAAA;IACb,iBAAiB;IACjB,wBAAa,CAAA;IACb,kCAAuB,CAAA;IACvB,oDAAyC,CAAA;IACzC,gCAAqB,CAAA;IACrB,iBAAiB;IACjB,gCAAqB,CAAA;AACvB,CAAC,EAXW,OAAO,KAAP,OAAO,QAWlB;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,gCAAW,CAAA;IACX,gCAAW,CAAA;IACX,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B","sourcesContent":["export type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonObject\n | JsonArray;\n\nexport type JsonObject = {\n [key: string]: JsonValue;\n};\n\nexport type JsonArray = JsonValue[];\n\nexport interface ChannelCreatedEvent {\n /**\n * The channel ID.\n */\n channelId: string;\n}\n\nexport interface PushTokenReceivedEvent {\n /**\n * The push token.\n */\n pushToken: string;\n}\n\n/**\n * Event fired when a push is received.\n */\nexport interface PushReceivedEvent {\n /**\n * The push payload.\n */\n pushPayload: PushPayload;\n\n /**\n * Indicates whether the push was received when the application was in the background or foreground.\n */\n isForeground: boolean;\n}\n\n/**\n * The push payload.\n */\nexport interface PushPayload {\n /**\n * The alert.\n */\n alert?: string;\n /**\n * The title.\n */\n title?: string;\n /**\n * The subtitle.\n */\n subtitle?: string;\n /**\n * The notification ID.\n */\n notificationId?: string;\n /**\n * The notification extras.\n */\n extras: JsonObject;\n}\n\n/**\n * Event fired when the user initiates a notification response.\n */\nexport interface NotificationResponseEvent {\n /**\n * The push notification.\n */\n pushPayload: PushPayload;\n\n /**\n * The action button ID, if available.\n */\n actionId?: string;\n\n /**\n * Indicates whether the response was a foreground action.\n * This value is always if the user taps the main notification,\n * otherwise it is defined by the notification action button.\n */\n isForeground: boolean;\n}\n\n/**\n * Push notification status.\n */\nexport interface PushNotificationStatus {\n /**\n * If user notifications are enabled on [Airship.push].\n */\n isUserNotificationsEnabled: boolean;\n\n /**\n * If notifications are allowed at the system level for the application.\n */\n areNotificationsAllowed: boolean;\n\n /**\n * If the push feature is enabled on [Airship.privacyManager].\n */\n isPushPrivacyFeatureEnabled: boolean;\n\n /*\n * If push registration was able to generate a token.\n */\n isPushTokenRegistered: boolean;\n\n /*\n * If Airship is able to send and display a push notification.\n */\n isOptedIn: boolean;\n\n /*\n * Checks for isUserNotificationsEnabled, areNotificationsAllowed, and isPushPrivacyFeatureEnabled. If this flag\n * is true but `isOptedIn` is false, that means push token was not able to be registered.\n */\n isUserOptedIn: boolean;\n\n /**\n * The notification permission status.\n */\n notificationPermissionStatus: PermissionStatus;\n}\n\n/**\n * Enum of permission status.\n */\nexport enum PermissionStatus {\n /**\n * Permission is granted.\n */\n Granted = 'granted',\n\n /**\n * Permission is denied.\n */\n Denied = 'denied',\n\n /**\n * Permission has not yet been requested.\n */\n NotDetermined = 'not_determined',\n}\n\n/**\n * Fallback when prompting for permission and the permission is\n * already denied on iOS or is denied silently on Android.\n */\nexport enum PromptPermissionFallback {\n /**\n * Take the user to the system settings to enable the permission.\n */\n SystemSettings = \"systemSettings\"\n}\n\n/**\n * Event fired when the notification status changes.\n */\nexport interface PushNotificationStatusChangedEvent {\n /**\n * The push notification status.\n */\n status: PushNotificationStatus;\n}\n\n/**\n * Event fired when the Message Center is updated.\n */\nexport interface MessageCenterUpdatedEvent {\n /**\n * The unread message count.\n */\n messageUnreadCount: number;\n /**\n * The total message count.\n */\n messageCount: number;\n}\n\n/**\n * Event fired when the Message Center is requested to be displayed.\n */\nexport interface DisplayMessageCenterEvent {\n /**\n * The message ID, if available.\n */\n messageId?: string;\n}\n\n/**\n * Event fired when a deep link is opened.\n */\nexport interface DeepLinkEvent {\n /**\n * The deep link string.\n */\n deepLink: string;\n}\n\n/**\n * Event fired when a preference center is requested to be displayed.\n */\nexport interface DisplayPreferenceCenterEvent {\n /**\n * The preference center Id.\n */\n preferenceCenterId: string;\n}\n\n/**\n * Custom event\n */\nexport interface CustomEvent {\n /**\n * Event name\n */\n eventName: string;\n /**\n * Event value\n */\n eventValue?: number;\n /**\n * Event properties\n */\n properties: JsonObject;\n /**\n * Transaction ID\n */\n transactionId?: string;\n /**\n * Interaction ID\n */\n interactionId?: string;\n /**\n * Interaction type\n */\n interactionType?: string;\n}\n\n/**\n * iOS options\n */\nexport namespace iOS {\n /**\n * Quiet time\n */\n export interface QuietTime {\n /**\n * Start hour. Must be 0-23.\n */\n startHour: number;\n\n /**\n * Start minute. Must be 0-59.\n */\n startMinute: number;\n\n /**\n * End hour. Must be 0-23.\n */\n endHour: number;\n\n /**\n * End minute. Must be 0-59.\n */\n endMinute: number;\n }\n\n /**\n * Enum of notification options. iOS only.\n */\n export enum NotificationOption {\n /**\n * Alerts.\n */\n Alert = 'alert',\n /**\n * Sounds.\n */\n Sound = 'sound',\n /**\n * Badges.\n */\n Badge = 'badge',\n /**\n * Car play.\n */\n CarPlay = 'car_play',\n /**\n * Critical Alert.\n */\n CriticalAlert = 'critical_alert',\n /**\n * Provides app notification settings.\n */\n ProvidesAppNotificationSettings = 'provides_app_notification_settings',\n /**\n * Provisional.\n */\n Provisional = 'provisional',\n }\n\n /**\n * Enum of foreground notification options.\n */\n export enum ForegroundPresentationOption {\n /**\n * Play the sound associated with the notification.\n */\n Sound = 'sound',\n /**\n * Apply the notification's badge value to the app’s icon.\n */\n Badge = 'badge',\n\n /**\n * Show the notification in Notification Center. On iOS 13 an older,\n * this will also show the notification as a banner.\n */\n List = 'list',\n\n /**\n * Present the notification as a banner. On iOS 13 an older,\n * this will also show the notification in the Notification Center.\n */\n Banner = 'banner',\n }\n\n /**\n * Enum of authorized notification options.\n */\n export enum AuthorizedNotificationSetting {\n /**\n * Alerts.\n */\n Alert = 'alert',\n /**\n * Sounds.\n */\n Sound = 'sound',\n /**\n * Badges.\n */\n Badge = 'badge',\n /**\n * CarPlay.\n */\n CarPlay = 'car_play',\n /**\n * Lock screen.\n */\n LockScreen = 'lock_screen',\n /**\n * Notification center.\n */\n NotificationCenter = 'notification_center',\n /**\n * Critical alert.\n */\n CriticalAlert = 'critical_alert',\n /**\n * Announcement.\n */\n Announcement = 'announcement',\n /**\n * Scheduled delivery.\n */\n ScheduledDelivery = 'scheduled_delivery',\n /**\n * Time sensitive.\n */\n TimeSensitive = 'time_sensitive',\n }\n\n /**\n * Enum of authorized status.\n */\n export enum AuthorizedNotificationStatus {\n /**\n * Not determined.\n */\n NotDetermined = 'not_determined',\n\n /**\n * Denied.\n */\n Denied = 'denied',\n\n /**\n * Authorized.\n */\n Authorized = 'authorized',\n\n /**\n * Provisional.\n */\n Provisional = 'provisional',\n\n /**\n * Ephemeral.\n */\n Ephemeral = 'ephemeral',\n }\n\n export interface AuthorizedNotificationSettingsChangedEvent {\n /**\n * Authorized settings.\n */\n authorizedSettings: AuthorizedNotificationSetting[];\n }\n}\n\nexport namespace Android {\n /**\n * Android notification config.\n */\n export interface NotificationConfig {\n /**\n * The icon resource name.\n */\n icon?: string;\n /**\n * The large icon resource name.\n */\n largeIcon?: string;\n /**\n * The default android notification channel ID.\n */\n defaultChannelId?: string;\n /**\n * The accent color. Must be a hex value #AARRGGBB.\n */\n accentColor?: string;\n }\n}\n\n/**\n * Airship config environment\n */\nexport interface ConfigEnvironment {\n /**\n * App key.\n */\n appKey: string;\n\n /**\n * App secret.\n */\n appSecret: string;\n\n /**\n * Optional log level.\n */\n logLevel?: LogLevel;\n\n /**\n * Optional iOS config\n */\n ios?: {\n /**\n * Log privacy level. By default it logs at `private`, not logging anything lower than info to the console\n * and redacting logs with string interpolation. `public` will log all configured log levels to the console\n * without redacting any of the log lines.\n */\n logPrivacyLevel?: 'private' | 'public';\n };\n}\n\n/**\n * Possible sites.\n */\nexport type Site = 'us' | 'eu';\n\n/**\n * Log levels.\n */\nexport type LogLevel =\n | 'verbose'\n | 'debug'\n | 'info'\n | 'warning'\n | 'error'\n | 'none';\n\n/**\n * Airship config\n */\nexport interface AirshipConfig {\n /**\n * Default environment.\n */\n default?: ConfigEnvironment;\n\n /**\n * Development environment. Overrides default environment if inProduction is false.\n */\n development?: ConfigEnvironment;\n\n /**\n * Production environment. Overrides default environment if inProduction is true.\n */\n production?: ConfigEnvironment;\n\n /**\n * Cloud site.\n */\n site?: Site;\n\n /**\n * Switches the environment from development or production. If the value is not\n * set, Airship will determine the value at runtime.\n */\n inProduction?: boolean;\n\n /**\n * URL allow list.\n */\n urlAllowList?: string[];\n\n /**\n * URL allow list for open URL scope.\n */\n urlAllowListScopeOpenUrl?: string[];\n\n /**\n * URL allow list for JS bridge injection.\n */\n urlAllowListScopeJavaScriptInterface?: string[];\n\n /**\n * Enables delayed channel creation.\n * Deprecated. Use the Private Manager to disable all features instead.\n */\n isChannelCreationDelayEnabled?: boolean;\n\n /**\n * Initial config URL for custom Airship domains. The URL\n * should also be added to the urlAllowList.\n */\n initialConfigUrl?: string;\n\n /**\n * Enabled features. Defaults to all.\n */\n enabledFeatures?: Feature[];\n\n /**\n * Enables channel capture feature.\n * This config is enabled by default.\n */\n isChannelCaptureEnabled?: boolean;\n\n /**\n * Whether to suppress console error messages about missing allow list entries during takeOff.\n * This config is disabled by default.\n */\n suppressAllowListError?: boolean;\n\n /**\n * Pauses In-App Automation on launch.\n */\n autoPauseInAppAutomationOnLaunch?: boolean;\n\n /**\n * iOS config.\n */\n ios?: {\n /**\n * itunesId for rate app and app store deep links.\n */\n itunesId?: string;\n };\n\n /**\n * Android config.\n */\n android?: {\n /**\n * App store URI\n */\n appStoreUri?: string;\n\n /**\n * Fcm app name if using multiple FCM projects.\n */\n fcmFirebaseAppName?: string;\n\n /**\n * Notification config.\n */\n notificationConfig?: Android.NotificationConfig;\n };\n}\n\n/**\n * Enum of authorized Features.\n */\nexport enum Feature {\n InAppAutomation = 'in_app_automation',\n MessageCenter = 'message_center',\n Push = 'push',\n // No longer used\n Chat = 'chat',\n Analytics = 'analytics',\n TagsAndAttributes = 'tags_and_attributes',\n Contacts = 'contacts',\n // No longer used\n Location = 'location',\n}\n\n/**\n * All available features.\n */\nexport const FEATURES_ALL = Object.values(Feature);\n\n/**\n * Subscription Scope types.\n */\nexport enum SubscriptionScope {\n App = 'app',\n Web = 'web',\n Sms = 'sms',\n Email = 'email',\n}\n\nexport interface InboxMessage {\n /**\n * The message ID. Needed to display, mark as read, or delete the message.\n */\n id: string;\n /**\n * The message title.\n */\n title: string;\n /**\n * The message sent date in milliseconds.\n */\n sentDate: number;\n /**\n * Optional - The icon url for the message.\n */\n listIconUrl: string;\n /**\n * The unread / read status of the message.\n */\n isRead: boolean;\n /**\n * String to String map of any message extras.\n */\n extras: Record<string, string>;\n}\n\n// ---\n// See: https://github.com/urbanairship/web-push-sdk/blob/master/src/remote-data/preference-center.ts\n// ---\n\n/**\n * A preference center definition.\n *\n * @typedef {object} PreferenceCenter\n * @property {string} id the ID of the preference center\n * @property {Array<PreferenceCenter.CommonSection>} sections a list of sections\n * @property {?CommonDisplay} display display information\n */\nexport type PreferenceCenter = {\n id: string;\n sections: Section[];\n display?: CommonDisplay;\n};\n\n/**\n * Preference center display information.\n * @typedef {object} CommonDisplay\n * @property {string} name\n * @property {?string} description\n */\nexport type CommonDisplay = {\n name: string;\n description?: string;\n};\n\nexport type Icon = {\n icon: string;\n};\n\nexport type IconDisplay = CommonDisplay & Partial<Icon>;\n\nexport interface ItemBase {\n type: unknown;\n id: string;\n display: CommonDisplay;\n conditions?: Condition[];\n}\n\n/**\n * A channel subscription item.\n * @typedef {object} ChannelSubscriptionItem\n * @memberof PreferenceCenter\n * @property {\"channel_subscription\"} type\n * @property {string} id the item identifier\n * @property {?CommonDisplay} display display information\n * @property {string} subscription_id the subscription list id\n */\nexport interface ChannelSubscriptionItem extends ItemBase {\n type: 'channel_subscription';\n subscription_id: string;\n}\n\nexport interface ContactSubscriptionGroupItem extends ItemBase {\n type: 'contact_subscription_group';\n id: string;\n subscription_id: string;\n components: ContactSubscriptionGroupItemComponent[];\n}\n\nexport interface ContactSubscriptionGroupItemComponent {\n scopes: SubscriptionScope[];\n display: Omit<CommonDisplay, 'description'>;\n}\n\nexport interface ContactSubscriptionItem extends ItemBase {\n type: 'contact_subscription';\n scopes: SubscriptionScope[];\n subscription_id: string;\n}\n\nexport interface AlertItem extends ItemBase {\n type: 'alert';\n display: IconDisplay;\n button?: Button;\n}\n\nexport interface ConditionBase {\n type: unknown;\n}\n\nexport interface NotificationOptInCondition extends ConditionBase {\n type: 'notification_opt_in';\n when_status: 'opt_in' | 'opt_out';\n}\n\nexport type Condition = NotificationOptInCondition;\n\n// Changed from `unknown` in spec\nexport type Actions = {\n [key: string]: JsonValue;\n};\n\nexport interface Button {\n text: string;\n content_description?: string;\n actions: Actions;\n}\n\nexport interface SectionBase {\n type: unknown;\n id: string;\n display?: CommonDisplay;\n items: Item[];\n}\n\n/**\n * @typedef {object} CommonSection\n * @memberof PreferenceCenter\n * @property {\"section\"} type\n * @property {string} id the section identifier\n * @property {?CommonDisplay} display display information\n * @property {Array<PreferenceCenter.ChannelSubscriptionItem>} items list of\n * section items\n */\nexport interface CommonSection extends SectionBase {\n type: 'section';\n}\n\nexport interface LabeledSectionBreak extends SectionBase {\n type: 'labeled_section_break';\n items: never;\n}\n\nexport type Item =\n | ChannelSubscriptionItem\n | ContactSubscriptionGroupItem\n | ContactSubscriptionItem\n | AlertItem;\n\nexport type Section = CommonSection | LabeledSectionBreak;\n\n/**\n * An interface representing the eligibility status of a flag, and optional\n * variables associated with the flag.\n */\nexport interface FeatureFlag {\n /**\n * A boolean representing flag eligibility; will be `true` if the current\n * contact is eligible for the flag.\n */\n readonly isEligible: boolean;\n /**\n * A variables associated with the flag, if any. Will be `null` if no data\n * is associated with the flag, or if the flag does not exist.\n */\n readonly variables: unknown | null;\n /**\n * A boolean representing if the flag exists or not. For ease of use and\n * deployment, asking for a flag by any name will return a `FeatureFlag`\n * interface, even if the flag was not found to exist. However this property\n * may be checked to determine if the flag was actually resolved to a known\n * flag name.\n */\n readonly exists: boolean;\n\n /**\n * Reporting Metadata, the shape of which is private and not to be relied\n * upon. When not provided, an interaction cannot be tracked on the flag.\n * @ignore\n */\n readonly _internal: unknown;\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -685,6 +685,15 @@ class AirshipMessageCenter {
|
|
|
685
685
|
showMessageView(messageId) {
|
|
686
686
|
return this.plugin.perform('messageCenter#showMessageView', messageId);
|
|
687
687
|
}
|
|
688
|
+
/**
|
|
689
|
+
* Overlays the message center regardless if auto launch Message Center is enabled or not.
|
|
690
|
+
*
|
|
691
|
+
* @param messageId Optional message Id.
|
|
692
|
+
* @returns A promise.
|
|
693
|
+
*/
|
|
694
|
+
showMessageCenter(messageId) {
|
|
695
|
+
return this.plugin.perform('messageCenter#showMessageCenter', messageId);
|
|
696
|
+
}
|
|
688
697
|
/**
|
|
689
698
|
* Refreshes the messages.
|
|
690
699
|
* @returns A promise. Will reject if the list fails to refresh or if
|
|
@@ -841,10 +850,11 @@ class AirshipPush {
|
|
|
841
850
|
}
|
|
842
851
|
/**
|
|
843
852
|
* Enables user notifications.
|
|
853
|
+
* @param options Optional options.
|
|
844
854
|
* @returns A promise with the permission result.
|
|
845
855
|
*/
|
|
846
|
-
enableUserNotifications() {
|
|
847
|
-
return this.plugin.perform('push#enableUserNotifications');
|
|
856
|
+
enableUserNotifications(options) {
|
|
857
|
+
return this.plugin.perform('push#enableUserNotifications', options);
|
|
848
858
|
}
|
|
849
859
|
/**
|
|
850
860
|
* Gets the notification status.
|
|
@@ -1100,6 +1110,35 @@ class AirshipPluginWrapper {
|
|
|
1100
1110
|
}
|
|
1101
1111
|
}
|
|
1102
1112
|
|
|
1113
|
+
/**
|
|
1114
|
+
* Enum of permission status.
|
|
1115
|
+
*/
|
|
1116
|
+
exports.PermissionStatus = void 0;
|
|
1117
|
+
(function (PermissionStatus) {
|
|
1118
|
+
/**
|
|
1119
|
+
* Permission is granted.
|
|
1120
|
+
*/
|
|
1121
|
+
PermissionStatus["Granted"] = "granted";
|
|
1122
|
+
/**
|
|
1123
|
+
* Permission is denied.
|
|
1124
|
+
*/
|
|
1125
|
+
PermissionStatus["Denied"] = "denied";
|
|
1126
|
+
/**
|
|
1127
|
+
* Permission has not yet been requested.
|
|
1128
|
+
*/
|
|
1129
|
+
PermissionStatus["NotDetermined"] = "not_determined";
|
|
1130
|
+
})(exports.PermissionStatus || (exports.PermissionStatus = {}));
|
|
1131
|
+
/**
|
|
1132
|
+
* Fallback when prompting for permission and the permission is
|
|
1133
|
+
* already denied on iOS or is denied silently on Android.
|
|
1134
|
+
*/
|
|
1135
|
+
exports.PromptPermissionFallback = void 0;
|
|
1136
|
+
(function (PromptPermissionFallback) {
|
|
1137
|
+
/**
|
|
1138
|
+
* Take the user to the system settings to enable the permission.
|
|
1139
|
+
*/
|
|
1140
|
+
PromptPermissionFallback["SystemSettings"] = "systemSettings";
|
|
1141
|
+
})(exports.PromptPermissionFallback || (exports.PromptPermissionFallback = {}));
|
|
1103
1142
|
/**
|
|
1104
1143
|
* iOS options
|
|
1105
1144
|
*/
|