Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AsyncStorage](./react-native-tracker.asyncstorage.md) &gt; [getItem](./react-native-tracker.asyncstorage.getitem.md)

## AsyncStorage.getItem property

<b>Signature:</b>

```typescript
getItem: (key: string) => Promise<string | null>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AsyncStorage](./react-native-tracker.asyncstorage.md)

## AsyncStorage interface

<b>Signature:</b>

```typescript
export interface AsyncStorage
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [getItem](./react-native-tracker.asyncstorage.getitem.md) | (key: string) =&gt; Promise&lt;string \| null&gt; | |
| [setItem](./react-native-tracker.asyncstorage.setitem.md) | (key: string, value: string) =&gt; Promise&lt;void&gt; | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AsyncStorage](./react-native-tracker.asyncstorage.md) &gt; [setItem](./react-native-tracker.asyncstorage.setitem.md)

## AsyncStorage.setItem property

<b>Signature:</b>

```typescript
setItem: (key: string, value: string) => Promise<void>;
```

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) &gt; [asyncStorage](./react-native-tracker.eventstoreconfiguration.asyncstorage.md)

## EventStoreConfiguration.asyncStorage property

The Async storage implementation. In environments where AsyncStorage is not available or where another kind of storage is used, you can provide a custom implementation.

<b>Signature:</b>

```typescript
asyncStorage?: AsyncStorage;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface EventStoreConfiguration

| Property | Type | Description |
| --- | --- | --- |
| [asyncStorage?](./react-native-tracker.eventstoreconfiguration.asyncstorage.md) | [AsyncStorage](./react-native-tracker.asyncstorage.md) | <i>(Optional)</i> The Async storage implementation. In environments where AsyncStorage is not available or where another kind of storage is used, you can provide a custom implementation. |
| [maxEventStoreSize?](./react-native-tracker.eventstoreconfiguration.maxeventstoresize.md) | number | <i>(Optional)</i> The maximum amount of events that will be buffered in the event store<!-- -->Will drop events once the limit is hit |
| [useAsyncStorageForEventStore?](./react-native-tracker.eventstoreconfiguration.useasyncstorageforeventstore.md) | boolean | <i>(Optional)</i> Whether to use the AsyncStorage library as the persistent event store for the event store |

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
| Interface | Description |
| --- | --- |
| [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) | Configuration for app lifecycle tracking |
| [AsyncStorage](./react-native-tracker.asyncstorage.md) | |
| [CoreConfiguration](./react-native-tracker.coreconfiguration.md) | The configuration object for the tracker core library |
| [CorePlugin](./react-native-tracker.coreplugin.md) | Interface which defines Core Plugins |
| [CorePluginConfiguration](./react-native-tracker.corepluginconfiguration.md) | The configuration of the plugin to add |
Expand All @@ -36,7 +37,6 @@
| [EmitterConfiguration](./react-native-tracker.emitterconfiguration.md) | |
| [EmitterConfigurationBase](./react-native-tracker.emitterconfigurationbase.md) | |
| [EventPayloadAndContext](./react-native-tracker.eventpayloadandcontext.md) | Interface for returning a built event (PayloadBuilder) and context (Array of SelfDescribingJson). |
| [EventStore](./react-native-tracker.eventstore.md) | EventStore allows storing and retrieving events before they are sent to the collector |
| [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) | Configuration for the event store |
| [EventStoreIterator](./react-native-tracker.eventstoreiterator.md) | EventStoreIterator allows iterating over all events in the store. |
| [EventStorePayload](./react-native-tracker.eventstorepayload.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Creates a new tracker instance with the given configuration
<b>Signature:</b>

```typescript
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration & AppLifecycleConfiguration): Promise<ReactNativeTracker>;
export declare function newTracker(configuration: Configuration): Promise<ReactNativeTracker>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| configuration | [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &amp; EmitterConfiguration &amp; [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) &amp; [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md) &amp; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) &amp; ScreenTrackingConfiguration &amp; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &amp; [DeepLinkConfiguration](./react-native-tracker.deeplinkconfiguration.md) &amp; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) | Configuration for the tracker |
| configuration | Configuration | Configuration for the tracker |

<b>Returns:</b>

Expand Down
24 changes: 13 additions & 11 deletions api-docs/docs/react-native-tracker/react-native-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export interface AppLifecycleConfiguration {
lifecycleAutotracking?: boolean;
}

// @public (undocumented)
export interface AsyncStorage {
// (undocumented)
getItem: (key: string) => Promise<string | null>;
// (undocumented)
setItem: (key: string, value: string) => Promise<void>;
}

// @public
export type ConditionalContextProvider = FilterProvider | RuleSetProvider;

Expand Down Expand Up @@ -117,6 +125,7 @@ export interface EmitterConfigurationBase {
customHeaders?: Record<string, string>;
dontRetryStatusCodes?: number[];
eventMethod?: EventMethod;
// Warning: (ae-forgotten-export) The symbol "EventStore" needs to be exported by the entry point index.d.ts
eventStore?: EventStore;
idService?: string;
keepalive?: boolean;
Expand Down Expand Up @@ -155,18 +164,9 @@ export interface EventPayloadAndContext {
event: PayloadBuilder;
}

// @public
export interface EventStore {
add: (payload: EventStorePayload) => Promise<number>;
count: () => Promise<number>;
getAll: () => Promise<readonly EventStorePayload[]>;
getAllPayloads: () => Promise<readonly Payload[]>;
iterator: () => EventStoreIterator;
removeHead: (count: number) => Promise<void>;
}

// @public
export interface EventStoreConfiguration {
asyncStorage?: AsyncStorage;
maxEventStoreSize?: number;
useAsyncStorageForEventStore?: boolean;
}
Expand Down Expand Up @@ -280,8 +280,10 @@ export type MessageNotificationProps = {
trigger: Trigger;
};

// Warning: (ae-forgotten-export) The symbol "Configuration" needs to be exported by the entry point index.d.ts
//
// @public
export function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration & AppLifecycleConfiguration): Promise<ReactNativeTracker>;
export function newTracker(configuration: Configuration): Promise<ReactNativeTracker>;

// @public
export interface PageViewEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/browser-plugin-button-click-tracking",
"comment": "Allow per-tracker disabling",
"type": "none"
}
],
"packageName": "@snowplow/browser-plugin-button-click-tracking"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/browser-plugin-button-click-tracking",
"comment": "Add default label to avoid bad events",
"type": "none"
}
],
"packageName": "@snowplow/browser-plugin-button-click-tracking"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/browser-tracker-core",
"comment": "Avoid undelivered notifications error (#1335)",
"type": "none"
}
],
"packageName": "@snowplow/browser-tracker-core"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/javascript-tracker",
"comment": "Fix inactive button-click test",
"type": "none"
}
],
"packageName": "@snowplow/javascript-tracker"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/react-native-tracker",
"comment": "Allow configuring a custom event store in React Native tracker (close #1413)",
"type": "none"
}
],
"packageName": "@snowplow/react-native-tracker"
}
16 changes: 11 additions & 5 deletions libraries/browser-tracker-core/src/helpers/browser_props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@ function useResizeObserver(): boolean {
}

let resizeObserverInitialized = false;
let readBrowserPropertiesTask: number | null = null;
function initializeResizeObserver() {
if (resizeObserverInitialized) {
return;
}
if(!document || !document.body || !document.documentElement) {
if (!document || !document.body || !document.documentElement) {
return;
}
resizeObserverInitialized = true;

const resizeObserver = new ResizeObserver((entries) => {
for (let entry of entries) {
if (entry.target === document.body || entry.target === document.documentElement) {
const resizeObserver = new ResizeObserver(() => {
if (!readBrowserPropertiesTask) {
// The browser property lookup causes a forced synchronous layout when offsets/sizes are
// queried. It's possible that the forced synchronous layout causes the ResizeObserver
// to be fired again, leading to an infinite loop and the "ResizeObserver loop completed
// with undelivered notifications" error.
readBrowserPropertiesTask = requestAnimationFrame(() => {
readBrowserPropertiesTask = null;
cachedProperties = readBrowserProperties();
}
});
}
});
resizeObserver.observe(document.body);
Expand Down
Loading
Loading