diff --git a/gatsby-config.js b/gatsby-config.js index b030bbc433..da24c2ebbb 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -240,7 +240,7 @@ module.exports = { ] }, { - title: "Code-based Experiences", + title: "Code-based Experiences & Content Cards", path: "/edge/adobe-journey-optimizer/code-based", pages: [ { @@ -248,7 +248,7 @@ module.exports = { path: "/edge/adobe-journey-optimizer/code-based/api-reference" }, { - title: "Tutorial", + title: "Code-based Tutorial", path: "/edge/adobe-journey-optimizer/code-based/tutorial" } ] @@ -258,12 +258,28 @@ module.exports = { path: "/edge/adobe-journey-optimizer/public-classes", pages: [ { - title: "MessagingPushPayload", - path: "/edge/adobe-journey-optimizer/public-classes/messaging-push-payload" + title: "ContentCard", + path: "/edge/adobe-journey-optimizer/public-classes/content-card" }, { - title: "PushTrackingStatus", - path: "/edge/adobe-journey-optimizer/public-classes/push-tracking-status" + title: "ContentCardSchemaData", + path: "/edge/adobe-journey-optimizer/public-classes/content-card-schema-data" + }, + { + title: "ContentType", + path: "/edge/adobe-journey-optimizer/public-classes/content-type" + }, + { + title: "HtmlContentSchemaData", + path: "/edge/adobe-journey-optimizer/public-classes/html-content-schema-data" + }, + { + title: "InAppSchemaData", + path: "/edge/adobe-journey-optimizer/public-classes/inapp-schema-data" + }, + { + title: "JsonContentSchemaData", + path: "/edge/adobe-journey-optimizer/public-classes/json-content-schema-data" }, { title: "Message", @@ -273,6 +289,10 @@ module.exports = { title: "MessagingEdgeEventType", path: "/edge/adobe-journey-optimizer/public-classes/messaging-edge-event-type" }, + { + title: "MessagingPushPayload", + path: "/edge/adobe-journey-optimizer/public-classes/messaging-push-payload" + }, { title: "Proposition", path: "/edge/adobe-journey-optimizer/public-classes/proposition" @@ -281,6 +301,10 @@ module.exports = { title: "PropositionItem", path: "/edge/adobe-journey-optimizer/public-classes/proposition-item" }, + { + title: "PushTrackingStatus", + path: "/edge/adobe-journey-optimizer/public-classes/push-tracking-status" + }, { title: "Surface", path: "/edge/adobe-journey-optimizer/public-classes/surface" diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/index.md b/src/pages/edge/adobe-journey-optimizer/code-based/index.md index d59cc56296..876d919ede 100644 --- a/src/pages/edge/adobe-journey-optimizer/code-based/index.md +++ b/src/pages/edge/adobe-journey-optimizer/code-based/index.md @@ -17,7 +17,12 @@ This document guides you to integrating code-based experiences in your applicati ## Public Classes and Enums -* [Class - Proposition](../public-classes/proposition.md) -* [Class - PropositionItem](../public-classes/proposition-item.md) -* [Enum - MessagingEdgeEventType](../public-classes/messaging-edge-event-type.md) -* [Class - Surface](../public-classes/surface.md) +* [Class - ContentCard](./../public-classes/content-card.md) +* [Class - Proposition](./../public-classes/proposition.md) +* [Class - PropositionItem](./../public-classes/proposition-item.md) +* [Class - Surface](./../public-classes/surface.md) +* [Enum - MessagingEdgeEventType](./../public-classes/messaging-edge-event-type.md) +* [Schema Class - ContentCardSchemaData](./../public-classes/content-card-schema-data.md) +* [Schema Class - HtmlContentSchemaData](./../public-classes/html-content-schema-data.md) +* [Schema Class - InAppSchemaData](./../public-classes/inapp-schema-data.md) +* [Schema Class - JsonContentSchemaData](./../public-classes/json-content-schema-data.md) diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer/code-based/tabs/api-reference.md index 05a0dcb4d5..5af5f85f86 100644 --- a/src/pages/edge/adobe-journey-optimizer/code-based/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer/code-based/tabs/api-reference.md @@ -2,7 +2,7 @@ noIndex: true --- - + #### Java @@ -15,7 +15,31 @@ public static void getPropositionsForSurfaces(@NonNull final List surfa * _surfaces_ is a list of surfaces for which propositions are requested. * _callback_ `call` method is invoked with propositions map of type `Map>`. If the callback is an instance of [AdobeCallbackWithError](../../../../home/base/mobile-core/api-reference.md#adobecallbackwitherror), and if the operation times out or an error occurs in retrieving propositions, the `fail` method is invoked with the appropriate [AdobeError](../../../../home/base/mobile-core/api-reference.md#adobeerror). -**Syntax** +**Example** + +#### Kotlin + +```kotlin +val surface1 = Surface("myActivity#button") +val surface2 = Surface("myActivityAttributes") +val surfaces = listOf(surface1, surface2) + +Messaging.getPropositionsForSurfaces(surfaces) { + it?.let { propositionsMap -> + if (propositionsMap.isNotEmpty()) { + // get the propositions for the given surfaces + propositionsMap[surface1]?.let { + // read surface1 propositions + } + propositionsMap[surface2]?.let { + // read surface2 propositions + } + } + } +} +``` + +#### Java ```java final Surface surface1 = new Surface("myActivity#button"); @@ -61,7 +85,7 @@ static func getPropositionsForSurfaces(_ surfacePaths: [Surface], _ completion: * _surfaces_ is an array of surfaces for which propositions are requested. * _completion_ is invoked with propositions dictionary of type `[Surface: [Proposition]]`. An `Error` is returned if SDK fails to retrieve the propositions. -**Syntax** +**Example** ```swift let surface1 = Surface(path: "myView#button") @@ -101,7 +125,7 @@ Messaging.getPropositionsForSurfaces([surface1, surface2]) { propositionsDict, e * _surfaces_ is an array of surfaces for which propositions are requested. * _completion_ is invoked with propositions dictionary of type `NSDictionary*>`. An `NSError` is returned if SDK fails to retrieve the propositions. -**Syntax** +**Example** ```objc AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"]; @@ -122,7 +146,7 @@ AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myView#button"]; }]; ``` - + #### Java @@ -134,7 +158,19 @@ public static void updatePropositionsForSurfaces(@NonNull final List su * _surfaces_ is a list of surfaces for which propositions need updating. -**Syntax** +**Example** + +#### Kotlin + +```kotlin +val surface1 = Surface("myActivity#button") +val surface2 = Surface("myActivityAttributes") +val surfaces = listOf(surface1, surface2) + +Messaging.updatePropositionsForSurfaces(surfaces) +``` + +#### Java ```java final Surface surface1 = new Surface("myActivity#button"); @@ -159,7 +195,7 @@ static func updatePropositionsForSurfaces(_ surfaces: [Surface]) * _surfaces_ is an array of surfaces for which propositions need updating. -**Syntax** +**Example** ```swift let surface1 = Surface(path: "myView#button") @@ -178,7 +214,7 @@ Messaging.updatePropositionsForSurfaces([surface1, surface2]) * _surfaces_ is an array of surfaces for which propositions need updating. -**Syntax** +**Example** ```objc AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"]; diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/tabs/tutorial.md b/src/pages/edge/adobe-journey-optimizer/code-based/tabs/tutorial.md index 3e708f3940..b8e16714e9 100644 --- a/src/pages/edge/adobe-journey-optimizer/code-based/tabs/tutorial.md +++ b/src/pages/edge/adobe-journey-optimizer/code-based/tabs/tutorial.md @@ -1,4 +1,15 @@ - + + +#### Kotlin + +```kotlin +val surface1 = Surface("mainActivity#banner") +val surface2 = Surface("secondActivity#promotions") +val surfaces = listOf(surface1, surface2) + +// fetch propositions from server and cache in-memory +Messaging.updatePropositionsForSurfaces(surfaces) +``` #### Java @@ -26,7 +37,29 @@ let surface2 = Surface("secondActivity#promotions") Messaging.updatePropositionsForSurfaces([surface1, surface2]) ``` - + + +#### Kotlin + +```kotlin +val surface1 = Surface("mainActivity#banner") +val surface2 = Surface("secondActivity#promotions") +val surfaces = listOf(surface1, surface2) + +Messaging.getPropositionsForSurfaces(surfaces) { + it?.let { propositionsMap -> + if (propositionsMap.isNotEmpty()) { + // get the propositions for the given surfaces + propositionsMap[surface1]?.let { + // read surface1 propositions + } + propositionsMap[surface2]?.let { + // read surface2 propositions + } + } + } +} +``` #### Java @@ -91,7 +124,25 @@ Messaging.getPropositionsForSurfaces([surface1, surface2]) { propositionsDict, e } ``` - + + +#### Kotlin + +```kotlin +// get the propositions for surface1 +// bail early if no propositions are found for surface1 +if (propositionsForSurface1 == null || propositionsForSurface1.isEmpty()) return + +// iterate through items in proposition +for (propositionItem in propositionsForSurface1.first()::items) { + if (propositionItem.schema == SchemaType.HTML_CONTENT) { + // retrieve the HTML content + val htmlContent = propositionItem.htmlContent + + // use retrieved html content + } +} +``` #### Java @@ -132,7 +183,19 @@ if let codePropositions: [Proposition] = propositionsDict?[surface1], !codePropo } ``` - + + +#### Kotlin + +```kotlin +// Tracking display of PropositionItem +// use the same propositionItem object that was used to get the content in the previous section +propositionItem.track(MessagingEdgeEventType.DISPLAY) + +// Tracking interaction with PropositionItem +// use the same propositionItem object that was used to get the content in the previous section +propositionItem.track("click", MessagingEdgeEventType.INTERACT, null) +``` #### Java @@ -160,7 +223,18 @@ propositionItem.track(withEdgeEventType: MessagingEdgeEventType.display) propositionItem.track("click", withEdgeEventType: MessagingEdgeEventType.display) ``` - + + +#### Kotlin + +```kotlin +// Tracking interaction with PropositionItem with tokens +// Extract the tokens from the PropositionItem item data +val tokenList = mutableListOf() +tokenList += dataItemToken1 +tokenList += dataItemToken2 +propositionItem.track("click", MessagingEdgeEventType.INTERACT, tokenList) +``` #### Java diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/tutorial.md b/src/pages/edge/adobe-journey-optimizer/code-based/tutorial.md index 5705b1a450..9ac99cdcc4 100644 --- a/src/pages/edge/adobe-journey-optimizer/code-based/tutorial.md +++ b/src/pages/edge/adobe-journey-optimizer/code-based/tutorial.md @@ -16,7 +16,7 @@ This document describes how to fetch, display and track code-based experiences u ## Pre-requisites -[Integrate and register Messaging extension](../index.md#implement-extension-in-mobile-app) in your app. +[Integrate and register Messaging extension](../../index.md#implement-extension-in-mobile-app) in your app. ## Fetch and cache the code-based content diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/content-card-schema-data.md b/src/pages/edge/adobe-journey-optimizer/public-classes/content-card-schema-data.md new file mode 100644 index 0000000000..3f8e590161 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/content-card-schema-data.md @@ -0,0 +1,211 @@ +--- +title: ContentCardSchemaData +description: The `ContentCardSchemaData` class represents a "content-card" proposition received from the remote, upon a personalization query request to the Experience Edge network. +keywords: +- Adobe Journey Optimizer +- Messaging +- Proposition +- Interface +- Android +- iOS +- Code-based Experiences +- Content Cards +--- + +# ContentCardSchemaData + +Represents the proposition response object containing a `content-card` schema. + +## iOS Interface + +```swift +@objc(AEPContentCardSchemaData) +@objcMembers +public class ContentCardSchemaData: NSObject, Codable { + /// Represents the content of the ContentCardSchemaData object. Its value's type is determined by `contentType`. + public let content: Any + + /// Determines the value type of `content`. + public let contentType: ContentType + + /// Date and time this content card was published represented as epoch seconds + public let publishedDate: Int? + + /// Date and time this content card will expire represented as epoch seconds + public let expiryDate: Int? + + /// Dictionary containing any additional meta data for this content card + public let meta: [String: Any]? + + ... +} +``` + +### Public functions + +--- + +### getContentCard + +Tries to convert the `content` of this `ContentCardSchemaData` into a [`ContentCard`](./content-card.md) object. + +Returns `nil` if the `contentType` is not equal to `.applicationJson` or the data in `content` is not decodable into a `ContentCard`. + +#### Syntax + +```swift +func getContentCard() -> ContentCard? +``` + +#### Example + +```swift +var propositionItem: PropositionItem +if let contentCardSchemaData = propositionItem.contentCardSchemaData, + let contentCard = contentCardSchemaData.getContentCard() { + // do something with the ContentCard object +} +``` + +### track(_:withEdgeEventType:) + +Tracks an interaction with the given `ContentCardSchemaData`. + +#### Syntax + +```swift +public func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType) +``` + +#### Parameters + +* _interaction_ - a custom `String` value to be recorded in the interaction +* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event + +#### Example + +```swift +var contentCardSchemaData: ContentCardSchemaData + +// tracking a display +contentCardSchemaData.track(withEdgeEventType: .display) + +// tracking a user interaction +contentCardSchemaData.track("itemSelected", withEdgeEventType: .interact) +``` + +## Android Interface + +```java +public class ContentCardSchemaData implements SchemaData { + private Object content; + private ContentType contentType; + private int publishedDate; + private int expiryDate; + private Map meta; + + @Override + public Object getContent() { + return content; + } + + public ContentType getContentType() { + return contentType; + } + + public int getPublishedDate() { + return publishedDate; + } + + public int getExpiryDate() { + return expiryDate; + } + + @Nullable public Map getMeta() { + return meta; + } + + ... +} +``` + +### Public functions + +--- + +### getContentCard + +Tries to convert the `content` of this `ContentCardSchemaData` into a [`ContentCard`](./content-card.md) object. + +Returns `null` if the `contentType` is not equal to `ContentType.APPLICATION_JSON` or the data in `content` is not decodable into a `ContentCard`. + +#### Syntax + +```java +@Nullable public ContentCard getContentCard(); +``` + +#### Example + +#### Kotlin + +```kotlin +val propisitionItem: PropositionItem +val contentCardData = item?.contentCardSchemaData +val contentCard = contentCardData?.contentCard +contentCard?.let { + // do something with the ContentCard object +} +``` + +#### Java + +```java +PropositionItem propositionItem; +ContentCardSchemaData contentCardSchemaData = propositionItem.getContentCardSchemaData(); +ContentCard contentCard = contentCardSchemaData.getContentCard(); +if (contentCard != null) { + // do something with the ContentCard object +} +``` + +### track + +Tracks an interaction with the given `ContentCardSchemaData`. + +#### Syntax + +```java +public void track(final String interaction, final MessagingEdgeEventType eventType); +``` + +#### Parameters + +* _interaction_ - a custom `String` value to be recorded in the interaction +* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event + +#### Example + +#### Kotlin + +```kotlin +val contentCardSchemaData = item?.contentCardSchemaData + +// tracking a display +contentCardSchemaData?.track(null, MessagingEdgeEventType.DISPLAY) + +// tracking a user interaction +contentCardSchemaData?.track("itemSelected", MessagingEdgeEventType.INTERACT) +``` + +#### Java + +```java +ContentCardSchemaData contentCardSchemaData; + +// tracking a display +contentCardSchemaData.track(null, MessagingEdgeEventType.DISPLAY); + +// tracking a user interaction +contentCardSchemaData.track("itemSelected", MessagingEdgeEventType.INTERACT); +``` diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/content-card.md b/src/pages/edge/adobe-journey-optimizer/public-classes/content-card.md new file mode 100644 index 0000000000..9556d236dd --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/content-card.md @@ -0,0 +1,158 @@ +--- +title: ContentCard +description: An object representing the default content card created in the Adobe Journey Optimizer UI. +keywords: +- Adobe Journey Optimizer +- Messaging +- Proposition +- Interface +- Android +- iOS +- Code-based Experiences +- Content Cards +- Content Card +--- + +# ContentCard + +An object representing the default content card created in the Adobe Journey Optimizer UI. + +Content cards must be rendered by the app developer. Tracking a content card is done via calls to the [`track(_:withEdgeEventType:)`](#track_withedgeeventtype) API. + +## iOS Interface + +```swift +@objc(AEPContentCard) +@objcMembers +public class ContentCard: NSObject, Codable { + /// Plain-text title for the content card + public let title: String + + /// Plain-text body representing the content for the content card + public let body: String + + /// String representing a URI that contains an image to be used for this content card + public let imageUrl: String? + + /// Contains a URL to be opened if the user interacts with the content card + public let actionUrl: String? + + /// Required if `actionUrl` is provided. Text to be used in title of button or link in content card + public let actionTitle: String? + + ... +} +``` + +### Public functions + +--- + +### track(_:withEdgeEventType:) + +Tracks an interaction with the given `ContentCard`. + +#### Syntax + +```swift +public func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType) +``` + +#### Parameters + +* _interaction_ - a custom `String` value to be recorded in the interaction +* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event + +#### Example + +```swift +var contentCard: ContentCard + +// tracking a display +contentCard.track(withEdgeEventType: .display) + +// tracking a user interaction +contentCard.track("itemSelected", withEdgeEventType: .interact) +``` + +## Android Interface + +```java +public class ContentCard { + // Plain-text title for the content card + private String title; + + // Plain-text body representing the content for the content card + private String body; + + // String representing a URI that contains an image to be used for this content card + private String imageUrl; + + // Contains a URL to be opened if the user interacts with the content card + private String actionUrl; + + // Required if actionUrl is provided. Text to be used in title of button or link in content card + private String actionTitle; + + public String getTitle() { return title; } + + public String getBody() { return body; } + + @Nullable public String getImageUrl() { return imageUrl; } + + @Nullable public String getActionUrl() { return actionUrl; } + + @Nullable public String getActionTitle() { return actionTitle; } + + ... +} +``` + +### Public functions + +--- + +### track + +Tracks an interaction with the given `ContentCard`. + +#### Syntax + +```java +public void track(final String interaction, final MessagingEdgeEventType eventType); +``` + +#### Parameters + +* _interaction_ - a custom `String` value to be recorded in the interaction +* _eventType_ - the [`MessagingEdgeEventType`](./messaging-edge-event-type.md) to be used for the ensuing Edge Event + +#### Example + +#### Kotlin + +```kotlin +// Get content card schema data from a PropositionItem object +val contentCardData = item?.contentCardSchemaData +val contentCard = contentCardData?.contentCard + +// tracking a display +contentCard?.track(null, MessagingEdgeEventType.DISPLAY) + +// tracking a user interaction +contentCard?.track("itemSelected", MessagingEdgeEventType.INTERACT) +``` + +#### Java + +```java +// Get content card schema data from a PropositionItem object +ContentCardSchemaData contentCardData = item.getContentCardSchemaData(); +ContentCard contentCard = contentCardData.getContentCard(); + +// tracking a display +contentCard.track(null, MessagingEdgeEventType.DISPLAY); + +// tracking a user interaction +contentCard.track("itemSelected", MessagingEdgeEventType.INTERACT); +``` diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/content-type.md b/src/pages/edge/adobe-journey-optimizer/public-classes/content-type.md new file mode 100644 index 0000000000..8f46201274 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/content-type.md @@ -0,0 +1,45 @@ +--- +title: ContentType +description: Enum representing the ContentTypes used in schema-based objects. +keywords: +- Adobe Journey Optimizer +- Messaging +- iOS +- Android +- Proposition +- Schema +- ContentType +- Content type +--- + +import Tabs from './tabs/content-type.md' + +# Enum - ContentType + +Enum representing content types found within a schema object. + +## Definition + + + +Android + + + +iOS + + + +## String values + +Below is the table of values returned by calling the `toString` method for each case: + + + +Android + + + +iOS + + diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/html-content-schema-data.md b/src/pages/edge/adobe-journey-optimizer/public-classes/html-content-schema-data.md new file mode 100644 index 0000000000..7c4ec29e6a --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/html-content-schema-data.md @@ -0,0 +1,47 @@ +--- +title: HtmlContentSchemaData +description: The `HtmlContentSchemaData` class represents a "html-content" proposition received from the remote, upon a personalization query request to the Experience Edge network. +keywords: +- Adobe Journey Optimizer +- Messaging +- Proposition +- Interface +- Android +- iOS +- Code-based Experiences +- Content Cards +--- + +# HtmlContentSchemaData + +Represents the proposition response object containing a `html-content` schema. + +## iOS Interface + +```swift +@objc(AEPHtmlContentSchemaData) +@objcMembers +public class HtmlContentSchemaData: NSObject, Codable { + /// Represents the content of the HtmlContentSchemaData object. + public let content: String + + /// Determines the value type of `content`. For HtmlContentSchemaData objects, this value is always `.textHtml`. + public let format: ContentType? + + ... +} +``` + +## Android Interface + +```java +public class HtmlContentSchemaData implements SchemaData { + private String content = null; + private ContentType format = null; + + @Override + @Nullable public String getContent() { return content; } + + public ContentType getFormat() { return format; } +} +``` diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/inapp-schema-data.md b/src/pages/edge/adobe-journey-optimizer/public-classes/inapp-schema-data.md new file mode 100644 index 0000000000..a88aa7628e --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/inapp-schema-data.md @@ -0,0 +1,83 @@ +--- +title: InAppSchemaData +description: The `InAppSchemaData` class represents a "in-app" proposition received from the remote, upon a personalization query request to the Experience Edge network. +keywords: +- Adobe Journey Optimizer +- Messaging +- Proposition +- Interface +- Android +- iOS +- Code-based Experiences +- Content Cards +--- + +# InAppSchemaData + +Represents the proposition response object containing a `in-app` schema. + +## iOS Interface + +```swift +@objc(AEPInAppSchemaData) +@objcMembers +public class InAppSchemaData: NSObject, Codable { + /// Represents the content of the InAppSchemaData object. Its value's type is determined by `contentType`. + public let content: Any + + /// Determines the value type of `content`. + public let contentType: ContentType + + /// Date and time this in-app campaign was published represented as epoch seconds + public let publishedDate: Int? + + /// Date and time this in-app campaign will expire represented as epoch seconds + public let expiryDate: Int? + + /// Dictionary containing any additional meta data for this content card + public let meta: [String: Any]? + + /// Dictionary containing parameters that help control display and behavior of the in-app message on mobile + public let mobileParameters: [String: Any]? + + /// Dictionary containing parameters that help control display and behavior of the in-app message on web + public let webParameters: [String: Any]? + + /// Array of remote assets to be downloaded and cached for future use with the in-app message + public let remoteAssets: [String]? + + ... +} +``` + +## Android Interface + +```java +public class InAppSchemaData implements SchemaData { + private Object content = null; + private ContentType contentType = null; + private int publishedDate = 0; + private int expiryDate = 0; + private Map meta = null; + private Map mobileParameters = null; + private Map webParameters = null; + private List remoteAssets = null; + + @Override + public Object getContent() { return content; } + + public ContentType getContentType() { return contentType; } + + public int getPublishedDate() { return publishedDate; } + + public int getExpiryDate() { return expiryDate; } + + @Nullable public Map getMeta() { return meta; } + + @Nullable public Map getMobileParameters() { return mobileParameters; } + + @Nullable public Map getWebParameters() { return webParameters; } + + @Nullable public List getRemoteAssets() { return remoteAssets; } +} +``` diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/index.md b/src/pages/edge/adobe-journey-optimizer/public-classes/index.md index 82d4797ec0..105e44bc38 100644 --- a/src/pages/edge/adobe-journey-optimizer/public-classes/index.md +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/index.md @@ -25,9 +25,15 @@ This documents lists details about the public classes and enums available in Mes * [Class - Message](./message.md) * [Enum - MessagingEdgeEventType](./messaging-edge-event-type.md) -## Code-based experiences +## Proposition-based messaging
\(Code-based experiences & Content Cards) +* [Class - ContentCard](./content-card.md) * [Class - Proposition](./proposition.md) * [Class - PropositionItem](./proposition-item.md) * [Class - Surface](./surface.md) +* [Enum - ContentType](./content-type.md) * [Enum - MessagingEdgeEventType](./messaging-edge-event-type.md) +* [Schema Class - ContentCardSchemaData](./content-card-schema-data.md) +* [Schema Class - HtmlContentSchemaData](./html-content-schema-data.md) +* [Schema Class - InAppSchemaData](./inapp-schema-data.md) +* [Schema Class - JsonContentSchemaData](./json-content-schema-data.md) diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/json-content-schema-data.md b/src/pages/edge/adobe-journey-optimizer/public-classes/json-content-schema-data.md new file mode 100644 index 0000000000..8b6b5e587d --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/json-content-schema-data.md @@ -0,0 +1,45 @@ +--- +title: JsonContentSchemaData +description: The `JsonContentSchemaData` class represents a "json-content" proposition received from the remote, upon a personalization query request to the Experience Edge network. +keywords: +- Adobe Journey Optimizer +- Messaging +- Proposition +- Interface +- Android +- iOS +- Code-based Experiences +- Content Cards +--- + +# JsonContentSchemaData + +Represents the proposition response object containing a `json-content` schema. + +## iOS Interface + +```swift +@objc(AEPJsonContentSchemaData) +@objcMembers +public class JsonContentSchemaData: NSObject, Codable { + /// Represents the content of the JsonContentSchemaData object. Its value's type is determined by `format`. + public let content: Any + + /// Determines the value type of `content`. + public let format: ContentType? + + ... +} +``` + +## Android Interface + +```java +public class JsonContentSchemaData implements SchemaData { + private Object content = null; + private ContentType format = null; + + @Override + @Nullable public Object getContent() { return content; } +} +``` diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/proposition-item.md b/src/pages/edge/adobe-journey-optimizer/public-classes/proposition-item.md index f3fbeb1ff0..44df2f95fd 100644 --- a/src/pages/edge/adobe-journey-optimizer/public-classes/proposition-item.md +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/proposition-item.md @@ -16,16 +16,36 @@ import Tabs from './tabs/proposition-item.md' The `PropositionItem` class represents the decision proposition item received from the remote, upon a personalization query to the Experience Edge network. -## iOS Interface - PropositionItem +## iOS Interface ## Public variables -### itemId +### contentCardSchemaData -Unique proposition item identifier. +Decodes and returns item data content as an [ContentCardSchemaData](./content-card-schema-data.md) object. + +Returns `nil` if decoding fails or if the proposition item schema is not `.contentCard`. ```swift -public let itemId: String +var contentCardSchemaData: ContentCardSchemaData? +``` + +### htmlContent + +Returns item data content as a string if the proposition item schema is `htmlContent`, otherwise returns `nil`. + +```swift +var htmlContent: String? +``` + +### inappSchemaData + +Decodes and returns item data content as an [InAppSchemaData](./inapp-schema-data.md) object. + +Returns `nil` if decoding fails or if the proposition item schema is not `.inApp`. + +```swift +var inappSchemaData: InAppSchemaData? ``` ### itemData @@ -36,20 +56,20 @@ Proposition item data as dictionary. public let itemData: [String: Any] ``` -### schema +### itemId -Proposition item schema string. +Unique proposition item identifier. ```swift -public let schema: String +public let itemId: String ``` -### htmlContent +### jsonContentArray -Returns item data content as a string if the proposition item schema is `htmlContent`, otherwise returns `nil`. +Returns item data content as an array if it can be parsed as an array and if the proposition item schema is `jsonContent`, otherwise returns `nil`. ```swift -var htmlContent: String? +var jsonContentArray: [Any]? ``` ### jsonContentDictionary @@ -60,12 +80,12 @@ Returns item data content as a dictionary if it can be parsed as a dictionary an var jsonContentDictionary: [String: Any]? ``` -### jsonContentArray +### schema -Returns item data content as an array if it can be parsed as an array and if the proposition item schema is `jsonContent`, otherwise returns `nil`. +Proposition item schema string. ```swift -var jsonContentArray: [Any]? +public let schema: String ``` ## Public functions @@ -90,39 +110,39 @@ iOS -## Android Interface - PropositionItem +## Android Interface ## Public functions -### getItemId +### generateInteractionXdm -Returns this proposition item's unique identifier as a string. +Returns a Map containing XDM data for interaction with the given proposition item, for the provided event type. Android - + -### getItemData +### generateInteractionXdm -Returns this proposition's unique identifier as a string. +Returns a Map containing XDM data for interaction with the given proposition item, for the provided event type and decision item tokens. Android - + -### getSchema +### getContentCardSchemaData -Returns this proposition item's content schema as a string. +Decodes and returns this proposition item's content schema as a [ContentCardSchemaData](./content-card-schema-data.md), or `null` if decoding fails. Android - + ### getHtmlContent @@ -134,15 +154,35 @@ Android -### getJsonContentMap +### getInAppSchemaData -Returns item data content as a Map if it can be parsed as a Map and if the proposition item schema is `JSON_CONTENT`, otherwise returns null. +Decodes and returns this proposition item's content schema as a [InAppSchemaData](./inapp-schema-data.md), or `null` if decoding fails. Android - + + +### getItemData + +Returns this proposition's unique identifier as a string. + + + +Android + + + +### getItemId + +Returns this proposition item's unique identifier as a string. + + + +Android + + ### getJsonContentArrayList @@ -154,25 +194,25 @@ Android -### generateInteractionXdm +### getJsonContentMap -Returns a Map containing XDM data for interaction with the given proposition item, for the provided event type. +Returns item data content as a Map if it can be parsed as a Map and if the proposition item schema is `JSON_CONTENT`, otherwise returns null. Android - + -### generateInteractionXdm +### getSchema -Returns a Map containing XDM data for interaction with the given proposition item, for the provided event type and decision item tokens. +Returns this proposition item's content schema as a string. Android - + ### track diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/content-type.md b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/content-type.md new file mode 100644 index 0000000000..b4d0ce09f5 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/content-type.md @@ -0,0 +1,57 @@ +--- +noIndex: true +--- + + + +#### Java + +```java +public enum ContentType { + APPLICATION_JSON(0), + TEXT_HTML(1), + TEXT_XML(2), + TEXT_PLAIN(3), + UNKNOWN(4); + + @Override + public String toString(); +} +``` + + + +#### Swift + +```swift +@objc(AEPContentType) +public enum ContentType: Int, Codable { + case applicationJson = 0 + case textHtml = 1 + case textXml = 2 + case textPlain = 3 + case unknown = 4 + + public func toString() -> String +} +``` + + + +| Case | String value | +| ---- | ------------ | +| `APPLICATION_JSON` | `application/json` | +| `TEXT_HTML` | `text/html` | +| `TEXT_XML` | `text/xml` | +| `TEXT_PLAIN` | `text/plain` | +| `UNKNOWN` | (empty string) | + + + +| Case | String value | +| ---- | ------------ | +| `.applicationJson` | `application/json` | +| `.testHtml` | `text/html` | +| `.textXml` | `text/xml` | +| `.textPlain` | `text/plain` | +| `.unknown` | (empty string) | diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition-item.md b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition-item.md index 0db0b2b124..5d43dea8ce 100644 --- a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition-item.md +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition-item.md @@ -30,6 +30,26 @@ func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingE * _eventType_ is an enum specifying event type for the interaction. * _tokens_ is an array containing the decision item tokens for recording interaction. + + +#### Java + +**Syntax** + +```java +public ContentCardSchemaData getContentCardSchemaData() +``` + + + +#### Java + +**Syntax** + +```java +public InAppSchemaData getInAppSchemaData() +``` + #### Java diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/surface.md b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/surface.md index 883db6dc32..2afd760a06 100644 --- a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/surface.md +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/surface.md @@ -21,7 +21,7 @@ public init(path: String) let surface = Surface(path: "homeView#banner") ``` - + #### Java @@ -35,12 +35,21 @@ public Surface(final String path) **Example** +#### Kotlin + +```kotlin +// Creates a surface instance representing a banner view within homeActivity in my mobile application. +val surface = Surface("homeActivity#banner") +``` + +#### Java + ```java // Creates a surface instance representing a banner view within homeActivity in my mobile application. final Surface surface = new Surface("homeActivity#banner") ``` - + #### Java @@ -52,12 +61,21 @@ public Surface() **Example** +#### Kotlin + +```kotlin +// Creates a new base surface by appending application package name to the mobile app surface prefix mobileapp:// +val surface = Surface() +``` + +#### Java + ```java // Creates a new base surface by appending application package name to the mobile app surface prefix mobileapp:// final Surface surface = new Surface() ``` - + #### Java @@ -69,6 +87,15 @@ public String getUri() **Example** +#### Kotlin + +```kotlin +val surface = Surface("homeActivity#banner") +val uri = surface.uri +``` + +#### Java + ```java final Surface surface = new Surface("homeActivity#banner") final String uri = surface.getUri() diff --git a/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md index ef1717791d..272e0e4fd0 100644 --- a/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md @@ -2,7 +2,7 @@ noIndex: true --- - + #### Java @@ -14,6 +14,14 @@ public static String extensionVersion(); **Example** +#### Kotlin + +```kotlin +Messaging.extensionVersion() +``` + +#### Java + ```java Messaging.extensionVersion(); ``` @@ -94,7 +102,7 @@ static func handleNotificationResponse(_ response: UNNotificationResponse, | `urlHandler` | `((URL) -> Bool)?` | An optional method to handle the actionable URL from the push notification. | | `closure` | `((PushTrackingStatus) -> Void)?` | An optional callback with `PushTrackingStatus` representing the tracking status of the interacted notification. | - + #### Java @@ -106,6 +114,14 @@ public static void registerExtension(); **Example** +#### Kotlin + +```kotlin +Messaging.registerExtension() +``` + +#### Java + ```java Messaging.registerExtension(); ```