@awesome-cordova-plugins/onesignal 7.0.1 → 8.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.
package/index.d.ts CHANGED
@@ -414,9 +414,10 @@ export interface OSInAppMessageAction {
414
414
  * OSActionType
415
415
  * OSInAppMessageAction
416
416
  */
417
- export declare class OneSignal extends AwesomeCordovaNativePlugin {
417
+ export declare class OneSignalOriginal extends AwesomeCordovaNativePlugin {
418
418
  /**
419
419
  * constants to use in inFocusDisplaying()
420
+ *
420
421
  * @hidden
421
422
  */
422
423
  OSInFocusDisplayOption: {
@@ -426,6 +427,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
426
427
  };
427
428
  /**
428
429
  * Start the initialization process. Once you are done configuring OneSignal, call the `endInit` function.
430
+ *
429
431
  * @param {string} appId Your OneSignal app id
430
432
  * @param {string} googleProjectNumber **ANDROID** - your Google project number; only required for Android GCM/FCM pushes.
431
433
  * @returns {any}
@@ -433,6 +435,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
433
435
  startInit(appId: string, googleProjectNumber?: string): any;
434
436
  /**
435
437
  * Callback to run when a notification is received, whether it was displayed or not.
438
+ *
436
439
  * @returns {Observable<OneSignalReceivedNotification>}
437
440
  */
438
441
  handleNotificationReceived(): Observable<OSNotification>;
@@ -440,16 +443,19 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
440
443
  * Callback to run when a notification is tapped on from the notification shade (**ANDROID**) or notification
441
444
  * center (**iOS**), or when closing an Alert notification shown in the app (if InAppAlert is enabled in
442
445
  * inFocusDisplaying).
446
+ *
443
447
  * @returns {Observable<OneSignalOpenedNotification>}
444
448
  */
445
449
  handleNotificationOpened(): Observable<OSNotificationOpenedResult>;
446
450
  /**
447
451
  * Use to process an In-App Message the user just tapped on.
452
+ *
448
453
  * @returns {Observable<OSInAppMessageAction>}
449
454
  */
450
455
  handleInAppMessageClicked(): Observable<OSInAppMessageAction>;
451
456
  /**
452
457
  * iOS** - Settings for iOS apps
458
+ *
453
459
  * @param settings
454
460
  * kOSSettingsKeyAutoPrompt: boolean = true
455
461
  * Auto prompt user for notification permissions.
@@ -466,11 +472,13 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
466
472
  }): any;
467
473
  /**
468
474
  * Must be called after `startInit` to complete initialization of OneSignal.
475
+ *
469
476
  * @returns {any}
470
477
  */
471
478
  endInit(): any;
472
479
  /**
473
480
  * Prompt the user for notification permissions. Callback fires as soon as the user accepts or declines notifications.
481
+ *
474
482
  * @returns {Promise<boolean>}
475
483
  */
476
484
  promptForPushNotificationsWithUserResponse(): Promise<boolean>;
@@ -478,12 +486,14 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
478
486
  * Retrieve a list of tags that have been set on the user from the OneSignal server.
479
487
  *
480
488
  * Quirk**: You must wait for `getTags` to resolve before calling it again, as the plugin will only process the last method call and discard any previous ones.
489
+ *
481
490
  * @returns {Promise<any>} Returns a Promise that resolves when tags are recieved.
482
491
  */
483
492
  getTags(): Promise<any>;
484
493
  /**
485
494
  * Lets you retrieve the OneSignal user id and device token.
486
495
  * Your handler is called after the device is successfully registered with OneSignal.
496
+ *
487
497
  * @returns {Promise<Object>} Returns a Promise that resolves if the device was successfully registered.
488
498
  *
489
499
  * userId {string} OneSignal userId is a UUID formatted string. (unique per device per app)
@@ -497,6 +507,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
497
507
  /**
498
508
  * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
499
509
  * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
510
+ *
500
511
  * @param {string} Key of your choosing to create or update.
501
512
  * @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
502
513
  * @param key
@@ -506,18 +517,21 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
506
517
  /**
507
518
  * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
508
519
  * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
520
+ *
509
521
  * @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
510
522
  * @param json
511
523
  */
512
524
  sendTags(json: any): void;
513
525
  /**
514
526
  * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
527
+ *
515
528
  * @param {string} Key to remove.
516
529
  * @param key
517
530
  */
518
531
  deleteTag(key: string): void;
519
532
  /**
520
533
  * Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
534
+ *
521
535
  * @param {string[]} Keys to remove.
522
536
  * @param keys
523
537
  */
@@ -533,6 +547,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
533
547
  *
534
548
  * By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
535
549
  * Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
550
+ *
536
551
  * @param {boolean} false to disable vibrate, true to re-enable it.
537
552
  * @param enable
538
553
  */
@@ -543,13 +558,15 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
543
558
  *
544
559
  * By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
545
560
  * Passing false means that the device will only vibrate unless the device is set to a total silent mode.
561
+ *
546
562
  * @param {boolean} false to disable sound, true to re-enable it.
547
563
  * @param enable
548
564
  */
549
565
  enableSound(enable: boolean): void;
550
566
  /**
551
567
  *
552
- *Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development.
568
+ * Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development.
569
+ *
553
570
  * @param {DisplayType} displayOption
554
571
  * @returns {any}
555
572
  */
@@ -557,11 +574,13 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
557
574
  /**
558
575
  * You can call this method with false to opt users out of receiving all notifications through OneSignal.
559
576
  * You can pass true later to opt users back into notifications.
577
+ *
560
578
  * @param {boolean} enable
561
579
  */
562
580
  setSubscription(enable: boolean): void;
563
581
  /**
564
582
  * Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below.
583
+ *
565
584
  * @returns {Promise<OSPermissionSubscriptionState>}
566
585
  */
567
586
  getPermissionSubscriptionState(): Promise<OSPermissionSubscriptionState>;
@@ -574,6 +593,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
574
593
  postNotification(notificationObj: OSNotification): Promise<any>;
575
594
  /**
576
595
  * Cancels a single OneSignal notification based on its Android notification integer id. Use instead of NotificationManager.cancel(id); otherwise the notification will be restored when your app is restarted.
596
+ *
577
597
  * @param notificationId {string}
578
598
  */
579
599
  cancelNotification(notificationId: string): void;
@@ -591,6 +611,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
591
611
  * The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
592
612
  *
593
613
  * The higher the value the more information is shown.
614
+ *
594
615
  * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
595
616
  * @param logLevel
596
617
  * @param logLevel.logLevel
@@ -602,6 +623,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
602
623
  }): void;
603
624
  /**
604
625
  * Disable or enable location collection (Defaults to enabled) if your app has location permission.
626
+ *
605
627
  * @param shared {boolean}
606
628
  */
607
629
  setLocationShared(shared: boolean): void;
@@ -611,6 +633,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
611
633
  * - Notification permission prompt shown
612
634
  * - The user accepting or declining the permission prompt
613
635
  * - Enabling/disabling notifications for your app in the device Settings after returning to your app.
636
+ *
614
637
  * @returns {Observable<any>}
615
638
  */
616
639
  addPermissionObserver(): Observable<any>;
@@ -621,11 +644,13 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
621
644
  * - Getting a player / user id from OneSignal
622
645
  * - OneSignal.setSubscription is called
623
646
  * - User disables or enables notifications
647
+ *
624
648
  * @returns {Observable<any>}
625
649
  */
626
650
  addSubscriptionObserver(): Observable<any>;
627
651
  /**
628
652
  * Clears all OneSignal notifications
653
+ *
629
654
  * @param email
630
655
  * @param emailAuthToken
631
656
  */
@@ -641,6 +666,7 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
641
666
  * - Getting a player / user id from OneSignal
642
667
  * - OneSignal.setSubscription is called
643
668
  * - User disables or enables notifications
669
+ *
644
670
  * @returns {Observable<any>}
645
671
  */
646
672
  addEmailSubscriptionObserver(): Observable<any>;
@@ -651,23 +677,27 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
651
677
  /**
652
678
  * Allows you to delay the initialization of the SDK until the user provides privacy consent.
653
679
  * The SDK will not be fully initialized until the provideUserConsent(true) method is called.
680
+ *
654
681
  * @param {boolean} required
655
682
  */
656
683
  setRequiresUserPrivacyConsent(required: boolean): void;
657
684
  /**
658
685
  * If your application is set to require the user's privacy consent, you can provide this consent using this method.
659
686
  * Until you call provideUserConsent(true), the SDK will not fully initialize and will not send any data to OneSignal.
687
+ *
660
688
  * @param {boolean} granted
661
689
  */
662
690
  provideUserConsent(granted: boolean): void;
663
691
  /**
664
692
  * Accepts a callback, which returns a boolean variable indicating if the user has given privacy consent yet.
693
+ *
665
694
  * @param {Function} callback
666
695
  */
667
696
  userProvidedPrivacyConsent(callback: Function): void;
668
697
  /**
669
698
  * Allows you to use your own system's user ID's to send push notifications to your users.
670
699
  * To tie a user to a given user ID, you can use this method.
700
+ *
671
701
  * @param {string} externalId
672
702
  */
673
703
  setExternalUserId(externalId: string): void;
@@ -677,27 +707,32 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
677
707
  removeExternalUserId(): void;
678
708
  /**
679
709
  * Add a trigger. May show an In-App Message if its trigger conditions were met.
710
+ *
680
711
  * @param {string} key Key for the trigger.
681
712
  * @param {string | number | Object} value Value for the trigger. String or number recommended. Object passed in will be converted to a string.
682
713
  */
683
714
  addTrigger(key: string, value: string | number | Object): void;
684
715
  /**
685
716
  * Add a map of triggers. May show an In-App Message if its trigger conditions were met.
717
+ *
686
718
  * @param {Object.<string, string | number | Object>} triggers Allows you to set multiple trigger key/value pairs simultaneously. Pass a json object with key/value pairs like: `{"key": "value", "key2": "value2"}`.
687
719
  */
688
720
  addTriggers(triggers: Object): void;
689
721
  /**
690
722
  * Removes a single trigger for the given key. May show an In-App Message if its trigger conditions were met.
723
+ *
691
724
  * @param {string} key Key for trigger to remove.
692
725
  */
693
726
  removeTriggerForKey(key: string): void;
694
727
  /**
695
728
  * Removes a list of triggers based on a collection (array) of keys. May show an In-App Message if its trigger conditions were met.
729
+ *
696
730
  * @param {string[]} keys Removes a collection of triggers from their keys. Pass an array of trigger keys like: `["key1", "key2", "key3"]`.
697
731
  */
698
732
  removeTriggersForKeys(keys: string[]): void;
699
733
  /**
700
734
  * Gets a trigger value for a provided trigger key.
735
+ *
701
736
  * @param {string} key Key for trigger to get value.
702
737
  * @returns {Promise<string | number | Object>} Return value set with `addTrigger`, or `null`/`nil` (iOS) if never set or removed.
703
738
  */
@@ -705,7 +740,10 @@ export declare class OneSignal extends AwesomeCordovaNativePlugin {
705
740
  /**
706
741
  * Allows you to temporarily pause all In-App Messages. You may want to do this while the user is engaged in an activity that you don't want a message to interrupt (such as watching a video).
707
742
  * An In-App Message that would display if not paused will display right after resume if its conditions to display remains satisfied.
743
+ *
708
744
  * @param {boolean} pause To pause, set `true`. To resume, set `false`.
709
745
  */
710
746
  pauseInAppMessages(pause: boolean): void;
711
747
  }
748
+
749
+ export declare const OneSignal: OneSignalOriginal;