@iblai/web-containers 0.0.5 → 0.0.6
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/components/profile/invite-user.d.ts +2 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +125 -58
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +125 -58
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/dist/index.css +0 -2138
- package/dist/index.esm.css +0 -2138
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare function InviteUserDialog({ tenant, onSeeAllInvitedUsersClick, onClose, }: {
|
|
1
|
+
export declare function InviteUserDialog({ tenant, onSeeAllInvitedUsersClick, onClose, isOpen, }: {
|
|
2
2
|
tenant: string;
|
|
3
3
|
onSeeAllInvitedUsersClick: () => void;
|
|
4
4
|
onClose: () => void;
|
|
5
|
+
isOpen: boolean;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -3889,7 +3889,7 @@ const oppositeAlignmentMap = {
|
|
|
3889
3889
|
function clamp(start, value, end) {
|
|
3890
3890
|
return max(start, min(value, end));
|
|
3891
3891
|
}
|
|
3892
|
-
function evaluate(value, param) {
|
|
3892
|
+
function evaluate$1(value, param) {
|
|
3893
3893
|
return typeof value === 'function' ? value(param) : value;
|
|
3894
3894
|
}
|
|
3895
3895
|
function getSide(placement) {
|
|
@@ -4171,7 +4171,7 @@ async function detectOverflow(state, options) {
|
|
|
4171
4171
|
elementContext = 'floating',
|
|
4172
4172
|
altBoundary = false,
|
|
4173
4173
|
padding = 0
|
|
4174
|
-
} = evaluate(options, state);
|
|
4174
|
+
} = evaluate$1(options, state);
|
|
4175
4175
|
const paddingObject = getPaddingObject(padding);
|
|
4176
4176
|
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
4177
4177
|
const element = elements[altBoundary ? altContext : elementContext];
|
|
@@ -4231,7 +4231,7 @@ const arrow$3 = options => ({
|
|
|
4231
4231
|
const {
|
|
4232
4232
|
element,
|
|
4233
4233
|
padding = 0
|
|
4234
|
-
} = evaluate(options, state) || {};
|
|
4234
|
+
} = evaluate$1(options, state) || {};
|
|
4235
4235
|
if (element == null) {
|
|
4236
4236
|
return {};
|
|
4237
4237
|
}
|
|
@@ -4322,7 +4322,7 @@ const flip$2 = function (options) {
|
|
|
4322
4322
|
fallbackAxisSideDirection = 'none',
|
|
4323
4323
|
flipAlignment = true,
|
|
4324
4324
|
...detectOverflowOptions
|
|
4325
|
-
} = evaluate(options, state);
|
|
4325
|
+
} = evaluate$1(options, state);
|
|
4326
4326
|
|
|
4327
4327
|
// If a reset by the arrow was caused due to an alignment offset being
|
|
4328
4328
|
// added, we should skip any logic now since `flip()` has already done its
|
|
@@ -4452,7 +4452,7 @@ const hide$2 = function (options) {
|
|
|
4452
4452
|
const {
|
|
4453
4453
|
strategy = 'referenceHidden',
|
|
4454
4454
|
...detectOverflowOptions
|
|
4455
|
-
} = evaluate(options, state);
|
|
4455
|
+
} = evaluate$1(options, state);
|
|
4456
4456
|
switch (strategy) {
|
|
4457
4457
|
case 'referenceHidden':
|
|
4458
4458
|
{
|
|
@@ -4506,7 +4506,7 @@ async function convertValueToCoords(state, options) {
|
|
|
4506
4506
|
const isVertical = getSideAxis(placement) === 'y';
|
|
4507
4507
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
4508
4508
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
4509
|
-
const rawValue = evaluate(options, state);
|
|
4509
|
+
const rawValue = evaluate$1(options, state);
|
|
4510
4510
|
|
|
4511
4511
|
// eslint-disable-next-line prefer-const
|
|
4512
4512
|
let {
|
|
@@ -4609,7 +4609,7 @@ const shift$2 = function (options) {
|
|
|
4609
4609
|
}
|
|
4610
4610
|
},
|
|
4611
4611
|
...detectOverflowOptions
|
|
4612
|
-
} = evaluate(options, state);
|
|
4612
|
+
} = evaluate$1(options, state);
|
|
4613
4613
|
const coords = {
|
|
4614
4614
|
x,
|
|
4615
4615
|
y
|
|
@@ -4673,7 +4673,7 @@ const limitShift$2 = function (options) {
|
|
|
4673
4673
|
offset = 0,
|
|
4674
4674
|
mainAxis: checkMainAxis = true,
|
|
4675
4675
|
crossAxis: checkCrossAxis = true
|
|
4676
|
-
} = evaluate(options, state);
|
|
4676
|
+
} = evaluate$1(options, state);
|
|
4677
4677
|
const coords = {
|
|
4678
4678
|
x,
|
|
4679
4679
|
y
|
|
@@ -4682,7 +4682,7 @@ const limitShift$2 = function (options) {
|
|
|
4682
4682
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
4683
4683
|
let mainAxisCoord = coords[mainAxis];
|
|
4684
4684
|
let crossAxisCoord = coords[crossAxis];
|
|
4685
|
-
const rawOffset = evaluate(offset, state);
|
|
4685
|
+
const rawOffset = evaluate$1(offset, state);
|
|
4686
4686
|
const computedOffset = typeof rawOffset === 'number' ? {
|
|
4687
4687
|
mainAxis: rawOffset,
|
|
4688
4688
|
crossAxis: 0
|
|
@@ -4745,7 +4745,7 @@ const size$2 = function (options) {
|
|
|
4745
4745
|
const {
|
|
4746
4746
|
apply = () => {},
|
|
4747
4747
|
...detectOverflowOptions
|
|
4748
|
-
} = evaluate(options, state);
|
|
4748
|
+
} = evaluate$1(options, state);
|
|
4749
4749
|
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
4750
4750
|
const side = getSide(placement);
|
|
4751
4751
|
const alignment = getAlignment(placement);
|
|
@@ -10110,7 +10110,7 @@ var Close$1 = ToastClose$1;
|
|
|
10110
10110
|
const ToastProvider = Provider;
|
|
10111
10111
|
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => (jsx(Viewport, { ref: ref, className: cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]", className), ...props })));
|
|
10112
10112
|
ToastViewport.displayName = Viewport.displayName;
|
|
10113
|
-
const toastVariants = cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-
|
|
10113
|
+
const toastVariants = cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full", {
|
|
10114
10114
|
variants: {
|
|
10115
10115
|
variant: {
|
|
10116
10116
|
default: "border bg-background text-foreground",
|
|
@@ -10125,11 +10125,11 @@ const Toast = React.forwardRef(({ className, variant, ...props }, ref) => {
|
|
|
10125
10125
|
return (jsx(Root2, { ref: ref, className: cn(toastVariants({ variant }), className), ...props }));
|
|
10126
10126
|
});
|
|
10127
10127
|
Toast.displayName = Root2.displayName;
|
|
10128
|
-
const ToastAction = React.forwardRef(({ className, ...props }, ref) => (jsx(Action, { ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-
|
|
10128
|
+
const ToastAction = React.forwardRef(({ className, ...props }, ref) => (jsx(Action, { ref: ref, className: cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive", className), ...props })));
|
|
10129
10129
|
ToastAction.displayName = Action.displayName;
|
|
10130
|
-
const ToastClose = React.forwardRef(({ className, ...props }, ref) => (jsx(Close$1, { ref: ref, className: cn("absolute right-
|
|
10130
|
+
const ToastClose = React.forwardRef(({ className, ...props }, ref) => (jsx(Close$1, { ref: ref, className: cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600", className), "toast-close": "", ...props, children: jsx(X, { className: "h-4 w-4" }) })));
|
|
10131
10131
|
ToastClose.displayName = Close$1.displayName;
|
|
10132
|
-
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => (jsx(Title$1, { ref: ref, className: cn("text-sm font-semibold
|
|
10132
|
+
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => (jsx(Title$1, { ref: ref, className: cn("text-sm font-semibold", className), ...props })));
|
|
10133
10133
|
ToastTitle.displayName = Title$1.displayName;
|
|
10134
10134
|
const ToastDescription = React.forwardRef(({ className, ...props }, ref) => (jsx(Description$1, { ref: ref, className: cn("text-sm opacity-90", className), ...props })));
|
|
10135
10135
|
ToastDescription.displayName = Description$1.displayName;
|
|
@@ -11049,7 +11049,7 @@ function getSyncValidatorArray(cause, options) {
|
|
|
11049
11049
|
const isGlobalFormValidationError = (error) => {
|
|
11050
11050
|
return !!error && typeof error === "object" && "fields" in error;
|
|
11051
11051
|
};
|
|
11052
|
-
function
|
|
11052
|
+
function evaluate(objA, objB) {
|
|
11053
11053
|
if (Object.is(objA, objB)) {
|
|
11054
11054
|
return true;
|
|
11055
11055
|
}
|
|
@@ -11071,11 +11071,12 @@ function shallow$1(objA, objB) {
|
|
|
11071
11071
|
return true;
|
|
11072
11072
|
}
|
|
11073
11073
|
const keysA = Object.keys(objA);
|
|
11074
|
-
|
|
11074
|
+
const keysB = Object.keys(objB);
|
|
11075
|
+
if (keysA.length !== keysB.length) {
|
|
11075
11076
|
return false;
|
|
11076
11077
|
}
|
|
11077
|
-
for (
|
|
11078
|
-
if (!
|
|
11078
|
+
for (const key of keysA) {
|
|
11079
|
+
if (!keysB.includes(key) || !evaluate(objA[key], objB[key])) {
|
|
11079
11080
|
return false;
|
|
11080
11081
|
}
|
|
11081
11082
|
}
|
|
@@ -11162,6 +11163,7 @@ const defaultFieldMeta = {
|
|
|
11162
11163
|
isDirty: false,
|
|
11163
11164
|
isPristine: true,
|
|
11164
11165
|
isValid: true,
|
|
11166
|
+
isDefaultValue: true,
|
|
11165
11167
|
errors: [],
|
|
11166
11168
|
errorMap: {},
|
|
11167
11169
|
errorSourceMap: {}
|
|
@@ -11323,8 +11325,8 @@ class FormApi {
|
|
|
11323
11325
|
const shouldUpdateReeval = !!((_b = (_a2 = options.transform) == null ? void 0 : _a2.deps) == null ? void 0 : _b.some(
|
|
11324
11326
|
(val, i) => val !== this.prevTransformArray[i]
|
|
11325
11327
|
));
|
|
11326
|
-
const shouldUpdateValues = options.defaultValues && !
|
|
11327
|
-
const shouldUpdateState = !
|
|
11328
|
+
const shouldUpdateValues = options.defaultValues && !evaluate(options.defaultValues, oldOptions.defaultValues) && !this.state.isTouched;
|
|
11329
|
+
const shouldUpdateState = !evaluate(options.defaultState, oldOptions.defaultState) && !this.state.isTouched;
|
|
11328
11330
|
if (!shouldUpdateValues && !shouldUpdateState && !shouldUpdateReeval) return;
|
|
11329
11331
|
batch(() => {
|
|
11330
11332
|
this.baseStore.setState(
|
|
@@ -11812,10 +11814,7 @@ class FormApi {
|
|
|
11812
11814
|
...prev.fieldMetaBase,
|
|
11813
11815
|
[field]: defaultFieldMeta
|
|
11814
11816
|
},
|
|
11815
|
-
values:
|
|
11816
|
-
...prev.values,
|
|
11817
|
-
[field]: this.options.defaultValues && this.options.defaultValues[field]
|
|
11818
|
-
}
|
|
11817
|
+
values: this.options.defaultValues ? setBy(prev.values, field, getBy(this.options.defaultValues, field)) : prev.values
|
|
11819
11818
|
};
|
|
11820
11819
|
});
|
|
11821
11820
|
};
|
|
@@ -11860,7 +11859,7 @@ class FormApi {
|
|
|
11860
11859
|
this.fieldMetaDerived = new Derived({
|
|
11861
11860
|
deps: [this.baseStore],
|
|
11862
11861
|
fn: ({ prevDepVals, currDepVals, prevVal: _prevVal }) => {
|
|
11863
|
-
var _a2;
|
|
11862
|
+
var _a2, _b, _c;
|
|
11864
11863
|
const prevVal = _prevVal;
|
|
11865
11864
|
const prevBaseStore = prevDepVals == null ? void 0 : prevDepVals[0];
|
|
11866
11865
|
const currBaseStore = currDepVals[0];
|
|
@@ -11869,12 +11868,13 @@ class FormApi {
|
|
|
11869
11868
|
for (const fieldName of Object.keys(
|
|
11870
11869
|
currBaseStore.fieldMetaBase
|
|
11871
11870
|
)) {
|
|
11872
|
-
const
|
|
11873
|
-
const
|
|
11871
|
+
const currBaseMeta = currBaseStore.fieldMetaBase[fieldName];
|
|
11872
|
+
const prevBaseMeta = prevBaseStore == null ? void 0 : prevBaseStore.fieldMetaBase[fieldName];
|
|
11874
11873
|
const prevFieldInfo = prevVal == null ? void 0 : prevVal[fieldName];
|
|
11874
|
+
const curFieldVal = getBy(currBaseStore.values, fieldName);
|
|
11875
11875
|
let fieldErrors = prevFieldInfo == null ? void 0 : prevFieldInfo.errors;
|
|
11876
|
-
if (!
|
|
11877
|
-
fieldErrors = Object.values(
|
|
11876
|
+
if (!prevBaseMeta || currBaseMeta.errorMap !== prevBaseMeta.errorMap) {
|
|
11877
|
+
fieldErrors = Object.values(currBaseMeta.errorMap ?? {}).filter(
|
|
11878
11878
|
(val) => val !== void 0
|
|
11879
11879
|
);
|
|
11880
11880
|
const fieldInstance = (_a2 = this.getFieldInfo(fieldName)) == null ? void 0 : _a2.instance;
|
|
@@ -11884,18 +11884,27 @@ class FormApi {
|
|
|
11884
11884
|
);
|
|
11885
11885
|
}
|
|
11886
11886
|
}
|
|
11887
|
-
const isFieldPristine = !currBaseVal.isDirty;
|
|
11888
11887
|
const isFieldValid = !isNonEmptyArray(fieldErrors ?? []);
|
|
11889
|
-
|
|
11888
|
+
const isFieldPristine = !currBaseMeta.isDirty;
|
|
11889
|
+
const isDefaultValue = evaluate(
|
|
11890
|
+
curFieldVal,
|
|
11891
|
+
getBy(this.options.defaultValues, fieldName)
|
|
11892
|
+
) || evaluate(
|
|
11893
|
+
curFieldVal,
|
|
11894
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
11895
|
+
(_c = (_b = this.getFieldInfo(fieldName)) == null ? void 0 : _b.instance) == null ? void 0 : _c.options.defaultValue
|
|
11896
|
+
);
|
|
11897
|
+
if (prevFieldInfo && prevFieldInfo.isPristine === isFieldPristine && prevFieldInfo.isValid === isFieldValid && prevFieldInfo.isDefaultValue === isDefaultValue && prevFieldInfo.errors === fieldErrors && currBaseMeta === prevBaseMeta) {
|
|
11890
11898
|
fieldMeta[fieldName] = prevFieldInfo;
|
|
11891
11899
|
originalMetaCount++;
|
|
11892
11900
|
continue;
|
|
11893
11901
|
}
|
|
11894
11902
|
fieldMeta[fieldName] = {
|
|
11895
|
-
...
|
|
11903
|
+
...currBaseMeta,
|
|
11896
11904
|
errors: fieldErrors,
|
|
11897
11905
|
isPristine: isFieldPristine,
|
|
11898
|
-
isValid: isFieldValid
|
|
11906
|
+
isValid: isFieldValid,
|
|
11907
|
+
isDefaultValue
|
|
11899
11908
|
};
|
|
11900
11909
|
}
|
|
11901
11910
|
if (!Object.keys(currBaseStore.fieldMetaBase).length) return fieldMeta;
|
|
@@ -11922,6 +11931,9 @@ class FormApi {
|
|
|
11922
11931
|
const isFieldsValid = fieldMetaValues.every((field) => field.isValid);
|
|
11923
11932
|
const isTouched = fieldMetaValues.some((field) => field.isTouched);
|
|
11924
11933
|
const isBlurred = fieldMetaValues.some((field) => field.isBlurred);
|
|
11934
|
+
const isDefaultValue = fieldMetaValues.every(
|
|
11935
|
+
(field) => field.isDefaultValue
|
|
11936
|
+
);
|
|
11925
11937
|
const shouldInvalidateOnMount = (
|
|
11926
11938
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
11927
11939
|
isTouched && ((_a2 = currBaseStore.errorMap) == null ? void 0 : _a2.onMount)
|
|
@@ -11960,7 +11972,7 @@ class FormApi {
|
|
|
11960
11972
|
);
|
|
11961
11973
|
errorMap = Object.assign(errorMap, { onMount: void 0 });
|
|
11962
11974
|
}
|
|
11963
|
-
if (prevVal && prevBaseStore && prevVal.errorMap === errorMap && prevVal.fieldMeta === this.fieldMetaDerived.state && prevVal.errors === errors && prevVal.isFieldsValidating === isFieldsValidating && prevVal.isFieldsValid === isFieldsValid && prevVal.isFormValid === isFormValid && prevVal.isValid === isValid && prevVal.canSubmit === canSubmit && prevVal.isTouched === isTouched && prevVal.isBlurred === isBlurred && prevVal.isPristine === isPristine && prevVal.isDirty === isDirty &&
|
|
11975
|
+
if (prevVal && prevBaseStore && prevVal.errorMap === errorMap && prevVal.fieldMeta === this.fieldMetaDerived.state && prevVal.errors === errors && prevVal.isFieldsValidating === isFieldsValidating && prevVal.isFieldsValid === isFieldsValid && prevVal.isFormValid === isFormValid && prevVal.isValid === isValid && prevVal.canSubmit === canSubmit && prevVal.isTouched === isTouched && prevVal.isBlurred === isBlurred && prevVal.isPristine === isPristine && prevVal.isDefaultValue === isDefaultValue && prevVal.isDirty === isDirty && evaluate(prevBaseStore, currBaseStore)) {
|
|
11964
11976
|
return prevVal;
|
|
11965
11977
|
}
|
|
11966
11978
|
let state = {
|
|
@@ -11976,6 +11988,7 @@ class FormApi {
|
|
|
11976
11988
|
isTouched,
|
|
11977
11989
|
isBlurred,
|
|
11978
11990
|
isPristine,
|
|
11991
|
+
isDefaultValue,
|
|
11979
11992
|
isDirty
|
|
11980
11993
|
};
|
|
11981
11994
|
const transformArray = ((_c = this.options.transform) == null ? void 0 : _c.deps) ?? [];
|
|
@@ -12092,13 +12105,46 @@ class FormApi {
|
|
|
12092
12105
|
* Updates the form's errorMap
|
|
12093
12106
|
*/
|
|
12094
12107
|
setErrorMap(errorMap) {
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12108
|
+
batch(() => {
|
|
12109
|
+
Object.entries(errorMap).forEach(([key, value]) => {
|
|
12110
|
+
const errorMapKey = key;
|
|
12111
|
+
if (isGlobalFormValidationError(value)) {
|
|
12112
|
+
const { formError, fieldErrors } = normalizeError$1(value);
|
|
12113
|
+
for (const fieldName of Object.keys(
|
|
12114
|
+
this.fieldInfo
|
|
12115
|
+
)) {
|
|
12116
|
+
const fieldMeta = this.getFieldMeta(fieldName);
|
|
12117
|
+
if (!fieldMeta) continue;
|
|
12118
|
+
this.setFieldMeta(fieldName, (prev) => ({
|
|
12119
|
+
...prev,
|
|
12120
|
+
errorMap: {
|
|
12121
|
+
...prev.errorMap,
|
|
12122
|
+
[errorMapKey]: fieldErrors == null ? void 0 : fieldErrors[fieldName]
|
|
12123
|
+
},
|
|
12124
|
+
errorSourceMap: {
|
|
12125
|
+
...prev.errorSourceMap,
|
|
12126
|
+
[errorMapKey]: "form"
|
|
12127
|
+
}
|
|
12128
|
+
}));
|
|
12129
|
+
}
|
|
12130
|
+
this.baseStore.setState((prev) => ({
|
|
12131
|
+
...prev,
|
|
12132
|
+
errorMap: {
|
|
12133
|
+
...prev.errorMap,
|
|
12134
|
+
[errorMapKey]: formError
|
|
12135
|
+
}
|
|
12136
|
+
}));
|
|
12137
|
+
} else {
|
|
12138
|
+
this.baseStore.setState((prev) => ({
|
|
12139
|
+
...prev,
|
|
12140
|
+
errorMap: {
|
|
12141
|
+
...prev.errorMap,
|
|
12142
|
+
[errorMapKey]: value
|
|
12143
|
+
}
|
|
12144
|
+
}));
|
|
12145
|
+
}
|
|
12146
|
+
});
|
|
12147
|
+
});
|
|
12102
12148
|
}
|
|
12103
12149
|
}
|
|
12104
12150
|
function normalizeError$1(rawError) {
|
|
@@ -14151,26 +14197,47 @@ const getUserName = () => {
|
|
|
14151
14197
|
return (_a = JSON.parse(localStorage.getItem("userData"))) === null || _a === void 0 ? void 0 : _a.user_nicename;
|
|
14152
14198
|
};
|
|
14153
14199
|
|
|
14154
|
-
function InviteUserDialog({ tenant, onSeeAllInvitedUsersClick, onClose, }) {
|
|
14200
|
+
function InviteUserDialog({ tenant, onSeeAllInvitedUsersClick, onClose, isOpen, }) {
|
|
14155
14201
|
const [inviteUser] = useInviteUserMutation();
|
|
14156
14202
|
const [email, setEmail] = useState("");
|
|
14157
|
-
const
|
|
14203
|
+
const containerRef = useRef(null);
|
|
14204
|
+
const { toast } = useToast();
|
|
14205
|
+
useEffect(() => {
|
|
14206
|
+
containerRef.current = document.getElementById("invite-user-dialog-container");
|
|
14207
|
+
}, []);
|
|
14158
14208
|
const handleInviteUser = async () => {
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14209
|
+
try {
|
|
14210
|
+
await inviteUser([
|
|
14211
|
+
{
|
|
14212
|
+
email,
|
|
14213
|
+
platform_key: tenant,
|
|
14214
|
+
redirect_to: window.location.href,
|
|
14215
|
+
source: getUserName(),
|
|
14216
|
+
},
|
|
14217
|
+
]);
|
|
14218
|
+
setEmail("");
|
|
14219
|
+
toast({
|
|
14220
|
+
title: "Success",
|
|
14221
|
+
description: `Invited user {email} successfully`,
|
|
14222
|
+
});
|
|
14223
|
+
}
|
|
14224
|
+
catch (error) {
|
|
14225
|
+
console.error(error);
|
|
14226
|
+
}
|
|
14167
14227
|
};
|
|
14168
|
-
return (
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
}
|
|
14173
|
-
|
|
14228
|
+
return (jsxs(Fragment, { children: [jsx("div", { id: "invite-user-dialog-container" }), jsx(Dialog, { open: isOpen, onOpenChange: (open) => {
|
|
14229
|
+
if (!open) {
|
|
14230
|
+
onClose();
|
|
14231
|
+
}
|
|
14232
|
+
}, children: jsx(DialogPortal, { container: containerRef.current || undefined, children: jsxs(DialogContent, { onInteractOutside: (e) => {
|
|
14233
|
+
e.preventDefault();
|
|
14234
|
+
e.stopPropagation();
|
|
14235
|
+
}, onEscapeKeyDown: (e) => {
|
|
14236
|
+
// Stop propagation to prevent both dialogs from closing
|
|
14237
|
+
e.preventDefault();
|
|
14238
|
+
e.stopPropagation();
|
|
14239
|
+
onClose();
|
|
14240
|
+
}, className: "max-w-sm rounded-2xl px-6 py-8 pointer-events-auto", children: [jsxs(DialogHeader, { className: "relative flex-row justify-between", children: [jsx(DialogTitle, { className: "text-blue-600 text-xl font-semibold", children: "Invite New User" }), jsx(DialogDescription, { children: jsx("span", { onClick: onSeeAllInvitedUsersClick, className: "text-blue-500 text-sm cursor-pointer hover:underline", children: "See All" }) })] }), jsxs("div", { className: "mt-4 space-y-1", children: [jsx("label", { className: "text-gray-700 text-sm font-medium", children: "Email" }), jsx("p", { className: "text-gray-500 text-sm", children: "A confirmation link would be sent" }), jsx(Input, { value: email, onChange: (event) => setEmail(event.target.value), placeholder: "Enter email address", className: "mt-2" })] }), jsx(Button, { onClick: handleInviteUser, className: "bg-[#2563EB] hover:bg-blue-600 text-white mt-6", children: "Submit" })] }) }) })] }));
|
|
14174
14241
|
}
|
|
14175
14242
|
|
|
14176
14243
|
function InvitedUsersDialog({ tenant, onClose, }) {
|
|
@@ -14192,7 +14259,7 @@ function InvitedUsersDialog({ tenant, onClose, }) {
|
|
|
14192
14259
|
setOpen(_open);
|
|
14193
14260
|
onClose();
|
|
14194
14261
|
}
|
|
14195
|
-
}, children: jsx(DialogPortal, { children: jsxs(DialogContent, { className: "max-w-sm rounded-2xl px-6 py-8 pointer-events-auto", children: [jsx(DialogHeader, { className: "relative flex-row justify-between", children: jsx(DialogTitle, { className: "text-blue-600 text-xl font-semibold", children: "Invited Users" }) }), jsxs("div", { className: "mt-4 space-y-1", children: [jsx("p", { className: "text-gray-500 text-sm", children: "Showing list of invited users pending confirmation" }), jsx("form", { children: jsx(Input, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: "Search Invited Users", className: "mt-2" }) })] }), jsxs("div", { children: [jsx("h2", { className: "text-lg font-semibold", children: "Email" }), invitedUsers === null || invitedUsers === void 0 ? void 0 : invitedUsers.results.map((user) => (jsx("div", { className: "border-b-gray-50 pb-2 mb-4", children: user.email }))), (invitedUsers === null || invitedUsers === void 0 ? void 0 : invitedUsers.results.length) === 0 && (jsx("p", { className: "text-gray", children: "No records found" }))] })] }) }) }));
|
|
14262
|
+
}, children: jsx(DialogPortal, { forceMount: true, children: jsxs(DialogContent, { className: "max-w-sm rounded-2xl px-6 py-8 pointer-events-auto", children: [jsx(DialogHeader, { className: "relative flex-row justify-between", children: jsx(DialogTitle, { className: "text-blue-600 text-xl font-semibold", children: "Invited Users" }) }), jsxs("div", { className: "mt-4 space-y-1", children: [jsx("p", { className: "text-gray-500 text-sm", children: "Showing list of invited users pending confirmation" }), jsx("form", { children: jsx(Input, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: "Search Invited Users", className: "mt-2" }) })] }), jsxs("div", { children: [jsx("h2", { className: "text-lg font-semibold", children: "Email" }), invitedUsers === null || invitedUsers === void 0 ? void 0 : invitedUsers.results.map((user) => (jsx("div", { className: "border-b-gray-50 pb-2 mb-4", children: user.email }))), (invitedUsers === null || invitedUsers === void 0 ? void 0 : invitedUsers.results.length) === 0 && (jsx("p", { className: "text-gray", children: "No records found" }))] })] }) }) }));
|
|
14196
14263
|
}
|
|
14197
14264
|
|
|
14198
14265
|
//import { useDispatch } from "react-redux";
|