Skip to content

Commit 64da1e4

Browse files
committed
add logic for newHashedemail to consider if attributes passed the selected current identity type
1 parent 82e12f1 commit 64da1e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/roktManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export default class RoktManager {
197197
// Hashed email identity is valid if it is set to Other-Other10
198198
if(this.mappedEmailShaIdentityType && IdentityType.getIdentityType(this.mappedEmailShaIdentityType) !== false) {
199199
currentHashedEmail = currentUserIdentities[this.mappedEmailShaIdentityType];
200-
newHashedEmail = mappedAttributes['emailsha256'] as string || undefined;
200+
newHashedEmail = mappedAttributes['emailsha256'] as string || mappedAttributes[this.mappedEmailShaIdentityType] as string || undefined;
201201
}
202202

203203
const emailChanged = this.hasIdentityChanged(currentEmail, newEmail);
@@ -344,15 +344,15 @@ export default class RoktManager {
344344
this.logger?.verbose(`RoktManager: Processing ${this.messageQueue.size} queued messages`);
345345

346346
this.messageQueue.forEach((message) => {
347-
if(!(message.methodName in this.kit) || !isFunction(this.kit[message.methodName])) {
347+
if(!(message.methodName in this) || !isFunction(this[message.methodName])) {
348348
this.logger?.error(`RoktManager: Method ${message.methodName} not found in kit`);
349349
return;
350350
}
351351

352352
this.logger?.verbose(`RoktManager: Processing queued message: ${message.methodName} with payload: ${JSON.stringify(message.payload)}`);
353353

354354
try {
355-
const result = (this.kit[message.methodName] as Function)(message.payload);
355+
const result = (this[message.methodName] as Function)(message.payload);
356356
this.completePendingPromise(message.messageId, result);
357357
} catch (error) {
358358
const errorMessage = error instanceof Error ? error.message : String(error);

0 commit comments

Comments
 (0)