@@ -24,6 +24,7 @@ export interface IRoktSelection {
2424
2525export interface IRoktLauncher {
2626 selectPlacements : ( options : IRoktSelectPlacementsOptions ) => Promise < IRoktSelection > ;
27+ hashAttributes : ( attributes : IRoktPartnerAttributes ) => Promise < Record < string , string > > ;
2728}
2829
2930export interface IRoktMessage {
@@ -43,6 +44,7 @@ export interface IRoktKit {
4344 launcher : IRoktLauncher | null ;
4445 userAttributes : Dictionary < string > ;
4546 selectPlacements : ( options : IRoktSelectPlacementsOptions ) => Promise < IRoktSelection > ;
47+ hashAttributes : ( attributes : IRoktPartnerAttributes ) => Promise < Record < string , string > > ;
4648}
4749
4850export interface IRoktManagerOptions {
@@ -136,6 +138,22 @@ export default class RoktManager {
136138 }
137139 }
138140
141+ public hashAttributes ( attributes : IRoktPartnerAttributes ) : Promise < Record < string , string > > {
142+ if ( ! this . isReady ( ) ) {
143+ this . queueMessage ( {
144+ methodName : 'hashAttributes' ,
145+ payload : attributes ,
146+ } ) ;
147+ return Promise . resolve ( { } as Record < string , string > ) ;
148+ }
149+
150+ try {
151+ return this . kit . hashAttributes ( attributes ) ;
152+ } catch ( error ) {
153+ return Promise . reject ( error instanceof Error ? error : new Error ( 'Unknown error occurred' ) ) ;
154+ }
155+ }
156+
139157 private isReady ( ) : boolean {
140158 // The Rokt Manager is ready when a kit is attached and has a launcher
141159 return Boolean ( this . kit && this . kit . launcher ) ;
0 commit comments