Skip to content

[MOB-11551] creates IterableEmbeddedMessageElements class#656

Merged
evantk91 merged 4 commits into
evan/embedded-message-classfrom
evan/MOB-11551-iterable-embedded-message-elements-class
Jun 24, 2025
Merged

[MOB-11551] creates IterableEmbeddedMessageElements class#656
evantk91 merged 4 commits into
evan/embedded-message-classfrom
evan/MOB-11551-iterable-embedded-message-elements-class

Conversation

@evantk91
Copy link
Copy Markdown
Contributor

@evantk91 evantk91 commented Jun 9, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

This pull request creates the IterableEmbeddedMessageElements class.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 9, 2025

Lines Statements Branches Functions
Coverage: 44%
43.73% (227/519) 19.07% (37/194) 37.64% (64/170)

@evantk91 evantk91 changed the title [MOB-11551] iterable embedded message elements class [MOB-11551] creates IterableEmbeddedMessageElements class Jun 9, 2025
@qlty-cloud-legacy
Copy link
Copy Markdown

qlty-cloud-legacy Bot commented Jun 9, 2025

❌ 7 blocking issues (10 total)

Tool Category Rule Count
eslint Lint Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
6
eslint Lint 'text' is already declared in the upper scope on line 74 column 11. 1
qlty Duplication Found 54 lines of similar code in 2 locations (mass = 93) 2
qlty Structure Function with many parameters (count = 7): constructor 1

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

Comment thread src/embedded/classes/IterableEmbeddedMessageDefaultAction.ts
Comment thread src/embedded/classes/IterableEmbeddedMessageElements.ts
Comment thread src/embedded/classes/IterableEmbeddedMessageText.ts
/**
* IterableEmbeddedMessageText represents a text element in an embedded message.
*/
export class IterableEmbeddedMessageText {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like a lot of these don't necessarily need to be classes, and that they could just be interfaces. But I'll have to double check how they all fit together.

Copy link
Copy Markdown
Contributor

@lposen lposen left a comment

Choose a reason for hiding this comment

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

Please update the comments

Base automatically changed from evan/MOB-11550-iterable-embedded-message-button-class to evan/embedded-message-class June 24, 2025 19:22
@@ -0,0 +1,40 @@
import { IterableEmbeddedMessageDefaultAction } from '../embedded/classes/IterableEmbeddedMessageDefaultAction';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,214 @@
import { IterableEmbeddedMessageElements } from '../embedded/classes/IterableEmbeddedMessageElements';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,38 @@
import { IterableEmbeddedMessageText } from '../embedded/classes/IterableEmbeddedMessageText';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,51 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Comment on lines +5 to +42
export class IterableEmbeddedMessageDefaultAction {
/**
* The type of iterable action
* For custom actions, the type is `action://` prefix followed by a custom action name
*/
readonly type: string;

/**
* The url for the action when the type is `openUrl`
* For custom actions, data is empty
*/
readonly data?: string;

/**
* Creates an instance of `IterableEmbeddedMessageDefaultAction`.
*
* @param type - The type of iterable action
* @param data - The url for the action when the type is `openUrl`
*/
constructor(type: string, data?: string) {
this.type = type;
this.data = data;
}

/**
* Creates an instance of `IterableEmbeddedMessageDefaultAction` from a dictionary object.
*
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageDefaultAction` instance.
* @returns A new instance of `IterableEmbeddedMessageDefaultAction` initialized with the provided dictionary properties.
*/
static fromDict(
dict: Partial<EmbeddedMessageDefaultActionDict>
): IterableEmbeddedMessageDefaultAction {
if (!dict.type) {
throw new Error('type is required');
}
return new IterableEmbeddedMessageDefaultAction(dict.type, dict.data);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Found 39 lines of similar code in 2 locations (mass = 76) [qlty:similar-code]

@@ -0,0 +1,101 @@
import { IterableEmbeddedMessageDefaultAction } from './IterableEmbeddedMessageDefaultAction';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Comment on lines +35 to +42
constructor(
title?: string,
body?: string,
mediaUrl?: string,
mediaUrlCaption?: string,
defaultAction?: IterableEmbeddedMessageDefaultAction,
buttons?: IterableEmbeddedMessageElementsButton[],
text?: IterableEmbeddedMessageText[]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 7): constructor [qlty:function-parameters]

IterableEmbeddedMessageElementsButton.fromDict(button)
);

const text = dict.text?.map((text) =>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'text' is already declared in the upper scope on line 74 column 11. [eslint:@typescript-eslint/no-shadow]

@@ -0,0 +1,48 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@evantk91 evantk91 merged commit 2b2899c into evan/embedded-message-class Jun 24, 2025
4 of 5 checks passed
@evantk91 evantk91 deleted the evan/MOB-11551-iterable-embedded-message-elements-class branch June 24, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants