Skip to content

Conversation

@lposen
Copy link
Contributor

@lposen lposen commented Oct 13, 2025

…ages## 🔹 JIRA Ticket(s) if any

✏️ Description

Please provide a brief description of what this pull request does.

@github-actions
Copy link

Lines Statements Branches Functions
Coverage: 48%
48.41% (291/601) 25% (57/228) 46.36% (102/220)

@qltysh
Copy link

qltysh bot commented Oct 13, 2025

4 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 6): getActionPrefix 2
qlty Structure High total complexity (count = 67) 1
qlty Structure Function with many returns (count = 4): getActionPrefix 1

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

Comment on lines +9 to +19
export const getActionPrefix = (
str?: string | null
): IterableCustomActionPrefix | null => {
if (!str) return null;
if (str.startsWith(IterableCustomActionPrefix.Action)) {
return IterableCustomActionPrefix.Action;
}
if (str.startsWith(IterableCustomActionPrefix.Itbl)) {
return IterableCustomActionPrefix.Itbl;
}
return null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues:

1. Function with high complexity (count = 6): getActionPrefix [qlty:function-complexity]


2. Function with many returns (count = 4): getActionPrefix [qlty:return-statements]

Comment on lines +200 to +240
handleClick(
message: IterableEmbeddedMessage,
buttonId: string | null,
action?: IterableAction | null
) {
const { data, type: actionType } = action ?? {};
const clickedUrl = data && data?.length > 0 ? data : actionType;

IterableLogger.log(
'IterableEmbeddedManager.handleClick',
message,
buttonId,
clickedUrl
);

if (!clickedUrl) {
IterableLogger.log(
'IterableEmbeddedManager.handleClick:',
'A url or action is required to handle an embedded click',
clickedUrl
);
return;
}

const actionPrefix = getActionPrefix(clickedUrl);
const source = IterableActionSource.embedded;

this.trackClick(message, buttonId, clickedUrl);

if (actionPrefix) {
const actionName = clickedUrl?.replace(actionPrefix, '');
const actionDetails = new IterableAction(actionName, '', '');
const context = new IterableActionContext(actionDetails, source);
if (this.config.customActionHandler) {
this.config.customActionHandler(actionDetails, context);
}
} else {
const actionDetails = new IterableAction('openUrl', clickedUrl, '');
const context = new IterableActionContext(actionDetails, source);
callUrlHandler(this.config, clickedUrl, context);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with high complexity (count = 7): handleClick [qlty:function-complexity]

@lposen lposen changed the title feat: add trackEmbeddedClick method to handle clicks on embedded mess… [MOB-12268] Add click handling and tracking Oct 13, 2025
@lposen lposen added the embedded Issues/PRs related to Embedded Messages label Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

embedded Issues/PRs related to Embedded Messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant