Skip to content

[MOB-11551] creates IterableEmbeddedMessageElements class #656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

evantk91
Copy link
Contributor

@evantk91 evantk91 commented Jun 9, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

This pull request creates the IterableEmbeddedMessageElements class.

Copy link

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
Copy link

codeclimate 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.

/**
* IterableEmbeddedMessageText represents a text element in an embedded message.
*/
export class IterableEmbeddedMessageText {
Copy link
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
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

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

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

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

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

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

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

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

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

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