@hook-sdk/template 0.16.0 → 0.18.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.
package/dist/index.d.cts CHANGED
@@ -400,6 +400,7 @@ interface PaywallPlanDerived {
400
400
  */
401
401
  declare function usePaywallState(): {
402
402
  status: SubscriptionStatus;
403
+ hasAccess: boolean | null;
403
404
  daysLeftInTrial: number | null;
404
405
  initialLoadComplete: boolean;
405
406
  plan: PaywallPlanDerived | null;
package/dist/index.d.ts CHANGED
@@ -400,6 +400,7 @@ interface PaywallPlanDerived {
400
400
  */
401
401
  declare function usePaywallState(): {
402
402
  status: SubscriptionStatus;
403
+ hasAccess: boolean | null;
403
404
  daysLeftInTrial: number | null;
404
405
  initialLoadComplete: boolean;
405
406
  plan: PaywallPlanDerived | null;
package/dist/index.js CHANGED
@@ -282,6 +282,7 @@ function usePaywallState() {
282
282
  const status = subscription.status();
283
283
  const daysLeftInTrial = subscription.daysLeftInTrial();
284
284
  const initialLoadComplete = subscription.initialLoadComplete;
285
+ const hasAccess = subscription.hasAccess;
285
286
  const pixPending = useMemo2(() => {
286
287
  const sdkPix = subscription.pixPending;
287
288
  if (!sdkPix) return null;
@@ -485,6 +486,7 @@ function usePaywallState() {
485
486
  return {
486
487
  // Subscription status (reactive, proxied from SDK)
487
488
  status,
489
+ hasAccess,
488
490
  daysLeftInTrial,
489
491
  initialLoadComplete,
490
492
  // Plan derivation from config (sync, no fetch)
@@ -528,9 +530,10 @@ var BLOCKING = /* @__PURE__ */ new Set([
528
530
  ]);
529
531
  function SubscriptionGate({ Paywall, children }) {
530
532
  const { mode } = useTemplateConfig();
531
- const { status, initialLoadComplete } = usePaywallState();
533
+ const { status, hasAccess, initialLoadComplete } = usePaywallState();
532
534
  if (mode === "free") return /* @__PURE__ */ jsx5(Fragment2, { children });
533
535
  if (!initialLoadComplete && status === "none") return null;
536
+ if (hasAccess === true && status !== "none") return /* @__PURE__ */ jsx5(Fragment2, { children });
534
537
  if (BLOCKING.has(status)) return /* @__PURE__ */ jsx5(Paywall, {});
535
538
  return /* @__PURE__ */ jsx5(Fragment2, { children });
536
539
  }