@openpanel/react-native 0.0.1-beta → 0.0.3-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 CHANGED
@@ -1,69 +1,2 @@
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
- });
1
+ "use strict";var O=Object.create;var a=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var p in e)a(t,p,{get:e[p],enumerable:!0})},s=(t,e,p,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P(e))!u.call(t,o)&&o!==p&&a(t,o,{get:()=>e[o],enumerable:!(c=A(e,o))||c.enumerable});return t},n=(t,e,p)=>(s(t,e,"default"),p&&s(p,e,"default")),m=(t,e,p)=>(p=t!=null?O(_(t)):{},s(e||!t||!t.__esModule?a(p,"default",{value:t,enumerable:!0}):p,t)),y=t=>s(a({},"__esModule",{value:!0}),t);var i={};h(i,{Openpanel:()=>d});module.exports=y(i);var l=require("react-native"),r=m(require("expo-application"),1),f=m(require("expo-constants"),1),v=require("@openpanel/sdk");n(i,require("@openpanel/sdk"),module.exports);var d=class extends v.OpenpanelSdk{constructor(e){super(e),this.api.headers["User-Agent"]=f.default.getWebViewUserAgentAsync(),l.AppState.addEventListener("change",p=>{p==="active"&&this.setProperties()}),this.setProperties()}async setProperties(){this.setGlobalProperties({__version:r.nativeApplicationVersion,__buildNumber:r.nativeBuildVersion,__referrer:l.Platform.OS==="android"?await r.getInstallReferrerAsync():void 0})}screenView(e,p){super.event("screen_view",{...p,__path:e})}};0&&(module.exports={Openpanel,...require("@openpanel/sdk")});
69
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +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"]}
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 { OpenpanelSdkOptions, PostEventPayload } from '@openpanel/sdk';\nimport { OpenpanelSdk } from '@openpanel/sdk';\n\nexport * from '@openpanel/sdk';\nexport type OpenpanelOptions = OpenpanelSdkOptions;\n\nexport class Openpanel extends OpenpanelSdk<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":"wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,wBACnCC,EAA6B,iCAC7BC,EAAsB,+BAGtBC,EAA6B,0BAE7BC,EAAAR,EAAc,0BAPd,gBAUO,IAAME,EAAN,cAAwB,cAA+B,CAC5D,YAAYO,EAA2B,CACrC,MAAMA,CAAO,EAEb,KAAK,IAAI,QAAQ,YAAY,EAAI,EAAAC,QAAU,yBAAyB,EAEpE,WAAS,iBAAiB,SAAWC,GAAU,CACzCA,IAAU,UACZ,KAAK,cAAc,CAEvB,CAAC,EAED,KAAK,cAAc,CACrB,CAEA,MAAc,eAAgB,CAC5B,KAAK,oBAAoB,CACvB,UAAuB,2BACvB,cAA2B,qBAC3B,WACE,WAAS,KAAO,UACZ,MAAkB,0BAAwB,EAC1C,MACR,CAAC,CACH,CAEO,WACLC,EACAC,EACM,CACN,MAAM,MAAM,cAAe,CACzB,GAAGA,EACH,OAAQD,CACV,CAAC,CACH,CACF","names":["react_native_exports","__export","Openpanel","__toCommonJS","import_react_native","Application","import_expo_constants","import_sdk","__reExport","options","Constants","state","route","properties"]}
package/dist/index.d.cts CHANGED
@@ -1,10 +1,11 @@
1
- import { OpenpanelBaseOptions, Openpanel, PostEventPayload } from '@openpanel/sdk';
1
+ import { OpenpanelSdkOptions, OpenpanelSdk, PostEventPayload } from '@openpanel/sdk';
2
+ export * from '@openpanel/sdk';
2
3
 
3
- type OpenpanelOptions = OpenpanelBaseOptions;
4
- declare class OpenpanelRN extends Openpanel<OpenpanelOptions> {
4
+ type OpenpanelOptions = OpenpanelSdkOptions;
5
+ declare class Openpanel extends OpenpanelSdk<OpenpanelOptions> {
5
6
  constructor(options: OpenpanelOptions);
6
7
  private setProperties;
7
8
  screenView(route: string, properties?: PostEventPayload['properties']): void;
8
9
  }
9
10
 
10
- export { type OpenpanelOptions, OpenpanelRN };
11
+ export { Openpanel, type OpenpanelOptions };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { OpenpanelBaseOptions, Openpanel, PostEventPayload } from '@openpanel/sdk';
1
+ import { OpenpanelSdkOptions, OpenpanelSdk, PostEventPayload } from '@openpanel/sdk';
2
+ export * from '@openpanel/sdk';
2
3
 
3
- type OpenpanelOptions = OpenpanelBaseOptions;
4
- declare class OpenpanelRN extends Openpanel<OpenpanelOptions> {
4
+ type OpenpanelOptions = OpenpanelSdkOptions;
5
+ declare class Openpanel extends OpenpanelSdk<OpenpanelOptions> {
5
6
  constructor(options: OpenpanelOptions);
6
7
  private setProperties;
7
8
  screenView(route: string, properties?: PostEventPayload['properties']): void;
8
9
  }
9
10
 
10
- export { type OpenpanelOptions, OpenpanelRN };
11
+ export { Openpanel, type OpenpanelOptions };
package/dist/index.js CHANGED
@@ -1,34 +1,2 @@
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
- };
1
+ import{AppState as n,Platform as r}from"react-native";import*as e from"expo-application";import o from"expo-constants";import{OpenpanelSdk as s}from"@openpanel/sdk";export*from"@openpanel/sdk";var i=class extends s{constructor(t){super(t),this.api.headers["User-Agent"]=o.getWebViewUserAgentAsync(),n.addEventListener("change",p=>{p==="active"&&this.setProperties()}),this.setProperties()}async setProperties(){this.setGlobalProperties({__version:e.nativeApplicationVersion,__buildNumber:e.nativeBuildVersion,__referrer:r.OS==="android"?await e.getInstallReferrerAsync():void 0})}screenView(t,p){super.event("screen_view",{...p,__path:t})}};export{i as Openpanel};
34
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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":[]}
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 { OpenpanelSdkOptions, PostEventPayload } from '@openpanel/sdk';\nimport { OpenpanelSdk } from '@openpanel/sdk';\n\nexport * from '@openpanel/sdk';\nexport type OpenpanelOptions = OpenpanelSdkOptions;\n\nexport class Openpanel extends OpenpanelSdk<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,OAAS,YAAAA,EAAU,YAAAC,MAAgB,eACnC,UAAYC,MAAiB,mBAC7B,OAAOC,MAAe,iBAGtB,OAAS,gBAAAC,MAAoB,iBAE7B,WAAc,iBAGP,IAAMC,EAAN,cAAwBD,CAA+B,CAC5D,YAAYE,EAA2B,CACrC,MAAMA,CAAO,EAEb,KAAK,IAAI,QAAQ,YAAY,EAAIH,EAAU,yBAAyB,EAEpEH,EAAS,iBAAiB,SAAWO,GAAU,CACzCA,IAAU,UACZ,KAAK,cAAc,CAEvB,CAAC,EAED,KAAK,cAAc,CACrB,CAEA,MAAc,eAAgB,CAC5B,KAAK,oBAAoB,CACvB,UAAuB,2BACvB,cAA2B,qBAC3B,WACEN,EAAS,KAAO,UACZ,MAAkB,0BAAwB,EAC1C,MACR,CAAC,CACH,CAEO,WACLO,EACAC,EACM,CACN,MAAM,MAAM,cAAe,CACzB,GAAGA,EACH,OAAQD,CACV,CAAC,CACH,CACF","names":["AppState","Platform","Application","Constants","OpenpanelSdk","Openpanel","options","state","route","properties"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpanel/react-native",
3
- "version": "0.0.1-beta",
3
+ "version": "0.0.3-beta",
4
4
  "module": "./dist/index.mjs",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist && tsup",
@@ -9,7 +9,7 @@
9
9
  "typecheck": "tsc --noEmit"
10
10
  },
11
11
  "dependencies": {
12
- "@openpanel/sdk": "0.0.1-beta"
12
+ "@openpanel/sdk": "0.0.3-beta"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@openpanel/eslint-config": "workspace:*",