@datatechsolutions/ui 3.8.0 → 3.9.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/astrlabe/index.js +107 -107
- package/dist/astrlabe/index.mjs +3 -3
- package/dist/astrlabe/workflow-canvas.js +3 -3
- package/dist/astrlabe/workflow-canvas.mjs +2 -2
- package/dist/{chunk-KKXI7CPF.mjs → chunk-2E7HYTS7.mjs} +3 -3
- package/dist/{chunk-KKXI7CPF.mjs.map → chunk-2E7HYTS7.mjs.map} +1 -1
- package/dist/{chunk-EWYAM4WJ.mjs → chunk-2ZY3IQ2I.mjs} +3 -3
- package/dist/{chunk-EWYAM4WJ.mjs.map → chunk-2ZY3IQ2I.mjs.map} +1 -1
- package/dist/{chunk-VPFVW7ZF.js → chunk-6E2YH67A.js} +35 -35
- package/dist/{chunk-VPFVW7ZF.js.map → chunk-6E2YH67A.js.map} +1 -1
- package/dist/{chunk-A4A3SQTV.mjs → chunk-6QJI5YOJ.mjs} +3 -3
- package/dist/{chunk-A4A3SQTV.mjs.map → chunk-6QJI5YOJ.mjs.map} +1 -1
- package/dist/{chunk-3X3IYDG6.js → chunk-7AM2SXEF.js} +68 -68
- package/dist/{chunk-3X3IYDG6.js.map → chunk-7AM2SXEF.js.map} +1 -1
- package/dist/{chunk-H37VDL7Y.js → chunk-A2RIX2RK.js} +4 -4
- package/dist/{chunk-H37VDL7Y.js.map → chunk-A2RIX2RK.js.map} +1 -1
- package/dist/{chunk-32DHEVOH.mjs → chunk-ARLYOLSO.mjs} +3 -3
- package/dist/{chunk-32DHEVOH.mjs.map → chunk-ARLYOLSO.mjs.map} +1 -1
- package/dist/{chunk-5YVOLHSW.mjs → chunk-AXBD6OAF.mjs} +4 -4
- package/dist/{chunk-5YVOLHSW.mjs.map → chunk-AXBD6OAF.mjs.map} +1 -1
- package/dist/{chunk-ZP37M2QK.mjs → chunk-BWUFLW5W.mjs} +6 -6
- package/dist/{chunk-ZP37M2QK.mjs.map → chunk-BWUFLW5W.mjs.map} +1 -1
- package/dist/{chunk-HBOORO52.js → chunk-CLTNCBSP.js} +4 -4
- package/dist/{chunk-HBOORO52.js.map → chunk-CLTNCBSP.js.map} +1 -1
- package/dist/{chunk-F35GFICG.js → chunk-CRBGZA6Y.js} +13 -13
- package/dist/{chunk-F35GFICG.js.map → chunk-CRBGZA6Y.js.map} +1 -1
- package/dist/{chunk-7JZFNKJD.js → chunk-DQIEVLA3.js} +35 -35
- package/dist/{chunk-7JZFNKJD.js.map → chunk-DQIEVLA3.js.map} +1 -1
- package/dist/{chunk-57E4TCB2.mjs → chunk-EAIE4QGD.mjs} +3 -3
- package/dist/{chunk-57E4TCB2.mjs.map → chunk-EAIE4QGD.mjs.map} +1 -1
- package/dist/{chunk-5W6LMDXV.mjs → chunk-GQWC4EKE.mjs} +4 -4
- package/dist/{chunk-5W6LMDXV.mjs.map → chunk-GQWC4EKE.mjs.map} +1 -1
- package/dist/{chunk-FKUIVS6I.js → chunk-IVKFXPLO.js} +28 -28
- package/dist/{chunk-FKUIVS6I.js.map → chunk-IVKFXPLO.js.map} +1 -1
- package/dist/{chunk-FNA66TT4.js → chunk-MT66VKLS.js} +163 -219
- package/dist/chunk-MT66VKLS.js.map +1 -0
- package/dist/{chunk-74BU2EBZ.mjs → chunk-OEZ7GAJY.mjs} +6 -6
- package/dist/{chunk-74BU2EBZ.mjs.map → chunk-OEZ7GAJY.mjs.map} +1 -1
- package/dist/{chunk-CZZOCKEA.mjs → chunk-OVQ4MKCV.mjs} +3 -3
- package/dist/{chunk-CZZOCKEA.mjs.map → chunk-OVQ4MKCV.mjs.map} +1 -1
- package/dist/{chunk-WDBVIU7W.mjs → chunk-PD3JLDA5.mjs} +3 -3
- package/dist/{chunk-WDBVIU7W.mjs.map → chunk-PD3JLDA5.mjs.map} +1 -1
- package/dist/{chunk-TJPPZU77.js → chunk-R6GEJBFC.js} +34 -34
- package/dist/{chunk-TJPPZU77.js.map → chunk-R6GEJBFC.js.map} +1 -1
- package/dist/{chunk-Q4QORAMH.js → chunk-RFUSH7WD.js} +10 -10
- package/dist/{chunk-Q4QORAMH.js.map → chunk-RFUSH7WD.js.map} +1 -1
- package/dist/{chunk-VS6PTRQ7.mjs → chunk-SJ6SUS7H.mjs} +3 -3
- package/dist/{chunk-VS6PTRQ7.mjs.map → chunk-SJ6SUS7H.mjs.map} +1 -1
- package/dist/{chunk-E57RZXOR.js → chunk-T4IYOKHR.js} +25 -25
- package/dist/{chunk-E57RZXOR.js.map → chunk-T4IYOKHR.js.map} +1 -1
- package/dist/{chunk-3H5CFLVK.js → chunk-U6VFS3RD.js} +135 -135
- package/dist/{chunk-3H5CFLVK.js.map → chunk-U6VFS3RD.js.map} +1 -1
- package/dist/{chunk-RCHTRG7R.js → chunk-UZIICTIY.js} +55 -55
- package/dist/{chunk-RCHTRG7R.js.map → chunk-UZIICTIY.js.map} +1 -1
- package/dist/{chunk-TCP45Q4B.js → chunk-WJENX6KB.js} +9 -9
- package/dist/{chunk-TCP45Q4B.js.map → chunk-WJENX6KB.js.map} +1 -1
- package/dist/{chunk-PYNXIDG3.mjs → chunk-WS3IJFPW.mjs} +3 -3
- package/dist/{chunk-PYNXIDG3.mjs.map → chunk-WS3IJFPW.mjs.map} +1 -1
- package/dist/{chunk-Q7HRCCFT.js → chunk-ZDXEGSCF.js} +45 -45
- package/dist/{chunk-Q7HRCCFT.js.map → chunk-ZDXEGSCF.js.map} +1 -1
- package/dist/{chunk-PCUINUIC.mjs → chunk-ZQEMKEEH.mjs} +3 -3
- package/dist/{chunk-PCUINUIC.mjs.map → chunk-ZQEMKEEH.mjs.map} +1 -1
- package/dist/{chunk-E6C7MFHJ.mjs → chunk-ZQRUAXGP.mjs} +164 -218
- package/dist/chunk-ZQRUAXGP.mjs.map +1 -0
- package/dist/index.d.mts +43 -42
- package/dist/index.d.ts +43 -42
- package/dist/index.js +662 -670
- package/dist/index.mjs +1 -1
- package/dist/platform/admin/index.js +9 -9
- package/dist/platform/admin/index.mjs +3 -3
- package/dist/platform/agents-workspace.js +6 -6
- package/dist/platform/agents-workspace.mjs +5 -5
- package/dist/platform/app-shell.js +3 -3
- package/dist/platform/app-shell.mjs +2 -2
- package/dist/platform/auth/index.js +21 -21
- package/dist/platform/auth/index.mjs +3 -3
- package/dist/platform/billing/index.js +3 -3
- package/dist/platform/billing/index.mjs +2 -2
- package/dist/platform/impersonation/index.js +3 -3
- package/dist/platform/impersonation/index.mjs +2 -2
- package/dist/platform/index.d.mts +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js +74 -74
- package/dist/platform/index.mjs +17 -17
- package/dist/platform/pages/index.d.mts +93 -4
- package/dist/platform/pages/index.d.ts +93 -4
- package/dist/platform/pages/index.js +1009 -575
- package/dist/platform/pages/index.js.map +1 -1
- package/dist/platform/pages/index.mjs +805 -372
- package/dist/platform/pages/index.mjs.map +1 -1
- package/dist/platform/settings/index.js +6 -6
- package/dist/platform/settings/index.mjs +5 -5
- package/dist/platform/workflow-canvas-shell.js +4 -4
- package/dist/platform/workflow-canvas-shell.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-E6C7MFHJ.mjs.map +0 -1
- package/dist/chunk-FNA66TT4.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { AdminOrganizationDetail } from './chunk-
|
|
3
|
-
import { UserProfile } from './chunk-
|
|
4
|
-
import { BillingPanel } from './chunk-
|
|
5
|
-
import { useAuth, InlineSpinner, SegmentedControl } from './chunk-
|
|
2
|
+
import { AdminOrganizationDetail } from './chunk-2E7HYTS7.mjs';
|
|
3
|
+
import { UserProfile } from './chunk-WS3IJFPW.mjs';
|
|
4
|
+
import { BillingPanel } from './chunk-PD3JLDA5.mjs';
|
|
5
|
+
import { useAuth, InlineSpinner, SegmentedControl } from './chunk-ZQRUAXGP.mjs';
|
|
6
6
|
import { useTranslations } from './chunk-7VJ7CMMT.mjs';
|
|
7
7
|
import { useMemo, useState, useEffect } from 'react';
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -94,5 +94,5 @@ function PlatformSettings({
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export { PlatformSettings };
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-OEZ7GAJY.mjs.map
|
|
98
|
+
//# sourceMappingURL=chunk-OEZ7GAJY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/platform/settings/platform-settings.tsx"],"names":[],"mappings":";;;;;;;;AA+CA,IAAM,gBAAA,GAA8C,CAAC,SAAA,EAAW,cAAA,EAAgB,SAAS,CAAA;AAElF,SAAS,gBAAA,CAAiB;AAAA,EAC/B,QAAA,GAAW,gBAAA;AAAA,EACX,cAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,CAAA,GAAI,gBAAgB,UAAU,CAAA;AACpC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,OAAA,EAAQ;AAE3B,EAAA,MAAM,eAAA,GAAkB,QAAQ,MAAM;AAEpC,IAAA,OAAO,QAAA,CAAS,MAAA,CAAO,CAAC,OAAA,KAAY;AAClC,MAAA,IAAI,YAAY,cAAA,EAAgB;AAC9B,QAAA,OAAO,OAAA,CAAQ,eAAe,cAAc,CAAA;AAAA,MAC9C;AACA,MAAA,OAAO,IAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,QAAA,EAAU,WAAA,EAAa,cAAc,CAAC,CAAA;AAE1C,EAAA,MAAM,cAAA,GACJ,kBAAkB,eAAA,CAAgB,QAAA,CAAS,cAAc,CAAA,GACrD,cAAA,GACA,eAAA,CAAgB,CAAC,CAAA,IAAK,SAAA;AAG5B,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,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ChC,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,QAAA,GAAW,eAAA,CAAgB,GAAA,CAAI,CAAC,OAAA,MAAa;AAAA,IACjD,KAAA,EAAO,OAAA;AAAA,IACP,KAAA,EAAO,CAAA,CAAE,CAAA,0BAAA,EAA6B,OAAO,CAAA,CAAE;AAAA,GACjD,CAAE,CAAA;AAEF,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,WAAA,EACZ,QAAA,EAAA;AAAA,IAAA,eAAA,CAAgB,SAAS,CAAA,oBACxB,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,QAAA;AAAA,QACA,KAAA,EAAO,aAAA;AAAA,QACP,QAAA,EAAU,CAAC,KAAA,KAAkB,gBAAA,CAAiB,KAAgC,CAAA;AAAA,QAC9E,SAAA,EAAS;AAAA;AAAA,KACX;AAAA,IAGD,aAAA,KAAkB,SAAA,oBAAa,GAAA,CAAC,WAAA,EAAA,EAAY,CAAA;AAAA,IAE5C,aAAA,KAAkB,cAAA,IAAkB,WAAA,IAAe,cAAA,KAClD,YAAA,mBACE,GAAA;AAAA,MAAC,uBAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAQ,WAAA;AAAA,QACR;AAAA;AAAA,QAEA,YAAA,mBACF,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,OAAA;AAAA,QACL,SAAA,EAAU,6IAAA;AAAA,QAET,QAAA,EAAA;AAAA;AAAA,wBAGH,GAAA,CAAC,KAAA,EAAA,EAAI,WAAU,wCAAA,EACb,QAAA,kBAAA,GAAA,CAAC,iBAAc,CAAA,EACjB,CAAA,CAAA;AAAA,IAIH,aAAA,KAAkB,SAAA,oBAAa,GAAA,CAAC,YAAA,EAAA,EAAc,GAAG,OAAA,EAAS;AAAA,GAAA,EAC7D,CAAA;AAEJ","file":"chunk-OEZ7GAJY.mjs","sourcesContent":["// =============================================================================\n// @datatechsolutions/windsock/ui — PlatformSettings\n// Unified settings shell consumed by every product (astrlabe, kori).\n// Composes existing building blocks:\n// - `<UserProfile>` — Profile / Security / Sessions / Linked accounts\n// - `<AdminOrganizationDetail>` — Members / Invitations / Domains\n// - `<BillingPanel>` — Current subscription + plan catalogue\n// Apps mount this at their `/settings` route; feature toggles hide sections\n// that a given user's role cannot access.\n// =============================================================================\n\nimport { useEffect, useMemo, useState } from 'react'\nimport { useTranslations } from '@ui/lib/i18n-context'\nimport { SegmentedControl, InlineSpinner } from '@ui/index'\nimport type { AdminClient, AuthOrganization } from '@datatechsolutions/shared-domain'\n\nimport { useAuth } from '../../_auth'\nimport { UserProfile } from '../auth/user-profile'\nimport { AdminOrganizationDetail } from '../admin/admin-organization-detail'\nimport { BillingPanel, type BillingPanelProps } from '../billing/billing-panel'\n\nexport type PlatformSettingsSection = 'account' | 'organization' | 'billing'\n\nexport interface PlatformSettingsProps {\n /**\n * Sections to surface to the current user. The host app is responsible for\n * picking the right set based on RBAC — e.g. hide `organization` for users\n * without `org:manage` and hide `billing` for users without `billing:read`.\n * Defaults to all three.\n */\n sections?: PlatformSettingsSection[]\n /** Starting section. Defaults to the first item in `sections`. */\n defaultSection?: PlatformSettingsSection\n /**\n * Windsock admin API client. Required when `organization` is in `sections`.\n * Create it once with `createAdminClient({ issuer, authClient })` and reuse.\n */\n adminClient?: AdminClient\n /**\n * Current organization id (usually `ctx.organizationId` from the JWT).\n * Required when `organization` is in `sections`.\n */\n organizationId?: string\n /** Forwarded to `<BillingPanel>` — e.g. redirect handler, billing interval. */\n billing?: BillingPanelProps\n}\n\nconst DEFAULT_SECTIONS: PlatformSettingsSection[] = ['account', 'organization', 'billing']\n\nexport function PlatformSettings({\n sections = DEFAULT_SECTIONS,\n defaultSection,\n adminClient,\n organizationId,\n billing,\n}: PlatformSettingsProps) {\n const t = useTranslations('windsock')\n const { status } = useAuth()\n\n const visibleSections = useMemo(() => {\n // Drop `organization` if the caller didn't pass an admin client + org id.\n return sections.filter((section) => {\n if (section === 'organization') {\n return Boolean(adminClient && organizationId)\n }\n return true\n })\n }, [sections, adminClient, organizationId])\n\n const initialSection: PlatformSettingsSection = (\n defaultSection && visibleSections.includes(defaultSection)\n ? defaultSection\n : visibleSections[0] ?? 'account'\n )\n\n const [activeSection, setActiveSection] = useState<PlatformSettingsSection>(initialSection)\n const [organization, setOrganization] = useState<AuthOrganization | null>(null)\n const [orgLoadError, setOrgLoadError] = useState<string | null>(null)\n\n // Resolve the org detail record (AdminOrganizationDetail needs the full\n // AuthOrganization, not just the id). Fires once the organization tab is\n // first selected so the listOrganizations round-trip is lazy.\n useEffect(() => {\n if (activeSection !== 'organization') return\n if (!adminClient || !organizationId) return\n if (organization?.id === organizationId) return\n\n let cancelled = false\n setOrgLoadError(null)\n void adminClient.listOrganizations()\n .then((orgs) => {\n if (cancelled) return\n const match = orgs.find((org) => org.id === organizationId)\n if (match) {\n setOrganization(match)\n } else {\n setOrgLoadError('Organization not found')\n }\n })\n .catch((loadError: unknown) => {\n if (cancelled) return\n setOrgLoadError(loadError instanceof Error ? loadError.message : String(loadError))\n })\n return () => {\n cancelled = true\n }\n }, [activeSection, adminClient, organizationId, organization?.id])\n\n if (status === 'loading') {\n return (\n <div className=\"flex items-center justify-center py-12\">\n <InlineSpinner />\n </div>\n )\n }\n\n if (status !== 'authenticated') {\n return null\n }\n\n if (visibleSections.length === 0) {\n return null\n }\n\n const segments = visibleSections.map((section) => ({\n value: section,\n label: t(`platformSettings.sections.${section}`),\n }))\n\n return (\n <div className=\"space-y-6\">\n {visibleSections.length > 1 && (\n <SegmentedControl\n segments={segments}\n value={activeSection}\n onChange={(value: string) => setActiveSection(value as PlatformSettingsSection)}\n fullWidth\n />\n )}\n\n {activeSection === 'account' && <UserProfile />}\n\n {activeSection === 'organization' && adminClient && organizationId && (\n organization ? (\n <AdminOrganizationDetail\n client={adminClient}\n organization={organization}\n />\n ) : orgLoadError ? (\n <div\n role=\"alert\"\n className=\"rounded-xl border border-red-300/40 bg-red-50/80 px-4 py-3 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300\"\n >\n {orgLoadError}\n </div>\n ) : (\n <div className=\"flex items-center justify-center py-12\">\n <InlineSpinner />\n </div>\n )\n )}\n\n {activeSection === 'billing' && <BillingPanel {...billing} />}\n </div>\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAuth, usePlatformPreferences, useNotifications, PlatformShell, LOCALE_FLAGS } from './chunk-
|
|
2
|
+
import { useAuth, usePlatformPreferences, useNotifications, PlatformShell, LOCALE_FLAGS } from './chunk-ZQRUAXGP.mjs';
|
|
3
3
|
import { useTranslations, useLocale } from './chunk-7VJ7CMMT.mjs';
|
|
4
4
|
import { usePathname, useRouter } from './chunk-QWG2FMUN.mjs';
|
|
5
5
|
import { createContext, useMemo, useContext, useCallback } from 'react';
|
|
@@ -125,5 +125,5 @@ function PlatformAppShell({
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
export { PlatformAppShell, PlatformStateProvider, usePlatformState };
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-OVQ4MKCV.mjs.map
|
|
129
|
+
//# sourceMappingURL=chunk-OVQ4MKCV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/platform/platform-state-provider.tsx","../src/platform/app-shell.tsx"],"names":["useMemo","jsx"],"mappings":";;;;;;;;AAQA,IAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AAa9D,SAAS,qBAAA,CAAsB,EAAE,QAAA,EAAU,aAAA,EAAc,EAA+B;AAC7F,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,OAAA,EAAQ;AAEzB,EAAA,MAAM,KAAA,GAAQ,QAAuB,MAAM;AACzC,IAAA,MAAM,cAAA,GAAiB,MAAM,cAAA,IAAkB,EAAA;AAE/C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,WAAW,CAAA;AAAA,QAClF,QAAA,EAAU,QAAQ,UAAU,CAAA;AAAA,QAC5B,aAAA,EAAe,YAAY,UAAA,IAAc,aAAA;AAAA,QACzC,UAAA,EAAY,YAAY,aAAa,CAAA;AAAA,QACrC,OAAA,EAAS,QAAQ,SAAS;AAAA,OAC5B;AAAA,MACC,GAAI,aAAA,GAAgB,EAAE,aAAA,EAAe,aAAA,KAAkB,EAAC;AAAA,MAExD;AAAA;AAAA,GACH;AAEJ","file":"chunk-CZZOCKEA.mjs","sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport { useAuth, type AuthUser } from '../_auth'\n\ntype PlatformState = {\n currentOrganizationId: string\n actor: AuthUser | null\n}\n\nconst PlatformStateContext = createContext<PlatformState | null>(null)\n\nexport type PlatformStateProviderProps = {\n children: ReactNode\n /**\n * Function that converts a JWT role claim to the app's canonical role\n * union (the same `normalizePlatformRole` produced by\n * `createPlatformRbac()` in this app). Lifted out as a prop because\n * each consuming app uses its own role enum.\n */\n normalizeRole: (input: unknown) => string\n}\n\nexport function PlatformStateProvider({ children, normalizeRole }: PlatformStateProviderProps) {\n const { user } = useAuth()\n\n const state = useMemo<PlatformState>(() => {\n const organizationId = user?.organizationId ?? ''\n\n const actor: AuthUser | null = user\n ? {\n ...user,\n role: normalizeRole(user.role),\n organizationId,\n }\n : null\n\n return {\n currentOrganizationId: organizationId,\n actor,\n }\n }, [user, normalizeRole])\n\n return (\n <PlatformStateContext.Provider value={state}>\n {children}\n </PlatformStateContext.Provider>\n )\n}\n\nexport function usePlatformState() {\n const context = useContext(PlatformStateContext)\n if (!context) throw new Error('usePlatformState must be used inside PlatformStateProvider')\n return context\n}\n","import { useCallback, useMemo, type ComponentType, type ReactNode } from 'react'\nimport { RectangleStackIcon, HomeIcon } from '@heroicons/react/24/outline'\nimport { useAuth, usePlatformPreferences } from '../_auth'\nimport { LANGUAGE_META } from '@datatechsolutions/shared-domain/i18n'\nimport {\n PlatformShell,\n type NavigationItem,\n} from '@ui/index'\nimport { useNotifications } from '@ui/components/notifications'\nimport { useLocale, useTranslations } from '@ui/lib/i18n-context'\nimport { usePathname, useRouter } from '@ui/lib/router-context'\nimport { LOCALE_FLAGS } from '@ui/lib/locale-flags'\nimport { usePlatformState } from './platform-state-provider'\n\nfunction resolveFlag(locale: string): string | undefined {\n const code = locale === 'pt-BR' ? 'br' : locale\n return LOCALE_FLAGS?.[code as keyof typeof LOCALE_FLAGS]\n}\n\nexport type PlatformAppShellProps = {\n /** App display name (e.g. \"Astrlabe\"). */\n appName: string\n /** Tailwind gradient classes for the shell branding (e.g. \"from-sky-500 to-indigo-600\"). */\n appGradient: string\n /** Branded logo node rendered inside the flyout trigger. */\n appLogo: ReactNode\n /**\n * Optional app icon for the branded loader (defaults to the platform's\n * RectangleStackIcon if omitted).\n */\n appIcon?: ReactNode\n /**\n * When the appIcon is a brand SVG that has its own background\n * (gradient, fill, etc), set this to true so the BrandedLoader\n * doesn't wrap it in a second gradient container.\n */\n appIconRaw?: boolean\n /**\n * Optional override for the dock dashboard icon (defaults to HomeIcon).\n */\n dashboardIcon?: ComponentType<{ className?: string }>\n\n /** App-specific navigation items already pre-translated. */\n navigationItems: NavigationItem[]\n /** Custom ordering of launchpad page tiles. */\n pageOrder: string[]\n /**\n * Map of navigation/module ID → required permission name. The shell\n * filters `navigationItems` so that any item whose ID has an entry here\n * is hidden unless `hasPermission` returns true for the listed permission.\n */\n modulePermissions: Record<string, string>\n /**\n * Permission predicate, typically `(p) => can(actor, p)` from each app's\n * `createPlatformRbac()` factory.\n */\n hasPermission: (permission: string) => boolean\n\n /**\n * Optional settings/profile drawer content (e.g. an app-specific\n * `<SettingsModal>`). Receives the open state + close handler the shell\n * manages internally so the drawer renders inside the shell chrome.\n */\n settingsModal?: (props: { open: boolean; onClose: () => void }) => ReactNode\n\n children: ReactNode\n}\n\n/**\n * Cross-app platform shell — wires `<PlatformShell>` from ui to windsock's\n * auth + preferences hooks and to ui's i18n/router contexts. Each app\n * passes its own logo, gradient, navigation, and permission predicate; the\n * rest of the chrome (header, dock, flyout, sign-out confirm modal) is\n * shared.\n */\nexport function PlatformAppShell({\n appName,\n appGradient,\n appLogo,\n appIcon,\n appIconRaw,\n dashboardIcon,\n navigationItems,\n pageOrder,\n modulePermissions,\n hasPermission,\n settingsModal,\n children,\n}: PlatformAppShellProps) {\n const tCommon = useTranslations('common')\n const { user, status, logout } = useAuth()\n // Validate the platform-state provider is mounted above this shell;\n // the actor itself isn't read here, but the same provider feeds children.\n usePlatformState()\n const { resolvedTheme, setTheme, dockPosition, dockAutoHide, dockEnabled } = usePlatformPreferences()\n const pathname = usePathname()\n const router = useRouter()\n const { history, openHistory } = useNotifications()\n const currentLocale = useLocale()\n const localeMeta = LANGUAGE_META[currentLocale as keyof typeof LANGUAGE_META]\n\n const items = useMemo(() => navigationItems.filter((item) => {\n const permission = modulePermissions[item.id]\n if (!permission) return true\n return hasPermission(permission)\n }), [navigationItems, modulePermissions, hasPermission])\n\n const handleSignOut = useCallback(() => { void logout('/login') }, [logout])\n const handleToggleTheme = useCallback(\n () => { setTheme(resolvedTheme === 'dark' ? 'light' : 'dark') },\n [resolvedTheme, setTheme],\n )\n const handleNavigate = useCallback((href: string) => router.push(href), [router])\n const handlePrefetch = useCallback((href: string) => router.prefetch(href), [router])\n\n const shellUser = user\n ? {\n name: user.name ?? null,\n email: user.email ?? null,\n image: user.image ?? null,\n role: user.role ?? null,\n permissions: user.permissions as string[] | undefined,\n organizationId: user.organizationId ?? null,\n }\n : null\n\n return (\n <PlatformShell\n items={items}\n launchpadPageOrder={pageOrder}\n user={shellUser}\n authStatus={status}\n onSignOut={handleSignOut}\n dockPosition={dockPosition}\n dockAutoHide={dockAutoHide}\n dockEnabled={dockEnabled}\n resolvedTheme={resolvedTheme}\n onToggleTheme={handleToggleTheme}\n pathname={pathname}\n onNavigate={handleNavigate}\n onPrefetch={handlePrefetch}\n appName={appName}\n appIcon={appIcon ?? <RectangleStackIcon className=\"h-full w-full\" />}\n appIconRaw={appIconRaw}\n appLogo={appLogo}\n appGradient={appGradient}\n dashboardIcon={dashboardIcon ?? HomeIcon}\n notificationCount={history.length}\n onNotifications={openHistory}\n labels={{\n home: tCommon('home'),\n profile: tCommon('profile'),\n signOut: tCommon('signOut'),\n signOutConfirmTitle: tCommon('signOutConfirmTitle'),\n cancel: tCommon('cancel'),\n notifications: tCommon('notifications'),\n theme: tCommon('theme'),\n currentTheme: resolvedTheme === 'dark' ? tCommon('darkMode') : tCommon('lightMode'),\n language: tCommon('language'),\n currentLocale: localeMeta?.nativeName ?? currentLocale,\n localeFlag: resolveFlag(currentLocale),\n actions: tCommon('actions'),\n }}\n {...(settingsModal ? { profileDrawer: settingsModal } : {})}\n >\n {children}\n </PlatformShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/platform/platform-state-provider.tsx","../src/platform/app-shell.tsx"],"names":["useMemo","jsx"],"mappings":";;;;;;;;AAQA,IAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AAa9D,SAAS,qBAAA,CAAsB,EAAE,QAAA,EAAU,aAAA,EAAc,EAA+B;AAC7F,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,OAAA,EAAQ;AAEzB,EAAA,MAAM,KAAA,GAAQ,QAAuB,MAAM;AACzC,IAAA,MAAM,cAAA,GAAiB,MAAM,cAAA,IAAkB,EAAA;AAE/C,IAAA,MAAM,QAAyB,IAAA,GAC3B;AAAA,MACA,GAAG,IAAA;AAAA,MACH,IAAA,EAAM,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AAAA,MAC7B;AAAA,KACF,GACE,IAAA;AAEJ,IAAA,OAAO;AAAA,MACL,qBAAA,EAAuB,cAAA;AAAA,MACvB;AAAA,KACF;AAAA,EACF,CAAA,EAAG,CAAC,IAAA,EAAM,aAAa,CAAC,CAAA;AAExB,EAAA,2BACG,oBAAA,CAAqB,QAAA,EAArB,EAA8B,KAAA,EAAO,OACnC,QAAA,EACH,CAAA;AA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import { useAuth, type AuthUser } from '../_auth'\n\ntype PlatformState = {\n currentOrganizationId: string\n actor: AuthUser | null\n}\n\nconst PlatformStateContext = createContext<PlatformState | null>(null)\n\nexport type PlatformStateProviderProps = {\n children: ReactNode\n /**\n * Function that converts a JWT role claim to the app's canonical role\n * union (the same `normalizePlatformRole` produced by\n * `createPlatformRbac()` in this app). Lifted out as a prop because\n * each consuming app uses its own role enum.\n */\n normalizeRole: (input: unknown) => string\n}\n\nexport function PlatformStateProvider({ children, normalizeRole }: PlatformStateProviderProps) {\n const { user } = useAuth()\n\n const state = useMemo<PlatformState>(() => {\n const organizationId = user?.organizationId ?? ''\n\n const actor: AuthUser | null = user\n ? {\n ...user,\n role: normalizeRole(user.role),\n organizationId,\n }\n : null\n\n return {\n currentOrganizationId: organizationId,\n actor,\n }\n }, [user, normalizeRole])\n\n return (\n <PlatformStateContext.Provider value={state}>\n {children}\n </PlatformStateContext.Provider>\n )\n}\n\nexport function usePlatformState() {\n const context = useContext(PlatformStateContext)\n if (!context) throw new Error('usePlatformState must be used inside PlatformStateProvider')\n return context\n}\n","import { useCallback, useMemo, type ComponentType, type ReactNode } from 'react'\nimport { RectangleStackIcon, HomeIcon } from '@heroicons/react/24/outline'\nimport { useAuth, usePlatformPreferences } from '../_auth'\nimport { LANGUAGE_META } from '@datatechsolutions/shared-domain/i18n'\nimport {\n PlatformShell,\n type NavigationItem,\n} from '@ui/index'\nimport { useNotifications } from '@ui/components/notifications'\nimport { useLocale, useTranslations } from '@ui/lib/i18n-context'\nimport { usePathname, useRouter } from '@ui/lib/router-context'\nimport { LOCALE_FLAGS } from '@ui/lib/locale-flags'\nimport { usePlatformState } from './platform-state-provider'\n\nfunction resolveFlag(locale: string): string | undefined {\n const code = locale === 'pt-BR' ? 'br' : locale\n return LOCALE_FLAGS?.[code as keyof typeof LOCALE_FLAGS]\n}\n\nexport type PlatformAppShellProps = {\n /** App display name (e.g. \"Astrlabe\"). */\n appName: string\n /** Tailwind gradient classes for the shell branding (e.g. \"from-sky-500 to-indigo-600\"). */\n appGradient: string\n /** Branded logo node rendered inside the flyout trigger. */\n appLogo: ReactNode\n /**\n * Optional app icon for the branded loader (defaults to the platform's\n * RectangleStackIcon if omitted).\n */\n appIcon?: ReactNode\n /**\n * When the appIcon is a brand SVG that has its own background\n * (gradient, fill, etc), set this to true so the BrandedLoader\n * doesn't wrap it in a second gradient container.\n */\n appIconRaw?: boolean\n /**\n * Optional override for the dock dashboard icon (defaults to HomeIcon).\n */\n dashboardIcon?: ComponentType<{ className?: string }>\n\n /** App-specific navigation items already pre-translated. */\n navigationItems: NavigationItem[]\n /** Custom ordering of launchpad page tiles. */\n pageOrder: string[]\n /**\n * Map of navigation/module ID → required permission name. The shell\n * filters `navigationItems` so that any item whose ID has an entry here\n * is hidden unless `hasPermission` returns true for the listed permission.\n */\n modulePermissions: Record<string, string>\n /**\n * Permission predicate, typically `(p) => can(actor, p)` from each app's\n * `createPlatformRbac()` factory.\n */\n hasPermission: (permission: string) => boolean\n\n /**\n * Optional settings/profile drawer content (e.g. an app-specific\n * `<SettingsModal>`). Receives the open state + close handler the shell\n * manages internally so the drawer renders inside the shell chrome.\n */\n settingsModal?: (props: { open: boolean; onClose: () => void }) => ReactNode\n\n children: ReactNode\n}\n\n/**\n * Cross-app platform shell — wires `<PlatformShell>` from ui to windsock's\n * auth + preferences hooks and to ui's i18n/router contexts. Each app\n * passes its own logo, gradient, navigation, and permission predicate; the\n * rest of the chrome (header, dock, flyout, sign-out confirm modal) is\n * shared.\n */\nexport function PlatformAppShell({\n appName,\n appGradient,\n appLogo,\n appIcon,\n appIconRaw,\n dashboardIcon,\n navigationItems,\n pageOrder,\n modulePermissions,\n hasPermission,\n settingsModal,\n children,\n}: PlatformAppShellProps) {\n const tCommon = useTranslations('common')\n const { user, status, logout } = useAuth()\n // Validate the platform-state provider is mounted above this shell;\n // the actor itself isn't read here, but the same provider feeds children.\n usePlatformState()\n const { resolvedTheme, setTheme, dockPosition, dockAutoHide, dockEnabled } = usePlatformPreferences()\n const pathname = usePathname()\n const router = useRouter()\n const { history, openHistory } = useNotifications()\n const currentLocale = useLocale()\n const localeMeta = LANGUAGE_META[currentLocale as keyof typeof LANGUAGE_META]\n\n const items = useMemo(() => navigationItems.filter((item) => {\n const permission = modulePermissions[item.id]\n if (!permission) return true\n return hasPermission(permission)\n }), [navigationItems, modulePermissions, hasPermission])\n\n const handleSignOut = useCallback(() => { void logout('/login') }, [logout])\n const handleToggleTheme = useCallback(\n () => { setTheme(resolvedTheme === 'dark' ? 'light' : 'dark') },\n [resolvedTheme, setTheme],\n )\n const handleNavigate = useCallback((href: string) => router.push(href), [router])\n const handlePrefetch = useCallback((href: string) => router.prefetch(href), [router])\n\n const shellUser = user\n ? {\n name: user.name ?? null,\n email: user.email ?? null,\n image: user.image ?? null,\n role: user.role ?? null,\n permissions: user.permissions as string[] | undefined,\n organizationId: user.organizationId ?? null,\n }\n : null\n\n return (\n <PlatformShell\n items={items}\n launchpadPageOrder={pageOrder}\n user={shellUser}\n authStatus={status}\n onSignOut={handleSignOut}\n dockPosition={dockPosition}\n dockAutoHide={dockAutoHide}\n dockEnabled={dockEnabled}\n resolvedTheme={resolvedTheme}\n onToggleTheme={handleToggleTheme}\n pathname={pathname}\n onNavigate={handleNavigate}\n onPrefetch={handlePrefetch}\n appName={appName}\n appIcon={appIcon ?? <RectangleStackIcon className=\"h-full w-full\" />}\n appIconRaw={appIconRaw}\n appLogo={appLogo}\n appGradient={appGradient}\n dashboardIcon={dashboardIcon ?? HomeIcon}\n notificationCount={history.length}\n onNotifications={openHistory}\n labels={{\n home: tCommon('home'),\n profile: tCommon('profile'),\n signOut: tCommon('signOut'),\n signOutConfirmTitle: tCommon('signOutConfirmTitle'),\n cancel: tCommon('cancel'),\n notifications: tCommon('notifications'),\n theme: tCommon('theme'),\n currentTheme: resolvedTheme === 'dark' ? tCommon('darkMode') : tCommon('lightMode'),\n language: tCommon('language'),\n currentLocale: localeMeta?.nativeName ?? currentLocale,\n localeFlag: resolveFlag(currentLocale),\n actions: tCommon('actions'),\n }}\n {...(settingsModal ? { profileDrawer: settingsModal } : {})}\n >\n {children}\n </PlatformShell>\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAuth, InlineSpinner, SectionCard, StatusBadge, ListCard, ListCardItem } from './chunk-
|
|
2
|
+
import { useAuth, InlineSpinner, SectionCard, StatusBadge, ListCard, ListCardItem } from './chunk-ZQRUAXGP.mjs';
|
|
3
3
|
import { useTranslations, useFormatter } from './chunk-7VJ7CMMT.mjs';
|
|
4
4
|
import { Badge, Button } from './chunk-WR55H7DH.mjs';
|
|
5
5
|
import { triggerHaptic } from './chunk-D2JF6C3E.mjs';
|
|
@@ -235,5 +235,5 @@ function BillingPanel({
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
export { BillingPanel };
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
239
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-PD3JLDA5.mjs.map
|
|
239
|
+
//# sourceMappingURL=chunk-PD3JLDA5.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/platform/billing/billing-panel.tsx"],"names":[],"mappings":";;;;;;;AAyCA,IAAM,UAAA,GAA+C;AAAA,EACnD,UAAA,EAAY,CAAA;AAAA,EACZ,OAAA,EAAS,CAAA;AAAA,EACT,YAAA,EAAc,CAAA;AAAA,EACd,UAAA,EAAY;AACd,CAAA;AAEO,SAAS,YAAA,CAAa;AAAA,EAC3B,sBAAA,GAAyB,SAAA;AAAA,EACzB;AACF,CAAA,EAAsB;AACpB,EAAA,MAAM,CAAA,GAAI,gBAAgB,UAAU,CAAA;AACpC,EAAA,MAAM,SAAS,YAAA,EAAa;AAC5B,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,OAAA,EAAQ;AAE3B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GA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A,CAAK,IAAI,CAAA,CAAA;AAAA,kBAC7C,UAAU,UAAA,KAAe,IAAA;AAAA,kBAExB,YAAE,4BAA4B;AAAA;AAAA,eACjC;AAAA,cAKN,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,qBAAA,EACb,QAAA,EAAA;AAAA,gCAAA,IAAA,CAAC,KAAA,EAAA,EAAI,WAAU,yBAAA,EACb,QAAA,EAAA;AAAA,kCAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,mDAAA,EACV,QAAA,EAAA,IAAA,CAAK,IAAA,EACR,CAAA;AAAA,kCACA,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,0CAAA,EACb,QAAA,EAAA;AAAA,oBAAA,MAAA,CAAO,MAAA,CAAO,KAAK,KAAA,EAAO,EAAE,OAAO,UAAA,EAAY,QAAA,EAAU,IAAA,CAAK,QAAA,EAAU,CAAA;AAAA,oBACxE,GAAA;AAAA,oBAAI,GAAA;AAAA,oBAAE,GAAA;AAAA,oBACN,CAAA,CAAE,CAAA,iBAAA,EAAoB,IAAA,CAAK,QAAQ,CAAA,CAAE;AAAA,mBAAA,EACxC;AAAA,iBAAA,EACF,CAAA;AAAA,gBACC,KAAK,WAAA,oBACJ,GAAA,CAAC,OAAE,SAAA,EAAU,0CAAA,EACV,eAAK,WAAA,EACR;AAAA,eAAA,EAEJ;AAAA,aAAA;AAAA,YAlDK,IAAA,CAAK;AAAA,WAmDZ;AAAA,QAEJ,CAAC,CAAA,EACH;AAAA;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ","file":"chunk-WDBVIU7W.mjs","sourcesContent":["// =============================================================================\n// @datatechsolutions/windsock/ui — BillingPanel\n// Shows the current organization subscription plus the plan catalogue, with\n// actions for opening the Stripe portal, starting checkout, or cancelling.\n// Backed by `AuthClient.getSubscription / getPlans / createPortalSession /\n// createCheckoutSession / cancelSubscription`.\n// =============================================================================\n\nimport { useEffect, useState, useCallback } from 'react'\nimport { useTranslations, useFormatter } from '@ui/lib/i18n-context'\nimport {\n SectionCard,\n Button,\n Badge,\n StatusBadge,\n InlineSpinner,\n ListCard,\n ListCardItem,\n triggerHaptic,\n} from '@ui/index'\nimport type {\n SubscriptionDetails,\n PlanDefinition,\n SubscriptionTier,\n} from '@datatechsolutions/shared-domain'\nimport { useAuth } from '../../_auth'\n\nexport interface BillingPanelProps {\n /**\n * Which billing interval to prefer when starting checkout. Defaults to\n * `'monthly'`. Surface a toggle in the host app if both matter.\n */\n defaultBillingInterval?: 'monthly' | 'yearly'\n /**\n * Called after the portal/checkout URL is resolved. Defaults to\n * `window.location.assign(url)`. Override to open in a new tab, use a\n * router, etc.\n */\n onRedirect?: (url: string) => void\n}\n\nconst TIER_ORDER: Record<SubscriptionTier, number> = {\n free_trial: 0,\n starter: 1,\n professional: 2,\n enterprise: 3,\n}\n\nexport function BillingPanel({\n defaultBillingInterval = 'monthly',\n onRedirect,\n}: BillingPanelProps) {\n const t = useTranslations('windsock')\n const format = useFormatter()\n const { client } = useAuth()\n\n const [subscription, setSubscription] = useState<SubscriptionDetails | null>(null)\n const [plans, setPlans] = useState<PlanDefinition[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n const [busyAction, setBusyAction] = useState<string | null>(null)\n\n const redirect = useCallback((url: string) => {\n if (onRedirect) {\n onRedirect(url)\n } else if (typeof window !== 'undefined') {\n window.location.assign(url)\n }\n }, [onRedirect])\n\n const load = useCallback(async () => {\n setIsLoading(true)\n setError(null)\n try {\n const [sub, availablePlans] = await Promise.all([\n client.getSubscription(),\n client.getPlans(),\n ])\n setSubscription(sub)\n setPlans(\n [...availablePlans]\n .filter((plan: { active: boolean }) => plan.active)\n .sort(\n (a: { tier: SubscriptionTier }, b: { tier: SubscriptionTier }) =>\n (TIER_ORDER[a.tier] ?? 0) - (TIER_ORDER[b.tier] ?? 0),\n ),\n )\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError.message : String(loadError))\n } finally {\n setIsLoading(false)\n }\n }, [client])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const handleOpenPortal = useCallback(async () => {\n setBusyAction('portal')\n triggerHaptic('light')\n try {\n const { url } = await client.createPortalSession()\n redirect(url)\n } catch (portalError) {\n setError(portalError instanceof Error ? portalError.message : String(portalError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, redirect])\n\n const handleStartCheckout = useCallback(async (planCode: string) => {\n setBusyAction(`checkout:${planCode}`)\n triggerHaptic('light')\n try {\n const { url } = await client.createCheckoutSession(planCode, defaultBillingInterval)\n redirect(url)\n } catch (checkoutError) {\n setError(checkoutError instanceof Error ? checkoutError.message : String(checkoutError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, defaultBillingInterval, redirect])\n\n const handleCancel = useCallback(async () => {\n if (typeof window !== 'undefined') {\n const confirmed = window.confirm(t('billing.cancelConfirm'))\n if (!confirmed) return\n }\n setBusyAction('cancel')\n triggerHaptic('warning')\n try {\n const result = await client.cancelSubscription()\n if (!result.success) {\n throw new Error(result.error ?? 'Subscription cancellation failed')\n }\n triggerHaptic('success')\n await load()\n } catch (cancelError) {\n setError(cancelError instanceof Error ? cancelError.message : String(cancelError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, load, t])\n\n if (isLoading) {\n return (\n <div className=\"flex items-center justify-center py-12\">\n <InlineSpinner />\n </div>\n )\n }\n\n const currentPlan = subscription?.plan ?? plans.find((plan) => plan.id === subscription?.planId) ?? null\n const currentTier = subscription?.tier ?? currentPlan?.tier ?? null\n\n return (\n <div className=\"space-y-6\">\n {error && (\n <div\n role=\"alert\"\n className=\"rounded-xl border border-red-300/40 bg-red-50/80 px-4 py-3 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300\"\n >\n {error}\n </div>\n )}\n\n <SectionCard\n header={{\n title: t('billing.currentPlan.title'),\n subtitle: t('billing.currentPlan.description'),\n }}\n >\n {subscription && currentPlan ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <span className=\"text-lg font-semibold text-gray-900 dark:text-white\">\n {currentPlan.name}\n </span>\n <StatusBadge\n status={\n subscription.status === 'active' ? 'success'\n : subscription.status === 'past_due' ? 'pending'\n : 'error'\n }\n label={t(`billing.status.${subscription.status}`)}\n />\n {subscription.cancelAtPeriodEnd && (\n <Badge color=\"amber\">{t('billing.currentPlan.cancelAtPeriodEnd')}</Badge>\n )}\n </div>\n\n <dl className=\"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2\">\n <div>\n <dt className=\"text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.price')}\n </dt>\n <dd className=\"font-medium text-gray-900 dark:text-white\">\n {format.number(currentPlan.price, { style: 'currency', currency: currentPlan.currency })}\n {' '}/{' '}\n {t(`billing.interval.${currentPlan.interval}`)}\n </dd>\n </div>\n {subscription.currentPeriodEnd && (\n <div>\n <dt className=\"text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.renewsOn')}\n </dt>\n <dd className=\"font-medium text-gray-900 dark:text-white\">\n {format.dateTime(new Date(subscription.currentPeriodEnd), { dateStyle: 'medium' })}\n </dd>\n </div>\n )}\n </dl>\n\n <div className=\"flex flex-wrap gap-2 pt-2\">\n <Button\n size=\"sm\"\n color=\"ios-glass-blue\"\n onClick={handleOpenPortal}\n loading={busyAction === 'portal'}\n disabled={busyAction !== null}\n >\n {t('billing.currentPlan.manageInPortal')}\n </Button>\n {subscription.status === 'active' && !subscription.cancelAtPeriodEnd && (\n <Button\n size=\"sm\"\n color=\"ios-glass-red\"\n onClick={handleCancel}\n loading={busyAction === 'cancel'}\n disabled={busyAction !== null}\n >\n {t('billing.currentPlan.cancel')}\n </Button>\n )}\n </div>\n </div>\n ) : (\n <p className=\"text-sm text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.noSubscription')}\n </p>\n )}\n </SectionCard>\n\n <SectionCard\n header={{\n title: t('billing.plans.title'),\n subtitle: t('billing.plans.description'),\n }}\n >\n {plans.length === 0 ? (\n <p className=\"text-sm text-gray-500 dark:text-gray-400\">\n {t('billing.plans.empty')}\n </p>\n ) : (\n <ListCard>\n {plans.map((plan) => {\n const isCurrent = currentPlan?.id === plan.id\n const isDowngrade = currentTier != null\n && (TIER_ORDER[plan.tier] ?? 0) < (TIER_ORDER[currentTier] ?? 0)\n return (\n <ListCardItem\n key={plan.id}\n leading={\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500/20 to-blue-500/20 text-violet-600 dark:text-violet-300\">\n <span className=\"text-sm font-bold uppercase\">{plan.tier.charAt(0)}</span>\n </div>\n }\n trailing={\n isCurrent ? (\n <Badge color=\"green\">{t('billing.plans.currentBadge')}</Badge>\n ) : (\n isDowngrade ? (\n <Button\n size=\"sm\"\n plain\n onClick={() => handleStartCheckout(plan.code)}\n loading={busyAction === `checkout:${plan.code}`}\n disabled={busyAction !== null}\n >\n {t('billing.plans.downgradeAction')}\n </Button>\n ) : (\n <Button\n size=\"sm\"\n color=\"ios-glass-blue\"\n onClick={() => handleStartCheckout(plan.code)}\n loading={busyAction === `checkout:${plan.code}`}\n disabled={busyAction !== null}\n >\n {t('billing.plans.selectAction')}\n </Button>\n )\n )\n }\n >\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"text-sm font-medium text-gray-900 dark:text-white\">\n {plan.name}\n </p>\n <span className=\"text-xs text-gray-500 dark:text-gray-400\">\n {format.number(plan.price, { style: 'currency', currency: plan.currency })}\n {' '}/{' '}\n {t(`billing.interval.${plan.interval}`)}\n </span>\n </div>\n {plan.description && (\n <p className=\"text-xs text-gray-500 dark:text-gray-400\">\n {plan.description}\n </p>\n )}\n </div>\n </ListCardItem>\n )\n })}\n </ListCard>\n )}\n </SectionCard>\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/platform/billing/billing-panel.tsx"],"names":[],"mappings":";;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AA,CAAC,OAAE,SAAA,EAAU,0CAAA,EACV,eAAK,WAAA,EACR;AAAA,eAAA,EAEJ;AAAA,aAAA;AAAA,YAlDK,IAAA,CAAK;AAAA,WAmDZ;AAAA,QAEJ,CAAC,CAAA,EACH;AAAA;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ","file":"chunk-PD3JLDA5.mjs","sourcesContent":["// =============================================================================\n// @datatechsolutions/windsock/ui — BillingPanel\n// Shows the current organization subscription plus the plan catalogue, with\n// actions for opening the Stripe portal, starting checkout, or cancelling.\n// Backed by `AuthClient.getSubscription / getPlans / createPortalSession /\n// createCheckoutSession / cancelSubscription`.\n// =============================================================================\n\nimport { useEffect, useState, useCallback } from 'react'\nimport { useTranslations, useFormatter } from '@ui/lib/i18n-context'\nimport {\n SectionCard,\n Button,\n Badge,\n StatusBadge,\n InlineSpinner,\n ListCard,\n ListCardItem,\n triggerHaptic,\n} from '@ui/index'\nimport type {\n SubscriptionDetails,\n PlanDefinition,\n SubscriptionTier,\n} from '@datatechsolutions/shared-domain'\nimport { useAuth } from '../../_auth'\n\nexport interface BillingPanelProps {\n /**\n * Which billing interval to prefer when starting checkout. Defaults to\n * `'monthly'`. Surface a toggle in the host app if both matter.\n */\n defaultBillingInterval?: 'monthly' | 'yearly'\n /**\n * Called after the portal/checkout URL is resolved. Defaults to\n * `window.location.assign(url)`. Override to open in a new tab, use a\n * router, etc.\n */\n onRedirect?: (url: string) => void\n}\n\nconst TIER_ORDER: Record<SubscriptionTier, number> = {\n free_trial: 0,\n starter: 1,\n professional: 2,\n enterprise: 3,\n}\n\nexport function BillingPanel({\n defaultBillingInterval = 'monthly',\n onRedirect,\n}: BillingPanelProps) {\n const t = useTranslations('windsock')\n const format = useFormatter()\n const { client } = useAuth()\n\n const [subscription, setSubscription] = useState<SubscriptionDetails | null>(null)\n const [plans, setPlans] = useState<PlanDefinition[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n const [busyAction, setBusyAction] = useState<string | null>(null)\n\n const redirect = useCallback((url: string) => {\n if (onRedirect) {\n onRedirect(url)\n } else if (typeof window !== 'undefined') {\n window.location.assign(url)\n }\n }, [onRedirect])\n\n const load = useCallback(async () => {\n setIsLoading(true)\n setError(null)\n try {\n const [sub, availablePlans] = await Promise.all([\n client.getSubscription(),\n client.getPlans(),\n ])\n setSubscription(sub)\n setPlans(\n [...availablePlans]\n .filter((plan: { active: boolean }) => plan.active)\n .sort(\n (a: { tier: SubscriptionTier }, b: { tier: SubscriptionTier }) =>\n (TIER_ORDER[a.tier] ?? 0) - (TIER_ORDER[b.tier] ?? 0),\n ),\n )\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError.message : String(loadError))\n } finally {\n setIsLoading(false)\n }\n }, [client])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const handleOpenPortal = useCallback(async () => {\n setBusyAction('portal')\n triggerHaptic('light')\n try {\n const { url } = await client.createPortalSession()\n redirect(url)\n } catch (portalError) {\n setError(portalError instanceof Error ? portalError.message : String(portalError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, redirect])\n\n const handleStartCheckout = useCallback(async (planCode: string) => {\n setBusyAction(`checkout:${planCode}`)\n triggerHaptic('light')\n try {\n const { url } = await client.createCheckoutSession(planCode, defaultBillingInterval)\n redirect(url)\n } catch (checkoutError) {\n setError(checkoutError instanceof Error ? checkoutError.message : String(checkoutError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, defaultBillingInterval, redirect])\n\n const handleCancel = useCallback(async () => {\n if (typeof window !== 'undefined') {\n const confirmed = window.confirm(t('billing.cancelConfirm'))\n if (!confirmed) return\n }\n setBusyAction('cancel')\n triggerHaptic('warning')\n try {\n const result = await client.cancelSubscription()\n if (!result.success) {\n throw new Error(result.error ?? 'Subscription cancellation failed')\n }\n triggerHaptic('success')\n await load()\n } catch (cancelError) {\n setError(cancelError instanceof Error ? cancelError.message : String(cancelError))\n triggerHaptic('error')\n } finally {\n setBusyAction(null)\n }\n }, [client, load, t])\n\n if (isLoading) {\n return (\n <div className=\"flex items-center justify-center py-12\">\n <InlineSpinner />\n </div>\n )\n }\n\n const currentPlan = subscription?.plan ?? plans.find((plan) => plan.id === subscription?.planId) ?? null\n const currentTier = subscription?.tier ?? currentPlan?.tier ?? null\n\n return (\n <div className=\"space-y-6\">\n {error && (\n <div\n role=\"alert\"\n className=\"rounded-xl border border-red-300/40 bg-red-50/80 px-4 py-3 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300\"\n >\n {error}\n </div>\n )}\n\n <SectionCard\n header={{\n title: t('billing.currentPlan.title'),\n subtitle: t('billing.currentPlan.description'),\n }}\n >\n {subscription && currentPlan ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <span className=\"text-lg font-semibold text-gray-900 dark:text-white\">\n {currentPlan.name}\n </span>\n <StatusBadge\n status={\n subscription.status === 'active' ? 'success'\n : subscription.status === 'past_due' ? 'pending'\n : 'error'\n }\n label={t(`billing.status.${subscription.status}`)}\n />\n {subscription.cancelAtPeriodEnd && (\n <Badge color=\"amber\">{t('billing.currentPlan.cancelAtPeriodEnd')}</Badge>\n )}\n </div>\n\n <dl className=\"grid grid-cols-1 gap-3 text-sm sm:grid-cols-2\">\n <div>\n <dt className=\"text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.price')}\n </dt>\n <dd className=\"font-medium text-gray-900 dark:text-white\">\n {format.number(currentPlan.price, { style: 'currency', currency: currentPlan.currency })}\n {' '}/{' '}\n {t(`billing.interval.${currentPlan.interval}`)}\n </dd>\n </div>\n {subscription.currentPeriodEnd && (\n <div>\n <dt className=\"text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.renewsOn')}\n </dt>\n <dd className=\"font-medium text-gray-900 dark:text-white\">\n {format.dateTime(new Date(subscription.currentPeriodEnd), { dateStyle: 'medium' })}\n </dd>\n </div>\n )}\n </dl>\n\n <div className=\"flex flex-wrap gap-2 pt-2\">\n <Button\n size=\"sm\"\n color=\"ios-glass-blue\"\n onClick={handleOpenPortal}\n loading={busyAction === 'portal'}\n disabled={busyAction !== null}\n >\n {t('billing.currentPlan.manageInPortal')}\n </Button>\n {subscription.status === 'active' && !subscription.cancelAtPeriodEnd && (\n <Button\n size=\"sm\"\n color=\"ios-glass-red\"\n onClick={handleCancel}\n loading={busyAction === 'cancel'}\n disabled={busyAction !== null}\n >\n {t('billing.currentPlan.cancel')}\n </Button>\n )}\n </div>\n </div>\n ) : (\n <p className=\"text-sm text-gray-500 dark:text-gray-400\">\n {t('billing.currentPlan.noSubscription')}\n </p>\n )}\n </SectionCard>\n\n <SectionCard\n header={{\n title: t('billing.plans.title'),\n subtitle: t('billing.plans.description'),\n }}\n >\n {plans.length === 0 ? (\n <p className=\"text-sm text-gray-500 dark:text-gray-400\">\n {t('billing.plans.empty')}\n </p>\n ) : (\n <ListCard>\n {plans.map((plan) => {\n const isCurrent = currentPlan?.id === plan.id\n const isDowngrade = currentTier != null\n && (TIER_ORDER[plan.tier] ?? 0) < (TIER_ORDER[currentTier] ?? 0)\n return (\n <ListCardItem\n key={plan.id}\n leading={\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500/20 to-blue-500/20 text-violet-600 dark:text-violet-300\">\n <span className=\"text-sm font-bold uppercase\">{plan.tier.charAt(0)}</span>\n </div>\n }\n trailing={\n isCurrent ? (\n <Badge color=\"green\">{t('billing.plans.currentBadge')}</Badge>\n ) : (\n isDowngrade ? (\n <Button\n size=\"sm\"\n plain\n onClick={() => handleStartCheckout(plan.code)}\n loading={busyAction === `checkout:${plan.code}`}\n disabled={busyAction !== null}\n >\n {t('billing.plans.downgradeAction')}\n </Button>\n ) : (\n <Button\n size=\"sm\"\n color=\"ios-glass-blue\"\n onClick={() => handleStartCheckout(plan.code)}\n loading={busyAction === `checkout:${plan.code}`}\n disabled={busyAction !== null}\n >\n {t('billing.plans.selectAction')}\n </Button>\n )\n )\n }\n >\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"text-sm font-medium text-gray-900 dark:text-white\">\n {plan.name}\n </p>\n <span className=\"text-xs text-gray-500 dark:text-gray-400\">\n {format.number(plan.price, { style: 'currency', currency: plan.currency })}\n {' '}/{' '}\n {t(`billing.interval.${plan.interval}`)}\n </span>\n </div>\n {plan.description && (\n <p className=\"text-xs text-gray-500 dark:text-gray-400\">\n {plan.description}\n </p>\n )}\n </div>\n </ListCardItem>\n )\n })}\n </ListCard>\n )}\n </SectionCard>\n </div>\n )\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkMT66VKLS_js = require('./chunk-MT66VKLS.js');
|
|
5
5
|
var chunkBHOT22QL_js = require('./chunk-BHOT22QL.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var outline = require('@heroicons/react/24/outline');
|
|
@@ -218,41 +218,41 @@ function ConnectionForm({
|
|
|
218
218
|
switch (dialect.formType) {
|
|
219
219
|
case "standard":
|
|
220
220
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
223
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
225
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "host", label: labels.fieldHost, placeholder: labels.fieldHostPlaceholder, required: true }),
|
|
222
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "port", label: labels.fieldPort, type: "number", defaultValue: dialect.defaultPort }),
|
|
223
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "database", label: labels.fieldDatabase, placeholder: labels.fieldDatabasePlaceholder, required: true }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "username", label: labels.fieldUsername, placeholder: labels.fieldUsernamePlaceholder }),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "password", label: labels.fieldPassword, type: "password", placeholder: labels.fieldPasswordPlaceholder }),
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "schema", label: labels.fieldSchema, placeholder: labels.fieldSchemaPlaceholder })
|
|
227
227
|
] });
|
|
228
228
|
case "connection-string":
|
|
229
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "connectionString", label: labels.fieldConnectionString, placeholder: labels.fieldConnectionStringPlaceholder, required: true }) });
|
|
230
230
|
case "cloud-bigquery":
|
|
231
231
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
232
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
233
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
234
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "projectId", label: labels.fieldProjectId, placeholder: labels.fieldProjectIdPlaceholder, required: true }),
|
|
233
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "dataset", label: labels.fieldDataset, placeholder: labels.fieldDatasetPlaceholder, required: true }),
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "keyFile", label: labels.fieldKeyFile, placeholder: labels.fieldKeyFilePlaceholder }) })
|
|
235
235
|
] });
|
|
236
236
|
case "cloud-snowflake":
|
|
237
237
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
238
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
239
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
242
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "account", label: labels.fieldAccount, placeholder: labels.fieldAccountPlaceholder, required: true }),
|
|
239
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "warehouse", label: labels.fieldWarehouse, placeholder: labels.fieldWarehousePlaceholder, required: true }),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "database", label: labels.fieldDatabase, placeholder: labels.fieldDatabasePlaceholder, required: true }),
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "username", label: labels.fieldUsername, placeholder: labels.fieldUsernamePlaceholder, required: true }),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "password", label: labels.fieldPassword, type: "password", placeholder: labels.fieldPasswordPlaceholder }),
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "schema", label: labels.fieldSchema, placeholder: labels.fieldSchemaPlaceholder })
|
|
244
244
|
] });
|
|
245
245
|
case "cloud-key":
|
|
246
246
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
247
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "region", label: labels.fieldRegion, placeholder: labels.fieldRegionPlaceholder, required: true }),
|
|
248
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "token", label: labels.fieldToken, type: "password", placeholder: labels.fieldTokenPlaceholder, required: true }),
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "bucket", label: labels.fieldBucket, placeholder: labels.fieldBucketPlaceholder })
|
|
250
250
|
] });
|
|
251
251
|
case "vector-key":
|
|
252
252
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
253
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
254
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "apiKey", label: labels.fieldApiKey, type: "password", placeholder: labels.fieldApiKeyPlaceholder, required: true }),
|
|
254
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "environment", label: labels.fieldEnvironment, placeholder: labels.fieldEnvironmentPlaceholder, required: true }),
|
|
255
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "index", label: labels.fieldIndex, placeholder: labels.fieldIndexPlaceholder })
|
|
256
256
|
] });
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -275,8 +275,8 @@ function ConnectionForm({
|
|
|
275
275
|
] })
|
|
276
276
|
] })
|
|
277
277
|
] }),
|
|
278
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
279
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormInput, { name: "name", label: labels.fieldName, placeholder: labels.fieldNamePlaceholder, required: true }),
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMT66VKLS_js.FormGrid, { children: renderFields() }),
|
|
280
280
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-6 pt-2", children: [
|
|
281
281
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 text-sm text-slate-700 dark:text-slate-300", children: [
|
|
282
282
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -307,9 +307,9 @@ function ConnectionForm({
|
|
|
307
307
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { className: "liquid-surface rounded-xl p-3", children: [
|
|
308
308
|
/* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cursor-pointer text-sm font-medium text-slate-700 dark:text-slate-300", children: labels.advancedToggle ?? "Governance & performance" }),
|
|
309
309
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-3", children: [
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
310
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkMT66VKLS_js.FormGrid, { children: [
|
|
311
311
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
312
|
-
|
|
312
|
+
chunkMT66VKLS_js.FormInput,
|
|
313
313
|
{
|
|
314
314
|
name: "maxPoolSize",
|
|
315
315
|
label: labels.fieldMaxPoolSize ?? "Max pool size",
|
|
@@ -320,7 +320,7 @@ function ConnectionForm({
|
|
|
320
320
|
}
|
|
321
321
|
),
|
|
322
322
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
-
|
|
323
|
+
chunkMT66VKLS_js.FormInput,
|
|
324
324
|
{
|
|
325
325
|
name: "timeoutMs",
|
|
326
326
|
label: labels.fieldTimeoutMs ?? "Timeout (ms)",
|
|
@@ -331,7 +331,7 @@ function ConnectionForm({
|
|
|
331
331
|
)
|
|
332
332
|
] }),
|
|
333
333
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
-
|
|
334
|
+
chunkMT66VKLS_js.FormInput,
|
|
335
335
|
{
|
|
336
336
|
name: "allowedTables",
|
|
337
337
|
label: labels.fieldAllowedTables ?? "Allowed tables (comma-separated)",
|
|
@@ -340,7 +340,7 @@ function ConnectionForm({
|
|
|
340
340
|
),
|
|
341
341
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-slate-500 dark:text-slate-400", children: labels.fieldAllowedTablesHelp ?? "Leave blank to allow every table the credential can see. Otherwise only the listed tables are queryable from workflows." }),
|
|
342
342
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
-
|
|
343
|
+
chunkMT66VKLS_js.FormInput,
|
|
344
344
|
{
|
|
345
345
|
name: "blockedColumns",
|
|
346
346
|
label: labels.fieldBlockedColumns ?? "Blocked columns (comma-separated)",
|
|
@@ -387,7 +387,7 @@ function DatasourceFormModal({ open, onClose, labels, onSave }) {
|
|
|
387
387
|
handleClose();
|
|
388
388
|
}
|
|
389
389
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
390
|
-
|
|
390
|
+
chunkMT66VKLS_js.GlassModal,
|
|
391
391
|
{
|
|
392
392
|
open,
|
|
393
393
|
onClose: handleClose,
|
|
@@ -420,7 +420,7 @@ function DatasourceModal({ open, onClose, labels, onSave }) {
|
|
|
420
420
|
handleClose();
|
|
421
421
|
}
|
|
422
422
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
-
|
|
423
|
+
chunkMT66VKLS_js.GlassModal,
|
|
424
424
|
{
|
|
425
425
|
open,
|
|
426
426
|
onClose: handleClose,
|
|
@@ -450,5 +450,5 @@ exports.DatasourceFormModal = DatasourceFormModal;
|
|
|
450
450
|
exports.DatasourceModal = DatasourceModal;
|
|
451
451
|
exports.findCategory = findCategory;
|
|
452
452
|
exports.findDialect = findDialect;
|
|
453
|
-
//# sourceMappingURL=chunk-
|
|
454
|
-
//# sourceMappingURL=chunk-
|
|
453
|
+
//# sourceMappingURL=chunk-R6GEJBFC.js.map
|
|
454
|
+
//# sourceMappingURL=chunk-R6GEJBFC.js.map
|