Skip to content

[MOB-11649] updated embedded message class #670

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

Open
wants to merge 24 commits into
base: evan/feature/embedded
Choose a base branch
from

Conversation

evantk91
Copy link
Contributor

@evantk91 evantk91 commented Jun 26, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

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

Evan Greer and others added 17 commits June 9, 2025 11:30
…d-message-button-class

[MOB-11550] creates iterableEmbeddedMessageButton class
…d-message-button-class

[MOB-XXXX] adds labels for dict
…d-message-elements-class

[MOB-11551] creates IterableEmbeddedMessageElements class
…-message-class

[MOB-7936] creates IterableEmbeddedMessage class
@evantk91 evantk91 changed the base branch from evan/feature/embedded to evan/embedded-message-class June 26, 2025 21:27
Copy link

github-actions bot commented Jun 26, 2025

Lines Statements Branches Functions
Coverage: 41%
41.24% (205/497) 18.65% (36/193) 34.16% (55/161)

@evantk91 evantk91 changed the title [MOB-11649] [MOB-11649] Convert subclasses of message into interfaces Jun 26, 2025
@evantk91 evantk91 marked this pull request as draft June 26, 2025 21:28
Copy link

codeclimate bot commented Jun 26, 2025

❌ 6 blocking issues (7 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
qlty Structure Function with high complexity (count = 8): constructor 1

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

@@ -1,5 +1,4 @@
import { IterableEmbeddedMessageElementsButton } from '../embedded/classes/IterableEmbeddedMessageElementsButton';
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]

const buttons = dict.buttons?.map((button) =>
IterableEmbeddedMessageElementsButton.fromDict(button)
const buttons = dict.buttons?.map(
(button) => new IterableEmbeddedMessageElementsButton(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]

@@ -1,5 +1,3 @@
import { IterableEmbeddedMessageElementsButtonAction } from './IterableEmbeddedMessageElementsButtonAction';

/**
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]

const text = dict.text?.map((text) =>
IterableEmbeddedMessageText.fromDict(text)
const text = dict.text?.map(
(text) => new IterableEmbeddedMessageText(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]

@@ -52,7 +52,8 @@ describe('IterableEmbeddedMessage', () => {
};

expect(() => {
IterableEmbeddedMessageMetadata.fromDict(dict);
// @ts-expect-error - messageId is purposely missing
new IterableEmbeddedMessageMetadata(dict);
Copy link

Choose a reason for hiding this comment

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

Do not use 'new' for side effects. [eslint:no-new]

@evantk91 evantk91 changed the base branch from evan/embedded-message-class to evan/feature/embedded June 27, 2025 16:17
@@ -0,0 +1,86 @@
import { IterableEmbeddedMessageButton } from '../embedded/classes/IterableEmbeddedMessageButton';
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,131 @@
import { IterableEmbeddedMessageButton } from './IterableEmbeddedMessageButton';
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 +49 to +88
constructor(dict: EmbeddedMessageDict) {
if (!dict.metadata) {
throw new Error('metadata is required');
}
this.metadata = {
messageId: dict.metadata.messageId,
placementId: dict.metadata.placementId,
campaignId: dict.metadata.campaignId,
isProof: dict.metadata.isProof,
};

if (dict.elements) {
this.elements = {
title: dict.elements?.title,
body: dict.elements?.body,
mediaUrl: dict.elements?.mediaUrl,
mediaUrlCaption: dict.elements?.mediaUrlCaption,
};

if (dict.elements?.defaultAction) {
this.elements.defaultAction = {
type: dict.elements.defaultAction.type,
data: dict.elements.defaultAction.data,
};
}

if (dict.elements?.buttons) {
this.elements.buttons = dict.elements.buttons.map(
(button) => new IterableEmbeddedMessageButton(button)
);
}

if (dict.elements?.text) {
this.elements.text = dict.elements.text.map(
(text) => new IterableEmbeddedMessageText(text)
);
}
}

this.payload = dict.payload;
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 = 8): constructor [qlty:function-complexity]

@@ -0,0 +1,54 @@
/**
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,162 @@
import { IterableEmbeddedMessage } from '../embedded/classes/IterableEmbeddedMessage';
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,86 @@
import { IterableEmbeddedMessageButton } from '../embedded/classes/IterableEmbeddedMessageButton';
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,39 @@
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,131 @@
import { IterableEmbeddedMessageButton } from './IterableEmbeddedMessageButton';
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 +49 to +88
constructor(dict: EmbeddedMessageDict) {
if (!dict.metadata) {
throw new Error('metadata is required');
}
this.metadata = {
messageId: dict.metadata.messageId,
placementId: dict.metadata.placementId,
campaignId: dict.metadata.campaignId,
isProof: dict.metadata.isProof,
};

if (dict.elements) {
this.elements = {
title: dict.elements?.title,
body: dict.elements?.body,
mediaUrl: dict.elements?.mediaUrl,
mediaUrlCaption: dict.elements?.mediaUrlCaption,
};

if (dict.elements?.defaultAction) {
this.elements.defaultAction = {
type: dict.elements.defaultAction.type,
data: dict.elements.defaultAction.data,
};
}

if (dict.elements?.buttons) {
this.elements.buttons = dict.elements.buttons.map(
(button) => new IterableEmbeddedMessageButton(button)
);
}

if (dict.elements?.text) {
this.elements.text = dict.elements.text.map(
(text) => new IterableEmbeddedMessageText(text)
);
}
}

this.payload = dict.payload;
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 = 8): constructor [qlty:function-complexity]

@@ -0,0 +1,54 @@
/**
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,40 @@
/**
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 marked this pull request as ready for review June 27, 2025 16:27
@evantk91 evantk91 changed the title [MOB-11649] Convert subclasses of message into interfaces [MOB-11649] embedded message class Jun 27, 2025
@evantk91 evantk91 changed the title [MOB-11649] embedded message class [MOB-11649] updated embedded message class Jun 27, 2025
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.

1 participant