Preferences
Introduction
The Preferences module exposes features for managing the user preferences.
Preferences Service
The PreferencesService can be used for managing preferences related operations.
Get Preferences
Use the get method to retrieve the user-defined and marketing Preferences.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getPreferencesService().get()
.then(response => console.log('Current preferences:', response))
.catch(error => console.error('Error getting preferences', error));
Update Preferences
Use the update method to update the user-defined and marketing preferences by providing a Preferences object.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const updatedPreferences = {
marketing: {
receivePushNotifications: true,
receiveMarketingEmails: true,
receiveMarketingSms: true,
receiveSocialAds: false,
receiveTargetedAds: false,
receiveThirdPartyAds: false
},
data: {
consentForTargetedAds: true,
consentForAnalytics: false,
consentForPerformanceTracking: true
}
};
Wallet.getInstance().getPreferencesService().update(updatedPreferences)
.then(response => console.log('Preferences updated:', response))
.catch(error => console.error('Error updating preferences', error));