@onramp-sdk/react 0.1.0 → 0.1.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":"OnRampProvider.d.ts","sourceRoot":"","sources":["../src/OnRampProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAU,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI1D,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,+BAW1E;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
1
+ {"version":3,"file":"OnRampProvider.d.ts","sourceRoot":"","sources":["../src/OnRampProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAU,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI1D,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,+BAU1E;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, useContext, useEffect, useRef } from 'react';
3
+ import { createContext, useContext, useRef } from 'react';
4
4
  import { OnRamp } from './core.js';
5
5
  const OnRampContext = createContext(false);
6
6
  /**
@@ -10,13 +10,12 @@ const OnRampContext = createContext(false);
10
10
  * won't opt your whole layout into client rendering; only its own subtree).
11
11
  */
12
12
  export function OnRampProvider({ children, ...config }) {
13
- // Keep the latest config without re-running init — init is intentionally
14
- // once-per-page-load (session + listeners are global).
15
13
  const configRef = useRef(config);
16
14
  configRef.current = config;
17
- useEffect(() => {
18
- OnRamp.init(configRef.current);
19
- }, []);
15
+ // Init synchronously during render so the client is ready before any child
16
+ // effects fire (e.g. OnRampRouteTracker). init() is a no-op on the server
17
+ // (hasWindow() guard) and idempotent on re-renders (started flag).
18
+ OnRamp.init(configRef.current);
20
19
  return _jsx(OnRampContext.Provider, { value: true, children: children });
21
20
  }
22
21
  /** @internal — true when a provider is mounted above the caller. */
@@ -1 +1 @@
1
- {"version":3,"file":"OnRampProvider.js","sourceRoot":"","sources":["../src/OnRampProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEpE,OAAO,EAAE,MAAM,EAA0B,MAAM,WAAW,CAAA;AAE1D,MAAM,aAAa,GAAG,aAAa,CAAU,KAAK,CAAC,CAAA;AAMnD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAuB;IACzE,yEAAyE;IACzE,uDAAuD;IACvD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAAG,QAAQ,GAA0B,CAAA;AACjF,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,oBAAoB;IAClC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAA;AAClC,CAAC"}
1
+ {"version":3,"file":"OnRampProvider.js","sourceRoot":"","sources":["../src/OnRampProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzD,OAAO,EAAE,MAAM,EAA0B,MAAM,WAAW,CAAA;AAE1D,MAAM,aAAa,GAAG,aAAa,CAAU,KAAK,CAAC,CAAA;AAMnD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAuB;IACzE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAA;IAE1B,2EAA2E;IAC3E,0EAA0E;IAC1E,mEAAmE;IACnE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAE9B,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAAG,QAAQ,GAA0B,CAAA;AACjF,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,oBAAoB;IAClC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAA;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onramp-sdk/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OnRamp onboarding funnel analytics for React & Next.js — track steps, see where users drop off.",
5
5
  "license": "MIT",
6
6
  "type": "module",