Skip to content

Commit 3cdb9cf

Browse files
Paul Boocockpaulboocock
authored andcommitted
Export Plugin Interfaces for Browser and Core plugins (close snowplow#933)
1 parent 8c9ef07 commit 3cdb9cf

4 files changed

Lines changed: 22 additions & 9 deletions

File tree

trackers/browser-tracker/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030

31-
import { createSharedState, addTracker, TrackerConfiguration, BrowserTracker } from '@snowplow/browser-tracker-core';
31+
import {
32+
createSharedState,
33+
addTracker,
34+
TrackerConfiguration,
35+
BrowserTracker,
36+
BrowserPlugin,
37+
} from '@snowplow/browser-tracker-core';
3238
import { version } from './version';
3339

3440
const state = typeof window !== 'undefined' ? createSharedState() : undefined;
@@ -63,6 +69,6 @@ export function newTracker(trackerId: string, endpoint: string, configuration: T
6369
}
6470
}
6571

66-
export { BrowserTracker, TrackerConfiguration };
72+
export { BrowserTracker, TrackerConfiguration, BrowserPlugin };
6773
export { version } from './version';
6874
export * from './api';

trackers/node-tracker/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ npm install @snowplow/node-tracker
3131
Initialize your tracker with your desired configuration:
3232

3333
```js
34-
import { tracker, gotEmitter } from 'snowplow-tracker';
34+
import { tracker, gotEmitter } from '@snowplow/node-tracker';
3535

3636
const e = gotEmitter(
3737
'collector.mydomain.net', // Collector endpoint
@@ -50,7 +50,7 @@ Then use the `track` function from this package, along with the `buildX` functio
5050
import {
5151
buildSelfDescribingEvent,
5252
buildPageView
53-
} from '@snowplow/tracker-core';
53+
} from '@snowplow/node-tracker';
5454

5555
const context = [
5656
{
@@ -66,14 +66,14 @@ t.track(
6666
context
6767
);
6868

69-
const evnetJson = {
69+
const eventJson = {
7070
schema: 'iglu:com.acme/viewed_product/jsonschema/1-0-0',
7171
data: {
7272
price: 20,
7373
},
7474
};
7575

76-
track.track(buildSelfDescribingEvent({ event: evnetJson }), context);
76+
track.track(buildSelfDescribingEvent({ event: eventJson }), context);
7777
```
7878

7979
To enable success and failure callback debugging, run your application with `NODE_DEBUG=snowplow`.

trackers/node-tracker/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ export {
7575
EcommerceTransactionItemEvent,
7676
SelfDescribingJson,
7777
Timestamp,
78+
PayloadBuilder,
79+
Payload,
80+
CorePlugin,
81+
CoreConfiguration,
7882
} from '@snowplow/tracker-core';

trackers/node-tracker/test/tracker.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@
2929
*/
3030

3131
import {
32+
tracker,
33+
gotEmitter,
34+
version,
35+
HttpMethod,
36+
HttpProtocol,
3237
buildEcommerceTransaction,
3338
buildEcommerceTransactionItem,
3439
buildPageView,
3540
buildScreenView,
3641
buildSelfDescribingEvent,
3742
buildStructEvent,
3843
Payload,
39-
} from '@snowplow/tracker-core';
44+
} from '../src/index';
4045
import test, { ExecutionContext } from 'ava';
4146
import nock from 'nock';
4247
import querystring from 'querystring';
4348

44-
import { tracker, gotEmitter, version, HttpMethod, HttpProtocol } from '../src/index';
45-
4649
const testMethods = [HttpMethod.GET, HttpMethod.POST];
4750

4851
const endpoint = 'd3rkrsqld9gmqf.cloudfront.net';

0 commit comments

Comments
 (0)