react-native-test-adx 0.1.3 → 0.1.5

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.
@@ -1,13 +1,26 @@
1
1
  import { type TrackAddToCartParams, type TrackCompleteRegistrationParams, type TrackLoginParams, type TrackPurchaseParams } from './services/event/normalizeProperties.js';
2
- import type { AdaxonInitializationConfiguration, AdaxonInitializationListener, AdaxonOfferShowListener, AdaxonRecommendationLoadListener } from './types/AdaxonConfig.js';
3
- import type { EventIngestionResponse, RecommendationOffer } from './types/ApiTypes.js';
2
+ import type { AdaxonInitializationConfiguration, AdaxonInitializationListener } from './types/AdaxonConfig.js';
3
+ import type { EventIngestionResponse } from './types/ApiTypes.js';
4
+ import type { InterstitialDismissReason } from './components/InterstitialAd.js';
4
5
  import type { EventProperties, TrackEventInput, TrackEventOptions } from './types/EventTypes.js';
5
6
  import type { BatchProcessResult } from './types/QueuedEvent.js';
7
+ export type ShowAdFailureReason = 'no_offer' | 'no_eligible_offer' | 'not_mounted';
8
+ export type ShowAdOptions = {
9
+ excludeOfferIds?: readonly number[];
10
+ onOfferClicked?: (offerId: number) => void;
11
+ };
12
+ export type ShowAdResult = {
13
+ shown: false;
14
+ reason: ShowAdFailureReason;
15
+ } | {
16
+ shown: true;
17
+ offerId: number;
18
+ dismissReason: InterstitialDismissReason;
19
+ };
6
20
  export declare class AdaxonSdk {
7
- private static readonly sharedInstance;
21
+ static readonly shared: AdaxonSdk;
8
22
  private client;
9
23
  private testMode;
10
- static get shared(): AdaxonSdk;
11
24
  isInitialized(): boolean;
12
25
  initialize(configuration: AdaxonInitializationConfiguration, listener?: AdaxonInitializationListener): Promise<void>;
13
26
  track(eventName: string, properties?: EventProperties, options?: TrackEventOptions): Promise<EventIngestionResponse>;
@@ -19,11 +32,11 @@ export declare class AdaxonSdk {
19
32
  trackAddToCart(params: TrackAddToCartParams, options?: TrackEventOptions): Promise<EventIngestionResponse>;
20
33
  trackLogin(params?: TrackLoginParams, options?: TrackEventOptions): Promise<EventIngestionResponse>;
21
34
  trackCompleteRegistration(params?: TrackCompleteRegistrationParams, options?: TrackEventOptions): Promise<EventIngestionResponse>;
22
- loadRecommendations(eventName: string, properties?: EventProperties, listener?: AdaxonRecommendationLoadListener): Promise<RecommendationOffer[]>;
23
- showOffer(offer: RecommendationOffer, listener?: AdaxonOfferShowListener): Promise<void>;
24
- setExternalUserId(externalUserId?: string): void;
35
+ showAd(options?: ShowAdOptions): Promise<ShowAdResult>;
25
36
  isNetworkAvailable(): boolean;
26
37
  destroy(): void;
38
+ private loadRecommendations;
39
+ private openOfferUrl;
27
40
  private requireClient;
28
41
  }
29
42
  //# sourceMappingURL=AdaxonSdk.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { RecommendationOffer } from '../types/ApiTypes.js';
2
+ export type InterstitialDismissReason = 'close' | 'back' | 'click';
3
+ export interface InterstitialAdSession {
4
+ offer: RecommendationOffer;
5
+ interact: () => void;
6
+ onDismiss?: (reason: InterstitialDismissReason) => void;
7
+ }
8
+ export declare function presentInterstitial(session: InterstitialAdSession): boolean;
9
+ export declare function dismissInterstitial(reason?: InterstitialDismissReason): void;
10
+ export declare function InterstitialAd(): import("react").JSX.Element | null;
11
+ //# sourceMappingURL=InterstitialAd.d.ts.map
@@ -1,10 +1,11 @@
1
- export declare const SDK_VERSION = "0.1.3";
1
+ export declare const SDK_VERSION: string;
2
2
  export declare const MEDIATION_PROVIDER = "mts";
3
- export declare const BASE_URL = "http://localhost:3002";
3
+ export declare const BASE_URL = "https://mts-tracking.mobupps.com";
4
4
  export declare const EVENT_TRACKING_PATH = "/event/tracking";
5
5
  export declare const RECOMMENDATIONS_PATH = "/api/mts/recommendations";
6
6
  export declare const CLICK_TRACKING_PATH = "/click/tracking";
7
7
  export declare const OFFER_OPENED_EVENT = "offer_opened";
8
+ export declare const RECOMMENDATION_VIEW_EVENT = "recommendation_view";
8
9
  export declare const DEFAULT_TIMEOUT_MS = 10000;
9
10
  export declare const PUBLIC_IP_LOOKUP_URL = "https://api.ipify.org?format=json";
10
11
  export declare const PUBLIC_IP_LOOKUP_TIMEOUT_MS = 2000;
@@ -28,7 +28,6 @@ export declare class AdaxonClient {
28
28
  processPendingEvents(): Promise<BatchProcessResult>;
29
29
  getRecommendations(input: TrackEventInput): Promise<RecommendationResponse>;
30
30
  createClickUrl(attribution: ClickAttribution): string;
31
- setExternalUserId(externalUserId?: string): void;
32
31
  private toQueryString;
33
32
  }
34
33
  export {};
@@ -11,9 +11,7 @@ export interface UseAdaxonResult {
11
11
  trackAddToCart: AdaxonSdk['trackAddToCart'];
12
12
  trackLogin: AdaxonSdk['trackLogin'];
13
13
  trackCompleteRegistration: AdaxonSdk['trackCompleteRegistration'];
14
- loadRecommendations: AdaxonSdk['loadRecommendations'];
15
- showOffer: AdaxonSdk['showOffer'];
16
- setExternalUserId: AdaxonSdk['setExternalUserId'];
14
+ showAd: AdaxonSdk['showAd'];
17
15
  }
18
16
  export declare function useAdaxon(): UseAdaxonResult;
19
17
  //# sourceMappingURL=useAdaxon.d.ts.map
@@ -9,9 +9,11 @@ export type { AdaxonSdkErrorCode } from './errors/AdaxonSdkError.js';
9
9
  export { AdxEvent, AdxParam } from './services/event/predefined.js';
10
10
  export type { AdxEventName, AdxParamName } from './services/event/predefined.js';
11
11
  export type { TrackAddToCartParams, TrackCompleteRegistrationParams, TrackLoginParams, TrackPurchaseParams, } from './services/event/normalizeProperties.js';
12
- export type { AdaxonInitializationConfiguration, AdaxonInitializationErrorCode, AdaxonInitializationListener, AdaxonOfferShowListener, AdaxonRecommendationLoadListener, AdaxonSdkConfig, AdaxonStorageAdapter, } from './types/AdaxonConfig.js';
12
+ export type { AdaxonInitializationConfiguration, AdaxonInitializationErrorCode, AdaxonInitializationListener, AdaxonSdkConfig, AdaxonStorageAdapter, } from './types/AdaxonConfig.js';
13
13
  export type { ClickAttribution, EventProperties, EventPropertyValue, AdaxonPlatform, TrackEventInput, TrackEventOptions, } from './types/EventTypes.js';
14
- export type { EventIngestionResponse, RecommendationOffer, RecommendationResponse, } from './types/ApiTypes.js';
14
+ export type { EventIngestionResponse } from './types/ApiTypes.js';
15
+ export type { InterstitialDismissReason } from './components/InterstitialAd.js';
16
+ export type { ShowAdFailureReason, ShowAdOptions, ShowAdResult, } from './AdaxonSdk.js';
15
17
  export type { BatchProcessResult } from './types/QueuedEvent.js';
16
18
  export type { AppInfoReader, DeviceInfoReader } from './platform/types.js';
17
19
  export declare const Adaxon: AdaxonSdk;
@@ -1,14 +1,6 @@
1
1
  import type { AdaxonAppContext } from '../types/EventTypes.js';
2
- export interface NativeAppConstants {
3
- applicationId?: string | null;
4
- androidPackage?: string | null;
5
- iosBundleIdentifier?: string | null;
6
- bundleId?: string | null;
7
- nativeApplicationVersion?: string | null;
8
- nativeAppVersion?: string | null;
9
- appVersion?: string | null;
10
- }
11
2
  type NativeAppFields = Pick<AdaxonAppContext, 'package_name' | 'app_version'>;
12
- export declare function appFieldsFromNative(constants: NativeAppConstants): NativeAppFields;
3
+ type NativeSource = object | null | undefined;
4
+ export declare function appFieldsFromNative(...sources: NativeSource[]): NativeAppFields;
13
5
  export {};
14
6
  //# sourceMappingURL=app.d.ts.map
@@ -1,3 +1,4 @@
1
+ export { BackHandler, Dimensions, Image, Modal, Platform, Pressable, SafeAreaView, StatusBar, StyleSheet, Text, View, } from 'react-native';
1
2
  import type { AdaxonPlatform } from '../types/EventTypes.js';
2
3
  import type { AppInfoReader, DeviceInfoReader, NetworkInfoReader, NetworkStatusReader, UrlOpener } from './types.js';
3
4
  export declare function detectReactNativePlatform(): AdaxonPlatform;
@@ -9,14 +9,11 @@ interface EventBuilderConfig {
9
9
  appInfo: AppInfoService;
10
10
  networkInfo: NetworkInfoService;
11
11
  validator: EventValidator;
12
- externalUserId?: string;
13
12
  }
14
13
  export declare class EventBuilder {
15
14
  private readonly config;
16
15
  private readonly sessionId;
17
- private externalUserId?;
18
16
  constructor(config: EventBuilderConfig);
19
- setExternalUserId(externalUserId?: string): void;
20
17
  build(input: TrackEventInput): Promise<EventPayload>;
21
18
  }
22
19
  export {};
@@ -1,4 +1,3 @@
1
- import type { RecommendationOffer } from './ApiTypes.js';
2
1
  export interface AdaxonStorageAdapter {
3
2
  getItem(key: string): Promise<string | null>;
4
3
  setItem(key: string, value: string): Promise<void>;
@@ -7,7 +6,6 @@ export interface AdaxonStorageAdapter {
7
6
  export interface AdaxonSdkConfig {
8
7
  appId: string;
9
8
  sdkKey: string;
10
- externalUserId?: string;
11
9
  storage?: AdaxonStorageAdapter;
12
10
  timeoutMs?: number;
13
11
  fetch?: typeof globalThis.fetch;
@@ -19,12 +17,4 @@ export interface AdaxonInitializationListener {
19
17
  onInitializationComplete(): void;
20
18
  onInitializationFailed(error: AdaxonInitializationErrorCode, message: string): void;
21
19
  }
22
- export interface AdaxonRecommendationLoadListener {
23
- onRecommendationsLoaded(offers: RecommendationOffer[]): void;
24
- onRecommendationsFailedToLoad(message: string, code?: string): void;
25
- }
26
- export interface AdaxonOfferShowListener {
27
- onOfferOpened(offer: RecommendationOffer): void;
28
- onOfferFailedToOpen(offer: RecommendationOffer, message: string): void;
29
- }
30
20
  //# sourceMappingURL=AdaxonConfig.d.ts.map
@@ -2,7 +2,6 @@ export type AdaxonPlatform = 'android' | 'ios' | 'web';
2
2
  export type EventPropertyValue = string | number | boolean | null;
3
3
  export type EventProperties = Record<string, EventPropertyValue>;
4
4
  export interface AdaxonUserContext {
5
- external_user_id?: string;
6
5
  anonymous_id: string;
7
6
  }
8
7
  export interface AdaxonDeviceContext {
@@ -47,9 +46,6 @@ export interface EventPayload {
47
46
  session: AdaxonSessionContext;
48
47
  network: AdaxonNetworkContext;
49
48
  }
50
- export interface RecommendationPayload extends EventPayload {
51
- event_type: 'recommendation';
52
- }
53
49
  export interface ClickAttribution {
54
50
  offerId: number;
55
51
  affiliateId: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-test-adx",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Adaxon React Native / Expo SDK for event tracking and offer recommendations.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",