@hook-sdk/template 0.1.4 → 0.3.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 +463 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -11
- package/dist/index.d.ts +96 -11
- package/dist/index.js +449 -141
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { ReactNode, ComponentType, Component } from 'react';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as _hook_sdk_sdk from '@hook-sdk/sdk';
|
|
5
|
+
import { ReminderSlot } from '@hook-sdk/sdk';
|
|
5
6
|
|
|
6
7
|
declare const AppConfigSchema: z.ZodObject<{
|
|
7
8
|
$schema: z.ZodOptional<z.ZodString>;
|
|
@@ -34,6 +35,12 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
34
35
|
pay_first: "pay_first";
|
|
35
36
|
free: "free";
|
|
36
37
|
}>>;
|
|
38
|
+
cpf_required: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
trial_type: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
sem_cartao: "sem_cartao";
|
|
41
|
+
com_cartao: "com_cartao";
|
|
42
|
+
nenhum: "nenhum";
|
|
43
|
+
}>>;
|
|
37
44
|
paywall_config: z.ZodObject<{
|
|
38
45
|
title: z.ZodString;
|
|
39
46
|
subtitle: z.ZodOptional<z.ZodString>;
|
|
@@ -43,6 +50,14 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
43
50
|
footerNote: z.ZodOptional<z.ZodString>;
|
|
44
51
|
}, z.core.$strict>;
|
|
45
52
|
}, z.core.$strict>;
|
|
53
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
has_forgot: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
email_verification_required: z.ZodDefault<z.ZodBoolean>;
|
|
56
|
+
min_password_length: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
pre_auth_routes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
58
|
+
post_auth_landing: z.ZodDefault<z.ZodString>;
|
|
59
|
+
signup_anti_enum: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
}, z.core.$strict>>;
|
|
46
61
|
sdk_version_required: z.ZodString;
|
|
47
62
|
template_version_required: z.ZodOptional<z.ZodString>;
|
|
48
63
|
max_bundle_size_kb: z.ZodNumber;
|
|
@@ -71,6 +86,25 @@ interface AppRootProps {
|
|
|
71
86
|
}
|
|
72
87
|
declare function AppRoot({ config, children, Login, Signup, Forgot, Reset, Paywall, }: AppRootProps): react_jsx_runtime.JSX.Element;
|
|
73
88
|
|
|
89
|
+
interface PushPromptTexts {
|
|
90
|
+
cta: string;
|
|
91
|
+
declineCta: string;
|
|
92
|
+
iosInstallTitle: string;
|
|
93
|
+
iosInstallBody: string;
|
|
94
|
+
iosInstallCta?: string;
|
|
95
|
+
deniedTitle: string;
|
|
96
|
+
deniedBody: string;
|
|
97
|
+
unsupportedBody: string;
|
|
98
|
+
}
|
|
99
|
+
interface PushPromptProps {
|
|
100
|
+
texts: PushPromptTexts;
|
|
101
|
+
onSubscribed?: () => void;
|
|
102
|
+
onDeclined?: () => void;
|
|
103
|
+
onInstallRequested?: () => void;
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
declare function PushPrompt({ texts, onSubscribed, onDeclined, onInstallRequested, className }: PushPromptProps): react_jsx_runtime.JSX.Element | null;
|
|
107
|
+
|
|
74
108
|
declare function DefaultSignupScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
75
109
|
|
|
76
110
|
declare function DefaultForgotScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
@@ -134,6 +168,12 @@ interface UseLoginFormResult {
|
|
|
134
168
|
submitting: boolean;
|
|
135
169
|
canSubmit: boolean;
|
|
136
170
|
error: AuthFormError | null;
|
|
171
|
+
/**
|
|
172
|
+
* Dispara OAuth Google: redireciona pro backend `/api/auth/oauth/google/start`.
|
|
173
|
+
* Fire-and-forget — a página é descarregada antes de qualquer retorno.
|
|
174
|
+
* Volta pro app logado (ou com `?oauth_error=...` em falha).
|
|
175
|
+
*/
|
|
176
|
+
loginWithGoogle: () => void;
|
|
137
177
|
}
|
|
138
178
|
declare function useLoginForm(): UseLoginFormResult;
|
|
139
179
|
|
|
@@ -156,6 +196,13 @@ interface UseSignupFormResult {
|
|
|
156
196
|
submitting: boolean;
|
|
157
197
|
canSubmit: boolean;
|
|
158
198
|
error: AuthFormError | null;
|
|
199
|
+
/**
|
|
200
|
+
* Dispara OAuth Google: mesmo endpoint que `useLoginForm.loginWithGoogle`.
|
|
201
|
+
* Backend decide entre `signup_new`, `auto_linked`, ou `login_existing`
|
|
202
|
+
* via `linkPolicy` — do ponto de vista do usuário "criar conta com Google"
|
|
203
|
+
* e "entrar com Google" são o mesmo botão.
|
|
204
|
+
*/
|
|
205
|
+
loginWithGoogle: () => void;
|
|
159
206
|
}
|
|
160
207
|
declare function useSignupForm(): UseSignupFormResult;
|
|
161
208
|
|
|
@@ -279,18 +326,56 @@ declare function useSubscription(): {
|
|
|
279
326
|
status: _hook_sdk_sdk.SdkSubscriptionStatus;
|
|
280
327
|
};
|
|
281
328
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
329
|
+
type PushUiState = {
|
|
330
|
+
kind: 'unsupported';
|
|
331
|
+
} | {
|
|
332
|
+
kind: 'ios_needs_install';
|
|
333
|
+
} | {
|
|
334
|
+
kind: 'prompt';
|
|
335
|
+
} | {
|
|
336
|
+
kind: 'subscribed';
|
|
337
|
+
} | {
|
|
338
|
+
kind: 'denied';
|
|
339
|
+
} | {
|
|
340
|
+
kind: 'error';
|
|
341
|
+
code: string;
|
|
342
|
+
message: string;
|
|
343
|
+
};
|
|
286
344
|
declare function usePush(): {
|
|
287
|
-
|
|
288
|
-
subscribe: () => Promise<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
345
|
+
state: PushUiState;
|
|
346
|
+
subscribe: () => Promise<void>;
|
|
347
|
+
unsubscribe: () => Promise<void>;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
declare function useReminders(): {
|
|
351
|
+
reminders: ReminderSlot[];
|
|
352
|
+
loading: boolean;
|
|
353
|
+
setReminder: (input: {
|
|
354
|
+
slot: string;
|
|
355
|
+
timeLocal: string;
|
|
356
|
+
timezone: string;
|
|
357
|
+
enabled: boolean;
|
|
358
|
+
}) => Promise<void>;
|
|
359
|
+
deleteReminder: (slot: string) => Promise<void>;
|
|
360
|
+
schedule: (items: Parameters<(items: Array<{
|
|
361
|
+
slot: string;
|
|
362
|
+
sendAt: string | Date;
|
|
363
|
+
title: string;
|
|
364
|
+
body: string;
|
|
365
|
+
url?: string;
|
|
366
|
+
}>) => Promise<{
|
|
367
|
+
accepted: number;
|
|
368
|
+
rejected: number;
|
|
369
|
+
}>>[0]) => Promise<{
|
|
370
|
+
accepted: number;
|
|
371
|
+
rejected: number;
|
|
293
372
|
}>;
|
|
373
|
+
setFallbacks: (items: Parameters<(items: Array<{
|
|
374
|
+
slot: string;
|
|
375
|
+
title: string;
|
|
376
|
+
body: string;
|
|
377
|
+
url?: string;
|
|
378
|
+
}>) => Promise<void>>[0]) => Promise<void>;
|
|
294
379
|
};
|
|
295
380
|
|
|
296
381
|
interface ToastItem {
|
|
@@ -308,4 +393,4 @@ declare function useToast(): {
|
|
|
308
393
|
dismiss: (id: string) => void;
|
|
309
394
|
};
|
|
310
395
|
|
|
311
|
-
export { AppRoot, type AppRootProps, type AuthFormError, type AuthFormErrorCode, type AuthScreen, type AuthScreenProps, DefaultForgotScreen, DefaultLoginScreen, DefaultPaywall, DefaultResetScreen, DefaultSignupScreen, EmptyState, ErrorBoundary, LoadingState, type SubscriptionStatus, type ToastItem, type UseLoginFormResult, type UseResetFormResult, useAuth, useAuthPrimitives, useForgotForm, useLoginForm, usePaywallState, usePush, useResetForm, useSignupForm, useSubscription, useToast };
|
|
396
|
+
export { AppRoot, type AppRootProps, type AuthFormError, type AuthFormErrorCode, type AuthScreen, type AuthScreenProps, DefaultForgotScreen, DefaultLoginScreen, DefaultPaywall, DefaultResetScreen, DefaultSignupScreen, EmptyState, ErrorBoundary, LoadingState, PushPrompt, type PushPromptProps, type PushPromptTexts, type PushUiState, type SubscriptionStatus, type ToastItem, type UseLoginFormResult, type UseResetFormResult, useAuth, useAuthPrimitives, useForgotForm, useLoginForm, usePaywallState, usePush, useReminders, useResetForm, useSignupForm, useSubscription, useToast };
|