@openpanel/react-native 0.0.1-beta

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/index.cjs ADDED
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // index.ts
31
+ var react_native_exports = {};
32
+ __export(react_native_exports, {
33
+ OpenpanelRN: () => OpenpanelRN
34
+ });
35
+ module.exports = __toCommonJS(react_native_exports);
36
+ var import_react_native = require("react-native");
37
+ var Application = __toESM(require("expo-application"), 1);
38
+ var import_expo_constants = __toESM(require("expo-constants"), 1);
39
+ var import_sdk = require("@openpanel/sdk");
40
+ var OpenpanelRN = class extends import_sdk.Openpanel {
41
+ constructor(options) {
42
+ super(options);
43
+ this.api.headers["User-Agent"] = import_expo_constants.default.getWebViewUserAgentAsync();
44
+ import_react_native.AppState.addEventListener("change", (state) => {
45
+ if (state === "active") {
46
+ this.setProperties();
47
+ }
48
+ });
49
+ this.setProperties();
50
+ }
51
+ async setProperties() {
52
+ this.setGlobalProperties({
53
+ __version: Application.nativeApplicationVersion,
54
+ __buildNumber: Application.nativeBuildVersion,
55
+ __referrer: import_react_native.Platform.OS === "android" ? await Application.getInstallReferrerAsync() : void 0
56
+ });
57
+ }
58
+ screenView(route, properties) {
59
+ super.event("screen_view", {
60
+ ...properties,
61
+ __path: route
62
+ });
63
+ }
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ OpenpanelRN
68
+ });
69
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["import { AppState, Platform } from 'react-native';\nimport * as Application from 'expo-application';\nimport Constants from 'expo-constants';\n\nimport type { OpenpanelBaseOptions, PostEventPayload } from '@openpanel/sdk';\nimport { Openpanel as OpenpanelBase } from '@openpanel/sdk';\n\nexport type OpenpanelOptions = OpenpanelBaseOptions;\n\nexport class OpenpanelRN extends OpenpanelBase<OpenpanelOptions> {\n constructor(options: OpenpanelOptions) {\n super(options);\n\n this.api.headers['User-Agent'] = Constants.getWebViewUserAgentAsync();\n\n AppState.addEventListener('change', (state) => {\n if (state === 'active') {\n this.setProperties();\n }\n });\n\n this.setProperties();\n }\n\n private async setProperties() {\n this.setGlobalProperties({\n __version: Application.nativeApplicationVersion,\n __buildNumber: Application.nativeBuildVersion,\n __referrer:\n Platform.OS === 'android'\n ? await Application.getInstallReferrerAsync()\n : undefined,\n });\n }\n\n public screenView(\n route: string,\n properties?: PostEventPayload['properties']\n ): void {\n super.event('screen_view', {\n ...properties,\n __path: route,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAmC;AACnC,kBAA6B;AAC7B,4BAAsB;AAGtB,iBAA2C;AAIpC,IAAM,cAAN,cAA0B,WAAAA,UAAgC;AAAA,EAC/D,YAAY,SAA2B;AACrC,UAAM,OAAO;AAEb,SAAK,IAAI,QAAQ,YAAY,IAAI,sBAAAC,QAAU,yBAAyB;AAEpE,iCAAS,iBAAiB,UAAU,CAAC,UAAU;AAC7C,UAAI,UAAU,UAAU;AACtB,aAAK,cAAc;AAAA,MACrB;AAAA,IACF,CAAC;AAED,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,MAAc,gBAAgB;AAC5B,SAAK,oBAAoB;AAAA,MACvB,WAAuB;AAAA,MACvB,eAA2B;AAAA,MAC3B,YACE,6BAAS,OAAO,YACZ,MAAkB,oCAAwB,IAC1C;AAAA,IACR,CAAC;AAAA,EACH;AAAA,EAEO,WACL,OACA,YACM;AACN,UAAM,MAAM,eAAe;AAAA,MACzB,GAAG;AAAA,MACH,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;","names":["OpenpanelBase","Constants"]}
@@ -0,0 +1,10 @@
1
+ import { OpenpanelBaseOptions, Openpanel, PostEventPayload } from '@openpanel/sdk';
2
+
3
+ type OpenpanelOptions = OpenpanelBaseOptions;
4
+ declare class OpenpanelRN extends Openpanel<OpenpanelOptions> {
5
+ constructor(options: OpenpanelOptions);
6
+ private setProperties;
7
+ screenView(route: string, properties?: PostEventPayload['properties']): void;
8
+ }
9
+
10
+ export { type OpenpanelOptions, OpenpanelRN };
@@ -0,0 +1,10 @@
1
+ import { OpenpanelBaseOptions, Openpanel, PostEventPayload } from '@openpanel/sdk';
2
+
3
+ type OpenpanelOptions = OpenpanelBaseOptions;
4
+ declare class OpenpanelRN extends Openpanel<OpenpanelOptions> {
5
+ constructor(options: OpenpanelOptions);
6
+ private setProperties;
7
+ screenView(route: string, properties?: PostEventPayload['properties']): void;
8
+ }
9
+
10
+ export { type OpenpanelOptions, OpenpanelRN };
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ // index.ts
2
+ import { AppState, Platform } from "react-native";
3
+ import * as Application from "expo-application";
4
+ import Constants from "expo-constants";
5
+ import { Openpanel as OpenpanelBase } from "@openpanel/sdk";
6
+ var OpenpanelRN = class extends OpenpanelBase {
7
+ constructor(options) {
8
+ super(options);
9
+ this.api.headers["User-Agent"] = Constants.getWebViewUserAgentAsync();
10
+ AppState.addEventListener("change", (state) => {
11
+ if (state === "active") {
12
+ this.setProperties();
13
+ }
14
+ });
15
+ this.setProperties();
16
+ }
17
+ async setProperties() {
18
+ this.setGlobalProperties({
19
+ __version: Application.nativeApplicationVersion,
20
+ __buildNumber: Application.nativeBuildVersion,
21
+ __referrer: Platform.OS === "android" ? await Application.getInstallReferrerAsync() : void 0
22
+ });
23
+ }
24
+ screenView(route, properties) {
25
+ super.event("screen_view", {
26
+ ...properties,
27
+ __path: route
28
+ });
29
+ }
30
+ };
31
+ export {
32
+ OpenpanelRN
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.ts"],"sourcesContent":["import { AppState, Platform } from 'react-native';\nimport * as Application from 'expo-application';\nimport Constants from 'expo-constants';\n\nimport type { OpenpanelBaseOptions, PostEventPayload } from '@openpanel/sdk';\nimport { Openpanel as OpenpanelBase } from '@openpanel/sdk';\n\nexport type OpenpanelOptions = OpenpanelBaseOptions;\n\nexport class OpenpanelRN extends OpenpanelBase<OpenpanelOptions> {\n constructor(options: OpenpanelOptions) {\n super(options);\n\n this.api.headers['User-Agent'] = Constants.getWebViewUserAgentAsync();\n\n AppState.addEventListener('change', (state) => {\n if (state === 'active') {\n this.setProperties();\n }\n });\n\n this.setProperties();\n }\n\n private async setProperties() {\n this.setGlobalProperties({\n __version: Application.nativeApplicationVersion,\n __buildNumber: Application.nativeBuildVersion,\n __referrer:\n Platform.OS === 'android'\n ? await Application.getInstallReferrerAsync()\n : undefined,\n });\n }\n\n public screenView(\n route: string,\n properties?: PostEventPayload['properties']\n ): void {\n super.event('screen_view', {\n ...properties,\n __path: route,\n });\n }\n}\n"],"mappings":";AAAA,SAAS,UAAU,gBAAgB;AACnC,YAAY,iBAAiB;AAC7B,OAAO,eAAe;AAGtB,SAAS,aAAa,qBAAqB;AAIpC,IAAM,cAAN,cAA0B,cAAgC;AAAA,EAC/D,YAAY,SAA2B;AACrC,UAAM,OAAO;AAEb,SAAK,IAAI,QAAQ,YAAY,IAAI,UAAU,yBAAyB;AAEpE,aAAS,iBAAiB,UAAU,CAAC,UAAU;AAC7C,UAAI,UAAU,UAAU;AACtB,aAAK,cAAc;AAAA,MACrB;AAAA,IACF,CAAC;AAED,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,MAAc,gBAAgB;AAC5B,SAAK,oBAAoB;AAAA,MACvB,WAAuB;AAAA,MACvB,eAA2B;AAAA,MAC3B,YACE,SAAS,OAAO,YACZ,MAAkB,oCAAwB,IAC1C;AAAA,IACR,CAAC;AAAA,EACH;AAAA,EAEO,WACL,OACA,YACM;AACN,UAAM,MAAM,eAAe;AAAA,MACzB,GAAG;AAAA,MACH,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@openpanel/react-native",
3
+ "version": "0.0.1-beta",
4
+ "module": "./dist/index.mjs",
5
+ "scripts": {
6
+ "build": "rm -rf dist && tsup",
7
+ "lint": "eslint .",
8
+ "format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
9
+ "typecheck": "tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@openpanel/sdk": "0.0.1-beta"
13
+ },
14
+ "devDependencies": {
15
+ "@openpanel/eslint-config": "workspace:*",
16
+ "@openpanel/prettier-config": "workspace:*",
17
+ "@openpanel/tsconfig": "workspace:*",
18
+ "eslint": "^8.48.0",
19
+ "prettier": "^3.0.3",
20
+ "tsup": "^7.2.0",
21
+ "typescript": "^5.2.2"
22
+ },
23
+ "peerDependencies": {
24
+ "react-native": "^0.72.5",
25
+ "expo-application": "~5.3.0",
26
+ "expo-constants": "~14.4.2"
27
+ },
28
+ "eslintConfig": {
29
+ "root": true,
30
+ "extends": [
31
+ "@openpanel/eslint-config/base"
32
+ ]
33
+ },
34
+ "prettier": "@openpanel/prettier-config",
35
+ "private": false,
36
+ "type": "module",
37
+ "main": "./dist/index.js",
38
+ "types": "./dist/index.d.ts",
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "exports": {
43
+ "import": "./dist/index.js",
44
+ "require": "./dist/index.cjs"
45
+ }
46
+ }