@burdenoff/microfe-admin 2026.1123.1 → 2026.1123.2
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/admin/components/forms/SubscriptionForm.d.ts +19 -20
- package/dist/admin/components/forms/SubscriptionForm.js +6 -6
- package/dist/admin/components/forms/SubscriptionForm.js.map +1 -1
- package/dist/admin/components/forms/TenantForm.d.ts +4 -42
- package/dist/admin/components/forms/TenantForm.js +75 -75
- package/dist/admin/components/forms/TenantForm.js.map +1 -1
- package/dist/admin/components/forms/TicketForm.d.ts +21 -22
- package/dist/admin/components/forms/TicketForm.js +1 -1
- package/dist/admin/components/forms/TicketForm.js.map +1 -1
- package/dist/admin/components/forms/UserForm.d.ts +14 -20
- package/dist/admin/components/forms/UserForm.js +55 -55
- package/dist/admin/components/forms/UserForm.js.map +1 -1
- package/dist/admin/schemas/index.d.ts +128 -243
- package/dist/admin/schemas/index.js +58 -58
- package/dist/admin/schemas/index.js.map +1 -1
- package/dist/node_modules/zod/v4/classic/errors.js +44 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +7 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +722 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +498 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +245 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +84 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +29 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +90 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +223 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/memoizer.js +188 -0
- package/dist/node_modules/zod/v4/core/memoizer.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +159 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +34 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +41 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +904 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +330 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +421 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/zod/v4/locales/en.js +96 -0
- package/dist/node_modules/zod/v4/locales/en.js.map +1 -0
- package/package.json +2 -2
- package/dist/node_modules/zod/v3/ZodError.js +0 -81
- package/dist/node_modules/zod/v3/ZodError.js.map +0 -1
- package/dist/node_modules/zod/v3/errors.js +0 -9
- package/dist/node_modules/zod/v3/errors.js.map +0 -1
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -8
- package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +0 -1
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -92
- package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +0 -1
- package/dist/node_modules/zod/v3/helpers/util.js +0 -75
- package/dist/node_modules/zod/v3/helpers/util.js.map +0 -1
- package/dist/node_modules/zod/v3/locales/en.js +0 -61
- package/dist/node_modules/zod/v3/locales/en.js.map +0 -1
- package/dist/node_modules/zod/v3/types.js +0 -2469
- package/dist/node_modules/zod/v3/types.js.map +0 -1
|
@@ -3,29 +3,28 @@ import { Subscription } from '../../types';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const subscriptionFormSchema: z.ZodObject<{
|
|
5
5
|
tenantId: z.ZodString;
|
|
6
|
-
plan: z.ZodEnum<
|
|
7
|
-
|
|
6
|
+
plan: z.ZodEnum<{
|
|
7
|
+
Free: "Free";
|
|
8
|
+
Starter: "Starter";
|
|
9
|
+
Professional: "Professional";
|
|
10
|
+
Enterprise: "Enterprise";
|
|
11
|
+
Custom: "Custom";
|
|
12
|
+
}>;
|
|
13
|
+
billingCycle: z.ZodEnum<{
|
|
14
|
+
monthly: "monthly";
|
|
15
|
+
yearly: "yearly";
|
|
16
|
+
}>;
|
|
8
17
|
seats: z.ZodNumber;
|
|
9
|
-
status: z.ZodOptional<z.ZodEnum<
|
|
18
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
active: "active";
|
|
20
|
+
past_due: "past_due";
|
|
21
|
+
trialing: "trialing";
|
|
22
|
+
paused: "paused";
|
|
23
|
+
cancelled: "cancelled";
|
|
24
|
+
}>>;
|
|
10
25
|
startDate: z.ZodOptional<z.ZodString>;
|
|
11
26
|
trialEndDate: z.ZodOptional<z.ZodString>;
|
|
12
|
-
},
|
|
13
|
-
tenantId: string;
|
|
14
|
-
plan: "Free" | "Starter" | "Professional" | "Enterprise" | "Custom";
|
|
15
|
-
billingCycle: "monthly" | "yearly";
|
|
16
|
-
seats: number;
|
|
17
|
-
status?: "active" | "past_due" | "trialing" | "paused" | "cancelled" | undefined;
|
|
18
|
-
startDate?: string | undefined;
|
|
19
|
-
trialEndDate?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
tenantId: string;
|
|
22
|
-
plan: "Free" | "Starter" | "Professional" | "Enterprise" | "Custom";
|
|
23
|
-
billingCycle: "monthly" | "yearly";
|
|
24
|
-
seats: number;
|
|
25
|
-
status?: "active" | "past_due" | "trialing" | "paused" | "cancelled" | undefined;
|
|
26
|
-
startDate?: string | undefined;
|
|
27
|
-
trialEndDate?: string | undefined;
|
|
28
|
-
}>;
|
|
27
|
+
}, z.core.$strip>;
|
|
29
28
|
type SubscriptionFormData = z.infer<typeof subscriptionFormSchema>;
|
|
30
29
|
/**
|
|
31
30
|
* SubscriptionForm props
|
|
@@ -3,7 +3,7 @@ import { zodResolver as t } from "../../../node_modules/@hookform/resolvers/zod/
|
|
|
3
3
|
import { FormRow as n, FormSection as r, FormSheet as i, FormSheetFooter as a } from "../FormSheet.js";
|
|
4
4
|
import { Input as o } from "../ui.js";
|
|
5
5
|
import { cn as s } from "../../utils/cn.js";
|
|
6
|
-
import {
|
|
6
|
+
import { enum as c, number as l, object as u, string as d } from "../../../node_modules/zod/v4/classic/schemas.js";
|
|
7
7
|
import * as f from "react";
|
|
8
8
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
9
|
// src/admin/components/forms/SubscriptionForm.tsx
|
|
@@ -46,16 +46,16 @@ var g = f.forwardRef(({ className: e, options: t, placeholder: n, ...r }, i) =>
|
|
|
46
46
|
g.displayName = "SelectField";
|
|
47
47
|
var _ = u({
|
|
48
48
|
tenantId: d().min(1, "Tenant is required"),
|
|
49
|
-
plan:
|
|
49
|
+
plan: c([
|
|
50
50
|
"Free",
|
|
51
51
|
"Starter",
|
|
52
52
|
"Professional",
|
|
53
53
|
"Enterprise",
|
|
54
54
|
"Custom"
|
|
55
55
|
]),
|
|
56
|
-
billingCycle:
|
|
57
|
-
seats:
|
|
58
|
-
status:
|
|
56
|
+
billingCycle: c(["monthly", "yearly"]),
|
|
57
|
+
seats: l({ error: "At least 1 seat is required" }).int("Seats must be a whole number").min(1, "At least 1 seat is required"),
|
|
58
|
+
status: c([
|
|
59
59
|
"active",
|
|
60
60
|
"cancelled",
|
|
61
61
|
"past_due",
|
|
@@ -205,7 +205,7 @@ function x({ open: s, onClose: c, subscription: l, tenantId: u, tenants: d = [],
|
|
|
205
205
|
description: "Number of user seats included",
|
|
206
206
|
children: /* @__PURE__ */ p(o, {
|
|
207
207
|
type: "number",
|
|
208
|
-
...T("seats"),
|
|
208
|
+
...T("seats", { valueAsNumber: !0 }),
|
|
209
209
|
placeholder: "1",
|
|
210
210
|
min: 1,
|
|
211
211
|
max: 1e4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionForm.js","names":["React","z.object","z.string","z.enum","zodResolver","u","enumType","objectType","stringType","React$1","FormField","label","required","children","description","error","SelectField","props","cn","className","placeholder","options","opt","subscriptionFormSchema","coerce","planOptions","billingCycleOptions","statusOptions","SubscriptionForm","isEditing","subscription","formId","defaultValues","tenantId","useForm","open","reset","onSubmit","onSave","data","onClose","plan","watch","billingCycle","seats","monthlyPrice","yearlyMultiplier","totalPerPeriod","FormSheet","FormSheetFooter","handleSubmit","tenants","FormSection","errors","register","t","FormRow","Input"],"sources":["../../../../src/admin/components/forms/SubscriptionForm.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { z } from 'zod';\nimport { FormSheet, FormSheetFooter, FormSection, FormRow } from '../FormSheet';\nimport { Input } from '../ui';\nimport { cn } from '../../utils/cn';\nimport type { Subscription } from '../../types';\n\n/**\n * Form field wrapper with label and error\n */\ninterface FormFieldProps {\n label: string;\n error?: string;\n required?: boolean;\n children: React.ReactNode;\n description?: string;\n}\n\nfunction FormField({ label, error, required, children, description }: FormFieldProps) {\n return (\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-medium text-text-primary\">\n {label}\n {required && <span className=\"text-status-error-text ml-0.5\">*</span>}\n </label>\n {children}\n {description && !error && <p className=\"text-xs text-text-secondary\">{description}</p>}\n {error && <p className=\"text-xs text-status-error-text\">{error}</p>}\n </div>\n );\n}\n\n/**\n * Select wrapper styled like Input\n */\ninterface SelectFieldProps extends React.SelectHTMLAttributes<HTMLSelectElement> {\n options: { value: string; label: string }[];\n placeholder?: string;\n}\n\nconst SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>(\n ({ className, options, placeholder, ...props }, ref) => (\n <select\n ref={ref}\n className={cn(\n 'flex h-9 w-full rounded-md border border-border-default bg-transparent px-3 py-1 text-sm shadow-sm transition-colors',\n 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...props}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n )\n);\nSelectField.displayName = 'SelectField';\n\n// Unified form schema (handles both create and edit)\nconst subscriptionFormSchema = z.object({\n tenantId: z.string().min(1, 'Tenant is required'),\n plan: z.enum(['Free', 'Starter', 'Professional', 'Enterprise', 'Custom']),\n billingCycle: z.enum(['monthly', 'yearly']),\n seats: z.coerce.number().int().min(1, 'At least 1 seat is required'),\n status: z.enum(['active', 'cancelled', 'past_due', 'trialing', 'paused']).optional(),\n startDate: z.string().optional(),\n trialEndDate: z.string().optional(),\n});\n\ntype SubscriptionFormData = z.infer<typeof subscriptionFormSchema>;\n\n/**\n * SubscriptionForm props\n */\nexport interface SubscriptionFormProps {\n /** Whether the form is open */\n open: boolean;\n /** Callback when the form should close */\n onClose: () => void;\n /** Existing subscription data for editing (undefined for create) */\n subscription?: Subscription;\n /** Pre-selected tenant ID */\n tenantId?: string;\n /** List of available tenants for selection */\n tenants?: { id: string; name: string }[];\n /** Callback on successful save */\n onSave: (data: SubscriptionFormData & { id?: string }) => Promise<void>;\n}\n\nconst planOptions = [\n { value: 'Free', label: 'Free - $0/mo' },\n { value: 'Starter', label: 'Starter - $29/mo' },\n { value: 'Professional', label: 'Professional - $99/mo' },\n { value: 'Enterprise', label: 'Enterprise - $299/mo' },\n { value: 'Custom', label: 'Custom Pricing' },\n];\n\nconst billingCycleOptions = [\n { value: 'monthly', label: 'Monthly' },\n { value: 'yearly', label: 'Yearly (Save 20%)' },\n];\n\nconst statusOptions = [\n { value: 'active', label: 'Active' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'past_due', label: 'Past Due' },\n { value: 'trialing', label: 'Trialing' },\n { value: 'paused', label: 'Paused' },\n];\n\n/**\n * SubscriptionForm - Create/Edit subscription form in a slide-over panel\n */\nexport function SubscriptionForm({\n open,\n onClose,\n subscription,\n tenantId,\n tenants = [],\n onSave,\n}: SubscriptionFormProps) {\n const isEditing = !!subscription;\n const formId = 'subscription-form';\n\n const defaultValues: SubscriptionFormData = {\n tenantId: subscription?.tenantId ?? tenantId ?? '',\n plan: (subscription?.plan ?? 'Starter') as SubscriptionFormData['plan'],\n billingCycle: (subscription?.billingCycle ?? 'monthly') as SubscriptionFormData['billingCycle'],\n seats: subscription?.seats ?? 1,\n status: subscription?.status as SubscriptionFormData['status'],\n startDate: subscription?.startDate\n ? new Date(subscription.startDate).toISOString().split('T')[0]\n : new Date().toISOString().split('T')[0],\n trialEndDate: subscription?.trialEndDate\n ? new Date(subscription.trialEndDate).toISOString().split('T')[0]\n : undefined,\n };\n\n const {\n register,\n handleSubmit,\n formState: { errors, isSubmitting },\n reset,\n watch,\n } = useForm<SubscriptionFormData>({\n resolver: zodResolver(subscriptionFormSchema),\n defaultValues,\n });\n\n // Reset form when subscription or tenantId changes\n React.useEffect(() => {\n if (open) {\n reset(defaultValues);\n }\n }, [open, subscription?.id, tenantId]);\n\n const onSubmit = async (data: SubscriptionFormData) => {\n try {\n await onSave({ ...data, id: subscription?.id });\n onClose();\n } catch (error) {\n console.error('Failed to save subscription:', error);\n }\n };\n\n // Calculate estimated cost\n const plan = watch('plan');\n const billingCycle = watch('billingCycle');\n const seats = watch('seats') || 1;\n\n const planPrices: Record<string, number> = {\n Free: 0,\n Starter: 29,\n Professional: 99,\n Enterprise: 299,\n Custom: 0,\n };\n\n const monthlyPrice = planPrices[plan] || 0;\n const yearlyMultiplier = billingCycle === 'yearly' ? 0.8 : 1; // 20% discount for yearly\n const estimatedCost = monthlyPrice * seats * yearlyMultiplier;\n const billingPeriod = billingCycle === 'yearly' ? 12 : 1;\n const totalPerPeriod = estimatedCost * billingPeriod;\n\n return (\n <FormSheet\n open={open}\n onClose={onClose}\n title={isEditing ? 'Edit Subscription' : 'Create Subscription'}\n description={\n isEditing ? 'Modify subscription details' : 'Set up a new subscription for a tenant'\n }\n width=\"md\"\n footer={\n <FormSheetFooter\n formId={formId}\n submitLabel={isEditing ? 'Save Changes' : 'Create Subscription'}\n onCancel={onClose}\n isSubmitting={isSubmitting}\n />\n }\n >\n <form id={formId} onSubmit={handleSubmit(onSubmit)} className=\"space-y-6\">\n {/* Tenant Selection */}\n {tenants.length > 0 && !tenantId && (\n <FormSection>\n <FormField\n label=\"Tenant\"\n required\n error={errors.tenantId?.message}\n description=\"Select the tenant for this subscription\"\n >\n <SelectField\n {...register('tenantId')}\n options={tenants.map((t) => ({ value: t.id, label: t.name }))}\n placeholder=\"Select a tenant...\"\n />\n </FormField>\n </FormSection>\n )}\n\n {/* Plan Selection */}\n <FormSection title=\"Plan Details\">\n <FormRow>\n <FormField label=\"Plan\" required>\n <SelectField {...register('plan')} options={planOptions} />\n </FormField>\n\n <FormField label=\"Billing Cycle\" required>\n <SelectField {...register('billingCycle')} options={billingCycleOptions} />\n </FormField>\n </FormRow>\n\n <FormField\n label=\"Seats\"\n required\n error={errors.seats?.message}\n description=\"Number of user seats included\"\n >\n <Input type=\"number\" {...register('seats')} placeholder=\"1\" min={1} max={10000} />\n </FormField>\n\n {isEditing && (\n <FormField label=\"Status\">\n <SelectField {...register('status')} options={statusOptions} />\n </FormField>\n )}\n </FormSection>\n\n {/* Dates */}\n <FormSection title=\"Dates\">\n <FormRow>\n <FormField label=\"Start Date\" error={errors.startDate?.message}>\n <Input type=\"date\" {...register('startDate')} />\n </FormField>\n\n <FormField\n label=\"Trial End Date\"\n error={errors.trialEndDate?.message}\n description=\"Leave empty for no trial\"\n >\n <Input type=\"date\" {...register('trialEndDate')} />\n </FormField>\n </FormRow>\n </FormSection>\n\n {/* Cost Summary */}\n {plan !== 'Custom' && monthlyPrice > 0 && (\n <FormSection title=\"Cost Summary\">\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken/30 p-4\">\n <div className=\"space-y-2\">\n <div className=\"flex justify-between text-sm\">\n <span className=\"text-text-secondary\">Base Price</span>\n <span>${monthlyPrice}/user/month</span>\n </div>\n <div className=\"flex justify-between text-sm\">\n <span className=\"text-text-secondary\">Seats</span>\n <span>× {seats}</span>\n </div>\n {billingCycle === 'yearly' && (\n <div className=\"flex justify-between text-sm text-status-success-text\">\n <span>Annual Discount</span>\n <span>-20%</span>\n </div>\n )}\n <div className=\"border-t border-border-subtle pt-2 mt-2\">\n <div className=\"flex justify-between font-medium\">\n <span>{billingCycle === 'yearly' ? 'Annual Total' : 'Monthly Total'}</span>\n <span className=\"text-lg\">\n ${totalPerPeriod.toFixed(2)}\n <span className=\"text-sm font-normal text-text-secondary\">\n /{billingCycle === 'yearly' ? 'year' : 'month'}\n </span>\n </span>\n </div>\n </div>\n </div>\n </div>\n </FormSection>\n )}\n </form>\n </FormSheet>\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAASU,EAAU,EAAE,UAAO,UAAO,aAAU,aAAU,kBAA+B;CACpF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CACGC,GACAC,KAAY,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAAO,CAAA,CAC/D;;GACNC;GACAC,KAAe,CAACC,KAAS,kBAAC,KAAD;IAAG,WAAU;IAA+B,UAAAD;GAAe,CAAA;GACpFC,KAAS,kBAAC,KAAD;IAAG,WAAU;IAAkC,UAAAA;GAAS,CAAA;EAC/D;;AAET;AAUA,IAAMC,IAAchB,EAAM,YACvB,EAAE,cAAW,YAAS,gBAAa,GAAGiB,KAAS,MAC9C,kBAAC,UAAD;CACO;CAC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D,EAAA,UAAOA,MAAiB,WAAW,iBAAiB,gBAAsB,CAAA,GAC1E,kBAAC,QAAD;WAAM,WAAU;WAAhB,UAAA;YAA0B;YACtBI,EAAe,QAAQ,CAAC;YAC1B,kBAAC,QAAD;aAAM,WAAU;aAAhB,UAAA,CAA0D,KACtDJ,MAAiB,WAAW,SAAS,OACnC;;WACF;UACH,CAAA,CAAA;;QACF,CAAA;OACF;;KACF,CAAA;IACM,CAAA;GAEX;;CACG,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"SubscriptionForm.js","names":["React","z.object","z.string","z.enum","z.number","zodResolver","u","_enum","React$1","FormField","label","required","children","description","error","SelectField","props","cn","className","placeholder","options","opt","subscriptionFormSchema","object","string","number","planOptions","billingCycleOptions","statusOptions","SubscriptionForm","isEditing","subscription","formId","defaultValues","tenantId","useForm","open","reset","onSubmit","onSave","data","onClose","plan","watch","billingCycle","seats","monthlyPrice","yearlyMultiplier","totalPerPeriod","FormSheet","FormSheetFooter","handleSubmit","tenants","FormSection","errors","register","t","FormRow","Input"],"sources":["../../../../src/admin/components/forms/SubscriptionForm.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { z } from 'zod';\nimport { FormSheet, FormSheetFooter, FormSection, FormRow } from '../FormSheet';\nimport { Input } from '../ui';\nimport { cn } from '../../utils/cn';\nimport type { Subscription } from '../../types';\n\n/**\n * Form field wrapper with label and error\n */\ninterface FormFieldProps {\n label: string;\n error?: string;\n required?: boolean;\n children: React.ReactNode;\n description?: string;\n}\n\nfunction FormField({ label, error, required, children, description }: FormFieldProps) {\n return (\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-medium text-text-primary\">\n {label}\n {required && <span className=\"text-status-error-text ml-0.5\">*</span>}\n </label>\n {children}\n {description && !error && <p className=\"text-xs text-text-secondary\">{description}</p>}\n {error && <p className=\"text-xs text-status-error-text\">{error}</p>}\n </div>\n );\n}\n\n/**\n * Select wrapper styled like Input\n */\ninterface SelectFieldProps extends React.SelectHTMLAttributes<HTMLSelectElement> {\n options: { value: string; label: string }[];\n placeholder?: string;\n}\n\nconst SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>(\n ({ className, options, placeholder, ...props }, ref) => (\n <select\n ref={ref}\n className={cn(\n 'flex h-9 w-full rounded-md border border-border-default bg-transparent px-3 py-1 text-sm shadow-sm transition-colors',\n 'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...props}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n )\n);\nSelectField.displayName = 'SelectField';\n\n// Unified form schema (handles both create and edit)\nconst subscriptionFormSchema = z.object({\n tenantId: z.string().min(1, 'Tenant is required'),\n plan: z.enum(['Free', 'Starter', 'Professional', 'Enterprise', 'Custom']),\n billingCycle: z.enum(['monthly', 'yearly']),\n // The input registers with valueAsNumber, so an empty field arrives as NaN;\n // the type error message covers that case.\n seats: z\n .number({ error: 'At least 1 seat is required' })\n .int('Seats must be a whole number')\n .min(1, 'At least 1 seat is required'),\n status: z.enum(['active', 'cancelled', 'past_due', 'trialing', 'paused']).optional(),\n startDate: z.string().optional(),\n trialEndDate: z.string().optional(),\n});\n\ntype SubscriptionFormData = z.infer<typeof subscriptionFormSchema>;\n\n/**\n * SubscriptionForm props\n */\nexport interface SubscriptionFormProps {\n /** Whether the form is open */\n open: boolean;\n /** Callback when the form should close */\n onClose: () => void;\n /** Existing subscription data for editing (undefined for create) */\n subscription?: Subscription;\n /** Pre-selected tenant ID */\n tenantId?: string;\n /** List of available tenants for selection */\n tenants?: { id: string; name: string }[];\n /** Callback on successful save */\n onSave: (data: SubscriptionFormData & { id?: string }) => Promise<void>;\n}\n\nconst planOptions = [\n { value: 'Free', label: 'Free - $0/mo' },\n { value: 'Starter', label: 'Starter - $29/mo' },\n { value: 'Professional', label: 'Professional - $99/mo' },\n { value: 'Enterprise', label: 'Enterprise - $299/mo' },\n { value: 'Custom', label: 'Custom Pricing' },\n];\n\nconst billingCycleOptions = [\n { value: 'monthly', label: 'Monthly' },\n { value: 'yearly', label: 'Yearly (Save 20%)' },\n];\n\nconst statusOptions = [\n { value: 'active', label: 'Active' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'past_due', label: 'Past Due' },\n { value: 'trialing', label: 'Trialing' },\n { value: 'paused', label: 'Paused' },\n];\n\n/**\n * SubscriptionForm - Create/Edit subscription form in a slide-over panel\n */\nexport function SubscriptionForm({\n open,\n onClose,\n subscription,\n tenantId,\n tenants = [],\n onSave,\n}: SubscriptionFormProps) {\n const isEditing = !!subscription;\n const formId = 'subscription-form';\n\n const defaultValues: SubscriptionFormData = {\n tenantId: subscription?.tenantId ?? tenantId ?? '',\n plan: (subscription?.plan ?? 'Starter') as SubscriptionFormData['plan'],\n billingCycle: (subscription?.billingCycle ?? 'monthly') as SubscriptionFormData['billingCycle'],\n seats: subscription?.seats ?? 1,\n status: subscription?.status as SubscriptionFormData['status'],\n startDate: subscription?.startDate\n ? new Date(subscription.startDate).toISOString().split('T')[0]\n : new Date().toISOString().split('T')[0],\n trialEndDate: subscription?.trialEndDate\n ? new Date(subscription.trialEndDate).toISOString().split('T')[0]\n : undefined,\n };\n\n const {\n register,\n handleSubmit,\n formState: { errors, isSubmitting },\n reset,\n watch,\n } = useForm<SubscriptionFormData>({\n resolver: zodResolver(subscriptionFormSchema),\n defaultValues,\n });\n\n // Reset form when subscription or tenantId changes\n React.useEffect(() => {\n if (open) {\n reset(defaultValues);\n }\n }, [open, subscription?.id, tenantId]);\n\n const onSubmit = async (data: SubscriptionFormData) => {\n try {\n await onSave({ ...data, id: subscription?.id });\n onClose();\n } catch (error) {\n console.error('Failed to save subscription:', error);\n }\n };\n\n // Calculate estimated cost\n const plan = watch('plan');\n const billingCycle = watch('billingCycle');\n const seats = watch('seats') || 1;\n\n const planPrices: Record<string, number> = {\n Free: 0,\n Starter: 29,\n Professional: 99,\n Enterprise: 299,\n Custom: 0,\n };\n\n const monthlyPrice = planPrices[plan] || 0;\n const yearlyMultiplier = billingCycle === 'yearly' ? 0.8 : 1; // 20% discount for yearly\n const estimatedCost = monthlyPrice * seats * yearlyMultiplier;\n const billingPeriod = billingCycle === 'yearly' ? 12 : 1;\n const totalPerPeriod = estimatedCost * billingPeriod;\n\n return (\n <FormSheet\n open={open}\n onClose={onClose}\n title={isEditing ? 'Edit Subscription' : 'Create Subscription'}\n description={\n isEditing ? 'Modify subscription details' : 'Set up a new subscription for a tenant'\n }\n width=\"md\"\n footer={\n <FormSheetFooter\n formId={formId}\n submitLabel={isEditing ? 'Save Changes' : 'Create Subscription'}\n onCancel={onClose}\n isSubmitting={isSubmitting}\n />\n }\n >\n <form id={formId} onSubmit={handleSubmit(onSubmit)} className=\"space-y-6\">\n {/* Tenant Selection */}\n {tenants.length > 0 && !tenantId && (\n <FormSection>\n <FormField\n label=\"Tenant\"\n required\n error={errors.tenantId?.message}\n description=\"Select the tenant for this subscription\"\n >\n <SelectField\n {...register('tenantId')}\n options={tenants.map((t) => ({ value: t.id, label: t.name }))}\n placeholder=\"Select a tenant...\"\n />\n </FormField>\n </FormSection>\n )}\n\n {/* Plan Selection */}\n <FormSection title=\"Plan Details\">\n <FormRow>\n <FormField label=\"Plan\" required>\n <SelectField {...register('plan')} options={planOptions} />\n </FormField>\n\n <FormField label=\"Billing Cycle\" required>\n <SelectField {...register('billingCycle')} options={billingCycleOptions} />\n </FormField>\n </FormRow>\n\n <FormField\n label=\"Seats\"\n required\n error={errors.seats?.message}\n description=\"Number of user seats included\"\n >\n <Input\n type=\"number\"\n {...register('seats', { valueAsNumber: true })}\n placeholder=\"1\"\n min={1}\n max={10000}\n />\n </FormField>\n\n {isEditing && (\n <FormField label=\"Status\">\n <SelectField {...register('status')} options={statusOptions} />\n </FormField>\n )}\n </FormSection>\n\n {/* Dates */}\n <FormSection title=\"Dates\">\n <FormRow>\n <FormField label=\"Start Date\" error={errors.startDate?.message}>\n <Input type=\"date\" {...register('startDate')} />\n </FormField>\n\n <FormField\n label=\"Trial End Date\"\n error={errors.trialEndDate?.message}\n description=\"Leave empty for no trial\"\n >\n <Input type=\"date\" {...register('trialEndDate')} />\n </FormField>\n </FormRow>\n </FormSection>\n\n {/* Cost Summary */}\n {plan !== 'Custom' && monthlyPrice > 0 && (\n <FormSection title=\"Cost Summary\">\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken/30 p-4\">\n <div className=\"space-y-2\">\n <div className=\"flex justify-between text-sm\">\n <span className=\"text-text-secondary\">Base Price</span>\n <span>${monthlyPrice}/user/month</span>\n </div>\n <div className=\"flex justify-between text-sm\">\n <span className=\"text-text-secondary\">Seats</span>\n <span>× {seats}</span>\n </div>\n {billingCycle === 'yearly' && (\n <div className=\"flex justify-between text-sm text-status-success-text\">\n <span>Annual Discount</span>\n <span>-20%</span>\n </div>\n )}\n <div className=\"border-t border-border-subtle pt-2 mt-2\">\n <div className=\"flex justify-between font-medium\">\n <span>{billingCycle === 'yearly' ? 'Annual Total' : 'Monthly Total'}</span>\n <span className=\"text-lg\">\n ${totalPerPeriod.toFixed(2)}\n <span className=\"text-sm font-normal text-text-secondary\">\n /{billingCycle === 'yearly' ? 'year' : 'month'}\n </span>\n </span>\n </div>\n </div>\n </div>\n </div>\n </FormSection>\n )}\n </form>\n </FormSheet>\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAASS,EAAU,EAAE,UAAO,UAAO,aAAU,aAAU,kBAA+B;CACpF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CACGC,GACAC,KAAY,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAAO,CAAA,CAC/D;;GACNC;GACAC,KAAe,CAACC,KAAS,kBAAC,KAAD;I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AAA,CAClB;;QACJD,MAAiB,YAChB,kBAAC,OAAD;SAAK,WAAU;SAAf,UAAA,CACE,kBAAC,QAAD,EAAA,UAAM,kBAAqB,CAAA,GAC3B,kBAAC,QAAD,EAAA,UAAM,OAAU,CAAA,CACb;;QAEP,kBAAC,OAAD;SAAK,WAAU;SACb,UAAA,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAAC,QAAD,EAAA,UAAOA,MAAiB,WAAW,iBAAiB,gBAAsB,CAAA,GAC1E,kBAAC,QAAD;WAAM,WAAU;WAAhB,UAAA;YAA0B;YACtBI,EAAe,QAAQ,CAAC;YAC1B,kBAAC,QAAD;aAAM,WAAU;aAAhB,UAAA,CAA0D,KACtDJ,MAAiB,WAAW,SAAS,OACnC;;WACF;UACH,CAAA,CAAA;;QACF,CAAA;OACF;;KACF,CAAA;IACM,CAAA;GAEX;;CACG,CAAA;AAEf"}
|
|
@@ -5,8 +5,8 @@ declare function buildTenantFormSchema(tr: (key: string, fallback: string) => st
|
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
slug: z.ZodString;
|
|
7
7
|
domain: z.ZodOptional<z.ZodString>;
|
|
8
|
-
ownerEmail: z.
|
|
9
|
-
billingEmail: z.ZodUnion<[z.ZodOptional<z.
|
|
8
|
+
ownerEmail: z.ZodEmail;
|
|
9
|
+
billingEmail: z.ZodUnion<[z.ZodOptional<z.ZodEmail>, z.ZodLiteral<"">]>;
|
|
10
10
|
plan: z.ZodString;
|
|
11
11
|
status: z.ZodOptional<z.ZodString>;
|
|
12
12
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -14,46 +14,8 @@ declare function buildTenantFormSchema(tr: (key: string, fallback: string) => st
|
|
|
14
14
|
ssoEnabled: z.ZodBoolean;
|
|
15
15
|
mfaRequired: z.ZodBoolean;
|
|
16
16
|
dataRetentionDays: z.ZodNumber;
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
ssoEnabled: boolean;
|
|
20
|
-
mfaRequired: boolean;
|
|
21
|
-
dataRetentionDays: number;
|
|
22
|
-
}, {
|
|
23
|
-
allowSignup: boolean;
|
|
24
|
-
ssoEnabled: boolean;
|
|
25
|
-
mfaRequired: boolean;
|
|
26
|
-
dataRetentionDays: number;
|
|
27
|
-
}>>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
name: string;
|
|
30
|
-
slug: string;
|
|
31
|
-
ownerEmail: string;
|
|
32
|
-
plan: string;
|
|
33
|
-
status?: string | undefined;
|
|
34
|
-
settings?: {
|
|
35
|
-
allowSignup: boolean;
|
|
36
|
-
ssoEnabled: boolean;
|
|
37
|
-
mfaRequired: boolean;
|
|
38
|
-
dataRetentionDays: number;
|
|
39
|
-
} | undefined;
|
|
40
|
-
domain?: string | undefined;
|
|
41
|
-
billingEmail?: string | undefined;
|
|
42
|
-
}, {
|
|
43
|
-
name: string;
|
|
44
|
-
slug: string;
|
|
45
|
-
ownerEmail: string;
|
|
46
|
-
plan: string;
|
|
47
|
-
status?: string | undefined;
|
|
48
|
-
settings?: {
|
|
49
|
-
allowSignup: boolean;
|
|
50
|
-
ssoEnabled: boolean;
|
|
51
|
-
mfaRequired: boolean;
|
|
52
|
-
dataRetentionDays: number;
|
|
53
|
-
} | undefined;
|
|
54
|
-
domain?: string | undefined;
|
|
55
|
-
billingEmail?: string | undefined;
|
|
56
|
-
}>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
57
19
|
type TenantFormData = z.infer<ReturnType<typeof buildTenantFormSchema>>;
|
|
58
20
|
export interface TenantFormProps {
|
|
59
21
|
open: boolean;
|
|
@@ -3,101 +3,101 @@ import { zodResolver as n } from "../../../node_modules/@hookform/resolvers/zod/
|
|
|
3
3
|
import { FormRow as r, FormSection as i, FormSheet as a, FormSheetFooter as o } from "../FormSheet.js";
|
|
4
4
|
import { Input as s } from "../ui.js";
|
|
5
5
|
import { cn as c } from "../../utils/cn.js";
|
|
6
|
-
import { boolean as l,
|
|
7
|
-
import { tWithFallback as
|
|
8
|
-
import * as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { useI18n as
|
|
6
|
+
import { boolean as l, email as u, literal as d, number as f, object as p, string as m } from "../../../node_modules/zod/v4/classic/schemas.js";
|
|
7
|
+
import { tWithFallback as h } from "../../utils/i18n.js";
|
|
8
|
+
import * as g from "react";
|
|
9
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
+
import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
11
|
// src/admin/components/forms/TenantForm.tsx
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
function b({ label: e, error: t, required: n, children: r, description: i }) {
|
|
13
|
+
return /* @__PURE__ */ v("div", {
|
|
14
14
|
className: "space-y-1.5",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ v("label", {
|
|
17
17
|
className: "text-sm font-medium text-text-primary",
|
|
18
|
-
children: [e, n && /* @__PURE__ */
|
|
18
|
+
children: [e, n && /* @__PURE__ */ _("span", {
|
|
19
19
|
className: "text-status-error-text ml-0.5",
|
|
20
20
|
children: "*"
|
|
21
21
|
})]
|
|
22
22
|
}),
|
|
23
23
|
r,
|
|
24
|
-
i && !t && /* @__PURE__ */
|
|
24
|
+
i && !t && /* @__PURE__ */ _("p", {
|
|
25
25
|
className: "text-xs text-text-secondary",
|
|
26
26
|
children: i
|
|
27
27
|
}),
|
|
28
|
-
t && /* @__PURE__ */
|
|
28
|
+
t && /* @__PURE__ */ _("p", {
|
|
29
29
|
className: "text-xs text-status-error-text",
|
|
30
30
|
children: t
|
|
31
31
|
})
|
|
32
32
|
]
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var x = g.forwardRef(({ className: e, options: t, placeholder: n, ...r }, i) => /* @__PURE__ */ v("select", {
|
|
36
36
|
ref: i,
|
|
37
37
|
className: c("flex h-9 w-full rounded-md border border-border-default bg-transparent px-3 py-1 text-sm shadow-sm transition-colors", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]", "disabled:cursor-not-allowed disabled:opacity-50", e),
|
|
38
38
|
...r,
|
|
39
|
-
children: [n && /* @__PURE__ */
|
|
39
|
+
children: [n && /* @__PURE__ */ _("option", {
|
|
40
40
|
value: "",
|
|
41
41
|
disabled: !0,
|
|
42
42
|
children: n
|
|
43
|
-
}), t.map((e) => /* @__PURE__ */
|
|
43
|
+
}), t.map((e) => /* @__PURE__ */ _("option", {
|
|
44
44
|
value: e.value,
|
|
45
45
|
children: e.label
|
|
46
46
|
}, e.value))]
|
|
47
47
|
}));
|
|
48
|
-
|
|
49
|
-
function
|
|
50
|
-
return /* @__PURE__ */
|
|
48
|
+
x.displayName = "SelectField";
|
|
49
|
+
function S({ label: e, checked: t, onChange: n, description: r, disabled: i }) {
|
|
50
|
+
return /* @__PURE__ */ v("label", {
|
|
51
51
|
className: "flex items-start gap-3 cursor-pointer",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ _("input", {
|
|
53
53
|
type: "checkbox",
|
|
54
54
|
checked: t,
|
|
55
55
|
onChange: (e) => n(e.target.checked),
|
|
56
56
|
disabled: i,
|
|
57
57
|
className: c("mt-0.5 h-4 w-4 rounded border border-border-default shadow-sm", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]", "disabled:cursor-not-allowed disabled:opacity-50", "checked:bg-action-primary-bg checked:border-primary")
|
|
58
|
-
}), /* @__PURE__ */
|
|
58
|
+
}), /* @__PURE__ */ v("div", {
|
|
59
59
|
className: "space-y-0.5",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ _("span", {
|
|
61
61
|
className: "text-sm font-medium text-text-primary",
|
|
62
62
|
children: e
|
|
63
|
-
}), r && /* @__PURE__ */
|
|
63
|
+
}), r && /* @__PURE__ */ _("p", {
|
|
64
64
|
className: "text-xs text-text-secondary",
|
|
65
65
|
children: r
|
|
66
66
|
})]
|
|
67
67
|
})]
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var C = [
|
|
71
71
|
"Free",
|
|
72
72
|
"Starter",
|
|
73
73
|
"Professional",
|
|
74
74
|
"Enterprise",
|
|
75
75
|
"Custom"
|
|
76
|
-
],
|
|
76
|
+
], w = [
|
|
77
77
|
"active",
|
|
78
78
|
"suspended",
|
|
79
79
|
"pending",
|
|
80
80
|
"churned"
|
|
81
81
|
];
|
|
82
|
-
function
|
|
83
|
-
return
|
|
84
|
-
name:
|
|
85
|
-
slug:
|
|
86
|
-
domain:
|
|
87
|
-
ownerEmail:
|
|
88
|
-
billingEmail:
|
|
89
|
-
plan:
|
|
90
|
-
status:
|
|
91
|
-
settings:
|
|
82
|
+
function T(e) {
|
|
83
|
+
return p({
|
|
84
|
+
name: m().min(2, e("admin.tenants.form.errors.nameMin", "Name must be at least 2 characters")).max(100, e("admin.tenants.form.errors.nameMax", "Name must be less than 100 characters")),
|
|
85
|
+
slug: m().min(2, e("admin.tenants.form.errors.slugMin", "Slug must be at least 2 characters")).max(50, e("admin.tenants.form.errors.slugMax", "Slug must be less than 50 characters")).regex(/^[a-z0-9-]+$/, e("admin.tenants.form.errors.slugPattern", "Slug can only contain lowercase letters, numbers, and hyphens")),
|
|
86
|
+
domain: m().optional(),
|
|
87
|
+
ownerEmail: u(e("admin.tenants.form.errors.emailInvalid", "Invalid email address")),
|
|
88
|
+
billingEmail: u(e("admin.tenants.form.errors.emailInvalid", "Invalid email address")).optional().or(d("")),
|
|
89
|
+
plan: m().min(1),
|
|
90
|
+
status: m().optional(),
|
|
91
|
+
settings: p({
|
|
92
92
|
allowSignup: l(),
|
|
93
93
|
ssoEnabled: l(),
|
|
94
94
|
mfaRequired: l(),
|
|
95
|
-
dataRetentionDays:
|
|
95
|
+
dataRetentionDays: f({ error: e("admin.tenants.form.errors.dataRetentionDaysRange", "Data retention must be between 30 and 3650 days") }).int().min(30, e("admin.tenants.form.errors.dataRetentionDaysRange", "Data retention must be between 30 and 3650 days")).max(3650, e("admin.tenants.form.errors.dataRetentionDaysRange", "Data retention must be between 30 and 3650 days"))
|
|
96
96
|
}).optional()
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
let f = !!u, p = "tenant-form", { t:
|
|
99
|
+
function E({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
100
|
+
let f = !!u, p = "tenant-form", { t: m } = y(), E = g.useCallback((e, t, n) => h(m, e, t, n), [m]), D = g.useMemo(() => T(E), [E]), O = g.useMemo(() => {
|
|
101
101
|
let e = [
|
|
102
102
|
{
|
|
103
103
|
value: "Free",
|
|
@@ -120,11 +120,11 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
120
120
|
label: E("admin.tenants.form.plans.custom", "Custom")
|
|
121
121
|
}
|
|
122
122
|
];
|
|
123
|
-
return u?.plan && !
|
|
123
|
+
return u?.plan && !C.includes(u.plan) && e.push({
|
|
124
124
|
value: u.plan,
|
|
125
125
|
label: E("admin.tenants.form.plans.legacy", "{{plan}} (legacy)", { plan: u.plan })
|
|
126
126
|
}), e;
|
|
127
|
-
}, [E, u?.plan]), k =
|
|
127
|
+
}, [E, u?.plan]), k = g.useMemo(() => {
|
|
128
128
|
let e = [
|
|
129
129
|
{
|
|
130
130
|
value: "active",
|
|
@@ -143,11 +143,11 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
143
143
|
label: E("admin.tenants.form.statuses.churned", "Churned")
|
|
144
144
|
}
|
|
145
145
|
];
|
|
146
|
-
return u?.status && !
|
|
146
|
+
return u?.status && !w.includes(u.status) && e.push({
|
|
147
147
|
value: u.status,
|
|
148
148
|
label: E("admin.tenants.form.statuses.other", "{{status}} (read-only)", { status: u.status })
|
|
149
149
|
}), e;
|
|
150
|
-
}, [E, u?.status]), A =
|
|
150
|
+
}, [E, u?.status]), A = g.useMemo(() => ({
|
|
151
151
|
name: u?.name ?? "",
|
|
152
152
|
slug: u?.slug ?? "",
|
|
153
153
|
domain: u?.domain ?? "",
|
|
@@ -164,8 +164,8 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
164
164
|
}), [u]), { register: j, handleSubmit: M, control: N, formState: { errors: P, isSubmitting: F }, reset: I, watch: L, setValue: R } = t({
|
|
165
165
|
resolver: n(D),
|
|
166
166
|
defaultValues: A
|
|
167
|
-
}), z =
|
|
168
|
-
|
|
167
|
+
}), z = g.useRef(null);
|
|
168
|
+
g.useEffect(() => {
|
|
169
169
|
if (!c) {
|
|
170
170
|
z.current = null;
|
|
171
171
|
return;
|
|
@@ -188,7 +188,7 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
188
188
|
console.error("Failed to save tenant:", e);
|
|
189
189
|
}
|
|
190
190
|
}, V = L("name"), H = L("slug");
|
|
191
|
-
|
|
191
|
+
g.useEffect(() => {
|
|
192
192
|
if (!f && V && !H) {
|
|
193
193
|
let e = V.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
194
194
|
R("slug", e);
|
|
@@ -200,72 +200,72 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
200
200
|
H
|
|
201
201
|
]);
|
|
202
202
|
let U = E("admin.tenants.form.titleEdit", "Edit Tenant"), W = E("admin.tenants.form.titleCreate", "Create Tenant"), G = E("admin.tenants.form.submitEdit", "Save Changes"), K = E("admin.tenants.form.submitCreate", "Create Tenant");
|
|
203
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ _(a, {
|
|
204
204
|
open: c,
|
|
205
205
|
onClose: l,
|
|
206
206
|
title: f ? U : W,
|
|
207
207
|
description: f ? E("admin.tenants.form.descriptionEdit", "Editing {{name}}", { name: u?.name ?? "" }) : E("admin.tenants.form.descriptionCreate", "Add a new tenant to the platform"),
|
|
208
208
|
width: "lg",
|
|
209
|
-
footer: /* @__PURE__ */
|
|
209
|
+
footer: /* @__PURE__ */ _(o, {
|
|
210
210
|
formId: p,
|
|
211
211
|
submitLabel: f ? G : K,
|
|
212
212
|
onCancel: l,
|
|
213
213
|
isSubmitting: F
|
|
214
214
|
}),
|
|
215
|
-
children: /* @__PURE__ */
|
|
215
|
+
children: /* @__PURE__ */ v("form", {
|
|
216
216
|
id: p,
|
|
217
217
|
onSubmit: M(B),
|
|
218
218
|
className: "space-y-6",
|
|
219
219
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ v(i, {
|
|
221
221
|
title: E("admin.tenants.form.sections.basic", "Basic Information"),
|
|
222
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ _(b, {
|
|
223
223
|
label: E("admin.tenants.form.fields.name", "Tenant Name"),
|
|
224
224
|
required: !0,
|
|
225
225
|
error: P.name?.message,
|
|
226
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ _(s, {
|
|
227
227
|
...j("name"),
|
|
228
228
|
placeholder: E("admin.tenants.form.placeholders.name", "Acme Corporation"),
|
|
229
229
|
"aria-invalid": !!P.name
|
|
230
230
|
})
|
|
231
|
-
}), /* @__PURE__ */
|
|
231
|
+
}), /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(b, {
|
|
232
232
|
label: E("admin.tenants.form.fields.slug", "Slug"),
|
|
233
233
|
required: !0,
|
|
234
234
|
error: P.slug?.message,
|
|
235
235
|
description: f ? E("admin.tenants.form.descriptions.slugImmutable", "Slug is set at creation and cannot be changed.") : E("admin.tenants.form.descriptions.slug", "URL-friendly identifier"),
|
|
236
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ _(s, {
|
|
237
237
|
...j("slug"),
|
|
238
238
|
placeholder: E("admin.tenants.form.placeholders.slug", "acme-corp"),
|
|
239
239
|
"aria-invalid": !!P.slug,
|
|
240
240
|
disabled: f,
|
|
241
241
|
readOnly: f
|
|
242
242
|
})
|
|
243
|
-
}), /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ _(b, {
|
|
244
244
|
label: E("admin.tenants.form.fields.domain", "Domain"),
|
|
245
245
|
error: P.domain?.message,
|
|
246
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ _(s, {
|
|
247
247
|
...j("domain"),
|
|
248
248
|
placeholder: E("admin.tenants.form.placeholders.domain", "acme.com"),
|
|
249
249
|
"aria-invalid": !!P.domain
|
|
250
250
|
})
|
|
251
251
|
})] })]
|
|
252
252
|
}),
|
|
253
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ _(i, {
|
|
254
254
|
title: E("admin.tenants.form.sections.contact", "Contact Information"),
|
|
255
|
-
children: /* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(b, {
|
|
256
256
|
label: E("admin.tenants.form.fields.ownerEmail", "Owner Email"),
|
|
257
257
|
required: !0,
|
|
258
258
|
error: P.ownerEmail?.message,
|
|
259
|
-
children: /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ _(s, {
|
|
260
260
|
type: "email",
|
|
261
261
|
...j("ownerEmail"),
|
|
262
262
|
placeholder: E("admin.tenants.form.placeholders.ownerEmail", "admin@acme.com"),
|
|
263
263
|
"aria-invalid": !!P.ownerEmail
|
|
264
264
|
})
|
|
265
|
-
}), /* @__PURE__ */
|
|
265
|
+
}), /* @__PURE__ */ _(b, {
|
|
266
266
|
label: E("admin.tenants.form.fields.billingEmail", "Billing Email"),
|
|
267
267
|
error: P.billingEmail?.message,
|
|
268
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ _(s, {
|
|
269
269
|
type: "email",
|
|
270
270
|
...j("billingEmail"),
|
|
271
271
|
placeholder: E("admin.tenants.form.placeholders.billingEmail", "billing@acme.com"),
|
|
@@ -273,53 +273,53 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
273
273
|
})
|
|
274
274
|
})] })
|
|
275
275
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ _(i, {
|
|
277
277
|
title: E("admin.tenants.form.sections.planStatus", "Plan & Status"),
|
|
278
|
-
children: /* @__PURE__ */
|
|
278
|
+
children: /* @__PURE__ */ v(r, { children: [/* @__PURE__ */ _(b, {
|
|
279
279
|
label: E("admin.tenants.form.fields.plan", "Plan"),
|
|
280
280
|
required: !0,
|
|
281
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ _(x, {
|
|
282
282
|
...j("plan"),
|
|
283
283
|
options: O
|
|
284
284
|
})
|
|
285
|
-
}), f && /* @__PURE__ */
|
|
285
|
+
}), f && /* @__PURE__ */ _(b, {
|
|
286
286
|
label: E("admin.tenants.form.fields.status", "Status"),
|
|
287
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ _(x, {
|
|
288
288
|
...j("status"),
|
|
289
289
|
options: k
|
|
290
290
|
})
|
|
291
291
|
})] })
|
|
292
292
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ v(i, {
|
|
294
294
|
title: E("admin.tenants.form.sections.settings", "Settings"),
|
|
295
295
|
description: E("admin.tenants.form.descriptions.settings", "Configure tenant security and access settings"),
|
|
296
|
-
children: [/* @__PURE__ */
|
|
296
|
+
children: [/* @__PURE__ */ v("div", {
|
|
297
297
|
className: "space-y-3",
|
|
298
298
|
children: [
|
|
299
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ _(e, {
|
|
300
300
|
name: "settings.allowSignup",
|
|
301
301
|
control: N,
|
|
302
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
302
|
+
render: ({ field: e }) => /* @__PURE__ */ _(S, {
|
|
303
303
|
label: E("admin.tenants.form.settings.allowSignupLabel", "Allow Self-Signup"),
|
|
304
304
|
checked: e.value ?? !0,
|
|
305
305
|
onChange: e.onChange,
|
|
306
306
|
description: E("admin.tenants.form.settings.allowSignupDescription", "Allow users to sign up for this tenant")
|
|
307
307
|
})
|
|
308
308
|
}),
|
|
309
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ _(e, {
|
|
310
310
|
name: "settings.ssoEnabled",
|
|
311
311
|
control: N,
|
|
312
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
312
|
+
render: ({ field: e }) => /* @__PURE__ */ _(S, {
|
|
313
313
|
label: E("admin.tenants.form.settings.ssoEnabledLabel", "Enable SSO"),
|
|
314
314
|
checked: e.value ?? !1,
|
|
315
315
|
onChange: e.onChange,
|
|
316
316
|
description: E("admin.tenants.form.settings.ssoEnabledDescription", "Enable Single Sign-On authentication")
|
|
317
317
|
})
|
|
318
318
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ _(e, {
|
|
320
320
|
name: "settings.mfaRequired",
|
|
321
321
|
control: N,
|
|
322
|
-
render: ({ field: e }) => /* @__PURE__ */
|
|
322
|
+
render: ({ field: e }) => /* @__PURE__ */ _(S, {
|
|
323
323
|
label: E("admin.tenants.form.settings.mfaRequiredLabel", "Require MFA"),
|
|
324
324
|
checked: e.value ?? !1,
|
|
325
325
|
onChange: e.onChange,
|
|
@@ -327,12 +327,12 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
327
327
|
})
|
|
328
328
|
})
|
|
329
329
|
]
|
|
330
|
-
}), /* @__PURE__ */
|
|
330
|
+
}), /* @__PURE__ */ _(b, {
|
|
331
331
|
label: E("admin.tenants.form.fields.dataRetentionDays", "Data Retention (days)"),
|
|
332
332
|
error: P.settings?.dataRetentionDays?.message,
|
|
333
|
-
children: /* @__PURE__ */
|
|
333
|
+
children: /* @__PURE__ */ _(s, {
|
|
334
334
|
type: "number",
|
|
335
|
-
...j("settings.dataRetentionDays"),
|
|
335
|
+
...j("settings.dataRetentionDays", { valueAsNumber: !0 }),
|
|
336
336
|
placeholder: "365",
|
|
337
337
|
min: 30,
|
|
338
338
|
max: 3650
|
|
@@ -343,6 +343,6 @@ function T({ open: c, onClose: l, tenant: u, onSave: d }) {
|
|
|
343
343
|
})
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
export {
|
|
346
|
+
export { E as TenantForm };
|
|
347
347
|
|
|
348
348
|
//# sourceMappingURL=TenantForm.js.map
|