@@ -14,7 +14,7 @@ import { SDKIdentityApi } from "./identity.interfaces";
1414import { SDKLoggerApi } from "./sdkRuntimeModels" ;
1515import { IStore , LocalSessionAttributes } from "./store" ;
1616import { UserIdentities } from "@mparticle/web-sdk" ;
17- import { IdentityType } from "./types" ;
17+ import { IdentityType , PerformanceMarkType } from "./types" ;
1818
1919// https://docs.rokt.com/developers/integration-guides/web/library/attributes
2020export type RoktAttributeValueArray = Array < string | number | boolean > ;
@@ -101,6 +101,7 @@ export default class RoktManager {
101101 private logger : SDKLoggerApi ;
102102 private domain ?: string ;
103103 private mappedEmailShaIdentityType ?: string | null ;
104+ private captureTiming ?: ( metricsName : string ) => void ;
104105 /**
105106 * Initializes the RoktManager with configuration settings and user data.
106107 *
@@ -109,6 +110,7 @@ export default class RoktManager {
109110 * @param {SDKIdentityApi } identityService - The mParticle Identity instance
110111 * @param {SDKLoggerApi } logger - The mParticle Logger instance
111112 * @param {IRoktOptions } options - Options for the RoktManager
113+ * @param {Function } captureTiming - Function to capture performance timing marks
112114 *
113115 * @throws Logs error to console if placementAttributesMapping parsing fails
114116 */
@@ -118,7 +120,8 @@ export default class RoktManager {
118120 identityService : SDKIdentityApi ,
119121 store : IStore ,
120122 logger ?: SDKLoggerApi ,
121- options ?: IRoktOptions
123+ options ?: IRoktOptions ,
124+ captureTiming ?: ( metricsName : string ) => void
122125 ) : void {
123126 const { userAttributeFilters, settings } = roktConfig || { } ;
124127 const { placementAttributesMapping, hashedEmailUserIdentityType } = settings || { } ;
@@ -127,6 +130,7 @@ export default class RoktManager {
127130 this . identityService = identityService ;
128131 this . store = store ;
129132 this . logger = logger ;
133+ this . captureTiming = captureTiming ;
130134
131135 this . filters = {
132136 userAttributeFilters,
@@ -176,6 +180,10 @@ export default class RoktManager {
176180 * });
177181 */
178182 public async selectPlacements ( options : IRoktSelectPlacementsOptions ) : Promise < IRoktSelection > {
183+ if ( this . captureTiming ) {
184+ this . captureTiming ( PerformanceMarkType . JointSdkSelectPlacements ) ;
185+ }
186+
179187 if ( ! this . isReady ( ) ) {
180188 return this . deferredCall < IRoktSelection > ( 'selectPlacements' , options ) ;
181189 }
@@ -514,4 +522,4 @@ export default class RoktManager {
514522
515523 return false ; // Values are the same
516524 }
517- }
525+ }
0 commit comments