@hook-sdk/template 0.8.1 → 0.9.1
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 +616 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -17
- package/dist/index.d.ts +30 -17
- package/dist/index.js +633 -96
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +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 { PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
5
|
+
import { CheckoutCycle, CheckoutCardData, CheckoutHolderInfo, PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
6
6
|
export { PlanInfo, PlanState } from '@hook-sdk/sdk';
|
|
7
7
|
|
|
8
8
|
declare const AppConfigSchema: z.ZodObject<{
|
|
@@ -281,19 +281,34 @@ interface PixPending {
|
|
|
281
281
|
*/
|
|
282
282
|
paid: boolean;
|
|
283
283
|
}
|
|
284
|
+
interface PaywallCheckoutArgs {
|
|
285
|
+
cpf: string;
|
|
286
|
+
cycle: CheckoutCycle;
|
|
287
|
+
method: 'card' | 'pix-auto';
|
|
288
|
+
/** Required when method === 'card'. */
|
|
289
|
+
card?: CheckoutCardData;
|
|
290
|
+
/** Required when method === 'card'. */
|
|
291
|
+
holderInfo?: CheckoutHolderInfo;
|
|
292
|
+
/** Optional; backend falls back to X-Forwarded-For when absent. */
|
|
293
|
+
remoteIp?: string;
|
|
294
|
+
}
|
|
284
295
|
/**
|
|
285
|
-
* Hook headless pro Paywall. Expõe status
|
|
286
|
-
* `checkout({cpf, cycle, method
|
|
296
|
+
* Hook headless pro Paywall. Expõe status da subscription + ação
|
|
297
|
+
* `checkout({cpf, cycle, method, card?, holderInfo?, remoteIp?})`.
|
|
298
|
+
*
|
|
299
|
+
* App Store substrate (2026-04-24, SDK 0.14.0+):
|
|
287
300
|
*
|
|
288
|
-
* - **card**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
301
|
+
* - **method='card'** → backend tokeniza via Asaas `/v3/creditCard/tokenize`
|
|
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`).
|
|
308
|
+
*
|
|
309
|
+
* - **method='pix-auto'** → Pix Automático BACEN Jornada 3. User escaneia
|
|
310
|
+
* QR 1x, autoriza débito recorrente no app do banco. Retorna QR via
|
|
311
|
+
* `pixPending` (polling existing detecta ativação e flipa `paid=true`).
|
|
297
312
|
*
|
|
298
313
|
* Subscription real é atualizada via webhook (`PAYMENT_RECEIVED` ou
|
|
299
314
|
* `PIX_AUTOMATIC_RECURRING_AUTHORIZATION_ACTIVATED`).
|
|
@@ -302,16 +317,14 @@ declare function usePaywallState(): {
|
|
|
302
317
|
status: SubscriptionStatus;
|
|
303
318
|
daysLeftInTrial: number | null;
|
|
304
319
|
initialLoadComplete: boolean;
|
|
305
|
-
checkout: (args:
|
|
306
|
-
cpf: string;
|
|
307
|
-
cycle?: "MONTHLY" | "YEARLY";
|
|
308
|
-
method?: PaymentMethod;
|
|
309
|
-
}) => Promise<void>;
|
|
320
|
+
checkout: (args: PaywallCheckoutArgs) => Promise<void>;
|
|
310
321
|
cancel: () => Promise<void>;
|
|
311
322
|
opening: boolean;
|
|
312
323
|
error: Error | null;
|
|
313
324
|
pixPending: PixPending | null;
|
|
314
325
|
dismissPix: () => void;
|
|
326
|
+
availableMethods: readonly ("card" | "pix-auto")[];
|
|
327
|
+
monthlyEquivalent: (cycle: CheckoutCycle) => number;
|
|
315
328
|
};
|
|
316
329
|
|
|
317
330
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +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 { PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
5
|
+
import { CheckoutCycle, CheckoutCardData, CheckoutHolderInfo, PlanState, ReminderSlot } from '@hook-sdk/sdk';
|
|
6
6
|
export { PlanInfo, PlanState } from '@hook-sdk/sdk';
|
|
7
7
|
|
|
8
8
|
declare const AppConfigSchema: z.ZodObject<{
|
|
@@ -281,19 +281,34 @@ interface PixPending {
|
|
|
281
281
|
*/
|
|
282
282
|
paid: boolean;
|
|
283
283
|
}
|
|
284
|
+
interface PaywallCheckoutArgs {
|
|
285
|
+
cpf: string;
|
|
286
|
+
cycle: CheckoutCycle;
|
|
287
|
+
method: 'card' | 'pix-auto';
|
|
288
|
+
/** Required when method === 'card'. */
|
|
289
|
+
card?: CheckoutCardData;
|
|
290
|
+
/** Required when method === 'card'. */
|
|
291
|
+
holderInfo?: CheckoutHolderInfo;
|
|
292
|
+
/** Optional; backend falls back to X-Forwarded-For when absent. */
|
|
293
|
+
remoteIp?: string;
|
|
294
|
+
}
|
|
284
295
|
/**
|
|
285
|
-
* Hook headless pro Paywall. Expõe status
|
|
286
|
-
* `checkout({cpf, cycle, method
|
|
296
|
+
* Hook headless pro Paywall. Expõe status da subscription + ação
|
|
297
|
+
* `checkout({cpf, cycle, method, card?, holderInfo?, remoteIp?})`.
|
|
298
|
+
*
|
|
299
|
+
* App Store substrate (2026-04-24, SDK 0.14.0+):
|
|
287
300
|
*
|
|
288
|
-
* - **card**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
301
|
+
* - **method='card'** → backend tokeniza via Asaas `/v3/creditCard/tokenize`
|
|
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`).
|
|
308
|
+
*
|
|
309
|
+
* - **method='pix-auto'** → Pix Automático BACEN Jornada 3. User escaneia
|
|
310
|
+
* QR 1x, autoriza débito recorrente no app do banco. Retorna QR via
|
|
311
|
+
* `pixPending` (polling existing detecta ativação e flipa `paid=true`).
|
|
297
312
|
*
|
|
298
313
|
* Subscription real é atualizada via webhook (`PAYMENT_RECEIVED` ou
|
|
299
314
|
* `PIX_AUTOMATIC_RECURRING_AUTHORIZATION_ACTIVATED`).
|
|
@@ -302,16 +317,14 @@ declare function usePaywallState(): {
|
|
|
302
317
|
status: SubscriptionStatus;
|
|
303
318
|
daysLeftInTrial: number | null;
|
|
304
319
|
initialLoadComplete: boolean;
|
|
305
|
-
checkout: (args:
|
|
306
|
-
cpf: string;
|
|
307
|
-
cycle?: "MONTHLY" | "YEARLY";
|
|
308
|
-
method?: PaymentMethod;
|
|
309
|
-
}) => Promise<void>;
|
|
320
|
+
checkout: (args: PaywallCheckoutArgs) => Promise<void>;
|
|
310
321
|
cancel: () => Promise<void>;
|
|
311
322
|
opening: boolean;
|
|
312
323
|
error: Error | null;
|
|
313
324
|
pixPending: PixPending | null;
|
|
314
325
|
dismissPix: () => void;
|
|
326
|
+
availableMethods: readonly ("card" | "pix-auto")[];
|
|
327
|
+
monthlyEquivalent: (cycle: CheckoutCycle) => number;
|
|
315
328
|
};
|
|
316
329
|
|
|
317
330
|
/**
|