-
Notifications
You must be signed in to change notification settings - Fork 37
[MOB-7936] create iterable embedded placement class #636
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
Changes from 11 commits
d83d2ec
6a63bbd
b78f8e0
0bb9997
ac62585
626a256
aacfeae
78c92f8
023ed30
0d4b4b3
c30f78a
1ce1e39
547377c
76ef3b9
a07277f
1e2a3a9
9ce071e
ee001de
f361566
ad0ee83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { IterableEmbeddedMessageMetadata } from '../embedded/classes/IterableEmbeddedMessageMetadata'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import { Iterable } from '../core'; | ||
|
||
describe('IterableEmbeddedMessage', () => { | ||
test('should create an instance of IterableEmbeddedMessageMetadata from a dictionary', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageMetadata_fromDict_valid_dictionary' | ||
); | ||
|
||
const dict = { | ||
messageId: '123', | ||
placementId: 456, | ||
campaignId: 789, | ||
isProof: false, | ||
}; | ||
|
||
const result = IterableEmbeddedMessageMetadata.fromDict(dict); | ||
|
||
expect(result).toBeInstanceOf(IterableEmbeddedMessageMetadata); | ||
expect(result.messageId).toBe('123'); | ||
expect(result.placementId).toBe(456); | ||
expect(result.campaignId).toBe(789); | ||
expect(result.isProof).toBe(false); | ||
}); | ||
|
||
test('should handle optional fields', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageMetadata_fromDict_optional_fields_omitted' | ||
); | ||
|
||
const dict = { | ||
messageId: '123', | ||
placementId: 456, | ||
}; | ||
|
||
const result = IterableEmbeddedMessageMetadata.fromDict(dict); | ||
|
||
expect(result).toBeInstanceOf(IterableEmbeddedMessageMetadata); | ||
expect(result.messageId).toBe('123'); | ||
expect(result.placementId).toBe(456); | ||
expect(result.campaignId).toBeUndefined(); | ||
expect(result.isProof).toBe(false); | ||
}); | ||
|
||
test('should throw an error if messageId is not provided', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageMetadata_fromDict_missing_messageId' | ||
); | ||
|
||
const dict = { | ||
placementId: 456, | ||
}; | ||
|
||
expect(() => { | ||
IterableEmbeddedMessageMetadata.fromDict(dict); | ||
}).toThrow('messageId and placementId are required'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { IterableEmbeddedMessageDefaultAction } from '../embedded/classes/IterableEmbeddedMessageDefaultAction'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import { Iterable } from '../core/classes/Iterable'; | ||
|
||
describe('IterableEmbeddedMessageDefaultAction', () => { | ||
it('should create an instance with the correct properties', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageDefaultAction_fromDict_valid_dictionary' | ||
); | ||
|
||
const dict = { type: 'openUrl', data: 'https://example.com' }; | ||
const action = IterableEmbeddedMessageDefaultAction.fromDict(dict); | ||
expect(action).toBeInstanceOf(IterableEmbeddedMessageDefaultAction); | ||
expect(action.type).toBe('openUrl'); | ||
expect(action.data).toBe('https://example.com'); | ||
}); | ||
|
||
it('should create an instance from a dictionary with data omitted', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageDefaultAction_fromDict_valid_dictionary_with_data_omitted' | ||
); | ||
|
||
const dict = { type: 'action://join', data: '' }; | ||
const action = IterableEmbeddedMessageDefaultAction.fromDict(dict); | ||
expect(action).toBeInstanceOf(IterableEmbeddedMessageDefaultAction); | ||
expect(action.type).toBe('action://join'); | ||
expect(action.data).toBe(''); | ||
}); | ||
|
||
it('should throw an error if type is missing in fromDict', () => { | ||
Iterable.logger.log( | ||
'iterableEmbeddedMessageDefaultAction_fromDict_invalid_dictionary_missing_type' | ||
); | ||
|
||
const dict = { data: 'foo' }; | ||
|
||
expect(() => IterableEmbeddedMessageDefaultAction.fromDict(dict)).toThrow( | ||
'type is required' | ||
); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { IterableEmbeddedMessageText } from '../embedded/classes/IterableEmbeddedMessageText'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import { Iterable } from '../core/classes/Iterable'; | ||
|
||
describe('IterableEmbeddedMessageText', () => { | ||
it('should create an instance from a dictionary with all properties', () => { | ||
Iterable.logger.log('iterableEmbeddedMessageText_fromDict_all_properties'); | ||
|
||
const dict = { id: 'text-123', text: 'Hello World!', type: 'heading' }; | ||
const text = IterableEmbeddedMessageText.fromDict(dict); | ||
|
||
expect(text).toBeInstanceOf(IterableEmbeddedMessageText); | ||
expect(text.id).toBe('text-123'); | ||
expect(text.text).toBe('Hello World!'); | ||
expect(text.type).toBe('heading'); | ||
}); | ||
|
||
it('should create an instance from a dictionary with only required properties', () => { | ||
Iterable.logger.log('iterableEmbeddedMessageText_fromDict_required_only'); | ||
|
||
const dict = { id: 'text-123' }; | ||
const text = IterableEmbeddedMessageText.fromDict(dict); | ||
|
||
expect(text).toBeInstanceOf(IterableEmbeddedMessageText); | ||
expect(text.id).toBe('text-123'); | ||
expect(text.text).toBeUndefined(); | ||
expect(text.type).toBeUndefined(); | ||
}); | ||
|
||
it('should throw an error if id is missing in fromDict', () => { | ||
Iterable.logger.log('iterableEmbeddedMessageText_fromDict_missing_id'); | ||
|
||
const dict = { text: 'Hello World!', type: 'heading' }; | ||
|
||
expect(() => IterableEmbeddedMessageText.fromDict(dict)).toThrow( | ||
'id is required' | ||
); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { IterableEmbeddedMessageMetadata } from './IterableEmbeddedMessageMetadata'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import { IterableEmbeddedMessageElements } from './IterableEmbeddedMessageElements'; | ||
|
||
export class IterableEmbeddedMessage { | ||
metadata: IterableEmbeddedMessageMetadata; | ||
elements: IterableEmbeddedMessageElements; | ||
payload: Record<string, unknown>; | ||
|
||
constructor( | ||
metadata: IterableEmbeddedMessageMetadata, | ||
elements: IterableEmbeddedMessageElements, | ||
payload: Record<string, unknown> | ||
) { | ||
this.metadata = metadata; | ||
this.elements = elements; | ||
this.payload = payload; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class IterableEmbeddedMessageButton {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found 2 issues: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found 2 issues: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found 2 issues: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found 2 issues: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found 2 issues: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export class IterableEmbeddedMessageDefaultAction { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** | ||
* 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); | ||
} | ||
} | ||
|
||
/** | ||
* An interface defining the dictionary object containing the properties for the embedded message default action. | ||
*/ | ||
export interface EmbeddedMessageDefaultActionDict { | ||
type: string; | ||
data?: string; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IterableEmbeddedMessageDefaultAction } from './IterableEmbeddedMessageDefaultAction'; | ||
evantk91 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
import { IterableEmbeddedMessageButton } from './IterableEmbeddedMessageButton'; | ||
import { IterableEmbeddedMessageText } from './IterableEmbeddedMessageText'; | ||
|
||
export class IterableEmbeddedMessageElements { | ||
readonly title: string; | ||
readonly body: string; | ||
readonly mediaUrl?: string; | ||
readonly mediaUrlCaption?: string; | ||
readonly defaultAction?: IterableEmbeddedMessageDefaultAction; | ||
readonly buttons?: IterableEmbeddedMessageButton[]; | ||
readonly text?: IterableEmbeddedMessageText[]; | ||
constructor( | ||
title: string, | ||
body: string, | ||
mediaUrl: string | undefined, | ||
mediaUrlCaption: string | undefined, | ||
defaultAction: IterableEmbeddedMessageDefaultAction | undefined, | ||
buttons: IterableEmbeddedMessageButton[] | undefined, | ||
text: IterableEmbeddedMessageText[] | undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
) { | ||
this.title = title; | ||
this.body = body; | ||
this.mediaUrl = mediaUrl; | ||
this.mediaUrlCaption = mediaUrlCaption; | ||
this.defaultAction = defaultAction; | ||
this.buttons = buttons; | ||
this.text = text; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* Metadata for an embedded message. | ||
*/ | ||
export class IterableEmbeddedMessageMetadata { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** The ID for the embedded message */ | ||
readonly messageId: string; | ||
|
||
/** The placement ID for the embedded message */ | ||
readonly placementId: number; | ||
|
||
/** The campaign ID for the embedded message */ | ||
readonly campaignId?: number; | ||
|
||
/** Whether the embedded message is a proof */ | ||
readonly isProof: boolean; | ||
|
||
/** | ||
* Constructs an instance of IterableEmbeddedMessageMetadata. | ||
* | ||
* @param messageId - The ID for the embedded message. | ||
* @param placementId - The placement ID for the embedded message. | ||
* @param campaignId - The campaign ID for the embedded message. | ||
* @param isProof - Whether the embedded message is a proof. | ||
*/ | ||
constructor( | ||
messageId: string, | ||
placementId: number, | ||
campaignId: number | undefined, | ||
isProof: boolean = false | ||
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
) { | ||
this.messageId = messageId; | ||
this.placementId = placementId; | ||
this.campaignId = campaignId; | ||
this.isProof = isProof; | ||
} | ||
|
||
/** | ||
* Creates an instance of `IterableEmbeddedMessageMetadata` from a dictionary object. | ||
* | ||
* @param dict - The dictionary objectcontaining the metadata properties. | ||
* This corresponds to the properties in {@link IterableEmbeddedMessageMetadata} | ||
* | ||
* @returns A new instance of `IterableEmbeddedMessageMetadata` with the provided properties. | ||
*/ | ||
static fromDict( | ||
dict: Partial<EmbeddedMessageMetadataDict> | ||
): IterableEmbeddedMessageMetadata { | ||
if (!dict.messageId || !dict.placementId) { | ||
throw new Error('messageId and placementId are required'); | ||
} | ||
return new IterableEmbeddedMessageMetadata( | ||
dict.messageId, | ||
dict.placementId, | ||
dict.campaignId, | ||
dict.isProof | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* An interface defining the dictionary object containing the metadata properties for an embedded message. | ||
*/ | ||
export interface EmbeddedMessageMetadataDict { | ||
messageId: string; | ||
placementId: number; | ||
campaignId?: number; | ||
isProof?: boolean; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export class IterableEmbeddedMessageText { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** The id of the text element */ | ||
readonly id: string; | ||
/** The text of the text element */ | ||
readonly text?: string; | ||
/** The type of the text element */ | ||
readonly type?: string; | ||
|
||
/** | ||
* Creates an instance of `IterableEmbeddedMessageText`. | ||
* | ||
* @param id - The id of the text element | ||
* @param text - The text of the text element | ||
* @param type - The type of the text element | ||
*/ | ||
constructor(id: string, text?: string, type?: string) { | ||
this.id = id; | ||
this.text = text; | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* Creates an instance of `IterableEmbeddedMessageText` from a dictionary object. | ||
* | ||
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageText` instance. | ||
* @returns A new instance of `IterableEmbeddedMessageText` initialized with the provided dictionary properties. | ||
*/ | ||
static fromDict( | ||
dict: Partial<EmbeddedMessageTextDict> | ||
): IterableEmbeddedMessageText { | ||
if (!dict.id) { | ||
throw new Error('id is required'); | ||
} | ||
return new IterableEmbeddedMessageText(dict.id, dict.text, dict.type); | ||
} | ||
} | ||
|
||
/** | ||
* An interface defining the dictionary object containing the properties for an embedded message text. | ||
*/ | ||
export interface EmbeddedMessageTextDict { | ||
id: string; | ||
text?: string; | ||
type?: string; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { IterableEmbeddedMessage } from './IterableEmbeddedMessage'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
/** | ||
* Iterable embedded placement | ||
* Contains placement id and the associated embedded messages | ||
*/ | ||
export class IterableEmbeddedPlacement { | ||
readonly placementId: number; | ||
|
||
constructor(placementId: number) { | ||
readonly messages: IterableEmbeddedMessage[]; | ||
|
||
constructor(placementId: number, messages: IterableEmbeddedMessage[]) { | ||
this.placementId = placementId; | ||
this.messages = messages; | ||
} | ||
} |
There was a problem hiding this comment.
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]