@nexly/core 0.10.0 → 0.12.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/dist/clients.d.ts +17 -0
- package/dist/clients.d.ts.map +1 -0
- package/dist/clients.js +14 -0
- package/dist/collect.d.ts +6 -5
- package/dist/collect.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/nexly-base.d.ts +9 -5
- package/dist/nexly-base.d.ts.map +1 -1
- package/dist/nexly-base.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which SDK is reporting an event. Each runtime/framework package ships its own
|
|
3
|
+
* constant; framework wrappers override (e.g. `@nexly/next` sends `Next` on top
|
|
4
|
+
* of `@nexly/react-web`). Wire values are kebab-case; the backend rejects any
|
|
5
|
+
* other value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const NexlyClient: {
|
|
8
|
+
readonly Web: "web";
|
|
9
|
+
readonly React: "react";
|
|
10
|
+
readonly Next: "next";
|
|
11
|
+
readonly RNIos: "rn-ios";
|
|
12
|
+
readonly RNAndroid: "rn-android";
|
|
13
|
+
readonly RNWeb: "rn-web";
|
|
14
|
+
};
|
|
15
|
+
/** Type union of all known client identifiers (string-literal type). */
|
|
16
|
+
export type NexlyClient = (typeof NexlyClient)[keyof typeof NexlyClient];
|
|
17
|
+
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAA;AAEV,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA"}
|
package/dist/clients.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which SDK is reporting an event. Each runtime/framework package ships its own
|
|
3
|
+
* constant; framework wrappers override (e.g. `@nexly/next` sends `Next` on top
|
|
4
|
+
* of `@nexly/react-web`). Wire values are kebab-case; the backend rejects any
|
|
5
|
+
* other value.
|
|
6
|
+
*/
|
|
7
|
+
export const NexlyClient = {
|
|
8
|
+
Web: 'web',
|
|
9
|
+
React: 'react',
|
|
10
|
+
Next: 'next',
|
|
11
|
+
RNIos: 'rn-ios',
|
|
12
|
+
RNAndroid: 'rn-android',
|
|
13
|
+
RNWeb: 'rn-web',
|
|
14
|
+
};
|
package/dist/collect.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This module is safe to import from any runtime (browser, React Native, Node).
|
|
5
5
|
* Transport (beacon / fetch / native) lives in platform-specific packages.
|
|
6
6
|
*/
|
|
7
|
+
import type { NexlyClient } from './clients.js';
|
|
7
8
|
/** Auth fields for ingest (no transport URL). */
|
|
8
9
|
export type IngestCredentials = {
|
|
9
10
|
appId: string;
|
|
@@ -13,7 +14,7 @@ export type IngestCredentials = {
|
|
|
13
14
|
export type CollectCredentials = {
|
|
14
15
|
collectUrl: string;
|
|
15
16
|
/** Which SDK identity to report (see {@link TrackEventInput.client}). Optional. */
|
|
16
|
-
client?:
|
|
17
|
+
client?: NexlyClient;
|
|
17
18
|
} & IngestCredentials;
|
|
18
19
|
/**
|
|
19
20
|
* Event envelope:
|
|
@@ -26,11 +27,11 @@ export type TrackEventInput = {
|
|
|
26
27
|
eventName: string;
|
|
27
28
|
eventType: string;
|
|
28
29
|
/**
|
|
29
|
-
* Which SDK is sending the event.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* Which SDK is sending the event. See {@link NexlyClient}.
|
|
31
|
+
* Emitted as top-level `client` on the wire when non-empty. The backend
|
|
32
|
+
* rejects any value outside the enum.
|
|
32
33
|
*/
|
|
33
|
-
client?:
|
|
34
|
+
client?: NexlyClient;
|
|
34
35
|
context?: Record<string, unknown>;
|
|
35
36
|
data?: Record<string, unknown>;
|
|
36
37
|
sessionContext?: Record<string, unknown>;
|
package/dist/collect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../src/collect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,MAAM,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../src/collect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,iBAAiB,CAAA;AAErB;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,iBAAiB,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACzC,CAAA;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwBnF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { buildCollectPayload, type CollectCredentials, type IngestCredentials, type TrackEventInput, } from './collect.js';
|
|
9
9
|
export { NexlyBase, DEFAULT_COLLECT_URL, type NexlyEventInput, type NexlyEventType, type NexlyInit, } from './nexly-base.js';
|
|
10
|
+
export { NexlyClient } from './clients.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/nexly-base.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NexlyClient } from './clients.js';
|
|
1
2
|
import { type IngestCredentials } from './collect.js';
|
|
2
3
|
export declare const DEFAULT_COLLECT_URL = "https://gate.nexly.to/v1/collect";
|
|
3
4
|
/** Options for {@link NexlyBase}. `key` is the ingest API token (sent as `api_token` on the wire). */
|
|
@@ -7,11 +8,14 @@ export type NexlyInit = {
|
|
|
7
8
|
appId: string;
|
|
8
9
|
key: string;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* SDK identifier sent on the wire as `client`. Runtime packages (e.g.
|
|
14
|
+
* `@nexly/web`, `@nexly/react-native`) set a default here; framework
|
|
15
|
+
* adapters (e.g. `@nexly/next`) override via the React context exported
|
|
16
|
+
* from `@nexly/react-web`. Application code should not set this directly.
|
|
13
17
|
*/
|
|
14
|
-
client?:
|
|
18
|
+
client?: NexlyClient;
|
|
15
19
|
};
|
|
16
20
|
/** Allowed event types. The backend rejects any other value. */
|
|
17
21
|
export type NexlyEventType = 'pageview' | 'engagement' | 'custom';
|
|
@@ -40,7 +44,7 @@ export declare abstract class NexlyBase {
|
|
|
40
44
|
readonly collectUrl: string;
|
|
41
45
|
readonly appId: string;
|
|
42
46
|
readonly key: string;
|
|
43
|
-
readonly client:
|
|
47
|
+
readonly client: NexlyClient | undefined;
|
|
44
48
|
protected constructor(init: NexlyInit);
|
|
45
49
|
protected get disabled(): boolean;
|
|
46
50
|
protected get credentials(): IngestCredentials;
|
package/dist/nexly-base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexly-base.d.ts","sourceRoot":"","sources":["../src/nexly-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAI1E,eAAO,MAAM,mBAAmB,qCAAqC,CAAA;AAErE,s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A;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAExC,SAAS,aAAa,IAAI,EAAE,SAAS;IASrC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAEhC;IAED,SAAS,KAAK,WAAW,IAAI,iBAAiB,CAE7C;IAED,kFAAkF;IAClF,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;IAEvE,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEjE,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnE,kDAAkD;IAClD,QAAQ,CAAC,cAAc,IAAI,MAAM;IAEjC,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,IAAI,MAAM,IAAI;IAEtC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO;IAYhC;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAatC,OAAO,CAAC,QAAQ;CAkBjB"}
|
package/dist/nexly-base.js
CHANGED
|
@@ -27,7 +27,7 @@ export class NexlyBase {
|
|
|
27
27
|
this.collectUrl = (init.collectUrl ?? DEFAULT_COLLECT_URL).trim();
|
|
28
28
|
this.appId = (init.appId ?? '').trim();
|
|
29
29
|
this.key = (init.key ?? '').trim();
|
|
30
|
-
this.client =
|
|
30
|
+
this.client = init.client;
|
|
31
31
|
if (!this.appId)
|
|
32
32
|
console.warn('[Nexly] Missing appId — tracking will be disabled.');
|
|
33
33
|
if (!this.key)
|