@kerne/react 0.1.2 → 1.0.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.
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { SubscriptionWithPlan } from '@kerne/types';
4
- export { K as KerneLocalization, d as defaultLocalization, u as useLocalization } from '../i18n-Qketn1RF.cjs';
3
+ import { PublicPlan, PublicPlanPrice, PublicPriceLabel, SubscriptionWithPlan } from '@kerne/types';
4
+ export { K as KerneLocalization, d as defaultLocalization, u as useLocalization } from '../i18n-Di5qlnL1.cjs';
5
5
 
6
6
  /**
7
7
  * Per-instance overrides of the same custom properties the stylesheet reads,
@@ -332,8 +332,10 @@ interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
332
332
  onUpgradeClick?: () => void;
333
333
  /** Hide the "Manage billing" button (e.g. when the page has its own). */
334
334
  hidePortalButton?: boolean;
335
+ /** Hide the "Cancel subscription" button, e.g. when cancellation goes through sales/support. */
336
+ hideCancelButton?: boolean;
335
337
  }
336
- declare function SubscriptionCard({ productSlug, title, portalReturnUrl, upgradeUrl, onUpgradeClick, hidePortalButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
338
+ declare function SubscriptionCard({ productSlug, title, portalReturnUrl, upgradeUrl, onUpgradeClick, hidePortalButton, hideCancelButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
337
339
 
338
340
  interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
339
341
  /** Heading above the meters. Omit for the localized default, `null` for none. */
@@ -351,6 +353,67 @@ interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
351
353
  }
352
354
  declare function UsageMeters({ title, featureKeys, showUnlimited, limit: maxRows, labels, emptyState, appearance, className, }: UsageMetersProps): react_jsx_runtime.JSX.Element;
353
355
 
356
+ interface PricingTableContextValue {
357
+ plans: PublicPlan[];
358
+ labels: PublicPriceLabel[];
359
+ selectedLabelSlug: string | null;
360
+ setSelectedLabelSlug: (slug: string) => void;
361
+ savings: {
362
+ labelSlug: string;
363
+ percent: number;
364
+ } | null;
365
+ currentPlanId: string | null;
366
+ busyPriceId: string | null;
367
+ onSelectPlan: (plan: PublicPlan) => void;
368
+ }
369
+ /**
370
+ * Headless access to the same state `<PricingTable.LabelSwitch>`/`<PricingTable.Plan>`
371
+ * read - for a host building a fully custom layout around the data instead of
372
+ * the provided subcomponents. Must be called under `<PricingTable>`.
373
+ */
374
+ declare function usePricingTable(): PricingTableContextValue;
375
+ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
376
+ /** Product the plans are read from. Omit for the tenant's default product. */
377
+ product?: string;
378
+ /** Label slug selected on first render. Defaults to the first label by PriceLabel.sort_order once the catalog loads. */
379
+ defaultLabel?: string;
380
+ /** Where the provider checkout should return to. */
381
+ checkoutSuccessUrl?: string;
382
+ checkoutCancelUrl?: string;
383
+ /** Overrides the built-in checkout - e.g. a marketing site that wants its own confirmation step first. */
384
+ onSelectPlan?: (plan: PublicPlan, price: PublicPlanPrice) => void;
385
+ children: React.ReactNode;
386
+ }
387
+ /**
388
+ * Provider + layout root. Renders a skeleton while the catalog loads and an
389
+ * error panel if it fails, so `<PricingTable.Plan>` children only ever mount
390
+ * once real data exists - they never have to handle a "plan not loaded yet"
391
+ * state of their own.
392
+ */
393
+ declare function PricingTable({ product, defaultLabel, checkoutSuccessUrl, checkoutCancelUrl, onSelectPlan, appearance, className, children, }: PricingTableProps): react_jsx_runtime.JSX.Element;
394
+ declare namespace PricingTable {
395
+ var LabelSwitch: () => react_jsx_runtime.JSX.Element | null;
396
+ var Plan: ({ slug, featured, badge, maxFeatures }: PricingTablePlanProps) => react_jsx_runtime.JSX.Element | null;
397
+ var Plans: ({ featuredSlug, featuredBadge, maxFeatures }: PricingTablePlansProps) => react_jsx_runtime.JSX.Element;
398
+ }
399
+ interface PricingTablePlanProps {
400
+ /** The plan to render - matched against `Plan.slug`. */
401
+ slug: string;
402
+ /** Visually distinguished (stronger border, soft elevation) - a host decision, never inferred from `is_default` (the free-tier fallback, not a "recommended" signal). */
403
+ featured?: boolean;
404
+ /** Eyebrow shown above the plan name, e.g. "Most popular". Only rendered when passed - no badge is invented from data. */
405
+ badge?: string;
406
+ /** Cap how many entitlements render before "+N more". Omit to show all. */
407
+ maxFeatures?: number;
408
+ }
409
+ interface PricingTablePlansProps {
410
+ /** Slug of the plan to visually feature - a host decision, see PricingTablePlanProps.featured. */
411
+ featuredSlug?: string;
412
+ /** Eyebrow on the featured plan, e.g. "Most popular". */
413
+ featuredBadge?: string;
414
+ maxFeatures?: number;
415
+ }
416
+
354
417
  interface CheckoutResultProps extends KerneUIProps {
355
418
  /** `cancel` renders the abandoned-checkout copy and skips polling entirely. */
356
419
  outcome?: 'success' | 'cancel';
@@ -388,4 +451,4 @@ interface UpgradePromptProps extends Omit<KerneUIProps, 'logo'> {
388
451
  }
389
452
  declare function UpgradePrompt({ featureKey, requested, featureName, children, upgradeUrl, onUpgradeClick, upgradeLabel, title, description, hideWhileLoading, appearance, className, }: UpgradePromptProps): react_jsx_runtime.JSX.Element | null;
390
453
 
391
- export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, type KerneAppearance, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps };
454
+ export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, type KerneAppearance, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, PricingTable, type PricingTablePlanProps, type PricingTablePlansProps, type PricingTableProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps, usePricingTable };
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { SubscriptionWithPlan } from '@kerne/types';
4
- export { K as KerneLocalization, d as defaultLocalization, u as useLocalization } from '../i18n-Qketn1RF.js';
3
+ import { PublicPlan, PublicPlanPrice, PublicPriceLabel, SubscriptionWithPlan } from '@kerne/types';
4
+ export { K as KerneLocalization, d as defaultLocalization, u as useLocalization } from '../i18n-Di5qlnL1.js';
5
5
 
6
6
  /**
7
7
  * Per-instance overrides of the same custom properties the stylesheet reads,
@@ -332,8 +332,10 @@ interface SubscriptionCardProps extends Omit<KerneUIProps, 'logo'> {
332
332
  onUpgradeClick?: () => void;
333
333
  /** Hide the "Manage billing" button (e.g. when the page has its own). */
334
334
  hidePortalButton?: boolean;
335
+ /** Hide the "Cancel subscription" button, e.g. when cancellation goes through sales/support. */
336
+ hideCancelButton?: boolean;
335
337
  }
336
- declare function SubscriptionCard({ productSlug, title, portalReturnUrl, upgradeUrl, onUpgradeClick, hidePortalButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
338
+ declare function SubscriptionCard({ productSlug, title, portalReturnUrl, upgradeUrl, onUpgradeClick, hidePortalButton, hideCancelButton, appearance, className, }: SubscriptionCardProps): react_jsx_runtime.JSX.Element;
337
339
 
338
340
  interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
339
341
  /** Heading above the meters. Omit for the localized default, `null` for none. */
@@ -351,6 +353,67 @@ interface UsageMetersProps extends Omit<KerneUIProps, 'logo'> {
351
353
  }
352
354
  declare function UsageMeters({ title, featureKeys, showUnlimited, limit: maxRows, labels, emptyState, appearance, className, }: UsageMetersProps): react_jsx_runtime.JSX.Element;
353
355
 
356
+ interface PricingTableContextValue {
357
+ plans: PublicPlan[];
358
+ labels: PublicPriceLabel[];
359
+ selectedLabelSlug: string | null;
360
+ setSelectedLabelSlug: (slug: string) => void;
361
+ savings: {
362
+ labelSlug: string;
363
+ percent: number;
364
+ } | null;
365
+ currentPlanId: string | null;
366
+ busyPriceId: string | null;
367
+ onSelectPlan: (plan: PublicPlan) => void;
368
+ }
369
+ /**
370
+ * Headless access to the same state `<PricingTable.LabelSwitch>`/`<PricingTable.Plan>`
371
+ * read - for a host building a fully custom layout around the data instead of
372
+ * the provided subcomponents. Must be called under `<PricingTable>`.
373
+ */
374
+ declare function usePricingTable(): PricingTableContextValue;
375
+ interface PricingTableProps extends Omit<KerneUIProps, 'logo'> {
376
+ /** Product the plans are read from. Omit for the tenant's default product. */
377
+ product?: string;
378
+ /** Label slug selected on first render. Defaults to the first label by PriceLabel.sort_order once the catalog loads. */
379
+ defaultLabel?: string;
380
+ /** Where the provider checkout should return to. */
381
+ checkoutSuccessUrl?: string;
382
+ checkoutCancelUrl?: string;
383
+ /** Overrides the built-in checkout - e.g. a marketing site that wants its own confirmation step first. */
384
+ onSelectPlan?: (plan: PublicPlan, price: PublicPlanPrice) => void;
385
+ children: React.ReactNode;
386
+ }
387
+ /**
388
+ * Provider + layout root. Renders a skeleton while the catalog loads and an
389
+ * error panel if it fails, so `<PricingTable.Plan>` children only ever mount
390
+ * once real data exists - they never have to handle a "plan not loaded yet"
391
+ * state of their own.
392
+ */
393
+ declare function PricingTable({ product, defaultLabel, checkoutSuccessUrl, checkoutCancelUrl, onSelectPlan, appearance, className, children, }: PricingTableProps): react_jsx_runtime.JSX.Element;
394
+ declare namespace PricingTable {
395
+ var LabelSwitch: () => react_jsx_runtime.JSX.Element | null;
396
+ var Plan: ({ slug, featured, badge, maxFeatures }: PricingTablePlanProps) => react_jsx_runtime.JSX.Element | null;
397
+ var Plans: ({ featuredSlug, featuredBadge, maxFeatures }: PricingTablePlansProps) => react_jsx_runtime.JSX.Element;
398
+ }
399
+ interface PricingTablePlanProps {
400
+ /** The plan to render - matched against `Plan.slug`. */
401
+ slug: string;
402
+ /** Visually distinguished (stronger border, soft elevation) - a host decision, never inferred from `is_default` (the free-tier fallback, not a "recommended" signal). */
403
+ featured?: boolean;
404
+ /** Eyebrow shown above the plan name, e.g. "Most popular". Only rendered when passed - no badge is invented from data. */
405
+ badge?: string;
406
+ /** Cap how many entitlements render before "+N more". Omit to show all. */
407
+ maxFeatures?: number;
408
+ }
409
+ interface PricingTablePlansProps {
410
+ /** Slug of the plan to visually feature - a host decision, see PricingTablePlanProps.featured. */
411
+ featuredSlug?: string;
412
+ /** Eyebrow on the featured plan, e.g. "Most popular". */
413
+ featuredBadge?: string;
414
+ maxFeatures?: number;
415
+ }
416
+
354
417
  interface CheckoutResultProps extends KerneUIProps {
355
418
  /** `cancel` renders the abandoned-checkout copy and skips polling entirely. */
356
419
  outcome?: 'success' | 'cancel';
@@ -388,4 +451,4 @@ interface UpgradePromptProps extends Omit<KerneUIProps, 'logo'> {
388
451
  }
389
452
  declare function UpgradePrompt({ featureKey, requested, featureName, children, upgradeUrl, onUpgradeClick, upgradeLabel, title, description, hideWhileLoading, appearance, className, }: UpgradePromptProps): react_jsx_runtime.JSX.Element | null;
390
453
 
391
- export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, type KerneAppearance, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps };
454
+ export { ActivateAccountForm, type ActivateAccountFormProps, AuthFlow, type AuthFlowProps, type AuthFlowStep, BillingSection, type BillingSectionProps, ChangePasswordForm, type ChangePasswordFormProps, CheckoutResult, type CheckoutResultProps, ForgotPasswordForm, type ForgotPasswordFormProps, type KerneAppearance, LoginForm, type LoginFormProps, MagicLinkCallback, type MagicLinkCallbackProps, PricingTable, type PricingTablePlanProps, type PricingTablePlansProps, type PricingTableProps, ProfileSection, type ProfileSectionProps, RegisterForm, type RegisterFormProps, ResetPasswordForm, type ResetPasswordFormProps, SecuritySection, type SecuritySectionProps, SignOutButton, type SignOutButtonProps, SubscriptionCard, type SubscriptionCardProps, UpgradePrompt, type UpgradePromptProps, UsageMeters, type UsageMetersProps, UserButton, type UserButtonMenuItem, type UserButtonProps, UserProfile, type UserProfileExtraTab, type UserProfileProps, type UserProfileTab, VerifyEmailForm, type VerifyEmailFormProps, WaitlistForm, type WaitlistFormProps, usePricingTable };