@refraction-ui/react 0.9.1 → 0.9.2

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
@@ -45403,6 +45403,10 @@ async function startSessionReplay(options) {
45403
45403
 
45404
45404
  // ../react-analytics/dist/index.js
45405
45405
  var AnalyticsContext = React11__namespace.createContext(null);
45406
+ var noopAnalytics = null;
45407
+ function getNoopAnalytics() {
45408
+ return noopAnalytics ??= createNoopAnalytics();
45409
+ }
45406
45410
  function AnalyticsProvider({ children, value }) {
45407
45411
  const analyticsRef = React11__namespace.useRef(null);
45408
45412
  if (!analyticsRef.current) {
@@ -45416,17 +45420,18 @@ function AnalyticsProvider({ children, value }) {
45416
45420
  }
45417
45421
  function useAnalytics(options) {
45418
45422
  const ctx = React11__namespace.useContext(AnalyticsContext);
45419
- if (!ctx) {
45423
+ let base = ctx;
45424
+ if (!base) {
45420
45425
  devWarn(
45421
45426
  "react-analytics/use-analytics-outside-provider",
45422
- "useAnalytics() was called outside an <AnalyticsProvider>. Wrap your app (or the consuming subtree) in <AnalyticsProvider> so the analytics context is available."
45427
+ "useAnalytics() (or useTrackEvent()) was called outside an <AnalyticsProvider>. Analytics is a no-op here; wrap your app (or the consuming subtree) in <AnalyticsProvider> to enable it."
45423
45428
  );
45424
- throw new Error("useAnalytics must be used within an <AnalyticsProvider>");
45429
+ base = getNoopAnalytics();
45425
45430
  }
45426
45431
  const scope = options?.scope;
45427
45432
  return React11__namespace.useMemo(
45428
- () => scope ? ctx.with(scope) : ctx,
45429
- [ctx, scope]
45433
+ () => scope ? base.with(scope) : base,
45434
+ [base, scope]
45430
45435
  );
45431
45436
  }
45432
45437
  function useTrackEvent(options) {