@adadapted/react-native-sdk 3.2.0 → 3.4.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.
Files changed (72) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
  3. package/android/bin/build.gradle +13 -11
  4. package/android/bin/gradle.properties +4 -4
  5. package/android/build.gradle +19 -81
  6. package/android/gradle.properties +4 -4
  7. package/android/src/main/AndroidManifest.xml +1 -3
  8. package/android/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +39 -54
  9. package/ios/AdadaptedReactNativeSdk.m +1 -1
  10. package/lib/commonjs/api/adadaptedApiRequests.js +3 -3
  11. package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
  12. package/lib/commonjs/api/adadaptedApiRequests.mock.js +25 -8
  13. package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
  14. package/lib/commonjs/api/adadaptedApiTypes.js +68 -28
  15. package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
  16. package/lib/commonjs/components/AdZone.js +101 -67
  17. package/lib/commonjs/components/AdZone.js.map +1 -1
  18. package/lib/commonjs/components/ReportAdButton.js +40 -0
  19. package/lib/commonjs/components/ReportAdButton.js.map +1 -0
  20. package/lib/commonjs/images/ReportIcon.png +0 -0
  21. package/lib/commonjs/index.js +139 -93
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/package.json +1 -0
  24. package/lib/commonjs/types.js +4 -0
  25. package/lib/commonjs/types.js.map +1 -1
  26. package/lib/commonjs/util.js +14 -4
  27. package/lib/commonjs/util.js.map +1 -1
  28. package/lib/module/api/adadaptedApiRequests.js +2 -0
  29. package/lib/module/api/adadaptedApiRequests.js.map +1 -1
  30. package/lib/module/api/adadaptedApiRequests.mock.js +27 -9
  31. package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
  32. package/lib/module/api/adadaptedApiTypes.js +85 -24
  33. package/lib/module/api/adadaptedApiTypes.js.map +1 -1
  34. package/lib/module/components/AdZone.js +90 -61
  35. package/lib/module/components/AdZone.js.map +1 -1
  36. package/lib/module/components/ReportAdButton.js +34 -0
  37. package/lib/module/components/ReportAdButton.js.map +1 -0
  38. package/lib/module/images/ReportIcon.png +0 -0
  39. package/lib/module/index.js +142 -89
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/package.json +1 -0
  42. package/lib/module/types.js +2 -0
  43. package/lib/module/types.js.map +1 -1
  44. package/lib/module/util.js +16 -4
  45. package/lib/module/util.js.map +1 -1
  46. package/lib/typescript/src/api/adadaptedApiRequests.d.ts +1 -0
  47. package/lib/typescript/src/api/adadaptedApiRequests.d.ts.map +1 -0
  48. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts +1 -0
  49. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts.map +1 -0
  50. package/lib/typescript/src/api/adadaptedApiTypes.d.ts +5 -0
  51. package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -0
  52. package/lib/typescript/src/components/AdZone.d.ts +11 -6
  53. package/lib/typescript/src/components/AdZone.d.ts.map +1 -0
  54. package/lib/typescript/src/components/ReportAdButton.d.ts +19 -0
  55. package/lib/typescript/src/components/ReportAdButton.d.ts.map +1 -0
  56. package/lib/typescript/src/index.d.ts +33 -17
  57. package/lib/typescript/src/index.d.ts.map +1 -0
  58. package/lib/typescript/src/types.d.ts +3 -2
  59. package/lib/typescript/src/types.d.ts.map +1 -0
  60. package/lib/typescript/src/util.d.ts +13 -0
  61. package/lib/typescript/src/util.d.ts.map +1 -0
  62. package/package.json +151 -155
  63. package/src/api/adadaptedApiRequests.mock.ts +25 -9
  64. package/src/api/adadaptedApiTypes.ts +5 -0
  65. package/src/components/AdZone.tsx +94 -46
  66. package/src/components/ReportAdButton.tsx +46 -0
  67. package/src/images/ReportIcon.png +0 -0
  68. package/src/index.tsx +146 -69
  69. package/src/util.ts +13 -0
  70. package/lib/typescript/example/index.d.ts +0 -1
  71. package/lib/typescript/example/src/App.d.ts +0 -9
  72. package/lib/typescript/jest.setup.d.ts +0 -5
@@ -49,42 +49,34 @@ exports.ReportedEventType = exports.PayloadStatus = exports.ListManagerEventSour
49
49
  /**
50
50
  * Enumeration that defines the possible values for a List Manager Event Source.
51
51
  */
52
- let ListManagerEventSource;
53
- /**
54
- * Enumeration that defines the possible values for a List Manager Event Name.
55
- */
56
- exports.ListManagerEventSource = ListManagerEventSource;
57
- (function (ListManagerEventSource) {
52
+ let ListManagerEventSource = exports.ListManagerEventSource = /*#__PURE__*/function (ListManagerEventSource) {
58
53
  ListManagerEventSource["APP"] = "app";
59
- })(ListManagerEventSource || (exports.ListManagerEventSource = ListManagerEventSource = {}));
60
- let ListManagerEventName;
54
+ return ListManagerEventSource;
55
+ }({});
61
56
  /**
62
- * Enum defining the available ad action types.
57
+ * Enumeration that defines the possible values for a List Manager Event Name.
63
58
  */
64
- exports.ListManagerEventName = ListManagerEventName;
65
- (function (ListManagerEventName) {
59
+ let ListManagerEventName = exports.ListManagerEventName = /*#__PURE__*/function (ListManagerEventName) {
66
60
  ListManagerEventName["ADDED_TO_LIST"] = "user_added_to_list";
67
61
  ListManagerEventName["CROSSED_OFF_LIST"] = "user_crossed_off_list";
68
62
  ListManagerEventName["DELETED_FROM_LIST"] = "user_deleted_from_list";
69
- })(ListManagerEventName || (exports.ListManagerEventName = ListManagerEventName = {}));
70
- let AdActionType;
63
+ return ListManagerEventName;
64
+ }({});
71
65
  /**
72
- * Enum defining the different types of events that can be reported.
66
+ * Enum defining the available ad action types.
73
67
  */
74
- exports.AdActionType = AdActionType;
75
- (function (AdActionType) {
68
+ let AdActionType = exports.AdActionType = /*#__PURE__*/function (AdActionType) {
76
69
  AdActionType["CONTENT"] = "c";
77
70
  AdActionType["EXTERNAL"] = "e";
78
71
  AdActionType["LINK"] = "l";
79
72
  AdActionType["APP"] = "a";
80
73
  AdActionType["NONE"] = "n";
81
- })(AdActionType || (exports.AdActionType = AdActionType = {}));
82
- let ReportedEventType;
74
+ return AdActionType;
75
+ }({});
83
76
  /**
84
- * Enumeration defining the possible payload acknowledgment status values.
77
+ * Enum defining the different types of events that can be reported.
85
78
  */
86
- exports.ReportedEventType = ReportedEventType;
87
- (function (ReportedEventType) {
79
+ let ReportedEventType = exports.ReportedEventType = /*#__PURE__*/function (ReportedEventType) {
88
80
  ReportedEventType["IMPRESSION"] = "impression";
89
81
  ReportedEventType["INVISIBLE_IMPRESSION"] = "invisible_impression";
90
82
  ReportedEventType["INTERACTION"] = "interaction";
@@ -92,16 +84,64 @@ exports.ReportedEventType = ReportedEventType;
92
84
  ReportedEventType["MATCHED"] = "matched";
93
85
  ReportedEventType["PRESENTED"] = "presented";
94
86
  ReportedEventType["SELECTED"] = "selected";
95
- })(ReportedEventType || (exports.ReportedEventType = ReportedEventType = {}));
96
- let PayloadStatus; // =============================================================================
87
+ return ReportedEventType;
88
+ }({});
89
+ /**
90
+ * Enumeration defining the possible payload acknowledgment status values.
91
+ */
92
+ let PayloadStatus = exports.PayloadStatus = /*#__PURE__*/function (PayloadStatus) {
93
+ PayloadStatus["DELIVERED"] = "delivered";
94
+ PayloadStatus["REJECTED"] = "rejected";
95
+ return PayloadStatus;
96
+ }({}); // =============================================================================
97
97
  // REQUEST MODELS
98
98
  // =============================================================================
99
99
  /**
100
100
  * The base request inputs that most requests will use.
101
101
  */
102
- exports.PayloadStatus = PayloadStatus;
103
- (function (PayloadStatus) {
104
- PayloadStatus["DELIVERED"] = "delivered";
105
- PayloadStatus["REJECTED"] = "rejected";
106
- })(PayloadStatus || (exports.PayloadStatus = PayloadStatus = {}));
102
+ /**
103
+ * Interface for the request of the Initialize Session API call.
104
+ */
105
+ /**
106
+ * Interface for the request of the Refresh Session Data API call.
107
+ */
108
+ /**
109
+ * Interface for the request that reports an ad event.
110
+ */
111
+ /**
112
+ * Interface for the request of the Refresh Session Data API call.
113
+ */
114
+ /**
115
+ * Interface for the request that reports an intercept event.
116
+ */
117
+ /**
118
+ * Interface for the request that reports List Manager data.
119
+ */
120
+ /**
121
+ * Interface for the request that reports Payload tracking data.
122
+ */
123
+ /**
124
+ * Interface for the request that gets Payload server data.
125
+ */
126
+ // =============================================================================
127
+ // RESPONSE MODELS
128
+ // =============================================================================
129
+ /**
130
+ * Interface for the response of the Campaign API request.
131
+ */
132
+ /**
133
+ * Interface for the response of the Campaign API request.
134
+ */
135
+ /**
136
+ * Interface for the response of the Report Ad Event API request.
137
+ */
138
+ /**
139
+ * Interface for the response of the Keyword Intercepts API request.
140
+ */
141
+ /**
142
+ * Interface for the response of the Report Intercept Event API request.
143
+ */
144
+ /**
145
+ * Interface for the response of the Retrieve Payload Item Data API request.
146
+ */
107
147
  //# sourceMappingURL=adadaptedApiTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ListManagerEventSource","ListManagerEventName","AdActionType","ReportedEventType","PayloadStatus"],"sources":["adadaptedApiTypes.ts"],"sourcesContent":["// =============================================================================\n// API TYPE MODELS\n// =============================================================================\n/**\n * The definition of an ad session data object.\n */\nexport interface AdSession {\n /**\n * The session ID.\n */\n session_id: string;\n /**\n * If true, ads will be served.\n */\n will_serve_ads: boolean;\n /**\n * If true, there are active campaigns.\n */\n active_campaigns: boolean;\n /**\n * How often to refresh session/ad data?\n */\n polling_interval_ms: number;\n /**\n * The time at which the session will expire.\n */\n session_expires_at: number;\n /**\n * All ad zones.\n */\n zones: { [key: number]: Zone };\n}\n\n/**\n * The definition of a zone.\n */\nexport interface Zone {\n /**\n * The zone ID.\n */\n id: string;\n /**\n * ?\n */\n land_height: number;\n /**\n * ?\n */\n land_width: number;\n /**\n * ?\n */\n port_height: number;\n /**\n * ?\n */\n port_width: number;\n /**\n * The available ads.\n */\n ads: Ad[];\n}\n\n/**\n * The definition of an Ad.\n */\nexport interface Ad {\n /**\n * The ad ID.\n */\n ad_id: string;\n /**\n * The impression ID.\n */\n impression_id: string;\n /**\n * The type of ad this is.\n */\n type: string;\n /**\n * How often the ad refreshes? Swaps out for another?\n * Length of time in seconds.\n */\n refresh_time: number;\n /**\n * The URL for the ad image to display.\n */\n creative_url: string;\n /**\n * The tracking pixel to include in the zone view for this ad?\n */\n tracking_html: string;\n /**\n * ?\n */\n action_path: string;\n /**\n * ?\n */\n action_type: AdActionType;\n /**\n * If true, the ad will be hidden after interaction.\n */\n hide_after_interaction: boolean;\n /**\n * ?\n */\n payload: AdPayload;\n /**\n * Track impression status.\n */\n impression_tracked?: boolean;\n}\n\n/**\n * The definition of an Ad Payload.\n */\nexport interface AdPayload {\n /**\n * The array of list items.\n */\n detailed_list_items: DetailedListItem[];\n}\n\n/**\n * The definition of an \"out of app\" data payload.\n */\nexport interface OutOfAppDataPayload {\n /**\n * The payload ID associated to the provided list items.\n */\n payload_id: string;\n /**\n * The payload message.\n */\n payload_message?: string;\n /**\n * The payload image.\n */\n payload_image?: string;\n /**\n * The campaign ID.\n */\n campaign_id?: string;\n /**\n * The app ID.\n */\n app_id?: string;\n /**\n * Expiration time in seconds.\n */\n expire_seconds?: number;\n /**\n * The array of list items.\n */\n detailed_list_items: DetailedListItem[];\n}\n\n/**\n * The definition of a Detailed List Item.\n */\nexport interface DetailedListItem {\n /**\n * The barcode of the product.\n */\n product_barcode: string;\n /**\n * The brand of the product.\n */\n product_brand: string;\n /**\n * The category of the product.\n */\n product_category: string;\n /**\n * The discount given for the product.\n */\n product_discount: string;\n /**\n * The image used for display of the product.\n */\n product_image: string;\n /**\n * The SKU of the product.\n */\n product_sku: string;\n /**\n * The name/title of the product.\n */\n product_title: string;\n /**\n * The tracking ID.\n */\n tracking_id?: string;\n}\n\n/**\n * The definition of a Keyword Intercepts object.\n */\nexport interface KeywordIntercepts {\n /**\n * The search ID.\n * Automatically assigned by the API.\n */\n search_id: string;\n /**\n * The minimum number of characters required to perform\n * a search against all available search terms.\n */\n min_match_length: number;\n /**\n * All available search terms.\n */\n terms: KeywordSearchTerm[];\n}\n\n/**\n * The definition of a Keyword Search Term.\n */\nexport interface KeywordSearchTerm {\n /**\n * The search term ID.\n */\n term_id: string;\n /**\n * The search term to validate a search string against.\n */\n term: string;\n /**\n * The display string a client can use to display in a list.\n */\n replacement: string;\n /**\n * The display priority of this item.\n * Compare this to other {@link KeywordSearchTerm} items to determine\n * the final priority order during display.\n * The lower the number, the higher the priority.\n */\n priority: number;\n}\n\n/**\n * The definition of a Reported Ad Event.\n */\nexport interface ReportedAdEvent {\n /**\n * The add ID.\n */\n ad_id: string;\n /**\n * The impression ID.\n */\n impression_id: string;\n /**\n * The event type to report\n */\n event_type: ReportedEventType;\n /**\n * The timestamp at which the event occurred.\n */\n created_at: number;\n}\n\n/**\n * The definition of a Reported Intercept Event.\n */\nexport interface ReportedInterceptEvent {\n /**\n * The intercept search ID.\n */\n search_id: string;\n /**\n * The term ID.\n */\n term_id: string;\n /**\n * The term.\n */\n term: string;\n /**\n * The user input provided that ultimately\n * resulted in the event triggering.\n */\n user_input: string;\n /**\n * The event type to report\n */\n event_type: ReportedEventType;\n /**\n * The timestamp at which the event occurred.\n */\n created_at: number;\n}\n\n/**\n * Interface defining the structure of an event to send when using List Manager.\n */\nexport interface ListManagerEvent {\n /**\n * The source of the list manager event.\n */\n event_source: ListManagerEventSource;\n /**\n * The timestamp this event occurred (unix time).\n */\n event_timestamp: number;\n /**\n * The event name.\n */\n event_name: ListManagerEventName;\n /**\n * The parameter the event is triggered for.\n */\n event_params: ListManagerEventParam;\n}\n\n/**\n * Interface defining the structure of a payload tracking event.\n */\nexport interface PayloadTrackingEvent {\n /**\n * The source of the list manager event.\n */\n payload_id: string;\n /**\n * The status to report.\n */\n status: PayloadStatus;\n /**\n * The timestamp this event occurred (unix time).\n */\n event_timestamp: number;\n}\n\n/**\n * Interface defining the structure of an Event Param for List Manager.\n */\nexport interface ListManagerEventParam {\n /**\n * The item name being reported.\n */\n item_name: string;\n /**\n * The list name being reported.\n */\n list_name?: string;\n}\n\n/**\n * Enumeration that defines the possible values for a List Manager Event Source.\n */\nexport enum ListManagerEventSource {\n /**\n * The event was triggered from the app.\n */\n APP = \"app\",\n}\n\n/**\n * Enumeration that defines the possible values for a List Manager Event Name.\n */\nexport enum ListManagerEventName {\n /**\n * The user added an item to their list.\n */\n ADDED_TO_LIST = \"user_added_to_list\",\n /**\n * The user crossed off an item from their list.\n */\n CROSSED_OFF_LIST = \"user_crossed_off_list\",\n /**\n * The user deleted an item from their list.\n */\n DELETED_FROM_LIST = \"user_deleted_from_list\",\n}\n\n/**\n * Enum defining the available ad action types.\n */\nexport enum AdActionType {\n /**\n * Used for Add To List.\n */\n CONTENT = \"c\",\n /**\n * Used for opening URLs in an external browser.\n */\n EXTERNAL = \"e\",\n /**\n * Used for opening URLs in a web view within the app.\n * NOTE: This one should probably be deprecated with the new\n * platform redesign, since its not as obvious what it does.\n */\n LINK = \"l\",\n /**\n * Used for opening app store URLs in the app store.\n */\n APP = \"a\",\n /**\n * ?\n */\n NONE = \"n\",\n}\n\n/**\n * Enum defining the different types of events that can be reported.\n */\nexport enum ReportedEventType {\n /**\n * Occurs when an ad is displayed to the user.\n */\n IMPRESSION = \"impression\",\n /**\n * Occurs when an ad is not viewable before timimg out.\n */\n INVISIBLE_IMPRESSION = \"invisible_impression\",\n /**\n * Occurs when the user interacts with an ad.\n */\n INTERACTION = \"interaction\",\n /**\n * Occurs when the user's search term did not\n * match an available keyword intercept term.\n */\n NOT_MATCHED = \"not_matched\",\n /**\n * Occurs when the user's search term has matched a keyword intercept term.\n */\n MATCHED = \"matched\",\n /**\n * Occurs when the user was presented a keyword intercept term.\n */\n PRESENTED = \"presented\",\n /**\n * Occurs when the user has selected a keyword intercept term.\n */\n SELECTED = \"selected\",\n}\n\n/**\n * Enumeration defining the possible payload acknowledgment status values.\n */\nexport enum PayloadStatus {\n /**\n * The delivered status.\n */\n DELIVERED = \"delivered\",\n /**\n * The rejected status.\n */\n REJECTED = \"rejected\",\n}\n\n// =============================================================================\n// REQUEST MODELS\n// =============================================================================\n/**\n * The base request inputs that most requests will use.\n */\nexport interface BaseRequestInputs {\n /**\n * The app ID provided by the client using the API.\n */\n app_id: string;\n /**\n * The unique device ID.\n */\n udid: string;\n /**\n * The current session ID.\n */\n session_id: string;\n}\n\n/**\n * Interface for the request of the Initialize Session API call.\n */\nexport interface InitializeSessionRequest {\n /**\n * The app ID provided by the client using the API.\n */\n app_id: string;\n /**\n * The unique device ID of the users device.\n */\n udid: string;\n /**\n * The bundle ID.\n */\n bundle_id?: string;\n /**\n * The bundle version.\n */\n bundle_version?: string;\n /**\n * The name of the device.\n */\n device_name?: string;\n /**\n * The unique device ID of the users device.\n */\n device_udid?: string;\n /**\n * The OS of the device.\n */\n device_os?: string;\n /**\n * The OS version of the device.\n */\n device_osv?: string;\n /**\n * The locale the device is currently set for.\n */\n device_locale?: string;\n /**\n * The timezone the device is currently set for.\n */\n device_timezone?: string;\n /**\n * The device carrier name.\n */\n device_carrier?: string;\n /**\n * The height of the devices screen in pixels.\n */\n device_height?: number;\n /**\n * The width of the devices screen in pixels.\n */\n device_width?: number;\n /**\n * The density of the devices screen.\n */\n device_density?: string;\n /**\n * If true, the device allows for ad retargeting.\n */\n allow_retargeting?: boolean;\n /**\n * ?\n */\n created_at?: number;\n /**\n * The AdAdapted SDK version number.\n */\n sdk_version?: string;\n /**\n * ?\n */\n params?: { [key: string]: string };\n}\n\n/**\n * Interface for the request of the Refresh Session Data API call.\n */\nexport interface RefreshSessionDataRequest {\n /**\n * The app ID provided by the client using the API.\n */\n aid: string;\n /**\n * The unique device ID.\n */\n uid: string;\n /**\n * The current session ID.\n */\n sid: string;\n}\n\n/**\n * Interface for the request that reports an ad event.\n */\nexport interface ReportAdEventRequest extends BaseRequestInputs {\n /**\n * Events to report.\n */\n events: ReportedAdEvent[];\n}\n\n/**\n * Interface for the request of the Refresh Session Data API call.\n */\nexport interface KeywordInterceptsRequest {\n /**\n * The app ID provided by the client using the API.\n */\n aid: string;\n /**\n * The unique device ID.\n */\n uid: string;\n /**\n * The current session ID.\n */\n sid: string;\n}\n\n/**\n * Interface for the request that reports an intercept event.\n */\nexport interface ReportInterceptEventRequest extends BaseRequestInputs {\n /**\n * Events to report.\n */\n events: ReportedInterceptEvent[];\n}\n\n/**\n * Interface for the request that reports List Manager data.\n */\nexport interface ReportListManagerDataRequest extends BaseRequestInputs {\n /**\n * The events to report.\n */\n events: ListManagerEvent[];\n}\n\n/**\n * Interface for the request that reports Payload tracking data.\n */\nexport interface ReportPayloadDataRequest extends BaseRequestInputs {\n /**\n * The payload tracking events.\n */\n tracking: PayloadTrackingEvent[];\n}\n\n/**\n * Interface for the request that gets Payload server data.\n */\nexport interface RetrievePayloadItemDataRequest extends BaseRequestInputs {}\n\n// =============================================================================\n// RESPONSE MODELS\n// =============================================================================\n/**\n * Interface for the response of the Campaign API request.\n */\nexport interface InitializeSessionResponse extends AdSession {}\n\n/**\n * Interface for the response of the Campaign API request.\n */\nexport interface RefreshSessionDataResponse extends AdSession {}\n\n/**\n * Interface for the response of the Report Ad Event API request.\n */\nexport interface ReportAdEventResponse {\n /**\n * Array that contains response strings of \"Ok\" or \"Failed\" based\n * on the same order of the events sent to the request.\n */\n results: string[];\n}\n\n/**\n * Interface for the response of the Keyword Intercepts API request.\n */\nexport interface KeywordInterceptsResponse extends KeywordIntercepts {}\n\n/**\n * Interface for the response of the Report Intercept Event API request.\n */\nexport interface ReportInterceptEventResponse {\n /**\n * Array that contains response strings of \"Ok\" or \"Failed\" based\n * on the same order of the events sent to the request.\n */\n results: string[];\n}\n\n/**\n * Interface for the response of the Retrieve Payload Item Data API request.\n */\nexport interface RetrievePayloadItemDataResponse {\n /**\n * Array containing all current payloads for the provided user.\n */\n payloads: OutOfAppDataPayload[];\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACA;AA4BA;AACA;AACA;AAiDA;AACA;AACA;AAQA;AACA;AACA;AAgCA;AACA;AACA;AAoCA;AACA;AACA;AAkBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AA6BA;AACA;AACA;AAoBA;AACA;AACA;AAgBA;AACA;AACA;AAYA;AACA;AACA;AAFA,IAGYA,sBAAsB;AAOlC;AACA;AACA;AAFA;AAAA,WAPYA,sBAAsB;EAAtBA,sBAAsB;AAAA,GAAtBA,sBAAsB,sCAAtBA,sBAAsB;AAAA,IAUtBC,oBAAoB;AAehC;AACA;AACA;AAFA;AAAA,WAfYA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB;AAAA,IAkBpBC,YAAY;AAyBxB;AACA;AACA;AAFA;AAAA,WAzBYA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;AAAA,GAAZA,YAAY,4BAAZA,YAAY;AAAA,IA4BZC,iBAAiB;AAgC7B;AACA;AACA;AAFA;AAAA,WAhCYA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,iCAAjBA,iBAAiB;AAAA,IAmCjBC,aAAa,EAWzB;AACA;AACA;AACA;AACA;AACA;AAFA;AAAA,WAdYA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa"}
1
+ {"version":3,"names":["ListManagerEventSource","exports","ListManagerEventName","AdActionType","ReportedEventType","PayloadStatus"],"sourceRoot":"../../../src","sources":["api/adadaptedApiTypes.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACA;AA4BA;AACA;AACA;AAiDA;AACA;AACA;AAQA;AACA;AACA;AAqCA;AACA;AACA;AAoCA;AACA;AACA;AAkBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AA6BA;AACA;AACA;AAoBA;AACA;AACA;AAgBA;AACA;AACA;AAYA;AACA;AACA;AAFA,IAGYA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAOlC;AACA;AACA;AAFA,IAGYE,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAehC;AACA;AACA;AAFA,IAGYC,YAAY,GAAAF,OAAA,CAAAE,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAyBxB;AACA;AACA;AAFA,IAGYC,iBAAiB,GAAAH,OAAA,CAAAG,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAgC7B;AACA;AACA;AAFA,IAGYC,aAAa,GAAAJ,OAAA,CAAAI,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA,OAWzB;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AA4EA;AACA;AACA;AAgBA;AACA;AACA;AAQA;AACA;AACA;AAgBA;AACA;AACA;AAQA;AACA;AACA;AAQA;AACA;AACA;AAQA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AASA;AACA;AACA;AAGA;AACA;AACA;AASA;AACA;AACA","ignoreList":[]}
@@ -3,20 +3,34 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.AdZone = AdZone;
7
- var React = _interopRequireWildcard(require("react"));
6
+ exports.AdZone = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var adadaptedApiRequests = _interopRequireWildcard(require("../api/adadaptedApiRequests"));
10
10
  var _adadaptedApiTypes = require("../api/adadaptedApiTypes");
11
11
  var _reactNativeWebview = require("react-native-webview");
12
12
  var _util = require("../util");
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ var _ReportAdButton = require("./ReportAdButton");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
17
  /**
16
18
  * Component for creating an {@link AdZone}.
17
19
  * @module
18
20
  */
19
21
 
22
+ /**
23
+ * Props interface for {@link AdZone}.
24
+ */
25
+
26
+ /**
27
+ * Interface for tracking "touch" coordinates.
28
+ */
29
+
30
+ /**
31
+ * Defines the style typing for the component.
32
+ */
33
+
20
34
  /**
21
35
  * Timer used for cycling through ads in the zone
22
36
  * based on the ad "refresh time" for each ad.
@@ -28,28 +42,26 @@ let cycleAdTimer;
28
42
  * @param props - properties passed to AdZone.
29
43
  * @returns an AdZone JSX Element.
30
44
  */
31
- function AdZone(props) {
32
- // Generates a random number between 0 and (number of available ads - 1).
33
- const startingAdIndex = Math.floor(Math.random() * props.adZoneData.ads.length);
34
-
45
+ const AdZone = props => {
35
46
  /**
36
47
  * Tracks the current ad index being shown.
37
48
  */
38
- const [adIndexShown, setAdIndexShown] = (0, React.useState)(startingAdIndex);
49
+ const [adIndexShown, setAdIndexShown] = (0, _react.useState)(Math.floor(Math.random() * props.adZoneData.ads.length));
39
50
  /**
40
51
  * Tracks the coordinates when the user started touching the Ad View.
41
52
  */
42
- const [touchStartCoords, setTouchStartCoords] = (0, React.useState)({
53
+ const [touchStartCoords, setTouchStartCoords] = (0, _react.useState)({
43
54
  x: 0,
44
55
  y: 0
45
56
  });
57
+
46
58
  /**
47
59
  * Track ad visibility (for off-screen ads).
48
60
  */
49
- const [isAdVisible, setIsAdVisibile] = (0, React.useState)(props.defaultToInvisibleAdZone ? false : true);
61
+ const [isAdZoneVisible, setIsAdVisibile] = (0, _react.useState)(props.isAdZoneVisible);
50
62
 
51
- // - Define all useEffect triggers.
52
- (0, React.useEffect)(() => {
63
+ // Setup device listeners.
64
+ (0, _react.useEffect)(() => {
53
65
  _reactNative.DeviceEventEmitter.addListener("visibility-event", event => {
54
66
  setIsAdVisibile(event);
55
67
  });
@@ -58,21 +70,25 @@ function AdZone(props) {
58
70
  });
59
71
  return () => {
60
72
  clearTimeout(cycleAdTimer);
61
- _reactNative.DeviceEventEmitter.removeAllListeners("visibility-event");
62
73
  _reactNative.DeviceEventEmitter.removeAllListeners("acknowledge");
63
74
  };
75
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
76
  }, []);
65
- (0, React.useEffect)(() => {
77
+
78
+ // Send impression on ad cycle.
79
+ (0, _react.useEffect)(() => {
66
80
  startAdTimer();
67
- if (isAdVisible) {
81
+ if (isAdZoneVisible) {
68
82
  sendAdImpression();
69
83
  }
84
+ // eslint-disable-next-line react-hooks/exhaustive-deps
70
85
  }, [adIndexShown]);
71
- (0, React.useEffect)(() => {
72
- if (isAdVisible) {
86
+ (0, _react.useEffect)(() => {
87
+ if (props.offScreenAdZone && isAdZoneVisible && props.adZoneData && props.adZoneData.ads && props.adZoneData.ads.length > adIndexShown && !props.adZoneData.ads[adIndexShown].impression_tracked) {
73
88
  sendAdImpression();
74
89
  }
75
- }, [isAdVisible]);
90
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
+ }, [isAdZoneVisible]);
76
92
 
77
93
  /**
78
94
  * Generates all component related styles.
@@ -87,6 +103,11 @@ function AdZone(props) {
87
103
  webView: {
88
104
  width: "100%",
89
105
  height: "100%"
106
+ },
107
+ reportAd: {
108
+ position: "absolute",
109
+ top: 10,
110
+ right: 10
90
111
  }
91
112
  });
92
113
  }
@@ -94,12 +115,11 @@ function AdZone(props) {
94
115
  // Generate the styles each render in case the ad is updated with
95
116
  // new settings that need to be reflected in the styles of the view.
96
117
  const styles = generateStyles();
97
- const currentAd = props.adZoneData.ads[adIndexShown] || undefined;
98
118
  const finalMainViewStyle = styles.mainView;
99
- if (!currentAd || !currentAd.creative_url) {
119
+ if (!props.adZoneData.ads[adIndexShown] || !props.adZoneData.ads[adIndexShown].creative_url) {
100
120
  // If there is no ad to display, make the view take up no space.
101
- finalMainViewStyle.width = "0";
102
- finalMainViewStyle.height = "0";
121
+ finalMainViewStyle.width = 0;
122
+ finalMainViewStyle.height = 0;
103
123
  }
104
124
 
105
125
  /**
@@ -124,11 +144,13 @@ function AdZone(props) {
124
144
  function acknowledge(itemName) {
125
145
  if (props.adZoneData.ads) {
126
146
  props.adZoneData.ads.forEach(ad => {
127
- ad.payload.detailed_list_items.forEach(item => {
128
- if (item.product_title === itemName) {
129
- triggerReportAdEvent(ad, _adadaptedApiTypes.ReportedEventType.INTERACTION);
130
- }
131
- });
147
+ if (ad.action_type === "c") {
148
+ ad.payload.detailed_list_items.forEach(item => {
149
+ if (item.product_title === itemName) {
150
+ triggerReportAdEvent(ad, _adadaptedApiTypes.ReportedEventType.INTERACTION);
151
+ }
152
+ });
153
+ }
132
154
  });
133
155
  }
134
156
  }
@@ -163,9 +185,11 @@ function AdZone(props) {
163
185
  */
164
186
  function startAdTimer() {
165
187
  clearTimeout(cycleAdTimer);
166
- if (props.adZoneData.ads.length > 0) {
188
+ if (props.adZoneData.ads.length > 0 && props.adZoneData.ads[adIndexShown]) {
167
189
  const refreshTime = props.adZoneData.ads[adIndexShown].refresh_time * 1000;
168
190
  cycleAdTimer = setTimeout(cycleDisplayedAd, refreshTime);
191
+ } else {
192
+ cycleAdTimer = setTimeout(cycleDisplayedAd, 30000);
169
193
  }
170
194
  }
171
195
 
@@ -173,19 +197,23 @@ function AdZone(props) {
173
197
  * Cycles to the next ad to display in the current available sequence of ads.
174
198
  */
175
199
  function cycleDisplayedAd() {
176
- // Start by determining the next ad index to display.
177
200
  let nextAdIndex = 0;
201
+
202
+ // Start by determining the next ad index to display.
178
203
  const lastAd = props.adZoneData.ads[adIndexShown];
179
204
  if (adIndexShown < props.adZoneData.ads.length - 1) {
180
205
  nextAdIndex = adIndexShown + 1;
181
- }
182
- if (nextAdIndex !== adIndexShown && lastAd.impression_tracked) {
183
- // Reset ad impression tracking status.
184
- lastAd.impression_tracked = false;
185
206
  } else {
207
+ nextAdIndex = 0;
208
+ }
209
+ if (!lastAd.impression_tracked && !isAdZoneVisible) {
186
210
  // Send invisible ad impression if ad was not visible before end of timer cycle.
187
211
  triggerReportAdEvent(lastAd, _adadaptedApiTypes.ReportedEventType.INVISIBLE_IMPRESSION);
188
212
  }
213
+ if (lastAd.impression_tracked) {
214
+ // Reset ad impression tracking status.
215
+ lastAd.impression_tracked = false;
216
+ }
189
217
  setAdIndexShown(nextAdIndex);
190
218
  }
191
219
 
@@ -194,47 +222,53 @@ function AdZone(props) {
194
222
  */
195
223
  function sendAdImpression() {
196
224
  const ad = props.adZoneData.ads[adIndexShown];
197
-
198
- // Trigger an impression event for the ad.
199
- if (!ad.impression_tracked) {
225
+ if (ad.impression_tracked === undefined || !ad.impression_tracked) {
200
226
  triggerReportAdEvent(ad, _adadaptedApiTypes.ReportedEventType.IMPRESSION);
201
227
  ad.impression_tracked = true;
202
228
  }
203
229
  }
204
230
 
205
231
  // Returned JSX.
206
- return /*#__PURE__*/React.createElement(_reactNative.View, {
207
- style: finalMainViewStyle
208
- }, currentAd && currentAd.creative_url ? /*#__PURE__*/React.createElement(_reactNativeWebview.WebView, {
209
- source: {
210
- uri: currentAd.creative_url
211
- },
212
- androidLayerType: "hardware",
213
- automaticallyAdjustContentInsets: false,
214
- style: styles.webView,
215
- onTouchStart: e => {
216
- setTouchStartCoords({
217
- x: e.nativeEvent.pageX,
218
- y: e.nativeEvent.pageY
219
- });
220
- },
221
- onTouchEnd: e => {
222
- if (touchStartCoords) {
223
- const touchEndCoords = {
232
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
233
+ style: finalMainViewStyle,
234
+ children: [props.adZoneData.ads[adIndexShown] && props.adZoneData.ads[adIndexShown].creative_url ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeWebview.WebView, {
235
+ source: {
236
+ uri: props.adZoneData.ads[adIndexShown].creative_url
237
+ },
238
+ androidLayerType: "hardware",
239
+ automaticallyAdjustContentInsets: false,
240
+ style: styles.webView,
241
+ onTouchStart: e => {
242
+ setTouchStartCoords({
224
243
  x: e.nativeEvent.pageX,
225
244
  y: e.nativeEvent.pageY
226
- };
227
- if (Math.abs(touchStartCoords.x - touchEndCoords.x) < props.xyDragDistanceAllowed && Math.abs(touchStartCoords.y - touchEndCoords.y) < props.xyDragDistanceAllowed) {
228
- onAdZoneSelected(currentAd);
229
- }
230
-
231
- // Make sure to reset the start coords
232
- setTouchStartCoords({
233
- x: 0,
234
- y: 0
235
245
  });
246
+ },
247
+ onTouchEnd: e => {
248
+ if (touchStartCoords) {
249
+ const touchEndCoords = {
250
+ x: e.nativeEvent.pageX,
251
+ y: e.nativeEvent.pageY
252
+ };
253
+ if (Math.abs(touchStartCoords.x - touchEndCoords.x) < props.xyDragDistanceAllowed && Math.abs(touchStartCoords.y - touchEndCoords.y) < props.xyDragDistanceAllowed) {
254
+ onAdZoneSelected(props.adZoneData.ads[adIndexShown]);
255
+ }
256
+
257
+ // Make sure to reset the start coords
258
+ setTouchStartCoords({
259
+ x: 0,
260
+ y: 0
261
+ });
262
+ }
236
263
  }
237
- }
238
- }) : undefined);
239
- }
264
+ }) : undefined, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
265
+ style: styles.reportAd,
266
+ children: props.adZoneData && props.adZoneData.ads[adIndexShown] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReportAdButton.ReportAdButton, {
267
+ adId: props.adZoneData.ads[adIndexShown].ad_id,
268
+ udid: props.udid
269
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {})
270
+ })]
271
+ });
272
+ };
273
+ exports.AdZone = AdZone;
240
274
  //# sourceMappingURL=AdZone.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["cycleAdTimer","AdZone","props","startingAdIndex","Math","floor","random","adZoneData","ads","length","adIndexShown","setAdIndexShown","useState","touchStartCoords","setTouchStartCoords","x","y","isAdVisible","setIsAdVisibile","defaultToInvisibleAdZone","useEffect","DeviceEventEmitter","addListener","event","itemName","acknowledge","clearTimeout","removeAllListeners","startAdTimer","sendAdImpression","generateStyles","StyleSheet","create","mainView","width","height","webView","styles","currentAd","undefined","finalMainViewStyle","creative_url","onAdZoneSelected","currentlyDisplayedAd","action_type","AdActionType","EXTERNAL","action_path","Linking","openURL","then","CONTENT","payload","detailed_list_items","safeInvoke","onAddToListTriggered","cycleDisplayedAd","forEach","ad","item","product_title","triggerReportAdEvent","ReportedEventType","INTERACTION","eventType","currentTs","round","Date","getTime","adadaptedApiRequests","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","refreshTime","refresh_time","setTimeout","nextAdIndex","lastAd","impression_tracked","INVISIBLE_IMPRESSION","IMPRESSION","uri","e","nativeEvent","pageX","pageY","touchEndCoords","abs","xyDragDistanceAllowed"],"sources":["AdZone.tsx"],"sourcesContent":["/**\n * Component for creating an {@link AdZone}.\n * @module\n */\nimport * as React from \"react\";\nimport {\n DeviceEventEmitter,\n Linking,\n StyleSheet,\n View,\n ViewStyle,\n} from \"react-native\";\nimport * as adadaptedApiRequests from \"../api/adadaptedApiRequests\";\nimport {\n Ad,\n AdActionType,\n DetailedListItem,\n ReportedEventType,\n Zone,\n} from \"../api/adadaptedApiTypes\";\nimport { WebView } from \"react-native-webview\";\nimport { ApiEnv, DeviceOS } from \"../index\";\nimport { safeInvoke } from \"../util\";\nimport { useEffect, useState } from \"react\";\n\n/**\n * Props interface for {@link AdZone}.\n */\ninterface Props {\n /**\n * The app ID.\n */\n appId: string;\n /**\n * The session ID.\n */\n sessionId: string;\n /**\n * The UDID.\n */\n udid: 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 * The device OS used for API requests.\n */\n deviceOs: DeviceOS;\n /**\n * The API environment to use when making an API request.\n */\n apiEnv: ApiEnv;\n /**\n * The ad zone data.\n */\n adZoneData: Zone;\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 * Track the ad zone visibility in parent component.\n */\n isAdZoneVisible?: boolean;\n /**\n * Set default ad zone visibility to false.\n */\n defaultToInvisibleAdZone?: boolean;\n}\n\n/**\n * Interface for tracking \"touch\" coordinates.\n */\ninterface TouchCoordinates {\n /**\n * The X coordinate for the touch.\n */\n x: number;\n /**\n * The Y coordinate for the touch.\n */\n y: number;\n}\n\n/**\n * Defines the style typing for the component.\n */\ninterface StyleDef {\n /**\n * Styles for the main View element.\n */\n mainView: ViewStyle;\n /**\n * Styles for the WebView element.\n */\n webView: ViewStyle;\n}\n/**\n * Timer used for cycling through ads in the zone\n * based on the ad \"refresh time\" for each ad.\n */\nlet cycleAdTimer: ReturnType<typeof setTimeout> | undefined;\n\n/**\n * Creates the AdZone component.\n * @param props - properties passed to AdZone.\n * @returns an AdZone JSX Element.\n */\nexport function AdZone(props: Props): JSX.Element {\n // Generates a random number between 0 and (number of available ads - 1).\n const startingAdIndex = Math.floor(\n Math.random() * props.adZoneData.ads.length\n );\n\n /**\n * Tracks the current ad index being shown.\n */\n const [adIndexShown, setAdIndexShown] = useState(startingAdIndex);\n /**\n * Tracks the coordinates when the user started touching the Ad View.\n */\n const [touchStartCoords, setTouchStartCoords] = useState({ x: 0, y: 0 });\n /**\n * Track ad visibility (for off-screen ads).\n */\n const [isAdVisible, setIsAdVisibile] = useState(\n props.defaultToInvisibleAdZone ? false : true\n );\n\n // - Define all useEffect triggers.\n useEffect(() => {\n DeviceEventEmitter.addListener(\"visibility-event\", (event) => {\n setIsAdVisibile(event);\n });\n DeviceEventEmitter.addListener(\"acknowledge\", (itemName) => {\n acknowledge(itemName);\n });\n return () => {\n clearTimeout(cycleAdTimer);\n DeviceEventEmitter.removeAllListeners(\"visibility-event\");\n DeviceEventEmitter.removeAllListeners(\"acknowledge\");\n };\n }, []);\n\n useEffect(() => {\n startAdTimer();\n if (isAdVisible) {\n sendAdImpression();\n }\n }, [adIndexShown]);\n\n useEffect(() => {\n if (isAdVisible) {\n sendAdImpression();\n }\n }, [isAdVisible]);\n\n /**\n * Generates all component related styles.\n * @returns the styles needed for the component.\n */\n function generateStyles(): StyleDef {\n return StyleSheet.create({\n mainView: {\n width: \"100%\",\n height: \"100%\",\n },\n webView: {\n width: \"100%\",\n height: \"100%\",\n },\n });\n }\n\n // Generate the styles each render in case the ad is updated with\n // new settings that need to be reflected in the styles of the view.\n const styles = generateStyles();\n const currentAd: Ad | undefined =\n props.adZoneData.ads[adIndexShown] || undefined;\n const finalMainViewStyle = styles.mainView;\n\n if (!currentAd || !currentAd.creative_url) {\n // If there is no ad to display, make the view take up no space.\n finalMainViewStyle.width = \"0\";\n finalMainViewStyle.height = \"0\";\n }\n\n /**\n * Triggers when the user selects the ad zone.\n * @param currentlyDisplayedAd - The ad currently displayed.\n */\n function onAdZoneSelected(currentlyDisplayedAd: Ad): void {\n // Determine the \"action type\" and perform that specific action.\n if (\n currentlyDisplayedAd.action_type === AdActionType.EXTERNAL &&\n currentlyDisplayedAd.action_path\n ) {\n // Action Type: EXTERNAL\n Linking.openURL(currentlyDisplayedAd.action_path).then();\n } else if (\n currentlyDisplayedAd.action_type === AdActionType.CONTENT &&\n currentlyDisplayedAd.payload &&\n currentlyDisplayedAd.payload.detailed_list_items\n ) {\n safeInvoke(\n props.onAddToListTriggered,\n currentlyDisplayedAd.payload.detailed_list_items\n );\n }\n\n cycleDisplayedAd();\n }\n\n /**\n * Call to acknowledge ATL item(s) added to user list.\n * @param itemName - Detailed list item title from ad that was clicked.\n */\n function acknowledge(itemName: string): void {\n if (props.adZoneData.ads) {\n props.adZoneData.ads.forEach((ad) => {\n ad.payload.detailed_list_items.forEach((item) => {\n if (item.product_title === itemName) {\n triggerReportAdEvent(ad, ReportedEventType.INTERACTION);\n }\n });\n });\n }\n }\n\n /**\n * Triggered when we need to report an ad event to the API.\n * @param ad - The ad to send an event for.\n * @param eventType - The event type for the reported event.\n */\n function triggerReportAdEvent(ad: Ad, eventType: ReportedEventType): void {\n // The event timestamp has to be sent as a unix timestamp.\n const currentTs = Math.round(new Date().getTime() / 1000);\n\n // Log the taken action/event with the API.\n adadaptedApiRequests\n .reportAdEvent(\n {\n app_id: props.appId,\n session_id: props.sessionId,\n udid: props.udid,\n events: [\n {\n ad_id: ad.ad_id,\n impression_id: ad.impression_id,\n event_type: eventType,\n created_at: currentTs,\n },\n ],\n },\n props.deviceOs,\n props.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n\n /**\n * Generates a new timer for cycling to the next ad.\n */\n function startAdTimer(): void {\n clearTimeout(cycleAdTimer);\n\n if (props.adZoneData.ads.length > 0) {\n const refreshTime: number =\n props.adZoneData.ads[adIndexShown].refresh_time * 1000;\n cycleAdTimer = setTimeout(cycleDisplayedAd, refreshTime);\n }\n }\n\n /**\n * Cycles to the next ad to display in the current available sequence of ads.\n */\n function cycleDisplayedAd(): void {\n // Start by determining the next ad index to display.\n let nextAdIndex = 0;\n const lastAd = props.adZoneData.ads[adIndexShown];\n\n if (adIndexShown < props.adZoneData.ads.length - 1) {\n nextAdIndex = adIndexShown + 1;\n }\n\n if (nextAdIndex !== adIndexShown && lastAd.impression_tracked) {\n // Reset ad impression tracking status.\n lastAd.impression_tracked = false;\n } else {\n // Send invisible ad impression if ad was not visible before end of timer cycle.\n triggerReportAdEvent(\n lastAd,\n ReportedEventType.INVISIBLE_IMPRESSION\n );\n }\n\n setAdIndexShown(nextAdIndex);\n }\n\n /**\n * Send ad tracking impression.\n */\n function sendAdImpression(): void {\n const ad = props.adZoneData.ads[adIndexShown];\n\n // Trigger an impression event for the ad.\n if (!ad.impression_tracked) {\n triggerReportAdEvent(ad, ReportedEventType.IMPRESSION);\n ad.impression_tracked = true;\n }\n }\n\n // Returned JSX.\n return (\n <View style={finalMainViewStyle}>\n {currentAd && currentAd.creative_url ? (\n <WebView\n source={{\n uri: currentAd.creative_url,\n }}\n androidLayerType=\"hardware\"\n automaticallyAdjustContentInsets={false}\n style={styles.webView}\n onTouchStart={(e) => {\n setTouchStartCoords({\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n });\n }}\n onTouchEnd={(e) => {\n if (touchStartCoords) {\n const touchEndCoords: TouchCoordinates = {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n };\n\n if (\n Math.abs(\n touchStartCoords.x - touchEndCoords.x\n ) < props.xyDragDistanceAllowed &&\n Math.abs(\n touchStartCoords.y - touchEndCoords.y\n ) < props.xyDragDistanceAllowed\n ) {\n onAdZoneSelected(currentAd);\n }\n\n // Make sure to reset the start coords\n setTouchStartCoords({ x: 0, y: 0 });\n }\n }}\n />\n ) : undefined}\n </View>\n );\n}\n"],"mappings":";;;;;;AAIA;AACA;AAOA;AACA;AAOA;AAEA;AAAqC;AAAA;AAtBrC;AACA;AACA;AACA;;AAqGA;AACA;AACA;AACA;AACA,IAAIA,YAAuD;;AAE3D;AACA;AACA;AACA;AACA;AACO,SAASC,MAAM,CAACC,KAAY,EAAe;EAC9C;EACA,MAAMC,eAAe,GAAGC,IAAI,CAACC,KAAK,CAC9BD,IAAI,CAACE,MAAM,EAAE,GAAGJ,KAAK,CAACK,UAAU,CAACC,GAAG,CAACC,MAAM,CAC9C;;EAED;AACJ;AACA;EACI,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAC,cAAQ,EAACT,eAAe,CAAC;EACjE;AACJ;AACA;EACI,MAAM,CAACU,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG,IAAAF,cAAQ,EAAC;IAAEG,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,CAAC;EACxE;AACJ;AACA;EACI,MAAM,CAACC,WAAW,EAAEC,eAAe,CAAC,GAAG,IAAAN,cAAQ,EAC3CV,KAAK,CAACiB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6F,GAAG,CACJpF,gBAAgB,CAACG,CAAC,GAAGgF,cAAc,CAAChF,CAAC,CACxC,GAAGd,KAAK,CAACgG,qBAAqB,EACjC;UACExD,gBAAgB,CAACJ,SAAS,CAAC;QAC/B;;QAEA;QACAxB,mBAAmB,CAAC;UAAEC,CAAC,EAAE,CAAC;UAAEC,CAAC,EAAE;QAAE,CAAC,CAAC;MACvC;IACJ;EAAE,EACJ,GACFuB,SAAS,CACV;AAEf"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","adadaptedApiRequests","_adadaptedApiTypes","_reactNativeWebview","_util","_ReportAdButton","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","cycleAdTimer","AdZone","props","adIndexShown","setAdIndexShown","useState","Math","floor","random","adZoneData","ads","length","touchStartCoords","setTouchStartCoords","x","y","isAdZoneVisible","setIsAdVisibile","useEffect","DeviceEventEmitter","addListener","event","itemName","acknowledge","clearTimeout","removeAllListeners","startAdTimer","sendAdImpression","offScreenAdZone","impression_tracked","generateStyles","StyleSheet","create","mainView","width","height","webView","reportAd","position","top","right","styles","finalMainViewStyle","creative_url","onAdZoneSelected","currentlyDisplayedAd","action_type","AdActionType","EXTERNAL","action_path","Linking","openURL","then","CONTENT","payload","detailed_list_items","safeInvoke","onAddToListTriggered","cycleDisplayedAd","forEach","ad","item","product_title","triggerReportAdEvent","ReportedEventType","INTERACTION","eventType","currentTs","round","Date","getTime","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","refreshTime","refresh_time","setTimeout","nextAdIndex","lastAd","INVISIBLE_IMPRESSION","undefined","IMPRESSION","jsxs","View","style","children","jsx","WebView","source","uri","androidLayerType","automaticallyAdjustContentInsets","onTouchStart","nativeEvent","pageX","pageY","onTouchEnd","touchEndCoords","abs","xyDragDistanceAllowed","ReportAdButton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IAAAjG,WAAA,CAAAqH,GAAA,EAAArH,WAAA,CAAAqI,QAAA,IAAI;IACP,CACC,CAAC;EAAA,CACL,CAAC;AAEf,CAAC;AAACC,OAAA,CAAAhH,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReportAdButton = ReportAdButton;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ /**
13
+ * Creates the ReportAdButton component.
14
+ * @param props The component's props.
15
+ * @returns a reportSdButton JSX Element.
16
+ */
17
+ function ReportAdButton(props) {
18
+ const reportAdUrlBase = new URL("https://feedback.add-it.io/");
19
+ const styles = _reactNative.StyleSheet.create({
20
+ buttonStyle: {
21
+ width: 14,
22
+ height: 14
23
+ }
24
+ });
25
+ (0, _react.useEffect)(() => {
26
+ reportAdUrlBase.searchParams.append("aid", props.adId);
27
+ reportAdUrlBase.searchParams.append("uid", props.udid);
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ }, [props]);
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
31
+ style: styles.buttonStyle,
32
+ onPress: () => {
33
+ _reactNative.Linking.openURL(reportAdUrlBase.toString());
34
+ },
35
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
36
+ source: require("../images/ReportIcon.png")
37
+ })
38
+ });
39
+ }
40
+ //# sourceMappingURL=ReportAdButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ReportAdButton","props","reportAdUrlBase","URL","styles","StyleSheet","create","buttonStyle","width","height","useEffect","searchParams","append","adId","udid","jsx","TouchableOpacity","style","onPress","Linking","openURL","toString","children","Image","source"],"sourceRoot":"../../../src","sources":["components/ReportAdButton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA4E,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MA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