diff --git a/apps/AEPSampleApp/extensions/OptimizeView.tsx b/apps/AEPSampleApp/extensions/OptimizeView.tsx index f0bd8adc..cddc714e 100644 --- a/apps/AEPSampleApp/extensions/OptimizeView.tsx +++ b/apps/AEPSampleApp/extensions/OptimizeView.tsx @@ -33,10 +33,6 @@ const ViewTypes = { content: 1, }; -const TARGET_OFFER_TYPE_TEXT = 'text/plain'; -const TARGET_OFFER_TYPE_JSON = 'application/json'; -const TARGET_OFFER_TYPE_HTML = 'text/html'; - const defaultPropositions = { textProposition: 'Placeholder Text Offer!!', imageProposition: @@ -122,7 +118,7 @@ export default ({navigation}: any) => { const renderTargetOffer = () => { if (targetProposition?.items) { - if (targetProposition.items[0].format === TARGET_OFFER_TYPE_TEXT) { + if (targetProposition.items[0].format === 'text/plain') { return ( { {targetProposition.items[0].content} ); - } else if (targetProposition.items[0].format === TARGET_OFFER_TYPE_JSON) { + } else if (targetProposition.items[0].format === 'application/json') { return ( { {targetProposition.items[0].content} ); - } else if (targetProposition.items[0].format === TARGET_OFFER_TYPE_HTML) { + } else if (targetProposition.items[0].format === 'text/html') { return ( { diff --git a/packages/messaging/README.md b/packages/messaging/README.md index da93746b..0f1d49a6 100644 --- a/packages/messaging/README.md +++ b/packages/messaging/README.md @@ -4,11 +4,11 @@ [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepmessaging.svg)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepmessaging)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) -`@adobe/react-native-aepmessaging` is a wrapper around the iOS and Android [Adobe Journey Optimizer Messaging](https://developer.adobe.com/client-sdks/documentation/adobe-journey-optimizer) to allow for integration with React Native applications. +`@adobe/react-native-aepmessaging` is a wrapper around the iOS and Android [Adobe Journey Optimizer Messaging](https://developer.adobe.com/client-sdks/documentation/iam) to allow for integration with React Native applications. ## Prerequisites -The messaging extension has the following peer dependenices, which must be installed prior to installing the messaging extension: +The messaging extension has the following peer dependencies, which must be installed prior to installing the messaging extension: - [Core](../core/README.md) - [Edge](../edge/README.md) - [Edge Identity](../edgeidentity/README.md) @@ -17,12 +17,10 @@ The messaging extension has the following peer dependenices, which must be insta See [Requirements and Installation](https://github.com/adobe/aepsdk-react-native#requirements) instructions on the main page -**Installation instructions for `@adobe/react-native-aepmessaging` v1.0.0-beta.3 with in-app messaging support** -Clone the `@adobe/react-native-aepmessaging` package from the `messaging` branch on [Github](https://github.com/adobe/aepsdk-react-native/tree/messaging). Place the Messaging package folder into app repo or directory of your choosing. Then you can install the package by running: +Install the `@adobe/react-native-aepmessaging` package: ```bash -cd MyReactApp -npm install {path to messaging package} +npm install @adobe/react-native-aepmessaging ``` ## IOS Setup @@ -313,7 +311,7 @@ var message: Message; message.clear(); ``` -## Programatically control the display of in-app messages +## Programmatically control the display of in-app messages App developers can now create a type MessagingDelegate in order to be alerted when specific events occur during the lifecycle of an in-app message. Definition of type MessagingDelegate is: diff --git a/packages/optimize/README.md b/packages/optimize/README.md index 098215c3..929d2c08 100644 --- a/packages/optimize/README.md +++ b/packages/optimize/README.md @@ -1,31 +1,32 @@ - # React Native AEP Optimize Extension [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepoptimize.svg)](https://www.npmjs.com/package/@adobe/react-native-aepoptimize) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepoptimize)](https://www.npmjs.com/package/@adobe/react-native-aepoptimize) - `@adobe/react-native-aepoptimize` is a wrapper around the iOS and Android [Adobe Experience Platform Optimize Extension](https://developer.adobe.com/client-sdks/documentation/adobe-journey-optimizer-decisioning) to allow for integration with React Native applications. ## Peer Dependencies The Adobe Experience Platform Optimize extension has the following peer dependency, which must be installed prior to installing the optimize extension: + - [Core](../core/README.md) - [Edge](../edge/README.md) - [Edge Identity](../edgeidentity/README.md) ## Installation -See [Requirements and Installation](https://github.com/adobe/aepsdk-react-native#requirements) instructions on the main page +See [Requirements and Installation](https://github.com/adobe/aepsdk-react-native#requirements) instructions on the main page Install the `@adobe/react-native-aepoptimize` package: NPM: + ```bash npm install @adobe/react-native-aepoptimize ``` Yarn: + ```bash yarn add @adobe/react-native-aepoptimize ``` @@ -36,9 +37,10 @@ yarn add @adobe/react-native-aepoptimize Initialization of the SDK should be done in native code, documentation on how to initialize the SDK can be found [here](https://github.com/adobe/aepsdk-react-native#initializing). -Example: +Example: + +iOS -iOS ```objectivec @import AEPCore; @import AEPLifecycle; @@ -59,7 +61,8 @@ iOS @end ``` -Android +Android + ```java import com.adobe.marketing.mobile.AdobeCallback; import com.adobe.marketing.mobile.InvalidInitException; @@ -69,7 +72,7 @@ import com.adobe.marketing.mobile.MobileCore; import com.adobe.marketing.mobile.Edge; import com.adobe.marketing.mobile.edge.identity.Identity; import com.adobe.marketing.mobile.optimize.Optimize; - + ... import android.app.Application; ... @@ -96,13 +99,18 @@ public class MainApplication extends Application implements ReactApplication { ... } } -} +} ``` ### Importing the extension: ```typescript -import { Optimize, Offer, Proposition, DecisionScope } from '@adobe/react-native-aepoptimize'; +import { + Optimize, + Offer, + Proposition, + DecisionScope +} from '@adobe/react-native-aepoptimize'; ``` ## API reference @@ -110,11 +118,13 @@ import { Optimize, Offer, Proposition, DecisionScope } from '@adobe/react-native ### Clearing the cached Propositions: **Syntax** + ```typescript -clearCachedPropositions() +clearCachedPropositions(); ``` **Example** + ```typescript Optimize.clearCachedPropositions(); ``` @@ -122,69 +132,105 @@ Optimize.clearCachedPropositions(); ### Getting the SDK version: **Syntax** + ```typescript extensionVersion(): Promise ``` **Example** + ```typescript Optimize.extensionVersion().then(newVersion => console.log("AdobeExperienceSDK: Optimize version: " + newVersion); ``` ### Getting the Cached Propositions: + This API returns the cached propositions for the provided DecisionScopes from the in-memory Proposition cache. **Syntax** + ```typescript getPropositions(decisionScopes: Array): Promise> ``` **Example** + ```typescript -const decisionScopeText = new DecisionScope("{DecisionScope name}"); -const decisionScopeImage = new DecisionScope("{DecisionScope name}"); -const decisionScopeHtml = new DecisionScope("{DecisionScope name{"); -const decisionScopeJson = new DecisionScope("{DecisionScope name}"); -const decisionScopes = [ decisionScopeText, decisionScopeImage, decisionScopeHtml, decisionScopeJson ]; +const decisionScopeText = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopeImage = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopeHtml = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopeJson = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopes = [ + decisionScopeText, + decisionScopeImage, + decisionScopeHtml, + decisionScopeJson +]; Optimize.getPropositions(decisionScopes).then( - (propositions: Map) => { - //Your app logic using the propositions -}); + (propositions: Map) => { + //Your app logic using the propositions + } +); ``` ### Adding onPropositionUpdate callback: + Callback that will be called with the updated Propositions. **Syntax** + ```typescript onPropositionUpdate(adobeCallback: AdobeCallback) ``` **Example** + ```typescript Optimize.onPropositionUpdate({ call(proposition: Map) { //App logic using the updated proposition } -}); +}); ``` ### updating the propositions: + This API fetches the propositions for the provided DecisionScope list. **Syntax** + ```typescript updatePropositions(decisionScopes: Array, xdm?: Map, data?: Map) ``` **Example** + ```typescript -const decisionScopeText = new DecisionScope("{DecisionScope name}"); -const decisionScopeImage = new DecisionScope("{DecisionScope name}"); -const decisionScopeHtml = new DecisionScope("{DecisionScope name{"); -const decisionScopeJson = new DecisionScope("{DecisionScope name}"); -const decisionScopes = [ decisionScopeText, decisionScopeImage, decisionScopeHtml, decisionScopeJson ]; +const decisionScopeText = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopeImage = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopeHtml = new DecisionScope('{DecisionScope name{'); +const decisionScopeJson = new DecisionScope( + 'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjEyYmEyZjM4MWJjYTY3NWUiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTJiOWEwMDA1NTUwNzM1NyIsICJ4ZG06aXRlbUNvdW50IjozfQ==' +); +const decisionScopes = [ + decisionScopeText, + decisionScopeImage, + decisionScopeHtml, + decisionScopeJson +]; Optimize.updatePropositions(decisionScopes, null, null); ``` @@ -198,153 +244,181 @@ Optimize.updatePropositions(decisionScopes, null, null); - [Offer](#offer) ### DecisionScope + This class represents the decision scope which is used to fetch the decision propositions from the Edge decisioning services. The encapsulated scope name can also represent the Base64 encoded JSON string created using the provided activityId, placementId and itemCount. ```typescript /** -* class represents a decision scope used to fetch personalized offers from the Experience Edge network. -*/ + * class represents a decision scope used to fetch personalized offers from the Experience Edge network. + */ module.exports = class DecisionScope { - name: string; - - constructor(name?: string, activityId?: string, placementId?: string, itemCount?: number) { - if(name && name.trim()) { - this.name = name; - } else { - const decisionScopeObject = {}; - decisionScopeObject['activityId'] = activityId; - decisionScopeObject['placementId'] = placementId; - decisionScopeObject['itemCount'] = itemCount; - this.name = Buffer.from(JSON.stringify(decisionScopeObject)).toString("base64"); - } + name: string; + + constructor( + name?: string, + activityId?: string, + placementId?: string, + itemCount?: number + ) { + if (name && name.trim()) { + this.name = name; + } else { + const decisionScopeObject = {}; + decisionScopeObject['activityId'] = activityId; + decisionScopeObject['placementId'] = placementId; + decisionScopeObject['itemCount'] = itemCount; + this.name = Buffer.from(JSON.stringify(decisionScopeObject)).toString( + 'base64' + ); } + } - /** - * Gets the name of this scope - * @return {string} - The name of the scope - */ - getName(): string { - return this.name; - } + /** + * Gets the name of this scope + * @return {string} - The name of the scope + */ + getName(): string { + return this.name; + } }; ``` ### Proposition + This class represents the decision propositions received from the decisioning services, upon a personalization query request to the Experience Edge network. ```typescript module.exports = class Proposition { - id: string; - items: Array; - scope: string; - scopeDetails: Map; - - constructor(eventData: PropositionEventData) { - this.id = eventData['id']; - this.scope = eventData['scope']; - this.scopeDetails = eventData['scopeDetails']; - if(eventData['items']) { - this.items = eventData['items'].map(offer => new Offer(offer)); - } - } - - /** - * Generates a map containing XDM formatted data for {Experience Event - Proposition Reference} field group from proposition arguement. - * The returned XDM data does not contain eventType for the Experience Event. - * @return {Promise>} a promise that resolves to xdm data map - */ - generateReferenceXdm(): Promise> { - const entries = Object.entries(this).filter(([key, value]) => typeof(value) !== "function"); - const proposition = Object.fromEntries(entries); - return Promise.resolve(RCTAEPOptimize.generateReferenceXdm(proposition)); - }; -} + id: string; + items: Array; + scope: string; + scopeDetails: Map; + + constructor(eventData: PropositionEventData) { + this.id = eventData['id']; + this.scope = eventData['scope']; + this.scopeDetails = eventData['scopeDetails']; + if (eventData['items']) { + this.items = eventData['items'].map((offer) => new Offer(offer)); + } + } + + /** + * Generates a map containing XDM formatted data for {Experience Event - Proposition Reference} field group from proposition argument. + * The returned XDM data does not contain eventType for the Experience Event. + * @return {Promise>} a promise that resolves to xdm data map + */ + generateReferenceXdm(): Promise> { + const entries = Object.entries(this).filter( + ([key, value]) => typeof value !== 'function' + ); + const proposition = Object.fromEntries(entries); + return Promise.resolve(RCTAEPOptimize.generateReferenceXdm(proposition)); + } +}; ``` ### Offer + This class represents the proposition option received from the decisioning services, upon a personalization query to the Experience Edge network. ```typescript module.exports = class Offer { - id: string; - etag: string; - schema: string; - data: Record; - meta?: Record; - - get content(): string { - return this.data["content"]; - } + id: string; + etag: string; + schema: string; + data: Record; + meta?: Record; + + get content(): string { + return this.data['content']; + } - get format(): string { - return this.data["format"]; - } + get format(): string { + return this.data['format']; + } - get language(): Array { - return this.data["language"]; - } + get language(): Array { + return this.data['language']; + } - get characteristics(): Map { - return this.data["characteristics"]; - } + get characteristics(): Map { + return this.data['characteristics']; + } - constructor(eventData: OfferEventData) { - this.id = eventData['id']; - this.etag = eventData['etag']; - this.schema = eventData['schema']; - this.data = eventData['data']; - this.meta = eventData['meta'] - } + constructor(eventData: OfferEventData) { + this.id = eventData['id']; + this.etag = eventData['etag']; + this.schema = eventData['schema']; + this.data = eventData['data']; + this.meta = eventData['meta']; + } - /** - * Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the display interaction data for the - * given Proposition offer. - * @param {Proposition} proposition - the proposition this Offer belongs to - */ - displayed(proposition: Proposition): void { - const entries = Object.entries(proposition).filter(([key, value]) => typeof(value) !== "function"); - const cleanedProposition = Object.fromEntries(entries); - RCTAEPOptimize.offerDisplayed(this.id, cleanedProposition); - }; - - /** - * Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the tap interaction data for the - * given Proposition offer. - * @param {Proposition} proposition - the proposition this Offer belongs to - */ - tapped(proposition: Proposition): void { - console.log("Offer is tapped"); - const entries = Object.entries(proposition).filter(([key, value]) => typeof(value) !== "function"); - const cleanedProposition = Object.fromEntries(entries); - RCTAEPOptimize.offerTapped(this.id, cleanedProposition); - }; - - /** - * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from proposition arguement. - * The returned XDM data does contain the eventType for the Experience Event with value decisioning.propositionDisplay. - * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override - * dataset identifier. - * @param {Proposition} proposition - the proposition this Offer belongs to - * @return {Promise>} - a promise that resolves to xdm map - */ - generateDisplayInteractionXdm(proposition: Proposition): Promise> { - const entries = Object.entries(proposition).filter(([key, value]) => typeof(value) !== "function"); - const cleanedProposition = Object.fromEntries(entries); - return Promise.resolve(RCTAEPOptimize.generateDisplayInteractionXdm(this.id, cleanedProposition)); - }; - - /** - * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from this proposition arguement. - * The returned XDM data contains the eventType for the Experience Event with value decisioning.propositionInteract. - * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override - * dataset identifier. - * @param {Proposition} proposition - proposition this Offer belongs to - * @return {Promise>} a promise that resolves to xdm map - */ - generateTapInteractionXdm(proposition: Proposition): Promise> { - const entries = Object.entries(proposition).filter(([key, value]) => typeof(value) !== "function"); - const cleanedProposition = Object.fromEntries(entries); - return Promise.resolve(RCTAEPOptimize.generateTapInteractionXdm(this.id, cleanedProposition)); - }; + /** + * Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the display interaction data for the + * given Proposition offer. + * @param {Proposition} proposition - the proposition this Offer belongs to + */ + displayed(proposition: Proposition): void { + const entries = Object.entries(proposition).filter( + ([key, value]) => typeof value !== 'function' + ); + const cleanedProposition = Object.fromEntries(entries); + RCTAEPOptimize.offerDisplayed(this.id, cleanedProposition); + } + + /** + * Dispatches an event for the Edge network extension to send an Experience Event to the Edge network with the tap interaction data for the + * given Proposition offer. + * @param {Proposition} proposition - the proposition this Offer belongs to + */ + tapped(proposition: Proposition): void { + console.log('Offer is tapped'); + const entries = Object.entries(proposition).filter( + ([key, value]) => typeof value !== 'function' + ); + const cleanedProposition = Object.fromEntries(entries); + RCTAEPOptimize.offerTapped(this.id, cleanedProposition); + } + + /** + * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from proposition argument. + * The returned XDM data does contain the eventType for the Experience Event with value decisioning.propositionDisplay. + * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override + * dataset identifier. + * @param {Proposition} proposition - the proposition this Offer belongs to + * @return {Promise>} - a promise that resolves to xdm map + */ + generateDisplayInteractionXdm( + proposition: Proposition + ): Promise> { + const entries = Object.entries(proposition).filter( + ([key, value]) => typeof value !== 'function' + ); + const cleanedProposition = Object.fromEntries(entries); + return Promise.resolve( + RCTAEPOptimize.generateDisplayInteractionXdm(this.id, cleanedProposition) + ); + } + + /** + * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from this proposition argument. + * The returned XDM data contains the eventType for the Experience Event with value decisioning.propositionInteract. + * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override + * dataset identifier. + * @param {Proposition} proposition - proposition this Offer belongs to + * @return {Promise>} a promise that resolves to xdm map + */ + generateTapInteractionXdm( + proposition: Proposition + ): Promise> { + const entries = Object.entries(proposition).filter( + ([key, value]) => typeof value !== 'function' + ); + const cleanedProposition = Object.fromEntries(entries); + return Promise.resolve( + RCTAEPOptimize.generateTapInteractionXdm(this.id, cleanedProposition) + ); + } }; ``` diff --git a/packages/optimize/package.json b/packages/optimize/package.json index b60b7c45..61d94f48 100644 --- a/packages/optimize/package.json +++ b/packages/optimize/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/react-native-aepoptimize", - "version": "1.0.0", + "version": "1.0.1", "description": "Adobe Experience Platform support for React Native apps.", "homepage": "https://developer.adobe.com/client-sdks/documentation/", "license": "Apache-2.0", diff --git a/packages/optimize/ts/models/Offer.ts b/packages/optimize/ts/models/Offer.ts index 6a40ebf3..450545e8 100644 --- a/packages/optimize/ts/models/Offer.ts +++ b/packages/optimize/ts/models/Offer.ts @@ -14,10 +14,12 @@ import Proposition from'./Proposition'; import { NativeModules } from 'react-native'; const { AEPOptimize: RCTAEPOptimize } = NativeModules; +type OfferFormat = 'text/html' | 'application/json' | 'text/plain' | 'image/*' | ''; + interface OfferData { id: string; content: string; - format: string; + format: OfferFormat; characteristics?: Record; language?: string[]; } @@ -43,7 +45,7 @@ class Offer { return this.data.content; } - get format(): string { + get format(): OfferFormat { return this.data.format; } @@ -88,7 +90,7 @@ class Offer { }; /** - * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from proposition arguement. + * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from proposition argument. * The returned XDM data does contain the eventType for the Experience Event with value decisioning.propositionDisplay. * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override * dataset identifier. @@ -102,7 +104,7 @@ class Offer { }; /** - * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from this proposition arguement. + * Generates a map containing XDM formatted data for {Experience Event - Proposition Interactions} field group from this proposition argument. * The returned XDM data contains the eventType for the Experience Event with value decisioning.propositionInteract. * Note: The Edge sendEvent API can be used to dispatch this data in an Experience Event along with any additional XDM, free-form data, and override * dataset identifier. diff --git a/packages/target/README.md b/packages/target/README.md index c7e8d0a1..825ec43a 100644 --- a/packages/target/README.md +++ b/packages/target/README.md @@ -116,11 +116,13 @@ import { ### Getting the extension version: **Syntax** + ```typescript extensionVersion(): Promise ``` **Example** + ```typescript const version = await Target.extensionVersion(); console.log('AdobeExperienceSDK: AEPTarget version: ' + version); @@ -129,11 +131,13 @@ console.log('AdobeExperienceSDK: AEPTarget version: ' + version); ### Get custom visitor IDs: **Syntax** + ```typescript getThirdPartyId(): Promise ``` **Example** + ```typescript const id = await Target.getThirdPartyId(); console.log('AdobeExperienceSDK: Third Party ID: ' + id); @@ -142,11 +146,13 @@ console.log('AdobeExperienceSDK: Third Party ID: ' + id); ### Set custom visitor IDs: **Syntax** + ```typescript setThirdPartyId(): void ``` **Example** + ```typescript Target.setThirdPartyId('thirdPartyId'); ``` @@ -154,11 +160,13 @@ Target.setThirdPartyId('thirdPartyId'); ### Reset user experience: **Syntax** + ```typescript resetExperience(): void ``` **Example** + ```typescript Target.resetExperience(); ``` @@ -166,11 +174,13 @@ Target.resetExperience(); ### Get Target Session ID: **Syntax** + ```typescript getSessionId(): Promise ``` **Example** + ```typescript const id = await Target.getSessionId(); console.log('AdobeExperienceSDK: Session ID ' + id); @@ -179,11 +189,13 @@ console.log('AdobeExperienceSDK: Session ID ' + id); ### Get Target user identifier: **Syntax** + ```typescript getTntId(): Promise ``` **Example** + ```typescript const id = await Target.getTntId(); console.log('AdobeExperienceSDK: TNT ID ' + id); @@ -192,11 +204,13 @@ console.log('AdobeExperienceSDK: TNT ID ' + id); ### Load Target requests: **Syntax** + ```typescript retrieveLocationContent(Array, ): void ``` **Example** + ```typescript var mboxParameters1 = { status: 'platinum' }; var mboxParameters2 = { userType: 'Paid' }; @@ -252,11 +266,13 @@ Target.retrieveLocationContent(locationRequests, parameters); ### Using the prefetch APIs: **Syntax** + ```typescript prefetchContent(Array, ): Promise ``` **Example** + ```typescript var mboxParameters1 = { status: 'platinum' }; var mboxParameters2 = { userType: 'Paid' }; @@ -289,14 +305,30 @@ Target.prefetchContent(prefetchList, parameters) .catch((err) => console.log(err)); ``` +### Clear the Prefetch cache + +**Syntax** + +```typescript +Target.clearPrefetchCache(): void +``` + +**Example** + +```typescript +Target.clearPrefetchCache() +``` + ### Set Session ID **Syntax** + ```typescript Target.setSessionId(): void ``` **Example** + ```typescript Target.setSessionId('sessionId'); ``` @@ -304,11 +336,13 @@ Target.setSessionId('sessionId'); ### Set TNT ID **Syntax** + ```typescript Target.setTntId(): void ``` **Example** + ```typescript Target.setTntId('tntId'); ``` @@ -316,11 +350,13 @@ Target.setTntId('tntId'); ### Set preview restart deep link: **Syntax** + ```typescript setPreviewRestartDeeplink(): void; ``` **Example** + ```typescript Target.setPreviewRestartDeeplink('https://www.adobe.com'); ``` @@ -328,11 +364,13 @@ Target.setPreviewRestartDeeplink('https://www.adobe.com'); ### Send an mbox click notification: **Syntax** + ```typescript clickedLocation(, ): void; ``` **Example** + ```typescript var purchaseIDs = ['34', '125']; @@ -352,11 +390,13 @@ Target.clickedLocation('locationName', parameters); ### Send an mbox location displayed notification: **Syntax** + ```typescript displayedLocations(Array, ): void; ``` **Example** + ```typescript var purchaseIDs = ['34', '125']; diff --git a/packages/target/ts/Target.ts b/packages/target/ts/Target.ts index 1a61b84b..7423a4ca 100644 --- a/packages/target/ts/Target.ts +++ b/packages/target/ts/Target.ts @@ -212,7 +212,7 @@ const Target: ITarget = { /** * Sends a display notification to Target for given prefetched mboxes. This helps Target record location display events. * - * @param mboxNames (required) an array of displayed locaitons names + * @param mboxNames (required) an array of displayed locations names * @param parameters {@link TargetParameters} for the displayed location */ displayedLocations(mboxNames: Array, parameters?: TargetParameters) {