@hook-sdk/template 0.9.1 → 0.11.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 +1263 -1692
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -129
- package/dist/index.d.ts +328 -129
- package/dist/index.js +1211 -1648
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,92 +1,114 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode, ComponentType, Component } from 'react';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
import * as _hook_sdk_sdk from '@hook-sdk/sdk';
|
|
5
|
-
import { CheckoutCycle, CheckoutCardData, CheckoutHolderInfo, PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
5
|
+
import { CheckoutMethod as CheckoutMethod$1, CheckoutCycle, CheckoutResult, CheckoutCardData, CheckoutHolderInfo, PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
6
6
|
export { PlanInfo, PlanState } from '@hook-sdk/sdk';
|
|
7
|
+
import { z } from 'zod';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
9
|
+
type Cycle = 'MONTHLY' | 'YEARLY';
|
|
10
|
+
type CheckoutMethod = 'card' | 'pix-auto' | 'pix-once';
|
|
11
|
+
type AuthFlowConfig = {
|
|
12
|
+
minPassword: number;
|
|
13
|
+
requiresEmailVerify: boolean;
|
|
14
|
+
googleOAuth: boolean;
|
|
15
|
+
postAuthLanding: string;
|
|
16
|
+
preAuthRoutes: string[];
|
|
17
|
+
};
|
|
18
|
+
type PaywallConfig = {
|
|
19
|
+
mode: 'free';
|
|
20
|
+
} | {
|
|
21
|
+
mode: 'trial' | 'pay_first';
|
|
22
|
+
trialDays?: number;
|
|
23
|
+
cycles: Cycle[];
|
|
24
|
+
prices: {
|
|
25
|
+
monthlyCents: number;
|
|
26
|
+
yearlyCents: number;
|
|
27
|
+
};
|
|
28
|
+
anchorPrices?: {
|
|
29
|
+
monthlyCents: number;
|
|
30
|
+
yearlyCents: number;
|
|
31
|
+
};
|
|
32
|
+
checkoutMethods: CheckoutMethod[];
|
|
33
|
+
requiresCpf: boolean;
|
|
34
|
+
cancelWindowDays?: number;
|
|
35
|
+
errorMessages: 'default' | 'custom';
|
|
36
|
+
};
|
|
37
|
+
type PersistedKey = {
|
|
38
|
+
key: string;
|
|
39
|
+
default: unknown;
|
|
40
|
+
guardRegen?: boolean;
|
|
41
|
+
debounceMs?: number;
|
|
42
|
+
};
|
|
43
|
+
type OnboardingStep = {
|
|
44
|
+
id: string;
|
|
45
|
+
screen: string;
|
|
46
|
+
validates?: string[];
|
|
47
|
+
};
|
|
48
|
+
type OnboardingConfig = {
|
|
49
|
+
trigger: 'pre_signup' | 'post_signup' | 'pre_signup_custom' | 'optional';
|
|
50
|
+
steps: OnboardingStep[];
|
|
51
|
+
persistTo: 'appData';
|
|
52
|
+
persistKey: string;
|
|
53
|
+
};
|
|
54
|
+
type DeepLinks = {
|
|
55
|
+
passwordReset?: string;
|
|
56
|
+
emailVerify?: string;
|
|
57
|
+
};
|
|
58
|
+
type AppConfig = {
|
|
59
|
+
slug: string;
|
|
60
|
+
name: string;
|
|
61
|
+
branding: {
|
|
62
|
+
primaryColor: string;
|
|
63
|
+
logoUrl: string;
|
|
64
|
+
};
|
|
65
|
+
authFlow: AuthFlowConfig;
|
|
66
|
+
paywall: PaywallConfig;
|
|
67
|
+
persistedKeys: PersistedKey[];
|
|
68
|
+
onboarding?: OnboardingConfig;
|
|
69
|
+
deepLinks?: DeepLinks;
|
|
70
|
+
features_enabled?: string[];
|
|
71
|
+
theme?: Record<string, unknown>;
|
|
72
|
+
};
|
|
68
73
|
|
|
69
|
-
type AuthScreen = 'login' | 'signup' | 'forgot' | 'reset';
|
|
70
74
|
interface AuthScreenProps {
|
|
71
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Optional callback for in-screen navigation between the auth screens
|
|
77
|
+
* (e.g. Login → Signup). Pre-Router screens used this; Router-based
|
|
78
|
+
* screens should use `useNavigate()` from react-router-dom directly and
|
|
79
|
+
* may ignore this prop.
|
|
80
|
+
*/
|
|
81
|
+
onNavigate?: (target: 'login' | 'signup' | 'forgot' | 'reset') => void;
|
|
72
82
|
}
|
|
73
|
-
declare function DefaultLoginScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
config: AppConfig;
|
|
84
|
+
declare function PaymentReturnHandler({ children }: {
|
|
77
85
|
children: ReactNode;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
}): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
type AppRootSlots = {
|
|
89
|
+
Login: ComponentType<AuthScreenProps>;
|
|
90
|
+
Signup: ComponentType<AuthScreenProps>;
|
|
91
|
+
Forgot: ComponentType<AuthScreenProps>;
|
|
92
|
+
Reset: ComponentType<AuthScreenProps>;
|
|
93
|
+
/** Required when config.authFlow.requiresEmailVerify === true. */
|
|
94
|
+
EmailVerify?: ComponentType<AuthScreenProps>;
|
|
95
|
+
/** Required when config.paywall.mode !== "free". */
|
|
87
96
|
Paywall?: ComponentType;
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
/** Map of step id → component. Used when config.onboarding && trigger !== "pre_signup_custom". */
|
|
98
|
+
Onboarding?: Record<string, ComponentType>;
|
|
99
|
+
/** Required when config.onboarding?.trigger === "pre_signup_custom". */
|
|
100
|
+
PreAuthFlow?: ComponentType;
|
|
101
|
+
};
|
|
102
|
+
type AppRootProps = AppRootSlots & {
|
|
103
|
+
config: AppConfig;
|
|
104
|
+
children?: ReactNode;
|
|
105
|
+
/** Test-only: skip BrowserRouter (which fights jsdom's document.location). */
|
|
106
|
+
testRouter?: 'memory';
|
|
107
|
+
/** Test-only: initial entries for MemoryRouter. */
|
|
108
|
+
testInitialEntries?: string[];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare function AppRoot(props: AppRootProps): react_jsx_runtime.JSX.Element;
|
|
90
112
|
|
|
91
113
|
interface PushPromptTexts {
|
|
92
114
|
cta: string;
|
|
@@ -119,22 +141,6 @@ interface InstallSplashProps {
|
|
|
119
141
|
}
|
|
120
142
|
declare function InstallSplash({ children, title, subtitle }: InstallSplashProps): react_jsx_runtime.JSX.Element;
|
|
121
143
|
|
|
122
|
-
declare function DefaultSignupScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
123
|
-
|
|
124
|
-
declare function DefaultForgotScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Tela default de reset de senha. Renderizada pelo AuthGate quando
|
|
128
|
-
* `?token=` está presente na URL (link vindo do email de password_reset).
|
|
129
|
-
*
|
|
130
|
-
* AuthScreenProps.onNavigate é usado pra voltar pro login após reset
|
|
131
|
-
* bem-sucedido (usuário precisa re-autenticar — backend revoga todos
|
|
132
|
-
* os refresh tokens na chamada de `auth.reset`).
|
|
133
|
-
*/
|
|
134
|
-
declare function DefaultResetScreen({ onNavigate }: AuthScreenProps): react_jsx_runtime.JSX.Element;
|
|
135
|
-
|
|
136
|
-
declare function DefaultPaywall(): react_jsx_runtime.JSX.Element;
|
|
137
|
-
|
|
138
144
|
declare function LoadingState({ message }: {
|
|
139
145
|
message?: string;
|
|
140
146
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -155,10 +161,24 @@ interface State {
|
|
|
155
161
|
declare class ErrorBoundary extends Component<Props, State> {
|
|
156
162
|
state: State;
|
|
157
163
|
static getDerivedStateFromError(error: Error): State;
|
|
158
|
-
componentDidCatch(error: Error
|
|
164
|
+
componentDidCatch(error: Error, info: {
|
|
165
|
+
componentStack: string;
|
|
166
|
+
}): void;
|
|
159
167
|
render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element;
|
|
160
168
|
}
|
|
161
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Reads `?token=` from the URL on mount + on location change. When present and
|
|
172
|
+
* the current pathname is `/`, redirects to the configured deep-link path
|
|
173
|
+
* (passwordReset or emailVerify) substituting `:token` for the actual value.
|
|
174
|
+
*
|
|
175
|
+
* Mounts once inside `<AppRoot>` (post-Router); a no-op when `deepLinks` is
|
|
176
|
+
* undefined or no `token` is in the URL.
|
|
177
|
+
*/
|
|
178
|
+
declare function DeepLinkHandler({ deepLinks }: {
|
|
179
|
+
deepLinks?: DeepLinks;
|
|
180
|
+
}): null;
|
|
181
|
+
|
|
162
182
|
type AuthFormErrorCode = 'invalid_credentials' | 'rate_limited' | 'email_unverified' | 'account_locked' | 'network' | 'server';
|
|
163
183
|
interface AuthFormError {
|
|
164
184
|
code: AuthFormErrorCode;
|
|
@@ -267,64 +287,98 @@ interface UseResetFormResult {
|
|
|
267
287
|
declare function useResetForm(): UseResetFormResult;
|
|
268
288
|
|
|
269
289
|
type SubscriptionStatus = 'active' | 'trialing' | 'expired' | 'canceled' | 'past_due' | 'pending' | 'none';
|
|
270
|
-
type PaymentMethod =
|
|
290
|
+
type PaymentMethod = CheckoutMethod$1;
|
|
291
|
+
interface PaywallError {
|
|
292
|
+
code: string;
|
|
293
|
+
message: string;
|
|
294
|
+
userMessage: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Local pixPending shape — re-exposes SDK's reactive `subscription.pixPending`
|
|
298
|
+
* with two extra UI-facing fields:
|
|
299
|
+
* - `expiresAt`: null (kept for compat; SDK does not surface expiry on auto/once)
|
|
300
|
+
* - `paid`: derived from `subscription.current.status` — flips true when the
|
|
301
|
+
* underlying subscription transitions to ACTIVE/TRIAL after the user pays
|
|
302
|
+
* the QR code. SDK clears the underlying pixPending shortly after; this
|
|
303
|
+
* wrapper preserves the "paid" frame for ~1 render so the paywall can show
|
|
304
|
+
* confirmation copy before unmounting the modal.
|
|
305
|
+
*/
|
|
271
306
|
interface PixPending {
|
|
272
307
|
method: 'pix-auto' | 'pix-once';
|
|
273
308
|
qrCodePayload: string | null;
|
|
274
309
|
qrCodeBase64: string | null;
|
|
275
310
|
expiresAt: string | null;
|
|
276
|
-
/**
|
|
277
|
-
* Flipa `true` quando o polling detecta subscription ACTIVE/TRIAL (webhook
|
|
278
|
-
* PAYMENT_RECEIVED ou AUTHORIZATION_ACTIVATED chegou). UI deve renderizar
|
|
279
|
-
* confirmação visual nesse momento; após 2-3s chama `dismissPix` pra
|
|
280
|
-
* limpar o modal e deixar SubscriptionGate liberar o app.
|
|
281
|
-
*/
|
|
282
311
|
paid: boolean;
|
|
283
312
|
}
|
|
313
|
+
interface CardFormState {
|
|
314
|
+
number: string;
|
|
315
|
+
cvv: string;
|
|
316
|
+
expiry: string;
|
|
317
|
+
holder: string;
|
|
318
|
+
}
|
|
319
|
+
interface CardFormStateWithSetter extends CardFormState {
|
|
320
|
+
set: (patch: Partial<CardFormState>) => void;
|
|
321
|
+
}
|
|
322
|
+
interface CpfState {
|
|
323
|
+
required: boolean;
|
|
324
|
+
value: string;
|
|
325
|
+
set: (v: string) => void;
|
|
326
|
+
valid: boolean;
|
|
327
|
+
}
|
|
284
328
|
interface PaywallCheckoutArgs {
|
|
285
329
|
cpf: string;
|
|
286
330
|
cycle: CheckoutCycle;
|
|
287
|
-
method: 'card' | 'pix-auto';
|
|
288
|
-
/** Required when method === 'card'. */
|
|
331
|
+
method: 'card' | 'pix-auto' | 'pix-once';
|
|
289
332
|
card?: CheckoutCardData;
|
|
290
|
-
/** Required when method === 'card'. */
|
|
291
333
|
holderInfo?: CheckoutHolderInfo;
|
|
292
|
-
/** Optional; backend falls back to X-Forwarded-For when absent. */
|
|
293
334
|
remoteIp?: string;
|
|
294
335
|
}
|
|
336
|
+
interface PaywallPlanDerived {
|
|
337
|
+
monthlyCents: number;
|
|
338
|
+
yearlyCents: number | null;
|
|
339
|
+
anchorMonthlyCents?: number;
|
|
340
|
+
anchorYearlyCents?: number;
|
|
341
|
+
monthlyEquivalent: number;
|
|
342
|
+
discountPercent: number;
|
|
343
|
+
}
|
|
295
344
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* -
|
|
302
|
-
* e cria subscription com `nextDueDate = today + trialDays`. Sem cobrança
|
|
303
|
-
* no day 0; trial corre enquanto Asaas já segura o instrumento. Caller
|
|
304
|
-
* obrigatório passar `card` + `holderInfo`. Nada é persistido/loggado no
|
|
305
|
-
* SDK — PAN/CVV transitam só no request HTTPS direto ao backend. Após
|
|
306
|
-
* success chama `subscription.refresh()` pra SubscriptionGate liberar
|
|
307
|
-
* o app automaticamente (status passa pra `trialing`).
|
|
345
|
+
* Headless paywall state — owns:
|
|
346
|
+
* - reactive subscription status (proxied from SDK)
|
|
347
|
+
* - cycle / selectedMethod / cpf / card form state
|
|
348
|
+
* - methods list (config.paywall.checkoutMethods filtered by SDK methodAvailability)
|
|
349
|
+
* - submit() — high-level no-args entrypoint that uses internal state
|
|
350
|
+
* - error mapping via asaasErrorMessage when paywall.errorMessages === 'default'
|
|
308
351
|
*
|
|
309
|
-
* -
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* `
|
|
352
|
+
* Backward-compat aliases preserved for SDK 0.13/template 0.9 consumers:
|
|
353
|
+
* - `availableMethods` mirrors `methods`
|
|
354
|
+
* - `opening` mirrors `submitting`
|
|
355
|
+
* - `checkout(args)` takes legacy args + validates card/holderInfo presence
|
|
356
|
+
* - `dismissPix` no-op (SDK polling auto-clears pixPending on settle)
|
|
357
|
+
* - `monthlyEquivalent(cycle)` helper
|
|
315
358
|
*/
|
|
316
359
|
declare function usePaywallState(): {
|
|
317
360
|
status: SubscriptionStatus;
|
|
318
361
|
daysLeftInTrial: number | null;
|
|
319
362
|
initialLoadComplete: boolean;
|
|
363
|
+
plan: PaywallPlanDerived | null;
|
|
364
|
+
cycle: CheckoutCycle;
|
|
365
|
+
setCycle: react.Dispatch<react.SetStateAction<CheckoutCycle>>;
|
|
366
|
+
methods: readonly CheckoutMethod$1[];
|
|
367
|
+
selectedMethod: CheckoutMethod$1;
|
|
368
|
+
setSelectedMethod: react.Dispatch<react.SetStateAction<CheckoutMethod$1>>;
|
|
369
|
+
cpfState: CpfState;
|
|
370
|
+
cardState: CardFormStateWithSetter;
|
|
371
|
+
submit: () => Promise<CheckoutResult | undefined>;
|
|
320
372
|
checkout: (args: PaywallCheckoutArgs) => Promise<void>;
|
|
321
373
|
cancel: () => Promise<void>;
|
|
322
|
-
opening: boolean;
|
|
323
|
-
error: Error | null;
|
|
324
374
|
pixPending: PixPending | null;
|
|
375
|
+
error: PaywallError | null;
|
|
376
|
+
submitting: boolean;
|
|
377
|
+
opening: boolean;
|
|
378
|
+
availableMethods: readonly CheckoutMethod$1[];
|
|
379
|
+
monthlyEquivalent: (c: CheckoutCycle) => number;
|
|
325
380
|
dismissPix: () => void;
|
|
326
|
-
|
|
327
|
-
monthlyEquivalent: (cycle: CheckoutCycle) => number;
|
|
381
|
+
refreshPlan: () => void;
|
|
328
382
|
};
|
|
329
383
|
|
|
330
384
|
/**
|
|
@@ -623,4 +677,149 @@ declare function shouldBlockInstall(state: InstallState, now?: number): boolean;
|
|
|
623
677
|
*/
|
|
624
678
|
declare function shouldShowPermanentOption(state: InstallState): boolean;
|
|
625
679
|
|
|
626
|
-
|
|
680
|
+
declare function asaasErrorMessage(code: string): string;
|
|
681
|
+
|
|
682
|
+
type RouteBoundaryProps = {
|
|
683
|
+
children: ReactNode;
|
|
684
|
+
};
|
|
685
|
+
declare function RouteBoundary({ children }: RouteBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
686
|
+
|
|
687
|
+
type PreAuthShellProps = {
|
|
688
|
+
basename?: string;
|
|
689
|
+
/** Test-only escape hatch — use MemoryRouter so jsdom doesn't fight document.location. */
|
|
690
|
+
testRouter?: 'memory';
|
|
691
|
+
/** Optional initial entries for MemoryRouter; ignored otherwise. */
|
|
692
|
+
testInitialEntries?: string[];
|
|
693
|
+
children: ReactNode;
|
|
694
|
+
};
|
|
695
|
+
declare function PreAuthShell({ basename, testRouter, testInitialEntries, children, }: PreAuthShellProps): react_jsx_runtime.JSX.Element;
|
|
696
|
+
|
|
697
|
+
type PersistenceRegistryProps = {
|
|
698
|
+
config: PersistedKey[];
|
|
699
|
+
children: ReactNode;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* Fire-and-forget prefetch of every key declared in `app.config.json.persistedKeys`
|
|
703
|
+
* via `appData.bulkRead`. Does NOT gate render — children mount immediately;
|
|
704
|
+
* `usePersistedState` consumers hit cache as soon as the prefetch resolves.
|
|
705
|
+
*
|
|
706
|
+
* Use when the consuming app tolerates a brief flash of `defaultValue` before
|
|
707
|
+
* hydrated state lands. For strict "no flash" semantics use `<PersistedKeysPrefetch>`
|
|
708
|
+
* (gating variant in `internal/`).
|
|
709
|
+
*/
|
|
710
|
+
declare function PersistenceRegistry({ config, children }: PersistenceRegistryProps): react_jsx_runtime.JSX.Element;
|
|
711
|
+
|
|
712
|
+
type OnboardingStepDef = {
|
|
713
|
+
id: string;
|
|
714
|
+
screen: string;
|
|
715
|
+
validates?: string[];
|
|
716
|
+
};
|
|
717
|
+
type OnboardingFlowProps = {
|
|
718
|
+
steps: OnboardingStepDef[];
|
|
719
|
+
screens: Record<string, ComponentType>;
|
|
720
|
+
onComplete: (value: Record<string, unknown>) => void;
|
|
721
|
+
persistKey: string;
|
|
722
|
+
};
|
|
723
|
+
declare function OnboardingFlow({ steps, screens, onComplete, persistKey, }: OnboardingFlowProps): react_jsx_runtime.JSX.Element | null;
|
|
724
|
+
|
|
725
|
+
type OnboardingStepCtx = {
|
|
726
|
+
stepIndex: number;
|
|
727
|
+
totalSteps: number;
|
|
728
|
+
next: () => void;
|
|
729
|
+
prev: () => void;
|
|
730
|
+
value: Record<string, unknown>;
|
|
731
|
+
setValue: (patch: Record<string, unknown>) => void;
|
|
732
|
+
valid: boolean;
|
|
733
|
+
};
|
|
734
|
+
declare function useOnboardingStep(): OnboardingStepCtx;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Returns `true` when `app.config.json.features_enabled` includes `name`.
|
|
738
|
+
* Use to gate optional UI surfaces (e.g. share button, premium-only screens)
|
|
739
|
+
* without scattering the feature list across the codebase.
|
|
740
|
+
*/
|
|
741
|
+
declare function useFeature(name: string): boolean;
|
|
742
|
+
|
|
743
|
+
declare function AppConfigProvider({ config, children, }: {
|
|
744
|
+
config: AppConfig;
|
|
745
|
+
children: ReactNode;
|
|
746
|
+
}): react_jsx_runtime.JSX.Element;
|
|
747
|
+
declare function useAppConfig(): AppConfig;
|
|
748
|
+
|
|
749
|
+
declare const AppConfigSchema: z.ZodObject<{
|
|
750
|
+
slug: z.ZodString;
|
|
751
|
+
name: z.ZodString;
|
|
752
|
+
branding: z.ZodObject<{
|
|
753
|
+
primaryColor: z.ZodString;
|
|
754
|
+
logoUrl: z.ZodString;
|
|
755
|
+
}, z.core.$strip>;
|
|
756
|
+
authFlow: z.ZodObject<{
|
|
757
|
+
minPassword: z.ZodNumber;
|
|
758
|
+
requiresEmailVerify: z.ZodBoolean;
|
|
759
|
+
googleOAuth: z.ZodBoolean;
|
|
760
|
+
postAuthLanding: z.ZodString;
|
|
761
|
+
preAuthRoutes: z.ZodArray<z.ZodString>;
|
|
762
|
+
}, z.core.$strip>;
|
|
763
|
+
paywall: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
764
|
+
mode: z.ZodEnum<{
|
|
765
|
+
trial: "trial";
|
|
766
|
+
pay_first: "pay_first";
|
|
767
|
+
}>;
|
|
768
|
+
trialDays: z.ZodOptional<z.ZodNumber>;
|
|
769
|
+
cycles: z.ZodArray<z.ZodEnum<{
|
|
770
|
+
MONTHLY: "MONTHLY";
|
|
771
|
+
YEARLY: "YEARLY";
|
|
772
|
+
}>>;
|
|
773
|
+
prices: z.ZodObject<{
|
|
774
|
+
monthlyCents: z.ZodNumber;
|
|
775
|
+
yearlyCents: z.ZodNumber;
|
|
776
|
+
}, z.core.$strip>;
|
|
777
|
+
anchorPrices: z.ZodOptional<z.ZodObject<{
|
|
778
|
+
monthlyCents: z.ZodNumber;
|
|
779
|
+
yearlyCents: z.ZodNumber;
|
|
780
|
+
}, z.core.$strip>>;
|
|
781
|
+
checkoutMethods: z.ZodArray<z.ZodEnum<{
|
|
782
|
+
card: "card";
|
|
783
|
+
"pix-auto": "pix-auto";
|
|
784
|
+
"pix-once": "pix-once";
|
|
785
|
+
}>>;
|
|
786
|
+
requiresCpf: z.ZodBoolean;
|
|
787
|
+
cancelWindowDays: z.ZodOptional<z.ZodNumber>;
|
|
788
|
+
errorMessages: z.ZodEnum<{
|
|
789
|
+
default: "default";
|
|
790
|
+
custom: "custom";
|
|
791
|
+
}>;
|
|
792
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
793
|
+
mode: z.ZodLiteral<"free">;
|
|
794
|
+
}, z.core.$strip>], "mode">;
|
|
795
|
+
persistedKeys: z.ZodArray<z.ZodObject<{
|
|
796
|
+
key: z.ZodString;
|
|
797
|
+
default: z.ZodUnknown;
|
|
798
|
+
guardRegen: z.ZodOptional<z.ZodBoolean>;
|
|
799
|
+
debounceMs: z.ZodOptional<z.ZodNumber>;
|
|
800
|
+
}, z.core.$strip>>;
|
|
801
|
+
onboarding: z.ZodOptional<z.ZodObject<{
|
|
802
|
+
trigger: z.ZodEnum<{
|
|
803
|
+
pre_signup: "pre_signup";
|
|
804
|
+
post_signup: "post_signup";
|
|
805
|
+
pre_signup_custom: "pre_signup_custom";
|
|
806
|
+
optional: "optional";
|
|
807
|
+
}>;
|
|
808
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
809
|
+
id: z.ZodString;
|
|
810
|
+
screen: z.ZodString;
|
|
811
|
+
validates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
812
|
+
}, z.core.$strip>>;
|
|
813
|
+
persistTo: z.ZodLiteral<"appData">;
|
|
814
|
+
persistKey: z.ZodString;
|
|
815
|
+
}, z.core.$strip>>;
|
|
816
|
+
deepLinks: z.ZodOptional<z.ZodObject<{
|
|
817
|
+
passwordReset: z.ZodOptional<z.ZodString>;
|
|
818
|
+
emailVerify: z.ZodOptional<z.ZodString>;
|
|
819
|
+
}, z.core.$strict>>;
|
|
820
|
+
features_enabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
821
|
+
theme: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
822
|
+
}, z.core.$strict>;
|
|
823
|
+
declare function parseAppConfig(input: unknown): AppConfig;
|
|
824
|
+
|
|
825
|
+
export { type AndroidBrowser, type AppConfig, AppConfigProvider, AppConfigSchema, AppRoot, type AppRootProps, type AppRootSlots, type AuthFlowConfig, type AuthFormError, type AuthFormErrorCode, type AuthScreenProps, type CheckoutMethod, type Cycle, DeepLinkHandler, type DeepLinks, EmptyState, ErrorBoundary, type IOSBrowser, type InAppApp, type InstallActions, InstallGate, InstallSplash, type InstallState, type InstallVariant, LoadingState, type OnboardingConfig, OnboardingFlow, type OnboardingFlowProps, type OnboardingStep, type OnboardingStepCtx, type OnboardingStepDef, type PaymentMethod, PaymentReturnHandler, type PaywallConfig, type PersistedKey, PersistenceRegistry, type PersistenceRegistryProps, type PixPending, type Platform, PreAuthShell, type PreAuthShellProps, PushPrompt, type PushPromptProps, type PushPromptTexts, type PushUiState, RouteBoundary, type RouteBoundaryProps, type SubscriptionStatus, type ToastItem, type UseLoginFormResult, type UseResetFormResult, asaasErrorMessage, computeAnchorCents, dailyFromYearly, detectAndroidBrowser, detectIOSBrowser, detectInAppApp, detectPlatform, detectStandalone, discountPercent, formatBRL, monthlyFromYearly, parseAppConfig, shouldBlockInstall, shouldShowPermanentOption, useAppConfig, useAuth, useAuthPrimitives, useFeature, useForgotForm, useInstallPrompt, useLoginForm, useOnboardingStep, usePaywallState, usePlan, usePush, useReminders, useResetForm, useSignupForm, useSubscription, useToast };
|