@vritti/quantum-ui 0.3.15 → 0.3.17
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/OrgContext.js +37 -0
- package/dist/OrgContext.js.map +1 -0
- package/dist/PermissionGate.js +62 -22
- package/dist/PermissionGate.js.map +1 -1
- package/dist/RepositorySelector.js +20 -0
- package/dist/RepositorySelector.js.map +1 -0
- package/dist/components/PermissionGate.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts +4 -2
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts +1 -0
- package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
- package/dist/lib/context/OrgContext.d.ts +17 -0
- package/dist/lib/context/OrgContext.d.ts.map +1 -0
- package/dist/lib/context/index.d.ts +1 -0
- package/dist/lib/context/index.d.ts.map +1 -1
- package/dist/lib/selects/index.d.ts +1 -0
- package/dist/lib/selects/index.d.ts.map +1 -1
- package/dist/lib/selects/repository/RepositorySelector.d.ts +4 -0
- package/dist/lib/selects/repository/RepositorySelector.d.ts.map +1 -0
- package/dist/lib/selects/repository/index.d.ts +2 -0
- package/dist/lib/selects/repository/index.d.ts.map +1 -0
- package/dist/lib/types/catalog-resolver.d.ts +8 -1
- package/dist/lib/types/catalog-resolver.d.ts.map +1 -1
- package/dist/lib/utils/services.d.ts +4 -0
- package/dist/lib/utils/services.d.ts.map +1 -0
- package/dist/selects/repository.js +2 -0
- package/dist/selects/repository.js.map +1 -0
- package/dist/types/catalog-resolver.js +2 -1
- package/dist/types/catalog-resolver.js.map +1 -1
- package/package.json +5 -1
- package/dist/LayoutModeContext.js +0 -19
- package/dist/LayoutModeContext.js.map +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useContext, createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const LayoutModeContext = createContext({
|
|
5
|
+
mode: "padded",
|
|
6
|
+
setMode: () => {
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
const LayoutModeProvider = ({ children }) => {
|
|
10
|
+
const [mode, setMode] = useState("padded");
|
|
11
|
+
const value = useMemo(() => ({ mode, setMode }), [mode]);
|
|
12
|
+
return /* @__PURE__ */ jsx(LayoutModeContext.Provider, { value, children });
|
|
13
|
+
};
|
|
14
|
+
function useLayoutMode() {
|
|
15
|
+
return useContext(LayoutModeContext);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const NO_SERVICES = [];
|
|
19
|
+
const ABSENT = Object.freeze({
|
|
20
|
+
id: null,
|
|
21
|
+
name: null,
|
|
22
|
+
subdomain: null,
|
|
23
|
+
logoUrl: null,
|
|
24
|
+
services: NO_SERVICES
|
|
25
|
+
});
|
|
26
|
+
const OrgContext = createContext(ABSENT);
|
|
27
|
+
const OrgContextProvider = OrgContext.Provider;
|
|
28
|
+
function useOrgContext() {
|
|
29
|
+
return useContext(OrgContext);
|
|
30
|
+
}
|
|
31
|
+
function useOrgService(service) {
|
|
32
|
+
const { services } = useOrgContext();
|
|
33
|
+
return services.find((entry) => entry.service === service) ?? null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { LayoutModeProvider as L, OrgContextProvider as O, useOrgContext as a, useOrgService as b, useLayoutMode as u };
|
|
37
|
+
//# sourceMappingURL=OrgContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrgContext.js","sources":["../lib/context/LayoutModeContext.tsx","../lib/context/OrgContext.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo, useState } from 'react';\n\nexport type LayoutMode = 'padded' | 'full';\n\ninterface LayoutModeContextValue {\n mode: LayoutMode;\n setMode: (mode: LayoutMode) => void;\n}\n\nconst LayoutModeContext = createContext<LayoutModeContextValue>({\n mode: 'padded',\n setMode: () => {},\n});\n\nexport const LayoutModeProvider = ({ children }: { children: ReactNode }) => {\n const [mode, setMode] = useState<LayoutMode>('padded');\n const value = useMemo(() => ({ mode, setMode }), [mode]);\n return <LayoutModeContext.Provider value={value}>{children}</LayoutModeContext.Provider>;\n};\n\n// Returns current layout mode and a setter; MF pages set 'full' on mount and reset to 'padded' on unmount.\nexport function useLayoutMode(): LayoutModeContextValue {\n return useContext(LayoutModeContext);\n}\n","import { createContext, useContext } from 'react';\nimport type { ServiceCode } from '../types/catalog-resolver';\n\n// An external service the org has provisioned. externalId/externalName carry the provider's own\n// identifiers (for Gitea: the numeric org id and the namespace) so consumers never need a second call.\nexport interface OrgService {\n service: ServiceCode;\n externalId: string | null;\n externalName: string | null;\n}\n\nexport interface OrgContextValue {\n id: string | null;\n name: string | null;\n subdomain: string | null;\n logoUrl: string | null;\n services: OrgService[];\n}\n\n// No provider means no org has been resolved yet — report zero services rather than throwing, so a\n// federated remote rendered outside the host still mounts (same posture as usePermission).\nconst NO_SERVICES: OrgService[] = [];\n\nconst ABSENT: OrgContextValue = Object.freeze({\n id: null,\n name: null,\n subdomain: null,\n logoUrl: null,\n services: NO_SERVICES,\n});\n\nconst OrgContext = createContext<OrgContextValue>(ABSENT);\n\nexport const OrgContextProvider = OrgContext.Provider;\n\n// Returns the host's current organization, fed from the auth-state stream; remotes read it instead of refetching\nexport function useOrgContext(): OrgContextValue {\n return useContext(OrgContext);\n}\n\n// Returns the org's provisioned entry for one service, or null when it has not been set up\nexport function useOrgService(service: ServiceCode): OrgService | null {\n const { services } = useOrgContext();\n return services.find((entry) => entry.service === service) ?? null;\n}\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB,aAAA,CAAsC;AAAA,EAC9D,IAAA,EAAM,QAAA;AAAA,EACN,SAAS,MAAM;AAAA,EAAC;AAClB,CAAC,CAAA;AAEM,MAAM,kBAAA,GAAqB,CAAC,EAAE,QAAA,EAAS,KAA+B;AAC3E,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAqB,QAAQ,CAAA;AACrD,EAAA,MAAM,KAAA,GAAQ,QAAQ,OAAO,EAAE,MAAM,OAAA,EAAQ,CAAA,EAAI,CAAC,IAAI,CAAC,CAAA;AACvD,EAAA,uBAAO,GAAA,CAAC,iBAAA,CAAkB,QAAA,EAAlB,EAA2B,OAAe,QAAA,EAAS,CAAA;AAC7D;AAGO,SAAS,aAAA,GAAwC;AACtD,EAAA,OAAO,WAAW,iBAAiB,CAAA;AACrC;;ACFA,MAAM,cAA4B,EAAC;AAEnC,MAAM,MAAA,GAA0B,OAAO,MAAA,CAAO;AAAA,EAC5C,EAAA,EAAI,IAAA;AAAA,EACJ,IAAA,EAAM,IAAA;AAAA,EACN,SAAA,EAAW,IAAA;AAAA,EACX,OAAA,EAAS,IAAA;AAAA,EACT,QAAA,EAAU;AACZ,CAAC,CAAA;AAED,MAAM,UAAA,GAAa,cAA+B,MAAM,CAAA;AAEjD,MAAM,qBAAqB,UAAA,CAAW;AAGtC,SAAS,aAAA,GAAiC;AAC/C,EAAA,OAAO,WAAW,UAAU,CAAA;AAC9B;AAGO,SAAS,cAAc,OAAA,EAAyC;AACrE,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,aAAA,EAAc;AACnC,EAAA,OAAO,SAAS,IAAA,CAAK,CAAC,UAAU,KAAA,CAAM,OAAA,KAAY,OAAO,CAAA,IAAK,IAAA;AAChE;;;;"}
|
package/dist/PermissionGate.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useContext, createContext } from 'react';
|
|
3
3
|
import { c as cn } from './utils.js';
|
|
4
|
-
import { L as LockKeyhole } from './lock-keyhole.js';
|
|
5
4
|
import { L as Lock } from './lock.js';
|
|
5
|
+
import { L as LockKeyhole } from './lock-keyhole.js';
|
|
6
|
+
|
|
7
|
+
const SERVICE_LABELS = {
|
|
8
|
+
GITEA: "a git organization"
|
|
9
|
+
};
|
|
10
|
+
function serviceLabels(services) {
|
|
11
|
+
const labels = services.map((service) => SERVICE_LABELS[service] ?? service);
|
|
12
|
+
if (labels.length === 0) return "a service";
|
|
13
|
+
if (labels.length === 1) return labels[0];
|
|
14
|
+
return `${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`;
|
|
15
|
+
}
|
|
6
16
|
|
|
7
17
|
const ALLOW = Object.freeze({
|
|
8
18
|
granted: true,
|
|
9
19
|
locked: false,
|
|
10
20
|
reason: null,
|
|
11
21
|
unlockPlans: [],
|
|
22
|
+
missingServices: [],
|
|
12
23
|
available: true,
|
|
13
24
|
featureName: null
|
|
14
25
|
});
|
|
@@ -28,10 +39,29 @@ function usePermission(code) {
|
|
|
28
39
|
const PermissionLockIcon = ({
|
|
29
40
|
reason,
|
|
30
41
|
className
|
|
31
|
-
}) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
}) => {
|
|
43
|
+
switch (reason) {
|
|
44
|
+
case "SITE":
|
|
45
|
+
return /* @__PURE__ */ jsx(LockKeyhole, { className: cn("text-destructive", className) });
|
|
46
|
+
case "SERVICE":
|
|
47
|
+
return /* @__PURE__ */ jsx(Lock, { className: cn("text-destructive", className) });
|
|
48
|
+
default:
|
|
49
|
+
return /* @__PURE__ */ jsx(Lock, { className: cn("text-warning", className) });
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function lockedTip({
|
|
53
|
+
reason,
|
|
54
|
+
unlockPlans,
|
|
55
|
+
missingServices = []
|
|
56
|
+
}) {
|
|
57
|
+
switch (reason) {
|
|
58
|
+
case "SITE":
|
|
59
|
+
return "Not enabled for this site";
|
|
60
|
+
case "SERVICE":
|
|
61
|
+
return `Requires ${serviceLabels(missingServices)}`;
|
|
62
|
+
default:
|
|
63
|
+
return unlockPlans.length > 0 ? `Available in ${unlockPlans.join(", ")}` : "Not included in your plan";
|
|
64
|
+
}
|
|
35
65
|
}
|
|
36
66
|
function lockMessages(result) {
|
|
37
67
|
const name = result.featureName;
|
|
@@ -41,23 +71,33 @@ function lockMessages(result) {
|
|
|
41
71
|
tip: name ? `You don't have permission to view ${name}.` : "You don't have permission to access this."
|
|
42
72
|
};
|
|
43
73
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
switch (result.reason) {
|
|
75
|
+
case "SITE":
|
|
76
|
+
return {
|
|
77
|
+
title: name ? `${name} not enabled here` : "Not available here",
|
|
78
|
+
tip: name ? `${name} isn't enabled for this site.` : "Not enabled for this site."
|
|
79
|
+
};
|
|
80
|
+
case "SERVICE": {
|
|
81
|
+
const needs = serviceLabels(result.missingServices ?? []);
|
|
82
|
+
return {
|
|
83
|
+
title: "Setup required",
|
|
84
|
+
tip: name ? `${name} needs ${needs}. Set it up to continue.` : `This needs ${needs}. Set it up to continue.`
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
default: {
|
|
88
|
+
if (result.unlockPlans.length > 0) {
|
|
89
|
+
const plans = result.unlockPlans.join(", ");
|
|
90
|
+
return {
|
|
91
|
+
title: name ? `Unlock ${name}` : "Upgrade required",
|
|
92
|
+
tip: name ? `${name} is available on ${plans}.` : `Available in ${plans}.`
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
title: name ? `Unlock ${name}` : "Upgrade required",
|
|
97
|
+
tip: name ? `${name} isn't included in your plan.` : "Not included in your plan."
|
|
98
|
+
};
|
|
99
|
+
}
|
|
56
100
|
}
|
|
57
|
-
return {
|
|
58
|
-
title: name ? `Unlock ${name}` : "Upgrade required",
|
|
59
|
-
tip: name ? `${name} isn't included in your plan.` : "Not included in your plan."
|
|
60
|
-
};
|
|
61
101
|
}
|
|
62
102
|
const DefaultLockFallback = ({ result }) => /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 text-center", children: [
|
|
63
103
|
/* @__PURE__ */ jsx(PermissionLockIcon, { reason: result.reason, className: "size-10" }),
|
|
@@ -71,5 +111,5 @@ const PermissionGate = ({ permission, children, fallback }) => {
|
|
|
71
111
|
return /* @__PURE__ */ jsx(DefaultLockFallback, { result });
|
|
72
112
|
};
|
|
73
113
|
|
|
74
|
-
export { PermissionGate as P, PermissionGateProvider as a, PermissionLockIcon as b, usePermissionGate as c, lockedTip as l, usePermission as u };
|
|
114
|
+
export { PermissionGate as P, SERVICE_LABELS as S, PermissionGateProvider as a, PermissionLockIcon as b, usePermissionGate as c, lockedTip as l, serviceLabels as s, usePermission as u };
|
|
75
115
|
//# sourceMappingURL=PermissionGate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionGate.js","sources":["../lib/components/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import { Lock, LockKeyhole } from 'lucide-react';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\nimport { cn } from '../../../shadcn/utils';\n\nexport type PermissionLockReason = 'PLAN' | 'SITE';\n\nexport interface PermissionGateResult {\n granted: boolean;\n locked: boolean;\n reason: PermissionLockReason | null;\n unlockPlans: string[];\n available: boolean;\n featureName: string | null;\n}\n\nexport type PermissionGateFn = (code: string) => PermissionGateResult;\n\nconst ALLOW: PermissionGateResult = Object.freeze({\n granted: true,\n locked: false,\n reason: null,\n unlockPlans: [],\n available: true,\n featureName: null,\n});\n\nconst ALLOW_GATE: PermissionGateFn = () => ALLOW;\n\nconst GATE_CONTEXT_KEY = Symbol.for('@vritti/quantum-ui/PermissionGate');\ntype GateRegistry = { [GATE_CONTEXT_KEY]?: React.Context<PermissionGateFn | null> };\nconst registry = globalThis as GateRegistry;\nregistry[GATE_CONTEXT_KEY] ??= createContext<PermissionGateFn | null>(null);\nconst PermissionGateContext = registry[GATE_CONTEXT_KEY];\n\nexport const PermissionGateProvider = PermissionGateContext.Provider;\n\n// The raw gate for mapping over collections; ALLOW-everything when no provider is mounted\nexport function usePermissionGate(): PermissionGateFn {\n return useContext(PermissionGateContext) ?? ALLOW_GATE;\n}\n\n// Total: no provider / no code resolves to ALLOW, so callers never branch on null\nexport function usePermission(code?: string): PermissionGateResult {\n const gate = useContext(PermissionGateContext);\n return code && gate ? gate(code) : ALLOW;\n}\n\n// The lock symbol for a locked control — plan locks show a warning lock, BU locks a red keyhole lock\nexport const PermissionLockIcon: React.FC<{ reason: PermissionLockReason | null; className?: string }> = ({\n reason,\n className,\n}) =>\n reason === 'SITE' ? (\n <LockKeyhole className={cn('text-destructive', className)} />\n ) : (\n <Lock className={cn('text-warning', className)} />\n );\n\n// Shared tooltip copy for locked controls — upsell for plan locks, restriction notice for BU locks\nexport function lockedTip({ reason, unlockPlans }: Pick<PermissionGateResult, 'reason' | 'unlockPlans'>): string {\n if (reason === 'SITE') return 'Not enabled for this site';\n return unlockPlans.length > 0 ? `Available in ${unlockPlans.join(', ')}` : 'Not included in your plan';\n}\n\n// Resolves a blocked control's heading + description, keyed off the resolved feature name when known\nfunction lockMessages(result: Pick<PermissionGateResult, 'granted' | 'reason' | 'unlockPlans' | 'featureName'>): {\n title: string;\n tip: string;\n} {\n const name = result.featureName;\n if (!result.granted) {\n return {\n title: name ? `${name} is restricted` : 'No access',\n tip: name ? `You don't have permission to view ${name}.` : \"You don't have permission to access this.\",\n };\n }\n if (result.reason === 'SITE') {\n return {\n title: name ? `${name} not enabled here` : 'Not available here',\n tip: name ? `${name} isn't enabled for this site.` : 'Not enabled for this site.',\n };\n }\n if (result.unlockPlans.length > 0) {\n const plans = result.unlockPlans.join(', ');\n return {\n title: name ? `Unlock ${name}` : 'Upgrade required',\n tip: name ? `${name} is available on ${plans}.` : `Available in ${plans}.`,\n };\n }\n return {\n title: name ? `Unlock ${name}` : 'Upgrade required',\n tip: name ? `${name} isn't included in your plan.` : 'Not included in your plan.',\n };\n}\n\nexport interface PermissionGateProps {\n permission?: string;\n children: React.ReactNode;\n fallback?: React.ReactNode | ((result: PermissionGateResult & { title: string; tip: string }) => React.ReactNode);\n}\n\n// Default fallback — a centered lock panel with the feature-specific restriction message\nconst DefaultLockFallback: React.FC<{ result: PermissionGateResult }> = ({ result }) => (\n <div className=\"flex flex-1 flex-col items-center justify-center gap-2 text-center\">\n <PermissionLockIcon reason={result.reason} className=\"size-10\" />\n <p className=\"max-w-sm text-sm text-muted-foreground\">{lockMessages(result).tip}</p>\n </div>\n);\n\n// Gates a subtree by permission code: children mount only when granted AND unlocked, else renders `fallback`\nexport const PermissionGate: React.FC<PermissionGateProps> = ({ permission, children, fallback }) => {\n const result = usePermission(permission);\n if (result.available) return <>{children}</>;\n if (fallback !== undefined)\n return <>{typeof fallback === 'function' ? fallback({ ...result, ...lockMessages(result) }) : fallback}</>;\n return <DefaultLockFallback result={result} />;\n};\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,KAAA,GAA8B,OAAO,MAAA,CAAO;AAAA,EAChD,OAAA,EAAS,IAAA;AAAA,EACT,MAAA,EAAQ,KAAA;AAAA,EACR,MAAA,EAAQ,IAAA;AAAA,EACR,aAAa,EAAC;AAAA,EACd,SAAA,EAAW,IAAA;AAAA,EACX,WAAA,EAAa;AACf,CAAC,CAAA;AAED,MAAM,aAA+B,MAAM,KAAA;AAE3C,MAAM,gBAAA,mBAAmB,MAAA,CAAO,GAAA,CAAI,mCAAmC,CAAA;AAEvE,MAAM,QAAA,GAAW,UAAA;AACjB,QAAA,CAAS,gBAAgB,CAAA,KAAM,aAAA,CAAuC,IAAI,CAAA;AAC1E,MAAM,qBAAA,GAAwB,SAAS,gBAAgB,CAAA;AAEhD,MAAM,yBAAyB,qBAAA,CAAsB;AAGrD,SAAS,iBAAA,GAAsC;AACpD,EAAA,OAAO,UAAA,CAAW,qBAAqB,CAAA,IAAK,UAAA;AAC9C;AAGO,SAAS,cAAc,IAAA,EAAqC;AACjE,EAAA,MAAM,IAAA,GAAO,WAAW,qBAAqB,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AG,MAAA,EAAQ,GAAG,YAAA,CAAa,MAAM,CAAA,EAAG,IAAI,QAAA,EAAS,CAAA;AACzG,EAAA,uBAAO,GAAA,CAAC,uBAAoB,MAAA,EAAgB,CAAA;AAC9C;;;;"}
|
|
1
|
+
{"version":3,"file":"PermissionGate.js","sources":["../lib/utils/services.ts","../lib/components/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import type { ServiceCode } from '../types/catalog-resolver';\n\n// Human copy for each external service a feature can depend on. Adding a service means adding one entry\n// here — no lock surface branches on a specific service code.\nexport const SERVICE_LABELS: Record<ServiceCode, string> = {\n GITEA: 'a git organization',\n};\n\n// Joins the missing services into a phrase, e.g. \"a git organization\" / \"a git organization and X\"\nexport function serviceLabels(services: ServiceCode[]): string {\n const labels = services.map((service) => SERVICE_LABELS[service] ?? service);\n if (labels.length === 0) return 'a service';\n if (labels.length === 1) return labels[0];\n return `${labels.slice(0, -1).join(', ')} and ${labels[labels.length - 1]}`;\n}\n","import { Lock, LockKeyhole } from 'lucide-react';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport type { ServiceCode } from '../../types/catalog-resolver';\nimport { serviceLabels } from '../../utils/services';\n\nexport type PermissionLockReason = 'PLAN' | 'SITE' | 'SERVICE';\n\nexport interface PermissionGateResult {\n granted: boolean;\n locked: boolean;\n reason: PermissionLockReason | null;\n unlockPlans: string[];\n // Which external services the org still has to provision — only populated when reason is 'SERVICE'\n missingServices: ServiceCode[];\n available: boolean;\n featureName: string | null;\n}\n\nexport type PermissionGateFn = (code: string) => PermissionGateResult;\n\nconst ALLOW: PermissionGateResult = Object.freeze({\n granted: true,\n locked: false,\n reason: null,\n unlockPlans: [],\n missingServices: [],\n available: true,\n featureName: null,\n});\n\nconst ALLOW_GATE: PermissionGateFn = () => ALLOW;\n\nconst GATE_CONTEXT_KEY = Symbol.for('@vritti/quantum-ui/PermissionGate');\ntype GateRegistry = { [GATE_CONTEXT_KEY]?: React.Context<PermissionGateFn | null> };\nconst registry = globalThis as GateRegistry;\nregistry[GATE_CONTEXT_KEY] ??= createContext<PermissionGateFn | null>(null);\nconst PermissionGateContext = registry[GATE_CONTEXT_KEY];\n\nexport const PermissionGateProvider = PermissionGateContext.Provider;\n\n// The raw gate for mapping over collections; ALLOW-everything when no provider is mounted\nexport function usePermissionGate(): PermissionGateFn {\n return useContext(PermissionGateContext) ?? ALLOW_GATE;\n}\n\n// Total: no provider / no code resolves to ALLOW, so callers never branch on null\nexport function usePermission(code?: string): PermissionGateResult {\n const gate = useContext(PermissionGateContext);\n return code && gate ? gate(code) : ALLOW;\n}\n\n// The lock symbol for a locked control — plan locks show a warning lock, BU locks a red keyhole lock,\n// service locks a red lock (blocked until the org provisions it, not an entitlement the user can buy)\nexport const PermissionLockIcon: React.FC<{ reason: PermissionLockReason | null; className?: string }> = ({\n reason,\n className,\n}) => {\n switch (reason) {\n case 'SITE':\n return <LockKeyhole className={cn('text-destructive', className)} />;\n case 'SERVICE':\n return <Lock className={cn('text-destructive', className)} />;\n default:\n return <Lock className={cn('text-warning', className)} />;\n }\n};\n\n// Shared tooltip copy for locked controls — upsell for plan locks, restriction notice for BU locks,\n// setup notice for service locks\nexport function lockedTip({\n reason,\n unlockPlans,\n missingServices = [],\n}: Pick<PermissionGateResult, 'reason' | 'unlockPlans'> &\n Partial<Pick<PermissionGateResult, 'missingServices'>>): string {\n switch (reason) {\n case 'SITE':\n return 'Not enabled for this site';\n case 'SERVICE':\n return `Requires ${serviceLabels(missingServices)}`;\n default:\n return unlockPlans.length > 0 ? `Available in ${unlockPlans.join(', ')}` : 'Not included in your plan';\n }\n}\n\n// Resolves a blocked control's heading + description, keyed off the resolved feature name when known\nfunction lockMessages(\n result: Pick<PermissionGateResult, 'granted' | 'reason' | 'unlockPlans' | 'featureName'> &\n Partial<Pick<PermissionGateResult, 'missingServices'>>,\n): {\n title: string;\n tip: string;\n} {\n const name = result.featureName;\n if (!result.granted) {\n return {\n title: name ? `${name} is restricted` : 'No access',\n tip: name ? `You don't have permission to view ${name}.` : \"You don't have permission to access this.\",\n };\n }\n switch (result.reason) {\n case 'SITE':\n return {\n title: name ? `${name} not enabled here` : 'Not available here',\n tip: name ? `${name} isn't enabled for this site.` : 'Not enabled for this site.',\n };\n case 'SERVICE': {\n const needs = serviceLabels(result.missingServices ?? []);\n return {\n title: 'Setup required',\n tip: name ? `${name} needs ${needs}. Set it up to continue.` : `This needs ${needs}. Set it up to continue.`,\n };\n }\n default: {\n if (result.unlockPlans.length > 0) {\n const plans = result.unlockPlans.join(', ');\n return {\n title: name ? `Unlock ${name}` : 'Upgrade required',\n tip: name ? `${name} is available on ${plans}.` : `Available in ${plans}.`,\n };\n }\n return {\n title: name ? `Unlock ${name}` : 'Upgrade required',\n tip: name ? `${name} isn't included in your plan.` : 'Not included in your plan.',\n };\n }\n }\n}\n\nexport interface PermissionGateProps {\n permission?: string;\n children: React.ReactNode;\n fallback?: React.ReactNode | ((result: PermissionGateResult & { title: string; tip: string }) => React.ReactNode);\n}\n\n// Default fallback — a centered lock panel with the feature-specific restriction message\nconst DefaultLockFallback: React.FC<{ result: PermissionGateResult }> = ({ result }) => (\n <div className=\"flex flex-1 flex-col items-center justify-center gap-2 text-center\">\n <PermissionLockIcon reason={result.reason} className=\"size-10\" />\n <p className=\"max-w-sm text-sm text-muted-foreground\">{lockMessages(result).tip}</p>\n </div>\n);\n\n// Gates a subtree by permission code: children mount only when granted AND unlocked, else renders `fallback`\nexport const PermissionGate: React.FC<PermissionGateProps> = ({ permission, children, fallback }) => {\n const result = usePermission(permission);\n if (result.available) return <>{children}</>;\n if (fallback !== undefined)\n return <>{typeof fallback === 'function' ? fallback({ ...result, ...lockMessages(result) }) : fallback}</>;\n return <DefaultLockFallback result={result} />;\n};\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,cAAA,GAA8C;AAAA,EACzD,KAAA,EAAO;AACT;AAGO,SAAS,cAAc,QAAA,EAAiC;AAC7D,EAAA,MAAM,MAAA,GA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CAAC,kBAAA,EAAA,EAAmB,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,WAAU,SAAA,EAAU,CAAA;AAAA,sBAC9D,GAAA,EAAA,EAAE,SAAA,EAAU,0CAA0C,QAAA,EAAA,YAAA,CAAa,MAAM,EAAE,GAAA,EAAI;AAAA,CAAA,EAClF,CAAA;AAIK,MAAM,iBAAgD,CAAC,EAAE,UAAA,EAAY,QAAA,EAAU,UAAS,KAAM;AACnG,EAAA,MAAM,MAAA,GAAS,cAAc,UAAU,CAAA;AACvC,EAAA,IAAI,MAAA,CAAO,SAAA,EAAW,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAS,CAAA;AACzC,EAAA,IAAI,QAAA,KAAa,MAAA;AACf,IAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA,OAAO,QAAA,KAAa,UAAA,GAAa,SAAS,EAAE,GAAG,MAAA,EAAQ,GAAG,YAAA,CAAa,MAAM,CAAA,EAAG,IAAI,QAAA,EAAS,CAAA;AACzG,EAAA,uBAAO,GAAA,CAAC,uBAAoB,MAAA,EAAgB,CAAA;AAC9C;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { S as Select } from './Select.js';
|
|
4
|
+
|
|
5
|
+
const RepositorySelector = forwardRef((props, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
Select,
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
label: "Repository",
|
|
10
|
+
placeholder: "Select repository",
|
|
11
|
+
searchable: true,
|
|
12
|
+
optionsEndpoint: "gitea-api/select-api/repositories",
|
|
13
|
+
fieldKeys: { valueKey: "name", labelKey: "name" },
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
));
|
|
17
|
+
RepositorySelector.displayName = "RepositorySelector";
|
|
18
|
+
|
|
19
|
+
export { RepositorySelector as R };
|
|
20
|
+
//# sourceMappingURL=RepositorySelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepositorySelector.js","sources":["../lib/selects/repository/RepositorySelector.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { Select, type SelectProps } from '../../components/Select/Select';\n\nexport type RepositorySelectorProps = Omit<SelectProps, 'optionsEndpoint'>;\n\n// Pre-configured Select for git repository selection with async search; repositories are keyed by name\nexport const RepositorySelector = forwardRef<HTMLButtonElement, RepositorySelectorProps>((props, ref) => (\n <Select\n ref={ref}\n label=\"Repository\"\n placeholder=\"Select repository\"\n searchable\n optionsEndpoint=\"gitea-api/select-api/repositories\"\n fieldKeys={{ valueKey: 'name', labelKey: 'name' }}\n {...props}\n />\n));\nRepositorySelector.displayName = 'RepositorySelector';\n"],"names":[],"mappings":";;;;AAMO,MAAM,kBAAA,GAAqB,UAAA,CAAuD,CAAC,KAAA,EAAO,GAAA,qBAC/F,GAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,GAAA;AAAA,IACA,KAAA,EAAM,YAAA;AAAA,IACN,WAAA,EAAY,mBAAA;AAAA,IACZ,UAAA,EAAU,IAAA;AAAA,IACV,eAAA,EAAgB,mCAAA;AAAA,IAChB,SAAA,EAAW,EAAE,QAAA,EAAU,MAAA,EAAQ,UAAU,MAAA,EAAO;AAAA,IAC/C,GAAG;AAAA;AACN,CACD;AACD,kBAAA,CAAmB,WAAA,GAAc,oBAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as PermissionGate, a as PermissionGateProvider, b as PermissionLockIcon, l as lockedTip, u as usePermission, c as usePermissionGate } from '../PermissionGate.js';
|
|
1
|
+
export { P as PermissionGate, a as PermissionGateProvider, b as PermissionLockIcon, S as SERVICE_LABELS, l as lockedTip, s as serviceLabels, u as usePermission, c as usePermissionGate } from '../PermissionGate.js';
|
|
2
2
|
//# sourceMappingURL=PermissionGate.js.map
|
package/dist/context/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { L as LayoutModeProvider, u as useLayoutMode } from '../
|
|
1
|
+
export { L as LayoutModeProvider, O as OrgContextProvider, u as useLayoutMode, a as useOrgContext, b as useOrgService } from '../OrgContext.js';
|
|
2
2
|
export { T as ThemeContext, a as ThemeProvider } from '../ThemeContext.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { c as cn } from './utils.js';
|
|
2
2
|
export { c as configureQuantumUI, d as defineConfig, g as getConfig, r as resetConfig } from './index8.js';
|
|
3
|
-
export { L as LayoutModeProvider, u as useLayoutMode } from './
|
|
3
|
+
export { L as LayoutModeProvider, O as OrgContextProvider, u as useLayoutMode, a as useOrgContext, b as useOrgService } from './OrgContext.js';
|
|
4
4
|
export { T as ThemeContext, a as ThemeProvider } from './ThemeContext.js';
|
|
5
5
|
export { u as useBarcodeScanner, a as useSSE, b as useSlugParams, c as useTimer } from './useTimer.js';
|
|
6
6
|
export { u as useBUCurrency, a as useFormatters } from './useFormatters.js';
|
|
@@ -74,7 +74,7 @@ export { O as OTPField } from './OTPField.js';
|
|
|
74
74
|
export { P as PageContent, a as PageContentDetails, b as PageContentPanel, c as PanelSkeleton, S as SidePanelListItem } from './PageContent.js';
|
|
75
75
|
export { P as PageHeader, a as PageHeaderSkeleton } from './PageHeaderSkeleton.js';
|
|
76
76
|
export { P as PasswordField } from './PasswordField.js';
|
|
77
|
-
export { P as PermissionGate, a as PermissionGateProvider, b as PermissionLockIcon, l as lockedTip, u as usePermission, c as usePermissionGate } from './PermissionGate.js';
|
|
77
|
+
export { P as PermissionGate, a as PermissionGateProvider, b as PermissionLockIcon, S as SERVICE_LABELS, l as lockedTip, s as serviceLabels, u as usePermission, c as usePermissionGate } from './PermissionGate.js';
|
|
78
78
|
export { P as PersonSelector } from './PersonSelector.js';
|
|
79
79
|
export { P as PhoneField } from './PhoneField.js';
|
|
80
80
|
export { P as PieChart } from './PieChart.js';
|
|
@@ -86,6 +86,7 @@ export { R as RadarChart } from './RadarChart.js';
|
|
|
86
86
|
export { R as RadialChart } from './RadialChart.js';
|
|
87
87
|
export { R as RadioGroup } from './RadioGroup.js';
|
|
88
88
|
export { R as RegionFilter, a as RegionSelector } from './RegionSelector.js';
|
|
89
|
+
export { R as RepositorySelector } from './RepositorySelector.js';
|
|
89
90
|
export { R as RichTextEditor } from './index38.js';
|
|
90
91
|
export { R as RoleSelector } from './RoleSelector.js';
|
|
91
92
|
export { S as SearchBar } from './SearchBar.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
import { ServiceCode } from '../../types/catalog-resolver';
|
|
3
|
+
export type PermissionLockReason = 'PLAN' | 'SITE' | 'SERVICE';
|
|
3
4
|
export interface PermissionGateResult {
|
|
4
5
|
granted: boolean;
|
|
5
6
|
locked: boolean;
|
|
6
7
|
reason: PermissionLockReason | null;
|
|
7
8
|
unlockPlans: string[];
|
|
9
|
+
missingServices: ServiceCode[];
|
|
8
10
|
available: boolean;
|
|
9
11
|
featureName: string | null;
|
|
10
12
|
}
|
|
@@ -16,7 +18,7 @@ export declare const PermissionLockIcon: React.FC<{
|
|
|
16
18
|
reason: PermissionLockReason | null;
|
|
17
19
|
className?: string;
|
|
18
20
|
}>;
|
|
19
|
-
export declare function lockedTip({ reason, unlockPlans }: Pick<PermissionGateResult, 'reason' | 'unlockPlans'>): string;
|
|
21
|
+
export declare function lockedTip({ reason, unlockPlans, missingServices, }: Pick<PermissionGateResult, 'reason' | 'unlockPlans'> & Partial<Pick<PermissionGateResult, 'missingServices'>>): string;
|
|
20
22
|
export interface PermissionGateProps {
|
|
21
23
|
permission?: string;
|
|
22
24
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionGate.d.ts","sourceRoot":"","sources":["../../../../lib/components/PermissionGate/PermissionGate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PermissionGate.d.ts","sourceRoot":"","sources":["../../../../lib/components/PermissionGate/PermissionGate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,eAAe,EAAE,WAAW,EAAE,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,oBAAoB,CAAC;AAoBtE,eAAO,MAAM,sBAAsB,yCAAiC,CAAC;AAGrE,wBAAgB,iBAAiB,IAAI,gBAAgB,CAEpD;AAGD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAGjE;AAID,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAYpG,CAAC;AAIF,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,WAAW,EACX,eAAoB,GACrB,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,aAAa,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAShE;AA8CD,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CACnH;AAWD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAMxD,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export { SERVICE_LABELS, serviceLabels } from '../../utils/services';
|
|
1
2
|
export { lockedTip, PermissionGate, type PermissionGateFn, type PermissionGateProps, PermissionGateProvider, type PermissionGateResult, PermissionLockIcon, type PermissionLockReason, usePermission, usePermissionGate, } from './PermissionGate';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/PermissionGate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/PermissionGate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EACL,SAAS,EACT,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ServiceCode } from '../types/catalog-resolver';
|
|
2
|
+
export interface OrgService {
|
|
3
|
+
service: ServiceCode;
|
|
4
|
+
externalId: string | null;
|
|
5
|
+
externalName: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface OrgContextValue {
|
|
8
|
+
id: string | null;
|
|
9
|
+
name: string | null;
|
|
10
|
+
subdomain: string | null;
|
|
11
|
+
logoUrl: string | null;
|
|
12
|
+
services: OrgService[];
|
|
13
|
+
}
|
|
14
|
+
export declare const OrgContextProvider: import('react').Provider<OrgContextValue>;
|
|
15
|
+
export declare function useOrgContext(): OrgContextValue;
|
|
16
|
+
export declare function useOrgService(service: ServiceCode): OrgService | null;
|
|
17
|
+
//# sourceMappingURL=OrgContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrgContext.d.ts","sourceRoot":"","sources":["../../../lib/context/OrgContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAI7D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAgBD,eAAO,MAAM,kBAAkB,2CAAsB,CAAC;AAGtD,wBAAgB,aAAa,IAAI,eAAe,CAE/C;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAGrE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { type LayoutMode, LayoutModeProvider, useLayoutMode } from './LayoutModeContext';
|
|
2
|
+
export { OrgContextProvider, type OrgContextValue, type OrgService, useOrgContext, useOrgService, } from './OrgContext';
|
|
2
3
|
export { ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, } from './ThemeContext';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,aAAa,EACb,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/selects/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/selects/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SelectProps } from '../../components/Select/Select';
|
|
2
|
+
export type RepositorySelectorProps = Omit<SelectProps, 'optionsEndpoint'>;
|
|
3
|
+
export declare const RepositorySelector: import('react').ForwardRefExoticComponent<RepositorySelectorProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
//# sourceMappingURL=RepositorySelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepositorySelector.d.ts","sourceRoot":"","sources":["../../../../lib/selects/repository/RepositorySelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAG3E,eAAO,MAAM,kBAAkB,uHAU7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/selects/repository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -39,6 +39,8 @@ export interface SnapshotMicrofrontends {
|
|
|
39
39
|
}
|
|
40
40
|
export type ScopeType = 'ORG' | 'LE' | 'SITE_GROUP' | 'SITE';
|
|
41
41
|
export type SiteType = 'OUTLET' | 'WAREHOUSE' | 'PRODUCTION';
|
|
42
|
+
export declare const SERVICE_CODES: readonly ["GITEA"];
|
|
43
|
+
export type ServiceCode = (typeof SERVICE_CODES)[number];
|
|
42
44
|
export interface SnapshotFeature {
|
|
43
45
|
code: string;
|
|
44
46
|
name: string;
|
|
@@ -49,6 +51,7 @@ export interface SnapshotFeature {
|
|
|
49
51
|
applicableSiteTypes: SiteType[];
|
|
50
52
|
permissions: SnapshotPermission[];
|
|
51
53
|
microfrontends: SnapshotMicrofrontends;
|
|
54
|
+
requiredServices?: ServiceCode[];
|
|
52
55
|
}
|
|
53
56
|
export interface SnapshotAppFeatureRef {
|
|
54
57
|
code: string;
|
|
@@ -100,12 +103,13 @@ export interface VersionSnapshot {
|
|
|
100
103
|
}
|
|
101
104
|
export declare function snapshotFeatureKey(code: string, scope: ScopeType): string;
|
|
102
105
|
export declare const SNAPSHOT_SCHEMA_VERSION = 2;
|
|
103
|
-
export type LockReason = 'PLAN' | 'SITE';
|
|
106
|
+
export type LockReason = 'PLAN' | 'SITE' | 'SERVICE';
|
|
104
107
|
export interface CatalogPermission {
|
|
105
108
|
code: string;
|
|
106
109
|
locked: boolean;
|
|
107
110
|
lockReason: LockReason | null;
|
|
108
111
|
unlockPlans: string[];
|
|
112
|
+
missingServices: ServiceCode[];
|
|
109
113
|
}
|
|
110
114
|
export interface FeatureCatalogEntry {
|
|
111
115
|
code: string;
|
|
@@ -131,6 +135,7 @@ export interface FeatureCatalogEntry {
|
|
|
131
135
|
locked: boolean;
|
|
132
136
|
lockReason: LockReason | null;
|
|
133
137
|
unlockPlans: string[];
|
|
138
|
+
missingServices: ServiceCode[];
|
|
134
139
|
permissions: CatalogPermission[];
|
|
135
140
|
}
|
|
136
141
|
export type RoleItem = SnapshotRoleTemplate;
|
|
@@ -179,6 +184,7 @@ export interface LockedPermission {
|
|
|
179
184
|
code: string;
|
|
180
185
|
reason: LockReason | null;
|
|
181
186
|
unlockPlans: string[];
|
|
187
|
+
missingServices: ServiceCode[];
|
|
182
188
|
}
|
|
183
189
|
export interface PlanUpsell {
|
|
184
190
|
plan: string;
|
|
@@ -194,6 +200,7 @@ export interface PermissionFeature {
|
|
|
194
200
|
locked: boolean;
|
|
195
201
|
lockReason: LockReason | null;
|
|
196
202
|
unlockPlans: string[];
|
|
203
|
+
missingServices: ServiceCode[];
|
|
197
204
|
lockedPermissions: LockedPermission[];
|
|
198
205
|
upsell: PlanUpsell[];
|
|
199
206
|
route: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-resolver.d.ts","sourceRoot":"","sources":["../../../lib/types/catalog-resolver.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,cAAc,EAAsB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtB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B,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../lib/utils/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAI7D,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAEtD,CAAC;AAGF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAK7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const PLATFORMS = ["web", "mobile"];
|
|
2
|
+
const SERVICE_CODES = ["GITEA"];
|
|
2
3
|
function snapshotFeatureKey(code, scope) {
|
|
3
4
|
return `${scope}.${code}`;
|
|
4
5
|
}
|
|
5
6
|
const SNAPSHOT_SCHEMA_VERSION = 2;
|
|
6
7
|
|
|
7
|
-
export { PLATFORMS, SNAPSHOT_SCHEMA_VERSION, snapshotFeatureKey };
|
|
8
|
+
export { PLATFORMS, SERVICE_CODES, SNAPSHOT_SCHEMA_VERSION, snapshotFeatureKey };
|
|
8
9
|
//# sourceMappingURL=catalog-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-resolver.js","sources":["../../lib/types/catalog-resolver.ts"],"sourcesContent":["// Frontend mirror of @vritti/api-sdk/catalog-resolver types — keep field-for-field in sync\nexport type PlatformBucket = 'web' | 'mobile';\n\nexport const PLATFORMS: PlatformBucket[] = ['web', 'mobile'];\n\nexport interface PlatformCodes {\n web?: string[];\n mobile?: string[];\n}\n\nexport interface PlatformDenyCodes {\n web?: string[] | null;\n mobile?: string[] | null;\n}\n\nexport type FeatureUnlocks = Record<string, PlatformCodes>;\n\nexport type FeatureLocks = Record<string, PlatformDenyCodes>;\nexport type SiteFeatureLocks = FeatureLocks;\n\nexport interface SnapshotPermission {\n code: string;\n label: string;\n isGlobal: boolean;\n businesses: string[];\n dependsOn: string[];\n}\n\nexport interface SnapshotMicrofrontendWeb {\n code: string;\n name: string;\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n}\n\nexport interface SnapshotMicrofrontendMobile {\n code: string;\n name: string;\n remoteEntryAndroid: string;\n remoteEntryIos: string;\n exposedModule: string;\n routePrefix: string;\n}\n\nexport interface SnapshotMicrofrontends {\n web?: SnapshotMicrofrontendWeb;\n mobile?: SnapshotMicrofrontendMobile;\n}\n\nexport type ScopeType = 'ORG' | 'LE' | 'SITE_GROUP' | 'SITE';\nexport type SiteType = 'OUTLET' | 'WAREHOUSE' | 'PRODUCTION';\nexport interface SnapshotFeature {\n code: string;\n name: string;\n lucideIcon: string;\n sfSymbol: string;\n materialSymbol: string;\n scope: ScopeType;\n applicableSiteTypes: SiteType[];\n permissions: SnapshotPermission[];\n microfrontends: SnapshotMicrofrontends;\n}\n\nexport interface SnapshotAppFeatureRef {\n code: string;\n scope: ScopeType;\n}\n\nexport interface SnapshotApp {\n code: string;\n name: string;\n icon: string;\n sortOrder: number;\n features: SnapshotAppFeatureRef[];\n}\n\nexport interface SnapshotRoleTemplate {\n name: string;\n code: string;\n scope: ScopeType;\n siteType: SiteType;\n features: FeatureUnlocks;\n}\n\nexport interface SnapshotPlan {\n code: string;\n name: string;\n isCustom: boolean;\n maxSites: number | null;\n unlockedPermissions: FeatureUnlocks;\n}\n\nexport interface VocabularyEntry {\n singular: string;\n plural: string;\n}\nexport interface BusinessVocabulary {\n site?: VocabularyEntry;\n siteGroup?: VocabularyEntry;\n outlet?: VocabularyEntry;\n warehouse?: VocabularyEntry;\n production?: VocabularyEntry;\n}\nexport interface SnapshotBusiness {\n name: string;\n vocabulary?: BusinessVocabulary;\n apps: SnapshotApp[];\n roleTemplates: Record<string, SnapshotRoleTemplate>;\n plans: Record<string, SnapshotPlan>;\n}\n\nexport interface VersionSnapshot {\n schemaVersion?: number;\n // Flat feature dictionary keyed by `${scope}.${code}` (see snapshotFeatureKey) — same-code features at different scopes stay distinct\n features: Record<string, SnapshotFeature>;\n businesses: Record<string, SnapshotBusiness>;\n}\n\n// Composite key for the snapshot feature dictionary — feature identity is (scope, code)\nexport function snapshotFeatureKey(code: string, scope: ScopeType): string {\n return `${scope}.${code}`;\n}\n\nexport const SNAPSHOT_SCHEMA_VERSION = 2;\n\nexport type LockReason = 'PLAN' | 'SITE';\n\nexport interface CatalogPermission {\n code: string;\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n}\n\nexport interface FeatureCatalogEntry {\n code: string;\n name: string;\n lucideIcon: string | null;\n sfSymbol: string;\n materialSymbol: string;\n web: {\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n } | null;\n mobile: {\n remoteEntryAndroid: string;\n remoteEntryIos: string;\n exposedModule: string;\n routePrefix: string;\n } | null;\n appCode: string;\n appName: string;\n appIcon: string | null;\n appSortOrder: number;\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n permissions: CatalogPermission[];\n}\n\nexport type RoleItem = SnapshotRoleTemplate;\n\nexport interface SiteMatrixCell {\n inPlan: boolean;\n selected: boolean;\n availableIn: string[];\n}\n\nexport interface SiteMatrixPermission {\n code: string;\n label: string;\n dependsOn: string[];\n web: SiteMatrixCell | null;\n mobile: SiteMatrixCell | null;\n}\n\nexport interface SiteMatrixFeature {\n code: string;\n name: string;\n icon: string | null;\n scope: ScopeType;\n applicableSiteTypes: SiteType[];\n platforms: PlatformBucket[];\n inPlan: boolean;\n availableIn: string[];\n permissions: SiteMatrixPermission[];\n}\n\nexport interface SiteMatrixApp {\n code: string;\n name: string;\n icon: string | null;\n unlockedCount: number;\n totalCount: number;\n features: SiteMatrixFeature[];\n}\n\nexport interface SiteMatrix {\n plan: { code: string; name: string };\n apps: SiteMatrixApp[];\n locks: SiteFeatureLocks;\n}\n\nexport type RevokedGrants = Record<string, PlatformDenyCodes>;\n\nexport type ClientPlatform = 'web' | 'ios' | 'android';\n\nexport interface LockedPermission {\n code: string;\n reason: LockReason | null;\n unlockPlans: string[];\n}\n\nexport interface PlanUpsell {\n plan: string;\n features: string[];\n}\n\nexport interface PermissionFeature {\n code: string;\n name: string;\n lucideIcon: string | null;\n sfSymbol: string;\n materialSymbol: string;\n permissions: string[];\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n lockedPermissions: LockedPermission[];\n upsell: PlanUpsell[];\n route: {\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n };\n appCode: string;\n appName: string;\n appIcon: string | null;\n appSortOrder: number;\n}\n\nexport interface ResolveUserFeaturesParams {\n snapshot: VersionSnapshot;\n businessCode: string;\n planCode: string | undefined;\n siteLocks: SiteFeatureLocks | undefined;\n roleFeatures: FeatureUnlocks;\n platform: ClientPlatform;\n}\n\nexport interface ComposeRoleGrantsParams {\n baseFeatures: FeatureUnlocks | undefined;\n additions: FeatureUnlocks;\n revoked: RevokedGrants | undefined;\n}\n"],"names":[],"mappings":"AAGO,MAAM,SAAA,GAA8B,CAAC,KAAA,EAAO,QAAQ;
|
|
1
|
+
{"version":3,"file":"catalog-resolver.js","sources":["../../lib/types/catalog-resolver.ts"],"sourcesContent":["// Frontend mirror of @vritti/api-sdk/catalog-resolver types — keep field-for-field in sync\nexport type PlatformBucket = 'web' | 'mobile';\n\nexport const PLATFORMS: PlatformBucket[] = ['web', 'mobile'];\n\nexport interface PlatformCodes {\n web?: string[];\n mobile?: string[];\n}\n\nexport interface PlatformDenyCodes {\n web?: string[] | null;\n mobile?: string[] | null;\n}\n\nexport type FeatureUnlocks = Record<string, PlatformCodes>;\n\nexport type FeatureLocks = Record<string, PlatformDenyCodes>;\nexport type SiteFeatureLocks = FeatureLocks;\n\nexport interface SnapshotPermission {\n code: string;\n label: string;\n isGlobal: boolean;\n businesses: string[];\n dependsOn: string[];\n}\n\nexport interface SnapshotMicrofrontendWeb {\n code: string;\n name: string;\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n}\n\nexport interface SnapshotMicrofrontendMobile {\n code: string;\n name: string;\n remoteEntryAndroid: string;\n remoteEntryIos: string;\n exposedModule: string;\n routePrefix: string;\n}\n\nexport interface SnapshotMicrofrontends {\n web?: SnapshotMicrofrontendWeb;\n mobile?: SnapshotMicrofrontendMobile;\n}\n\nexport type ScopeType = 'ORG' | 'LE' | 'SITE_GROUP' | 'SITE';\nexport type SiteType = 'OUTLET' | 'WAREHOUSE' | 'PRODUCTION';\nexport const SERVICE_CODES = ['GITEA'] as const;\nexport type ServiceCode = (typeof SERVICE_CODES)[number];\nexport interface SnapshotFeature {\n code: string;\n name: string;\n lucideIcon: string;\n sfSymbol: string;\n materialSymbol: string;\n scope: ScopeType;\n applicableSiteTypes: SiteType[];\n permissions: SnapshotPermission[];\n microfrontends: SnapshotMicrofrontends;\n requiredServices?: ServiceCode[];\n}\n\nexport interface SnapshotAppFeatureRef {\n code: string;\n scope: ScopeType;\n}\n\nexport interface SnapshotApp {\n code: string;\n name: string;\n icon: string;\n sortOrder: number;\n features: SnapshotAppFeatureRef[];\n}\n\nexport interface SnapshotRoleTemplate {\n name: string;\n code: string;\n scope: ScopeType;\n siteType: SiteType;\n features: FeatureUnlocks;\n}\n\nexport interface SnapshotPlan {\n code: string;\n name: string;\n isCustom: boolean;\n maxSites: number | null;\n unlockedPermissions: FeatureUnlocks;\n}\n\nexport interface VocabularyEntry {\n singular: string;\n plural: string;\n}\nexport interface BusinessVocabulary {\n site?: VocabularyEntry;\n siteGroup?: VocabularyEntry;\n outlet?: VocabularyEntry;\n warehouse?: VocabularyEntry;\n production?: VocabularyEntry;\n}\nexport interface SnapshotBusiness {\n name: string;\n vocabulary?: BusinessVocabulary;\n apps: SnapshotApp[];\n roleTemplates: Record<string, SnapshotRoleTemplate>;\n plans: Record<string, SnapshotPlan>;\n}\n\nexport interface VersionSnapshot {\n schemaVersion?: number;\n // Flat feature dictionary keyed by `${scope}.${code}` (see snapshotFeatureKey) — same-code features at different scopes stay distinct\n features: Record<string, SnapshotFeature>;\n businesses: Record<string, SnapshotBusiness>;\n}\n\n// Composite key for the snapshot feature dictionary — feature identity is (scope, code)\nexport function snapshotFeatureKey(code: string, scope: ScopeType): string {\n return `${scope}.${code}`;\n}\n\nexport const SNAPSHOT_SCHEMA_VERSION = 2;\n\nexport type LockReason = 'PLAN' | 'SITE' | 'SERVICE';\n\nexport interface CatalogPermission {\n code: string;\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n missingServices: ServiceCode[];\n}\n\nexport interface FeatureCatalogEntry {\n code: string;\n name: string;\n lucideIcon: string | null;\n sfSymbol: string;\n materialSymbol: string;\n web: {\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n } | null;\n mobile: {\n remoteEntryAndroid: string;\n remoteEntryIos: string;\n exposedModule: string;\n routePrefix: string;\n } | null;\n appCode: string;\n appName: string;\n appIcon: string | null;\n appSortOrder: number;\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n missingServices: ServiceCode[];\n permissions: CatalogPermission[];\n}\n\nexport type RoleItem = SnapshotRoleTemplate;\n\nexport interface SiteMatrixCell {\n inPlan: boolean;\n selected: boolean;\n availableIn: string[];\n}\n\nexport interface SiteMatrixPermission {\n code: string;\n label: string;\n dependsOn: string[];\n web: SiteMatrixCell | null;\n mobile: SiteMatrixCell | null;\n}\n\nexport interface SiteMatrixFeature {\n code: string;\n name: string;\n icon: string | null;\n scope: ScopeType;\n applicableSiteTypes: SiteType[];\n platforms: PlatformBucket[];\n inPlan: boolean;\n availableIn: string[];\n permissions: SiteMatrixPermission[];\n}\n\nexport interface SiteMatrixApp {\n code: string;\n name: string;\n icon: string | null;\n unlockedCount: number;\n totalCount: number;\n features: SiteMatrixFeature[];\n}\n\nexport interface SiteMatrix {\n plan: { code: string; name: string };\n apps: SiteMatrixApp[];\n locks: SiteFeatureLocks;\n}\n\nexport type RevokedGrants = Record<string, PlatformDenyCodes>;\n\nexport type ClientPlatform = 'web' | 'ios' | 'android';\n\nexport interface LockedPermission {\n code: string;\n reason: LockReason | null;\n unlockPlans: string[];\n missingServices: ServiceCode[];\n}\n\nexport interface PlanUpsell {\n plan: string;\n features: string[];\n}\n\nexport interface PermissionFeature {\n code: string;\n name: string;\n lucideIcon: string | null;\n sfSymbol: string;\n materialSymbol: string;\n permissions: string[];\n locked: boolean;\n lockReason: LockReason | null;\n unlockPlans: string[];\n // Which declared services the org has not provisioned — empty unless lockReason is 'SERVICE'\n missingServices: ServiceCode[];\n lockedPermissions: LockedPermission[];\n upsell: PlanUpsell[];\n route: {\n remoteEntry: string;\n exposedModule: string;\n routePrefix: string;\n };\n appCode: string;\n appName: string;\n appIcon: string | null;\n appSortOrder: number;\n}\n\nexport interface ResolveUserFeaturesParams {\n snapshot: VersionSnapshot;\n businessCode: string;\n planCode: string | undefined;\n siteLocks: SiteFeatureLocks | undefined;\n roleFeatures: FeatureUnlocks;\n platform: ClientPlatform;\n}\n\nexport interface ComposeRoleGrantsParams {\n baseFeatures: FeatureUnlocks | undefined;\n additions: FeatureUnlocks;\n revoked: RevokedGrants | undefined;\n}\n"],"names":[],"mappings":"AAGO,MAAM,SAAA,GAA8B,CAAC,KAAA,EAAO,QAAQ;AAiDpD,MAAM,aAAA,GAAgB,CAAC,OAAO;AAuE9B,SAAS,kBAAA,CAAmB,MAAc,KAAA,EAA0B;AACzE,EAAA,OAAO,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AACzB;AAEO,MAAM,uBAAA,GAA0B;;;;"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.3.
|
|
8
|
+
"version": "0.3.17",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
11
11
|
"repository": {
|
|
@@ -184,6 +184,10 @@
|
|
|
184
184
|
"types": "./dist/lib/selects/region/index.d.ts",
|
|
185
185
|
"import": "./dist/selects/region.js"
|
|
186
186
|
},
|
|
187
|
+
"./selects/repository": {
|
|
188
|
+
"types": "./dist/lib/selects/repository/index.d.ts",
|
|
189
|
+
"import": "./dist/selects/repository.js"
|
|
190
|
+
},
|
|
187
191
|
"./selects/plan": {
|
|
188
192
|
"types": "./dist/lib/selects/plan/index.d.ts",
|
|
189
193
|
"import": "./dist/selects/plan.js"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useMemo, useContext, createContext } from 'react';
|
|
3
|
-
|
|
4
|
-
const LayoutModeContext = createContext({
|
|
5
|
-
mode: "padded",
|
|
6
|
-
setMode: () => {
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
const LayoutModeProvider = ({ children }) => {
|
|
10
|
-
const [mode, setMode] = useState("padded");
|
|
11
|
-
const value = useMemo(() => ({ mode, setMode }), [mode]);
|
|
12
|
-
return /* @__PURE__ */ jsx(LayoutModeContext.Provider, { value, children });
|
|
13
|
-
};
|
|
14
|
-
function useLayoutMode() {
|
|
15
|
-
return useContext(LayoutModeContext);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { LayoutModeProvider as L, useLayoutMode as u };
|
|
19
|
-
//# sourceMappingURL=LayoutModeContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutModeContext.js","sources":["../lib/context/LayoutModeContext.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo, useState } from 'react';\n\nexport type LayoutMode = 'padded' | 'full';\n\ninterface LayoutModeContextValue {\n mode: LayoutMode;\n setMode: (mode: LayoutMode) => void;\n}\n\nconst LayoutModeContext = createContext<LayoutModeContextValue>({\n mode: 'padded',\n setMode: () => {},\n});\n\nexport const LayoutModeProvider = ({ children }: { children: ReactNode }) => {\n const [mode, setMode] = useState<LayoutMode>('padded');\n const value = useMemo(() => ({ mode, setMode }), [mode]);\n return <LayoutModeContext.Provider value={value}>{children}</LayoutModeContext.Provider>;\n};\n\n// Returns current layout mode and a setter; MF pages set 'full' on mount and reset to 'padded' on unmount.\nexport function useLayoutMode(): LayoutModeContextValue {\n return useContext(LayoutModeContext);\n}\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB,aAAA,CAAsC;AAAA,EAC9D,IAAA,EAAM,QAAA;AAAA,EACN,SAAS,MAAM;AAAA,EAAC;AAClB,CAAC,CAAA;AAEM,MAAM,kBAAA,GAAqB,CAAC,EAAE,QAAA,EAAS,KAA+B;AAC3E,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAqB,QAAQ,CAAA;AACrD,EAAA,MAAM,KAAA,GAAQ,QAAQ,OAAO,EAAE,MAAM,OAAA,EAAQ,CAAA,EAAI,CAAC,IAAI,CAAC,CAAA;AACvD,EAAA,uBAAO,GAAA,CAAC,iBAAA,CAAkB,QAAA,EAAlB,EAA2B,OAAe,QAAA,EAAS,CAAA;AAC7D;AAGO,SAAS,aAAA,GAAwC;AACtD,EAAA,OAAO,WAAW,iBAAiB,CAAA;AACrC;;;;"}
|