@metarouter/react-native-sdk 0.1.27 → 1.0.1
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaRouterAnalyticsClient.d.ts","sourceRoot":"","sources":["../../src/analytics/MetaRouterAnalyticsClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MetaRouterAnalyticsClient.d.ts","sourceRoot":"","sources":["../../src/analytics/MetaRouterAnalyticsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,WAAW,EAAE,MAAM,SAAS,CAAC;AAQlE;;;;;;GAMG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,oBAAoB,CAAwC;IACpE,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAM;IAE5C;;;OAGG;gBACS,OAAO,EAAE,WAAW;IAiChC;;;OAGG;YACW,IAAI;IA8BlB;;;OAGG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;;OAGG;IACH,OAAO,CAAC,GAAG;IAIX;;;OAGG;IACH,OAAO,CAAC,OAAO;IAiBf;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;;OAGG;IACH,OAAO,CAAC,oBAAoB,CAK1B;IAEF;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAMrD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAOrD;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAWnD;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAOnD;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAWrD;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM;IAOvB;;OAEG;IACH,kBAAkB;IAKlB;;OAEG;IACH,YAAY;;;;;;;;;;IAaZ;;OAEG;IACG,KAAK;;;;;;;;;;IAkDX;;OAEG;IACH,KAAK;IAML;;OAEG;IACH,OAAO;CAOR"}
|
|
@@ -36,6 +36,18 @@ export class MetaRouterAnalyticsClient {
|
|
|
36
36
|
};
|
|
37
37
|
log("Initializing analytics client", options);
|
|
38
38
|
const { writeKey, ingestionHost, flushInterval } = options;
|
|
39
|
+
if (!writeKey || typeof writeKey !== "string" || writeKey.trim() === "") {
|
|
40
|
+
throw new Error("MetaRouterAnalyticsClient initialization failed: `writeKey` is required and must be a non-empty string.");
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const url = new URL(ingestionHost);
|
|
44
|
+
if (url.pathname !== "/" && ingestionHost.endsWith("/")) {
|
|
45
|
+
throw new Error();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new Error("MetaRouterAnalyticsClient initialization failed: `ingestionHost` must be a valid URL and not end in a slash.");
|
|
50
|
+
}
|
|
39
51
|
this.ingestionHost = ingestionHost;
|
|
40
52
|
this.writeKey = writeKey;
|
|
41
53
|
this.flushIntervalMs = flushInterval !== null && flushInterval !== void 0 ? flushInterval : 10000;
|