@iblai/iblai-js 1.10.4 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86051,7 +86051,7 @@ function Profile({ tenant, username, tenants, onClose, customization = {}, isAdm
86051
86051
  // Show memory tab if enabled for this platform AND memsearch is enabled (or status API is unavailable)
86052
86052
  const isMemoryEnabled = enableMemoryTab && (isMemsearchStatusError || ((_a = memsearchStatus === null || memsearchStatus === void 0 ? void 0 : memsearchStatus.enable_memsearch) !== null && _a !== void 0 ? _a : false));
86053
86053
  const currentTenant = tenants.find((t) => t.key === tenant);
86054
- const isPurchasesEnabled = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.show_paywall;
86054
+ const isPurchasesEnabled = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.enable_monetization;
86055
86055
  const baseTabs = [
86056
86056
  { id: 'basic', label: 'Basic', renderIcon: renderLucideIcon(User) },
86057
86057
  { id: 'social', label: 'Social', renderIcon: renderLucideIcon(Globe) },
@@ -124104,7 +124104,7 @@ function Profile({ tenant, username, tenants, onClose, customization = {}, isAdm
124104
124104
  // Show memory tab if enabled for this platform AND memsearch is enabled (or status API is unavailable)
124105
124105
  const isMemoryEnabled = enableMemoryTab && (isMemsearchStatusError || ((_a = memsearchStatus === null || memsearchStatus === void 0 ? void 0 : memsearchStatus.enable_memsearch) !== null && _a !== void 0 ? _a : false));
124106
124106
  const currentTenant = tenants.find((t) => t.key === tenant);
124107
- const isPurchasesEnabled = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.show_paywall;
124107
+ const isPurchasesEnabled = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.enable_monetization;
124108
124108
  const baseTabs = [
124109
124109
  { id: 'basic', label: 'Basic', renderIcon: renderLucideIcon(User) },
124110
124110
  { id: 'social', label: 'Social', renderIcon: renderLucideIcon(Globe) },
@@ -198158,8 +198158,12 @@ function AlertsTab({ tenant }) {
198158
198158
  availableWatcherUsers.length === 0 && (jsx("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg p-3 z-50", children: jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "No users found" }) }))] })] })] }), formError && (jsx("div", { className: "mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md", children: jsx("p", { className: "text-sm text-red-600 dark:text-red-400", children: formError }) })), jsxs(DialogFooter, { className: "mt-6", children: [jsx(Button$1, { variant: "outline", onClick: () => setIsOpen(false), children: "Cancel" }), jsxs(Button$1, { onClick: onSubmit, disabled: isSubmitting, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: [isSubmitting ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin mr-2", "aria-hidden": "true" })) : null, editingGroup ? 'Save Alert' : 'Create Alert'] })] })] }) })] }));
198159
198159
  }
198160
198160
 
198161
+ const TabDescription = ({ icon, title, children }) => {
198162
+ const [expanded, setExpanded] = useState(false);
198163
+ return (jsxs("div", { className: "flex gap-3 items-start border rounded-lg p-4 bg-blue-50/60 border-blue-100", children: [jsx("div", { className: "shrink-0 w-9 h-9 rounded-md flex items-center justify-center bg-blue-100 text-blue-600", children: icon }), jsxs("div", { className: "flex-1 min-w-0", children: [jsx("h3", { className: "text-sm font-semibold mb-1 text-blue-900 hidden sm:block", children: title }), jsx("p", { className: `text-sm text-gray-600 leading-relaxed sm:line-clamp-none! ${expanded ? '' : 'line-clamp-2'}`, children: children }), jsx("button", { type: "button", onClick: () => setExpanded((prev) => !prev), className: "mt-1 text-xs font-medium text-blue-700 hover:text-blue-800 sm:hidden", children: expanded ? 'Read less' : 'Read more' })] })] }));
198164
+ };
198161
198165
  const Admin = ({ tenant, onInviteClick, hasUserTabPermission = false, hasGroupsTabPermission = false, hasRolesTabPermission = false, hasPoliciesTabPermission = false, hasTeamsTabPermission = false, hasAlertsTabPermission = false, hasInviteUserPermission = false, hasCreateTeamPermission = false, onLoadGroupPermissions, rbacPermissions = {}, enableRbac = false, }) => {
198162
- return (jsx("div", { className: "border border-gray-200 rounded-lg p-6", children: jsxs(Tabs, { defaultValue: "users", "aria-label": "RBAC Management Tabs", children: [jsxs(TabsList, { "aria-label": "Management tabs", className: "max-w-full overflow-x-auto justify-start px-1", children: [hasUserTabPermission && jsx(TabsTrigger, { value: "users", children: "Users" }), hasGroupsTabPermission && jsx(TabsTrigger, { value: "groups", children: "Groups" }), hasRolesTabPermission && jsx(TabsTrigger, { value: "roles", children: "Roles" }), hasPoliciesTabPermission && jsx(TabsTrigger, { value: "policies", children: "Policies" }), hasTeamsTabPermission && jsx(TabsTrigger, { value: "teams", children: "Teams" }), hasAlertsTabPermission && jsx(TabsTrigger, { value: "alerts", children: "Alerts" })] }), hasUserTabPermission && (jsx(TabsContent, { value: "users", children: jsx(UsersTab, { tenant: tenant, onInviteClick: onInviteClick }) })), hasGroupsTabPermission && (jsx(TabsContent, { value: "groups", children: jsx(GroupsTab, { tenant: tenant }) })), hasRolesTabPermission && (jsx(TabsContent, { value: "roles", children: jsx(RolesTab, { tenant: tenant }) })), hasPoliciesTabPermission && (jsx(TabsContent, { value: "policies", children: jsx(PoliciesTab, { tenant: tenant }) })), hasTeamsTabPermission && (jsx(TabsContent, { value: "teams", children: jsx(GroupsTab, { tenant: tenant, isTeam: true, onInviteClick: onInviteClick, hasInviteUserPermission: hasInviteUserPermission, hasCreateTeamPermission: hasCreateTeamPermission, onLoadGroupPermissions: onLoadGroupPermissions, rbacPermissions: rbacPermissions, enableRbac: enableRbac }) })), hasAlertsTabPermission && (jsx(TabsContent, { value: "alerts", children: jsx(AlertsTab, { tenant: tenant }) }))] }) }));
198166
+ return (jsx("div", { className: "border border-gray-200 rounded-lg p-6", children: jsxs(Tabs, { defaultValue: "users", "aria-label": "RBAC Management Tabs", children: [jsxs(TabsList, { "aria-label": "Management tabs", className: "max-w-full overflow-x-auto justify-start px-1", children: [hasUserTabPermission && jsx(TabsTrigger, { value: "users", children: "Users" }), hasGroupsTabPermission && jsx(TabsTrigger, { value: "groups", children: "Groups" }), hasRolesTabPermission && jsx(TabsTrigger, { value: "roles", children: "Roles" }), hasPoliciesTabPermission && jsx(TabsTrigger, { value: "policies", children: "Policies" }), hasTeamsTabPermission && jsx(TabsTrigger, { value: "teams", children: "Teams" }), hasAlertsTabPermission && jsx(TabsTrigger, { value: "alerts", children: "Alerts" })] }), hasUserTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "users", children: [jsx(TabDescription, { icon: jsx(Users, { className: "w-5 h-5" }), title: "Users", children: "Manage platform-wide users and their predefined roles. Admins have the highest level of permissions; Students can optionally be granted limited policies." }), jsx(UsersTab, { tenant: tenant, onInviteClick: onInviteClick })] })), hasGroupsTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "groups", children: [jsx(TabDescription, { icon: jsx(UsersRound, { className: "w-5 h-5" }), title: "Groups", children: "RBAC groups bundle users so a single policy assignment grants permissions to all of them. The same group can be reused across policies." }), jsx(GroupsTab, { tenant: tenant })] })), hasRolesTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "roles", children: [jsx(TabDescription, { icon: jsx(UserCog, { className: "w-5 h-5" }), title: "Roles", children: "An RBAC role is a named bundle of permissions (actions applied to resources in policies)." }), jsx(RolesTab, { tenant: tenant })] })), hasPoliciesTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "policies", children: [jsxs(TabDescription, { icon: jsx(ScrollText, { className: "w-5 h-5" }), title: "Policies", children: ["An RBAC policy grants a role's permissions to a set of users or groups on a set of resources. Resources are hierarchical: granting on /platforms/", '{pk}', "/mentors/ covers every mentor, while /platforms/", '{pk}', "/mentors/", '{pk}', "/ scopes to one."] }), jsx(PoliciesTab, { tenant: tenant })] })), hasTeamsTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "teams", children: [jsx(TabDescription, { icon: jsx(Shield, { className: "w-5 h-5" }), title: "Teams", children: "A team is a curated set of users that you can share with others \u2014 e.g., grant another user permission to view the team's analytics or send notifications to them." }), jsx(GroupsTab, { tenant: tenant, isTeam: true, onInviteClick: onInviteClick, hasInviteUserPermission: hasInviteUserPermission, hasCreateTeamPermission: hasCreateTeamPermission, onLoadGroupPermissions: onLoadGroupPermissions, rbacPermissions: rbacPermissions, enableRbac: enableRbac })] })), hasAlertsTabPermission && (jsxs(TabsContent, { className: "mt-4", value: "alerts", children: [jsx(TabDescription, { icon: jsx(BellRing, { className: "w-5 h-5" }), title: "Alerts", children: "An alert pairs a team of watched users with one or more watchers who get notified when monitored events occur for a watched user. Each watcher subscribes to its own subset of events." }), jsx(AlertsTab, { tenant: tenant })] }))] }) }));
198163
198167
  };
198164
198168
 
198165
198169
  function OrganizationTab({ platformKey, setOrganizationLogoFromOutside, tenant, onTenantUpdate, }) {
@@ -201020,7 +201024,7 @@ function AdvancedTab({ platformKey, username, currentSPA, authURL, currentPlatfo
201020
201024
 
201021
201025
  function StripeConnect({ platformKey }) {
201022
201026
  const [isRedirecting, setIsRedirecting] = useState(false);
201023
- const { data: status, isLoading, refetch, } = useGetStripeConnectStatusQuery({ platform_key: platformKey }, { refetchOnMountOrArgChange: true });
201027
+ const { data: status, isLoading, refetch, isError, } = useGetStripeConnectStatusQuery({ platform_key: platformKey }, { refetchOnMountOrArgChange: true });
201024
201028
  const [startOnboarding, { isLoading: isStartingOnboarding }] = useStartStripeConnectOnboardingMutation();
201025
201029
  const [triggerGetDashboard] = useLazyGetStripeConnectDashboardQuery();
201026
201030
  const buildMonetizationUrl = () => {
@@ -201068,11 +201072,11 @@ function StripeConnect({ platformKey }) {
201068
201072
  }
201069
201073
  const isReady = status === null || status === void 0 ? void 0 : status.is_ready_for_payments;
201070
201074
  const hasAccount = status === null || status === void 0 ? void 0 : status.has_account;
201071
- return (jsx(Card, { className: "shadow-sm border", style: { borderColor: 'oklch(.922 0 0)' }, children: jsx(CardContent, { className: "p-6", children: jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-4", children: [jsxs("div", { className: "flex-1 min-w-0", children: [jsxs("div", { className: "flex items-center gap-2 mb-1", children: [jsx("h4", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: "Stripe Connect" }), isReady ? (jsx(Badge, { className: "bg-blue-100 text-blue-700 border-blue-200", children: "Connected" })) : hasAccount ? (jsx(Badge, { className: "bg-yellow-100 text-yellow-700 border-yellow-200", children: "Incomplete" })) : (jsx(Badge, { variant: "secondary", children: "Not Connected" }))] }), isReady ? (jsxs("p", { className: "text-sm text-gray-500", children: ["Stripe is connected and ready to accept payments.", (status === null || status === void 0 ? void 0 : status.charges_enabled) && ' Charges enabled.', (status === null || status === void 0 ? void 0 : status.payouts_enabled) && ' Payouts enabled.'] })) : hasAccount ? (jsx("p", { className: "text-sm text-gray-500", children: "Stripe account created but onboarding is incomplete. Complete setup to start accepting payments." })) : (jsx("p", { className: "text-sm text-gray-500", children: "Connect a Stripe account to enable monetization features." }))] }), jsx("div", { className: "flex gap-2 flex-shrink-0", children: isReady ? (jsxs(Button$1, { onClick: handleOpenDashboard, disabled: isRedirecting, variant: "outline", className: "cursor-pointer", children: [isRedirecting ? (jsx(LoaderCircle, { className: "h-4 w-4 mr-2 animate-spin" })) : (jsx(ExternalLink, { className: "h-4 w-4 mr-2" })), "Stripe Dashboard"] })) : (jsxs(Button$1, { onClick: handleStartOnboarding, disabled: isStartingOnboarding || isRedirecting, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white cursor-pointer", children: [isStartingOnboarding || isRedirecting ? (jsx(LoaderCircle, { className: "h-4 w-4 mr-2 animate-spin" })) : (jsx(Link$1, { className: "h-4 w-4 mr-2" })), isStartingOnboarding || isRedirecting
201075
+ return (jsx(Card, { className: "shadow-sm border", style: { borderColor: 'oklch(.922 0 0)' }, children: jsx(CardContent, { className: "p-6", children: jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-4", children: [jsxs("div", { className: "flex-1 min-w-0", children: [jsxs("div", { className: "flex items-center gap-2 mb-1", children: [jsx("h4", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: "Stripe Configuration" }), isReady ? (jsx(Badge, { className: "bg-blue-100 text-blue-700 border-blue-200", children: "Configured" })) : hasAccount ? (jsx(Badge, { className: "bg-yellow-100 text-yellow-700 border-yellow-200", children: "Incomplete" })) : (jsx(Badge, { variant: "secondary", children: "Not Configured" }))] }), isReady ? (jsxs("p", { className: "text-sm text-gray-500", children: ["Stripe is connected and ready to accept payments.", (status === null || status === void 0 ? void 0 : status.charges_enabled) && ' Charges enabled.', (status === null || status === void 0 ? void 0 : status.payouts_enabled) && ' Payouts enabled.'] })) : hasAccount ? (jsx("p", { className: "text-sm text-gray-500", children: "Stripe account created but onboarding is incomplete. Complete setup to start accepting payments." })) : (jsx("p", { className: "text-sm text-gray-500", children: "Connect a Stripe account to enable monetization features." }))] }), jsx("div", { className: "flex gap-2 flex-shrink-0", children: isError ? null : isReady ? (jsxs(Button$1, { onClick: handleOpenDashboard, disabled: isRedirecting, variant: "outline", className: "cursor-pointer", children: [isRedirecting ? (jsx(LoaderCircle, { className: "h-4 w-4 mr-2 animate-spin" })) : (jsx(ExternalLink, { className: "h-4 w-4 mr-2" })), "Stripe Dashboard"] })) : (jsxs(Button$1, { onClick: handleStartOnboarding, disabled: isStartingOnboarding || isRedirecting, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white cursor-pointer", children: [isStartingOnboarding || isRedirecting ? (jsx(LoaderCircle, { className: "h-4 w-4 mr-2 animate-spin" })) : (jsx(Link$1, { className: "h-4 w-4 mr-2" })), isStartingOnboarding || isRedirecting
201072
201076
  ? 'Redirecting...'
201073
201077
  : hasAccount
201074
201078
  ? 'Complete Setup'
201075
- : 'Connect Stripe'] })) })] }) }) }));
201079
+ : 'Configure Stripe'] })) })] }) }) }));
201076
201080
  }
201077
201081
 
201078
201082
  function slugify(text) {
@@ -201232,7 +201236,7 @@ function PaywalledItemsList({ platformKey, onSelectItem, onAddCustomItem, }) {
201232
201236
  : 'bg-gray-100 text-gray-500 border-gray-200 hover:bg-gray-100', children: pw.is_enabled ? 'Active' : 'Disabled' })] }) }, `${pw.item_type}-${pw.item_id}`));
201233
201237
  }), (paywalls.previous_page !== null || paywalls.next_page !== null) && (jsxs("div", { className: "flex items-center justify-between pt-2", children: [jsxs("span", { className: "text-xs text-gray-400", children: [paywalls.count, " item", paywalls.count !== 1 ? 's' : '', " total"] }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Button$1, { variant: "outline", size: "sm", disabled: paywalls.previous_page === null, onClick: () => paywalls.previous_page !== null && setPage(paywalls.previous_page), className: "h-7 text-xs cursor-pointer", children: "Previous" }), jsxs("span", { className: "text-xs text-gray-500", children: ["Page ", page] }), jsx(Button$1, { variant: "outline", size: "sm", disabled: paywalls.next_page === null, onClick: () => paywalls.next_page !== null && setPage(paywalls.next_page), className: "h-7 text-xs cursor-pointer", children: "Next" })] })] }))] })) : (jsx("p", { className: "text-sm text-gray-400 text-center py-6", children: statusFilter !== 'all'
201234
201238
  ? `No ${statusFilter} items found.`
201235
- : 'No items configured yet. Search and select an agent above.' }))] })] }));
201239
+ : 'No items configured yet. Search and select an item above.' }))] })] }));
201236
201240
  }
201237
201241
 
201238
201242
  const EMPTY_FORM = {
@@ -201561,21 +201565,22 @@ function PaywallConfig({ platformKey, authURL, disabled }) {
201561
201565
  }
201562
201566
 
201563
201567
  function MonetizationTab({ platformKey, authURL }) {
201564
- var _a;
201568
+ var _a, _b;
201565
201569
  const { data: stripeStatus } = useGetStripeConnectStatusQuery({ platform_key: platformKey }, { refetchOnMountOrArgChange: true });
201566
201570
  const isStripeReady = (_a = stripeStatus === null || stripeStatus === void 0 ? void 0 : stripeStatus.is_ready_for_payments) !== null && _a !== void 0 ? _a : false;
201567
- return (jsxs("div", { className: "container mx-auto max-w-7xl !mt-0 space-y-6", children: [jsx(StripeConnect, { platformKey: platformKey }), jsx(PaywallConfig, { platformKey: platformKey, authURL: authURL, disabled: !isStripeReady })] }));
201571
+ const isOwner = (_b = stripeStatus === null || stripeStatus === void 0 ? void 0 : stripeStatus.is_owner) !== null && _b !== void 0 ? _b : false;
201572
+ return (jsxs("div", { className: "container mx-auto max-w-7xl !mt-0 space-y-6", children: [isOwner && jsx(StripeConnect, { platformKey: platformKey }), jsx(PaywallConfig, { platformKey: platformKey, authURL: authURL, disabled: !isStripeReady })] }));
201568
201573
  }
201569
201574
 
201570
201575
  function Account({ tenant, tenants = [], username, onInviteClick, email, mainPlatformKey, userActiveApp = null, showPlatformName = false, isAdmin = false, targetTab = 'basic', currentPlan: _currentPlan = '', currentSPA = '', authURL, onTenantUpdate, currentPlatformBaseDomain = '', enableRbac = false, rbacPermissions = {}, onLoadGroupPermissions, onTabChange, }) {
201571
201576
  const currentTenant = tenants.find((t) => t.key === tenant);
201577
+ const hasMonetizationPermission = checkRbacPermission(rbacPermissions, `/platforms/${tenant}/#can_sell_items`, enableRbac);
201578
+ const canMonetize = (currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.enable_monetization) && hasMonetizationPermission;
201572
201579
  const TABS = [
201573
201580
  { id: 'organization', label: 'Organization', icon: Briefcase },
201574
201581
  { id: 'management', label: 'Management', icon: Users },
201575
201582
  { id: 'integrations', label: 'Integrations', icon: KeyRound },
201576
- ...((currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.show_paywall)
201577
- ? [{ id: 'monetization', label: 'Monetization', icon: Coins }]
201578
- : []),
201583
+ ...(canMonetize ? [{ id: 'monetization', label: 'Monetization', icon: Coins }] : []),
201579
201584
  { id: 'advanced', label: 'Advanced', icon: Settings$1 },
201580
201585
  ];
201581
201586
  const [activeTab, setActiveTab] = useState(targetTab);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/iblai-js",
3
- "version": "1.10.4",
3
+ "version": "1.11.1",
4
4
  "description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
5
5
  "type": "module",
6
6
  "engines": {
@@ -61,10 +61,10 @@
61
61
  "axios": "1.13.6",
62
62
  "dotenv": "16.6.1",
63
63
  "winston": "3.19.0",
64
- "@iblai/data-layer": "1.5.7",
64
+ "@iblai/data-layer": "1.5.8",
65
65
  "@iblai/mcp": "1.4.10",
66
- "@iblai/web-containers": "1.6.14",
67
- "@iblai/web-utils": "1.6.10"
66
+ "@iblai/web-containers": "1.7.1",
67
+ "@iblai/web-utils": "1.7.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@radix-ui/react-dialog": "^1.1.7",