@growflowstudio/growflowbilling-admin-ui 2.0.0 → 2.1.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.d.mts +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +1368 -932
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1337 -911
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1 from 'react';
|
|
3
|
-
import { Fetcher, AdminPlan, AdminPlanPricingModel, RecurringInterval, AdminProduct, AdminInvoice } from '@growflowstudio/growflowbilling-admin-core';
|
|
3
|
+
import { Fetcher, AdminPlan, AdminPlanPricingModel, Visibility, RecurringInterval, AdminProduct, AdminInvoice, AdminFeature } from '@growflowstudio/growflowbilling-admin-core';
|
|
4
4
|
|
|
5
5
|
interface LimitFieldConfig {
|
|
6
6
|
key: string;
|
|
@@ -156,7 +156,17 @@ interface PlanFormData {
|
|
|
156
156
|
color: string;
|
|
157
157
|
limits: Record<string, number>;
|
|
158
158
|
limits_unlimited: Record<string, boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* Newline-separated feature slugs — legacy shape kept for compatibility
|
|
161
|
+
* with existing submit logic in ``PlansPage``. The unified feature
|
|
162
|
+
* editor writes to this field via ``applyFeatureState``.
|
|
163
|
+
*/
|
|
159
164
|
features: string;
|
|
165
|
+
/**
|
|
166
|
+
* Per-feature UI visibility overrides (tri-state). Managed atomically
|
|
167
|
+
* with ``features`` by ``PlanFeaturesSection``.
|
|
168
|
+
*/
|
|
169
|
+
ui_visibility: Record<string, Visibility>;
|
|
160
170
|
sort_order: number;
|
|
161
171
|
}
|
|
162
172
|
declare function createDefaultPlanFormData(limitFields?: LimitFieldConfig[]): PlanFormData;
|
|
@@ -219,6 +229,61 @@ declare const PLAN_COLORS: readonly [{
|
|
|
219
229
|
type PlanColorValue = typeof PLAN_COLORS[number]['value'];
|
|
220
230
|
declare function getPlanColorClass(color: string | undefined): string;
|
|
221
231
|
|
|
232
|
+
interface PlanDetailsSectionProps {
|
|
233
|
+
formData: PlanFormData;
|
|
234
|
+
formErrors: Record<string, string>;
|
|
235
|
+
isCreating: boolean;
|
|
236
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
237
|
+
onNameChange: (name: string) => void;
|
|
238
|
+
}
|
|
239
|
+
declare function PlanDetailsSection({ formData, formErrors, onFormDataChange, onNameChange, }: PlanDetailsSectionProps): react_jsx_runtime.JSX.Element;
|
|
240
|
+
|
|
241
|
+
interface PlanPricingSectionProps {
|
|
242
|
+
formData: PlanFormData;
|
|
243
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
244
|
+
}
|
|
245
|
+
declare function PlanPricingSection({ formData, onFormDataChange }: PlanPricingSectionProps): react_jsx_runtime.JSX.Element;
|
|
246
|
+
|
|
247
|
+
interface PlanLimitsSectionProps {
|
|
248
|
+
limitFields: LimitFieldConfig[];
|
|
249
|
+
formData: PlanFormData;
|
|
250
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
251
|
+
}
|
|
252
|
+
declare function PlanLimitsSection({ limitFields, formData, onFormDataChange }: PlanLimitsSectionProps): react_jsx_runtime.JSX.Element | null;
|
|
253
|
+
|
|
254
|
+
interface AvailableFeature$1 {
|
|
255
|
+
slug: string;
|
|
256
|
+
name: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
}
|
|
259
|
+
interface PlanFeaturesSectionProps {
|
|
260
|
+
availableFeatures: AvailableFeature$1[];
|
|
261
|
+
/** Current included feature slugs (mirror of ``plan.features``). */
|
|
262
|
+
selectedFeatureSlugs: string[];
|
|
263
|
+
/** Current UI visibility overrides (mirror of ``plan.ui_visibility``). */
|
|
264
|
+
uiVisibility: Record<string, Visibility>;
|
|
265
|
+
/**
|
|
266
|
+
* Called when the admin picks a new state for a slug. Receives the
|
|
267
|
+
* atomically-updated ``features`` array and ``uiVisibility`` map;
|
|
268
|
+
* callers MUST write both back to the parent form state.
|
|
269
|
+
*/
|
|
270
|
+
onFeatureStateChange: (next: {
|
|
271
|
+
features: string[];
|
|
272
|
+
uiVisibility: Record<string, Visibility>;
|
|
273
|
+
}) => void;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Unified feature-state editor for the plan form.
|
|
277
|
+
*
|
|
278
|
+
* Replaces the old split between "Features Incluse nel Piano" checkboxes
|
|
279
|
+
* and a separate visibility dropdown. One row per feature, one dropdown
|
|
280
|
+
* per row with 3 user-facing states (``Non inclusa``, ``Teaser``,
|
|
281
|
+
* ``Inclusa``) plus an advanced ``Sunset`` option behind a toggle. Every
|
|
282
|
+
* state change writes ``plan.features`` and ``plan.ui_visibility``
|
|
283
|
+
* atomically via ``applyFeatureState`` so the two fields can never drift.
|
|
284
|
+
*/
|
|
285
|
+
declare function PlanFeaturesSection({ availableFeatures, selectedFeatureSlugs, uiVisibility, onFeatureStateChange, }: PlanFeaturesSectionProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
|
|
222
287
|
interface ProductFormData {
|
|
223
288
|
name: string;
|
|
224
289
|
description: string;
|
|
@@ -254,6 +319,22 @@ interface InvoiceDetailsDialogProps {
|
|
|
254
319
|
}
|
|
255
320
|
declare function InvoiceDetailsDialog({ isOpen, onOpenChange, invoice }: InvoiceDetailsDialogProps): react_jsx_runtime.JSX.Element | null;
|
|
256
321
|
|
|
322
|
+
interface FeatureFormModalProps {
|
|
323
|
+
/** null = create mode, defined = edit mode */
|
|
324
|
+
feature: AdminFeature | null;
|
|
325
|
+
open: boolean;
|
|
326
|
+
onClose: () => void;
|
|
327
|
+
onSuccess: () => void;
|
|
328
|
+
}
|
|
329
|
+
declare function FeatureFormModal({ feature, open, onClose, onSuccess }: FeatureFormModalProps): react_jsx_runtime.JSX.Element | null;
|
|
330
|
+
|
|
331
|
+
interface FeatureListItemProps {
|
|
332
|
+
feature: AdminFeature;
|
|
333
|
+
onEdit: (feature: AdminFeature) => void;
|
|
334
|
+
onDelete: (feature: AdminFeature) => void;
|
|
335
|
+
}
|
|
336
|
+
declare function FeatureListItem({ feature, onEdit, onDelete }: FeatureListItemProps): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
257
338
|
interface DeleteConfirmDialogProps {
|
|
258
339
|
isOpen: boolean;
|
|
259
340
|
onOpenChange: (open: boolean) => void;
|
|
@@ -310,6 +391,13 @@ interface SkeletonRowsProps {
|
|
|
310
391
|
}
|
|
311
392
|
declare function SkeletonRows({ rows, columns }: SkeletonRowsProps): react_jsx_runtime.JSX.Element;
|
|
312
393
|
|
|
394
|
+
interface ToggleSwitchProps {
|
|
395
|
+
label: string;
|
|
396
|
+
checked: boolean;
|
|
397
|
+
onChange: (value: boolean) => void;
|
|
398
|
+
}
|
|
399
|
+
declare function ToggleSwitch({ label, checked, onChange }: ToggleSwitchProps): react_jsx_runtime.JSX.Element;
|
|
400
|
+
|
|
313
401
|
interface BillingNavItem {
|
|
314
402
|
key: string;
|
|
315
403
|
label: string;
|
|
@@ -326,4 +414,4 @@ interface BillingNavItem {
|
|
|
326
414
|
*/
|
|
327
415
|
declare function getBillingNavItems(modules?: BillingModulesConfig, basePath?: string): BillingNavItem[];
|
|
328
416
|
|
|
329
|
-
export { type BillingAdminConfig, BillingAdminProvider, type BillingAdminProviderProps, type BillingModulesConfig, type BillingNavItem, CursorPagination, DeleteConfirmDialog, type FeaturesConfig, FeaturesPage, type FeaturesPageProps, FilterBar, InvoiceDetailsDialog, InvoicesPage, type InvoicesPageProps, type LimitFieldConfig, LimitInput, PLAN_COLORS, PaymentsPage, type PaymentsPageProps, type PlanColorValue, type PlanFormData, PlanFormDialog, PlansPage, type PlansPageProps, PlansTable, type ProductFormData, ProductFormDialog, ProductsPage, type ProductsPageProps, type PublicPlansConfig, SkeletonRows, StatusBadge, SubscriptionsPage, type SubscriptionsPageProps, createDefaultPlanFormData, defaultProductFormData, getBillingNavItems, getPlanColorClass, useBillingAdminConfig, useEnabledModules };
|
|
417
|
+
export { type BillingAdminConfig, BillingAdminProvider, type BillingAdminProviderProps, type BillingModulesConfig, type BillingNavItem, CursorPagination, DeleteConfirmDialog, FeatureFormModal, type FeatureFormModalProps, FeatureListItem, type FeaturesConfig, FeaturesPage, type FeaturesPageProps, FilterBar, InvoiceDetailsDialog, InvoicesPage, type InvoicesPageProps, type LimitFieldConfig, LimitInput, PLAN_COLORS, PaymentsPage, type PaymentsPageProps, type PlanColorValue, PlanDetailsSection, PlanFeaturesSection, type PlanFormData, PlanFormDialog, type PlanFormDialogProps, PlanLimitsSection, PlanPricingSection, PlansPage, type PlansPageProps, PlansTable, type ProductFormData, ProductFormDialog, ProductsPage, type ProductsPageProps, type PublicPlansConfig, SkeletonRows, StatusBadge, SubscriptionsPage, type SubscriptionsPageProps, ToggleSwitch, createDefaultPlanFormData, defaultProductFormData, getBillingNavItems, getPlanColorClass, useBillingAdminConfig, useEnabledModules };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1 from 'react';
|
|
3
|
-
import { Fetcher, AdminPlan, AdminPlanPricingModel, RecurringInterval, AdminProduct, AdminInvoice } from '@growflowstudio/growflowbilling-admin-core';
|
|
3
|
+
import { Fetcher, AdminPlan, AdminPlanPricingModel, Visibility, RecurringInterval, AdminProduct, AdminInvoice, AdminFeature } from '@growflowstudio/growflowbilling-admin-core';
|
|
4
4
|
|
|
5
5
|
interface LimitFieldConfig {
|
|
6
6
|
key: string;
|
|
@@ -156,7 +156,17 @@ interface PlanFormData {
|
|
|
156
156
|
color: string;
|
|
157
157
|
limits: Record<string, number>;
|
|
158
158
|
limits_unlimited: Record<string, boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* Newline-separated feature slugs — legacy shape kept for compatibility
|
|
161
|
+
* with existing submit logic in ``PlansPage``. The unified feature
|
|
162
|
+
* editor writes to this field via ``applyFeatureState``.
|
|
163
|
+
*/
|
|
159
164
|
features: string;
|
|
165
|
+
/**
|
|
166
|
+
* Per-feature UI visibility overrides (tri-state). Managed atomically
|
|
167
|
+
* with ``features`` by ``PlanFeaturesSection``.
|
|
168
|
+
*/
|
|
169
|
+
ui_visibility: Record<string, Visibility>;
|
|
160
170
|
sort_order: number;
|
|
161
171
|
}
|
|
162
172
|
declare function createDefaultPlanFormData(limitFields?: LimitFieldConfig[]): PlanFormData;
|
|
@@ -219,6 +229,61 @@ declare const PLAN_COLORS: readonly [{
|
|
|
219
229
|
type PlanColorValue = typeof PLAN_COLORS[number]['value'];
|
|
220
230
|
declare function getPlanColorClass(color: string | undefined): string;
|
|
221
231
|
|
|
232
|
+
interface PlanDetailsSectionProps {
|
|
233
|
+
formData: PlanFormData;
|
|
234
|
+
formErrors: Record<string, string>;
|
|
235
|
+
isCreating: boolean;
|
|
236
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
237
|
+
onNameChange: (name: string) => void;
|
|
238
|
+
}
|
|
239
|
+
declare function PlanDetailsSection({ formData, formErrors, onFormDataChange, onNameChange, }: PlanDetailsSectionProps): react_jsx_runtime.JSX.Element;
|
|
240
|
+
|
|
241
|
+
interface PlanPricingSectionProps {
|
|
242
|
+
formData: PlanFormData;
|
|
243
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
244
|
+
}
|
|
245
|
+
declare function PlanPricingSection({ formData, onFormDataChange }: PlanPricingSectionProps): react_jsx_runtime.JSX.Element;
|
|
246
|
+
|
|
247
|
+
interface PlanLimitsSectionProps {
|
|
248
|
+
limitFields: LimitFieldConfig[];
|
|
249
|
+
formData: PlanFormData;
|
|
250
|
+
onFormDataChange: (data: Partial<PlanFormData>) => void;
|
|
251
|
+
}
|
|
252
|
+
declare function PlanLimitsSection({ limitFields, formData, onFormDataChange }: PlanLimitsSectionProps): react_jsx_runtime.JSX.Element | null;
|
|
253
|
+
|
|
254
|
+
interface AvailableFeature$1 {
|
|
255
|
+
slug: string;
|
|
256
|
+
name: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
}
|
|
259
|
+
interface PlanFeaturesSectionProps {
|
|
260
|
+
availableFeatures: AvailableFeature$1[];
|
|
261
|
+
/** Current included feature slugs (mirror of ``plan.features``). */
|
|
262
|
+
selectedFeatureSlugs: string[];
|
|
263
|
+
/** Current UI visibility overrides (mirror of ``plan.ui_visibility``). */
|
|
264
|
+
uiVisibility: Record<string, Visibility>;
|
|
265
|
+
/**
|
|
266
|
+
* Called when the admin picks a new state for a slug. Receives the
|
|
267
|
+
* atomically-updated ``features`` array and ``uiVisibility`` map;
|
|
268
|
+
* callers MUST write both back to the parent form state.
|
|
269
|
+
*/
|
|
270
|
+
onFeatureStateChange: (next: {
|
|
271
|
+
features: string[];
|
|
272
|
+
uiVisibility: Record<string, Visibility>;
|
|
273
|
+
}) => void;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Unified feature-state editor for the plan form.
|
|
277
|
+
*
|
|
278
|
+
* Replaces the old split between "Features Incluse nel Piano" checkboxes
|
|
279
|
+
* and a separate visibility dropdown. One row per feature, one dropdown
|
|
280
|
+
* per row with 3 user-facing states (``Non inclusa``, ``Teaser``,
|
|
281
|
+
* ``Inclusa``) plus an advanced ``Sunset`` option behind a toggle. Every
|
|
282
|
+
* state change writes ``plan.features`` and ``plan.ui_visibility``
|
|
283
|
+
* atomically via ``applyFeatureState`` so the two fields can never drift.
|
|
284
|
+
*/
|
|
285
|
+
declare function PlanFeaturesSection({ availableFeatures, selectedFeatureSlugs, uiVisibility, onFeatureStateChange, }: PlanFeaturesSectionProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
|
|
222
287
|
interface ProductFormData {
|
|
223
288
|
name: string;
|
|
224
289
|
description: string;
|
|
@@ -254,6 +319,22 @@ interface InvoiceDetailsDialogProps {
|
|
|
254
319
|
}
|
|
255
320
|
declare function InvoiceDetailsDialog({ isOpen, onOpenChange, invoice }: InvoiceDetailsDialogProps): react_jsx_runtime.JSX.Element | null;
|
|
256
321
|
|
|
322
|
+
interface FeatureFormModalProps {
|
|
323
|
+
/** null = create mode, defined = edit mode */
|
|
324
|
+
feature: AdminFeature | null;
|
|
325
|
+
open: boolean;
|
|
326
|
+
onClose: () => void;
|
|
327
|
+
onSuccess: () => void;
|
|
328
|
+
}
|
|
329
|
+
declare function FeatureFormModal({ feature, open, onClose, onSuccess }: FeatureFormModalProps): react_jsx_runtime.JSX.Element | null;
|
|
330
|
+
|
|
331
|
+
interface FeatureListItemProps {
|
|
332
|
+
feature: AdminFeature;
|
|
333
|
+
onEdit: (feature: AdminFeature) => void;
|
|
334
|
+
onDelete: (feature: AdminFeature) => void;
|
|
335
|
+
}
|
|
336
|
+
declare function FeatureListItem({ feature, onEdit, onDelete }: FeatureListItemProps): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
257
338
|
interface DeleteConfirmDialogProps {
|
|
258
339
|
isOpen: boolean;
|
|
259
340
|
onOpenChange: (open: boolean) => void;
|
|
@@ -310,6 +391,13 @@ interface SkeletonRowsProps {
|
|
|
310
391
|
}
|
|
311
392
|
declare function SkeletonRows({ rows, columns }: SkeletonRowsProps): react_jsx_runtime.JSX.Element;
|
|
312
393
|
|
|
394
|
+
interface ToggleSwitchProps {
|
|
395
|
+
label: string;
|
|
396
|
+
checked: boolean;
|
|
397
|
+
onChange: (value: boolean) => void;
|
|
398
|
+
}
|
|
399
|
+
declare function ToggleSwitch({ label, checked, onChange }: ToggleSwitchProps): react_jsx_runtime.JSX.Element;
|
|
400
|
+
|
|
313
401
|
interface BillingNavItem {
|
|
314
402
|
key: string;
|
|
315
403
|
label: string;
|
|
@@ -326,4 +414,4 @@ interface BillingNavItem {
|
|
|
326
414
|
*/
|
|
327
415
|
declare function getBillingNavItems(modules?: BillingModulesConfig, basePath?: string): BillingNavItem[];
|
|
328
416
|
|
|
329
|
-
export { type BillingAdminConfig, BillingAdminProvider, type BillingAdminProviderProps, type BillingModulesConfig, type BillingNavItem, CursorPagination, DeleteConfirmDialog, type FeaturesConfig, FeaturesPage, type FeaturesPageProps, FilterBar, InvoiceDetailsDialog, InvoicesPage, type InvoicesPageProps, type LimitFieldConfig, LimitInput, PLAN_COLORS, PaymentsPage, type PaymentsPageProps, type PlanColorValue, type PlanFormData, PlanFormDialog, PlansPage, type PlansPageProps, PlansTable, type ProductFormData, ProductFormDialog, ProductsPage, type ProductsPageProps, type PublicPlansConfig, SkeletonRows, StatusBadge, SubscriptionsPage, type SubscriptionsPageProps, createDefaultPlanFormData, defaultProductFormData, getBillingNavItems, getPlanColorClass, useBillingAdminConfig, useEnabledModules };
|
|
417
|
+
export { type BillingAdminConfig, BillingAdminProvider, type BillingAdminProviderProps, type BillingModulesConfig, type BillingNavItem, CursorPagination, DeleteConfirmDialog, FeatureFormModal, type FeatureFormModalProps, FeatureListItem, type FeaturesConfig, FeaturesPage, type FeaturesPageProps, FilterBar, InvoiceDetailsDialog, InvoicesPage, type InvoicesPageProps, type LimitFieldConfig, LimitInput, PLAN_COLORS, PaymentsPage, type PaymentsPageProps, type PlanColorValue, PlanDetailsSection, PlanFeaturesSection, type PlanFormData, PlanFormDialog, type PlanFormDialogProps, PlanLimitsSection, PlanPricingSection, PlansPage, type PlansPageProps, PlansTable, type ProductFormData, ProductFormDialog, ProductsPage, type ProductsPageProps, type PublicPlansConfig, SkeletonRows, StatusBadge, SubscriptionsPage, type SubscriptionsPageProps, ToggleSwitch, createDefaultPlanFormData, defaultProductFormData, getBillingNavItems, getPlanColorClass, useBillingAdminConfig, useEnabledModules };
|