diff --git a/gatsby-config.js b/gatsby-config.js index 67e4bda491..2deebd9f99 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -239,6 +239,16 @@ module.exports = { } ] }, + { + title: "Code-based Experiences", + path: "/edge/adobe-journey-optimizer/code-based", + pages: [ + { + title: "API reference", + path: "/edge/adobe-journey-optimizer/code-based/api-reference" + } + ] + }, { title: "Public classes and enums", path: "/edge/adobe-journey-optimizer/public-classes", @@ -258,6 +268,18 @@ module.exports = { { title: "MessagingEdgeEventType", path: "/edge/adobe-journey-optimizer/public-classes/messaging-edge-event-type" + }, + { + title: "Proposition", + path: "/edge/adobe-journey-optimizer/public-classes/proposition" + }, + { + title: "PropositionItem", + path: "/edge/adobe-journey-optimizer/public-classes/proposition-item" + }, + { + title: "Surface", + path: "/edge/adobe-journey-optimizer/public-classes/surface" } ] }, diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md index 5d211563c1..b5576994a4 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/api-reference.md @@ -103,10 +103,10 @@ iOS ## Public classes -| Type | Android | (AEP 3.x) Swift | (AEP 3.x) Objective-C | +| Type | Android | (AEP 5.x) Swift | (AEP 5.x) Objective-C | | :--- | :--- | :--- | :--- | | class | `DecisionScope` | `DecisionScope` | `AEPDecisionScope` | -| class | `Proposition` | `Proposition` | `AEPProposition` | +| class | `Proposition` | `OptimizeProposition` | `AEPOptimizeProposition` | | class | `Offer` | `Offer` | `AEPOffer` | ### DecisionScope @@ -123,7 +123,7 @@ iOS -### Proposition +### Proposition/OptimizeProposition This class represents the decision propositions received from the decisioning services, upon a personalization query request to the Experience Edge network. diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/index.md b/src/pages/edge/adobe-journey-optimizer-decisioning/index.md index 46479e4bd4..be6a2f4aae 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/index.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/index.md @@ -271,7 +271,7 @@ iOS ### Proposition tracking using Edge extension API -For more advanced tracking use cases, additional public methods are available in the `Offer` and `Proposition` classes. These methods can be used to generate XDM formatted data for `Experience Event - Proposition Interactions` and `Experience Event - Proposition Reference` field groups. +For more advanced tracking use cases, additional public methods are available in the `Offer` and `Proposition`/`OptimizeProposition` classes. These methods can be used to generate XDM formatted data for `Experience Event - Proposition Interactions` and `Experience Event - Proposition Reference` field groups. diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md index d0516f5f00..3328b38262 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/api-reference.md @@ -148,11 +148,11 @@ Optimize.getPropositions(scopes, new AdobeCallbackWithError Void) + _ completion: @escaping ([DecisionScope: OptimizeProposition]?, Error?) -> Void) ``` * _decisionScopes_ is an array of decision scopes for which propositions are requested. -* _completion_ is invoked with propositions dictionary of type `[DecisionScope: Proposition]`. An `Error` is returned if SDK fails to retrieve the propositions. +* _completion_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`. An `Error` is returned if SDK fails to retrieve the propositions. #### Example @@ -189,11 +189,11 @@ Optimize.getPropositions(for: [decisionScope1, decisionScope2]) { propositionsDi ```objc + (void) getPropositions: (NSArray* _Nonnull) decisionScopes - completion: (void (^ _Nonnull)(NSDictionary* _Nullable propositionsDict, NSError* _Nullable error)) completion; + completion: (void (^ _Nonnull)(NSDictionary* _Nullable propositionsDict, NSError* _Nullable error)) completion; ``` * _decisionScopes_ is an array of decision scopes 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. +* _completion_ is invoked with propositions dictionary of type `NSDictionary`. An `NSError` is returned if SDK fails to retrieve the propositions. #### Example @@ -204,16 +204,16 @@ AEPDecisionScope* decisionScope1 = [[AEPDecisionScope alloc] initWithActivityId: AEPDecisionScope* decisionScope2 = [[AEPDecisionScope alloc] initWithName: @"myScope"]; [AEPMobileOptimize getPropositions: @[decisionScope1, decisionScope2] - completion: ^(NSDictionary* propositionsDict, NSError* error) { + completion: ^(NSDictionary* propositionsDict, NSError* error) { if (error != nil) { // handle error return; } - AEPProposition* proposition1 = propositionsDict[decisionScope1]; + AEPOptimizeProposition* proposition1 = propositionsDict[decisionScope1]; // read proposition1 offers - AEPProposition* proposition2 = propositionsDict[decisionScope2]; + AEPOptimizeProposition* proposition2 = propositionsDict[decisionScope2]; // read proposition2 offers }]; ``` @@ -255,10 +255,10 @@ Optimize.onPropositionsUpdate(new AdobeCallbackWithError Void) +static func onPropositionsUpdate(perform action: @escaping ([DecisionScope: OptimizeProposition]?) -> Void) ``` -* _action_ is invoked with propositions dictionary of type `[DecisionScope: Proposition]`. +* _action_ is invoked with propositions dictionary of type `[DecisionScope: OptimizeProposition]`. #### Example @@ -275,15 +275,15 @@ Optimize.onPropositionsUpdate { propositionsDict in #### Syntax ```objc -+ (void) onPropositionsUpdate: (void (^ _Nonnull)(NSDictionary* _Nullable)) action; ++ (void) onPropositionsUpdate: (void (^ _Nonnull)(NSDictionary* _Nullable)) action; ``` -* _action_ is invoked with propositions dictionary of type `NSDictionary`. +* _action_ is invoked with propositions dictionary of type `NSDictionary`. #### Example ```objc -[AEPMobileOptimize onPropositionsUpdate: ^(NSDictionary* propositionsDict) { +[AEPMobileOptimize onPropositionsUpdate: ^(NSDictionary* propositionsDict) { // handle propositions }]; ``` @@ -538,9 +538,9 @@ public class Proposition { #### Swift ```swift -/// `Proposition` class -@objc(AEPProposition) -public class Proposition: NSObject, Codable { +/// `OptimizeProposition` class +@objc(AEPOptimizeProposition) +public class OptimizeProposition: NSObject, Codable { /// Unique proposition identifier @objc public let id: String @@ -556,18 +556,18 @@ public class Proposition: NSObject, Codable { } ``` -The `Proposition` class extension provides a method for generating XDM data for Proposition Reference field group which can be used for proposition tracking. +The `OptimizeProposition` class extension provides a method for generating XDM data for Proposition Reference field group which can be used for proposition tracking. ```swift -/// `Proposition` extension +/// `OptimizeProposition` extension @objc -public extension Proposition { +public extension OptimizeProposition { /// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Reference` field group from the given proposition. /// /// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier. /// /// - Note: The returned XDM data does not contain an `eventType` for the Experience Event. - /// - Returns A dictionary containing XDM data for the propositon reference. + /// - Returns A dictionary containing XDM data for the proposition reference. func generateReferenceXdm() -> [String: Any] {...} } ``` @@ -816,7 +816,7 @@ public extension Offer { /// If the proposition reference within the option is released and no longer valid, the method returns `nil`. /// /// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionDisplay`. - /// - Returns A dictionary containing XDM data for the propositon interactions. + /// - Returns A dictionary containing XDM data for the proposition interactions. func generateDisplayInteractionXdm() -> [String: Any]? {...} /// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option. @@ -825,7 +825,7 @@ public extension Offer { /// If the proposition reference within the option is released and no longer valid, the method returns `nil`. /// /// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionInteract`. - /// - Returns A dictionary containing XDM data for the propositon interactions. + /// - Returns A dictionary containing XDM data for the proposition interactions. func generateTapInteractionXdm() -> [String: Any]? {...} /// Dispatches an event for the Edge extension to send an Experience Event to the Edge network with the display interaction data for the given proposition item. diff --git a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/index.md b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/index.md index eb33c4c48c..37d0ba45c8 100644 --- a/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/index.md +++ b/src/pages/edge/adobe-journey-optimizer-decisioning/tabs/index.md @@ -457,7 +457,7 @@ public extension Offer { /// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier. /// /// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionDisplay`. - /// - Returns A dictionary containing XDM data for the propositon interactions. + /// - Returns A dictionary containing XDM data for the proposition interactions. func generateDisplayInteractionXdm() -> [String: Any] {...} /// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Interactions` field group from the given proposition option. @@ -465,19 +465,19 @@ public extension Offer { /// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier. /// /// - Note: The returned XDM data also contains the `eventType` for the Experience Event with value `decisioning.propositionInteract`. - /// - Returns A dictionary containing XDM data for the propositon interactions. + /// - Returns A dictionary containing XDM data for the proposition interactions. func generateTapInteractionXdm() -> [String: Any] {...} } ``` ```swift -public extension Proposition { +public extension OptimizeProposition { /// Creates a dictionary containing XDM formatted data for `Experience Event - Proposition Reference` field group from the given proposition. /// /// The Edge `sendEvent(experienceEvent:_:)` API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, or override dataset identifier. /// /// - Note: The returned XDM data does not contain an `eventType` for the Experience Event. - /// - Returns A dictionary containing XDM data for the propositon reference. + /// - Returns A dictionary containing XDM data for the proposition reference. func generateReferenceXdm() -> [String: Any] {...} } ``` diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/api-reference.md b/src/pages/edge/adobe-journey-optimizer/code-based/api-reference.md new file mode 100644 index 0000000000..a67ad2a49a --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/code-based/api-reference.md @@ -0,0 +1,47 @@ +--- +title: Code-based Experiences - API Reference +description: This document lists the public APIs available in the Messaging extension for implementing code-based experiences. +keywords: +- Adobe Journey Optimizer +- API reference +- Messaging +- Code-based Experiences +--- + +import Tabs from './tabs/api-reference.md' + +# Code-based Experiences - API reference + +This document lists the public APIs available in the Messaging extension for implementing code-based experiences. + +## getPropositionsForSurfaces + +The `getPropositionsForSurfaces` API retrieves the previously fetched propositions from the SDK's in-memory propositions cache for the provided surfaces. The completion handler is invoked with the decision propositions corresponding to the given surfaces or `AEPError`, if it occurs. + +If a requested surface was not previously cached prior to calling `getPropositionsForSurfaces` (using the `updatePropositionsForSurfaces` API), no propositions will be returned for that surface. + + + +Android + + + +iOS + + + +## updatePropositionsForSurfaces + +The `updatePropositionsForSurfaces` API dispatches an event for the Edge network extension to fetch personalization decisions from the AJO campaigns for the provided surfaces array. The returned decision propositions are cached in-memory by the Messaging extension. + +To retrieve previously cached decision propositions, use `getPropositionsForSurfaces` API. + + + +Android + + + +iOS + + diff --git a/src/pages/edge/adobe-journey-optimizer/code-based/index.md b/src/pages/edge/adobe-journey-optimizer/code-based/index.md new file mode 100644 index 0000000000..d59cc56296 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/code-based/index.md @@ -0,0 +1,23 @@ +--- +title: Code-based Experiences +description: This document guides you to integrating code-based experiences in your application. +keywords: +- Adobe Journey Optimizer +- Guide +- Code-based experiences +--- + +# Code-based Experiences + +This document guides you to integrating code-based experiences in your application. + +## API reference + +* [Code-based Experiences APIs](./api-reference.md) + +## 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) 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 new file mode 100644 index 0000000000..0f9fd8b36a --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/code-based/tabs/api-reference.md @@ -0,0 +1,200 @@ +--- +noIndex: true +--- + + + +### Coming soon + + + + + +#### Swift + +**Syntax** + +```swift +static func getPropositionsForSurfaces(_ surfacePaths: [Surface], _ completion: @escaping ([Surface: [Proposition]]?, Error?) -> Void) +``` + +* _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** + +```swift +let surface1 = Surface(path: "myView#button") +let surface2 = Surface(path: "myViewAttributes") + +Messaging.getPropositionsForSurfaces([surface1, surface2]) { propositionsDict, error in + guard error == nil else { + // handle error + return + } + + guard let propositionsDict = propositionsDict else { + // bail early if no propositions + return + } + + // get the propositions for the given surfaces + if let propositions1 = propositionsDict[surface1] { + // read surface1 propositions + } + + if let propositions2 = propositionsDict[surface2] { + // read surface2 propositions + } +} +``` + +#### Objective-C + +**Syntax** + +```objc ++ (void) getPropositionsForSurfaces: (NSArray* _Nonnull) surfaces + completion: (void (^ _Nonnull)(NSDictionary*>* _Nullable propositionsDict, NSError* _Nullable error)) completion; +``` + +* _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** + +```objc +AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"]; +AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myView#button"]; + +[AEPMobileMessaging getPropositionsForSurfaces: @[surface1, surface2] + completion: ^(NSDictionary*>* propositionsDict, NSError* error) { + if (error != nil) { + // handle error + return; + } + + NSArray* proposition1 = propositionsDict[surface1]; + // read surface1 propositions + + NSArray* proposition2 = propositionsDict[surface2]; + // read surface2 propositions +}]; +``` + + + +### Coming soon + + + + + +#### Swift + +**Syntax** + +```swift +static func updatePropositionsForSurfaces(_ surfaces: [Surface]) +``` + +* _surfaces_ is an array of surfaces for which propositions need updating. + +**Syntax** + +```swift +let surface1 = Surface(path: "myView#button") +let surface2 = Surface(path: "myViewAttributes") + +Messaging.updatePropositionsForSurfaces([surface1, surface2]) +``` + +#### Objective-C + +**Syntax** + +```objc ++ (void) updatePropositionsForSurfaces: (NSArray* _Nonnull) surfaces; +``` + +* _surfaces_ is an array of surfaces for which propositions need updating. + +**Syntax** + +```objc +AEPSurface* surface1 = [[AEPSurface alloc] initWithPath: @"myView#button"]; +AEPSurface* surface2 = [[AEPSurface alloc] initWithPath: @"myView#button"]; + +[AEPMobileMessaging updatePropositionsForSurfaces: @[surface1, surface2]]; +``` diff --git a/src/pages/edge/adobe-journey-optimizer/index.md b/src/pages/edge/adobe-journey-optimizer/index.md index 1a713561d4..800eb4452c 100644 --- a/src/pages/edge/adobe-journey-optimizer/index.md +++ b/src/pages/edge/adobe-journey-optimizer/index.md @@ -100,3 +100,4 @@ You can update the SDK configuration, including the Messaging configuration valu * [Push notification implementation guide](./push-notification/index.md) * [In-App message implementation guide](./in-app-message/index.md) +* [Code-based experiences implementation guide](./code-based/index.md) 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 new file mode 100644 index 0000000000..6905f290df --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/proposition-item.md @@ -0,0 +1,201 @@ +--- +title: PropositionItem +description: The `PropositionItem` class represents the decision proposition item received from the remote, upon a personalization query to the Experience Edge network. +keywords: +- Adobe Journey Optimizer +- Messaging +- PropositionItem +- Interface +- Android +- iOS +- Code-based Experiences +--- +import Tabs from './tabs/proposition-item.md' + +# PropositionItem + +The `PropositionItem` class represents the decision proposition item received from the remote, upon a personalization query to the Experience Edge network. + +## iOS Interface - PropositionItem + +## Public variables + +### itemId + +Unique proposition item identifier. + +```swift +public let itemId: String +``` + +### itemData + +Proposition item data as dictionary. + +```swift +public let itemData: [String: Any] +``` + +### schema + +Proposition item schema string. + +```swift +public let schema: String +``` + +### htmlContent + +Returns item data content as a string if the proposition item schema is `htmlContent`, otherwise returns `nil`. + +```swift +var htmlContent: String? +``` + +### jsonContentDictionary + +Returns item data content as a dictionary if it can be parsed as a dictionary and if the proposition item schema is `jsonContent`, otherwise returns `nil`. + +```swift +var jsonContentDictionary: [String: Any]? +``` + +### jsonContentArray + +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 jsonContentArray: [Any]? +``` + +## Public functions + +### generateInteractionXdm + +Returns a dictionary containing XDM data for interaction with the given proposition item, for the provided event type. + + + +iOS + + + +### track + +Tracks interaction with the given proposition item. + + + +iOS + + + +## Android Interface - PropositionItem + +### Coming soon + + diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/proposition.md b/src/pages/edge/adobe-journey-optimizer/public-classes/proposition.md new file mode 100644 index 0000000000..66ce4a477c --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/proposition.md @@ -0,0 +1,85 @@ +--- +title: Proposition +description: The `Proposition` class represents the decision propositions 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 +--- +import Tabs from './tabs/proposition.md' + +# Proposition + +The `Proposition` class represents the decision propositions received from the remote, upon a personalization query request to the Experience Edge network. + +## iOS Interface - Proposition + +## Public variables + +### uniqueId + +Unique proposition identifier. + +```swift +public let uniqueId: String +``` + +### scope + +Scope string. + +```swift +public let scope: String +``` + +### items + +An array containing proposition decision items. + +```swift +public lazy var items: [PropositionItem] +``` + +## Android Interface - Proposition + +### Coming soon + + diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/surface.md b/src/pages/edge/adobe-journey-optimizer/public-classes/surface.md new file mode 100644 index 0000000000..ea1d93358a --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/surface.md @@ -0,0 +1,83 @@ +--- +title: Surface +description: The `Surface` class contains the definition of an in-app message and controls its tracking via Experience Edge events. +keywords: +- Adobe Journey Optimizer +- Messaging +- Surface +- Interface +- Android +- iOS +- Code-based Experiences +--- +import Tabs from './tabs/surface.md' + +# Surface + +The `Surface` class represents an entity for user or system interaction. It is identified by a self-describing URI which is used to fetch the decision propositions from the AJO campaigns. For example, all mobile application surface URIs start with `mobileapp://`, followed by app bundle identifier and an optional path. + +## iOS Interface - Surface + +`Surface` class is used to create surface instances for requesting propositions in personalization query requests. + +## Public variables + +### uri + +Unique surface URI string. + +```swift +public let uri: String +``` + +## Public functions + +### init + +Creates a new surface by appending the given surface `path` to the mobile app surface prefix. + + + +iOS + + + +## Android Interface - Surface + +### Coming soon + + \ No newline at end of file diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/messaging-edge-event-type.md b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/messaging-edge-event-type.md index a867202e1f..e9747dbd80 100644 --- a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/messaging-edge-event-type.md +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/messaging-edge-event-type.md @@ -52,23 +52,23 @@ public enum MessagingEdgeEventType { ```swift @objc(AEPMessagingEdgeEventType) -public enum MessagingEdgeEventType: Int { - case inappDismiss = 0 - case inappInteract = 1 - case inappTrigger = 2 - case inappDisplay = 3 +public enum MessagingEdgeEventType: Int { case pushApplicationOpened = 4 case pushCustomAction = 5 + case dismiss = 6 + case interact = 7 + case trigger = 8 + case display = 9 public func toString() -> String { switch self { - case .inappDismiss: + case .dismiss: return MessagingConstants.XDM.IAM.EventType.DISMISS - case .inappTrigger: + case .trigger: return MessagingConstants.XDM.IAM.EventType.TRIGGER - case .inappInteract: + case .interact: return MessagingConstants.XDM.IAM.EventType.INTERACT - case .inappDisplay: + case .display: return MessagingConstants.XDM.IAM.EventType.DISPLAY case .pushCustomAction: return MessagingConstants.XDM.Push.EventType.CUSTOM_ACTION @@ -94,9 +94,9 @@ public enum MessagingEdgeEventType: Int { | Case | String value | | ---- | ------------ | -| inappDismiss | `decisioning.propositionDismiss` | -| inappInteract | `decisioning.propositionInteract` | -| inappTrigger | `decisioning.propositionTrigger` | -| inappDisplay | `decisioning.propositionDisplay` | +| dismiss | `decisioning.propositionDismiss` | +| interact | `decisioning.propositionInteract` | +| trigger | `decisioning.propositionTrigger` | +| display | `decisioning.propositionDisplay` | | pushApplicationOpened | `pushTracking.applicationOpened` | | pushCustomAction | `pushTracking.customAction` | 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 new file mode 100644 index 0000000000..e765d34f99 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition-item.md @@ -0,0 +1,143 @@ +--- +noIndex: true +--- + + + +#### Swift + +**Syntax** + +```swift +func generateInteractionXdm(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType, forTokens tokens: [String]? = nil) -> [String: Any]? +``` + +* _interaction_ is a custom string value describing the interaction. +* _eventType_ is an enum specifying event type for the interaction. +* _tokens_ is an array containing the decision item tokens for recording interaction. + + + +#### Swift + +**Syntax** + +```swift +func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType, forTokens tokens: [String]? = nil) +``` + +* _interaction_ is a custom string value describing the interaction. +* _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 String getItemId() +``` + + + +#### Java + +**Syntax** + +```java +public Map getItemData() +``` + + + +#### Java + +**Syntax** + +```java +public SchemaType getSchema() +``` + + + +#### Java + +**Syntax** + +```java +public String getHtmlContent() +``` + + + +#### Java + +**Syntax** + +```java +public Map getJsonContentMap() +``` + + + +#### Java + +**Syntax** + +```java +public List> getJsonArrayList() +``` + + + +#### Java + +**Syntax** + +```java +public Map generateInteractionXdm(@NonNull final MessagingEdgeEventType eventType) +``` + +* _eventType_ is an enum specifying event type for the interaction. + + + +#### Java + +**Syntax** + +```java +public Map generateInteractionXdm(final String interaction, @NonNull final MessagingEdgeEventType eventType, final List tokens) +``` + +* _interaction_ is a custom string value describing the interaction. +* _eventType_ is an enum specifying event type for the interaction. +* _tokens_ is a list containing the decision item tokens for recording interaction. + + + +#### Java + +**Syntax** + +```java +public void track(@NonNull final MessagingEdgeEventType eventType) +``` + +* _eventType_ is an enum specifying event type for the interaction. + + + +#### Java + +**Syntax** + +```java +public void track(final String interaction, @NonNull final MessagingEdgeEventType eventType, final List tokens) +``` + +* _interaction_ is a custom string value describing the interaction. +* _eventType_ is an enum specifying event type for the interaction. +* _tokens_ is a list containing the decision item tokens for recording interaction. diff --git a/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition.md b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition.md new file mode 100644 index 0000000000..2bc3c29b17 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/proposition.md @@ -0,0 +1,33 @@ +--- +noIndex: true +--- + + + +#### Java + +**Syntax** + +```java +public List getItems() +``` + + + +#### Java + +**Syntax** + +```java +public String getScope() +``` + + + +#### Java + +**Syntax** + +```java +public String getUniqueId() +``` 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 new file mode 100644 index 0000000000..883db6dc32 --- /dev/null +++ b/src/pages/edge/adobe-journey-optimizer/public-classes/tabs/surface.md @@ -0,0 +1,75 @@ +--- +noIndex: true +--- + + + +#### Swift + +**Syntax** + +```swift +public init(path: String) +``` + +* _path_ is a string representation for the surface path. + +**Example** + +```swift +// Creates a surface instance representing a banner within homeView view in my mobile application. +let surface = Surface(path: "homeView#banner") +``` + + + +#### Java + +**Syntax** + +```java +public Surface(final String path) +``` + +* _path_ is a string containing the surface path. + +**Example** + +```java +// Creates a surface instance representing a banner view within homeActivity in my mobile application. +final Surface surface = new Surface("homeActivity#banner") +``` + + + +#### Java + +**Syntax** + +```java +public Surface() +``` + +**Example** + +```java +// Creates a new base surface by appending application package name to the mobile app surface prefix mobileapp:// +final Surface surface = new Surface() +``` + + + +#### Java + +**Syntax** + +```java +public String getUri() +``` + +**Example** + +```java +final Surface surface = new Surface("homeActivity#banner") +final String uri = surface.getUri() +``` diff --git a/src/pages/edge/adobe-journey-optimizer/push-notification/ios/api-reference.md b/src/pages/edge/adobe-journey-optimizer/push-notification/ios/api-reference.md index d5a2f9312f..f98929b32d 100644 --- a/src/pages/edge/adobe-journey-optimizer/push-notification/ios/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer/push-notification/ios/api-reference.md @@ -44,7 +44,7 @@ func application(_ application: UIApplication, didRegisterForRemoteNotifications ## Track push notification interactions -Use `handleNotificationResponse` API to send push notification interaction data to Adobe Experience Platform. +Use [`handleNotificationResponse`](./../../api-reference/#handlenotificationresponse) API to send push notification interaction data to Adobe Experience Platform. In iOS, [UNUserNotificationCenterDelegate](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate) is the interface for processing incoming notifications and responding to notification actions. Once the delegate is implemented, handle push notification responses in [userNotificationCenter(_:didReceive:withCompletionHandler:)](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter) method. @@ -55,8 +55,20 @@ In iOS, [UNUserNotificationCenterDelegate](https://developer.apple.com/documenta ```swift func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse, - withCompletionHandler completionHandler: @escaping () -> Void) { - Messaging.handleNotificationResponse(response) + withCompletionHandler completionHandler: @escaping () -> Void) { + + Messaging.handleNotificationResponse(response, urlHandler: { url in + /// return `true` if the app is handling the url or `false` if the Adobe SDK should handle it + let appHandlesUrl = false + return appHandlesUrl + }, closure: { pushTrackingStatus in + if pushTrackingStatus == .trackingInitiated { + // tracking was successful + } else { + // tracking failed, view the status for more information + } + }) + completionHandler() } ``` @@ -64,11 +76,21 @@ func userNotificationCenter(_: UNUserNotificationCenter, #### Objective-C ```objc -- (void)userNotificationCenter:(UNUserNotificationCenter *)center -didReceiveNotificationResponse:(UNNotificationResponse *)response - withCompletionHandler:(void (^)(void))completionHandler { - - [AEPMobileMessaging handleNotificationResponse:response closure:nil]; +- (void) userNotificationCenter:(UNUserNotificationCenter *) center + didReceiveNotificationResponse:(UNNotificationResponse *) response + withCompletionHandler:(void (^)(void)) completionHandler { + + [AEPMobileMessaging handleNotificationResponse:response urlHandler: ^(NSURL *url) { + /// return `true` if the app is handling the url or `false` if the Adobe SDK should handle it + bool appHandlesUrl = false; + return appHandlesUrl; + } closure:^(AEPPushTrackingStatus status) { + if (status == AEPPushTrackingStatusTrackingInitiated) { + // tracking was successful + } else { + // tracking failed, view the status for more information + } + }]; } ``` @@ -85,17 +107,17 @@ Implement the callback in `handleNotificationResponse` API to read [PushTracking #### Swift ```swift - Messaging.handleNotificationResponse(response) { trackingStatus in - // handle the different values of trackingStatus - } +Messaging.handleNotificationResponse(response) { trackingStatus in + // handle the different values of trackingStatus +} ``` #### Objective-C ```objc - [AEPMobileMessaging handleNotificationResponse:response closure:^(AEPPushTrackingStatus status){ - if (status == AEPPushTrackingStatusTrackingInitiated) { - NSLog(@"Successfully started push notification tracking"); - } - }]; +[AEPMobileMessaging handleNotificationResponse:response urlHandler:nil closure:^(AEPPushTrackingStatus status) { + if (status == AEPPushTrackingStatusTrackingInitiated) { + NSLog(@"Successfully started push notification tracking"); + } +}]; ``` diff --git a/src/pages/edge/adobe-journey-optimizer/release-notes.md b/src/pages/edge/adobe-journey-optimizer/release-notes.md index b9591bad96..dac5519ba8 100644 --- a/src/pages/edge/adobe-journey-optimizer/release-notes.md +++ b/src/pages/edge/adobe-journey-optimizer/release-notes.md @@ -15,12 +15,12 @@ Major version update for [Adobe Journey Optimizer](./index.md) for Adobe Experie * Updated the minimum supported version to iOS 12.0. * Include XCFrameworks built with Xcode 15.0.1 with the GitHub release. -* Added `handleNotificationResponse(_:urlHandler:closure:)` API to provide more control over URL handling from `UNNotificationResponse` objects. +* Added [`handleNotificationResponse(_:urlHandler:closure:)`](./api-reference/#handlenotificationresponse) API to provide more control over URL handling from `UNNotificationResponse` objects. * Removed deprecated public API `Messaging.handleNotificationResponse(_:applicationOpened:withCustomActionId:)`. * Removed public API `Messaging.handleNotificationResponse(_:closure:)` API. * Added support for [Code Based Experiences](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/code-based-experience/get-started-code-based). - * Added public API `Messaging.updatePropositionsForSurfaces(_)`. - * Added public API `Messaging.getPropositionsForSurfaces(_:completion:)`. + * Added public API [`Messaging.updatePropositionsForSurfaces(_)`](./code-based/api-reference/#updatepropositionsforsurfaces). + * Added public API [`Messaging.getPropositionsForSurfaces(_:completion:)`](./code-based/api-reference/#getpropositionsforsurfaces). ## March 5, 2024 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 3235203f81..ef1717791d 100644 --- a/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md +++ b/src/pages/edge/adobe-journey-optimizer/tabs/api-reference.md @@ -74,8 +74,8 @@ public static void handleNotificationResponse(final Intent intent, ```swift static func handleNotificationResponse(_ response: UNNotificationResponse, - applicationOpened: Bool, - customActionId: String?) + urlHandler: ((URL) -> Bool)? = nil, + closure: ((PushTrackingStatus) -> Void)? = nil) ``` #### Objective-C @@ -83,16 +83,16 @@ static func handleNotificationResponse(_ response: UNNotificationResponse, **Syntax** ```objc -+ (void)handleNotificationResponse:(UNNotificationResponse *)response - applicationOpened: (BOOL)applicationOpened - customActionId: (NSString *)customActionId; ++ (void) handleNotificationResponse: (UNNotificationResponse *) response + urlHandler: (BOOL (^)(NSURL *url)) handler + closure: (void (^)(PushTrackingStatus status)) closure; ``` | **Parameter** | **Type** | **Description** | | :----------- | :------- | :-------------- | -| `response` | UNNotificationResponse | An object containing information about the push notification details. | -| `applicationOpened` | Boolean | Shows whether the application has been opened or not. | -| `customActionId` | String | The ID of the custom action. | +| `response` | `UNNotificationResponse` | An object containing information about the push notification details. | +| `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. | diff --git a/src/pages/home/release-notes/index.md b/src/pages/home/release-notes/index.md index 79126a1d3e..e25bf16759 100644 --- a/src/pages/home/release-notes/index.md +++ b/src/pages/home/release-notes/index.md @@ -66,12 +66,12 @@ Major version update for [Adobe Journey Optimizer](../../edge/adobe-journey-opti * Updated the minimum supported version to iOS 12.0. * Include XCFrameworks built with Xcode 15.0.1 with the GitHub release. -* Added `handleNotificationResponse(_:urlHandler:closure:)` API to provide more control over URL handling from `UNNotificationResponse` objects. +* Added [`handleNotificationResponse(_:urlHandler:closure:)`](./../../edge/adobe-journey-optimizer/api-reference/#handlenotificationresponse) API to provide more control over URL handling from `UNNotificationResponse` objects. * Removed deprecated public API `Messaging.handleNotificationResponse(_:applicationOpened:withCustomActionId:)`. * Removed public API `Messaging.handleNotificationResponse(_:closure:)` API. * Added support for [Code Based Experiences](https://experienceleague.adobe.com/en/docs/journey-optimizer/using/code-based-experience/get-started-code-based). - * Added public API `Messaging.updatePropositionsForSurfaces(_)`. - * Added public API `Messaging.getPropositionsForSurfaces(_:completion:)`. + * Added public API [`Messaging.updatePropositionsForSurfaces(_)`](./../../edge/adobe-journey-optimizer/code-based/api-reference/#updatepropositionsforsurfaces). + * Added public API [`Messaging.getPropositionsForSurfaces(_:completion:)`](./../../edge/adobe-journey-optimizer/code-based/api-reference/#getpropositionsforsurfaces). ### iOS Optimize 5.0.0 diff --git a/src/pages/resources/migration/ios/migrate-to-5x.md b/src/pages/resources/migration/ios/migrate-to-5x.md index 14973c2c4a..1e62880893 100644 --- a/src/pages/resources/migration/ios/migrate-to-5x.md +++ b/src/pages/resources/migration/ios/migrate-to-5x.md @@ -142,3 +142,20 @@ MobileCore.track(state: "view name", data: ["&&events": "event5,event2=2"]) } } ``` + +### Messaging + +#### Push tracking + +In order to provide more control over URL handling from `UNNotificationResponse` objects, two old APIs were removed and a new one was added. + +| Old API (4.x) | New API (5.x) | +| ------------- | ------------- | +| `handleNotificationResponse(_:applicationOpened:withCustomActionId:)` | `handleNotificationResponse(_:urlHandler:closure:)` | +| `handleNotificationResponse(_:closure:)` | `handleNotificationResponse(_:urlHandler:closure:)` | + +For examples see [handleNotificationResponse](./../../../edge/adobe-journey-optimizer/api-reference#handlenotificationresponse). + +#### Optimize + +The `Proposition` class has been renamed to [`OptimizeProposition`](./../../../edge/adobe-journey-optimizer-decisioning/api-reference/#propositionoptimizeproposition). All references should be updated accordingly.