@rpcbase/client 0.362.0 → 0.363.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.
@@ -1,4 +1,4 @@
1
1
  export declare const instrument: ({ posthogKey }: {
2
2
  posthogKey?: string;
3
- }) => void;
3
+ }) => Promise<void>;
4
4
  //# sourceMappingURL=instrument.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.d.ts","sourceRoot":"","sources":["../src/instrument.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,GAAI,gBAAc;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,SA2B7D,CAAA"}
1
+ {"version":3,"file":"instrument.d.ts","sourceRoot":"","sources":["../src/instrument.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,GAAU,gBAAc;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,kBAiCnE,CAAA"}
@@ -1,28 +1,32 @@
1
- import posthog from "posthog-js";
2
1
  import { s as setClientExceptionReporter } from "./errorReporting-CVoUUKxW.js";
3
- const instrument = ({ posthogKey }) => {
2
+ const instrument = async ({ posthogKey }) => {
4
3
  if (typeof posthogKey === "string" && posthogKey.length > 0) {
5
- posthog.init(posthogKey, {
6
- api_host: "/ingest",
7
- ui_host: "https://eu.posthog.com",
8
- person_profiles: "always",
9
- session_recording: {
10
- maskAllInputs: false
11
- },
12
- capture_exceptions: {
13
- capture_unhandled_errors: true,
14
- capture_unhandled_rejections: true,
15
- capture_console_errors: true
16
- },
17
- capture_pageview: true,
18
- autocapture: true,
19
- disable_session_recording: false,
20
- disable_surveys: true,
21
- disable_surveys_automatic_display: true
22
- });
23
- setClientExceptionReporter((error, context) => {
24
- posthog.captureException(error, context);
25
- });
4
+ try {
5
+ const { default: posthog } = await import("posthog-js");
6
+ posthog.init(posthogKey, {
7
+ api_host: "/ingest",
8
+ ui_host: "https://eu.posthog.com",
9
+ person_profiles: "always",
10
+ session_recording: {
11
+ maskAllInputs: false
12
+ },
13
+ capture_exceptions: {
14
+ capture_unhandled_errors: true,
15
+ capture_unhandled_rejections: true,
16
+ capture_console_errors: true
17
+ },
18
+ capture_pageview: true,
19
+ autocapture: true,
20
+ disable_session_recording: false,
21
+ disable_surveys: true,
22
+ disable_surveys_automatic_display: true
23
+ });
24
+ setClientExceptionReporter((error, context) => {
25
+ posthog.captureException(error, context);
26
+ });
27
+ } catch (err) {
28
+ console.warn("instrument: failed to load posthog-js", err);
29
+ }
26
30
  } else {
27
31
  console.warn("instrument: missing posthogKey");
28
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.js","sources":["../src/instrument.ts"],"sourcesContent":["import posthog from \"posthog-js\"\n\nimport { setClientExceptionReporter } from \"./errorReporting\"\n\n\nexport const instrument = ({posthogKey}: {posthogKey?: string}) => {\n if (typeof posthogKey === \"string\" && posthogKey.length > 0) {\n posthog.init(posthogKey, {\n api_host: \"/ingest\",\n ui_host: \"https://eu.posthog.com\",\n person_profiles: \"always\",\n session_recording: {\n maskAllInputs: false\n },\n capture_exceptions: {\n capture_unhandled_errors: true,\n capture_unhandled_rejections: true,\n capture_console_errors: true,\n },\n capture_pageview: true,\n autocapture: true,\n disable_session_recording: false,\n disable_surveys: true,\n disable_surveys_automatic_display: true,\n })\n\n setClientExceptionReporter((error, context) => {\n posthog.captureException(error, context)\n })\n } else {\n console.warn(\"instrument: missing posthogKey\")\n }\n}\n"],"names":[],"mappings":";;AAKO,MAAM,aAAa,CAAC,EAAC,iBAAuC;AACjE,MAAI,OAAO,eAAe,YAAY,WAAW,SAAS,GAAG;AAC3D,YAAQ,KAAK,YAAY;AAAA,MACvB,UAAU;AAAA,MACV,SAAS;AAAA,MACT,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,QACjB,eAAe;AAAA,MAAA;AAAA,MAEjB,oBAAoB;AAAA,QAClB,0BAA0B;AAAA,QAC1B,8BAA8B;AAAA,QAC9B,wBAAwB;AAAA,MAAA;AAAA,MAE1B,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,2BAA2B;AAAA,MAC3B,iBAAiB;AAAA,MACjB,mCAAmC;AAAA,IAAA,CACpC;AAED,+BAA2B,CAAC,OAAO,YAAY;AAC7C,cAAQ,iBAAiB,OAAO,OAAO;AAAA,IACzC,CAAC;AAAA,EACH,OAAO;AACL,YAAQ,KAAK,gCAAgC;AAAA,EAC/C;AACF;"}
1
+ {"version":3,"file":"instrument.js","sources":["../src/instrument.ts"],"sourcesContent":["import { setClientExceptionReporter } from \"./errorReporting\"\n\n\nexport const instrument = async ({posthogKey}: {posthogKey?: string}) => {\n if (typeof posthogKey === \"string\" && posthogKey.length > 0) {\n try {\n const { default: posthog } = await import(\"posthog-js\")\n\n posthog.init(posthogKey, {\n api_host: \"/ingest\",\n ui_host: \"https://eu.posthog.com\",\n person_profiles: \"always\",\n session_recording: {\n maskAllInputs: false\n },\n capture_exceptions: {\n capture_unhandled_errors: true,\n capture_unhandled_rejections: true,\n capture_console_errors: true,\n },\n capture_pageview: true,\n autocapture: true,\n disable_session_recording: false,\n disable_surveys: true,\n disable_surveys_automatic_display: true,\n })\n\n setClientExceptionReporter((error, context) => {\n posthog.captureException(error, context)\n })\n } catch (err) {\n console.warn(\"instrument: failed to load posthog-js\", err)\n }\n } else {\n console.warn(\"instrument: missing posthogKey\")\n }\n}\n"],"names":[],"mappings":";AAGO,MAAM,aAAa,OAAO,EAAC,iBAAuC;AACvE,MAAI,OAAO,eAAe,YAAY,WAAW,SAAS,GAAG;AAC3D,QAAI;AACF,YAAM,EAAE,SAAS,YAAY,MAAM,OAAO,YAAY;AAEtD,cAAQ,KAAK,YAAY;AAAA,QACvB,UAAU;AAAA,QACV,SAAS;AAAA,QACT,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,UACjB,eAAe;AAAA,QAAA;AAAA,QAEjB,oBAAoB;AAAA,UAClB,0BAA0B;AAAA,UAC1B,8BAA8B;AAAA,UAC9B,wBAAwB;AAAA,QAAA;AAAA,QAE1B,kBAAkB;AAAA,QAClB,aAAa;AAAA,QACb,2BAA2B;AAAA,QAC3B,iBAAiB;AAAA,QACjB,mCAAmC;AAAA,MAAA,CACpC;AAED,iCAA2B,CAAC,OAAO,YAAY;AAC7C,gBAAQ,iBAAiB,OAAO,OAAO;AAAA,MACzC,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,cAAQ,KAAK,yCAAyC,GAAG;AAAA,IAC3D;AAAA,EACF,OAAO;AACL,YAAQ,KAAK,gCAAgC;AAAA,EAC/C;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.362.0",
3
+ "version": "0.363.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"