@hook-sdk/template 0.5.0 → 0.6.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 +39 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -2
- package/dist/index.d.ts +63 -2
- package/dist/index.js +35 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,11 +32,14 @@ __export(index_exports, {
|
|
|
32
32
|
InstallSplash: () => InstallSplash,
|
|
33
33
|
LoadingState: () => LoadingState,
|
|
34
34
|
PushPrompt: () => PushPrompt2,
|
|
35
|
+
dailyFromYearly: () => dailyFromYearly,
|
|
35
36
|
detectAndroidBrowser: () => detectAndroidBrowser,
|
|
36
37
|
detectIOSBrowser: () => detectIOSBrowser,
|
|
37
38
|
detectInAppApp: () => detectInAppApp,
|
|
38
39
|
detectPlatform: () => detectPlatform,
|
|
39
40
|
detectStandalone: () => detectStandalone,
|
|
41
|
+
formatBRL: () => formatBRL,
|
|
42
|
+
monthlyFromYearly: () => monthlyFromYearly,
|
|
40
43
|
shouldBlockInstall: () => shouldBlockInstall,
|
|
41
44
|
shouldShowPermanentOption: () => shouldShowPermanentOption,
|
|
42
45
|
useAuth: () => useAuth,
|
|
@@ -45,6 +48,7 @@ __export(index_exports, {
|
|
|
45
48
|
useInstallPrompt: () => useInstallPrompt,
|
|
46
49
|
useLoginForm: () => useLoginForm,
|
|
47
50
|
usePaywallState: () => usePaywallState,
|
|
51
|
+
usePlan: () => usePlan,
|
|
48
52
|
usePush: () => usePush,
|
|
49
53
|
useReminders: () => useReminders,
|
|
50
54
|
useResetForm: () => useResetForm,
|
|
@@ -2383,12 +2387,37 @@ function EmptyState({ title, description, action }) {
|
|
|
2383
2387
|
] });
|
|
2384
2388
|
}
|
|
2385
2389
|
|
|
2390
|
+
// src/hooks/usePlan.ts
|
|
2391
|
+
var import_sdk11 = require("@hook-sdk/sdk");
|
|
2392
|
+
function usePlan() {
|
|
2393
|
+
const { plan } = (0, import_sdk11.useHook)();
|
|
2394
|
+
return plan;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
// src/utils/price.ts
|
|
2398
|
+
function formatBRL(cents) {
|
|
2399
|
+
if (cents === null || cents === void 0) return "";
|
|
2400
|
+
const reais = cents / 100;
|
|
2401
|
+
return new Intl.NumberFormat("pt-BR", {
|
|
2402
|
+
style: "currency",
|
|
2403
|
+
currency: "BRL"
|
|
2404
|
+
}).format(reais);
|
|
2405
|
+
}
|
|
2406
|
+
function monthlyFromYearly(yearlyCents) {
|
|
2407
|
+
if (yearlyCents === null || yearlyCents === void 0) return 0;
|
|
2408
|
+
return Math.round(yearlyCents / 12);
|
|
2409
|
+
}
|
|
2410
|
+
function dailyFromYearly(yearlyCents) {
|
|
2411
|
+
if (yearlyCents === null || yearlyCents === void 0) return 0;
|
|
2412
|
+
return Math.round(yearlyCents / 365);
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2386
2415
|
// src/hooks/useAuthPrimitives.ts
|
|
2387
2416
|
var import_react17 = require("react");
|
|
2388
|
-
var
|
|
2417
|
+
var import_sdk12 = require("@hook-sdk/sdk");
|
|
2389
2418
|
var warned = false;
|
|
2390
2419
|
function useAuthPrimitives() {
|
|
2391
|
-
const { auth } = (0,
|
|
2420
|
+
const { auth } = (0, import_sdk12.useHook)();
|
|
2392
2421
|
(0, import_react17.useEffect)(() => {
|
|
2393
2422
|
if (!warned && process.env.NODE_ENV !== "production") {
|
|
2394
2423
|
warned = true;
|
|
@@ -2411,9 +2440,9 @@ function useAuthPrimitives() {
|
|
|
2411
2440
|
}
|
|
2412
2441
|
|
|
2413
2442
|
// src/hooks/useSubscription.ts
|
|
2414
|
-
var
|
|
2443
|
+
var import_sdk13 = require("@hook-sdk/sdk");
|
|
2415
2444
|
function useSubscription() {
|
|
2416
|
-
const { subscription } = (0,
|
|
2445
|
+
const { subscription } = (0, import_sdk13.useHook)();
|
|
2417
2446
|
return {
|
|
2418
2447
|
status: subscription.status()
|
|
2419
2448
|
};
|
|
@@ -2421,9 +2450,9 @@ function useSubscription() {
|
|
|
2421
2450
|
|
|
2422
2451
|
// src/hooks/useReminders.ts
|
|
2423
2452
|
var import_react18 = require("react");
|
|
2424
|
-
var
|
|
2453
|
+
var import_sdk14 = require("@hook-sdk/sdk");
|
|
2425
2454
|
function useReminders() {
|
|
2426
|
-
const { push } = (0,
|
|
2455
|
+
const { push } = (0, import_sdk14.useHook)();
|
|
2427
2456
|
const r = push.reminders;
|
|
2428
2457
|
const [reminders, setReminders] = (0, import_react18.useState)([]);
|
|
2429
2458
|
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
@@ -2486,11 +2515,14 @@ function useToast() {
|
|
|
2486
2515
|
InstallSplash,
|
|
2487
2516
|
LoadingState,
|
|
2488
2517
|
PushPrompt,
|
|
2518
|
+
dailyFromYearly,
|
|
2489
2519
|
detectAndroidBrowser,
|
|
2490
2520
|
detectIOSBrowser,
|
|
2491
2521
|
detectInAppApp,
|
|
2492
2522
|
detectPlatform,
|
|
2493
2523
|
detectStandalone,
|
|
2524
|
+
formatBRL,
|
|
2525
|
+
monthlyFromYearly,
|
|
2494
2526
|
shouldBlockInstall,
|
|
2495
2527
|
shouldShowPermanentOption,
|
|
2496
2528
|
useAuth,
|
|
@@ -2499,6 +2531,7 @@ function useToast() {
|
|
|
2499
2531
|
useInstallPrompt,
|
|
2500
2532
|
useLoginForm,
|
|
2501
2533
|
usePaywallState,
|
|
2534
|
+
usePlan,
|
|
2502
2535
|
usePush,
|
|
2503
2536
|
useReminders,
|
|
2504
2537
|
useResetForm,
|