@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.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -353,6 +353,7 @@ function usePaywallState() {
|
|
|
353
353
|
const status = subscription.status();
|
|
354
354
|
const daysLeftInTrial = subscription.daysLeftInTrial();
|
|
355
355
|
const initialLoadComplete = subscription.initialLoadComplete;
|
|
356
|
+
const hasAccess = subscription.hasAccess;
|
|
356
357
|
const pixPending = (0, import_react6.useMemo)(() => {
|
|
357
358
|
const sdkPix = subscription.pixPending;
|
|
358
359
|
if (!sdkPix) return null;
|
|
@@ -556,6 +557,7 @@ function usePaywallState() {
|
|
|
556
557
|
return {
|
|
557
558
|
// Subscription status (reactive, proxied from SDK)
|
|
558
559
|
status,
|
|
560
|
+
hasAccess,
|
|
559
561
|
daysLeftInTrial,
|
|
560
562
|
initialLoadComplete,
|
|
561
563
|
// Plan derivation from config (sync, no fetch)
|
|
@@ -599,9 +601,10 @@ var BLOCKING = /* @__PURE__ */ new Set([
|
|
|
599
601
|
]);
|
|
600
602
|
function SubscriptionGate({ Paywall, children }) {
|
|
601
603
|
const { mode } = useTemplateConfig();
|
|
602
|
-
const { status, initialLoadComplete } = usePaywallState();
|
|
604
|
+
const { status, hasAccess, initialLoadComplete } = usePaywallState();
|
|
603
605
|
if (mode === "free") return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
604
606
|
if (!initialLoadComplete && status === "none") return null;
|
|
607
|
+
if (hasAccess === true && status !== "none") return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
605
608
|
if (BLOCKING.has(status)) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Paywall, {});
|
|
606
609
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
607
610
|
}
|