@ua/capacitor-airship 1.0.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.
Files changed (84) hide show
  1. package/README.md +12 -0
  2. package/UaCapacitorAirship.podspec +18 -0
  3. package/android/build.gradle +72 -0
  4. package/android/src/main/AndroidManifest.xml +33 -0
  5. package/android/src/main/java/com/airship/capacitor/AirshipCapacitorVersion.kt +7 -0
  6. package/android/src/main/java/com/airship/capacitor/AirshipPlugin.kt +331 -0
  7. package/android/src/main/java/com/airship/capacitor/CapacitorAutopilot.kt +39 -0
  8. package/android/src/main/res/.gitkeep +0 -0
  9. package/dist/esm/AirshipActions.d.ts +18 -0
  10. package/dist/esm/AirshipActions.js +20 -0
  11. package/dist/esm/AirshipActions.js.map +1 -0
  12. package/dist/esm/AirshipAnalytics.d.ts +30 -0
  13. package/dist/esm/AirshipAnalytics.js +39 -0
  14. package/dist/esm/AirshipAnalytics.js.map +1 -0
  15. package/dist/esm/AirshipChannel.d.ts +61 -0
  16. package/dist/esm/AirshipChannel.js +87 -0
  17. package/dist/esm/AirshipChannel.js.map +1 -0
  18. package/dist/esm/AirshipContact.d.ts +48 -0
  19. package/dist/esm/AirshipContact.js +68 -0
  20. package/dist/esm/AirshipContact.js.map +1 -0
  21. package/dist/esm/AirshipFeatureFlagManager.d.ts +24 -0
  22. package/dist/esm/AirshipFeatureFlagManager.js +28 -0
  23. package/dist/esm/AirshipFeatureFlagManager.js.map +1 -0
  24. package/dist/esm/AirshipInApp.d.ts +30 -0
  25. package/dist/esm/AirshipInApp.js +39 -0
  26. package/dist/esm/AirshipInApp.js.map +1 -0
  27. package/dist/esm/AirshipLocale.d.ts +24 -0
  28. package/dist/esm/AirshipLocale.js +31 -0
  29. package/dist/esm/AirshipLocale.js.map +1 -0
  30. package/dist/esm/AirshipMessageCenter.d.ts +77 -0
  31. package/dist/esm/AirshipMessageCenter.js +99 -0
  32. package/dist/esm/AirshipMessageCenter.js.map +1 -0
  33. package/dist/esm/AirshipPlugin.d.ts +31 -0
  34. package/dist/esm/AirshipPlugin.js +15 -0
  35. package/dist/esm/AirshipPlugin.js.map +1 -0
  36. package/dist/esm/AirshipPreferenceCenter.d.ts +38 -0
  37. package/dist/esm/AirshipPreferenceCenter.js +49 -0
  38. package/dist/esm/AirshipPreferenceCenter.js.map +1 -0
  39. package/dist/esm/AirshipPrivacyManager.d.ts +38 -0
  40. package/dist/esm/AirshipPrivacyManager.js +48 -0
  41. package/dist/esm/AirshipPrivacyManager.js.map +1 -0
  42. package/dist/esm/AirshipPush.d.ts +184 -0
  43. package/dist/esm/AirshipPush.js +232 -0
  44. package/dist/esm/AirshipPush.js.map +1 -0
  45. package/dist/esm/AirshipRoot.d.ts +49 -0
  46. package/dist/esm/AirshipRoot.js +55 -0
  47. package/dist/esm/AirshipRoot.js.map +1 -0
  48. package/dist/esm/AttributeEditor.d.ts +54 -0
  49. package/dist/esm/AttributeEditor.js +76 -0
  50. package/dist/esm/AttributeEditor.js.map +1 -0
  51. package/dist/esm/EventType.d.ts +25 -0
  52. package/dist/esm/EventType.js +14 -0
  53. package/dist/esm/EventType.js.map +1 -0
  54. package/dist/esm/ScopedSubscriptionListEditor.d.ts +59 -0
  55. package/dist/esm/ScopedSubscriptionListEditor.js +62 -0
  56. package/dist/esm/ScopedSubscriptionListEditor.js.map +1 -0
  57. package/dist/esm/SubscriptionListEditor.d.ts +50 -0
  58. package/dist/esm/SubscriptionListEditor.js +56 -0
  59. package/dist/esm/SubscriptionListEditor.js.map +1 -0
  60. package/dist/esm/TagEditor.d.ts +46 -0
  61. package/dist/esm/TagEditor.js +46 -0
  62. package/dist/esm/TagEditor.js.map +1 -0
  63. package/dist/esm/TagGroupEditor.d.ts +60 -0
  64. package/dist/esm/TagGroupEditor.js +60 -0
  65. package/dist/esm/TagGroupEditor.js.map +1 -0
  66. package/dist/esm/index.d.ts +20 -0
  67. package/dist/esm/index.js +25 -0
  68. package/dist/esm/index.js.map +1 -0
  69. package/dist/esm/types.d.ts +651 -0
  70. package/dist/esm/types.js +167 -0
  71. package/dist/esm/types.js.map +1 -0
  72. package/dist/plugin.cjs.js +1278 -0
  73. package/dist/plugin.cjs.js.map +1 -0
  74. package/dist/plugin.js +1281 -0
  75. package/dist/plugin.js.map +1 -0
  76. package/ios/Plugin/AirshipCapacitorAutopilot.swift +94 -0
  77. package/ios/Plugin/AirshipCapacitorBootstrap.h +8 -0
  78. package/ios/Plugin/AirshipCapacitorBootstrap.m +24 -0
  79. package/ios/Plugin/AirshipCapacitorVersion.swift +7 -0
  80. package/ios/Plugin/AirshipPlugin.h +7 -0
  81. package/ios/Plugin/AirshipPlugin.m +9 -0
  82. package/ios/Plugin/AirshipPlugin.swift +557 -0
  83. package/ios/Plugin/Info.plist +24 -0
  84. package/package.json +75 -0
@@ -0,0 +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;IAChE,CAAC;IAED;;;OAGG;IACI,uBAAuB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7D,C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C,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#setForegroundNotificationsEnabled',\n enabled,\n );\n }\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import { AirshipActions } from './AirshipActions';
3
+ import { AirshipAnalytics } from './AirshipAnalytics';
4
+ import { AirshipChannel } from './AirshipChannel';
5
+ import { AirshipContact } from './AirshipContact';
6
+ import { AirshipFeatureFlagManager } from './AirshipFeatureFlagManager';
7
+ import { AirshipInApp } from './AirshipInApp';
8
+ import { AirshipLocale } from './AirshipLocale';
9
+ import { AirshipMessageCenter } from './AirshipMessageCenter';
10
+ import { AirshipPreferenceCenter } from './AirshipPreferenceCenter';
11
+ import { AirshipPrivacyManager } from './AirshipPrivacyManager';
12
+ import { AirshipPush } from './AirshipPush';
13
+ import type { AirshipPluginWrapper } from './AirshipPlugin';
14
+ import type { AirshipConfig, DeepLinkEvent } from './types';
15
+ /**
16
+ * Airship
17
+ */
18
+ export declare class AirshipRoot {
19
+ private readonly plugin;
20
+ readonly actions: AirshipActions;
21
+ readonly analytics: AirshipAnalytics;
22
+ readonly channel: AirshipChannel;
23
+ readonly contact: AirshipContact;
24
+ readonly inApp: AirshipInApp;
25
+ readonly locale: AirshipLocale;
26
+ readonly messageCenter: AirshipMessageCenter;
27
+ readonly preferenceCenter: AirshipPreferenceCenter;
28
+ readonly privacyManager: AirshipPrivacyManager;
29
+ readonly push: AirshipPush;
30
+ readonly featureFlagManager: AirshipFeatureFlagManager;
31
+ constructor(plugin: AirshipPluginWrapper);
32
+ /**
33
+ * Calls takeOff. If Airship is already configured for
34
+ * the app session, the new config will be applied on the next
35
+ * app init.
36
+ * @param config The config.
37
+ * @returns A promise with the result. `true` if airship is ready.
38
+ */
39
+ takeOff(config: AirshipConfig): Promise<boolean>;
40
+ /**
41
+ * Checks if Airship is ready.
42
+ * @returns A promise with the result.
43
+ */
44
+ isFlying(): Promise<boolean>;
45
+ /**
46
+ * Adds a deep link listener.
47
+ */
48
+ onDeepLink(listener: (event: DeepLinkEvent) => void): Promise<PluginListenerHandle>;
49
+ }
@@ -0,0 +1,55 @@
1
+ import { AirshipActions } from './AirshipActions';
2
+ import { AirshipAnalytics } from './AirshipAnalytics';
3
+ import { AirshipChannel } from './AirshipChannel';
4
+ import { AirshipContact } from './AirshipContact';
5
+ import { AirshipFeatureFlagManager } from './AirshipFeatureFlagManager';
6
+ import { AirshipInApp } from './AirshipInApp';
7
+ import { AirshipLocale } from './AirshipLocale';
8
+ import { AirshipMessageCenter } from './AirshipMessageCenter';
9
+ import { AirshipPreferenceCenter } from './AirshipPreferenceCenter';
10
+ import { AirshipPrivacyManager } from './AirshipPrivacyManager';
11
+ import { AirshipPush } from './AirshipPush';
12
+ import { EventType } from './EventType';
13
+ /**
14
+ * Airship
15
+ */
16
+ export class AirshipRoot {
17
+ constructor(plugin) {
18
+ this.plugin = plugin;
19
+ this.actions = new AirshipActions(plugin);
20
+ this.analytics = new AirshipAnalytics(plugin);
21
+ this.channel = new AirshipChannel(plugin);
22
+ this.contact = new AirshipContact(plugin);
23
+ this.inApp = new AirshipInApp(plugin);
24
+ this.locale = new AirshipLocale(plugin);
25
+ this.messageCenter = new AirshipMessageCenter(plugin);
26
+ this.preferenceCenter = new AirshipPreferenceCenter(plugin);
27
+ this.privacyManager = new AirshipPrivacyManager(plugin);
28
+ this.push = new AirshipPush(plugin);
29
+ this.featureFlagManager = new AirshipFeatureFlagManager(plugin);
30
+ }
31
+ /**
32
+ * Calls takeOff. If Airship is already configured for
33
+ * the app session, the new config will be applied on the next
34
+ * app init.
35
+ * @param config The config.
36
+ * @returns A promise with the result. `true` if airship is ready.
37
+ */
38
+ takeOff(config) {
39
+ return this.plugin.perform('takeOff', config);
40
+ }
41
+ /**
42
+ * Checks if Airship is ready.
43
+ * @returns A promise with the result.
44
+ */
45
+ isFlying() {
46
+ return this.plugin.perform('isFlying');
47
+ }
48
+ /**
49
+ * Adds a deep link listener.
50
+ */
51
+ onDeepLink(listener) {
52
+ return this.plugin.addListener(EventType.DeepLink, listener);
53
+ }
54
+ }
55
+ //# sourceMappingURL=AirshipRoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirshipRoot.js","sourceRoot":"","sources":["../../src/AirshipRoot.ts"],"names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AAuB,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,cAAc,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,kBAAkB,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,MAAqB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,UAAU,CAAC,QAAwC;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC9D,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { AirshipActions } from './AirshipActions';\nimport { AirshipAnalytics } from './AirshipAnalytics';\nimport { AirshipChannel } from './AirshipChannel';\nimport { AirshipContact } from './AirshipContact';\nimport { AirshipFeatureFlagManager } from './AirshipFeatureFlagManager';\nimport { AirshipInApp } from './AirshipInApp';\nimport { AirshipLocale } from './AirshipLocale';\nimport { AirshipMessageCenter } from './AirshipMessageCenter';\nimport { AirshipPreferenceCenter } from './AirshipPreferenceCenter';\nimport { AirshipPrivacyManager } from './AirshipPrivacyManager';\nimport { AirshipPush } from './AirshipPush';\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type { AirshipConfig , DeepLinkEvent } from './types';\n\n/**\n * Airship\n */\nexport class AirshipRoot {\n public readonly actions: AirshipActions;\n public readonly analytics: AirshipAnalytics;\n public readonly channel: AirshipChannel;\n public readonly contact: AirshipContact;\n public readonly inApp: AirshipInApp;\n public readonly locale: AirshipLocale;\n public readonly messageCenter: AirshipMessageCenter;\n public readonly preferenceCenter: AirshipPreferenceCenter;\n public readonly privacyManager: AirshipPrivacyManager;\n public readonly push: AirshipPush;\n public readonly featureFlagManager: AirshipFeatureFlagManager;\n\n constructor(private readonly plugin: AirshipPluginWrapper) {\n this.actions = new AirshipActions(plugin);\n this.analytics = new AirshipAnalytics(plugin);\n this.channel = new AirshipChannel(plugin);\n this.contact = new AirshipContact(plugin);\n this.inApp = new AirshipInApp(plugin);\n this.locale = new AirshipLocale(plugin);\n this.messageCenter = new AirshipMessageCenter(plugin);\n this.preferenceCenter = new AirshipPreferenceCenter(plugin);\n this.privacyManager = new AirshipPrivacyManager(plugin);\n this.push = new AirshipPush(plugin);\n this.featureFlagManager = new AirshipFeatureFlagManager(plugin);\n }\n\n /**\n * Calls takeOff. If Airship is already configured for\n * the app session, the new config will be applied on the next\n * app init.\n * @param config The config.\n * @returns A promise with the result. `true` if airship is ready.\n */\n public takeOff(config: AirshipConfig): Promise<boolean> {\n return this.plugin.perform('takeOff', config);\n }\n\n /**\n * Checks if Airship is ready.\n * @returns A promise with the result.\n */\n public isFlying(): Promise<boolean> {\n return this.plugin.perform('isFlying');\n }\n\n /**\n * Adds a deep link listener.\n */\n public onDeepLink(listener: (event: DeepLinkEvent) => void): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.DeepLink, listener)\n }\n}\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Attribute operation
3
+ * @hidden
4
+ */
5
+ export interface AttributeOperation {
6
+ /**
7
+ * The operation name.
8
+ */
9
+ action: string;
10
+ /**
11
+ * The attribute key.
12
+ */
13
+ key: string;
14
+ /**
15
+ * The attribute value, if available.
16
+ */
17
+ value?: string | number | Date;
18
+ /**
19
+ * The attribute type, if available.
20
+ */
21
+ type?: 'string' | 'number' | 'date';
22
+ }
23
+ /**
24
+ * Editor for attributes.
25
+ */
26
+ export declare class AttributeEditor {
27
+ onApply: (operations: AttributeOperation[]) => Promise<void>;
28
+ operations: AttributeOperation[];
29
+ /**
30
+ * AttributeEditor constructor
31
+ *
32
+ * @hidden
33
+ * @param onApply The apply function
34
+ */
35
+ constructor(onApply: (operations: AttributeOperation[]) => Promise<void>);
36
+ /**
37
+ * Adds an attribute.
38
+ *
39
+ * @param value The attribute value.
40
+ * @param name The attribute name.
41
+ * @return The attribute editor instance.
42
+ */
43
+ setAttribute(name: string, value: string | number | boolean | Date): AttributeEditor;
44
+ /**
45
+ * Removes an attribute.
46
+ * @param name The name of the attribute to remove.
47
+ * @return The attribute editor instance.
48
+ */
49
+ removeAttribute(name: string): AttributeEditor;
50
+ /**
51
+ * Applies the attribute operations.
52
+ */
53
+ apply(): Promise<void>;
54
+ }
@@ -0,0 +1,76 @@
1
+ /* Copyright Airship and Contributors */
2
+ 'use strict';
3
+ /**
4
+ * Editor for attributes.
5
+ */
6
+ export class AttributeEditor {
7
+ /**
8
+ * AttributeEditor constructor
9
+ *
10
+ * @hidden
11
+ * @param onApply The apply function
12
+ */
13
+ constructor(onApply) {
14
+ this.onApply = onApply;
15
+ this.operations = [];
16
+ }
17
+ /**
18
+ * Adds an attribute.
19
+ *
20
+ * @param value The attribute value.
21
+ * @param name The attribute name.
22
+ * @return The attribute editor instance.
23
+ */
24
+ setAttribute(name, value) {
25
+ let attributeValue;
26
+ let attributeType;
27
+ if (typeof value === 'boolean') {
28
+ // No boolean attribute type. Convert value to string.
29
+ attributeValue = value.toString();
30
+ attributeType = 'string';
31
+ }
32
+ else {
33
+ attributeValue = value;
34
+ if (typeof value === 'string') {
35
+ attributeType = 'string';
36
+ }
37
+ else if (typeof attributeValue === 'number') {
38
+ attributeType = 'number';
39
+ }
40
+ else if (value instanceof Date) {
41
+ // JavaScript's date type doesn't pass through the JS to native bridge.
42
+ // Dates are instead serialized as milliseconds since epoch.
43
+ attributeType = 'date';
44
+ attributeValue = value.getTime();
45
+ }
46
+ else {
47
+ throw 'Unsupported attribute type: ' + typeof attributeValue;
48
+ }
49
+ }
50
+ const operation = {
51
+ action: 'set',
52
+ value: attributeValue,
53
+ key: name,
54
+ type: attributeType,
55
+ };
56
+ this.operations.push(operation);
57
+ return this;
58
+ }
59
+ /**
60
+ * Removes an attribute.
61
+ * @param name The name of the attribute to remove.
62
+ * @return The attribute editor instance.
63
+ */
64
+ removeAttribute(name) {
65
+ const operation = { action: 'remove', key: name };
66
+ this.operations.push(operation);
67
+ return this;
68
+ }
69
+ /**
70
+ * Applies the attribute operations.
71
+ */
72
+ apply() {
73
+ return this.onApply(this.operations);
74
+ }
75
+ }
76
+ //# sourceMappingURL=AttributeEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttributeEditor.js","sourceRoot":"","sources":["../../src/AttributeEditor.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,YAAY,CAAC;AAyBb;;GAEG;AACH,MAAM,OAAO,eAAe;IAI1B;;;;;OAKG;IACH,YAAY,OAA4D;QACtE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CACV,IAAY,EACZ,KAAuC;QAEvC,IAAI,cAAsC,CAAC;QAC3C,IAAI,aAA2C,CAAC;QAEhD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;YAC9B,sDAAsD;YACtD,cAAc,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAClC,aAAa,GAAG,QAAQ,CAAC;SAC1B;aAAM;YACL,cAAc,GAAG,KAAK,CAAC;YACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,aAAa,GAAG,QAAQ,CAAC;aAC1B;iBAAM,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;gBAC7C,aAAa,GAAG,QAAQ,CAAC;aAC1B;iBAAM,IAAI,KAAK,YAAY,IAAI,EAAE;gBAChC,uEAAuE;gBACvE,4DAA4D;gBAC5D,aAAa,GAAG,MAAM,CAAC;gBACvB,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;aAClC;iBAAM;gBACL,MAAM,8BAA8B,GAAG,OAAO,cAAc,CAAC;aAC9D;SACF;QAED,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,cAAc;YACrB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,aAAa;SACpB,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,IAAY;QAC1B,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/* Copyright Airship and Contributors */\n\n'use strict';\n\n/**\n * Attribute operation\n * @hidden\n */\nexport interface AttributeOperation {\n /**\n * The operation name.\n */\n action: string;\n /**\n * The attribute key.\n */\n key: string;\n /**\n * The attribute value, if available.\n */\n value?: string | number | Date;\n /**\n * The attribute type, if available.\n */\n type?: 'string' | 'number' | 'date';\n}\n\n/**\n * Editor for attributes.\n */\nexport class AttributeEditor {\n onApply: (operations: AttributeOperation[]) => Promise<void>;\n operations: AttributeOperation[];\n\n /**\n * AttributeEditor constructor\n *\n * @hidden\n * @param onApply The apply function\n */\n constructor(onApply: (operations: AttributeOperation[]) => Promise<void>) {\n this.onApply = onApply;\n this.operations = [];\n }\n\n /**\n * Adds an attribute.\n *\n * @param value The attribute value.\n * @param name The attribute name.\n * @return The attribute editor instance.\n */\n setAttribute(\n name: string,\n value: string | number | boolean | Date\n ): AttributeEditor {\n let attributeValue: string | number | Date;\n let attributeType: 'string' | 'number' | 'date';\n\n if (typeof value === 'boolean') {\n // No boolean attribute type. Convert value to string.\n attributeValue = value.toString();\n attributeType = 'string';\n } else {\n attributeValue = value;\n if (typeof value === 'string') {\n attributeType = 'string';\n } else if (typeof attributeValue === 'number') {\n attributeType = 'number';\n } else if (value instanceof Date) {\n // JavaScript's date type doesn't pass through the JS to native bridge.\n // Dates are instead serialized as milliseconds since epoch.\n attributeType = 'date';\n attributeValue = value.getTime();\n } else {\n throw 'Unsupported attribute type: ' + typeof attributeValue;\n }\n }\n\n const operation = {\n action: 'set',\n value: attributeValue,\n key: name,\n type: attributeType,\n };\n this.operations.push(operation);\n\n return this;\n }\n\n /**\n * Removes an attribute.\n * @param name The name of the attribute to remove.\n * @return The attribute editor instance.\n */\n removeAttribute(name: string): AttributeEditor {\n const operation = { action: 'remove', key: name };\n this.operations.push(operation);\n return this;\n }\n\n /**\n * Applies the attribute operations.\n */\n apply(): Promise<void> {\n return this.onApply(this.operations);\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { ChannelCreatedEvent, NotificationResponseEvent, PushReceivedEvent, DeepLinkEvent, MessageCenterUpdatedEvent, PushNotificationStatusChangedEvent, iOS, DisplayMessageCenterEvent, DisplayPreferenceCenterEvent, PushTokenReceivedEvent } from './types';
2
+ export declare enum EventType {
3
+ ChannelCreated = "channel_created",
4
+ NotificationResponse = "notification_response_received",
5
+ PushReceived = "push_received",
6
+ DeepLink = "deep_link_received",
7
+ MessageCenterUpdated = "message_center_updated",
8
+ PushNotificationStatusChangedStatus = "notification_status_changed",
9
+ DisplayMessageCenter = "display_message_center",
10
+ DisplayPreferenceCenter = "display_preference_center",
11
+ PushTokenReceived = "push_token_received",
12
+ IOSAuthorizedNotificationSettingsChanged = "ios_authorized_notification_settings_changed"
13
+ }
14
+ export interface EventTypeMap {
15
+ [EventType.ChannelCreated]: ChannelCreatedEvent;
16
+ [EventType.NotificationResponse]: NotificationResponseEvent;
17
+ [EventType.PushReceived]: PushReceivedEvent;
18
+ [EventType.DeepLink]: DeepLinkEvent;
19
+ [EventType.MessageCenterUpdated]: MessageCenterUpdatedEvent;
20
+ [EventType.PushNotificationStatusChangedStatus]: PushNotificationStatusChangedEvent;
21
+ [EventType.IOSAuthorizedNotificationSettingsChanged]: iOS.AuthorizedNotificationSettingsChangedEvent;
22
+ [EventType.DisplayMessageCenter]: DisplayMessageCenterEvent;
23
+ [EventType.DisplayPreferenceCenter]: DisplayPreferenceCenterEvent;
24
+ [EventType.PushTokenReceived]: PushTokenReceivedEvent;
25
+ }
@@ -0,0 +1,14 @@
1
+ export var EventType;
2
+ (function (EventType) {
3
+ EventType["ChannelCreated"] = "channel_created";
4
+ EventType["NotificationResponse"] = "notification_response_received";
5
+ EventType["PushReceived"] = "push_received";
6
+ EventType["DeepLink"] = "deep_link_received";
7
+ EventType["MessageCenterUpdated"] = "message_center_updated";
8
+ EventType["PushNotificationStatusChangedStatus"] = "notification_status_changed";
9
+ EventType["DisplayMessageCenter"] = "display_message_center";
10
+ EventType["DisplayPreferenceCenter"] = "display_preference_center";
11
+ EventType["PushTokenReceived"] = "push_token_received";
12
+ EventType["IOSAuthorizedNotificationSettingsChanged"] = "ios_authorized_notification_settings_changed";
13
+ })(EventType || (EventType = {}));
14
+ //# sourceMappingURL=EventType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventType.js","sourceRoot":"","sources":["../../src/EventType.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,+CAAkC,CAAA;IAClC,oEAAuD,CAAA;IACvD,2CAA8B,CAAA;IAC9B,4CAA+B,CAAA;IAC/B,4DAA+C,CAAA;IAC/C,gFAAmE,CAAA;IACnE,4DAA+C,CAAA;IAC/C,kEAAqD,CAAA;IACrD,sDAAyC,CAAA;IACzC,sGAAyF,CAAA;AAC3F,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB","sourcesContent":["import type {\n ChannelCreatedEvent,\n NotificationResponseEvent,\n PushReceivedEvent,\n DeepLinkEvent,\n MessageCenterUpdatedEvent,\n PushNotificationStatusChangedEvent,\n iOS,\n DisplayMessageCenterEvent,\n DisplayPreferenceCenterEvent,\n PushTokenReceivedEvent,\n} from './types';\n\nexport enum EventType {\n ChannelCreated = 'channel_created',\n NotificationResponse = 'notification_response_received',\n PushReceived = 'push_received',\n DeepLink = 'deep_link_received',\n MessageCenterUpdated = 'message_center_updated',\n PushNotificationStatusChangedStatus = 'notification_status_changed',\n DisplayMessageCenter = 'display_message_center',\n DisplayPreferenceCenter = 'display_preference_center',\n PushTokenReceived = 'push_token_received',\n IOSAuthorizedNotificationSettingsChanged = 'ios_authorized_notification_settings_changed',\n}\n\nexport interface EventTypeMap {\n [EventType.ChannelCreated]: ChannelCreatedEvent;\n [EventType.NotificationResponse]: NotificationResponseEvent;\n [EventType.PushReceived]: PushReceivedEvent;\n [EventType.DeepLink]: DeepLinkEvent;\n [EventType.MessageCenterUpdated]: MessageCenterUpdatedEvent;\n [EventType.PushNotificationStatusChangedStatus]: PushNotificationStatusChangedEvent;\n [EventType.IOSAuthorizedNotificationSettingsChanged]: iOS.AuthorizedNotificationSettingsChangedEvent;\n [EventType.DisplayMessageCenter]: DisplayMessageCenterEvent;\n [EventType.DisplayPreferenceCenter]: DisplayPreferenceCenterEvent;\n [EventType.PushTokenReceived]: PushTokenReceivedEvent;\n}\n"]}
@@ -0,0 +1,59 @@
1
+ import type { SubscriptionScope } from './types';
2
+ /**
3
+ * Enum of internal scoped subscription list update type.
4
+ * @hidden
5
+ */
6
+ declare enum ScopedSubscriptionListOperationAction {
7
+ subscribe = "subscribe",
8
+ unsubscribe = "unsubscribe"
9
+ }
10
+ /**
11
+ * Scoped subscription list operation.
12
+ * @hidden
13
+ */
14
+ export interface ScopedSubscriptionListOperation {
15
+ /**
16
+ * The subscription list identifier.
17
+ */
18
+ listId: string;
19
+ /**
20
+ * The subscription list update type.
21
+ */
22
+ action: ScopedSubscriptionListOperationAction;
23
+ /**
24
+ * The subscription scope to update.
25
+ */
26
+ scope: SubscriptionScope;
27
+ }
28
+ /**
29
+ * Scoped subscription list editor.
30
+ */
31
+ export declare class ScopedSubscriptionListEditor {
32
+ onApply: (operations: ScopedSubscriptionListOperation[]) => Promise<void>;
33
+ operations: ScopedSubscriptionListOperation[];
34
+ /**
35
+ */
36
+ constructor(onApply: (operations: ScopedSubscriptionListOperation[]) => Promise<void>);
37
+ /**
38
+ * Subscribes to a list in the given scope.
39
+ *
40
+ * @param subscriptionListId The subscription list identifier.
41
+ * @param scope The subscription scope to subscribe.
42
+ * @returns The editor.
43
+ */
44
+ subscribe(subscriptionListId: string, scope: SubscriptionScope): ScopedSubscriptionListEditor;
45
+ /**
46
+ * Unsubscribe from a list.
47
+ *
48
+ * @param subscriptionListId The subscription list identifier.
49
+ * @param scope The subscription scope to unsubscribe.
50
+ * @returns The editor.
51
+ */
52
+ unsubscribe(subscriptionListId: string, scope: SubscriptionScope): ScopedSubscriptionListEditor;
53
+ /**
54
+ * Applies subscription list changes.
55
+ *
56
+ */
57
+ apply(): Promise<void>;
58
+ }
59
+ export {};
@@ -0,0 +1,62 @@
1
+ /* Copyright Airship and Contributors */
2
+ 'use strict';
3
+ /**
4
+ * Enum of internal scoped subscription list update type.
5
+ * @hidden
6
+ */
7
+ var ScopedSubscriptionListOperationAction;
8
+ (function (ScopedSubscriptionListOperationAction) {
9
+ ScopedSubscriptionListOperationAction["subscribe"] = "subscribe";
10
+ ScopedSubscriptionListOperationAction["unsubscribe"] = "unsubscribe";
11
+ })(ScopedSubscriptionListOperationAction || (ScopedSubscriptionListOperationAction = {}));
12
+ /**
13
+ * Scoped subscription list editor.
14
+ */
15
+ export class ScopedSubscriptionListEditor {
16
+ /**
17
+ */
18
+ constructor(onApply) {
19
+ this.onApply = onApply;
20
+ this.operations = [];
21
+ }
22
+ /**
23
+ * Subscribes to a list in the given scope.
24
+ *
25
+ * @param subscriptionListId The subscription list identifier.
26
+ * @param scope The subscription scope to subscribe.
27
+ * @returns The editor.
28
+ */
29
+ subscribe(subscriptionListId, scope) {
30
+ const operation = {
31
+ listId: subscriptionListId,
32
+ action: ScopedSubscriptionListOperationAction.subscribe,
33
+ scope: scope,
34
+ };
35
+ this.operations.push(operation);
36
+ return this;
37
+ }
38
+ /**
39
+ * Unsubscribe from a list.
40
+ *
41
+ * @param subscriptionListId The subscription list identifier.
42
+ * @param scope The subscription scope to unsubscribe.
43
+ * @returns The editor.
44
+ */
45
+ unsubscribe(subscriptionListId, scope) {
46
+ const operation = {
47
+ listId: subscriptionListId,
48
+ action: ScopedSubscriptionListOperationAction.unsubscribe,
49
+ scope: scope,
50
+ };
51
+ this.operations.push(operation);
52
+ return this;
53
+ }
54
+ /**
55
+ * Applies subscription list changes.
56
+ *
57
+ */
58
+ apply() {
59
+ return this.onApply(this.operations);
60
+ }
61
+ }
62
+ //# sourceMappingURL=ScopedSubscriptionListEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopedSubscriptionListEditor.js","sourceRoot":"","sources":["../../src/ScopedSubscriptionListEditor.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,YAAY,CAAC;AAIb;;;GAGG;AACH,IAAK,qCAGJ;AAHD,WAAK,qCAAqC;IACxC,gEAAuB,CAAA;IACvB,oEAA2B,CAAA;AAC7B,CAAC,EAHI,qCAAqC,KAArC,qCAAqC,QAGzC;AAqBD;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAMvC;OACG;IACH,YACE,OAEkB;QAElB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,kBAA0B,EAAE,KAAwB;QAC5D,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE,qCAAqC,CAAC,SAAS;YACvD,KAAK,EAAE,KAAK;SACb,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,kBAA0B,EAAE,KAAwB;QAC9D,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE,qCAAqC,CAAC,WAAW;YACzD,KAAK,EAAE,KAAK;SACb,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/* Copyright Airship and Contributors */\n\n'use strict';\n\nimport type { SubscriptionScope } from './types';\n\n/**\n * Enum of internal scoped subscription list update type.\n * @hidden\n */\nenum ScopedSubscriptionListOperationAction {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * Scoped subscription list operation.\n * @hidden\n */\nexport interface ScopedSubscriptionListOperation {\n /**\n * The subscription list identifier.\n */\n listId: string;\n /**\n * The subscription list update type.\n */\n action: ScopedSubscriptionListOperationAction;\n /**\n * The subscription scope to update.\n */\n scope: SubscriptionScope;\n}\n\n/**\n * Scoped subscription list editor.\n */\nexport class ScopedSubscriptionListEditor {\n onApply: (\n operations: ScopedSubscriptionListOperation[]\n ) => Promise<void>;\n operations: ScopedSubscriptionListOperation[];\n\n /**\n */\n constructor(\n onApply: (\n operations: ScopedSubscriptionListOperation[]\n ) => Promise<void>\n ) {\n this.onApply = onApply;\n this.operations = [];\n }\n\n /**\n * Subscribes to a list in the given scope.\n *\n * @param subscriptionListId The subscription list identifier.\n * @param scope The subscription scope to subscribe.\n * @returns The editor.\n */\n subscribe(subscriptionListId: string, scope: SubscriptionScope): ScopedSubscriptionListEditor {\n const operation = {\n listId: subscriptionListId,\n action: ScopedSubscriptionListOperationAction.subscribe,\n scope: scope,\n };\n this.operations.push(operation);\n return this;\n }\n\n /**\n * Unsubscribe from a list.\n *\n * @param subscriptionListId The subscription list identifier.\n * @param scope The subscription scope to unsubscribe.\n * @returns The editor.\n */\n unsubscribe(subscriptionListId: string, scope: SubscriptionScope): ScopedSubscriptionListEditor {\n const operation = {\n listId: subscriptionListId,\n action: ScopedSubscriptionListOperationAction.unsubscribe,\n scope: scope,\n };\n this.operations.push(operation);\n return this;\n }\n\n /**\n * Applies subscription list changes.\n *\n */\n apply(): Promise<void> {\n return this.onApply(this.operations);\n }\n}\n"]}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Enum of internal subscription list update type.
3
+ * @hidden
4
+ */
5
+ declare enum SubscriptionListOperationAction {
6
+ subscribe = "subscribe",
7
+ unsubscribe = "unsubscribe"
8
+ }
9
+ /**
10
+ * Subscription list operation.
11
+ * @hidden
12
+ */
13
+ export interface SubscriptionListOperation {
14
+ /**
15
+ * The subscription list identifier.
16
+ */
17
+ listId: string;
18
+ /**
19
+ * The subscription list update type.
20
+ */
21
+ action: SubscriptionListOperationAction;
22
+ }
23
+ /**
24
+ * Subscription list editor.
25
+ */
26
+ export declare class SubscriptionListEditor {
27
+ private readonly onApply;
28
+ private operations;
29
+ constructor(onApply: (subscriptionListUpdates: SubscriptionListOperation[]) => Promise<void>);
30
+ /**
31
+ * Subscribes to a list.
32
+ *
33
+ * @param subscriptionListId The subscription list identifier.
34
+ * @returns The editor
35
+ */
36
+ subscribe(subscriptionListId: string): SubscriptionListEditor;
37
+ /**
38
+ * Unsubscribe from a list.
39
+ *
40
+ * @param subscriptionListId The subscription list identifier.
41
+ * @returns The editor
42
+ */
43
+ unsubscribe(subscriptionListId: string): SubscriptionListEditor;
44
+ /**
45
+ * Applies subscription list changes.
46
+ *
47
+ */
48
+ apply(): Promise<void>;
49
+ }
50
+ export {};
@@ -0,0 +1,56 @@
1
+ /* Copyright Airship and Contributors */
2
+ 'use strict';
3
+ /**
4
+ * Enum of internal subscription list update type.
5
+ * @hidden
6
+ */
7
+ var SubscriptionListOperationAction;
8
+ (function (SubscriptionListOperationAction) {
9
+ SubscriptionListOperationAction["subscribe"] = "subscribe";
10
+ SubscriptionListOperationAction["unsubscribe"] = "unsubscribe";
11
+ })(SubscriptionListOperationAction || (SubscriptionListOperationAction = {}));
12
+ /**
13
+ * Subscription list editor.
14
+ */
15
+ export class SubscriptionListEditor {
16
+ constructor(onApply) {
17
+ this.onApply = onApply;
18
+ this.operations = [];
19
+ }
20
+ /**
21
+ * Subscribes to a list.
22
+ *
23
+ * @param subscriptionListId The subscription list identifier.
24
+ * @returns The editor
25
+ */
26
+ subscribe(subscriptionListId) {
27
+ const operation = {
28
+ listId: subscriptionListId,
29
+ action: SubscriptionListOperationAction.subscribe,
30
+ };
31
+ this.operations.push(operation);
32
+ return this;
33
+ }
34
+ /**
35
+ * Unsubscribe from a list.
36
+ *
37
+ * @param subscriptionListId The subscription list identifier.
38
+ * @returns The editor
39
+ */
40
+ unsubscribe(subscriptionListId) {
41
+ const operation = {
42
+ listId: subscriptionListId,
43
+ action: SubscriptionListOperationAction.unsubscribe,
44
+ };
45
+ this.operations.push(operation);
46
+ return this;
47
+ }
48
+ /**
49
+ * Applies subscription list changes.
50
+ *
51
+ */
52
+ apply() {
53
+ return this.onApply(this.operations);
54
+ }
55
+ }
56
+ //# sourceMappingURL=SubscriptionListEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubscriptionListEditor.js","sourceRoot":"","sources":["../../src/SubscriptionListEditor.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,YAAY,CAAC;AAEb;;;GAGG;AACH,IAAK,+BAGJ;AAHD,WAAK,+BAA+B;IAClC,0DAAuB,CAAA;IACvB,8DAA2B,CAAA;AAC7B,CAAC,EAHI,+BAA+B,KAA/B,+BAA+B,QAGnC;AAiBD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAGjC,YACmB,OAEC;QAFD,YAAO,GAAP,OAAO,CAEN;QALZ,eAAU,GAAgC,EAAE,CAAC;IAMlD,CAAC;IAEJ;;;;;OAKG;IACH,SAAS,CAAC,kBAA0B;QAClC,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE,+BAA+B,CAAC,SAAS;SAClD,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,kBAA0B;QACpC,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE,+BAA+B,CAAC,WAAW;SACpD,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/* Copyright Airship and Contributors */\n\n'use strict';\n\n/**\n * Enum of internal subscription list update type.\n * @hidden\n */\nenum SubscriptionListOperationAction {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * Subscription list operation.\n * @hidden\n */\nexport interface SubscriptionListOperation {\n /**\n * The subscription list identifier.\n */\n listId: string;\n /**\n * The subscription list update type.\n */\n action: SubscriptionListOperationAction;\n}\n\n/**\n * Subscription list editor.\n */\nexport class SubscriptionListEditor {\n private operations: SubscriptionListOperation[] = [];\n\n constructor(\n private readonly onApply: (\n subscriptionListUpdates: SubscriptionListOperation[]\n ) => Promise<void>\n ) {}\n\n /**\n * Subscribes to a list.\n *\n * @param subscriptionListId The subscription list identifier.\n * @returns The editor\n */\n subscribe(subscriptionListId: string): SubscriptionListEditor {\n const operation = {\n listId: subscriptionListId,\n action: SubscriptionListOperationAction.subscribe,\n };\n this.operations.push(operation);\n return this;\n }\n\n /**\n * Unsubscribe from a list.\n *\n * @param subscriptionListId The subscription list identifier.\n * @returns The editor\n */\n unsubscribe(subscriptionListId: string): SubscriptionListEditor {\n const operation = {\n listId: subscriptionListId,\n action: SubscriptionListOperationAction.unsubscribe,\n };\n this.operations.push(operation);\n return this;\n }\n\n /**\n * Applies subscription list changes.\n *\n */\n apply(): Promise<void> {\n return this.onApply(this.operations);\n }\n}\n"]}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Tag operation.
3
+ * @hidden
4
+ */
5
+ export interface TagOperation {
6
+ /**
7
+ * The operation name
8
+ */
9
+ operationType: string;
10
+ /**
11
+ * An array of tags.
12
+ */
13
+ tags: string[];
14
+ }
15
+ /**
16
+ * Editor for device tags.
17
+ */
18
+ export declare class TagEditor {
19
+ onApply: (operations: TagOperation[]) => Promise<void>;
20
+ operations: TagOperation[];
21
+ /**
22
+ * TagEditor constructor
23
+ *
24
+ * @hidden
25
+ * @param onApply The apply function
26
+ */
27
+ constructor(onApply: (operations: TagOperation[]) => Promise<void>);
28
+ /**
29
+ * Adds tags to a channel.
30
+ *
31
+ * @param tags Tags to add.
32
+ * @return The tag editor instance.
33
+ */
34
+ addTags(tags: string[]): TagEditor;
35
+ /**
36
+ * Removes tags from the channel.
37
+ *
38
+ * @param tags Tags to remove.
39
+ * @return The tag editor instance.
40
+ */
41
+ removeTags(tags: string[]): TagEditor;
42
+ /**
43
+ * Applies the tag changes.
44
+ */
45
+ apply(): Promise<void>;
46
+ }