@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":"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,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,SAAiB;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;;OAQG;IACI,OAAO,CAAC,SAAkB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACI,eAAe,CAAC,SAAiB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,iCAAiC,CAAC,UAAmB;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,iDAAiD,EACjD,UAAU,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS,CACd,QAAoD;QAEpD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,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"]}
@@ -0,0 +1,31 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { EventType, EventTypeMap } from './EventType';
3
+ import { AirshipConfig } from './types';
4
+ export interface AirshipPlugin {
5
+ perform(options: {
6
+ method: string;
7
+ value?: any;
8
+ }): Promise<{
9
+ value?: any;
10
+ }>;
11
+ addListener(eventName: string, listenerFunc: (...args: any[]) => any): Promise<PluginListenerHandle>;
12
+ }
13
+ export declare class AirshipPluginWrapper {
14
+ private readonly plugin;
15
+ constructor(plugin: AirshipPlugin);
16
+ perform(method: string, value?: any): Promise<any | undefined | null>;
17
+ addListener<T extends EventType>(eventType: T, listener: (event: EventTypeMap[T]) => any): Promise<PluginListenerHandle>;
18
+ }
19
+ declare module '@capacitor/cli' {
20
+ interface PluginsConfig {
21
+ /**
22
+ * Airship plugin options
23
+ */
24
+ Airship?: {
25
+ /**
26
+ * Default config options
27
+ */
28
+ config?: AirshipConfig;
29
+ };
30
+ }
31
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="@capacitor/cli" />
2
+ export class AirshipPluginWrapper {
3
+ constructor(plugin) {
4
+ this.plugin = plugin;
5
+ }
6
+ perform(method, value) {
7
+ return this.plugin.perform({ method: method, value: value }).then(value => {
8
+ return value.value;
9
+ });
10
+ }
11
+ addListener(eventType, listener) {
12
+ return this.plugin.addListener(eventType, listener);
13
+ }
14
+ }
15
+ //# sourceMappingURL=AirshipPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirshipPlugin.js","sourceRoot":"","sources":["../../src/AirshipPlugin.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAexC,MAAM,OAAO,oBAAoB;IAC/B,YAA6B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAC/C,OAAO,CAAC,MAAc,EAAE,KAAW;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxE,OAAO,KAAK,CAAC,KAAK,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,WAAW,CAChB,SAAY,EACZ,QAAyC;QAEzC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nimport type { EventType, EventTypeMap } from './EventType';\nimport { AirshipConfig } from './types';\n\nexport interface AirshipPlugin {\n perform(options: { method: string; value?: any }): Promise<{ value?: any }>;\n addListener(\n eventName: string,\n listenerFunc: (...args: any[]) => any,\n ): Promise<PluginListenerHandle>;\n}\n\nexport class AirshipPluginWrapper {\n constructor(private readonly plugin: AirshipPlugin) {}\n public perform(method: string, value?: any): Promise<any | undefined | null> {\n return this.plugin.perform({ method: method, value: value }).then(value => {\n return value.value;\n });\n }\n\n public addListener<T extends EventType>(\n eventType: T,\n listener: (event: EventTypeMap[T]) => any,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(eventType, listener);\n }\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * Airship plugin options\n */\n Airship?: {\n /**\n * Default config options\n */\n config?: AirshipConfig\n }\n }\n}\n\n"]}
@@ -0,0 +1,38 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { AirshipPluginWrapper } from './AirshipPlugin';
3
+ import type { DisplayPreferenceCenterEvent, PreferenceCenter } from './types';
4
+ /**
5
+ * Airship Preference Center.
6
+ */
7
+ export declare class AirshipPreferenceCenter {
8
+ private readonly plugin;
9
+ constructor(plugin: AirshipPluginWrapper);
10
+ /**
11
+ * Requests to display a preference center.
12
+ *
13
+ * Will either emit an event to display the
14
+ * Preference Center if auto launch is disabled,
15
+ * or display the OOTB UI.
16
+ * @param preferenceCenterId The preference center Id.
17
+ * @returns A promise.
18
+ */
19
+ display(preferenceCenterId: string): Promise<void>;
20
+ /**
21
+ * Gets the preference center config.
22
+ * @param preferenceCenterId The preference center Id.
23
+ * @returns A promise with the result.
24
+ */
25
+ getConfig(preferenceCenterId: string): Promise<PreferenceCenter>;
26
+ /**
27
+ * Enables or disables showing the OOTB UI when requested to display by either
28
+ * `display` or by a notification with some other action.
29
+ * @param preferenceCenterId The preference center Id.
30
+ * @param autoLaunch true to show OOTB UI, false to emit events.
31
+ * @returns A promise with the result.
32
+ */
33
+ setAutoLaunchDefaultPreferenceCenter(preferenceCenterId: string, autoLaunch: boolean): Promise<void>;
34
+ /**
35
+ * Adds a display message center listener.
36
+ */
37
+ onDisplay(listener: (event: DisplayPreferenceCenterEvent) => void): Promise<PluginListenerHandle>;
38
+ }
@@ -0,0 +1,49 @@
1
+ import { EventType } from './EventType';
2
+ /**
3
+ * Airship Preference Center.
4
+ */
5
+ export class AirshipPreferenceCenter {
6
+ constructor(plugin) {
7
+ this.plugin = plugin;
8
+ }
9
+ /**
10
+ * Requests to display a preference center.
11
+ *
12
+ * Will either emit an event to display the
13
+ * Preference Center if auto launch is disabled,
14
+ * or display the OOTB UI.
15
+ * @param preferenceCenterId The preference center Id.
16
+ * @returns A promise.
17
+ */
18
+ display(preferenceCenterId) {
19
+ return this.plugin.perform('preferenceCenter#display', preferenceCenterId);
20
+ }
21
+ /**
22
+ * Gets the preference center config.
23
+ * @param preferenceCenterId The preference center Id.
24
+ * @returns A promise with the result.
25
+ */
26
+ getConfig(preferenceCenterId) {
27
+ return this.plugin.perform('preferenceCenter#getConfig', preferenceCenterId);
28
+ }
29
+ /**
30
+ * Enables or disables showing the OOTB UI when requested to display by either
31
+ * `display` or by a notification with some other action.
32
+ * @param preferenceCenterId The preference center Id.
33
+ * @param autoLaunch true to show OOTB UI, false to emit events.
34
+ * @returns A promise with the result.
35
+ */
36
+ setAutoLaunchDefaultPreferenceCenter(preferenceCenterId, autoLaunch) {
37
+ return this.plugin.perform('preferenceCenter#getConfig', [
38
+ preferenceCenterId,
39
+ autoLaunch,
40
+ ]);
41
+ }
42
+ /**
43
+ * Adds a display message center listener.
44
+ */
45
+ onDisplay(listener) {
46
+ return this.plugin.addListener(EventType.DisplayPreferenceCenter, listener);
47
+ }
48
+ }
49
+ //# sourceMappingURL=AirshipPreferenceCenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirshipPreferenceCenter.js","sourceRoot":"","sources":["../../src/AirshipPreferenceCenter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAClC,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D;;;;;;;;OAQG;IACI,OAAO,CAAC,kBAA0B;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,kBAA0B;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,4BAA4B,EAC5B,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,oCAAoC,CACzC,kBAA0B,EAC1B,UAAmB;QAEnB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,4BAA4B,EAAE;YACvD,kBAAkB;YAClB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,SAAS,CACd,QAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { EventType } from './EventType';\nimport type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type { DisplayPreferenceCenterEvent, PreferenceCenter } from './types';\n/**\n * Airship Preference Center.\n */\nexport class AirshipPreferenceCenter {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Requests to display a preference center.\n *\n * Will either emit an event to display the\n * Preference Center if auto launch is disabled,\n * or display the OOTB UI.\n * @param preferenceCenterId The preference center Id.\n * @returns A promise.\n */\n public display(preferenceCenterId: string): Promise<void> {\n return this.plugin.perform('preferenceCenter#display', preferenceCenterId);\n }\n\n /**\n * Gets the preference center config.\n * @param preferenceCenterId The preference center Id.\n * @returns A promise with the result.\n */\n public getConfig(preferenceCenterId: string): Promise<PreferenceCenter> {\n return this.plugin.perform(\n 'preferenceCenter#getConfig',\n preferenceCenterId,\n );\n }\n\n /**\n * Enables or disables showing the OOTB UI when requested to display by either\n * `display` or by a notification with some other action.\n * @param preferenceCenterId The preference center Id.\n * @param autoLaunch true to show OOTB UI, false to emit events.\n * @returns A promise with the result.\n */\n public setAutoLaunchDefaultPreferenceCenter(\n preferenceCenterId: string,\n autoLaunch: boolean,\n ): Promise<void> {\n return this.plugin.perform('preferenceCenter#getConfig', [\n preferenceCenterId,\n autoLaunch,\n ]);\n }\n\n /**\n * Adds a display message center listener.\n */\n public onDisplay(\n listener: (event: DisplayPreferenceCenterEvent) => void,\n ): Promise<PluginListenerHandle> {\n return this.plugin.addListener(EventType.DisplayPreferenceCenter, listener);\n }\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import type { AirshipPluginWrapper } from './AirshipPlugin';
2
+ import type { Feature } from './types';
3
+ /**
4
+ * Airship Privacy Manager.
5
+ */
6
+ export declare class AirshipPrivacyManager {
7
+ private readonly plugin;
8
+ constructor(plugin: AirshipPluginWrapper);
9
+ /**
10
+ * Sets the current set of enabled features.
11
+ * @param features The features to set.
12
+ * @returns A promise.
13
+ */
14
+ setEnabledFeatures(features: Feature[]): Promise<void>;
15
+ /**
16
+ * Gets the current enabled features.
17
+ * @returns A promise with the result.
18
+ */
19
+ getEnabledFeatures(): Promise<Feature[]>;
20
+ /**
21
+ * Enables additional features.
22
+ * @param features The features to enable.
23
+ * @returns A promise.
24
+ */
25
+ enableFeatures(features: Feature[]): Promise<void>;
26
+ /**
27
+ * Disable features.
28
+ * @param features The features to disable.
29
+ * @returns A promise.
30
+ */
31
+ disableFeatures(features: Feature[]): Promise<void>;
32
+ /**
33
+ * Checks if the features are enabled or not.
34
+ * @param features The features to check.
35
+ * @returns A promise with the result.
36
+ */
37
+ isFeaturesEnabled(features: Feature[]): Promise<void>;
38
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Airship Privacy Manager.
3
+ */
4
+ export class AirshipPrivacyManager {
5
+ constructor(plugin) {
6
+ this.plugin = plugin;
7
+ }
8
+ /**
9
+ * Sets the current set of enabled features.
10
+ * @param features The features to set.
11
+ * @returns A promise.
12
+ */
13
+ setEnabledFeatures(features) {
14
+ return this.plugin.perform('privacyManager#setEnabledFeatures', features);
15
+ }
16
+ /**
17
+ * Gets the current enabled features.
18
+ * @returns A promise with the result.
19
+ */
20
+ getEnabledFeatures() {
21
+ return this.plugin.perform('privacyManager#getEnabledFeatures');
22
+ }
23
+ /**
24
+ * Enables additional features.
25
+ * @param features The features to enable.
26
+ * @returns A promise.
27
+ */
28
+ enableFeatures(features) {
29
+ return this.plugin.perform('privacyManager#enableFeatures', features);
30
+ }
31
+ /**
32
+ * Disable features.
33
+ * @param features The features to disable.
34
+ * @returns A promise.
35
+ */
36
+ disableFeatures(features) {
37
+ return this.plugin.perform('privacyManager#disableFeatures', features);
38
+ }
39
+ /**
40
+ * Checks if the features are enabled or not.
41
+ * @param features The features to check.
42
+ * @returns A promise with the result.
43
+ */
44
+ isFeaturesEnabled(features) {
45
+ return this.plugin.perform('privacyManager#isFeaturesEnabled', features);
46
+ }
47
+ }
48
+ //# sourceMappingURL=AirshipPrivacyManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AirshipPrivacyManager.js","sourceRoot":"","sources":["../../src/AirshipPrivacyManager.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D;;;;OAIG;IACI,kBAAkB,CAAC,QAAmB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,QAAmB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,QAAmB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,QAAmB;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { AirshipPluginWrapper } from './AirshipPlugin';\nimport type { Feature } from './types';\n\n/**\n * Airship Privacy Manager.\n */\nexport class AirshipPrivacyManager {\n constructor(private readonly plugin: AirshipPluginWrapper) {}\n\n /**\n * Sets the current set of enabled features.\n * @param features The features to set.\n * @returns A promise.\n */\n public setEnabledFeatures(features: Feature[]): Promise<void> {\n return this.plugin.perform('privacyManager#setEnabledFeatures', features);\n }\n\n /**\n * Gets the current enabled features.\n * @returns A promise with the result.\n */\n public getEnabledFeatures(): Promise<Feature[]> {\n return this.plugin.perform('privacyManager#getEnabledFeatures');\n }\n\n /**\n * Enables additional features.\n * @param features The features to enable.\n * @returns A promise.\n */\n public enableFeatures(features: Feature[]): Promise<void> {\n return this.plugin.perform('privacyManager#enableFeatures', features);\n }\n\n /**\n * Disable features.\n * @param features The features to disable.\n * @returns A promise.\n */\n public disableFeatures(features: Feature[]): Promise<void> {\n return this.plugin.perform('privacyManager#disableFeatures', features);\n }\n\n /**\n * Checks if the features are enabled or not.\n * @param features The features to check.\n * @returns A promise with the result.\n */\n public isFeaturesEnabled(features: Feature[]): Promise<void> {\n return this.plugin.perform('privacyManager#isFeaturesEnabled', features);\n }\n}\n"]}
@@ -0,0 +1,184 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { AirshipPluginWrapper } from './AirshipPlugin';
3
+ import type { Android, iOS, NotificationResponseEvent, PushNotificationStatus, PushNotificationStatusChangedEvent, PushPayload, PushReceivedEvent, PushTokenReceivedEvent } from './types';
4
+ /**
5
+ * Airship Push.
6
+ */
7
+ export declare class AirshipPush {
8
+ private readonly plugin;
9
+ /**
10
+ * iOS only push methods.
11
+ */
12
+ readonly iOS: AirshipPushIOS;
13
+ /**
14
+ * Android only push methods.
15
+ */
16
+ readonly android: AirshipPushAndroid;
17
+ constructor(plugin: AirshipPluginWrapper);
18
+ /**
19
+ * Enables/disables notifications on Airship.
20
+ *
21
+ * When enabled, it will cause the user to be prompted for
22
+ * the permission on platforms that support it.
23
+ * To get the result of the prompt, use `enableUserNotifications`.
24
+ * @param enabled true to enable, false to disable
25
+ * @returns A promise.
26
+ */
27
+ setUserNotificationsEnabled(enabled: boolean): Promise<void>;
28
+ /**
29
+ * Checks if user notifications are enabled or not on Airship.
30
+ * @returns A promise with the result.
31
+ */
32
+ isUserNotificationsEnabled(): Promise<boolean>;
33
+ /**
34
+ * Enables user notifications.
35
+ * @returns A promise with the permission result.
36
+ */
37
+ enableUserNotifications(): Promise<boolean>;
38
+ /**
39
+ * Gets the notification status.
40
+ * @returns A promise with the result.
41
+ */
42
+ getNotificationStatus(): Promise<PushNotificationStatus>;
43
+ /**
44
+ * Gets the registration token if generated.
45
+ * Use the event EventType.PushTokenReceived to be notified
46
+ * when available.
47
+ * @returns A promise with the result.
48
+ */
49
+ getPushToken(): Promise<string | null | undefined>;
50
+ /**
51
+ * Gets the list of active notifications.
52
+ *
53
+ * On Android, this list only includes notifications
54
+ * sent through Airship.
55
+ * @returns A promise with the result.
56
+ */
57
+ getActiveNotifications(): Promise<PushPayload[]>;
58
+ /**
59
+ * Clears all notifications for the app.
60
+ * @returns A promise with the result.
61
+ */
62
+ clearNotifications(): Promise<void>;
63
+ /**
64
+ * Clears a specific notification.
65
+ *
66
+ * On Android, you can use this method to clear
67
+ * notifications outside of Airship, The identifier is in
68
+ * the format of <tag>:<id>.
69
+ * @param identifier The identifier.
70
+ * @returns A promise with the result.
71
+ */
72
+ clearNotification(identifier: string): Promise<void>;
73
+ /**
74
+ * Adds a notification response event listener.
75
+ */
76
+ onNotificationResponse(listener: (event: NotificationResponseEvent) => void): Promise<PluginListenerHandle>;
77
+ /**
78
+ * Adds a push received event listener.
79
+ */
80
+ onPushReceived(listener: (event: PushReceivedEvent) => void): Promise<PluginListenerHandle>;
81
+ /**
82
+ * Adds a notification status changed event listener.
83
+ */
84
+ onNotificationStatusChanged(listener: (event: PushNotificationStatusChangedEvent) => void): Promise<PluginListenerHandle>;
85
+ /**
86
+ * Adds a notification status changed event listener.
87
+ */
88
+ onPushTokenReceived(listener: (event: PushTokenReceivedEvent) => void): Promise<PluginListenerHandle>;
89
+ }
90
+ /**
91
+ * iOS Push.
92
+ */
93
+ export declare class AirshipPushIOS {
94
+ private readonly plugin;
95
+ constructor(plugin: AirshipPluginWrapper);
96
+ /**
97
+ * Sets the foreground presentation options.
98
+ * @param options The foreground options.
99
+ * @returns A promise.
100
+ */
101
+ setForegroundPresentationOptions(options: iOS.ForegroundPresentationOption[]): Promise<void>;
102
+ /**
103
+ * Sets the notification options.
104
+ * @param options The notification options.
105
+ * @returns A promise.
106
+ */
107
+ setNotificationOptions(options: iOS.NotificationOption[]): Promise<void>;
108
+ /**
109
+ * Checks if autobadge is enabled.
110
+ * @returns A promise with the result.
111
+ */
112
+ isAutobadgeEnabled(): Promise<boolean>;
113
+ /**
114
+ * Enables/disables autobadge.
115
+ * @param enabled true to enable, false to disable.
116
+ * @returns A promise.
117
+ */
118
+ setAutobadgeEnabled(enabled: boolean): Promise<void>;
119
+ /**
120
+ * Set the badge number.
121
+ * @param badge The badge number.
122
+ * @returns A promise.
123
+ */
124
+ setBadgeNumber(badge: number): Promise<void>;
125
+ /**
126
+ * Gets the badge number.
127
+ * @returns A promise with the result.
128
+ */
129
+ getBadgeNumber(): Promise<number>;
130
+ /**
131
+ * Enables/disables quiet time.
132
+ *
133
+ * @param enabled true to enable, false to disable
134
+ * @returns A promise with the result.
135
+ */
136
+ setQuietTimeEnabled(enabled: boolean): Promise<void>;
137
+ /**
138
+ * Checks if quiet time is enabled or not.
139
+ * @returns A promise with the result.
140
+ */
141
+ isQuietTimeEnabled(): Promise<void>;
142
+ /**
143
+ * Sets quiet time.
144
+ *
145
+ * @param quietTime The quiet time.
146
+ * @returns A promise with the result.
147
+ */
148
+ setQuietTime(quietTime: iOS.QuietTime): Promise<void>;
149
+ /**
150
+ * Gets the quiet time settings.
151
+ *
152
+ * @returns A promise with the result.
153
+ */
154
+ getQuietTime(): Promise<iOS.QuietTime | null | undefined>;
155
+ /**
156
+ * Adds a authorized settings changed event listener.
157
+ */
158
+ onAuthorizedSettingsChanged(listener: (event: iOS.AuthorizedNotificationSettingsChangedEvent) => void): Promise<PluginListenerHandle>;
159
+ }
160
+ /**
161
+ * Android Push.
162
+ */
163
+ export declare class AirshipPushAndroid {
164
+ private readonly plugin;
165
+ constructor(plugin: AirshipPluginWrapper);
166
+ /**
167
+ * Checks if a notification category/channel is enabled.
168
+ * @param channel The channel name.
169
+ * @returns A promise with the result.
170
+ */
171
+ isNotificationChannelEnabled(channel: string): Promise<boolean>;
172
+ /**
173
+ * Sets the notification config.
174
+ * @param config The notification config.
175
+ * @returns A promise with the result.
176
+ */
177
+ setNotificationConfig(config: Android.NotificationConfig): Promise<void>;
178
+ /**
179
+ * Enables/disables showing notifications in the foreground.
180
+ * @param enabled true to enable, false to disable.
181
+ * @returns A promise with the result.
182
+ */
183
+ setForegroundNotificationsEnabled(enabled: boolean): Promise<void>;
184
+ }
@@ -0,0 +1,232 @@
1
+ import { EventType } from './EventType';
2
+ /**
3
+ * Airship Push.
4
+ */
5
+ export class AirshipPush {
6
+ constructor(plugin) {
7
+ this.plugin = plugin;
8
+ this.iOS = new AirshipPushIOS(plugin);
9
+ this.android = new AirshipPushAndroid(plugin);
10
+ }
11
+ /**
12
+ * Enables/disables notifications on Airship.
13
+ *
14
+ * When enabled, it will cause the user to be prompted for
15
+ * the permission on platforms that support it.
16
+ * To get the result of the prompt, use `enableUserNotifications`.
17
+ * @param enabled true to enable, false to disable
18
+ * @returns A promise.
19
+ */
20
+ setUserNotificationsEnabled(enabled) {
21
+ return this.plugin.perform('push#setUserNotificationsEnabled', enabled);
22
+ }
23
+ /**
24
+ * Checks if user notifications are enabled or not on Airship.
25
+ * @returns A promise with the result.
26
+ */
27
+ isUserNotificationsEnabled() {
28
+ return this.plugin.perform('push#isUserNotificationsEnabled');
29
+ }
30
+ /**
31
+ * Enables user notifications.
32
+ * @returns A promise with the permission result.
33
+ */
34
+ enableUserNotifications() {
35
+ return this.plugin.perform('push#enableUserNotifications');
36
+ }
37
+ /**
38
+ * Gets the notification status.
39
+ * @returns A promise with the result.
40
+ */
41
+ getNotificationStatus() {
42
+ return this.plugin.perform('push#getNotificationStatus');
43
+ }
44
+ /**
45
+ * Gets the registration token if generated.
46
+ * Use the event EventType.PushTokenReceived to be notified
47
+ * when available.
48
+ * @returns A promise with the result.
49
+ */
50
+ getPushToken() {
51
+ return this.plugin.perform('push#getPushToken');
52
+ }
53
+ /**
54
+ * Gets the list of active notifications.
55
+ *
56
+ * On Android, this list only includes notifications
57
+ * sent through Airship.
58
+ * @returns A promise with the result.
59
+ */
60
+ getActiveNotifications() {
61
+ return this.plugin.perform('push#getActiveNotifications');
62
+ }
63
+ /**
64
+ * Clears all notifications for the app.
65
+ * @returns A promise with the result.
66
+ */
67
+ clearNotifications() {
68
+ return this.plugin.perform('push#clearNotifications');
69
+ }
70
+ /**
71
+ * Clears a specific notification.
72
+ *
73
+ * On Android, you can use this method to clear
74
+ * notifications outside of Airship, The identifier is in
75
+ * the format of <tag>:<id>.
76
+ * @param identifier The identifier.
77
+ * @returns A promise with the result.
78
+ */
79
+ clearNotification(identifier) {
80
+ return this.plugin.perform('push#clearNotification', identifier);
81
+ }
82
+ /**
83
+ * Adds a notification response event listener.
84
+ */
85
+ onNotificationResponse(listener) {
86
+ return this.plugin.addListener(EventType.NotificationResponse, listener);
87
+ }
88
+ /**
89
+ * Adds a push received event listener.
90
+ */
91
+ onPushReceived(listener) {
92
+ return this.plugin.addListener(EventType.PushReceived, listener);
93
+ }
94
+ /**
95
+ * Adds a notification status changed event listener.
96
+ */
97
+ onNotificationStatusChanged(listener) {
98
+ return this.plugin.addListener(EventType.PushNotificationStatusChangedStatus, listener);
99
+ }
100
+ /**
101
+ * Adds a notification status changed event listener.
102
+ */
103
+ onPushTokenReceived(listener) {
104
+ return this.plugin.addListener(EventType.PushTokenReceived, listener);
105
+ }
106
+ }
107
+ /**
108
+ * iOS Push.
109
+ */
110
+ export class AirshipPushIOS {
111
+ constructor(plugin) {
112
+ this.plugin = plugin;
113
+ }
114
+ /**
115
+ * Sets the foreground presentation options.
116
+ * @param options The foreground options.
117
+ * @returns A promise.
118
+ */
119
+ setForegroundPresentationOptions(options) {
120
+ return this.plugin.perform('push#ios#setForegroundPresentationOptions', options);
121
+ }
122
+ /**
123
+ * Sets the notification options.
124
+ * @param options The notification options.
125
+ * @returns A promise.
126
+ */
127
+ setNotificationOptions(options) {
128
+ return this.plugin.perform('push#ios#setNotificationOptions', options);
129
+ }
130
+ /**
131
+ * Checks if autobadge is enabled.
132
+ * @returns A promise with the result.
133
+ */
134
+ isAutobadgeEnabled() {
135
+ return this.plugin.perform('push#ios#isAutobadgeEnabled');
136
+ }
137
+ /**
138
+ * Enables/disables autobadge.
139
+ * @param enabled true to enable, false to disable.
140
+ * @returns A promise.
141
+ */
142
+ setAutobadgeEnabled(enabled) {
143
+ return this.plugin.perform('push#ios#setAutobadgeEnabled', enabled);
144
+ }
145
+ /**
146
+ * Set the badge number.
147
+ * @param badge The badge number.
148
+ * @returns A promise.
149
+ */
150
+ setBadgeNumber(badge) {
151
+ return this.plugin.perform('push#ios#setBadgeNumber', badge);
152
+ }
153
+ /**
154
+ * Gets the badge number.
155
+ * @returns A promise with the result.
156
+ */
157
+ getBadgeNumber() {
158
+ return this.plugin.perform('push#ios#getBadgeNumber');
159
+ }
160
+ /**
161
+ * Enables/disables quiet time.
162
+ *
163
+ * @param enabled true to enable, false to disable
164
+ * @returns A promise with the result.
165
+ */
166
+ setQuietTimeEnabled(enabled) {
167
+ return this.plugin.perform('push#ios#setQuietTimeEnabled', enabled);
168
+ }
169
+ /**
170
+ * Checks if quiet time is enabled or not.
171
+ * @returns A promise with the result.
172
+ */
173
+ isQuietTimeEnabled() {
174
+ return this.plugin.perform('push#ios#isQuietTimeEnabled');
175
+ }
176
+ /**
177
+ * Sets quiet time.
178
+ *
179
+ * @param quietTime The quiet time.
180
+ * @returns A promise with the result.
181
+ */
182
+ setQuietTime(quietTime) {
183
+ return this.plugin.perform('push#ios#setQuietTime', quietTime);
184
+ }
185
+ /**
186
+ * Gets the quiet time settings.
187
+ *
188
+ * @returns A promise with the result.
189
+ */
190
+ getQuietTime() {
191
+ return this.plugin.perform('push#ios#getQuietTime');
192
+ }
193
+ /**
194
+ * Adds a authorized settings changed event listener.
195
+ */
196
+ onAuthorizedSettingsChanged(listener) {
197
+ return this.plugin.addListener(EventType.IOSAuthorizedNotificationSettingsChanged, listener);
198
+ }
199
+ }
200
+ /**
201
+ * Android Push.
202
+ */
203
+ export class AirshipPushAndroid {
204
+ constructor(plugin) {
205
+ this.plugin = plugin;
206
+ }
207
+ /**
208
+ * Checks if a notification category/channel is enabled.
209
+ * @param channel The channel name.
210
+ * @returns A promise with the result.
211
+ */
212
+ isNotificationChannelEnabled(channel) {
213
+ return this.plugin.perform('push#android#isNotificationChannelEnabled', channel);
214
+ }
215
+ /**
216
+ * Sets the notification config.
217
+ * @param config The notification config.
218
+ * @returns A promise with the result.
219
+ */
220
+ setNotificationConfig(config) {
221
+ return this.plugin.perform('push#android#setNotificationConfig', config);
222
+ }
223
+ /**
224
+ * Enables/disables showing notifications in the foreground.
225
+ * @param enabled true to enable, false to disable.
226
+ * @returns A promise with the result.
227
+ */
228
+ setForegroundNotificationsEnabled(enabled) {
229
+ return this.plugin.perform('push#android#setForegroundNotificationsEnabled', enabled);
230
+ }
231
+ }
232
+ //# sourceMappingURL=AirshipPush.js.map