@paysafe/paysafe-wallet-saas-web
    Preparing search index...

    Class PreferencesService

    Service class for managing user preferences related operations.

    Hierarchy

    • ApiService
      • PreferencesService
    Index

    Methods

    • Retrieves the current user preferences.

      Returns Promise<Preferences>

      A Promise that resolves to the retrieved user preferences.

      If the HTTP request fails.

      // Example usage:
      preferencesService.get()
      .then((preferences) => {
      console.log(preferences);
      })
      .catch((error) => {
      console.error('Error fetching preferences.');
      });
    • Updates the user preferences with the provided preferences data.

      Parameters

      • preferences: Preferences

        The preferences object containing marketing and data preferences to update.

      Returns Promise<Preferences>

      A Promise that resolves to the updated user preferences.

      If the HTTP request fails.

      // Example usage:
      const updatedPreferences = {
      marketing: {
      receiveMarketingEmails: true,
      receivePushNotifications: false
      },
      data: {
      consentForAnalytics: true
      }
      };
      preferencesService.update(updatedPreferences)
      .then((preferences) => {
      console.log('Preferences updated:', preferences);
      })
      .catch((error) => {
      console.error('Error updating preferences.');
      });
    • Function

      Retrieves the singleton instance of the PreferencesService class.

      Returns PreferencesService

      The singleton instance of the PreferencesService class.

      // Example usage:
      const preferencesService = PreferencesService.getInstance();