@nozle-js/react 0.10.0 → 0.10.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.
package/README.md CHANGED
@@ -147,7 +147,7 @@ formats amounts/dates. Errors use `code: "session" | "unauthorized" | "request"
147
147
  Pass `planChangeActions` to `BillingPortal`, or use the standalone `PlanChangeControl`.
148
148
  Its adapter provides `load`, `status`, `preview`, `apply`, and `withdraw`; use
149
149
  `verifyCheckout` and `getCheckoutStatus` for scoped payment verification/recovery.
150
- The Node.js `0.9.0` and Python `0.9.0` SDKs provide the matching backend methods.
150
+ The Node.js `0.9.0` and Python `0.9.0` SDKs introduced the matching backend methods. Use `0.9.1` of either backend SDK for the Feature Event timestamp fix used by provider capture.
151
151
 
152
152
  Load eligible plans for the selected external subscription, confirm the signed quote,
153
153
  and retain the same quote and idempotency key for uncertain retries. Upgrades activate
@@ -159,3 +159,7 @@ See the [billing portal guide](https://docs.nozle.dev/sdks/react/billing-portal)
159
159
  complete typed adapters, standalone controls, and the runnable Node/Python integrations.
160
160
  The hosted Nozle backend supports these flows; self-hosted deployments need the matching
161
161
  subscription-management endpoints and cancellation-date guard.
162
+
163
+ ## License
164
+
165
+ Proprietary. Contact Nozle about licensing.
package/dist/index.cjs CHANGED
@@ -2872,8 +2872,12 @@ function usePlans() {
2872
2872
  const { client } = useBillingContext();
2873
2873
  const [plans, setPlans] = React.useState([]);
2874
2874
  const [isLoading, setIsLoading] = React.useState(true);
2875
+ const [error, setError] = React.useState(null);
2875
2876
  React.useEffect(() => {
2876
2877
  let cancelled = false;
2878
+ setIsLoading(true);
2879
+ setError(null);
2880
+ setPlans([]);
2877
2881
  if (!client) {
2878
2882
  setIsLoading(false);
2879
2883
  return;
@@ -2882,6 +2886,12 @@ function usePlans() {
2882
2886
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
2883
2887
  const data = await response.json();
2884
2888
  if (!cancelled) setPlans(data.plans ?? []);
2889
+ }).catch((cause) => {
2890
+ if (!cancelled) {
2891
+ setError(
2892
+ cause instanceof Error ? cause : new Error("Failed to load plans")
2893
+ );
2894
+ }
2885
2895
  }).finally(() => {
2886
2896
  if (!cancelled) setIsLoading(false);
2887
2897
  });
@@ -2889,7 +2899,7 @@ function usePlans() {
2889
2899
  cancelled = true;
2890
2900
  };
2891
2901
  }, [client]);
2892
- return { plans, isLoading };
2902
+ return { plans, isLoading, error };
2893
2903
  }
2894
2904
  function useCheckout2() {
2895
2905
  const { createCheckout } = useBillingContext();