@bytexbyte/nxtlinq-ai-agent-sdk 1.6.25 → 1.6.26
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4mBxD,CAAC"}
|
|
@@ -11,12 +11,29 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
11
11
|
const [isSaving, setIsSaving] = React.useState(false);
|
|
12
12
|
const [tempPermissions, setTempPermissions] = React.useState(permissions);
|
|
13
13
|
const [hasUserInteracted, setHasUserInteracted] = React.useState(false);
|
|
14
|
+
// Check if ALL permission is selected
|
|
15
|
+
const isAllSelected = tempPermissions.includes('ALL');
|
|
14
16
|
// Update temp permissions when permissions change, but only if user hasn't interacted
|
|
15
17
|
React.useEffect(() => {
|
|
16
18
|
if (!hasUserInteracted) {
|
|
17
19
|
setTempPermissions(permissions);
|
|
18
20
|
}
|
|
19
21
|
}, [permissions, hasUserInteracted]);
|
|
22
|
+
// When ALL is selected, automatically select all other permissions
|
|
23
|
+
// This handles cases where ALL is set from initial permissions or when availablePermissions loads
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (isAllSelected && availablePermissions.length > 0) {
|
|
26
|
+
const allPermissionLabels = availablePermissions.map(p => p.label);
|
|
27
|
+
const currentPermissionSet = new Set(tempPermissions);
|
|
28
|
+
// Check if all permissions are already selected
|
|
29
|
+
const hasAllPermissions = allPermissionLabels.every(label => currentPermissionSet.has(label));
|
|
30
|
+
if (!hasAllPermissions) {
|
|
31
|
+
// Add all permissions (this will include ALL and all others)
|
|
32
|
+
setTempPermissions([...allPermissionLabels].sort());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
}, [isAllSelected, availablePermissions.length]);
|
|
20
37
|
const fetchAvailablePermissions = async () => {
|
|
21
38
|
if (!serviceId)
|
|
22
39
|
return;
|
|
@@ -343,37 +360,65 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
343
360
|
overflow-y: auto !important;
|
|
344
361
|
overflow-x: hidden !important;
|
|
345
362
|
min-height: 0 !important;
|
|
346
|
-
`, children: availablePermissions.map((permission) =>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
363
|
+
`, children: availablePermissions.map((permission) => {
|
|
364
|
+
const isAllPermission = permission.label === 'ALL';
|
|
365
|
+
const isOtherPermissionDisabled = isAllSelected && !isAllPermission;
|
|
366
|
+
const isChecked = isAllSelected && !isAllPermission
|
|
367
|
+
? true
|
|
368
|
+
: tempPermissions.includes(permission.label);
|
|
369
|
+
return (_jsx("div", { css: css `margin-bottom: 12px !important;`, children: _jsxs("label", { css: css `
|
|
370
|
+
display: flex !important;
|
|
371
|
+
align-items: center !important;
|
|
372
|
+
gap: 12px !important;
|
|
373
|
+
cursor: ${isAITLoading || isOtherPermissionDisabled ? 'not-allowed' : 'pointer'} !important;
|
|
374
|
+
padding: 8px !important;
|
|
375
|
+
border-radius: 6px !important;
|
|
376
|
+
transition: background-color 0.2s !important;
|
|
377
|
+
opacity: ${isAITLoading || isOtherPermissionDisabled ? 0.6 : 1} !important;
|
|
378
|
+
|
|
379
|
+
&:hover {
|
|
380
|
+
background-color: ${!isAITLoading && !isOtherPermissionDisabled ? '#e9ecef' : 'transparent'} !important;
|
|
381
|
+
}
|
|
382
|
+
`, children: [_jsx("input", { type: "checkbox", checked: isChecked, onChange: () => {
|
|
383
|
+
if (!isAITLoading) {
|
|
384
|
+
if (isAllPermission) {
|
|
385
|
+
// Handle ALL permission toggle
|
|
386
|
+
if (isAllSelected) {
|
|
387
|
+
// Unchecking ALL - keep all other permissions selected
|
|
388
|
+
// Get all permission labels except ALL
|
|
389
|
+
const allOtherPermissions = availablePermissions
|
|
390
|
+
.map(p => p.label)
|
|
391
|
+
.filter(label => label !== 'ALL');
|
|
392
|
+
setTempPermissions(allOtherPermissions.sort());
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
// Checking ALL - add all permissions
|
|
396
|
+
const allPermissionLabels = availablePermissions.map(p => p.label);
|
|
397
|
+
setTempPermissions(allPermissionLabels.sort());
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
// Handle other permissions (only if ALL is not selected)
|
|
402
|
+
if (!isAllSelected) {
|
|
403
|
+
const newPermissions = tempPermissions.includes(permission.label)
|
|
404
|
+
? tempPermissions.filter(p => p !== permission.label)
|
|
405
|
+
: [...tempPermissions, permission.label].sort();
|
|
406
|
+
setTempPermissions(newPermissions);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
setHasUserInteracted(true);
|
|
410
|
+
setIsDisabled(false);
|
|
411
|
+
}
|
|
412
|
+
}, disabled: isAITLoading || isOtherPermissionDisabled, css: css `
|
|
413
|
+
margin: 0 !important;
|
|
414
|
+
width: 18px !important;
|
|
415
|
+
height: 18px !important;
|
|
416
|
+
cursor: ${isAITLoading || isOtherPermissionDisabled ? 'not-allowed' : 'pointer'} !important;
|
|
417
|
+
` }), _jsx("span", { css: css `
|
|
418
|
+
font-size: 14px !important;
|
|
419
|
+
color: ${isOtherPermissionDisabled ? '#999' : '#333'} !important;
|
|
420
|
+
`, children: permission.label })] }) }, permission.id));
|
|
421
|
+
}) }))] }), _jsxs("div", { css: css `
|
|
377
422
|
display: flex !important;
|
|
378
423
|
justify-content: flex-end !important;
|
|
379
424
|
gap: 12px !important;
|
package/package.json
CHANGED