@adadapted/react-native-sdk 3.1.12 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/adadaptedApiTypes.js +1 -0
- package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
- package/lib/commonjs/components/AdZone.js +160 -128
- package/lib/commonjs/components/AdZone.js.map +1 -1
- package/lib/commonjs/index.js +36 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/api/adadaptedApiTypes.js +1 -0
- package/lib/module/api/adadaptedApiTypes.js.map +1 -1
- package/lib/module/components/AdZone.js +156 -127
- package/lib/module/components/AdZone.js.map +1 -1
- package/lib/module/index.js +37 -3
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/example/src/App.d.ts +2 -69
- package/lib/typescript/src/api/adadaptedApiTypes.d.ts +8 -0
- package/lib/typescript/src/components/AdZone.d.ts +8 -80
- package/lib/typescript/src/index.d.ts +21 -0
- package/package.json +1 -1
- package/src/api/adadaptedApiTypes.ts +8 -0
- package/src/components/AdZone.tsx +190 -173
- package/src/index.tsx +40 -2
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","AppState","Linking","NativeModules","Platform","adadaptedApiRequests","ListManagerEventName","ListManagerEventSource","PayloadStatus","ReportedEventType","AdZone","safeInvoke","packageJson","base64","DeviceOS","ApiEnv","ListManagerApiEnv","PayloadApiEnv","AdadaptedReactNativeSdk","getSessionId","sessionId","getDeviceInfo","deviceInfo","getAdZones","adZones","constructor","apiEnv","Prod","listManagerApiEnv","payloadApiEnv","onAdZonesRefreshed","onAddToListTriggered","onOutOfAppPayloadAvailable","keywordInterceptSearchValue","initialize","bind","unmount","handleAppStateChange","handleDeepLink","getDeviceInformation","Promise","resolve","then","response","generateAdZones","adZoneInfoList","adZoneId","Object","prototype","hasOwnProperty","call","push","zoneId","id","adZone","appId","udid","deviceOs","xyAdZoneDragDistanceAllowed","items","onRefreshAdZones","timerMs","sessionInfo","polling_interval_ms","refreshAdZonesTimer","setTimeout","refreshSessionData","aid","sid","uid","data","zones","catch","err","console","error","getKeywordIntercepts","keywordIntercepts","performKeywordSearch","getKeywordInterceptTerm","termId","term","termObj","terms","term_id","getCurrentUnixTimestamp","Math","round","Date","getTime","getListManagerApiRequestData","eventSource","eventName","itemNames","listName","eventList","itemName","event_source","event_name","event_timestamp","event_params","item_name","list_name","session_id","app_id","events","event","searchStr","dataIndex","indexOf","encodedData","url","substr","length","payloadData","JSON","parse","decode","payloadId","itemDataList","finalItemList","itemData","payload_id","detailed_list_items","product_title","product_brand","product_category","product_barcode","product_discount","product_image","product_sku","state","getPayloadItemData","retrievePayloadContent","payload","payloads","props","Dev","xyDragDistanceAllowed","reject","deviceInfoObj","systemName","IOS","ANDROID","OS","advertiserId","undefined","initializeSession","device_udid","sdk_version","version","device_width","parseInt","deviceWidth","device_height","deviceHeight","device_density","deviceScreenDensity","device_carrier","deviceCarrier","device_name","deviceName","device_os","device_osv","systemVersion","device_locale","deviceLocale","device_timezone","deviceTimezone","bundle_id","bundleId","bundle_version","bundleVersion","allow_retargeting","isAdTrackingEnabled","storeCurrentSessionId","getInitialURL","deepLinkOnEventListener","addEventListener","AppStateOnEventListener","searchTerm","finalResultListStartsWith","finalResultListContains","trim","min_match_length","finalEventsList","currentTs","toLowerCase","startsWith","search_id","user_input","event_type","MATCHED","created_at","sort","a","b","priority","NOT_MATCHED","reportInterceptEvent","concat","reportKeywordInterceptTermSelected","SELECTED","reportKeywordInterceptTermsPresented","termIds","termObjs","termEvents","PRESENTED","reportItemsAddedToList","requestData","APP","ADDED_TO_LIST","reportListManagerEvents","reportItemsCrossedOffList","CROSSED_OFF_LIST","reportItemsDeletedFromList","DELETED_FROM_LIST","markPayloadContentAcknowledged","reportPayloadContentStatus","tracking","status","DELIVERED","markPayloadContentRejected","REJECTED","clearTimeout","remove"],"sources":["index.tsx"],"sourcesContent":["/**\n * The AdadaptedReactNativeSdk package/module definition.\n */\nimport * as React from \"react\";\nimport {\n AppState,\n EmitterSubscription,\n Linking,\n NativeModules,\n Platform,\n} from \"react-native\";\nimport * as adadaptedApiRequests from \"./api/adadaptedApiRequests\";\nimport {\n AdSession,\n DetailedListItem,\n KeywordIntercepts,\n KeywordSearchTerm,\n ListManagerEvent,\n ListManagerEventName,\n ListManagerEventSource,\n OutOfAppDataPayload,\n PayloadStatus,\n ReportedEventType,\n ReportedInterceptEvent,\n ReportListManagerDataRequest,\n Zone,\n} from \"./api/adadaptedApiTypes\";\nimport { AdZone } from \"./components/AdZone\";\nimport { safeInvoke } from \"./util\";\nimport packageJson from \"../package.json\";\nimport base64 from \"react-native-base64\";\n\n/**\n * Enum representing possible device operating systems.\n */\nexport enum DeviceOS {\n /**\n * Represents the Android operating system.\n */\n ANDROID = \"android\",\n /**\n * Represents the iOS operating system.\n */\n IOS = \"ios\",\n}\n\n/**\n * Enum defining the different API environments.\n */\nexport enum ApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://ads.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandbox.adadapted.com\",\n /**\n * Used only for unit testing/mock data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Enum defining the different API environments for List Manager.\n */\nexport enum ListManagerApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://ec.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandec.adadapted.com\",\n /**\n * Used only for unit testing/mocking data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Enum defining the different API environments for the Payload Server.\n */\nexport enum PayloadApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://payload.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandpayload.adadapted.com\",\n /**\n * Used only for unit testing/mocking data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Interface defining inputs to the {@link Sdk.initialize} method.\n */\nexport interface InitializeProps {\n /**\n * The app ID provided by the client.\n */\n appId: string;\n /**\n * The API environment.\n * If undefined, defaults to production.\n */\n apiEnv?: ApiEnv;\n /**\n * Optional custom advertiserId to replace IDFA - ios only.\n */\n advertiserId?: string;\n /**\n * The touch sensitivity of the Ad Zone in both the X and Y directions.\n * This is used to determine the click/press sensitivity when the\n * Ad Zone is being touched by the user as a regular touch or while\n * scrolling the view. If the amount of touch \"drag\" distance in either\n * X or Y direction is less than this value, we will treat the action as\n * a click/press on the Ad Zone.\n */\n xyDragDistanceAllowed?: number;\n /**\n * Callback that gets triggered when the session/zones/ads data\n * gets refreshed and is now available for reference.\n */\n onAdZonesRefreshed?(): void;\n /**\n * Callback that gets triggered when an \"add to list\" item/items are clicked.\n * @param items - The array of items to \"add to list\".\n */\n onAddToListTriggered?(items: DetailedListItem[]): void;\n /**\n * Callback that gets triggered when an \"add to list\"\n * occurs by means of an \"out of app\" data payload.\n * @param payloads - All payloads the client must go through.\n */\n onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;\n}\n\n/**\n * Interface defining properties of a user's Device.\n */\nexport interface DeviceInfo {\n /**\n * The unique device ID.\n */\n udid: string;\n /**\n * The device name.\n */\n deviceName: string;\n /**\n * The operating system name.\n */\n systemName: string;\n /**\n * The operating system version.\n */\n systemVersion: string;\n /**\n * The device model.\n */\n deviceModel: string;\n /**\n * The device screen width.\n */\n deviceWidth: string;\n /**\n * The device screen height.\n */\n deviceHeight: string;\n /**\n * The device screen density.\n */\n deviceScreenDensity: string;\n /**\n * The current device local.\n */\n deviceLocale: string;\n /**\n * The device carrier name.\n */\n deviceCarrier: string;\n /**\n * The bundle ID.\n */\n bundleId: string;\n /**\n * The bundle version.\n */\n bundleVersion: string;\n /**\n * The current device timezone.\n */\n deviceTimezone: string;\n /**\n * If true, ad tracking is enabled for the device.\n */\n isAdTrackingEnabled: boolean;\n}\n\n/**\n * Interface defining a wrapper for an {@link AdZone}.\n */\nexport interface AdZoneInfo {\n /**\n * The ad zone ID.\n */\n zoneId: string;\n /**\n * The ad zone component.\n */\n adZone: JSX.Element;\n}\n\n/**\n * Interface defining a keyword search result.\n * This is primarily used to export an interface directly from\n * {@link AdadaptedReactNativeSdk} so the interaction with the SDK all be\n * done through this namespace.\n */\nexport interface KeywordSearchResult extends KeywordSearchTerm {}\n\n/**\n * Class that acts as the AdAdapted SDK for react-native.\n */\nexport class AdadaptedReactNativeSdk {\n /**\n * The client app ID used to send to API endpoints.\n */\n private appId: string = \"\";\n /**\n * The API environment to use when making API calls.\n */\n private apiEnv: ApiEnv;\n /**\n * The API environment to use when making API calls for List Manager.\n */\n private listManagerApiEnv: ListManagerApiEnv;\n /**\n * The API environment to use when making API calls for the Payload server.\n */\n private payloadApiEnv: PayloadApiEnv;\n /**\n * The device operating system.\n */\n private deviceOs: DeviceOS | undefined;\n /**\n * The session ID used for the API to properly identify a user.\n */\n private sessionId: string | undefined;\n /**\n * All device data gathered when \"initialize\" is called.\n */\n private deviceInfo: DeviceInfo | undefined;\n /**\n * All current Session/Ad info.\n * This info can be refreshed based on the set interval.\n */\n private sessionInfo: AdSession | undefined;\n /**\n * The available ad zones.\n */\n private adZones: AdZoneInfo[] | undefined;\n /**\n * The touch sensitivity of the Ad Zone in both the X and Y directions.\n * This is used to determine the click/press sensitivity when the\n * Ad Zone is being touched by the user as a regular touch or while\n * scrolling the view. If the amount of touch \"drag\" distance in either\n * X or Y direction is less than this value, we will treat the action as\n * a click/press on the Ad Zone.\n */\n private xyAdZoneDragDistanceAllowed: number | undefined;\n /**\n * If provided, triggers when the overall session/zones/ads data is\n * refreshed and available for reference.\n */\n private onAdZonesRefreshed: () => void | undefined;\n /**\n * The current active \"setTimeout\" reference. This is needed so we\n * can reference this variable and clean up the timer when its no\n * longer needed so memory leaks do not occur.\n */\n private refreshAdZonesTimer: ReturnType<typeof setTimeout> | undefined;\n /**\n * The user input string provided by the client and used to return a\n * result of keyword intercept terms. This will always be the last\n * provided value.\n */\n private keywordInterceptSearchValue: string;\n /**\n * The current available keyword intercepts that can\n * be used when a search is provided by the user.\n */\n private keywordIntercepts: KeywordIntercepts | undefined;\n /**\n * If provided, triggers when an \"add to list\" item is\n * clicked in an ad zone.\n * @param items - The array of items to \"add to list\".\n * @param isExternalPayload - If true, the items are from an external payload.\n */\n private onAddToListTriggered: (\n items: DetailedListItem[],\n isExternalPayload?: boolean\n ) => void | undefined;\n /**\n * If provided, triggers when an \"add to list\"\n * occurs by means of an \"out of app\" data payload.\n * @param payloads - All payloads the client must go through.\n */\n private onOutOfAppPayloadAvailable: (\n payloads: OutOfAppDataPayload[]\n ) => void | undefined;\n /**\n * Deeplink event listener.\n */\n private deepLinkOnEventListener: EmitterSubscription | undefined;\n /**\n * AppState event listener.\n */\n private AppStateOnEventListener: EmitterSubscription | undefined;\n /**\n * Gets the Session ID.\n * @returns the Session ID.\n */\n public getSessionId(): string | undefined {\n return this.sessionId;\n }\n\n /**\n * Gets the Device Info object.\n * @returns the Device Info object.\n */\n public getDeviceInfo(): DeviceInfo | undefined {\n return this.deviceInfo;\n }\n\n /**\n * Gets the list of available Ad Zones.\n * @returns all available ad zones.\n */\n public getAdZones(): AdZoneInfo[] | undefined {\n return this.adZones;\n }\n\n /**\n * @inheritDoc\n */\n constructor() {\n this.apiEnv = ApiEnv.Prod;\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n this.payloadApiEnv = PayloadApiEnv.Prod;\n this.onAdZonesRefreshed = () => {\n // Defaulting to empty method.\n };\n this.onAddToListTriggered = () => {\n // Defaulting to empty method.\n };\n this.onOutOfAppPayloadAvailable = () => {\n // Defaulting to empty method.\n };\n this.keywordInterceptSearchValue = \"\";\n\n this.initialize = this.initialize.bind(this);\n this.unmount = this.unmount.bind(this);\n this.handleAppStateChange = this.handleAppStateChange.bind(this);\n this.handleDeepLink = this.handleDeepLink.bind(this);\n }\n\n /**\n * Gets the users device info.\n * @returns a Promise of void.\n */\n private getDeviceInformation(): Promise<string> {\n return new Promise<string>((resolve) => {\n NativeModules.AdadaptedReactNativeSdk.getDeviceInfo().then(\n (response: string) => {\n resolve(response);\n }\n );\n });\n }\n\n /**\n * Creates all Ad Zone Info objects based on provided Ad Zones.\n * @param adZones - The object of available zones.\n * @returns the array of Ad Zone Info objects.\n */\n private generateAdZones(adZones: { [key: number]: Zone }): AdZoneInfo[] {\n const adZoneInfoList: AdZoneInfo[] = [];\n\n for (const adZoneId in adZones) {\n if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {\n adZoneInfoList.push({\n zoneId: adZones[adZoneId].id,\n adZone: (\n <AdZone\n key={adZoneId}\n appId={this.appId}\n sessionId={this.sessionId!}\n udid={this.deviceInfo!.udid}\n deviceOs={this.deviceOs!}\n apiEnv={this.apiEnv}\n xyDragDistanceAllowed={\n this.xyAdZoneDragDistanceAllowed || 25\n }\n adZoneData={adZones[adZoneId]}\n onAddToListTriggered={(items) => {\n safeInvoke(this.onAddToListTriggered, items);\n }}\n />\n ),\n });\n }\n }\n\n return adZoneInfoList;\n }\n\n /**\n * Triggered when session data is initialized or refreshed. Creates\n * a timer based on the session data refresh value.\n */\n private onRefreshAdZones(): void {\n // Get the amount of time we will wait until a refresh occurs.\n // We are setting a minimum refresh time of 5 minutes, so if a\n // value provided by the API is lower, we don't refresh too often.\n const timerMs =\n this.sessionInfo!.polling_interval_ms >= 300000\n ? this.sessionInfo!.polling_interval_ms\n : 300000;\n\n this.refreshAdZonesTimer = setTimeout(() => {\n adadaptedApiRequests\n .refreshSessionData(\n {\n aid: this.appId,\n sid: this.sessionId!,\n uid: this.deviceInfo!.udid,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then((response) => {\n this.sessionInfo = response.data;\n this.adZones = this.generateAdZones(response.data.zones);\n\n // Call the user defined callback indicating\n // the session data has been refreshed.\n this.onAdZonesRefreshed();\n\n // Start the timer again based on the new session data.\n this.onRefreshAdZones();\n })\n .catch((err) => {\n console.error(err);\n\n // Start the timer again so we can make another\n // attempt to refresh the session data.\n this.onRefreshAdZones();\n });\n }, timerMs);\n }\n\n /**\n * Trigger an API request to get all possible\n * keyword intercepts for the session.\n */\n private getKeywordIntercepts(): void {\n adadaptedApiRequests\n .getKeywordIntercepts(\n {\n aid: this.appId,\n sid: this.sessionId!,\n uid: this.deviceInfo!.udid,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then((response) => {\n this.keywordIntercepts = response.data;\n\n this.performKeywordSearch(\"mil\");\n });\n }\n\n /**\n * Gets the Keyword Intercept Term based on the provided term ID.\n * @param termId - The term ID to get the term object for.\n * @returns the term if it was found based on the provided term ID.\n */\n private getKeywordInterceptTerm(\n termId: string\n ): KeywordSearchTerm | undefined {\n let term: KeywordSearchTerm | undefined;\n\n if (this.keywordIntercepts && termId) {\n for (const termObj of this.keywordIntercepts.terms) {\n if (termObj.term_id === termId) {\n term = termObj;\n }\n }\n }\n\n return term;\n }\n\n /**\n * Gets the current unix timestamp.\n * @returns the current unix timestamp.\n */\n private getCurrentUnixTimestamp(): number {\n return Math.round(new Date().getTime() / 1000);\n }\n\n /**\n * Gets all data needed to make a List Manager API request.\n * @param eventSource - The event source.\n * @param eventName - The event name.\n * @param itemNames - The items to report.\n * @param listName - The list associated to the items, if any.\n * @returns the data required for the request.\n */\n private getListManagerApiRequestData(\n eventSource: ListManagerEventSource,\n eventName: ListManagerEventName,\n itemNames: string[],\n listName?: string\n ): ReportListManagerDataRequest {\n const eventList: ListManagerEvent[] = [];\n\n for (const itemName of itemNames) {\n eventList.push({\n event_source: eventSource,\n event_name: eventName,\n event_timestamp: this.getCurrentUnixTimestamp(),\n event_params: {\n item_name: itemName,\n list_name: listName,\n },\n });\n }\n\n return {\n session_id: this.sessionId!,\n app_id: this.appId,\n udid: this.deviceInfo!.udid,\n events: eventList,\n };\n }\n\n /**\n * Takes the deep link URL and extracts out the payload items data to\n * send to the client for adding to a user's list.\n * @param event - The event containing URL related info.\n */\n private handleDeepLink(event: any): void {\n const searchStr = \"data=\";\n const dataIndex: number = event[\"url\"].indexOf(searchStr);\n\n if (dataIndex !== -1) {\n const encodedData = event.url.substr(dataIndex + searchStr.length);\n const payloadData = JSON.parse(base64.decode(encodedData));\n const payloadId = payloadData[\"payload_id\"];\n const itemDataList = payloadData[\"detailed_list_items\"];\n\n if (itemDataList && itemDataList.length > 0) {\n const finalItemList: OutOfAppDataPayload[] = [];\n\n for (const itemData of itemDataList) {\n finalItemList.push({\n payload_id: payloadId,\n detailed_list_items: [\n {\n product_title: itemData[\"product_title\"],\n product_brand: itemData[\"product_brand\"],\n product_category: itemData[\"product_category\"],\n product_barcode: itemData[\"product_barcode\"],\n product_discount: itemData[\"product_discount\"],\n product_image: itemData[\"product_image\"],\n product_sku: itemData[\"product_sku\"],\n },\n ],\n });\n }\n\n // Send the items to the client, so they can add them to the list.\n safeInvoke(this.onOutOfAppPayloadAvailable, finalItemList);\n }\n }\n }\n\n /**\n * Triggered when the state of the app changes.\n * @param state - The current state of the app.\n */\n private handleAppStateChange(state: string): void {\n if (state === \"active\") {\n this.getPayloadItemData();\n }\n }\n\n /**\n * Gets all available Payload server item data for the user.\n */\n private getPayloadItemData(): void {\n adadaptedApiRequests\n .retrievePayloadContent(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n },\n this.payloadApiEnv\n )\n .then((response) => {\n const finalItemList: OutOfAppDataPayload[] = [];\n\n for (const payload of response.data.payloads) {\n for (const itemData of payload.detailed_list_items) {\n finalItemList.push({\n payload_id: payload.payload_id,\n detailed_list_items: [\n {\n product_title: itemData[\"product_title\"],\n product_brand: itemData[\"product_brand\"],\n product_category:\n itemData[\"product_category\"],\n product_barcode:\n itemData[\"product_barcode\"],\n product_discount:\n itemData[\"product_discount\"],\n product_image: itemData[\"product_image\"],\n product_sku: itemData[\"product_sku\"],\n },\n ],\n });\n }\n }\n\n // Send the items to the client, so they can add them to the list.\n safeInvoke(this.onOutOfAppPayloadAvailable, finalItemList);\n })\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Initializes the session for the AdAdapted API and sets up the SDK.\n * @param props - The props used to initialize the SDK.\n * @returns a Promise of void.\n */\n public initialize(props: InitializeProps): Promise<void> {\n // Set the app ID.\n this.appId = props.appId;\n\n // Set the API environment based on the provided override value.\n // If the apiEnv value is not provided, production will be used as default.\n if (props.apiEnv) {\n this.apiEnv = props.apiEnv;\n } else {\n this.apiEnv = ApiEnv.Prod;\n }\n\n // Base the List Manager API environment off what\n // the user provides for the props.apiEnv value.\n if (props.apiEnv) {\n if (props.apiEnv === ApiEnv.Prod) {\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n } else {\n this.listManagerApiEnv = ListManagerApiEnv.Dev;\n }\n } else {\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n }\n\n // The ad zone touch drag sensitivity setting.\n if (props.xyDragDistanceAllowed) {\n this.xyAdZoneDragDistanceAllowed = props.xyDragDistanceAllowed;\n }\n\n // If the callback for onAdZonesRefreshed was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onAdZonesRefreshed) {\n this.onAdZonesRefreshed = props.onAdZonesRefreshed;\n }\n\n // If the callback for onAddToListTriggered was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onAddToListTriggered) {\n this.onAddToListTriggered = props.onAddToListTriggered;\n }\n\n // If the callback for onOutOfAppPayloadAvailable was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onOutOfAppPayloadAvailable) {\n this.onOutOfAppPayloadAvailable = props.onOutOfAppPayloadAvailable;\n }\n\n return new Promise<void>((resolve, reject) => {\n this.getDeviceInformation()\n .then((deviceInfoObj) => {\n const deviceInfo = JSON.parse(deviceInfoObj) as DeviceInfo;\n this.deviceInfo = deviceInfo;\n this.deviceOs =\n deviceInfo.systemName === \"ios\"\n ? DeviceOS.IOS\n : DeviceOS.ANDROID;\n // Pass custom advertiserId - ios only\n if (Platform.OS === \"ios\") {\n if (!(props.advertiserId === undefined)) {\n deviceInfo.udid = props.advertiserId;\n }\n }\n // Pass device info along with API call\n adadaptedApiRequests\n .initializeSession(\n {\n app_id: this.appId,\n udid: deviceInfo.udid,\n device_udid: deviceInfo.udid,\n sdk_version: packageJson.version,\n device_width: parseInt(\n deviceInfo.deviceWidth,\n 10\n ),\n device_height: parseInt(\n deviceInfo.deviceHeight,\n 10\n ),\n device_density: deviceInfo.deviceScreenDensity,\n device_carrier: deviceInfo.deviceCarrier,\n device_name: deviceInfo.deviceName,\n device_os: deviceInfo.systemName,\n device_osv: deviceInfo.systemVersion,\n device_locale: deviceInfo.deviceLocale,\n device_timezone: deviceInfo.deviceTimezone,\n bundle_id: deviceInfo.bundleId,\n bundle_version: deviceInfo.bundleVersion,\n allow_retargeting:\n deviceInfo.isAdTrackingEnabled,\n },\n this.deviceOs,\n this.apiEnv\n )\n .then((response) => {\n NativeModules.AdadaptedReactNativeSdk.storeCurrentSessionId(\n response.data.session_id\n );\n this.sessionId = response.data.session_id;\n this.sessionInfo = response.data;\n this.adZones = this.generateAdZones(\n response.data.zones\n );\n\n // Start the session data refresh timer.\n this.onRefreshAdZones();\n\n // Get all possible keyword intercept values.\n // We don't need to wait for this to complete\n // prior to resolving initialization of the SDK.\n this.getKeywordIntercepts();\n\n // Intercept an initial deep link here, if needed.\n Linking.getInitialURL().then((url) => {\n if (url) {\n // Pass in as an object so it mimics the \"url\"\n // property of the Linking.addEventListener(\"url\") method.\n this.handleDeepLink({\n url,\n });\n }\n });\n\n // Make the initial call to the Payload data server to see if\n // the user has any outstanding items to be added to list.\n this.getPayloadItemData();\n\n // Initialize an event listener to intercept deep links while the app is running.\n\n this.deepLinkOnEventListener = Linking.addEventListener(\n \"url\",\n this.handleDeepLink\n );\n\n // Initialize an event listener to intercept App state changes.\n\n this.AppStateOnEventListener = AppState.addEventListener(\n \"change\",\n this.handleAppStateChange\n );\n\n resolve();\n })\n .catch((err) => {\n reject(err);\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n /**\n * Searches through available ad keywords based on provided search term.\n * @param searchTerm - The search term used to match against\n * available keyword intercepts.\n * @returns all keyword intercept terms that matched the search term.\n */\n public performKeywordSearch(searchTerm: string): KeywordSearchResult[] {\n const finalResultListStartsWith: KeywordSearchResult[] = [];\n const finalResultListContains: KeywordSearchResult[] = [];\n\n this.keywordInterceptSearchValue = searchTerm;\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (\n searchTerm &&\n searchTerm.trim() &&\n searchTerm.trim().length >= this.keywordIntercepts.min_match_length\n ) {\n searchTerm = searchTerm.trim();\n\n const finalEventsList: ReportedInterceptEvent[] = [];\n const currentTs = this.getCurrentUnixTimestamp();\n\n // Search for matching terms.\n for (const termObj of this.keywordIntercepts.terms) {\n if (\n termObj.term\n .toLowerCase()\n .startsWith(searchTerm.toLowerCase())\n ) {\n // If the term starts with the search term,\n // add it to the finalResultListStartsWith list.\n finalResultListStartsWith.push(termObj);\n\n finalEventsList.push({\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.MATCHED,\n created_at: currentTs,\n });\n }\n }\n\n // Sort the final results by priority.\n finalResultListStartsWith.sort((a, b) =>\n a.priority > b.priority ? 1 : -1\n );\n finalResultListContains.sort((a, b) =>\n a.priority > b.priority ? 1 : -1\n );\n\n // If there are no events to report at this point,\n // we need to report the \"not_matched\" event.\n if (finalEventsList.length === 0) {\n finalEventsList.push({\n term_id: \"\",\n search_id: \"NA\",\n user_input: this.keywordInterceptSearchValue,\n term: \"NA\",\n event_type: ReportedEventType.NOT_MATCHED,\n created_at: currentTs,\n });\n }\n\n // Send up the \"matched\" event for the keyword search for\n // all terms that matched the users search.\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: finalEventsList,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n\n // The returned list will keep all terms found by matching the\n // beginning of the term string at the beginning of the list. All\n // terms found that didn't match the beginning of the string, but\n // still contained the search term will be concatenated to the end\n // of the list.\n return finalResultListStartsWith.concat(finalResultListContains);\n }\n\n /**\n * Client must trigger this method when a Keyword Intercept Term has\n * been \"selected\" by the user.\n * This will ensure that the event is properly recorded and enable\n * accuracy in client reports.\n * @param termId - The term ID to trigger the event for.\n */\n public reportKeywordInterceptTermSelected(termId: string): void {\n const termObj = this.getKeywordInterceptTerm(termId);\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (!termId || !termObj) {\n console.error(\"Invalid term ID provided.\");\n } else {\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: [\n {\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.SELECTED,\n created_at: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n }\n\n /**\n * Client must trigger this method when a Keyword Intercept Term has\n * been \"presented\" to the user. All terms that satisfy a search don't\n * have to be presented, so only provide term IDs for the terms that\n * ultimately get presented to the user.\n * This will ensure that the event is properly recorded and enable\n * accuracy in client reports.\n * @param termIds - The term IDs list to trigger the event for.\n */\n public reportKeywordInterceptTermsPresented(termIds: string[]): void {\n const termObjs: KeywordSearchTerm[] = [];\n\n for (const termId of termIds) {\n const termObj = this.getKeywordInterceptTerm(termId);\n\n if (termObj) {\n termObjs.push(termObj);\n }\n }\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (!termIds || termIds.length === 0 || termObjs.length === 0) {\n console.error(\"Invalid or empty terms ID list provided.\");\n } else {\n const termEvents: ReportedInterceptEvent[] = [];\n const currentTs = this.getCurrentUnixTimestamp();\n\n for (const termObj of termObjs) {\n termEvents.push({\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.PRESENTED,\n created_at: currentTs,\n });\n }\n\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: termEvents,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n }\n\n /**\n * Client must trigger this method when any items\n * are added to a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list to associate the items with, if any.\n */\n public reportItemsAddedToList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.ADDED_TO_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are crossed off a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list the items are associated with, if any.\n */\n public reportItemsCrossedOffList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.CROSSED_OFF_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list the items are associated with, if any.\n */\n public reportItemsDeletedFromList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.DELETED_FROM_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param payloadId - The payload ID that we want to acknowledge.\n */\n public markPayloadContentAcknowledged(payloadId: string): void {\n adadaptedApiRequests\n .reportPayloadContentStatus(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n tracking: [\n {\n payload_id: payloadId,\n status: PayloadStatus.DELIVERED,\n event_timestamp: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.payloadApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param payloadId - The payload ID that we want to acknowledge.\n */\n public markPayloadContentRejected(payloadId: string): void {\n adadaptedApiRequests\n .reportPayloadContentStatus(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n tracking: [\n {\n payload_id: payloadId,\n status: PayloadStatus.REJECTED,\n event_timestamp: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.payloadApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Performs all clean up tasks for the SDK. Call this method when\n * the component that references this SDK will \"unmount\", otherwise you\n * can experience memory leaks.\n */\n public unmount(): void {\n if (this.refreshAdZonesTimer) {\n clearTimeout(this.refreshAdZonesTimer);\n }\n\n if (this.deepLinkOnEventListener) {\n this.deepLinkOnEventListener.remove();\n }\n\n if (this.AppStateOnEventListener) {\n this.AppStateOnEventListener.remove();\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACIC,QAAQ,EAERC,OAA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AC;EACV;;EAEA;AACJ;AACA;AACA;AACA;EACWsJ,0BAA0B,CAACxG,SAAiB,EAAQ;IACvDjH,oBAAoB,CACfqN,0BAA0B,CACvB;MACIlH,MAAM,EAAE,IAAI,CAACjD,KAAK;MAClBgD,UAAU,EAAE,IAAI,CAACnF,SAAU;MAC3BoC,IAAI,EAAE,IAAI,CAAClC,UAAU,CAAEkC,IAAI;MAC3BmK,QAAQ,EAAE,CACN;QACIjG,UAAU,EAAEJ,SAAS;QACrBsG,MAAM,EAAEpN,aAAa,CAACuN,QAAQ;QAC9B5H,eAAe,EAAE,IAAI,CAACd,uBAAuB;MACjD,CAAC;IAET,CAAC,EACD,IAAI,CAACxD,aAAa,CACrB,CACAa,IAAI,EAAE,CACN8B,KAAK,CAAC,MAAM;MACT;IAAA,CACH,CAAC;EACV;;EAEA;AACJ;AACA;AACA;AACA;EACWpC,OAAO,GAAS;IACnB,IAAI,IAAI,CAAC4B,mBAAmB,EAAE;MAC1BgK,YAAY,CAAC,IAAI,CAAChK,mBAAmB,CAAC;IAC1C;IAEA,IAAI,IAAI,CAACiH,uBAAuB,EAAE;MAC9B,IAAI,CAACA,uBAAuB,CAACgD,MAAM,EAAE;IACzC;IAEA,IAAI,IAAI,CAAC9C,uBAAuB,EAAE;MAC9B,IAAI,CAACA,uBAAuB,CAAC8C,MAAM,EAAE;IACzC;EACJ;AACJ"}
|
|
1
|
+
{"version":3,"names":["React","AppState","DeviceEventEmitter","Linking","NativeModules","Platform","adadaptedApiRequests","ListManagerEventName","ListManagerEventSource","PayloadStatus","ReportedEventType","AdZone","safeInvoke","packageJson","base64","DeviceOS","ApiEnv","ListManagerApiEnv","PayloadApiEnv","AdadaptedReactNativeSdk","getSessionId","sessionId","getDeviceInfo","deviceInfo","getAdZones","adZones","constructor","apiEnv","Prod","listManagerApiEnv","payloadApiEnv","onAdZonesRefreshed","onAddToListTriggered","onOutOfAppPayloadAvailable","keywordInterceptSearchValue","initialize","bind","unmount","handleAppStateChange","handleDeepLink","getDeviceInformation","Promise","resolve","then","response","generateAdZones","adZoneInfoList","adZoneId","Object","prototype","hasOwnProperty","call","push","zoneId","id","adZone","appId","udid","deviceOs","xyAdZoneDragDistanceAllowed","items","onAdZoneVisibilityChanged","defaultAdZoneVisibility","onRefreshAdZones","timerMs","sessionInfo","polling_interval_ms","refreshAdZonesTimer","setTimeout","refreshSessionData","aid","sid","uid","data","zones","catch","err","console","error","getKeywordIntercepts","keywordIntercepts","getKeywordInterceptTerm","termId","term","termObj","terms","term_id","getCurrentUnixTimestamp","Math","round","Date","getTime","getListManagerApiRequestData","eventSource","eventName","itemNames","listName","eventList","itemName","event_source","event_name","event_timestamp","event_params","item_name","list_name","session_id","app_id","events","event","searchStr","dataIndex","indexOf","encodedData","url","substr","length","payloadData","JSON","parse","decode","payloadId","itemDataList","finalItemList","itemData","payload_id","detailed_list_items","product_title","product_brand","product_category","product_barcode","product_discount","product_image","product_sku","state","getPayloadItemData","retrievePayloadContent","payload","payloads","isVisible","isAdZoneVisible","emit","acknowledge","props","Dev","xyDragDistanceAllowed","defaultToInvisibleAdZone","reject","deviceInfoObj","systemName","IOS","ANDROID","OS","advertiserId","undefined","initializeSession","device_udid","sdk_version","version","device_width","parseInt","deviceWidth","device_height","deviceHeight","device_density","deviceScreenDensity","device_carrier","deviceCarrier","device_name","deviceName","device_os","device_osv","systemVersion","device_locale","deviceLocale","device_timezone","deviceTimezone","bundle_id","bundleId","bundle_version","bundleVersion","allow_retargeting","isAdTrackingEnabled","storeCurrentSessionId","getInitialURL","deepLinkOnEventListener","addEventListener","AppStateOnEventListener","performKeywordSearch","searchTerm","finalResultListStartsWith","finalResultListContains","trim","min_match_length","finalEventsList","currentTs","toLowerCase","startsWith","search_id","user_input","event_type","MATCHED","created_at","sort","a","b","priority","NOT_MATCHED","reportInterceptEvent","concat","reportKeywordInterceptTermSelected","SELECTED","reportKeywordInterceptTermsPresented","termIds","termObjs","termEvents","PRESENTED","reportItemsAddedToList","requestData","APP","ADDED_TO_LIST","reportListManagerEvents","reportItemsCrossedOffList","CROSSED_OFF_LIST","reportItemsDeletedFromList","DELETED_FROM_LIST","markPayloadContentAcknowledged","reportPayloadContentStatus","tracking","status","DELIVERED","markPayloadContentRejected","REJECTED","clearTimeout","remove"],"sources":["index.tsx"],"sourcesContent":["/**\n * The AdadaptedReactNativeSdk package/module definition.\n */\nimport * as React from \"react\";\nimport {\n AppState,\n DeviceEventEmitter,\n EmitterSubscription,\n Linking,\n NativeModules,\n Platform,\n} from \"react-native\";\nimport * as adadaptedApiRequests from \"./api/adadaptedApiRequests\";\nimport {\n AdSession,\n DetailedListItem,\n KeywordIntercepts,\n KeywordSearchTerm,\n ListManagerEvent,\n ListManagerEventName,\n ListManagerEventSource,\n OutOfAppDataPayload,\n PayloadStatus,\n ReportedEventType,\n ReportedInterceptEvent,\n ReportListManagerDataRequest,\n Zone,\n} from \"./api/adadaptedApiTypes\";\nimport { AdZone } from \"./components/AdZone\";\nimport { safeInvoke } from \"./util\";\nimport packageJson from \"../package.json\";\nimport base64 from \"react-native-base64\";\n\n/**\n * Enum representing possible device operating systems.\n */\nexport enum DeviceOS {\n /**\n * Represents the Android operating system.\n */\n ANDROID = \"android\",\n /**\n * Represents the iOS operating system.\n */\n IOS = \"ios\",\n}\n\n/**\n * Enum defining the different API environments.\n */\nexport enum ApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://ads.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandbox.adadapted.com\",\n /**\n * Used only for unit testing/mock data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Enum defining the different API environments for List Manager.\n */\nexport enum ListManagerApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://ec.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandec.adadapted.com\",\n /**\n * Used only for unit testing/mocking data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Enum defining the different API environments for the Payload Server.\n */\nexport enum PayloadApiEnv {\n /**\n * The production API environment.\n */\n Prod = \"https://payload.adadapted.com\",\n /**\n * The development API environment.\n */\n Dev = \"https://sandpayload.adadapted.com\",\n /**\n * Used only for unit testing/mocking data.\n */\n Mock = \"MOCK_DATA\",\n}\n\n/**\n * Interface defining inputs to the {@link Sdk.initialize} method.\n */\nexport interface InitializeProps {\n /**\n * The app ID provided by the client.\n */\n appId: string;\n /**\n * The API environment.\n * If undefined, defaults to production.\n */\n apiEnv?: ApiEnv;\n /**\n * Optional custom advertiserId to replace IDFA - ios only.\n */\n advertiserId?: string;\n /**\n * The touch sensitivity of the Ad Zone in both the X and Y directions.\n * This is used to determine the click/press sensitivity when the\n * Ad Zone is being touched by the user as a regular touch or while\n * scrolling the view. If the amount of touch \"drag\" distance in either\n * X or Y direction is less than this value, we will treat the action as\n * a click/press on the Ad Zone.\n */\n xyDragDistanceAllowed?: number;\n /**\n * Callback that gets triggered when the session/zones/ads data\n * gets refreshed and is now available for reference.\n */\n onAdZonesRefreshed?(): void;\n /**\n * Callback that gets triggered when an \"add to list\" item/items are clicked.\n * @param items - The array of items to \"add to list\".\n */\n onAddToListTriggered?(items: DetailedListItem[]): void;\n /**\n * Callback that gets triggered when an \"add to list\"\n * occurs by means of an \"out of app\" data payload.\n * @param payloads - All payloads the client must go through.\n */\n onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;\n /**\n * Change the optional ad zone visibility default setting.\n */\n defaultToInvisibleAdZone?: boolean;\n}\n\n/**\n * Interface defining properties of a user's Device.\n */\nexport interface DeviceInfo {\n /**\n * The unique device ID.\n */\n udid: string;\n /**\n * The device name.\n */\n deviceName: string;\n /**\n * The operating system name.\n */\n systemName: string;\n /**\n * The operating system version.\n */\n systemVersion: string;\n /**\n * The device model.\n */\n deviceModel: string;\n /**\n * The device screen width.\n */\n deviceWidth: string;\n /**\n * The device screen height.\n */\n deviceHeight: string;\n /**\n * The device screen density.\n */\n deviceScreenDensity: string;\n /**\n * The current device local.\n */\n deviceLocale: string;\n /**\n * The device carrier name.\n */\n deviceCarrier: string;\n /**\n * The bundle ID.\n */\n bundleId: string;\n /**\n * The bundle version.\n */\n bundleVersion: string;\n /**\n * The current device timezone.\n */\n deviceTimezone: string;\n /**\n * If true, ad tracking is enabled for the device.\n */\n isAdTrackingEnabled: boolean;\n}\n\n/**\n * Interface defining a wrapper for an {@link AdZone}.\n */\nexport interface AdZoneInfo {\n /**\n * The ad zone ID.\n */\n zoneId: string;\n /**\n * The ad zone component.\n */\n adZone: JSX.Element;\n}\n\n/**\n * Interface defining a keyword search result.\n * This is primarily used to export an interface directly from\n * {@link AdadaptedReactNativeSdk} so the interaction with the SDK all be\n * done through this namespace.\n */\nexport interface KeywordSearchResult extends KeywordSearchTerm {}\n\n/**\n * Class that acts as the AdAdapted SDK for react-native.\n */\nexport class AdadaptedReactNativeSdk {\n /**\n * The client app ID used to send to API endpoints.\n */\n private appId: string = \"\";\n /**\n * The API environment to use when making API calls.\n */\n private apiEnv: ApiEnv;\n /**\n * The API environment to use when making API calls for List Manager.\n */\n private listManagerApiEnv: ListManagerApiEnv;\n /**\n * The API environment to use when making API calls for the Payload server.\n */\n private payloadApiEnv: PayloadApiEnv;\n /**\n * The device operating system.\n */\n private deviceOs: DeviceOS | undefined;\n /**\n * The session ID used for the API to properly identify a user.\n */\n private sessionId: string | undefined;\n /**\n * All device data gathered when \"initialize\" is called.\n */\n private deviceInfo: DeviceInfo | undefined;\n /**\n * All current Session/Ad info.\n * This info can be refreshed based on the set interval.\n */\n private sessionInfo: AdSession | undefined;\n /**\n * The available ad zones.\n */\n private adZones: AdZoneInfo[] | undefined;\n /**\n * The touch sensitivity of the Ad Zone in both the X and Y directions.\n * This is used to determine the click/press sensitivity when the\n * Ad Zone is being touched by the user as a regular touch or while\n * scrolling the view. If the amount of touch \"drag\" distance in either\n * X or Y direction is less than this value, we will treat the action as\n * a click/press on the Ad Zone.\n */\n private xyAdZoneDragDistanceAllowed: number | undefined;\n /**\n * If provided, triggers when the overall session/zones/ads data is\n * refreshed and available for reference.\n */\n private onAdZonesRefreshed: () => void | undefined;\n /**\n * The current active \"setTimeout\" reference. This is needed so we\n * can reference this variable and clean up the timer when its no\n * longer needed so memory leaks do not occur.\n */\n private refreshAdZonesTimer: ReturnType<typeof setTimeout> | undefined;\n /**\n * The user input string provided by the client and used to return a\n * result of keyword intercept terms. This will always be the last\n * provided value.\n */\n private keywordInterceptSearchValue: string;\n /**\n * The current available keyword intercepts that can\n * be used when a search is provided by the user.\n */\n private keywordIntercepts: KeywordIntercepts | undefined;\n /**\n * If provided, triggers when an \"add to list\" item is\n * clicked in an ad zone.\n * @param items - The array of items to \"add to list\".\n * @param isExternalPayload - If true, the items are from an external payload.\n */\n private onAddToListTriggered: (\n items: DetailedListItem[],\n isExternalPayload?: boolean\n ) => void | undefined;\n /**\n * If provided, triggers when an \"add to list\"\n * occurs by means of an \"out of app\" data payload.\n * @param payloads - All payloads the client must go through.\n */\n private onOutOfAppPayloadAvailable: (\n payloads: OutOfAppDataPayload[]\n ) => void | undefined;\n /**\n * Deeplink event listener.\n */\n private deepLinkOnEventListener: EmitterSubscription | undefined;\n /**\n * AppState event listener.\n */\n private AppStateOnEventListener: EmitterSubscription | undefined;\n /**\n * Track ad zone visibility for off-screen ads.\n */\n private isAdZoneVisible: boolean = true;\n /**\n * Optional default ad zone visibility for off-screen ads.\n */\n private defaultAdZoneVisibility: boolean | undefined;\n /**\n * Gets the Session ID.\n * @returns the Session ID.\n */\n public getSessionId(): string | undefined {\n return this.sessionId;\n }\n\n /**\n * Gets the Device Info object.\n * @returns the Device Info object.\n */\n public getDeviceInfo(): DeviceInfo | undefined {\n return this.deviceInfo;\n }\n\n /**\n * Gets the list of available Ad Zones.\n * @returns all available ad zones.\n */\n public getAdZones(): AdZoneInfo[] | undefined {\n return this.adZones;\n }\n\n /**\n * @inheritDoc\n */\n constructor() {\n this.apiEnv = ApiEnv.Prod;\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n this.payloadApiEnv = PayloadApiEnv.Prod;\n this.onAdZonesRefreshed = () => {\n // Defaulting to empty method.\n };\n this.onAddToListTriggered = () => {\n // Defaulting to empty method.\n };\n this.onOutOfAppPayloadAvailable = () => {\n // Defaulting to empty method.\n };\n this.keywordInterceptSearchValue = \"\";\n\n this.initialize = this.initialize.bind(this);\n this.unmount = this.unmount.bind(this);\n this.handleAppStateChange = this.handleAppStateChange.bind(this);\n this.handleDeepLink = this.handleDeepLink.bind(this);\n }\n\n /**\n * Gets the users device info.\n * @returns a Promise of void.\n */\n private getDeviceInformation(): Promise<string> {\n return new Promise<string>((resolve) => {\n NativeModules.AdadaptedReactNativeSdk.getDeviceInfo().then(\n (response: string) => {\n resolve(response);\n }\n );\n });\n }\n\n /**\n * Creates all Ad Zone Info objects based on provided Ad Zones.\n * @param adZones - The object of available zones.\n * @returns the array of Ad Zone Info objects.\n */\n private generateAdZones(adZones: { [key: number]: Zone }): AdZoneInfo[] {\n const adZoneInfoList: AdZoneInfo[] = [];\n\n for (const adZoneId in adZones) {\n if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {\n adZoneInfoList.push({\n zoneId: adZones[adZoneId].id,\n adZone: (\n <AdZone\n key={adZoneId}\n appId={this.appId}\n sessionId={this.sessionId!}\n udid={this.deviceInfo!.udid}\n deviceOs={this.deviceOs!}\n apiEnv={this.apiEnv}\n xyDragDistanceAllowed={\n this.xyAdZoneDragDistanceAllowed || 25\n }\n adZoneData={adZones[adZoneId]}\n onAddToListTriggered={(items) => {\n safeInvoke(this.onAddToListTriggered, items);\n }}\n isAdZoneVisible={!this.onAdZoneVisibilityChanged}\n defaultToInvisibleAdZone={\n this.defaultAdZoneVisibility\n }\n />\n ),\n });\n }\n }\n\n return adZoneInfoList;\n }\n\n /**\n * Triggered when session data is initialized or refreshed. Creates\n * a timer based on the session data refresh value.\n */\n private onRefreshAdZones(): void {\n // Get the amount of time we will wait until a refresh occurs.\n // We are setting a minimum refresh time of 5 minutes, so if a\n // value provided by the API is lower, we don't refresh too often.\n const timerMs =\n this.sessionInfo!.polling_interval_ms >= 300000\n ? this.sessionInfo!.polling_interval_ms\n : 300000;\n\n this.refreshAdZonesTimer = setTimeout(() => {\n adadaptedApiRequests\n .refreshSessionData(\n {\n aid: this.appId,\n sid: this.sessionId!,\n uid: this.deviceInfo!.udid,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then((response) => {\n this.sessionInfo = response.data;\n this.adZones = this.generateAdZones(response.data.zones);\n\n // Call the user defined callback indicating\n // the session data has been refreshed.\n this.onAdZonesRefreshed();\n\n // Start the timer again based on the new session data.\n this.onRefreshAdZones();\n })\n .catch((err) => {\n console.error(err);\n\n // Start the timer again so we can make another\n // attempt to refresh the session data.\n this.onRefreshAdZones();\n });\n }, timerMs);\n }\n\n /**\n * Trigger an API request to get all possible\n * keyword intercepts for the session.\n */\n private getKeywordIntercepts(): void {\n adadaptedApiRequests\n .getKeywordIntercepts(\n {\n aid: this.appId,\n sid: this.sessionId!,\n uid: this.deviceInfo!.udid,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then((response) => {\n this.keywordIntercepts = response.data;\n });\n }\n\n /**\n * Gets the Keyword Intercept Term based on the provided term ID.\n * @param termId - The term ID to get the term object for.\n * @returns the term if it was found based on the provided term ID.\n */\n private getKeywordInterceptTerm(\n termId: string\n ): KeywordSearchTerm | undefined {\n let term: KeywordSearchTerm | undefined;\n\n if (this.keywordIntercepts && termId) {\n for (const termObj of this.keywordIntercepts.terms) {\n if (termObj.term_id === termId) {\n term = termObj;\n }\n }\n }\n\n return term;\n }\n\n /**\n * Gets the current unix timestamp.\n * @returns the current unix timestamp.\n */\n private getCurrentUnixTimestamp(): number {\n return Math.round(new Date().getTime() / 1000);\n }\n\n /**\n * Gets all data needed to make a List Manager API request.\n * @param eventSource - The event source.\n * @param eventName - The event name.\n * @param itemNames - The items to report.\n * @param listName - The list associated to the items, if any.\n * @returns the data required for the request.\n */\n private getListManagerApiRequestData(\n eventSource: ListManagerEventSource,\n eventName: ListManagerEventName,\n itemNames: string[],\n listName?: string\n ): ReportListManagerDataRequest {\n const eventList: ListManagerEvent[] = [];\n\n for (const itemName of itemNames) {\n eventList.push({\n event_source: eventSource,\n event_name: eventName,\n event_timestamp: this.getCurrentUnixTimestamp(),\n event_params: {\n item_name: itemName,\n list_name: listName,\n },\n });\n }\n\n return {\n session_id: this.sessionId!,\n app_id: this.appId,\n udid: this.deviceInfo!.udid,\n events: eventList,\n };\n }\n\n /**\n * Takes the deep link URL and extracts out the payload items data to\n * send to the client for adding to a user's list.\n * @param event - The event containing URL related info.\n */\n private handleDeepLink(event: any): void {\n const searchStr = \"data=\";\n const dataIndex: number = event[\"url\"].indexOf(searchStr);\n\n if (dataIndex !== -1) {\n const encodedData = event.url.substr(dataIndex + searchStr.length);\n const payloadData = JSON.parse(base64.decode(encodedData));\n const payloadId = payloadData[\"payload_id\"];\n const itemDataList = payloadData[\"detailed_list_items\"];\n\n if (itemDataList && itemDataList.length > 0) {\n const finalItemList: OutOfAppDataPayload[] = [];\n\n for (const itemData of itemDataList) {\n finalItemList.push({\n payload_id: payloadId,\n detailed_list_items: [\n {\n product_title: itemData[\"product_title\"],\n product_brand: itemData[\"product_brand\"],\n product_category: itemData[\"product_category\"],\n product_barcode: itemData[\"product_barcode\"],\n product_discount: itemData[\"product_discount\"],\n product_image: itemData[\"product_image\"],\n product_sku: itemData[\"product_sku\"],\n },\n ],\n });\n }\n\n // Send the items to the client, so they can add them to the list.\n safeInvoke(this.onOutOfAppPayloadAvailable, finalItemList);\n }\n }\n }\n\n /**\n * Triggered when the state of the app changes.\n * @param state - The current state of the app.\n */\n private handleAppStateChange(state: string): void {\n if (state === \"active\") {\n this.getPayloadItemData();\n }\n }\n\n /**\n * Gets all available Payload server item data for the user.\n */\n private getPayloadItemData(): void {\n adadaptedApiRequests\n .retrievePayloadContent(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n },\n this.payloadApiEnv\n )\n .then((response) => {\n const finalItemList: OutOfAppDataPayload[] = [];\n\n for (const payload of response.data.payloads) {\n for (const itemData of payload.detailed_list_items) {\n finalItemList.push({\n payload_id: payload.payload_id,\n detailed_list_items: [\n {\n product_title: itemData[\"product_title\"],\n product_brand: itemData[\"product_brand\"],\n product_category:\n itemData[\"product_category\"],\n product_barcode:\n itemData[\"product_barcode\"],\n product_discount:\n itemData[\"product_discount\"],\n product_image: itemData[\"product_image\"],\n product_sku: itemData[\"product_sku\"],\n },\n ],\n });\n }\n }\n\n // Send the items to the client, so they can add them to the list.\n safeInvoke(this.onOutOfAppPayloadAvailable, finalItemList);\n })\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Notify the ad zone of visibility status change for off-screen ads.\n */\n public onAdZoneVisibilityChanged(): void {\n const isVisible = !this.isAdZoneVisible;\n this.isAdZoneVisible = isVisible;\n DeviceEventEmitter.emit(\"visibility-event\", isVisible);\n }\n\n /**\n * Notify the adZone to send ad interaction report.\n * @param itemName - Detailed list item title from ad that was clicked.\n */\n public acknowledge(itemName: string): void {\n DeviceEventEmitter.emit(\"acknowledge\", itemName);\n }\n\n /**\n * Initializes the session for the AdAdapted API and sets up the SDK.\n * @param props - The props used to initialize the SDK.\n * @returns a Promise of void.\n */\n public initialize(props: InitializeProps): Promise<void> {\n // Set the app ID.\n this.appId = props.appId;\n\n // Set the API environment based on the provided override value.\n // If the apiEnv value is not provided, production will be used as default.\n if (props.apiEnv) {\n this.apiEnv = props.apiEnv;\n } else {\n this.apiEnv = ApiEnv.Prod;\n }\n\n // Base the List Manager API environment off what\n // the user provides for the props.apiEnv value.\n if (props.apiEnv) {\n if (props.apiEnv === ApiEnv.Prod) {\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n } else {\n this.listManagerApiEnv = ListManagerApiEnv.Dev;\n }\n } else {\n this.listManagerApiEnv = ListManagerApiEnv.Prod;\n }\n\n // The ad zone touch drag sensitivity setting.\n if (props.xyDragDistanceAllowed) {\n this.xyAdZoneDragDistanceAllowed = props.xyDragDistanceAllowed;\n }\n\n // If the callback for onAdZonesRefreshed was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onAdZonesRefreshed) {\n this.onAdZonesRefreshed = props.onAdZonesRefreshed;\n }\n\n // If the callback for onAddToListTriggered was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onAddToListTriggered) {\n this.onAddToListTriggered = props.onAddToListTriggered;\n }\n\n // If the callback for onOutOfAppPayloadAvailable was provided, set it\n // globally for use when the method needs to be triggered.\n if (props.onOutOfAppPayloadAvailable) {\n this.onOutOfAppPayloadAvailable = props.onOutOfAppPayloadAvailable;\n }\n\n // If provided for off-screen ads, set the ad zone visibility for ad tracking.\n if (props.defaultToInvisibleAdZone) {\n this.defaultAdZoneVisibility = props.defaultToInvisibleAdZone;\n this.onAdZoneVisibilityChanged();\n }\n\n return new Promise<void>((resolve, reject) => {\n this.getDeviceInformation()\n .then((deviceInfoObj) => {\n const deviceInfo = JSON.parse(deviceInfoObj) as DeviceInfo;\n this.deviceInfo = deviceInfo;\n this.deviceOs =\n deviceInfo.systemName === \"ios\"\n ? DeviceOS.IOS\n : DeviceOS.ANDROID;\n // Pass custom advertiserId - ios only\n if (Platform.OS === \"ios\") {\n if (!(props.advertiserId === undefined)) {\n deviceInfo.udid = props.advertiserId;\n }\n }\n // Pass device info along with API call\n adadaptedApiRequests\n .initializeSession(\n {\n app_id: this.appId,\n udid: deviceInfo.udid,\n device_udid: deviceInfo.udid,\n sdk_version: packageJson.version,\n device_width: parseInt(\n deviceInfo.deviceWidth,\n 10\n ),\n device_height: parseInt(\n deviceInfo.deviceHeight,\n 10\n ),\n device_density: deviceInfo.deviceScreenDensity,\n device_carrier: deviceInfo.deviceCarrier,\n device_name: deviceInfo.deviceName,\n device_os: deviceInfo.systemName,\n device_osv: deviceInfo.systemVersion,\n device_locale: deviceInfo.deviceLocale,\n device_timezone: deviceInfo.deviceTimezone,\n bundle_id: deviceInfo.bundleId,\n bundle_version: deviceInfo.bundleVersion,\n allow_retargeting:\n deviceInfo.isAdTrackingEnabled,\n },\n this.deviceOs,\n this.apiEnv\n )\n .then((response) => {\n NativeModules.AdadaptedReactNativeSdk.storeCurrentSessionId(\n response.data.session_id\n );\n this.sessionId = response.data.session_id;\n this.sessionInfo = response.data;\n this.adZones = this.generateAdZones(\n response.data.zones\n );\n\n // Start the session data refresh timer.\n this.onRefreshAdZones();\n\n // Get all possible keyword intercept values.\n // We don't need to wait for this to complete\n // prior to resolving initialization of the SDK.\n this.getKeywordIntercepts();\n\n // Intercept an initial deep link here, if needed.\n Linking.getInitialURL().then((url) => {\n if (url) {\n // Pass in as an object so it mimics the \"url\"\n // property of the Linking.addEventListener(\"url\") method.\n this.handleDeepLink({\n url,\n });\n }\n });\n\n // Make the initial call to the Payload data server to see if\n // the user has any outstanding items to be added to list.\n this.getPayloadItemData();\n\n // Initialize an event listener to intercept deep links while the app is running.\n\n this.deepLinkOnEventListener = Linking.addEventListener(\n \"url\",\n this.handleDeepLink\n );\n\n // Initialize an event listener to intercept App state changes.\n\n this.AppStateOnEventListener = AppState.addEventListener(\n \"change\",\n this.handleAppStateChange\n );\n\n resolve();\n })\n .catch((err) => {\n reject(err);\n });\n })\n .catch((err) => {\n reject(err);\n });\n });\n }\n\n /**\n * Searches through available ad keywords based on provided search term.\n * @param searchTerm - The search term used to match against\n * available keyword intercepts.\n * @returns all keyword intercept terms that matched the search term.\n */\n public performKeywordSearch(searchTerm: string): KeywordSearchResult[] {\n const finalResultListStartsWith: KeywordSearchResult[] = [];\n const finalResultListContains: KeywordSearchResult[] = [];\n\n this.keywordInterceptSearchValue = searchTerm;\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (\n searchTerm &&\n searchTerm.trim() &&\n searchTerm.trim().length >= this.keywordIntercepts.min_match_length\n ) {\n searchTerm = searchTerm.trim();\n\n const finalEventsList: ReportedInterceptEvent[] = [];\n const currentTs = this.getCurrentUnixTimestamp();\n\n // Search for matching terms.\n for (const termObj of this.keywordIntercepts.terms) {\n if (\n termObj.term\n .toLowerCase()\n .startsWith(searchTerm.toLowerCase())\n ) {\n // If the term starts with the search term,\n // add it to the finalResultListStartsWith list.\n finalResultListStartsWith.push(termObj);\n\n finalEventsList.push({\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.MATCHED,\n created_at: currentTs,\n });\n }\n }\n\n // Sort the final results by priority.\n finalResultListStartsWith.sort((a, b) =>\n a.priority > b.priority ? 1 : -1\n );\n finalResultListContains.sort((a, b) =>\n a.priority > b.priority ? 1 : -1\n );\n\n // If there are no events to report at this point,\n // we need to report the \"not_matched\" event.\n if (finalEventsList.length === 0) {\n finalEventsList.push({\n term_id: \"\",\n search_id: \"NA\",\n user_input: this.keywordInterceptSearchValue,\n term: \"NA\",\n event_type: ReportedEventType.NOT_MATCHED,\n created_at: currentTs,\n });\n }\n\n // Send up the \"matched\" event for the keyword search for\n // all terms that matched the users search.\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: finalEventsList,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n\n // The returned list will keep all terms found by matching the\n // beginning of the term string at the beginning of the list. All\n // terms found that didn't match the beginning of the string, but\n // still contained the search term will be concatenated to the end\n // of the list.\n return finalResultListStartsWith.concat(finalResultListContains);\n }\n\n /**\n * Client must trigger this method when a Keyword Intercept Term has\n * been \"selected\" by the user.\n * This will ensure that the event is properly recorded and enable\n * accuracy in client reports.\n * @param termId - The term ID to trigger the event for.\n */\n public reportKeywordInterceptTermSelected(termId: string): void {\n const termObj = this.getKeywordInterceptTerm(termId);\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (!termId || !termObj) {\n console.error(\"Invalid term ID provided.\");\n } else {\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: [\n {\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.SELECTED,\n created_at: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n }\n\n /**\n * Client must trigger this method when a Keyword Intercept Term has\n * been \"presented\" to the user. All terms that satisfy a search don't\n * have to be presented, so only provide term IDs for the terms that\n * ultimately get presented to the user.\n * This will ensure that the event is properly recorded and enable\n * accuracy in client reports.\n * @param termIds - The term IDs list to trigger the event for.\n */\n public reportKeywordInterceptTermsPresented(termIds: string[]): void {\n const termObjs: KeywordSearchTerm[] = [];\n\n for (const termId of termIds) {\n const termObj = this.getKeywordInterceptTerm(termId);\n\n if (termObj) {\n termObjs.push(termObj);\n }\n }\n\n if (!this.deviceInfo || !this.sessionId) {\n console.error(\"AdAdapted SDK has not been initialized.\");\n } else if (!this.keywordIntercepts) {\n console.error(\"No available keyword intercepts.\");\n } else if (!termIds || termIds.length === 0 || termObjs.length === 0) {\n console.error(\"Invalid or empty terms ID list provided.\");\n } else {\n const termEvents: ReportedInterceptEvent[] = [];\n const currentTs = this.getCurrentUnixTimestamp();\n\n for (const termObj of termObjs) {\n termEvents.push({\n term_id: termObj.term_id,\n search_id: this.keywordIntercepts.search_id,\n user_input: this.keywordInterceptSearchValue,\n term: termObj.term,\n event_type: ReportedEventType.PRESENTED,\n created_at: currentTs,\n });\n }\n\n adadaptedApiRequests\n .reportInterceptEvent(\n {\n app_id: this.appId,\n udid: this.deviceInfo.udid,\n session_id: this.sessionId,\n events: termEvents,\n },\n this.deviceOs!,\n this.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n }\n\n /**\n * Client must trigger this method when any items\n * are added to a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list to associate the items with, if any.\n */\n public reportItemsAddedToList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.ADDED_TO_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are crossed off a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list the items are associated with, if any.\n */\n public reportItemsCrossedOffList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.CROSSED_OFF_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param itemNames - The items to report.\n * @param listName - The list the items are associated with, if any.\n */\n public reportItemsDeletedFromList(\n itemNames: string[],\n listName?: string\n ): void {\n const requestData = this.getListManagerApiRequestData(\n ListManagerEventSource.APP,\n ListManagerEventName.DELETED_FROM_LIST,\n itemNames,\n listName\n );\n\n adadaptedApiRequests\n .reportListManagerEvents(\n requestData,\n this.deviceOs!,\n this.listManagerApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param payloadId - The payload ID that we want to acknowledge.\n */\n public markPayloadContentAcknowledged(payloadId: string): void {\n adadaptedApiRequests\n .reportPayloadContentStatus(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n tracking: [\n {\n payload_id: payloadId,\n status: PayloadStatus.DELIVERED,\n event_timestamp: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.payloadApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Client must trigger this method when any items\n * are deleted from a list for reports we provide to the client.\n * @param payloadId - The payload ID that we want to acknowledge.\n */\n public markPayloadContentRejected(payloadId: string): void {\n adadaptedApiRequests\n .reportPayloadContentStatus(\n {\n app_id: this.appId,\n session_id: this.sessionId!,\n udid: this.deviceInfo!.udid,\n tracking: [\n {\n payload_id: payloadId,\n status: PayloadStatus.REJECTED,\n event_timestamp: this.getCurrentUnixTimestamp(),\n },\n ],\n },\n this.payloadApiEnv\n )\n .then()\n .catch(() => {\n // Do nothing.\n });\n }\n\n /**\n * Performs all clean up tasks for the SDK. Call this method when\n * the component that references this SDK will \"unmount\", otherwise you\n * can experience memory leaks.\n */\n public unmount(): void {\n if (this.refreshAdZonesTimer) {\n clearTimeout(this.refreshAdZonesTimer);\n }\n\n if (this.deepLinkOnEventListener) {\n this.deepLinkOnEventListener.remove();\n }\n\n if (this.AppStateOnEventListener) {\n this.AppStateOnEventListener.remove();\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACIC,QAAQ,EACRC,kBAAkB,EAElBC,OAAO,EACPC,aAAa,EACbC,QAAQ,QACL,cAAc;AACrB,OAAO,KAAKC,oBAAoB,MAAM,4BAA4B;AAClE,SAMIC,oBAAoB,EACpBC,sBAAsB,EAEtBC,aAAa,EACbC,iBAAiB,QAId,yBAAyB;AAChC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,QAAQ;AACnC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,qBAAqB;;AAExC;AACA;AACA;AACA,WAAYC,QAAQ;;AAWpB;AACA;AACA;AAFA,WAXYA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AAU,EAAEJ,SAAS;QACrB4G,MAAM,EAAE3N,aAAa,CAAC4N,SAAS;QAC/BhI,eAAe,EAAE,IAAI,CAACd,uBAAuB;MACjD,CAAC;IAET,CAAC,EACD,IAAI,CAACzD,aAAa,CACrB,CACAa,IAAI,EAAE,CACNgC,KAAK,CAAC,MAAM;MACT;IAAA,CACH,CAAC;EACV;;EAEA;AACJ;AACA;AACA;AACA;EACW2J,0BAA0B,CAAC9G,SAAiB,EAAQ;IACvDlH,oBAAoB,CACf4N,0BAA0B,CACvB;MACIxH,MAAM,EAAE,IAAI,CAAClD,KAAK;MAClBiD,UAAU,EAAE,IAAI,CAACpF,SAAU;MAC3BoC,IAAI,EAAE,IAAI,CAAClC,UAAU,CAAEkC,IAAI;MAC3B0K,QAAQ,EAAE,CACN;QACIvG,UAAU,EAAEJ,SAAS;QACrB4G,MAAM,EAAE3N,aAAa,CAAC8N,QAAQ;QAC9BlI,eAAe,EAAE,IAAI,CAACd,uBAAuB;MACjD,CAAC;IAET,CAAC,EACD,IAAI,CAACzD,aAAa,CACrB,CACAa,IAAI,EAAE,CACNgC,KAAK,CAAC,MAAM;MACT;IAAA,CACH,CAAC;EACV;;EAEA;AACJ;AACA;AACA;AACA;EACWtC,OAAO,GAAS;IACnB,IAAI,IAAI,CAAC8B,mBAAmB,EAAE;MAC1BqK,YAAY,CAAC,IAAI,CAACrK,mBAAmB,CAAC;IAC1C;IAEA,IAAI,IAAI,CAACqH,uBAAuB,EAAE;MAC9B,IAAI,CAACA,uBAAuB,CAACiD,MAAM,EAAE;IACzC;IAEA,IAAI,IAAI,CAAC/C,uBAAuB,EAAE;MAC9B,IAAI,CAACA,uBAAuB,CAAC+C,MAAM,EAAE;IACzC;EACJ;AACJ"}
|
|
@@ -2,75 +2,8 @@
|
|
|
2
2
|
* Test app component for testing the
|
|
3
3
|
* {@link AdadaptedReactNativeSdk} package/module.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import { AdZoneInfo, KeywordSearchResult } from "../../src/index";
|
|
7
|
-
/**
|
|
8
|
-
* Props interface for {@link App}.
|
|
9
|
-
*/
|
|
10
|
-
interface Props {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* State interface for {@link App}.
|
|
14
|
-
*/
|
|
15
|
-
interface State {
|
|
16
|
-
/**
|
|
17
|
-
* The session ID.
|
|
18
|
-
*/
|
|
19
|
-
sessionId: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* The Ad Zone Info list.
|
|
22
|
-
*/
|
|
23
|
-
adZoneInfoList: AdZoneInfo[] | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The test search term value.
|
|
26
|
-
*/
|
|
27
|
-
searchValue: string;
|
|
28
|
-
/**
|
|
29
|
-
* Standard products search result item list.
|
|
30
|
-
*/
|
|
31
|
-
standardProductSearchResultItemList: string[];
|
|
32
|
-
/**
|
|
33
|
-
* AdAdapted SDK Keyword Search result item list.
|
|
34
|
-
*/
|
|
35
|
-
aasdkSearchResultItemList: KeywordSearchResult[];
|
|
36
|
-
/**
|
|
37
|
-
* The selected item list.
|
|
38
|
-
*/
|
|
39
|
-
selectedItemList: string[];
|
|
40
|
-
}
|
|
5
|
+
import { FC } from "react";
|
|
41
6
|
/**
|
|
42
7
|
* Creates the main component for the App.
|
|
43
8
|
*/
|
|
44
|
-
export declare
|
|
45
|
-
/**
|
|
46
|
-
* The {@link AdadaptedReactNativeSdk} instance.
|
|
47
|
-
*/
|
|
48
|
-
private readonly aaSdk;
|
|
49
|
-
/**
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
constructor(props: Props, context?: any);
|
|
53
|
-
/**
|
|
54
|
-
* @inheritDoc
|
|
55
|
-
*/
|
|
56
|
-
componentDidMount(): void;
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
componentWillUnmount(): void;
|
|
61
|
-
/**
|
|
62
|
-
* @inheritDoc
|
|
63
|
-
*/
|
|
64
|
-
render(): JSX.Element;
|
|
65
|
-
/**
|
|
66
|
-
* Triggered when the search text field's value has changed.
|
|
67
|
-
* @param searchValue - The search string.
|
|
68
|
-
*/
|
|
69
|
-
private handleOnSearchValueChanged;
|
|
70
|
-
/**
|
|
71
|
-
* Adds the selected item to the selected item list.
|
|
72
|
-
* @param selectedItem - The item to select.
|
|
73
|
-
*/
|
|
74
|
-
private selectItem;
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
9
|
+
export declare const App: FC;
|
|
@@ -103,6 +103,10 @@ export interface Ad {
|
|
|
103
103
|
* ?
|
|
104
104
|
*/
|
|
105
105
|
payload: AdPayload;
|
|
106
|
+
/**
|
|
107
|
+
* Track impression status.
|
|
108
|
+
*/
|
|
109
|
+
impression_tracked?: boolean;
|
|
106
110
|
}
|
|
107
111
|
/**
|
|
108
112
|
* The definition of an Ad Payload.
|
|
@@ -389,6 +393,10 @@ export declare enum ReportedEventType {
|
|
|
389
393
|
* Occurs when an ad is displayed to the user.
|
|
390
394
|
*/
|
|
391
395
|
IMPRESSION = "impression",
|
|
396
|
+
/**
|
|
397
|
+
* Occurs when an ad is not viewable before timimg out.
|
|
398
|
+
*/
|
|
399
|
+
INVISIBLE_IMPRESSION = "invisible_impression",
|
|
392
400
|
/**
|
|
393
401
|
* Occurs when the user interacts with an ad.
|
|
394
402
|
*/
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Component for creating an {@link AdZone}.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import * as React from "react";
|
|
1
|
+
/// <reference types="react" />
|
|
6
2
|
import { DetailedListItem, Zone } from "../api/adadaptedApiTypes";
|
|
7
3
|
import { ApiEnv, DeviceOS } from "../index";
|
|
8
4
|
/**
|
|
@@ -47,87 +43,19 @@ interface Props {
|
|
|
47
43
|
* @param items - The array of items to "add to list".
|
|
48
44
|
*/
|
|
49
45
|
onAddToListTriggered?(items: DetailedListItem[]): void;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* State interface for {@link AdZone}.
|
|
53
|
-
*/
|
|
54
|
-
interface State {
|
|
55
|
-
/**
|
|
56
|
-
* Tracks the current ad index being shown.
|
|
57
|
-
*/
|
|
58
|
-
adIndexShown: number;
|
|
59
|
-
/**
|
|
60
|
-
* Tracks the coordinates when the user started touching the Ad View.
|
|
61
|
-
*/
|
|
62
|
-
touchStartCoords: TouchCoordinates | undefined;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Interface for tracking "touch" coordinates.
|
|
66
|
-
*/
|
|
67
|
-
interface TouchCoordinates {
|
|
68
46
|
/**
|
|
69
|
-
*
|
|
47
|
+
* Track the ad zone visibility in parent component.
|
|
70
48
|
*/
|
|
71
|
-
|
|
49
|
+
isAdZoneVisible?: boolean;
|
|
72
50
|
/**
|
|
73
|
-
*
|
|
51
|
+
* Set default ad zone visibility to false.
|
|
74
52
|
*/
|
|
75
|
-
|
|
53
|
+
defaultToInvisibleAdZone?: boolean;
|
|
76
54
|
}
|
|
77
55
|
/**
|
|
78
56
|
* Creates the AdZone component.
|
|
57
|
+
* @param props - properties passed to AdZone.
|
|
58
|
+
* @returns an AdZone JSX Element.
|
|
79
59
|
*/
|
|
80
|
-
export declare
|
|
81
|
-
/**
|
|
82
|
-
* Timer used for cycling through ads in the zone
|
|
83
|
-
* based on the ad "refresh time" for each ad.
|
|
84
|
-
*/
|
|
85
|
-
private cycleAdTimer;
|
|
86
|
-
/**
|
|
87
|
-
* @inheritDoc
|
|
88
|
-
*/
|
|
89
|
-
constructor(props: Props, context?: any);
|
|
90
|
-
/**
|
|
91
|
-
* @inheritDoc
|
|
92
|
-
*/
|
|
93
|
-
componentDidMount(): void;
|
|
94
|
-
/**
|
|
95
|
-
* @inheritDoc
|
|
96
|
-
*/
|
|
97
|
-
componentWillUnmount(): void;
|
|
98
|
-
/**
|
|
99
|
-
* @inheritDoc
|
|
100
|
-
*/
|
|
101
|
-
render(): JSX.Element;
|
|
102
|
-
/**
|
|
103
|
-
* Triggers when the user selects the ad zone.
|
|
104
|
-
* @param currentAd - The ad currently displayed.
|
|
105
|
-
*/
|
|
106
|
-
private onAdZoneSelected;
|
|
107
|
-
/**
|
|
108
|
-
* Triggered when we need to report an ad event to the API.
|
|
109
|
-
* @param currentAd - The ad to send an event for.
|
|
110
|
-
* @param eventType - The event type for the reported event.
|
|
111
|
-
*/
|
|
112
|
-
private triggerReportAdEvent;
|
|
113
|
-
/**
|
|
114
|
-
* Generates a new timer for cycling to the next ad.
|
|
115
|
-
* @param timerLength - The length of time(in milliseconds) to initialize
|
|
116
|
-
* the timer with.
|
|
117
|
-
*/
|
|
118
|
-
private createAdTimer;
|
|
119
|
-
/**
|
|
120
|
-
* Cycles to the next ad to display in the current available sequence of ads.
|
|
121
|
-
*/
|
|
122
|
-
private cycleDisplayedAd;
|
|
123
|
-
/**
|
|
124
|
-
* Performs all ad initialization tasks when a new ad is being displayed.
|
|
125
|
-
*/
|
|
126
|
-
private initializeAd;
|
|
127
|
-
/**
|
|
128
|
-
* Generates all component related styles.
|
|
129
|
-
* @returns the styles needed for the component.
|
|
130
|
-
*/
|
|
131
|
-
private generateStyles;
|
|
132
|
-
}
|
|
60
|
+
export declare function AdZone(props: Props): JSX.Element;
|
|
133
61
|
export {};
|
|
@@ -106,6 +106,10 @@ export interface InitializeProps {
|
|
|
106
106
|
* @param payloads - All payloads the client must go through.
|
|
107
107
|
*/
|
|
108
108
|
onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;
|
|
109
|
+
/**
|
|
110
|
+
* Change the optional ad zone visibility default setting.
|
|
111
|
+
*/
|
|
112
|
+
defaultToInvisibleAdZone?: boolean;
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
115
|
* Interface defining properties of a user's Device.
|
|
@@ -282,6 +286,14 @@ export declare class AdadaptedReactNativeSdk {
|
|
|
282
286
|
* AppState event listener.
|
|
283
287
|
*/
|
|
284
288
|
private AppStateOnEventListener;
|
|
289
|
+
/**
|
|
290
|
+
* Track ad zone visibility for off-screen ads.
|
|
291
|
+
*/
|
|
292
|
+
private isAdZoneVisible;
|
|
293
|
+
/**
|
|
294
|
+
* Optional default ad zone visibility for off-screen ads.
|
|
295
|
+
*/
|
|
296
|
+
private defaultAdZoneVisibility;
|
|
285
297
|
/**
|
|
286
298
|
* Gets the Session ID.
|
|
287
299
|
* @returns the Session ID.
|
|
@@ -357,6 +369,15 @@ export declare class AdadaptedReactNativeSdk {
|
|
|
357
369
|
* Gets all available Payload server item data for the user.
|
|
358
370
|
*/
|
|
359
371
|
private getPayloadItemData;
|
|
372
|
+
/**
|
|
373
|
+
* Notify the ad zone of visibility status change for off-screen ads.
|
|
374
|
+
*/
|
|
375
|
+
onAdZoneVisibilityChanged(): void;
|
|
376
|
+
/**
|
|
377
|
+
* Notify the adZone to send ad interaction report.
|
|
378
|
+
* @param itemName - Detailed list item title from ad that was clicked.
|
|
379
|
+
*/
|
|
380
|
+
acknowledge(itemName: string): void;
|
|
360
381
|
/**
|
|
361
382
|
* Initializes the session for the AdAdapted API and sets up the SDK.
|
|
362
383
|
* @param props - The props used to initialize the SDK.
|
package/package.json
CHANGED
|
@@ -106,6 +106,10 @@ export interface Ad {
|
|
|
106
106
|
* ?
|
|
107
107
|
*/
|
|
108
108
|
payload: AdPayload;
|
|
109
|
+
/**
|
|
110
|
+
* Track impression status.
|
|
111
|
+
*/
|
|
112
|
+
impression_tracked?: boolean;
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
/**
|
|
@@ -406,6 +410,10 @@ export enum ReportedEventType {
|
|
|
406
410
|
* Occurs when an ad is displayed to the user.
|
|
407
411
|
*/
|
|
408
412
|
IMPRESSION = "impression",
|
|
413
|
+
/**
|
|
414
|
+
* Occurs when an ad is not viewable before timimg out.
|
|
415
|
+
*/
|
|
416
|
+
INVISIBLE_IMPRESSION = "invisible_impression",
|
|
409
417
|
/**
|
|
410
418
|
* Occurs when the user interacts with an ad.
|
|
411
419
|
*/
|