@hook-sdk/template 0.4.2 → 0.5.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 -2
- 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 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -156,6 +156,7 @@ function usePaywallState() {
|
|
|
156
156
|
const [error, setError] = (0, import_react3.useState)(null);
|
|
157
157
|
const status = subscription.status();
|
|
158
158
|
const daysLeftInTrial = subscription.daysLeftInTrial();
|
|
159
|
+
const initialLoadComplete = subscription.initialLoadComplete;
|
|
159
160
|
const checkout = (0, import_react3.useCallback)(
|
|
160
161
|
async (args) => {
|
|
161
162
|
setOpening(true);
|
|
@@ -181,7 +182,7 @@ function usePaywallState() {
|
|
|
181
182
|
setError(err);
|
|
182
183
|
}
|
|
183
184
|
}, [subscription]);
|
|
184
|
-
return { status, daysLeftInTrial, checkout, cancel, opening, error };
|
|
185
|
+
return { status, daysLeftInTrial, initialLoadComplete, checkout, cancel, opening, error };
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
// src/internal/SubscriptionGate.tsx
|
|
@@ -194,8 +195,9 @@ var BLOCKING = /* @__PURE__ */ new Set([
|
|
|
194
195
|
]);
|
|
195
196
|
function SubscriptionGate({ Paywall, children }) {
|
|
196
197
|
const { mode } = useTemplateConfig();
|
|
197
|
-
const { status } = usePaywallState();
|
|
198
|
+
const { status, initialLoadComplete } = usePaywallState();
|
|
198
199
|
if (mode === "free") return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
200
|
+
if (!initialLoadComplete && status === "none") return null;
|
|
199
201
|
if (BLOCKING.has(status)) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Paywall, {});
|
|
200
202
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
201
203
|
}
|