@asgardeo/react 0.6.0 → 0.6.2
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/cjs/index.js +620 -558
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/factories/FieldFactory.d.ts +4 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +27 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +2 -2
- package/dist/components/presentation/SignIn/component-driven/SignInOptionFactory.d.ts +1 -0
- package/dist/components/presentation/SignUp/BaseSignUp.d.ts +0 -4
- package/dist/components/presentation/SignUp/SignUpOptionFactory.d.ts +0 -6
- package/dist/components/presentation/SignUp/transformer.d.ts +75 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +432 -367
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -36,13 +36,13 @@ __export(index_exports, {
|
|
|
36
36
|
AlertTitle: () => AlertTitle,
|
|
37
37
|
AsgardeoContext: () => AsgardeoContext_default,
|
|
38
38
|
AsgardeoProvider: () => AsgardeoProvider_default,
|
|
39
|
-
AsgardeoRuntimeError: () =>
|
|
39
|
+
AsgardeoRuntimeError: () => import_browser76.AsgardeoRuntimeError,
|
|
40
40
|
BaseCreateOrganization: () => BaseCreateOrganization,
|
|
41
41
|
BaseOrganization: () => BaseOrganization_default,
|
|
42
42
|
BaseOrganizationList: () => BaseOrganizationList_default,
|
|
43
43
|
BaseOrganizationProfile: () => BaseOrganizationProfile_default,
|
|
44
44
|
BaseOrganizationSwitcher: () => BaseOrganizationSwitcher_default,
|
|
45
|
-
BaseSignIn: () =>
|
|
45
|
+
BaseSignIn: () => BaseSignIn_default3,
|
|
46
46
|
BaseSignInButton: () => BaseSignInButton_default,
|
|
47
47
|
BaseSignOutButton: () => BaseSignOutButton_default,
|
|
48
48
|
BaseSignUp: () => BaseSignUp_default,
|
|
@@ -125,17 +125,17 @@ __export(index_exports, {
|
|
|
125
125
|
UsernamePassword: () => UsernamePassword_default,
|
|
126
126
|
createField: () => createField,
|
|
127
127
|
createOrganization: () => createOrganization_default,
|
|
128
|
-
createPatchOperations: () =>
|
|
128
|
+
createPatchOperations: () => import_browser75.createPatchOperations,
|
|
129
129
|
createSignInOption: () => createSignInOption,
|
|
130
130
|
createSignInOptionFromAuthenticator: () => createSignInOptionFromAuthenticator,
|
|
131
|
-
getActiveTheme: () =>
|
|
131
|
+
getActiveTheme: () => import_browser76.getActiveTheme,
|
|
132
132
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
133
133
|
getMeOrganizations: () => getMeOrganizations_default,
|
|
134
134
|
getMeProfile: () => getScim2Me_default,
|
|
135
135
|
getOrganization: () => getOrganization_default,
|
|
136
136
|
getSchemas: () => getSchemas_default,
|
|
137
|
-
http: () =>
|
|
138
|
-
navigate: () =>
|
|
137
|
+
http: () => import_browser76.http,
|
|
138
|
+
navigate: () => import_browser76.navigate,
|
|
139
139
|
updateMeProfile: () => updateMeProfile_default,
|
|
140
140
|
updateOrganization: () => updateOrganization_default,
|
|
141
141
|
useAlertVariant: () => useAlertVariant,
|
|
@@ -3006,6 +3006,9 @@ var Loading = ({ children, fallback = null }) => {
|
|
|
3006
3006
|
Loading.displayName = "Loading";
|
|
3007
3007
|
var Loading_default = Loading;
|
|
3008
3008
|
|
|
3009
|
+
// src/components/presentation/SignIn/BaseSignIn.tsx
|
|
3010
|
+
var import_browser48 = require("@asgardeo/browser");
|
|
3011
|
+
|
|
3009
3012
|
// src/components/presentation/SignIn/non-component-driven/BaseSignIn.tsx
|
|
3010
3013
|
var import_browser44 = require("@asgardeo/browser");
|
|
3011
3014
|
var import_css35 = require("@emotion/css");
|
|
@@ -4455,6 +4458,7 @@ var createField = (config) => {
|
|
|
4455
4458
|
required,
|
|
4456
4459
|
value,
|
|
4457
4460
|
onChange,
|
|
4461
|
+
onBlur,
|
|
4458
4462
|
disabled = false,
|
|
4459
4463
|
error,
|
|
4460
4464
|
className,
|
|
@@ -4471,7 +4475,8 @@ var createField = (config) => {
|
|
|
4471
4475
|
error: validationError,
|
|
4472
4476
|
className,
|
|
4473
4477
|
value,
|
|
4474
|
-
placeholder
|
|
4478
|
+
placeholder,
|
|
4479
|
+
onBlur
|
|
4475
4480
|
};
|
|
4476
4481
|
switch (type) {
|
|
4477
4482
|
case import_browser32.FieldType.Password:
|
|
@@ -6891,12 +6896,6 @@ var BaseSignInContent = ({
|
|
|
6891
6896
|
};
|
|
6892
6897
|
var BaseSignIn_default = BaseSignIn;
|
|
6893
6898
|
|
|
6894
|
-
// src/components/presentation/SignIn/SignIn.tsx
|
|
6895
|
-
var import_browser50 = require("@asgardeo/browser");
|
|
6896
|
-
|
|
6897
|
-
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
6898
|
-
var import_react60 = require("react");
|
|
6899
|
-
|
|
6900
6899
|
// src/components/presentation/SignIn/component-driven/BaseSignIn.tsx
|
|
6901
6900
|
var import_react59 = require("react");
|
|
6902
6901
|
var import_css37 = require("@emotion/css");
|
|
@@ -7116,6 +7115,7 @@ var createSignInComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
7116
7115
|
value,
|
|
7117
7116
|
error,
|
|
7118
7117
|
onChange: (newValue) => onInputChange(identifier, newValue),
|
|
7118
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
7119
7119
|
className: options.inputClassName
|
|
7120
7120
|
});
|
|
7121
7121
|
return import_react58.default.cloneElement(field, { key });
|
|
@@ -7292,6 +7292,8 @@ var BaseSignInContent2 = ({
|
|
|
7292
7292
|
} = form;
|
|
7293
7293
|
const handleInputChange = (name, value) => {
|
|
7294
7294
|
setFormValue(name, value);
|
|
7295
|
+
};
|
|
7296
|
+
const handleInputBlur = (name) => {
|
|
7295
7297
|
setFormTouched(name, true);
|
|
7296
7298
|
};
|
|
7297
7299
|
const handleSubmit = async (component, data) => {
|
|
@@ -7371,6 +7373,7 @@ var BaseSignInContent2 = ({
|
|
|
7371
7373
|
buttonClassName: buttonClasses,
|
|
7372
7374
|
error,
|
|
7373
7375
|
inputClassName: inputClasses,
|
|
7376
|
+
onInputBlur: handleInputBlur,
|
|
7374
7377
|
onSubmit: handleSubmit,
|
|
7375
7378
|
size,
|
|
7376
7379
|
variant
|
|
@@ -7387,6 +7390,7 @@ var BaseSignInContent2 = ({
|
|
|
7387
7390
|
error,
|
|
7388
7391
|
inputClasses,
|
|
7389
7392
|
buttonClasses,
|
|
7393
|
+
handleInputBlur,
|
|
7390
7394
|
handleSubmit
|
|
7391
7395
|
]
|
|
7392
7396
|
);
|
|
@@ -7439,16 +7443,31 @@ var BaseSignInContent2 = ({
|
|
|
7439
7443
|
};
|
|
7440
7444
|
var BaseSignIn_default2 = BaseSignIn2;
|
|
7441
7445
|
|
|
7446
|
+
// src/components/presentation/SignIn/BaseSignIn.tsx
|
|
7447
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7448
|
+
var BaseSignIn3 = (props) => {
|
|
7449
|
+
const { platform } = useAsgardeo_default();
|
|
7450
|
+
if (platform === import_browser48.Platform.AsgardeoV2) {
|
|
7451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseSignIn_default2, { ...props });
|
|
7452
|
+
}
|
|
7453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BaseSignIn_default, { ...props });
|
|
7454
|
+
};
|
|
7455
|
+
var BaseSignIn_default3 = BaseSignIn3;
|
|
7456
|
+
|
|
7457
|
+
// src/components/presentation/SignIn/SignIn.tsx
|
|
7458
|
+
var import_browser51 = require("@asgardeo/browser");
|
|
7459
|
+
|
|
7442
7460
|
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7443
|
-
var
|
|
7461
|
+
var import_react60 = require("react");
|
|
7462
|
+
var import_browser50 = require("@asgardeo/browser");
|
|
7444
7463
|
|
|
7445
7464
|
// src/components/presentation/SignIn/component-driven/transformer.ts
|
|
7446
|
-
var
|
|
7465
|
+
var import_browser49 = require("@asgardeo/browser");
|
|
7447
7466
|
var generateId = (prefix) => {
|
|
7448
7467
|
const suffix = Math.random().toString(36).substring(2, 6);
|
|
7449
7468
|
return `${prefix}_${suffix}`;
|
|
7450
7469
|
};
|
|
7451
|
-
var getInputVariant = (type) => {
|
|
7470
|
+
var getInputVariant = (type, name) => {
|
|
7452
7471
|
switch (type.toLowerCase()) {
|
|
7453
7472
|
case "email":
|
|
7454
7473
|
return "EMAIL";
|
|
@@ -7475,15 +7494,19 @@ var getInputPlaceholder = (name, type, t) => {
|
|
|
7475
7494
|
return placeholder;
|
|
7476
7495
|
};
|
|
7477
7496
|
var convertSimpleInputToComponent = (input, t) => {
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7497
|
+
let fieldType = input.type;
|
|
7498
|
+
if (input.name.toLowerCase().includes("password") && input.type.toLowerCase() === "string") {
|
|
7499
|
+
fieldType = "password";
|
|
7500
|
+
}
|
|
7501
|
+
const variant = getInputVariant(fieldType, input.name);
|
|
7502
|
+
const label = getInputLabel(input.name, fieldType, t);
|
|
7503
|
+
const placeholder = getInputPlaceholder(input.name, fieldType, t);
|
|
7481
7504
|
return {
|
|
7482
7505
|
id: generateId("input"),
|
|
7483
|
-
type:
|
|
7506
|
+
type: import_browser49.EmbeddedFlowComponentType.Input,
|
|
7484
7507
|
variant,
|
|
7485
7508
|
config: {
|
|
7486
|
-
type:
|
|
7509
|
+
type: fieldType,
|
|
7487
7510
|
label,
|
|
7488
7511
|
placeholder,
|
|
7489
7512
|
required: input.required,
|
|
@@ -7494,7 +7517,8 @@ var convertSimpleInputToComponent = (input, t) => {
|
|
|
7494
7517
|
};
|
|
7495
7518
|
};
|
|
7496
7519
|
var convertActionToComponent = (action, t) => {
|
|
7497
|
-
const
|
|
7520
|
+
const normalizedId = action.id.replace(/_auth$/, "");
|
|
7521
|
+
const i18nKey = `elements.buttons.${normalizedId}`;
|
|
7498
7522
|
let text = t(i18nKey);
|
|
7499
7523
|
if (!text || text === i18nKey) {
|
|
7500
7524
|
text = action.id.replace(/_/g, " ");
|
|
@@ -7502,7 +7526,7 @@ var convertActionToComponent = (action, t) => {
|
|
|
7502
7526
|
}
|
|
7503
7527
|
return {
|
|
7504
7528
|
id: generateId("action"),
|
|
7505
|
-
type:
|
|
7529
|
+
type: import_browser49.EmbeddedFlowComponentType.Button,
|
|
7506
7530
|
variant: "SECONDARY",
|
|
7507
7531
|
config: {
|
|
7508
7532
|
type: "button",
|
|
@@ -7518,7 +7542,7 @@ var transformSimpleToComponentDriven = (response, t) => {
|
|
|
7518
7542
|
const actionComponents = response?.data?.actions?.map((action) => convertActionToComponent(action, t)) || [];
|
|
7519
7543
|
const submitButton = inputComponents.length > 0 ? {
|
|
7520
7544
|
id: generateId("button"),
|
|
7521
|
-
type:
|
|
7545
|
+
type: import_browser49.EmbeddedFlowComponentType.Button,
|
|
7522
7546
|
variant: "PRIMARY",
|
|
7523
7547
|
config: {
|
|
7524
7548
|
type: "submit",
|
|
@@ -7535,7 +7559,7 @@ var transformSimpleToComponentDriven = (response, t) => {
|
|
|
7535
7559
|
if (formComponents.length > 0) {
|
|
7536
7560
|
result.push({
|
|
7537
7561
|
id: generateId("form"),
|
|
7538
|
-
type:
|
|
7562
|
+
type: import_browser49.EmbeddedFlowComponentType.Form,
|
|
7539
7563
|
config: {},
|
|
7540
7564
|
components: formComponents
|
|
7541
7565
|
});
|
|
@@ -7553,7 +7577,7 @@ var normalizeFlowResponse = (response, t) => {
|
|
|
7553
7577
|
};
|
|
7554
7578
|
|
|
7555
7579
|
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7556
|
-
var
|
|
7580
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7557
7581
|
var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
|
|
7558
7582
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
7559
7583
|
const { t } = useTranslation_default();
|
|
@@ -7575,7 +7599,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7575
7599
|
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
7576
7600
|
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
7577
7601
|
if (!flowIdFromUrl && !effectiveApplicationId) {
|
|
7578
|
-
const error = new
|
|
7602
|
+
const error = new import_browser50.AsgardeoRuntimeError(
|
|
7579
7603
|
"Either flowId or applicationId is required for authentication",
|
|
7580
7604
|
"SignIn-initializeFlow-RuntimeError-001",
|
|
7581
7605
|
"react",
|
|
@@ -7594,7 +7618,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7594
7618
|
} else {
|
|
7595
7619
|
response = await signIn({
|
|
7596
7620
|
applicationId: effectiveApplicationId,
|
|
7597
|
-
flowType:
|
|
7621
|
+
flowType: import_browser50.EmbeddedFlowType.Authentication
|
|
7598
7622
|
});
|
|
7599
7623
|
}
|
|
7600
7624
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
@@ -7607,7 +7631,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7607
7631
|
const err = error;
|
|
7608
7632
|
setFlowError(err);
|
|
7609
7633
|
onError?.(err);
|
|
7610
|
-
throw new
|
|
7634
|
+
throw new import_browser50.AsgardeoRuntimeError(
|
|
7611
7635
|
`Failed to initialize authentication flow: ${error instanceof Error ? error.message : String(error)}`,
|
|
7612
7636
|
"SignIn-initializeFlow-RuntimeError-002",
|
|
7613
7637
|
"react",
|
|
@@ -7627,7 +7651,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7627
7651
|
...payload
|
|
7628
7652
|
});
|
|
7629
7653
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
7630
|
-
if (response.flowStatus ===
|
|
7654
|
+
if (response.flowStatus === import_browser50.EmbeddedSignInFlowStatusV2.Complete) {
|
|
7631
7655
|
onSuccess && onSuccess({
|
|
7632
7656
|
redirectUrl: response.redirectUrl || afterSignInUrl,
|
|
7633
7657
|
...response.data
|
|
@@ -7643,7 +7667,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7643
7667
|
const err = error;
|
|
7644
7668
|
setFlowError(err);
|
|
7645
7669
|
onError?.(err);
|
|
7646
|
-
throw new
|
|
7670
|
+
throw new import_browser50.AsgardeoRuntimeError(
|
|
7647
7671
|
`Failed to submit authentication flow: ${error instanceof Error ? error.message : String(error)}`,
|
|
7648
7672
|
"SignIn-handleSubmit-RuntimeError-001",
|
|
7649
7673
|
"react",
|
|
@@ -7667,9 +7691,9 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7667
7691
|
components,
|
|
7668
7692
|
error: flowError
|
|
7669
7693
|
};
|
|
7670
|
-
return /* @__PURE__ */ (0,
|
|
7694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: children(renderProps) });
|
|
7671
7695
|
}
|
|
7672
|
-
return /* @__PURE__ */ (0,
|
|
7696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7673
7697
|
BaseSignIn_default2,
|
|
7674
7698
|
{
|
|
7675
7699
|
components,
|
|
@@ -7685,7 +7709,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7685
7709
|
var SignIn_default = SignIn;
|
|
7686
7710
|
|
|
7687
7711
|
// src/components/presentation/SignIn/SignIn.tsx
|
|
7688
|
-
var
|
|
7712
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
7689
7713
|
var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
7690
7714
|
const { signIn, afterSignInUrl, isInitialized, isLoading, platform } = useAsgardeo_default();
|
|
7691
7715
|
const handleInitialize = async () => {
|
|
@@ -7705,8 +7729,8 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7705
7729
|
window.location.href = url.toString();
|
|
7706
7730
|
}
|
|
7707
7731
|
};
|
|
7708
|
-
if (platform ===
|
|
7709
|
-
return /* @__PURE__ */ (0,
|
|
7732
|
+
if (platform === import_browser51.Platform.AsgardeoV2) {
|
|
7733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7710
7734
|
SignIn_default,
|
|
7711
7735
|
{
|
|
7712
7736
|
className,
|
|
@@ -7718,7 +7742,7 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7718
7742
|
}
|
|
7719
7743
|
);
|
|
7720
7744
|
}
|
|
7721
|
-
return /* @__PURE__ */ (0,
|
|
7745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7722
7746
|
BaseSignIn_default,
|
|
7723
7747
|
{
|
|
7724
7748
|
isLoading: isLoading || !isInitialized,
|
|
@@ -7735,15 +7759,15 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7735
7759
|
var SignIn_default2 = SignIn2;
|
|
7736
7760
|
|
|
7737
7761
|
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
7738
|
-
var
|
|
7762
|
+
var import_browser60 = require("@asgardeo/browser");
|
|
7739
7763
|
var import_css39 = require("@emotion/css");
|
|
7740
7764
|
var import_react62 = require("react");
|
|
7741
7765
|
|
|
7742
7766
|
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
7743
|
-
var
|
|
7767
|
+
var import_browser58 = require("@asgardeo/browser");
|
|
7744
7768
|
|
|
7745
7769
|
// src/components/adapters/CheckboxInput.tsx
|
|
7746
|
-
var
|
|
7770
|
+
var import_browser52 = require("@asgardeo/browser");
|
|
7747
7771
|
var CheckboxInput = ({
|
|
7748
7772
|
component,
|
|
7749
7773
|
formValues,
|
|
@@ -7757,7 +7781,7 @@ var CheckboxInput = ({
|
|
|
7757
7781
|
const value = formValues[fieldName] || false;
|
|
7758
7782
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7759
7783
|
return createField({
|
|
7760
|
-
type:
|
|
7784
|
+
type: import_browser52.FieldType.Checkbox,
|
|
7761
7785
|
name: fieldName,
|
|
7762
7786
|
label: config["label"] || "",
|
|
7763
7787
|
placeholder: config["placeholder"] || "",
|
|
@@ -7771,7 +7795,7 @@ var CheckboxInput = ({
|
|
|
7771
7795
|
var CheckboxInput_default = CheckboxInput;
|
|
7772
7796
|
|
|
7773
7797
|
// src/components/adapters/DateInput.tsx
|
|
7774
|
-
var
|
|
7798
|
+
var import_browser53 = require("@asgardeo/browser");
|
|
7775
7799
|
var DateInput = ({
|
|
7776
7800
|
component,
|
|
7777
7801
|
formValues,
|
|
@@ -7785,7 +7809,7 @@ var DateInput = ({
|
|
|
7785
7809
|
const value = formValues[fieldName] || "";
|
|
7786
7810
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7787
7811
|
return createField({
|
|
7788
|
-
type:
|
|
7812
|
+
type: import_browser53.FieldType.Date,
|
|
7789
7813
|
name: fieldName,
|
|
7790
7814
|
label: config["label"] || "",
|
|
7791
7815
|
placeholder: config["placeholder"] || "",
|
|
@@ -7799,13 +7823,13 @@ var DateInput = ({
|
|
|
7799
7823
|
var DateInput_default = DateInput;
|
|
7800
7824
|
|
|
7801
7825
|
// src/components/adapters/DividerComponent.tsx
|
|
7802
|
-
var
|
|
7826
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
7803
7827
|
var DividerComponent = ({ component }) => {
|
|
7804
7828
|
const { theme } = useTheme_default();
|
|
7805
7829
|
const config = component.config || {};
|
|
7806
7830
|
const text = config["text"] || "";
|
|
7807
7831
|
const variant = component.variant?.toLowerCase() || "horizontal";
|
|
7808
|
-
return /* @__PURE__ */ (0,
|
|
7832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7809
7833
|
Divider_default,
|
|
7810
7834
|
{
|
|
7811
7835
|
orientation: variant === "vertical" ? "vertical" : "horizontal",
|
|
@@ -7818,7 +7842,7 @@ var DividerComponent = ({ component }) => {
|
|
|
7818
7842
|
var DividerComponent_default = DividerComponent;
|
|
7819
7843
|
|
|
7820
7844
|
// src/components/adapters/EmailInput.tsx
|
|
7821
|
-
var
|
|
7845
|
+
var import_browser54 = require("@asgardeo/browser");
|
|
7822
7846
|
var EmailInput = ({
|
|
7823
7847
|
component,
|
|
7824
7848
|
formValues,
|
|
@@ -7832,7 +7856,7 @@ var EmailInput = ({
|
|
|
7832
7856
|
const value = formValues[fieldName] || "";
|
|
7833
7857
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7834
7858
|
return createField({
|
|
7835
|
-
type:
|
|
7859
|
+
type: import_browser54.FieldType.Email,
|
|
7836
7860
|
name: fieldName,
|
|
7837
7861
|
label: config["label"] || "Email",
|
|
7838
7862
|
placeholder: config["placeholder"] || "Enter your email",
|
|
@@ -7846,7 +7870,7 @@ var EmailInput = ({
|
|
|
7846
7870
|
var EmailInput_default = EmailInput;
|
|
7847
7871
|
|
|
7848
7872
|
// src/components/adapters/FormContainer.tsx
|
|
7849
|
-
var
|
|
7873
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
7850
7874
|
var FormContainer = (props) => {
|
|
7851
7875
|
const { component } = props;
|
|
7852
7876
|
if (component.components && component.components.length > 0) {
|
|
@@ -7859,19 +7883,19 @@ var FormContainer = (props) => {
|
|
|
7859
7883
|
props.onSubmit(submitButton, props.formValues);
|
|
7860
7884
|
}
|
|
7861
7885
|
};
|
|
7862
|
-
return /* @__PURE__ */ (0,
|
|
7886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("form", { onSubmit: handleFormSubmit, style: { display: "flex", flexDirection: "column" }, children: component.components.map(
|
|
7863
7887
|
(childComponent, index) => createSignUpComponent({
|
|
7864
7888
|
...props,
|
|
7865
7889
|
component: childComponent
|
|
7866
7890
|
})
|
|
7867
7891
|
) }, component.id);
|
|
7868
7892
|
}
|
|
7869
|
-
return /* @__PURE__ */ (0,
|
|
7893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", {}, component.id);
|
|
7870
7894
|
};
|
|
7871
7895
|
var FormContainer_default = FormContainer;
|
|
7872
7896
|
|
|
7873
7897
|
// src/components/adapters/ImageComponent.tsx
|
|
7874
|
-
var
|
|
7898
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7875
7899
|
var ImageComponent = ({ component }) => {
|
|
7876
7900
|
const { theme } = useTheme_default();
|
|
7877
7901
|
const config = component.config || {};
|
|
@@ -7888,7 +7912,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7888
7912
|
if (!src) {
|
|
7889
7913
|
return null;
|
|
7890
7914
|
}
|
|
7891
|
-
return /* @__PURE__ */ (0,
|
|
7915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7892
7916
|
"img",
|
|
7893
7917
|
{
|
|
7894
7918
|
src,
|
|
@@ -7903,7 +7927,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7903
7927
|
var ImageComponent_default = ImageComponent;
|
|
7904
7928
|
|
|
7905
7929
|
// src/components/adapters/NumberInput.tsx
|
|
7906
|
-
var
|
|
7930
|
+
var import_browser55 = require("@asgardeo/browser");
|
|
7907
7931
|
var NumberInput = ({
|
|
7908
7932
|
component,
|
|
7909
7933
|
formValues,
|
|
@@ -7917,7 +7941,7 @@ var NumberInput = ({
|
|
|
7917
7941
|
const value = formValues[fieldName] || "";
|
|
7918
7942
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7919
7943
|
return createField({
|
|
7920
|
-
type:
|
|
7944
|
+
type: import_browser55.FieldType.Number,
|
|
7921
7945
|
name: fieldName,
|
|
7922
7946
|
label: config["label"] || "",
|
|
7923
7947
|
placeholder: config["placeholder"] || "",
|
|
@@ -7931,7 +7955,7 @@ var NumberInput = ({
|
|
|
7931
7955
|
var NumberInput_default = NumberInput;
|
|
7932
7956
|
|
|
7933
7957
|
// src/components/adapters/PasswordInput.tsx
|
|
7934
|
-
var
|
|
7958
|
+
var import_browser56 = require("@asgardeo/browser");
|
|
7935
7959
|
var PasswordInput = ({
|
|
7936
7960
|
component,
|
|
7937
7961
|
formValues,
|
|
@@ -7977,7 +8001,7 @@ var PasswordInput = ({
|
|
|
7977
8001
|
});
|
|
7978
8002
|
const hint = validationHints.length > 0 ? validationHints.join(", ") : config["hint"] || "";
|
|
7979
8003
|
return createField({
|
|
7980
|
-
type:
|
|
8004
|
+
type: import_browser56.FieldType.Password,
|
|
7981
8005
|
name: fieldName,
|
|
7982
8006
|
label: config["label"] || "Password",
|
|
7983
8007
|
placeholder: config["placeholder"] || "Enter your password",
|
|
@@ -7991,7 +8015,7 @@ var PasswordInput = ({
|
|
|
7991
8015
|
var PasswordInput_default = PasswordInput;
|
|
7992
8016
|
|
|
7993
8017
|
// src/components/adapters/SubmitButton.tsx
|
|
7994
|
-
var
|
|
8018
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
7995
8019
|
var ButtonComponent = ({
|
|
7996
8020
|
component,
|
|
7997
8021
|
isLoading,
|
|
@@ -8024,7 +8048,7 @@ var ButtonComponent = ({
|
|
|
8024
8048
|
onSubmit(component);
|
|
8025
8049
|
}
|
|
8026
8050
|
};
|
|
8027
|
-
return /* @__PURE__ */ (0,
|
|
8051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
8028
8052
|
Button_default,
|
|
8029
8053
|
{
|
|
8030
8054
|
type: buttonType === "submit" ? "submit" : "button",
|
|
@@ -8035,7 +8059,7 @@ var ButtonComponent = ({
|
|
|
8035
8059
|
onClick: buttonType !== "submit" ? handleClick : void 0,
|
|
8036
8060
|
className: buttonClassName,
|
|
8037
8061
|
style: { width: "100%" },
|
|
8038
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
8062
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Spinner_default, { size: "small" }) : buttonText
|
|
8039
8063
|
},
|
|
8040
8064
|
component.id
|
|
8041
8065
|
);
|
|
@@ -8043,7 +8067,7 @@ var ButtonComponent = ({
|
|
|
8043
8067
|
var SubmitButton_default = ButtonComponent;
|
|
8044
8068
|
|
|
8045
8069
|
// src/components/adapters/TelephoneInput.tsx
|
|
8046
|
-
var
|
|
8070
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8047
8071
|
var TelephoneInput = ({
|
|
8048
8072
|
component,
|
|
8049
8073
|
formValues,
|
|
@@ -8056,7 +8080,7 @@ var TelephoneInput = ({
|
|
|
8056
8080
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
8057
8081
|
const value = formValues[fieldName] || "";
|
|
8058
8082
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
8059
|
-
return /* @__PURE__ */ (0,
|
|
8083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
8060
8084
|
TextField_default,
|
|
8061
8085
|
{
|
|
8062
8086
|
name: fieldName,
|
|
@@ -8076,7 +8100,7 @@ var TelephoneInput = ({
|
|
|
8076
8100
|
var TelephoneInput_default = TelephoneInput;
|
|
8077
8101
|
|
|
8078
8102
|
// src/components/adapters/TextInput.tsx
|
|
8079
|
-
var
|
|
8103
|
+
var import_browser57 = require("@asgardeo/browser");
|
|
8080
8104
|
var TextInput = ({
|
|
8081
8105
|
component,
|
|
8082
8106
|
formValues,
|
|
@@ -8090,7 +8114,7 @@ var TextInput = ({
|
|
|
8090
8114
|
const value = formValues[fieldName] || "";
|
|
8091
8115
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
8092
8116
|
return createField({
|
|
8093
|
-
type:
|
|
8117
|
+
type: import_browser57.FieldType.Text,
|
|
8094
8118
|
name: fieldName,
|
|
8095
8119
|
label: config["label"] || "",
|
|
8096
8120
|
placeholder: config["placeholder"] || "",
|
|
@@ -8104,7 +8128,7 @@ var TextInput = ({
|
|
|
8104
8128
|
var TextInput_default = TextInput;
|
|
8105
8129
|
|
|
8106
8130
|
// src/components/adapters/Typography.tsx
|
|
8107
|
-
var
|
|
8131
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
8108
8132
|
var TypographyComponent = ({ component }) => {
|
|
8109
8133
|
const { theme } = useTheme_default();
|
|
8110
8134
|
const config = component.config || {};
|
|
@@ -8145,7 +8169,7 @@ var TypographyComponent = ({ component }) => {
|
|
|
8145
8169
|
default:
|
|
8146
8170
|
typographyVariant = "body1";
|
|
8147
8171
|
}
|
|
8148
|
-
return /* @__PURE__ */ (0,
|
|
8172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
8149
8173
|
Typography_default,
|
|
8150
8174
|
{
|
|
8151
8175
|
variant: typographyVariant,
|
|
@@ -8158,66 +8182,66 @@ var TypographyComponent = ({ component }) => {
|
|
|
8158
8182
|
var Typography_default2 = TypographyComponent;
|
|
8159
8183
|
|
|
8160
8184
|
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
8161
|
-
var
|
|
8185
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8162
8186
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
8163
8187
|
switch (component.type) {
|
|
8164
|
-
case
|
|
8165
|
-
return /* @__PURE__ */ (0,
|
|
8166
|
-
case
|
|
8188
|
+
case import_browser58.EmbeddedFlowComponentType.Typography:
|
|
8189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
8190
|
+
case import_browser58.EmbeddedFlowComponentType.Input:
|
|
8167
8191
|
const inputVariant = component.variant?.toUpperCase();
|
|
8168
8192
|
const inputType = component.config["type"]?.toLowerCase();
|
|
8169
8193
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
8170
|
-
return /* @__PURE__ */ (0,
|
|
8194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(EmailInput_default, { component, onSubmit, ...rest });
|
|
8171
8195
|
}
|
|
8172
8196
|
if (inputVariant === "PASSWORD" || inputType === "password") {
|
|
8173
|
-
return /* @__PURE__ */ (0,
|
|
8197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PasswordInput_default, { component, onSubmit, ...rest });
|
|
8174
8198
|
}
|
|
8175
8199
|
if (inputVariant === "TELEPHONE" || inputType === "tel") {
|
|
8176
|
-
return /* @__PURE__ */ (0,
|
|
8200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TelephoneInput_default, { component, onSubmit, ...rest });
|
|
8177
8201
|
}
|
|
8178
8202
|
if (inputVariant === "NUMBER" || inputType === "number") {
|
|
8179
|
-
return /* @__PURE__ */ (0,
|
|
8203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NumberInput_default, { component, onSubmit, ...rest });
|
|
8180
8204
|
}
|
|
8181
8205
|
if (inputVariant === "DATE" || inputType === "date") {
|
|
8182
|
-
return /* @__PURE__ */ (0,
|
|
8206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DateInput_default, { component, onSubmit, ...rest });
|
|
8183
8207
|
}
|
|
8184
8208
|
if (inputVariant === "CHECKBOX" || inputType === "checkbox") {
|
|
8185
|
-
return /* @__PURE__ */ (0,
|
|
8209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CheckboxInput_default, { component, onSubmit, ...rest });
|
|
8186
8210
|
}
|
|
8187
|
-
return /* @__PURE__ */ (0,
|
|
8188
|
-
case
|
|
8211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TextInput_default, { component, onSubmit, ...rest });
|
|
8212
|
+
case import_browser58.EmbeddedFlowComponentType.Button: {
|
|
8189
8213
|
const buttonVariant = component.variant?.toUpperCase();
|
|
8190
8214
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
8191
8215
|
if (buttonVariant === "SOCIAL") {
|
|
8192
8216
|
if (buttonText.toLowerCase().includes("google")) {
|
|
8193
|
-
return /* @__PURE__ */ (0,
|
|
8217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GoogleButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8194
8218
|
}
|
|
8195
8219
|
if (buttonText.toLowerCase().includes("github")) {
|
|
8196
|
-
return /* @__PURE__ */ (0,
|
|
8220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GitHubButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8197
8221
|
}
|
|
8198
8222
|
if (buttonText.toLowerCase().includes("microsoft")) {
|
|
8199
|
-
return /* @__PURE__ */ (0,
|
|
8223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MicrosoftButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8200
8224
|
}
|
|
8201
8225
|
if (buttonText.toLowerCase().includes("facebook")) {
|
|
8202
|
-
return /* @__PURE__ */ (0,
|
|
8226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FacebookButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8203
8227
|
}
|
|
8204
8228
|
if (buttonText.toLowerCase().includes("linkedin")) {
|
|
8205
|
-
return /* @__PURE__ */ (0,
|
|
8229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LinkedInButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8206
8230
|
}
|
|
8207
8231
|
if (buttonText.toLowerCase().includes("ethereum")) {
|
|
8208
|
-
return /* @__PURE__ */ (0,
|
|
8232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SignInWithEthereumButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8209
8233
|
}
|
|
8210
8234
|
}
|
|
8211
|
-
return /* @__PURE__ */ (0,
|
|
8235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SubmitButton_default, { component, onSubmit, ...rest });
|
|
8212
8236
|
}
|
|
8213
|
-
case
|
|
8214
|
-
return /* @__PURE__ */ (0,
|
|
8215
|
-
case
|
|
8216
|
-
return /* @__PURE__ */ (0,
|
|
8217
|
-
case
|
|
8218
|
-
return /* @__PURE__ */ (0,
|
|
8237
|
+
case import_browser58.EmbeddedFlowComponentType.Form:
|
|
8238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormContainer_default, { component, onSubmit, ...rest });
|
|
8239
|
+
case import_browser58.EmbeddedFlowComponentType.Divider:
|
|
8240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DividerComponent_default, { component, onSubmit, ...rest });
|
|
8241
|
+
case import_browser58.EmbeddedFlowComponentType.Image:
|
|
8242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ImageComponent_default, { component, onSubmit, ...rest });
|
|
8219
8243
|
default:
|
|
8220
|
-
return /* @__PURE__ */ (0,
|
|
8244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", {});
|
|
8221
8245
|
}
|
|
8222
8246
|
};
|
|
8223
8247
|
var createSignUpOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createSignUpComponent({
|
|
@@ -8248,12 +8272,12 @@ var renderSignUpComponents = (components, formValues, touchedFields, formErrors,
|
|
|
8248
8272
|
).filter(Boolean);
|
|
8249
8273
|
|
|
8250
8274
|
// src/components/presentation/SignUp/transformer.ts
|
|
8251
|
-
var
|
|
8275
|
+
var import_browser59 = require("@asgardeo/browser");
|
|
8252
8276
|
var generateId2 = (prefix) => {
|
|
8253
8277
|
const suffix = Math.random().toString(36).substring(2, 6);
|
|
8254
8278
|
return `${prefix}_${suffix}`;
|
|
8255
8279
|
};
|
|
8256
|
-
var getInputVariant2 = (type) => {
|
|
8280
|
+
var getInputVariant2 = (type, name) => {
|
|
8257
8281
|
switch (type.toLowerCase()) {
|
|
8258
8282
|
case "email":
|
|
8259
8283
|
return "EMAIL";
|
|
@@ -8280,15 +8304,19 @@ var getInputPlaceholder2 = (name, type, t) => {
|
|
|
8280
8304
|
return placeholder;
|
|
8281
8305
|
};
|
|
8282
8306
|
var convertSimpleInputToComponent2 = (input, t) => {
|
|
8283
|
-
|
|
8307
|
+
let fieldType = input.type;
|
|
8308
|
+
if (input.name.toLowerCase().includes("password") && input.type.toLowerCase() === "string") {
|
|
8309
|
+
fieldType = "password";
|
|
8310
|
+
}
|
|
8311
|
+
const variant = getInputVariant2(input.type, input.name);
|
|
8284
8312
|
const label = getInputLabel2(input.name, input.type, t);
|
|
8285
8313
|
const placeholder = getInputPlaceholder2(input.name, input.type, t);
|
|
8286
8314
|
return {
|
|
8287
8315
|
id: generateId2("input"),
|
|
8288
|
-
type:
|
|
8316
|
+
type: import_browser59.EmbeddedFlowComponentType.Input,
|
|
8289
8317
|
variant,
|
|
8290
8318
|
config: {
|
|
8291
|
-
type: input.type
|
|
8319
|
+
type: input.type,
|
|
8292
8320
|
label,
|
|
8293
8321
|
placeholder,
|
|
8294
8322
|
required: input.required,
|
|
@@ -8299,7 +8327,8 @@ var convertSimpleInputToComponent2 = (input, t) => {
|
|
|
8299
8327
|
};
|
|
8300
8328
|
};
|
|
8301
8329
|
var convertActionToComponent2 = (action, t) => {
|
|
8302
|
-
const
|
|
8330
|
+
const normalizedId = action.id.replace(/_auth$/, "");
|
|
8331
|
+
const i18nKey = `elements.buttons.${normalizedId}`;
|
|
8303
8332
|
let text = t(i18nKey);
|
|
8304
8333
|
if (!text || text === i18nKey) {
|
|
8305
8334
|
text = action.id.replace(/_/g, " ");
|
|
@@ -8307,7 +8336,7 @@ var convertActionToComponent2 = (action, t) => {
|
|
|
8307
8336
|
}
|
|
8308
8337
|
return {
|
|
8309
8338
|
id: generateId2("action"),
|
|
8310
|
-
type:
|
|
8339
|
+
type: import_browser59.EmbeddedFlowComponentType.Button,
|
|
8311
8340
|
variant: "SECONDARY",
|
|
8312
8341
|
config: {
|
|
8313
8342
|
type: "button",
|
|
@@ -8323,7 +8352,7 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8323
8352
|
const actionComponents = response?.data?.actions?.map((action) => convertActionToComponent2(action, t)) || [];
|
|
8324
8353
|
const submitButton = inputComponents.length > 0 ? {
|
|
8325
8354
|
id: generateId2("button"),
|
|
8326
|
-
type:
|
|
8355
|
+
type: import_browser59.EmbeddedFlowComponentType.Button,
|
|
8327
8356
|
variant: "PRIMARY",
|
|
8328
8357
|
config: {
|
|
8329
8358
|
type: "submit",
|
|
@@ -8340,7 +8369,7 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8340
8369
|
if (formComponents.length > 0) {
|
|
8341
8370
|
result.push({
|
|
8342
8371
|
id: generateId2("form"),
|
|
8343
|
-
type:
|
|
8372
|
+
type: import_browser59.EmbeddedFlowComponentType.Form,
|
|
8344
8373
|
config: {},
|
|
8345
8374
|
components: formComponents
|
|
8346
8375
|
});
|
|
@@ -8350,6 +8379,38 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8350
8379
|
}
|
|
8351
8380
|
return result;
|
|
8352
8381
|
};
|
|
8382
|
+
var extractErrorMessage = (error, t) => {
|
|
8383
|
+
let errorMessage = t("errors.sign.up.flow.failure");
|
|
8384
|
+
if (error && typeof error === "object") {
|
|
8385
|
+
if (error.flowStatus === "ERROR" && error.failureReason) {
|
|
8386
|
+
errorMessage = error.failureReason;
|
|
8387
|
+
} else if (error.code && (error.message || error.description)) {
|
|
8388
|
+
errorMessage = error.description || error.message;
|
|
8389
|
+
} else if (error instanceof Error && error.name === "AsgardeoAPIError") {
|
|
8390
|
+
try {
|
|
8391
|
+
const errorResponse = JSON.parse(
|
|
8392
|
+
error.message
|
|
8393
|
+
);
|
|
8394
|
+
if (errorResponse.failureReason) {
|
|
8395
|
+
errorMessage = errorResponse.failureReason;
|
|
8396
|
+
} else if (errorResponse.description) {
|
|
8397
|
+
errorMessage = errorResponse.description;
|
|
8398
|
+
} else if (errorResponse.message) {
|
|
8399
|
+
errorMessage = errorResponse.message;
|
|
8400
|
+
} else {
|
|
8401
|
+
errorMessage = error.message;
|
|
8402
|
+
}
|
|
8403
|
+
} catch {
|
|
8404
|
+
errorMessage = error.message;
|
|
8405
|
+
}
|
|
8406
|
+
} else if (error.message) {
|
|
8407
|
+
errorMessage = error.message;
|
|
8408
|
+
}
|
|
8409
|
+
} else if (typeof error === "string") {
|
|
8410
|
+
errorMessage = error;
|
|
8411
|
+
}
|
|
8412
|
+
return errorMessage;
|
|
8413
|
+
};
|
|
8353
8414
|
|
|
8354
8415
|
// src/components/presentation/SignUp/BaseSignUp.styles.ts
|
|
8355
8416
|
var import_css38 = require("@emotion/css");
|
|
@@ -8493,13 +8554,13 @@ var useStyles18 = (theme, colorScheme) => {
|
|
|
8493
8554
|
var BaseSignUp_styles_default = useStyles18;
|
|
8494
8555
|
|
|
8495
8556
|
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
8496
|
-
var
|
|
8557
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
8497
8558
|
var BaseSignUp = (props) => {
|
|
8498
8559
|
const { theme, colorScheme } = useTheme_default();
|
|
8499
8560
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
8500
|
-
return /* @__PURE__ */ (0,
|
|
8501
|
-
/* @__PURE__ */ (0,
|
|
8502
|
-
/* @__PURE__ */ (0,
|
|
8561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
8562
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Logo_default, { size: "large" }) }),
|
|
8563
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BaseSignUpContent, { ...props }) })
|
|
8503
8564
|
] });
|
|
8504
8565
|
};
|
|
8505
8566
|
var BaseSignUpContent = ({
|
|
@@ -8521,12 +8582,22 @@ var BaseSignUpContent = ({
|
|
|
8521
8582
|
}) => {
|
|
8522
8583
|
const { theme, colorScheme } = useTheme_default();
|
|
8523
8584
|
const { t } = useTranslation_default();
|
|
8524
|
-
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages } = useFlow_default();
|
|
8585
|
+
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
8525
8586
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
8587
|
+
const handleError = (0, import_react62.useCallback)(
|
|
8588
|
+
(error) => {
|
|
8589
|
+
const errorMessage = extractErrorMessage(error, t);
|
|
8590
|
+
clearMessages();
|
|
8591
|
+
addMessage({
|
|
8592
|
+
type: "error",
|
|
8593
|
+
message: errorMessage
|
|
8594
|
+
});
|
|
8595
|
+
},
|
|
8596
|
+
[t, addMessage, clearMessages]
|
|
8597
|
+
);
|
|
8526
8598
|
const [isLoading, setIsLoading] = (0, import_react62.useState)(false);
|
|
8527
8599
|
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react62.useState)(false);
|
|
8528
8600
|
const [currentFlow, setCurrentFlow] = (0, import_react62.useState)(null);
|
|
8529
|
-
const [error, setError] = (0, import_react62.useState)(null);
|
|
8530
8601
|
const [formData, setFormData] = (0, import_react62.useState)({});
|
|
8531
8602
|
const initializationAttemptedRef = (0, import_react62.useRef)(false);
|
|
8532
8603
|
const normalizeFlowResponse2 = (0, import_react62.useCallback)(
|
|
@@ -8553,7 +8624,7 @@ var BaseSignUpContent = ({
|
|
|
8553
8624
|
const fields = [];
|
|
8554
8625
|
const processComponents = (comps) => {
|
|
8555
8626
|
comps.forEach((component) => {
|
|
8556
|
-
if (component.type ===
|
|
8627
|
+
if (component.type === import_browser60.EmbeddedFlowComponentType.Input) {
|
|
8557
8628
|
const config = component.config || {};
|
|
8558
8629
|
fields.push({
|
|
8559
8630
|
name: config.name || component.id,
|
|
@@ -8627,7 +8698,7 @@ var BaseSignUpContent = ({
|
|
|
8627
8698
|
return;
|
|
8628
8699
|
}
|
|
8629
8700
|
setIsLoading(true);
|
|
8630
|
-
|
|
8701
|
+
clearMessages();
|
|
8631
8702
|
try {
|
|
8632
8703
|
const filteredInputs = {};
|
|
8633
8704
|
if (data) {
|
|
@@ -8646,11 +8717,11 @@ var BaseSignUpContent = ({
|
|
|
8646
8717
|
const rawResponse = await onSubmit(payload);
|
|
8647
8718
|
const response = normalizeFlowResponse2(rawResponse);
|
|
8648
8719
|
onFlowChange?.(response);
|
|
8649
|
-
if (response.flowStatus ===
|
|
8720
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8650
8721
|
onComplete?.(response);
|
|
8651
8722
|
return;
|
|
8652
8723
|
}
|
|
8653
|
-
if (response.flowStatus ===
|
|
8724
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8654
8725
|
if (handleRedirectionIfNeeded(response, component)) {
|
|
8655
8726
|
return;
|
|
8656
8727
|
}
|
|
@@ -8658,15 +8729,14 @@ var BaseSignUpContent = ({
|
|
|
8658
8729
|
setupFormFields(response);
|
|
8659
8730
|
}
|
|
8660
8731
|
} catch (err) {
|
|
8661
|
-
|
|
8662
|
-
setError(errorMessage);
|
|
8732
|
+
handleError(err);
|
|
8663
8733
|
onError?.(err);
|
|
8664
8734
|
} finally {
|
|
8665
8735
|
setIsLoading(false);
|
|
8666
8736
|
}
|
|
8667
8737
|
};
|
|
8668
8738
|
const handleRedirectionIfNeeded = (response, component) => {
|
|
8669
|
-
if (response?.type ===
|
|
8739
|
+
if (response?.type === import_browser60.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {
|
|
8670
8740
|
const redirectUrl = response.data.redirectURL;
|
|
8671
8741
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
8672
8742
|
if (!popup) {
|
|
@@ -8695,17 +8765,16 @@ var BaseSignUpContent = ({
|
|
|
8695
8765
|
try {
|
|
8696
8766
|
const continueResponse = await onSubmit(payload);
|
|
8697
8767
|
onFlowChange?.(continueResponse);
|
|
8698
|
-
if (continueResponse.flowStatus ===
|
|
8768
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8699
8769
|
onComplete?.(continueResponse);
|
|
8700
|
-
} else if (continueResponse.flowStatus ===
|
|
8770
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8701
8771
|
setCurrentFlow(continueResponse);
|
|
8702
8772
|
setupFormFields(continueResponse);
|
|
8703
8773
|
}
|
|
8704
8774
|
popup.close();
|
|
8705
8775
|
cleanup();
|
|
8706
8776
|
} catch (err) {
|
|
8707
|
-
|
|
8708
|
-
setError(errorMessage);
|
|
8777
|
+
handleError(err);
|
|
8709
8778
|
onError?.(err);
|
|
8710
8779
|
popup.close();
|
|
8711
8780
|
cleanup();
|
|
@@ -8736,9 +8805,9 @@ var BaseSignUpContent = ({
|
|
|
8736
8805
|
const url = new URL(popupUrl);
|
|
8737
8806
|
const code = url.searchParams.get("code");
|
|
8738
8807
|
const state = url.searchParams.get("state");
|
|
8739
|
-
const
|
|
8740
|
-
if (
|
|
8741
|
-
console.error("OAuth error:",
|
|
8808
|
+
const error = url.searchParams.get("error");
|
|
8809
|
+
if (error) {
|
|
8810
|
+
console.error("OAuth error:", error);
|
|
8742
8811
|
popup.close();
|
|
8743
8812
|
cleanup();
|
|
8744
8813
|
return;
|
|
@@ -8756,16 +8825,15 @@ var BaseSignUpContent = ({
|
|
|
8756
8825
|
try {
|
|
8757
8826
|
const continueResponse = await onSubmit(payload);
|
|
8758
8827
|
onFlowChange?.(continueResponse);
|
|
8759
|
-
if (continueResponse.flowStatus ===
|
|
8828
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8760
8829
|
onComplete?.(continueResponse);
|
|
8761
|
-
} else if (continueResponse.flowStatus ===
|
|
8830
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8762
8831
|
setCurrentFlow(continueResponse);
|
|
8763
8832
|
setupFormFields(continueResponse);
|
|
8764
8833
|
}
|
|
8765
8834
|
popup.close();
|
|
8766
8835
|
} catch (err) {
|
|
8767
|
-
|
|
8768
|
-
setError(errorMessage);
|
|
8836
|
+
handleError(err);
|
|
8769
8837
|
onError?.(err);
|
|
8770
8838
|
popup.close();
|
|
8771
8839
|
}
|
|
@@ -8783,30 +8851,30 @@ var BaseSignUpContent = ({
|
|
|
8783
8851
|
};
|
|
8784
8852
|
const containerClasses = (0, import_css39.cx)(
|
|
8785
8853
|
[
|
|
8786
|
-
(0,
|
|
8787
|
-
(0,
|
|
8788
|
-
(0,
|
|
8854
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup"),
|
|
8855
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${size}`),
|
|
8856
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${variant}`)
|
|
8789
8857
|
],
|
|
8790
8858
|
className
|
|
8791
8859
|
);
|
|
8792
8860
|
const inputClasses = (0, import_css39.cx)(
|
|
8793
8861
|
[
|
|
8794
|
-
(0,
|
|
8795
|
-
size === "small" && (0,
|
|
8796
|
-
size === "large" && (0,
|
|
8862
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__input"),
|
|
8863
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--small"),
|
|
8864
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--large")
|
|
8797
8865
|
],
|
|
8798
8866
|
inputClassName
|
|
8799
8867
|
);
|
|
8800
8868
|
const buttonClasses = (0, import_css39.cx)(
|
|
8801
8869
|
[
|
|
8802
|
-
(0,
|
|
8803
|
-
size === "small" && (0,
|
|
8804
|
-
size === "large" && (0,
|
|
8870
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__button"),
|
|
8871
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--small"),
|
|
8872
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--large")
|
|
8805
8873
|
],
|
|
8806
8874
|
buttonClassName
|
|
8807
8875
|
);
|
|
8808
|
-
const errorClasses = (0, import_css39.cx)([(0,
|
|
8809
|
-
const messageClasses = (0, import_css39.cx)([(0,
|
|
8876
|
+
const errorClasses = (0, import_css39.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
8877
|
+
const messageClasses = (0, import_css39.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
8810
8878
|
const renderComponents = (0, import_react62.useCallback)(
|
|
8811
8879
|
(components) => renderSignUpComponents(
|
|
8812
8880
|
components,
|
|
@@ -8818,7 +8886,6 @@ var BaseSignUpContent = ({
|
|
|
8818
8886
|
handleInputChange,
|
|
8819
8887
|
{
|
|
8820
8888
|
buttonClassName: buttonClasses,
|
|
8821
|
-
error,
|
|
8822
8889
|
inputClassName: inputClasses,
|
|
8823
8890
|
onSubmit: handleSubmit,
|
|
8824
8891
|
size,
|
|
@@ -8833,7 +8900,6 @@ var BaseSignUpContent = ({
|
|
|
8833
8900
|
isLoading,
|
|
8834
8901
|
size,
|
|
8835
8902
|
variant,
|
|
8836
|
-
error,
|
|
8837
8903
|
inputClasses,
|
|
8838
8904
|
buttonClasses,
|
|
8839
8905
|
handleSubmit
|
|
@@ -8844,23 +8910,22 @@ var BaseSignUpContent = ({
|
|
|
8844
8910
|
initializationAttemptedRef.current = true;
|
|
8845
8911
|
(async () => {
|
|
8846
8912
|
setIsLoading(true);
|
|
8847
|
-
|
|
8913
|
+
clearMessages();
|
|
8848
8914
|
try {
|
|
8849
8915
|
const rawResponse = await onInitialize();
|
|
8850
8916
|
const response = normalizeFlowResponse2(rawResponse);
|
|
8851
8917
|
setCurrentFlow(response);
|
|
8852
8918
|
setIsFlowInitialized(true);
|
|
8853
8919
|
onFlowChange?.(response);
|
|
8854
|
-
if (response.flowStatus ===
|
|
8920
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8855
8921
|
onComplete?.(response);
|
|
8856
8922
|
return;
|
|
8857
8923
|
}
|
|
8858
|
-
if (response.flowStatus ===
|
|
8924
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8859
8925
|
setupFormFields(response);
|
|
8860
8926
|
}
|
|
8861
8927
|
} catch (err) {
|
|
8862
|
-
|
|
8863
|
-
setError(errorMessage);
|
|
8928
|
+
handleError(err);
|
|
8864
8929
|
onError?.(err);
|
|
8865
8930
|
} finally {
|
|
8866
8931
|
setIsLoading(false);
|
|
@@ -8886,7 +8951,6 @@ var BaseSignUpContent = ({
|
|
|
8886
8951
|
touched: touchedFields,
|
|
8887
8952
|
isValid: isFormValid,
|
|
8888
8953
|
isLoading,
|
|
8889
|
-
error,
|
|
8890
8954
|
components: currentFlow?.data?.components || [],
|
|
8891
8955
|
handleInputChange,
|
|
8892
8956
|
handleSubmit,
|
|
@@ -8895,41 +8959,39 @@ var BaseSignUpContent = ({
|
|
|
8895
8959
|
subtitle: flowSubtitle || t("signup.subtitle"),
|
|
8896
8960
|
messages: flowMessages || []
|
|
8897
8961
|
};
|
|
8898
|
-
return /* @__PURE__ */ (0,
|
|
8962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
8899
8963
|
}
|
|
8900
8964
|
if (!isFlowInitialized && isLoading) {
|
|
8901
|
-
return /* @__PURE__ */ (0,
|
|
8965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
8902
8966
|
}
|
|
8903
8967
|
if (!currentFlow) {
|
|
8904
|
-
return /* @__PURE__ */ (0,
|
|
8905
|
-
/* @__PURE__ */ (0,
|
|
8906
|
-
/* @__PURE__ */ (0,
|
|
8968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
8969
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Title, { children: t("errors.title") }),
|
|
8970
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: t("errors.sign.up.flow.initialization.failure") })
|
|
8907
8971
|
] }) }) });
|
|
8908
8972
|
}
|
|
8909
|
-
return /* @__PURE__ */ (0,
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
{
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && renderComponents(currentFlow.data.components) })
|
|
8925
|
-
] })
|
|
8973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: [
|
|
8974
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
8975
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.title") }),
|
|
8976
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.subtitle") }),
|
|
8977
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
8978
|
+
Alert_default,
|
|
8979
|
+
{
|
|
8980
|
+
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
8981
|
+
className: (0, import_css39.cx)(styles.flowMessageItem, messageClasses),
|
|
8982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: message.message })
|
|
8983
|
+
},
|
|
8984
|
+
message.id || index
|
|
8985
|
+
)) })
|
|
8986
|
+
] }),
|
|
8987
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", children: t("errors.sign.up.components.not.available") }) }) }) })
|
|
8926
8988
|
] });
|
|
8927
8989
|
};
|
|
8928
8990
|
var BaseSignUp_default = BaseSignUp;
|
|
8929
8991
|
|
|
8930
8992
|
// src/components/presentation/SignUp/SignUp.tsx
|
|
8931
|
-
var
|
|
8932
|
-
var
|
|
8993
|
+
var import_browser61 = require("@asgardeo/browser");
|
|
8994
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
8933
8995
|
var SignUp = ({
|
|
8934
8996
|
className,
|
|
8935
8997
|
size = "medium",
|
|
@@ -8943,23 +9005,23 @@ var SignUp = ({
|
|
|
8943
9005
|
const { signUp, isInitialized, applicationId, platform } = useAsgardeo_default();
|
|
8944
9006
|
const handleInitialize = async (payload) => {
|
|
8945
9007
|
const initialPayload = payload || {
|
|
8946
|
-
flowType:
|
|
8947
|
-
...platform ===
|
|
9008
|
+
flowType: import_browser61.EmbeddedFlowType.Registration,
|
|
9009
|
+
...platform === import_browser61.Platform.AsgardeoV2 && applicationId && { applicationId }
|
|
8948
9010
|
};
|
|
8949
9011
|
return await signUp(initialPayload);
|
|
8950
9012
|
};
|
|
8951
9013
|
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
8952
9014
|
const handleComplete = (response) => {
|
|
8953
9015
|
onComplete?.(response);
|
|
8954
|
-
if (shouldRedirectAfterSignUp && response?.type !==
|
|
9016
|
+
if (shouldRedirectAfterSignUp && response?.type !== import_browser61.EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {
|
|
8955
9017
|
window.location.href = afterSignUpUrl;
|
|
8956
9018
|
}
|
|
8957
|
-
if (shouldRedirectAfterSignUp && response?.type ===
|
|
9019
|
+
if (shouldRedirectAfterSignUp && response?.type === import_browser61.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
8958
9020
|
!response.data.redirectURL.includes("auth")) {
|
|
8959
9021
|
window.location.href = response.data.redirectURL;
|
|
8960
9022
|
}
|
|
8961
9023
|
};
|
|
8962
|
-
return /* @__PURE__ */ (0,
|
|
9024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
8963
9025
|
BaseSignUp_default,
|
|
8964
9026
|
{
|
|
8965
9027
|
afterSignUpUrl,
|
|
@@ -8978,75 +9040,75 @@ var SignUp = ({
|
|
|
8978
9040
|
var SignUp_default = SignUp;
|
|
8979
9041
|
|
|
8980
9042
|
// src/components/presentation/User/BaseUser.tsx
|
|
8981
|
-
var
|
|
9043
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
8982
9044
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
8983
9045
|
if (!user) {
|
|
8984
|
-
return /* @__PURE__ */ (0,
|
|
9046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: fallback });
|
|
8985
9047
|
}
|
|
8986
|
-
return /* @__PURE__ */ (0,
|
|
9048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: children(user) });
|
|
8987
9049
|
};
|
|
8988
9050
|
BaseUser.displayName = "BaseUser";
|
|
8989
9051
|
var BaseUser_default = BaseUser;
|
|
8990
9052
|
|
|
8991
9053
|
// src/components/presentation/User/User.tsx
|
|
8992
|
-
var
|
|
9054
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
8993
9055
|
var User5 = ({ children, fallback = null }) => {
|
|
8994
9056
|
const { user } = useAsgardeo_default();
|
|
8995
|
-
return /* @__PURE__ */ (0,
|
|
9057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(BaseUser_default, { user, fallback, children });
|
|
8996
9058
|
};
|
|
8997
9059
|
User5.displayName = "User";
|
|
8998
9060
|
var User_default = User5;
|
|
8999
9061
|
|
|
9000
9062
|
// src/components/presentation/Organization/BaseOrganization.tsx
|
|
9001
|
-
var
|
|
9063
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
9002
9064
|
var BaseOrganization = ({ children, fallback = null, organization }) => {
|
|
9003
9065
|
if (!organization) {
|
|
9004
|
-
return /* @__PURE__ */ (0,
|
|
9066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: fallback });
|
|
9005
9067
|
}
|
|
9006
|
-
return /* @__PURE__ */ (0,
|
|
9068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: children(organization) });
|
|
9007
9069
|
};
|
|
9008
9070
|
BaseOrganization.displayName = "BaseOrganization";
|
|
9009
9071
|
var BaseOrganization_default = BaseOrganization;
|
|
9010
9072
|
|
|
9011
9073
|
// src/components/presentation/Organization/Organization.tsx
|
|
9012
|
-
var
|
|
9074
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
9013
9075
|
var Organization5 = ({ children, fallback = null }) => {
|
|
9014
9076
|
const { currentOrganization } = useOrganization_default();
|
|
9015
|
-
return /* @__PURE__ */ (0,
|
|
9077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(BaseOrganization_default, { organization: currentOrganization, fallback, children });
|
|
9016
9078
|
};
|
|
9017
9079
|
Organization5.displayName = "Organization";
|
|
9018
9080
|
var Organization_default = Organization5;
|
|
9019
9081
|
|
|
9020
9082
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
9021
|
-
var
|
|
9083
|
+
var import_browser67 = require("@asgardeo/browser");
|
|
9022
9084
|
var import_css47 = require("@emotion/css");
|
|
9023
9085
|
var import_react71 = require("react");
|
|
9024
9086
|
|
|
9025
9087
|
// src/utils/getMappedUserProfileValue.ts
|
|
9026
|
-
var
|
|
9088
|
+
var import_browser62 = require("@asgardeo/browser");
|
|
9027
9089
|
var getMappedUserProfileValue = (key, mappings, user) => {
|
|
9028
9090
|
if (!key || !mappings || !user) {
|
|
9029
9091
|
return void 0;
|
|
9030
9092
|
}
|
|
9031
9093
|
const mapping = mappings[key];
|
|
9032
9094
|
if (!mapping) {
|
|
9033
|
-
return (0,
|
|
9095
|
+
return (0, import_browser62.get)(user, key);
|
|
9034
9096
|
}
|
|
9035
9097
|
if (Array.isArray(mapping)) {
|
|
9036
9098
|
for (const path of mapping) {
|
|
9037
|
-
const value = (0,
|
|
9099
|
+
const value = (0, import_browser62.get)(user, path);
|
|
9038
9100
|
if (value !== void 0 && value !== null && value !== "") {
|
|
9039
9101
|
return value;
|
|
9040
9102
|
}
|
|
9041
9103
|
}
|
|
9042
9104
|
return void 0;
|
|
9043
9105
|
}
|
|
9044
|
-
return (0,
|
|
9106
|
+
return (0, import_browser62.get)(user, mapping);
|
|
9045
9107
|
};
|
|
9046
9108
|
var getMappedUserProfileValue_default = getMappedUserProfileValue;
|
|
9047
9109
|
|
|
9048
9110
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9049
|
-
var
|
|
9111
|
+
var import_browser63 = require("@asgardeo/browser");
|
|
9050
9112
|
var import_css41 = require("@emotion/css");
|
|
9051
9113
|
var import_react64 = require("react");
|
|
9052
9114
|
|
|
@@ -9118,7 +9180,7 @@ var useStyles19 = (theme, colorScheme, size, variant, backgroundColor) => {
|
|
|
9118
9180
|
var Avatar_styles_default = useStyles19;
|
|
9119
9181
|
|
|
9120
9182
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9121
|
-
var
|
|
9183
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
9122
9184
|
var Avatar = ({
|
|
9123
9185
|
alt = "User avatar",
|
|
9124
9186
|
background = "random",
|
|
@@ -9165,33 +9227,33 @@ var Avatar = ({
|
|
|
9165
9227
|
const getInitials = (fullName) => fullName.split(" ").map((part) => part[0]).slice(0, 2).join("").toUpperCase();
|
|
9166
9228
|
const renderContent = () => {
|
|
9167
9229
|
if (imageUrl) {
|
|
9168
|
-
return /* @__PURE__ */ (0,
|
|
9230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("img", { src: imageUrl, alt, className: (0, import_css41.cx)((0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "image")), styles.image) });
|
|
9169
9231
|
}
|
|
9170
9232
|
if (name) {
|
|
9171
9233
|
return getInitials(name);
|
|
9172
9234
|
}
|
|
9173
9235
|
if (isLoading) {
|
|
9174
|
-
return /* @__PURE__ */ (0,
|
|
9236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: (0, import_css41.cx)((0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "skeleton")), styles.skeleton) });
|
|
9175
9237
|
}
|
|
9176
|
-
return /* @__PURE__ */ (0,
|
|
9238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9177
9239
|
"svg",
|
|
9178
9240
|
{
|
|
9179
9241
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9180
9242
|
viewBox: "0 0 640 640",
|
|
9181
|
-
className: (0, import_css41.cx)((0,
|
|
9182
|
-
children: /* @__PURE__ */ (0,
|
|
9243
|
+
className: (0, import_css41.cx)((0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "icon")), styles.icon),
|
|
9244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
9183
9245
|
}
|
|
9184
9246
|
);
|
|
9185
9247
|
};
|
|
9186
|
-
return /* @__PURE__ */ (0,
|
|
9248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9187
9249
|
"div",
|
|
9188
9250
|
{
|
|
9189
9251
|
className: (0, import_css41.cx)(
|
|
9190
|
-
(0,
|
|
9252
|
+
(0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar")),
|
|
9191
9253
|
styles.avatar,
|
|
9192
9254
|
styles.variant,
|
|
9193
|
-
(0,
|
|
9194
|
-
isDefaultState && (0,
|
|
9255
|
+
(0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", null, variant)),
|
|
9256
|
+
isDefaultState && (0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "default")),
|
|
9195
9257
|
className
|
|
9196
9258
|
),
|
|
9197
9259
|
children: renderContent()
|
|
@@ -9201,14 +9263,14 @@ var Avatar = ({
|
|
|
9201
9263
|
var Avatar_default = Avatar;
|
|
9202
9264
|
|
|
9203
9265
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9204
|
-
var
|
|
9266
|
+
var import_browser64 = require("@asgardeo/browser");
|
|
9205
9267
|
var import_react66 = require("@floating-ui/react");
|
|
9206
9268
|
var import_css43 = require("@emotion/css");
|
|
9207
9269
|
var import_react67 = __toESM(require("react"), 1);
|
|
9208
9270
|
|
|
9209
9271
|
// src/components/primitives/Icons/LogOut.tsx
|
|
9210
|
-
var
|
|
9211
|
-
var LogOut = (props) => /* @__PURE__ */ (0,
|
|
9272
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
9273
|
+
var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
9212
9274
|
"svg",
|
|
9213
9275
|
{
|
|
9214
9276
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9222,17 +9284,17 @@ var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
|
9222
9284
|
strokeLinejoin: "round",
|
|
9223
9285
|
...props,
|
|
9224
9286
|
children: [
|
|
9225
|
-
/* @__PURE__ */ (0,
|
|
9226
|
-
/* @__PURE__ */ (0,
|
|
9227
|
-
/* @__PURE__ */ (0,
|
|
9287
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "m16 17 5-5-5-5" }),
|
|
9288
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "M21 12H9" }),
|
|
9289
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" })
|
|
9228
9290
|
]
|
|
9229
9291
|
}
|
|
9230
9292
|
);
|
|
9231
9293
|
var LogOut_default = LogOut;
|
|
9232
9294
|
|
|
9233
9295
|
// src/components/primitives/Icons/Plus.tsx
|
|
9234
|
-
var
|
|
9235
|
-
var Plus = (props) => /* @__PURE__ */ (0,
|
|
9296
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
9297
|
+
var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
9236
9298
|
"svg",
|
|
9237
9299
|
{
|
|
9238
9300
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9246,16 +9308,16 @@ var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
|
9246
9308
|
strokeLinejoin: "round",
|
|
9247
9309
|
...props,
|
|
9248
9310
|
children: [
|
|
9249
|
-
/* @__PURE__ */ (0,
|
|
9250
|
-
/* @__PURE__ */ (0,
|
|
9311
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("path", { d: "M5 12h14" }),
|
|
9312
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("path", { d: "M12 5v14" })
|
|
9251
9313
|
]
|
|
9252
9314
|
}
|
|
9253
9315
|
);
|
|
9254
9316
|
var Plus_default = Plus;
|
|
9255
9317
|
|
|
9256
9318
|
// src/components/primitives/Icons/User.tsx
|
|
9257
|
-
var
|
|
9258
|
-
var User7 = (props) => /* @__PURE__ */ (0,
|
|
9319
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
9320
|
+
var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
9259
9321
|
"svg",
|
|
9260
9322
|
{
|
|
9261
9323
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9269,16 +9331,16 @@ var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
|
9269
9331
|
strokeLinejoin: "round",
|
|
9270
9332
|
...props,
|
|
9271
9333
|
children: [
|
|
9272
|
-
/* @__PURE__ */ (0,
|
|
9273
|
-
/* @__PURE__ */ (0,
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("circle", { cx: "12", cy: "7", r: "4" })
|
|
9274
9336
|
]
|
|
9275
9337
|
}
|
|
9276
9338
|
);
|
|
9277
9339
|
var User_default2 = User7;
|
|
9278
9340
|
|
|
9279
9341
|
// src/components/primitives/Icons/X.tsx
|
|
9280
|
-
var
|
|
9281
|
-
var X = (props) => /* @__PURE__ */ (0,
|
|
9342
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
9343
|
+
var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
9282
9344
|
"svg",
|
|
9283
9345
|
{
|
|
9284
9346
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9292,8 +9354,8 @@ var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
|
9292
9354
|
strokeLinejoin: "round",
|
|
9293
9355
|
...props,
|
|
9294
9356
|
children: [
|
|
9295
|
-
/* @__PURE__ */ (0,
|
|
9296
|
-
/* @__PURE__ */ (0,
|
|
9357
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { d: "M18 6 6 18" }),
|
|
9358
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { d: "m6 6 12 12" })
|
|
9297
9359
|
]
|
|
9298
9360
|
}
|
|
9299
9361
|
);
|
|
@@ -9365,7 +9427,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
9365
9427
|
var Dialog_styles_default = useStyles20;
|
|
9366
9428
|
|
|
9367
9429
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9368
|
-
var
|
|
9430
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
9369
9431
|
function useDialog({
|
|
9370
9432
|
initialOpen = false,
|
|
9371
9433
|
open: controlledOpen,
|
|
@@ -9411,7 +9473,7 @@ var useDialogContext = () => {
|
|
|
9411
9473
|
};
|
|
9412
9474
|
function Dialog({ children, ...options }) {
|
|
9413
9475
|
const dialog = useDialog(options);
|
|
9414
|
-
return /* @__PURE__ */ (0,
|
|
9476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
9415
9477
|
}
|
|
9416
9478
|
var DialogTrigger = import_react67.default.forwardRef(
|
|
9417
9479
|
({ children, asChild = false, ...props }, propRef) => {
|
|
@@ -9429,7 +9491,7 @@ var DialogTrigger = import_react67.default.forwardRef(
|
|
|
9429
9491
|
})
|
|
9430
9492
|
);
|
|
9431
9493
|
}
|
|
9432
|
-
return /* @__PURE__ */ (0,
|
|
9494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
9433
9495
|
}
|
|
9434
9496
|
);
|
|
9435
9497
|
var DialogContent = import_react67.default.forwardRef((props, propRef) => {
|
|
@@ -9438,11 +9500,11 @@ var DialogContent = import_react67.default.forwardRef((props, propRef) => {
|
|
|
9438
9500
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
9439
9501
|
const ref = (0, import_react66.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
9440
9502
|
if (!floatingContext.open) return null;
|
|
9441
|
-
return /* @__PURE__ */ (0,
|
|
9503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react66.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react66.FloatingOverlay, { className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "overlay")), styles.overlay), lockScroll: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react66.FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9442
9504
|
"div",
|
|
9443
9505
|
{
|
|
9444
9506
|
ref,
|
|
9445
|
-
className: (0, import_css43.cx)((0,
|
|
9507
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "content")), styles.content, props.className),
|
|
9446
9508
|
"aria-labelledby": context.labelId,
|
|
9447
9509
|
"aria-describedby": context.descriptionId,
|
|
9448
9510
|
...context.getFloatingProps(props),
|
|
@@ -9460,18 +9522,18 @@ var DialogHeading = import_react67.default.forwardRef(
|
|
|
9460
9522
|
context.setLabelId(id);
|
|
9461
9523
|
return () => context.setLabelId(void 0);
|
|
9462
9524
|
}, [id, context.setLabelId]);
|
|
9463
|
-
return /* @__PURE__ */ (0,
|
|
9464
|
-
/* @__PURE__ */ (0,
|
|
9525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "header")), styles.header), children: [
|
|
9526
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9465
9527
|
"h2",
|
|
9466
9528
|
{
|
|
9467
9529
|
...props,
|
|
9468
9530
|
ref,
|
|
9469
9531
|
id,
|
|
9470
|
-
className: (0, import_css43.cx)((0,
|
|
9532
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "title")), styles.headerTitle),
|
|
9471
9533
|
children
|
|
9472
9534
|
}
|
|
9473
9535
|
),
|
|
9474
|
-
/* @__PURE__ */ (0,
|
|
9536
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9475
9537
|
Button_default,
|
|
9476
9538
|
{
|
|
9477
9539
|
color: "tertiary",
|
|
@@ -9480,7 +9542,7 @@ var DialogHeading = import_react67.default.forwardRef(
|
|
|
9480
9542
|
shape: "round",
|
|
9481
9543
|
onClick: () => context.setOpen(false),
|
|
9482
9544
|
"aria-label": "Close",
|
|
9483
|
-
children: /* @__PURE__ */ (0,
|
|
9545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(X_default, { width: 16, height: 16 })
|
|
9484
9546
|
}
|
|
9485
9547
|
)
|
|
9486
9548
|
] });
|
|
@@ -9496,13 +9558,13 @@ var DialogDescription = import_react67.default.forwardRef(
|
|
|
9496
9558
|
context.setDescriptionId(id);
|
|
9497
9559
|
return () => context.setDescriptionId(void 0);
|
|
9498
9560
|
}, [id, context.setDescriptionId]);
|
|
9499
|
-
return /* @__PURE__ */ (0,
|
|
9561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9500
9562
|
"p",
|
|
9501
9563
|
{
|
|
9502
9564
|
...props,
|
|
9503
9565
|
ref,
|
|
9504
9566
|
id,
|
|
9505
|
-
className: (0, import_css43.cx)((0,
|
|
9567
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "description")), styles.description, props.className),
|
|
9506
9568
|
children
|
|
9507
9569
|
}
|
|
9508
9570
|
);
|
|
@@ -9526,13 +9588,13 @@ var DialogClose = import_react67.default.forwardRef(({ children, asChild = false
|
|
|
9526
9588
|
onClick: handleClick
|
|
9527
9589
|
});
|
|
9528
9590
|
}
|
|
9529
|
-
return /* @__PURE__ */ (0,
|
|
9591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9530
9592
|
Button_default,
|
|
9531
9593
|
{
|
|
9532
9594
|
...props,
|
|
9533
9595
|
ref,
|
|
9534
9596
|
onClick: handleClick,
|
|
9535
|
-
className: (0, import_css43.cx)((0,
|
|
9597
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "close")), props.className),
|
|
9536
9598
|
variant: "text",
|
|
9537
9599
|
children
|
|
9538
9600
|
}
|
|
@@ -9553,7 +9615,7 @@ var Dialog_default = Dialog;
|
|
|
9553
9615
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9554
9616
|
var import_react69 = require("react");
|
|
9555
9617
|
var import_css45 = require("@emotion/css");
|
|
9556
|
-
var
|
|
9618
|
+
var import_browser65 = require("@asgardeo/browser");
|
|
9557
9619
|
|
|
9558
9620
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
9559
9621
|
var import_css44 = require("@emotion/css");
|
|
@@ -9649,7 +9711,7 @@ var useStyles21 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove
|
|
|
9649
9711
|
var MultiInput_styles_default = useStyles21;
|
|
9650
9712
|
|
|
9651
9713
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9652
|
-
var
|
|
9714
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
9653
9715
|
var MultiInput = ({
|
|
9654
9716
|
label,
|
|
9655
9717
|
error,
|
|
@@ -9672,8 +9734,8 @@ var MultiInput = ({
|
|
|
9672
9734
|
const canAddMore = !maxFields || values.length < maxFields;
|
|
9673
9735
|
const canRemove = values.length > minFields;
|
|
9674
9736
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
9675
|
-
const PlusIcon = ({ className: className2 }) => /* @__PURE__ */ (0,
|
|
9676
|
-
const BinIcon = ({ className: className2 }) => /* @__PURE__ */ (0,
|
|
9737
|
+
const PlusIcon = ({ className: className2 }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css45.cx)(styles.icon, className2), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
9738
|
+
const BinIcon = ({ className: className2 }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css45.cx)(styles.icon, className2), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("path", { d: "M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6" }) });
|
|
9677
9739
|
const handleAddValue = (0, import_react69.useCallback)(
|
|
9678
9740
|
(newValue) => {
|
|
9679
9741
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
@@ -9717,9 +9779,9 @@ var MultiInput = ({
|
|
|
9717
9779
|
};
|
|
9718
9780
|
switch (fieldType) {
|
|
9719
9781
|
case "DATE_TIME":
|
|
9720
|
-
return /* @__PURE__ */ (0,
|
|
9782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DatePicker_default, { ...commonProps });
|
|
9721
9783
|
case "BOOLEAN":
|
|
9722
|
-
return /* @__PURE__ */ (0,
|
|
9784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9723
9785
|
Checkbox_default,
|
|
9724
9786
|
{
|
|
9725
9787
|
...commonProps,
|
|
@@ -9728,7 +9790,7 @@ var MultiInput = ({
|
|
|
9728
9790
|
}
|
|
9729
9791
|
);
|
|
9730
9792
|
default:
|
|
9731
|
-
return /* @__PURE__ */ (0,
|
|
9793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TextField_default, { ...commonProps, type });
|
|
9732
9794
|
}
|
|
9733
9795
|
},
|
|
9734
9796
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
@@ -9740,43 +9802,43 @@ var MultiInput = ({
|
|
|
9740
9802
|
setCurrentInputValue("");
|
|
9741
9803
|
}
|
|
9742
9804
|
}, [currentInputValue, handleAddValue]);
|
|
9743
|
-
return /* @__PURE__ */ (0,
|
|
9805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
9744
9806
|
FormControl_default,
|
|
9745
9807
|
{
|
|
9746
9808
|
error,
|
|
9747
9809
|
helperText,
|
|
9748
|
-
className: (0, import_css45.cx)((0,
|
|
9810
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input")), className),
|
|
9749
9811
|
style,
|
|
9750
9812
|
children: [
|
|
9751
|
-
label && /* @__PURE__ */ (0,
|
|
9752
|
-
/* @__PURE__ */ (0,
|
|
9753
|
-
/* @__PURE__ */ (0,
|
|
9813
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
9814
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "container")), styles.container), children: [
|
|
9815
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "input-row")), styles.inputRow), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "input-wrapper")), styles.inputWrapper), children: renderInputField(
|
|
9754
9816
|
currentInputValue,
|
|
9755
9817
|
setCurrentInputValue,
|
|
9756
|
-
canAddMore ? /* @__PURE__ */ (0,
|
|
9818
|
+
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(PlusIcon, { className: styles.plusIcon }) : void 0,
|
|
9757
9819
|
canAddMore ? handleInputSubmit : void 0
|
|
9758
9820
|
) }) }),
|
|
9759
|
-
values.length > 0 && /* @__PURE__ */ (0,
|
|
9821
|
+
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "list-container")), styles.listContainer), children: values.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
9760
9822
|
"div",
|
|
9761
9823
|
{
|
|
9762
|
-
className: (0, import_css45.cx)((0,
|
|
9824
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "list-item")), styles.listItem),
|
|
9763
9825
|
children: [
|
|
9764
|
-
/* @__PURE__ */ (0,
|
|
9826
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9765
9827
|
"span",
|
|
9766
9828
|
{
|
|
9767
|
-
className: (0, import_css45.cx)((0,
|
|
9829
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "list-item-text")), styles.listItemText),
|
|
9768
9830
|
children: value
|
|
9769
9831
|
}
|
|
9770
9832
|
),
|
|
9771
|
-
canRemove && /* @__PURE__ */ (0,
|
|
9833
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9772
9834
|
"button",
|
|
9773
9835
|
{
|
|
9774
9836
|
type: "button",
|
|
9775
9837
|
onClick: () => handleRemoveValue(index),
|
|
9776
9838
|
disabled,
|
|
9777
|
-
className: (0, import_css45.cx)((0,
|
|
9839
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "remove-button")), styles.removeButton),
|
|
9778
9840
|
title: "Remove value",
|
|
9779
|
-
children: /* @__PURE__ */ (0,
|
|
9841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BinIcon, { className: styles.icon })
|
|
9780
9842
|
}
|
|
9781
9843
|
)
|
|
9782
9844
|
]
|
|
@@ -9793,7 +9855,7 @@ var MultiInput_default = MultiInput;
|
|
|
9793
9855
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
9794
9856
|
var import_css46 = require("@emotion/css");
|
|
9795
9857
|
var import_react70 = require("react");
|
|
9796
|
-
var
|
|
9858
|
+
var import_browser66 = require("@asgardeo/browser");
|
|
9797
9859
|
var useStyles22 = (theme, colorScheme) => {
|
|
9798
9860
|
const valuePlaceholder = import_css46.css`
|
|
9799
9861
|
font-style: italic;
|
|
@@ -9904,7 +9966,7 @@ var useStyles22 = (theme, colorScheme) => {
|
|
|
9904
9966
|
max-width: 350px;
|
|
9905
9967
|
text-align: start;
|
|
9906
9968
|
|
|
9907
|
-
.${(0,
|
|
9969
|
+
.${(0, import_browser66.withVendorCSSClassPrefix)("form-control")} {
|
|
9908
9970
|
margin-bottom: 0;
|
|
9909
9971
|
}
|
|
9910
9972
|
|
|
@@ -9975,7 +10037,7 @@ var getDisplayName = (mergedMappings, user) => {
|
|
|
9975
10037
|
var getDisplayName_default = getDisplayName;
|
|
9976
10038
|
|
|
9977
10039
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
9978
|
-
var
|
|
10040
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
9979
10041
|
var fieldsToSkip = [
|
|
9980
10042
|
"roles.default",
|
|
9981
10043
|
"active",
|
|
@@ -10035,7 +10097,7 @@ var BaseUserProfile = ({
|
|
|
10035
10097
|
},
|
|
10036
10098
|
[showFields, hideFields]
|
|
10037
10099
|
);
|
|
10038
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
10100
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10039
10101
|
"svg",
|
|
10040
10102
|
{
|
|
10041
10103
|
width: "16",
|
|
@@ -10046,7 +10108,7 @@ var BaseUserProfile = ({
|
|
|
10046
10108
|
strokeWidth: "2",
|
|
10047
10109
|
strokeLinecap: "round",
|
|
10048
10110
|
strokeLinejoin: "round",
|
|
10049
|
-
children: /* @__PURE__ */ (0,
|
|
10111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
10050
10112
|
}
|
|
10051
10113
|
);
|
|
10052
10114
|
const toggleFieldEdit = (0, import_react71.useCallback)((fieldName) => {
|
|
@@ -10071,12 +10133,12 @@ var BaseUserProfile = ({
|
|
|
10071
10133
|
}, []);
|
|
10072
10134
|
const ObjectDisplay = ({ data }) => {
|
|
10073
10135
|
if (!data || typeof data !== "object") return null;
|
|
10074
|
-
return /* @__PURE__ */ (0,
|
|
10075
|
-
/* @__PURE__ */ (0,
|
|
10136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("table", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("tr", { children: [
|
|
10137
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: styles.objectKey, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("strong", { children: [
|
|
10076
10138
|
formatLabel(key),
|
|
10077
10139
|
":"
|
|
10078
10140
|
] }) }),
|
|
10079
|
-
/* @__PURE__ */ (0,
|
|
10141
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: styles.objectValue, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
10080
10142
|
] }, key)) }) });
|
|
10081
10143
|
};
|
|
10082
10144
|
function set(obj, path, value) {
|
|
@@ -10103,7 +10165,7 @@ var BaseUserProfile = ({
|
|
|
10103
10165
|
fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
10104
10166
|
}
|
|
10105
10167
|
let payload = {};
|
|
10106
|
-
if (schema.schemaId && schema.schemaId !==
|
|
10168
|
+
if (schema.schemaId && schema.schemaId !== import_browser67.WellKnownSchemaIds.User) {
|
|
10107
10169
|
payload = {
|
|
10108
10170
|
[schema.schemaId]: {
|
|
10109
10171
|
[fieldName]: fieldValue
|
|
@@ -10149,9 +10211,9 @@ var BaseUserProfile = ({
|
|
|
10149
10211
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
10150
10212
|
const label = displayName || description || name || "";
|
|
10151
10213
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
10152
|
-
return /* @__PURE__ */ (0,
|
|
10153
|
-
/* @__PURE__ */ (0,
|
|
10154
|
-
/* @__PURE__ */ (0,
|
|
10214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: subAttributes.map((subAttr, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.field, children: [
|
|
10215
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
10216
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: Array.isArray(subAttr.value) ? subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ") : typeof subAttr.value === "object" ? JSON.stringify(subAttr.value) : String(subAttr.value) })
|
|
10155
10217
|
] }, index)) });
|
|
10156
10218
|
}
|
|
10157
10219
|
if (Array.isArray(value) || multiValued) {
|
|
@@ -10167,9 +10229,9 @@ var BaseUserProfile = ({
|
|
|
10167
10229
|
} else {
|
|
10168
10230
|
fieldValues = [];
|
|
10169
10231
|
}
|
|
10170
|
-
return /* @__PURE__ */ (0,
|
|
10171
|
-
/* @__PURE__ */ (0,
|
|
10172
|
-
/* @__PURE__ */ (0,
|
|
10232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10233
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10234
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10173
10235
|
MultiInput_default,
|
|
10174
10236
|
{
|
|
10175
10237
|
values: fieldValues,
|
|
@@ -10200,9 +10262,9 @@ var BaseUserProfile = ({
|
|
|
10200
10262
|
} else {
|
|
10201
10263
|
displayValue2 = "-";
|
|
10202
10264
|
}
|
|
10203
|
-
return /* @__PURE__ */ (0,
|
|
10204
|
-
/* @__PURE__ */ (0,
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10266
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10267
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: (0, import_css47.cx)(styles.value, !hasValues ? styles.valuePlaceholder : ""), children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10206
10268
|
Button_default,
|
|
10207
10269
|
{
|
|
10208
10270
|
onClick: onStartEdit,
|
|
@@ -10217,7 +10279,7 @@ var BaseUserProfile = ({
|
|
|
10217
10279
|
] });
|
|
10218
10280
|
}
|
|
10219
10281
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
10220
|
-
return /* @__PURE__ */ (0,
|
|
10282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ObjectDisplay, { data: value });
|
|
10221
10283
|
}
|
|
10222
10284
|
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
10223
10285
|
const fieldValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value || "";
|
|
@@ -10232,16 +10294,16 @@ var BaseUserProfile = ({
|
|
|
10232
10294
|
let field;
|
|
10233
10295
|
switch (type) {
|
|
10234
10296
|
case "STRING":
|
|
10235
|
-
field = /* @__PURE__ */ (0,
|
|
10297
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TextField_default, { ...commonProps });
|
|
10236
10298
|
break;
|
|
10237
10299
|
case "DATE_TIME":
|
|
10238
|
-
field = /* @__PURE__ */ (0,
|
|
10300
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(DatePicker_default, { ...commonProps });
|
|
10239
10301
|
break;
|
|
10240
10302
|
case "BOOLEAN":
|
|
10241
|
-
field = /* @__PURE__ */ (0,
|
|
10303
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Checkbox_default, { ...commonProps, checked: !!fieldValue, onChange: (e) => onEditValue(e.target.checked) });
|
|
10242
10304
|
break;
|
|
10243
10305
|
case "COMPLEX":
|
|
10244
|
-
field = /* @__PURE__ */ (0,
|
|
10306
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10245
10307
|
"textarea",
|
|
10246
10308
|
{
|
|
10247
10309
|
value: fieldValue,
|
|
@@ -10253,11 +10315,11 @@ var BaseUserProfile = ({
|
|
|
10253
10315
|
);
|
|
10254
10316
|
break;
|
|
10255
10317
|
default:
|
|
10256
|
-
field = /* @__PURE__ */ (0,
|
|
10318
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TextField_default, { ...commonProps });
|
|
10257
10319
|
}
|
|
10258
|
-
return /* @__PURE__ */ (0,
|
|
10259
|
-
/* @__PURE__ */ (0,
|
|
10260
|
-
/* @__PURE__ */ (0,
|
|
10320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10321
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10322
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: field })
|
|
10261
10323
|
] });
|
|
10262
10324
|
}
|
|
10263
10325
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
@@ -10270,9 +10332,9 @@ var BaseUserProfile = ({
|
|
|
10270
10332
|
} else {
|
|
10271
10333
|
displayValue = "-";
|
|
10272
10334
|
}
|
|
10273
|
-
return /* @__PURE__ */ (0,
|
|
10274
|
-
/* @__PURE__ */ (0,
|
|
10275
|
-
/* @__PURE__ */ (0,
|
|
10335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10336
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10337
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: (0, import_css47.cx)(styles.value, !hasValue ? styles.valuePlaceholder : ""), children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10276
10338
|
Button_default,
|
|
10277
10339
|
{
|
|
10278
10340
|
onClick: onStartEdit,
|
|
@@ -10300,8 +10362,8 @@ var BaseUserProfile = ({
|
|
|
10300
10362
|
alignItems: "center",
|
|
10301
10363
|
gap: theme.vars.spacing.unit
|
|
10302
10364
|
};
|
|
10303
|
-
return /* @__PURE__ */ (0,
|
|
10304
|
-
/* @__PURE__ */ (0,
|
|
10365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.field, children: [
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.fieldInner, children: renderSchemaField(
|
|
10305
10367
|
schema,
|
|
10306
10368
|
isFieldEditing,
|
|
10307
10369
|
(value) => {
|
|
@@ -10311,12 +10373,12 @@ var BaseUserProfile = ({
|
|
|
10311
10373
|
},
|
|
10312
10374
|
() => toggleFieldEdit(schema.name)
|
|
10313
10375
|
) }),
|
|
10314
|
-
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0,
|
|
10315
|
-
isFieldEditing && /* @__PURE__ */ (0,
|
|
10316
|
-
/* @__PURE__ */ (0,
|
|
10317
|
-
/* @__PURE__ */ (0,
|
|
10376
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.fieldActions, children: [
|
|
10377
|
+
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10378
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
10379
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button_default, { size: "small", color: "secondary", variant: "solid", onClick: () => handleFieldCancel(schema.name), children: "Cancel" })
|
|
10318
10380
|
] }),
|
|
10319
|
-
!isFieldEditing && hasValue && /* @__PURE__ */ (0,
|
|
10381
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10320
10382
|
Button_default,
|
|
10321
10383
|
{
|
|
10322
10384
|
size: "small",
|
|
@@ -10325,7 +10387,7 @@ var BaseUserProfile = ({
|
|
|
10325
10387
|
onClick: () => toggleFieldEdit(schema.name),
|
|
10326
10388
|
title: "Edit",
|
|
10327
10389
|
className: styles.editButton,
|
|
10328
|
-
children: /* @__PURE__ */ (0,
|
|
10390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PencilIcon, {})
|
|
10329
10391
|
}
|
|
10330
10392
|
)
|
|
10331
10393
|
] })
|
|
@@ -10337,7 +10399,7 @@ var BaseUserProfile = ({
|
|
|
10337
10399
|
const containerClasses = (0, import_css47.cx)(
|
|
10338
10400
|
styles.root,
|
|
10339
10401
|
cardLayout ? styles.card : "",
|
|
10340
|
-
(0,
|
|
10402
|
+
(0, import_browser67.withVendorCSSClassPrefix)("user-profile"),
|
|
10341
10403
|
className
|
|
10342
10404
|
);
|
|
10343
10405
|
const currentUser = flattenedProfile || profile;
|
|
@@ -10349,17 +10411,17 @@ var BaseUserProfile = ({
|
|
|
10349
10411
|
if (!shouldShowField(key)) return false;
|
|
10350
10412
|
return value !== void 0 && value !== "" && value !== null;
|
|
10351
10413
|
}).sort(([a], [b]) => a.localeCompare(b));
|
|
10352
|
-
return /* @__PURE__ */ (0,
|
|
10353
|
-
/* @__PURE__ */ (0,
|
|
10354
|
-
/* @__PURE__ */ (0,
|
|
10414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: profileEntries.map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.field, children: [
|
|
10415
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: formatLabel(key) }),
|
|
10416
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: typeof value === "object" ? JSON.stringify(value, null, 2) : String(value) })
|
|
10355
10417
|
] }, key)) });
|
|
10356
10418
|
};
|
|
10357
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
10358
|
-
error && /* @__PURE__ */ (0,
|
|
10359
|
-
/* @__PURE__ */ (0,
|
|
10360
|
-
/* @__PURE__ */ (0,
|
|
10419
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Card_default, { className: containerClasses, children: [
|
|
10420
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Alert_default, { variant: "error", className: (0, import_css47.cx)((0, import_browser67.withVendorCSSClassPrefix)((0, import_browser67.bem)("user-profile", "alert")), styles.alert), children: [
|
|
10421
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Alert_default.Title, { children: t("errors.title") || "Error" }),
|
|
10422
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Alert_default.Description, { children: error })
|
|
10361
10423
|
] }),
|
|
10362
|
-
/* @__PURE__ */ (0,
|
|
10424
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10363
10425
|
Avatar,
|
|
10364
10426
|
{
|
|
10365
10427
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -10369,7 +10431,7 @@ var BaseUserProfile = ({
|
|
|
10369
10431
|
isLoading
|
|
10370
10432
|
}
|
|
10371
10433
|
) }),
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10434
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.infoContainer, children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
10373
10435
|
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
10374
10436
|
if (!editable) {
|
|
10375
10437
|
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
@@ -10386,13 +10448,13 @@ var BaseUserProfile = ({
|
|
|
10386
10448
|
...schema,
|
|
10387
10449
|
value
|
|
10388
10450
|
};
|
|
10389
|
-
return /* @__PURE__ */ (0,
|
|
10451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.info, children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
10390
10452
|
}) : renderProfileWithoutSchemas() })
|
|
10391
10453
|
] });
|
|
10392
10454
|
if (mode === "popup") {
|
|
10393
|
-
return /* @__PURE__ */ (0,
|
|
10394
|
-
/* @__PURE__ */ (0,
|
|
10395
|
-
/* @__PURE__ */ (0,
|
|
10455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Dialog_default.Content, { children: [
|
|
10456
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Dialog_default.Heading, { children: title ?? t("user.profile.title") }),
|
|
10457
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.popup, children: profileContent })
|
|
10396
10458
|
] }) });
|
|
10397
10459
|
}
|
|
10398
10460
|
return profileContent;
|
|
@@ -10403,8 +10465,8 @@ var BaseUserProfile_default = BaseUserProfile;
|
|
|
10403
10465
|
var import_react72 = require("react");
|
|
10404
10466
|
|
|
10405
10467
|
// src/api/updateMeProfile.ts
|
|
10406
|
-
var
|
|
10407
|
-
var httpClient5 =
|
|
10468
|
+
var import_browser68 = require("@asgardeo/browser");
|
|
10469
|
+
var httpClient5 = import_browser68.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser68.AsgardeoSPAClient.getInstance());
|
|
10408
10470
|
var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
10409
10471
|
const defaultFetcher = async (url, config) => {
|
|
10410
10472
|
const response = await httpClient5({
|
|
@@ -10421,7 +10483,7 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
10421
10483
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
10422
10484
|
};
|
|
10423
10485
|
};
|
|
10424
|
-
return (0,
|
|
10486
|
+
return (0, import_browser68.updateMeProfile)({
|
|
10425
10487
|
...requestConfig,
|
|
10426
10488
|
fetcher: fetcher || defaultFetcher
|
|
10427
10489
|
});
|
|
@@ -10429,8 +10491,8 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
10429
10491
|
var updateMeProfile_default = updateMeProfile;
|
|
10430
10492
|
|
|
10431
10493
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
10432
|
-
var
|
|
10433
|
-
var
|
|
10494
|
+
var import_browser69 = require("@asgardeo/browser");
|
|
10495
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
10434
10496
|
var UserProfile3 = ({ ...rest }) => {
|
|
10435
10497
|
const { baseUrl, isLoading } = useAsgardeo_default();
|
|
10436
10498
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
@@ -10443,13 +10505,13 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10443
10505
|
onUpdateProfile(response);
|
|
10444
10506
|
} catch (error2) {
|
|
10445
10507
|
let message = t("user.profile.update.generic.error");
|
|
10446
|
-
if (error2 instanceof
|
|
10508
|
+
if (error2 instanceof import_browser69.AsgardeoError) {
|
|
10447
10509
|
message = error2?.message;
|
|
10448
10510
|
}
|
|
10449
10511
|
setError(message);
|
|
10450
10512
|
}
|
|
10451
10513
|
};
|
|
10452
|
-
return /* @__PURE__ */ (0,
|
|
10514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
10453
10515
|
BaseUserProfile_default,
|
|
10454
10516
|
{
|
|
10455
10517
|
profile,
|
|
@@ -10464,7 +10526,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10464
10526
|
var UserProfile_default = UserProfile3;
|
|
10465
10527
|
|
|
10466
10528
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10467
|
-
var
|
|
10529
|
+
var import_browser70 = require("@asgardeo/browser");
|
|
10468
10530
|
var import_react74 = require("@floating-ui/react");
|
|
10469
10531
|
var import_css49 = require("@emotion/css");
|
|
10470
10532
|
var import_react75 = require("react");
|
|
@@ -10654,7 +10716,7 @@ var useStyles23 = (theme, colorScheme) => {
|
|
|
10654
10716
|
var BaseUserDropdown_styles_default = useStyles23;
|
|
10655
10717
|
|
|
10656
10718
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10657
|
-
var
|
|
10719
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
10658
10720
|
var BaseUserDropdown = ({
|
|
10659
10721
|
fallback = null,
|
|
10660
10722
|
className = "",
|
|
@@ -10708,14 +10770,14 @@ var BaseUserDropdown = ({
|
|
|
10708
10770
|
defaultMenuItems.push({
|
|
10709
10771
|
label: "Manage Profile",
|
|
10710
10772
|
onClick: onManageProfile,
|
|
10711
|
-
icon: /* @__PURE__ */ (0,
|
|
10773
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(User_default2, { width: "16", height: "16" })
|
|
10712
10774
|
});
|
|
10713
10775
|
}
|
|
10714
10776
|
if (onSignOut) {
|
|
10715
10777
|
defaultMenuItems.push({
|
|
10716
10778
|
label: "Sign Out",
|
|
10717
10779
|
onClick: onSignOut,
|
|
10718
|
-
icon: /* @__PURE__ */ (0,
|
|
10780
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LogOut_default, { width: "16", height: "16" })
|
|
10719
10781
|
});
|
|
10720
10782
|
}
|
|
10721
10783
|
const allMenuItems = [...menuItems];
|
|
@@ -10725,18 +10787,18 @@ var BaseUserDropdown = ({
|
|
|
10725
10787
|
}
|
|
10726
10788
|
allMenuItems.push(...defaultMenuItems);
|
|
10727
10789
|
}
|
|
10728
|
-
return /* @__PURE__ */ (0,
|
|
10729
|
-
/* @__PURE__ */ (0,
|
|
10790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
10791
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10730
10792
|
Button_default,
|
|
10731
10793
|
{
|
|
10732
10794
|
ref: refs.setReference,
|
|
10733
|
-
className: (0, import_css49.cx)((0,
|
|
10795
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__trigger"), styles.trigger),
|
|
10734
10796
|
color: "tertiary",
|
|
10735
10797
|
variant: "text",
|
|
10736
10798
|
size: "medium",
|
|
10737
10799
|
...getReferenceProps(),
|
|
10738
10800
|
children: [
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
10801
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10740
10802
|
Avatar,
|
|
10741
10803
|
{
|
|
10742
10804
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10745,22 +10807,22 @@ var BaseUserDropdown = ({
|
|
|
10745
10807
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10746
10808
|
}
|
|
10747
10809
|
),
|
|
10748
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
10810
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10749
10811
|
Typography_default,
|
|
10750
10812
|
{
|
|
10751
10813
|
variant: "body2",
|
|
10752
|
-
className: (0, import_css49.cx)((0,
|
|
10814
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__trigger-label"), styles.userName),
|
|
10753
10815
|
children: getDisplayName_default(mergedMappings, user)
|
|
10754
10816
|
}
|
|
10755
10817
|
)
|
|
10756
10818
|
]
|
|
10757
10819
|
}
|
|
10758
10820
|
),
|
|
10759
|
-
isOpen && /* @__PURE__ */ (0,
|
|
10821
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react74.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react74.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10760
10822
|
"div",
|
|
10761
10823
|
{
|
|
10762
10824
|
ref: refs.setFloating,
|
|
10763
|
-
className: (0, import_css49.cx)((0,
|
|
10825
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__content"), styles.dropdownContent),
|
|
10764
10826
|
style: {
|
|
10765
10827
|
...floatingStyles,
|
|
10766
10828
|
// Floating UI doesn't set a z-index by default, so we set a high value to ensure the dropdown appears above other elements.
|
|
@@ -10769,8 +10831,8 @@ var BaseUserDropdown = ({
|
|
|
10769
10831
|
},
|
|
10770
10832
|
...getFloatingProps(),
|
|
10771
10833
|
children: [
|
|
10772
|
-
/* @__PURE__ */ (0,
|
|
10773
|
-
/* @__PURE__ */ (0,
|
|
10834
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header"), styles.dropdownHeader), children: [
|
|
10835
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10774
10836
|
Avatar,
|
|
10775
10837
|
{
|
|
10776
10838
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10779,22 +10841,22 @@ var BaseUserDropdown = ({
|
|
|
10779
10841
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10780
10842
|
}
|
|
10781
10843
|
),
|
|
10782
|
-
/* @__PURE__ */ (0,
|
|
10783
|
-
/* @__PURE__ */ (0,
|
|
10844
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-info"), styles.headerInfo), children: [
|
|
10845
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10784
10846
|
Typography_default,
|
|
10785
10847
|
{
|
|
10786
10848
|
noWrap: true,
|
|
10787
|
-
className: (0,
|
|
10849
|
+
className: (0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-name"),
|
|
10788
10850
|
variant: "body1",
|
|
10789
10851
|
fontWeight: "medium",
|
|
10790
10852
|
children: getDisplayName_default(mergedMappings, user)
|
|
10791
10853
|
}
|
|
10792
10854
|
),
|
|
10793
|
-
/* @__PURE__ */ (0,
|
|
10855
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10794
10856
|
Typography_default,
|
|
10795
10857
|
{
|
|
10796
10858
|
noWrap: true,
|
|
10797
|
-
className: (0,
|
|
10859
|
+
className: (0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-email"),
|
|
10798
10860
|
variant: "caption",
|
|
10799
10861
|
color: "secondary",
|
|
10800
10862
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -10802,31 +10864,31 @@ var BaseUserDropdown = ({
|
|
|
10802
10864
|
)
|
|
10803
10865
|
] })
|
|
10804
10866
|
] }),
|
|
10805
|
-
/* @__PURE__ */ (0,
|
|
10867
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu"), styles.dropdownMenu), children: allMenuItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { children: item.label === "" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu-divider"), styles.divider) }) : item.href ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10806
10868
|
"a",
|
|
10807
10869
|
{
|
|
10808
10870
|
href: item.href,
|
|
10809
10871
|
style: {
|
|
10810
10872
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
10811
10873
|
},
|
|
10812
|
-
className: (0, import_css49.cx)((0,
|
|
10874
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu-item"), styles.menuItemAnchor),
|
|
10813
10875
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
10814
10876
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
10815
10877
|
onFocus: () => setHoveredItemIndex(index),
|
|
10816
10878
|
onBlur: () => setHoveredItemIndex(null),
|
|
10817
10879
|
children: [
|
|
10818
10880
|
item.icon,
|
|
10819
|
-
/* @__PURE__ */ (0,
|
|
10881
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: item.label })
|
|
10820
10882
|
]
|
|
10821
10883
|
}
|
|
10822
|
-
) : /* @__PURE__ */ (0,
|
|
10884
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10823
10885
|
Button_default,
|
|
10824
10886
|
{
|
|
10825
10887
|
onClick: () => handleMenuItemClick(item),
|
|
10826
10888
|
style: {
|
|
10827
10889
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
10828
10890
|
},
|
|
10829
|
-
className: (0, import_css49.cx)((0,
|
|
10891
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu-item"), styles.menuItem),
|
|
10830
10892
|
color: "tertiary",
|
|
10831
10893
|
variant: "text",
|
|
10832
10894
|
size: "small",
|
|
@@ -10845,7 +10907,7 @@ var BaseUserDropdown_default = BaseUserDropdown;
|
|
|
10845
10907
|
|
|
10846
10908
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
10847
10909
|
var import_react76 = require("react");
|
|
10848
|
-
var
|
|
10910
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
10849
10911
|
var UserDropdown = ({
|
|
10850
10912
|
children,
|
|
10851
10913
|
renderTrigger,
|
|
@@ -10874,14 +10936,14 @@ var UserDropdown = ({
|
|
|
10874
10936
|
closeProfile
|
|
10875
10937
|
};
|
|
10876
10938
|
if (children) {
|
|
10877
|
-
return /* @__PURE__ */ (0,
|
|
10939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10878
10940
|
children(renderProps),
|
|
10879
|
-
/* @__PURE__ */ (0,
|
|
10941
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10880
10942
|
] });
|
|
10881
10943
|
}
|
|
10882
10944
|
if (renderTrigger || renderDropdown) {
|
|
10883
|
-
return /* @__PURE__ */ (0,
|
|
10884
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0,
|
|
10945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10946
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
10885
10947
|
BaseUserDropdown_default,
|
|
10886
10948
|
{
|
|
10887
10949
|
user,
|
|
@@ -10891,11 +10953,11 @@ var UserDropdown = ({
|
|
|
10891
10953
|
...rest
|
|
10892
10954
|
}
|
|
10893
10955
|
),
|
|
10894
|
-
/* @__PURE__ */ (0,
|
|
10956
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10895
10957
|
] });
|
|
10896
10958
|
}
|
|
10897
|
-
return /* @__PURE__ */ (0,
|
|
10898
|
-
/* @__PURE__ */ (0,
|
|
10959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10960
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
10899
10961
|
BaseUserDropdown_default,
|
|
10900
10962
|
{
|
|
10901
10963
|
user,
|
|
@@ -10905,7 +10967,7 @@ var UserDropdown = ({
|
|
|
10905
10967
|
...rest
|
|
10906
10968
|
}
|
|
10907
10969
|
),
|
|
10908
|
-
isProfileOpen && /* @__PURE__ */ (0,
|
|
10970
|
+
isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10909
10971
|
] });
|
|
10910
10972
|
};
|
|
10911
10973
|
var UserDropdown_default = UserDropdown;
|
|
@@ -10916,9 +10978,9 @@ var import_css51 = require("@emotion/css");
|
|
|
10916
10978
|
var import_react79 = require("react");
|
|
10917
10979
|
|
|
10918
10980
|
// src/components/primitives/Icons/Building.tsx
|
|
10919
|
-
var
|
|
10920
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
10921
|
-
/* @__PURE__ */ (0,
|
|
10981
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
10982
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
10983
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
10922
10984
|
"path",
|
|
10923
10985
|
{
|
|
10924
10986
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -10928,25 +10990,25 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
10928
10990
|
strokeLinejoin: "round"
|
|
10929
10991
|
}
|
|
10930
10992
|
),
|
|
10931
|
-
/* @__PURE__ */ (0,
|
|
10932
|
-
/* @__PURE__ */ (0,
|
|
10933
|
-
/* @__PURE__ */ (0,
|
|
10934
|
-
/* @__PURE__ */ (0,
|
|
10935
|
-
/* @__PURE__ */ (0,
|
|
10936
|
-
/* @__PURE__ */ (0,
|
|
10993
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10994
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10995
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10996
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10997
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10998
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
10937
10999
|
] });
|
|
10938
11000
|
Building.displayName = "Building";
|
|
10939
11001
|
var Building_default = Building;
|
|
10940
11002
|
|
|
10941
11003
|
// src/components/primitives/Icons/Check.tsx
|
|
10942
|
-
var
|
|
10943
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
11004
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11005
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
10944
11006
|
Check.displayName = "Check";
|
|
10945
11007
|
var Check_default = Check;
|
|
10946
11008
|
|
|
10947
11009
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
10948
|
-
var
|
|
10949
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
11010
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
11011
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
10950
11012
|
ChevronDown.displayName = "ChevronDown";
|
|
10951
11013
|
var ChevronDown_default = ChevronDown;
|
|
10952
11014
|
|
|
@@ -11176,7 +11238,7 @@ var useStyles24 = (theme, colorScheme) => {
|
|
|
11176
11238
|
var BaseOrganizationSwitcher_styles_default = useStyles24;
|
|
11177
11239
|
|
|
11178
11240
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
11179
|
-
var
|
|
11241
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
11180
11242
|
var BaseOrganizationSwitcher = ({
|
|
11181
11243
|
organizations,
|
|
11182
11244
|
currentOrganization,
|
|
@@ -11230,8 +11292,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11230
11292
|
const switchableOrganizations = organizations.filter(
|
|
11231
11293
|
(org) => org.id !== currentOrganization?.id
|
|
11232
11294
|
);
|
|
11233
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0,
|
|
11234
|
-
/* @__PURE__ */ (0,
|
|
11295
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11296
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11235
11297
|
Avatar,
|
|
11236
11298
|
{
|
|
11237
11299
|
variant: "square",
|
|
@@ -11241,24 +11303,24 @@ var BaseOrganizationSwitcher = ({
|
|
|
11241
11303
|
alt: `${organization.name} avatar`
|
|
11242
11304
|
}
|
|
11243
11305
|
),
|
|
11244
|
-
/* @__PURE__ */ (0,
|
|
11245
|
-
/* @__PURE__ */ (0,
|
|
11246
|
-
/* @__PURE__ */ (0,
|
|
11247
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11306
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.organizationInfo), children: [
|
|
11307
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "body2", fontWeight: "medium", className: (0, import_css51.cx)(styles.organizationName), children: organization.name }),
|
|
11308
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.organizationMeta), children: [
|
|
11309
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
|
|
11248
11310
|
organization.memberCount,
|
|
11249
11311
|
" ",
|
|
11250
11312
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
11251
11313
|
] }),
|
|
11252
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11253
|
-
showRole && organization.role && /* @__PURE__ */ (0,
|
|
11314
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: " \u2022 " }),
|
|
11315
|
+
showRole && organization.role && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: (0, import_css51.cx)(styles.roleCapitalized), children: organization.role })
|
|
11254
11316
|
] })
|
|
11255
11317
|
] }),
|
|
11256
|
-
isSelected && /* @__PURE__ */ (0,
|
|
11318
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Check_default, { width: "16", height: "16", color: theme.vars.colors.text.primary })
|
|
11257
11319
|
] });
|
|
11258
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */ (0,
|
|
11259
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0,
|
|
11260
|
-
return /* @__PURE__ */ (0,
|
|
11261
|
-
/* @__PURE__ */ (0,
|
|
11320
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css51.cx)(styles.loadingContainer), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "caption", className: (0, import_css51.cx)(styles.loadingText), children: t("organization.switcher.loading.organizations") }) });
|
|
11321
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css51.cx)(styles.errorContainer), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "caption", className: (0, import_css51.cx)(styles.errorText), children: errorMessage }) });
|
|
11322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.root, className), style, children: [
|
|
11323
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11262
11324
|
Button_default,
|
|
11263
11325
|
{
|
|
11264
11326
|
ref: refs.setReference,
|
|
@@ -11268,8 +11330,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11268
11330
|
size: "medium",
|
|
11269
11331
|
...getReferenceProps(),
|
|
11270
11332
|
children: [
|
|
11271
|
-
currentOrganization ? /* @__PURE__ */ (0,
|
|
11272
|
-
/* @__PURE__ */ (0,
|
|
11333
|
+
currentOrganization ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11334
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11273
11335
|
Avatar,
|
|
11274
11336
|
{
|
|
11275
11337
|
variant: "square",
|
|
@@ -11279,18 +11341,18 @@ var BaseOrganizationSwitcher = ({
|
|
|
11279
11341
|
alt: `${currentOrganization.name} avatar`
|
|
11280
11342
|
}
|
|
11281
11343
|
),
|
|
11282
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
11283
|
-
] }) : /* @__PURE__ */ (0,
|
|
11284
|
-
/* @__PURE__ */ (0,
|
|
11285
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
11344
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "body2", className: (0, import_css51.cx)(styles.triggerLabel), children: currentOrganization.name })
|
|
11345
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11346
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Building_default, { width: avatarSize, height: avatarSize }),
|
|
11347
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "body2", className: (0, import_css51.cx)(styles.triggerLabel), children: t("organization.switcher.select.organization") })
|
|
11286
11348
|
] }),
|
|
11287
|
-
/* @__PURE__ */ (0,
|
|
11349
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { style: { transform: isRTL ? "scaleX(-1)" : "none", display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ChevronDown_default, { width: "16", height: "16" }) })
|
|
11288
11350
|
]
|
|
11289
11351
|
}
|
|
11290
11352
|
),
|
|
11291
|
-
isOpen && /* @__PURE__ */ (0,
|
|
11292
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
11293
|
-
/* @__PURE__ */ (0,
|
|
11353
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react78.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react78.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { ref: refs.setFloating, className: (0, import_css51.cx)(styles.content), style: floatingStyles, ...getFloatingProps(), children: [
|
|
11354
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.header), children: [
|
|
11355
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11294
11356
|
Avatar,
|
|
11295
11357
|
{
|
|
11296
11358
|
variant: "square",
|
|
@@ -11300,10 +11362,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11300
11362
|
alt: `${currentOrganization.name} avatar`
|
|
11301
11363
|
}
|
|
11302
11364
|
),
|
|
11303
|
-
/* @__PURE__ */ (0,
|
|
11304
|
-
/* @__PURE__ */ (0,
|
|
11305
|
-
/* @__PURE__ */ (0,
|
|
11306
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11365
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.headerInfo), children: [
|
|
11366
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { noWrap: true, className: (0, import_css51.cx)(styles.headerName), variant: "body1", fontWeight: "medium", children: currentOrganization.name }),
|
|
11367
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.headerMeta), children: [
|
|
11368
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11307
11369
|
Typography_default,
|
|
11308
11370
|
{
|
|
11309
11371
|
noWrap: true,
|
|
@@ -11313,17 +11375,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
11313
11375
|
currentOrganization.memberCount,
|
|
11314
11376
|
" ",
|
|
11315
11377
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
11316
|
-
showRole && currentOrganization.role && /* @__PURE__ */ (0,
|
|
11378
|
+
showRole && currentOrganization.role && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
|
|
11317
11379
|
" \u2022 ",
|
|
11318
11380
|
currentOrganization.role
|
|
11319
11381
|
] })
|
|
11320
11382
|
]
|
|
11321
11383
|
}
|
|
11322
11384
|
),
|
|
11323
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0,
|
|
11385
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { noWrap: true, className: (0, import_css51.cx)(styles.headerRole), variant: "caption", color: "secondary", children: currentOrganization.role })
|
|
11324
11386
|
] })
|
|
11325
11387
|
] }),
|
|
11326
|
-
onManageProfile && /* @__PURE__ */ (0,
|
|
11388
|
+
onManageProfile && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11327
11389
|
Button_default,
|
|
11328
11390
|
{
|
|
11329
11391
|
onClick: onManageProfile,
|
|
@@ -11332,7 +11394,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
11332
11394
|
size: "small",
|
|
11333
11395
|
"aria-label": "Manage Organization Profile",
|
|
11334
11396
|
className: (0, import_css51.cx)(styles.manageButton),
|
|
11335
|
-
endIcon: /* @__PURE__ */ (0,
|
|
11397
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11336
11398
|
"svg",
|
|
11337
11399
|
{
|
|
11338
11400
|
width: "16",
|
|
@@ -11344,8 +11406,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11344
11406
|
strokeLinecap: "round",
|
|
11345
11407
|
strokeLinejoin: "round",
|
|
11346
11408
|
children: [
|
|
11347
|
-
/* @__PURE__ */ (0,
|
|
11348
|
-
/* @__PURE__ */ (0,
|
|
11409
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
11410
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
11349
11411
|
]
|
|
11350
11412
|
}
|
|
11351
11413
|
),
|
|
@@ -11353,20 +11415,20 @@ var BaseOrganizationSwitcher = ({
|
|
|
11353
11415
|
}
|
|
11354
11416
|
)
|
|
11355
11417
|
] }),
|
|
11356
|
-
organizations.length > 1 && /* @__PURE__ */ (0,
|
|
11418
|
+
organizations.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11357
11419
|
"div",
|
|
11358
11420
|
{
|
|
11359
11421
|
className: (0, import_css51.cx)(styles.header, styles.sectionHeaderContainer),
|
|
11360
11422
|
style: {
|
|
11361
11423
|
borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : "none"
|
|
11362
11424
|
},
|
|
11363
|
-
children: /* @__PURE__ */ (0,
|
|
11425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "caption", fontWeight: 600, className: (0, import_css51.cx)(styles.sectionHeader), children: t("organization.switcher.switch.organization") })
|
|
11364
11426
|
}
|
|
11365
11427
|
),
|
|
11366
|
-
/* @__PURE__ */ (0,
|
|
11428
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css51.cx)(styles.menu), children: loading ? renderLoading ? renderLoading() : defaultRenderLoading2() : error ? renderError ? renderError(error) : defaultRenderError2(error) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11367
11429
|
switchableOrganizations.map((organization) => {
|
|
11368
11430
|
const isSelected = false;
|
|
11369
|
-
return /* @__PURE__ */ (0,
|
|
11431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11370
11432
|
Button_default,
|
|
11371
11433
|
{
|
|
11372
11434
|
onClick: () => handleOrganizationSwitch(organization),
|
|
@@ -11384,10 +11446,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11384
11446
|
organization.id
|
|
11385
11447
|
);
|
|
11386
11448
|
}),
|
|
11387
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
11388
|
-
/* @__PURE__ */ (0,
|
|
11449
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11450
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css51.cx)(styles.menuDivider) }),
|
|
11389
11451
|
menuItems.map(
|
|
11390
|
-
(item, index) => /* @__PURE__ */ (0,
|
|
11452
|
+
(item, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11391
11453
|
"a",
|
|
11392
11454
|
{
|
|
11393
11455
|
href: item.href,
|
|
@@ -11401,10 +11463,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11401
11463
|
onBlur: () => setHoveredItemIndex(null),
|
|
11402
11464
|
children: [
|
|
11403
11465
|
item.icon,
|
|
11404
|
-
/* @__PURE__ */ (0,
|
|
11466
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: item.label })
|
|
11405
11467
|
]
|
|
11406
11468
|
}
|
|
11407
|
-
) : /* @__PURE__ */ (0,
|
|
11469
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11408
11470
|
Button_default,
|
|
11409
11471
|
{
|
|
11410
11472
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -11578,7 +11640,7 @@ var useStyles25 = (theme, colorScheme) => {
|
|
|
11578
11640
|
var BaseCreateOrganization_styles_default = useStyles25;
|
|
11579
11641
|
|
|
11580
11642
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
11581
|
-
var
|
|
11643
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
11582
11644
|
var BaseCreateOrganization = ({
|
|
11583
11645
|
cardLayout = true,
|
|
11584
11646
|
className = "",
|
|
@@ -11665,13 +11727,13 @@ var BaseCreateOrganization = ({
|
|
|
11665
11727
|
console.error("Form submission error:", submitError);
|
|
11666
11728
|
}
|
|
11667
11729
|
};
|
|
11668
|
-
const createOrganizationContent = /* @__PURE__ */ (0,
|
|
11669
|
-
/* @__PURE__ */ (0,
|
|
11670
|
-
error && /* @__PURE__ */ (0,
|
|
11671
|
-
/* @__PURE__ */ (0,
|
|
11672
|
-
/* @__PURE__ */ (0,
|
|
11730
|
+
const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.root, cardLayout && styles.card, className), style, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: (0, import_css53.cx)(styles.content), children: [
|
|
11731
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("form", { id: "create-organization-form", className: (0, import_css53.cx)(styles.form), onSubmit: handleSubmit, children: [
|
|
11732
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Alert_default, { variant: "error", className: styles.errorAlert, children: [
|
|
11733
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Title, { children: "Error" }),
|
|
11734
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Description, { children: error })
|
|
11673
11735
|
] }),
|
|
11674
|
-
/* @__PURE__ */ (0,
|
|
11736
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.fieldGroup), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11675
11737
|
TextField_default,
|
|
11676
11738
|
{
|
|
11677
11739
|
label: `${t("organization.create.name.label")}`,
|
|
@@ -11684,7 +11746,7 @@ var BaseCreateOrganization = ({
|
|
|
11684
11746
|
className: (0, import_css53.cx)(styles.input)
|
|
11685
11747
|
}
|
|
11686
11748
|
) }),
|
|
11687
|
-
/* @__PURE__ */ (0,
|
|
11749
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.fieldGroup), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11688
11750
|
TextField_default,
|
|
11689
11751
|
{
|
|
11690
11752
|
label: `${t("organization.create.handle.label") || "Organization Handle"}`,
|
|
@@ -11698,9 +11760,9 @@ var BaseCreateOrganization = ({
|
|
|
11698
11760
|
className: (0, import_css53.cx)(styles.input)
|
|
11699
11761
|
}
|
|
11700
11762
|
) }),
|
|
11701
|
-
/* @__PURE__ */ (0,
|
|
11702
|
-
/* @__PURE__ */ (0,
|
|
11703
|
-
/* @__PURE__ */ (0,
|
|
11763
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.fieldGroup), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(FormControl_default, { error: formErrors.description, children: [
|
|
11764
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InputLabel_default, { required: true, children: t("organization.create.description.label") }),
|
|
11765
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11704
11766
|
"textarea",
|
|
11705
11767
|
{
|
|
11706
11768
|
className: (0, import_css53.cx)(styles.textarea, formErrors.description && styles.textareaError),
|
|
@@ -11714,23 +11776,23 @@ var BaseCreateOrganization = ({
|
|
|
11714
11776
|
] }) }),
|
|
11715
11777
|
renderAdditionalFields && renderAdditionalFields()
|
|
11716
11778
|
] }),
|
|
11717
|
-
/* @__PURE__ */ (0,
|
|
11718
|
-
onCancel && /* @__PURE__ */ (0,
|
|
11719
|
-
/* @__PURE__ */ (0,
|
|
11779
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: (0, import_css53.cx)(styles.actions), children: [
|
|
11780
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.cancel") }),
|
|
11781
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.creating") : t("organization.create.button") })
|
|
11720
11782
|
] })
|
|
11721
11783
|
] }) });
|
|
11722
11784
|
if (mode === "popup") {
|
|
11723
|
-
return /* @__PURE__ */ (0,
|
|
11724
|
-
/* @__PURE__ */ (0,
|
|
11725
|
-
/* @__PURE__ */ (0,
|
|
11785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Dialog_default.Content, { children: [
|
|
11786
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog_default.Heading, { children: title }),
|
|
11787
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: styles.popup, children: createOrganizationContent })
|
|
11726
11788
|
] }) });
|
|
11727
11789
|
}
|
|
11728
11790
|
return createOrganizationContent;
|
|
11729
11791
|
};
|
|
11730
11792
|
|
|
11731
11793
|
// src/api/createOrganization.ts
|
|
11732
|
-
var
|
|
11733
|
-
var httpClient6 =
|
|
11794
|
+
var import_browser71 = require("@asgardeo/browser");
|
|
11795
|
+
var httpClient6 = import_browser71.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser71.AsgardeoSPAClient.getInstance());
|
|
11734
11796
|
var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
11735
11797
|
const defaultFetcher = async (url, config) => {
|
|
11736
11798
|
const response = await httpClient6({
|
|
@@ -11747,7 +11809,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
11747
11809
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
11748
11810
|
};
|
|
11749
11811
|
};
|
|
11750
|
-
return (0,
|
|
11812
|
+
return (0, import_browser71.createOrganization)({
|
|
11751
11813
|
...requestConfig,
|
|
11752
11814
|
fetcher: fetcher || defaultFetcher
|
|
11753
11815
|
});
|
|
@@ -11755,7 +11817,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
11755
11817
|
var createOrganization_default = createOrganization;
|
|
11756
11818
|
|
|
11757
11819
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
11758
|
-
var
|
|
11820
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
11759
11821
|
var CreateOrganization = ({
|
|
11760
11822
|
onCreateOrganization,
|
|
11761
11823
|
fallback = null,
|
|
@@ -11771,7 +11833,7 @@ var CreateOrganization = ({
|
|
|
11771
11833
|
return fallback;
|
|
11772
11834
|
}
|
|
11773
11835
|
if (!isSignedIn) {
|
|
11774
|
-
return /* @__PURE__ */ (0,
|
|
11836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, {});
|
|
11775
11837
|
}
|
|
11776
11838
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
11777
11839
|
const handleSubmit = async (payload) => {
|
|
@@ -11805,7 +11867,7 @@ var CreateOrganization = ({
|
|
|
11805
11867
|
setLoading(false);
|
|
11806
11868
|
}
|
|
11807
11869
|
};
|
|
11808
|
-
return /* @__PURE__ */ (0,
|
|
11870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
11809
11871
|
BaseCreateOrganization,
|
|
11810
11872
|
{
|
|
11811
11873
|
onSubmit: handleSubmit,
|
|
@@ -11822,12 +11884,12 @@ var CreateOrganization = ({
|
|
|
11822
11884
|
var import_react87 = require("react");
|
|
11823
11885
|
|
|
11824
11886
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
11825
|
-
var
|
|
11887
|
+
var import_browser73 = require("@asgardeo/browser");
|
|
11826
11888
|
var import_css57 = require("@emotion/css");
|
|
11827
11889
|
var import_react86 = require("react");
|
|
11828
11890
|
|
|
11829
11891
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
11830
|
-
var
|
|
11892
|
+
var import_browser72 = require("@asgardeo/browser");
|
|
11831
11893
|
var import_css55 = require("@emotion/css");
|
|
11832
11894
|
var import_react84 = require("react");
|
|
11833
11895
|
|
|
@@ -11987,7 +12049,7 @@ var useStyles26 = (theme, colorScheme, disabled, readOnly, hasError) => {
|
|
|
11987
12049
|
var KeyValueInput_styles_default = useStyles26;
|
|
11988
12050
|
|
|
11989
12051
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
11990
|
-
var
|
|
12052
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
11991
12053
|
var KeyValueInput = ({
|
|
11992
12054
|
className = "",
|
|
11993
12055
|
disabled = false,
|
|
@@ -12062,105 +12124,105 @@ var KeyValueInput = ({
|
|
|
12062
12124
|
);
|
|
12063
12125
|
const canAddMore = !maxPairs || pairs.length < maxPairs;
|
|
12064
12126
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
12065
|
-
return /* @__PURE__ */ (0,
|
|
12066
|
-
label && /* @__PURE__ */ (0,
|
|
12127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input")), styles.container, className), children: [
|
|
12128
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("label", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "label")), styles.label), children: [
|
|
12067
12129
|
label,
|
|
12068
|
-
required && /* @__PURE__ */ (0,
|
|
12130
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12069
12131
|
"span",
|
|
12070
12132
|
{
|
|
12071
|
-
className: (0, import_css55.cx)((0,
|
|
12133
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "required")), styles.requiredIndicator),
|
|
12072
12134
|
children: " *"
|
|
12073
12135
|
}
|
|
12074
12136
|
)
|
|
12075
12137
|
] }),
|
|
12076
|
-
/* @__PURE__ */ (0,
|
|
12077
|
-
pairs.length === 0 && readOnly ? /* @__PURE__ */ (0,
|
|
12138
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pairs-list")), styles.pairsList), children: [
|
|
12139
|
+
pairs.length === 0 && readOnly ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "empty-state")), styles.emptyState), children: "No attributes defined" }) : readOnly ? pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12078
12140
|
"div",
|
|
12079
12141
|
{
|
|
12080
|
-
className: (0, import_css55.cx)((0,
|
|
12142
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-pair")), styles.readOnlyPair),
|
|
12081
12143
|
children: [
|
|
12082
|
-
/* @__PURE__ */ (0,
|
|
12144
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12083
12145
|
"span",
|
|
12084
12146
|
{
|
|
12085
|
-
className: (0, import_css55.cx)((0,
|
|
12147
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-key")), styles.readOnlyKey),
|
|
12086
12148
|
children: [
|
|
12087
12149
|
pair.key,
|
|
12088
12150
|
":"
|
|
12089
12151
|
]
|
|
12090
12152
|
}
|
|
12091
12153
|
),
|
|
12092
|
-
/* @__PURE__ */ (0,
|
|
12154
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12093
12155
|
"span",
|
|
12094
12156
|
{
|
|
12095
|
-
className: (0, import_css55.cx)((0,
|
|
12157
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-value")), styles.readOnlyValue),
|
|
12096
12158
|
children: pair.value
|
|
12097
12159
|
}
|
|
12098
12160
|
)
|
|
12099
12161
|
]
|
|
12100
12162
|
},
|
|
12101
12163
|
`${pair.key}-${index}`
|
|
12102
|
-
)) : pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
12164
|
+
)) : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12103
12165
|
"div",
|
|
12104
12166
|
{
|
|
12105
|
-
className: (0, import_css55.cx)((0,
|
|
12167
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-row")), styles.pairRow),
|
|
12106
12168
|
children: [
|
|
12107
|
-
/* @__PURE__ */ (0,
|
|
12169
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12108
12170
|
TextField_default,
|
|
12109
12171
|
{
|
|
12110
12172
|
placeholder: keyPlaceholder,
|
|
12111
12173
|
value: pair.key,
|
|
12112
12174
|
onChange: (e) => handleUpdatePair(index, "key", e.target.value),
|
|
12113
12175
|
disabled: disabled || readOnly,
|
|
12114
|
-
className: (0, import_css55.cx)((0,
|
|
12176
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12115
12177
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
12116
12178
|
}
|
|
12117
12179
|
),
|
|
12118
|
-
/* @__PURE__ */ (0,
|
|
12180
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12119
12181
|
TextField_default,
|
|
12120
12182
|
{
|
|
12121
12183
|
placeholder: valuePlaceholder,
|
|
12122
12184
|
value: pair.value,
|
|
12123
12185
|
onChange: (e) => handleUpdatePair(index, "value", e.target.value),
|
|
12124
12186
|
disabled: disabled || readOnly,
|
|
12125
|
-
className: (0, import_css55.cx)((0,
|
|
12187
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12126
12188
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
12127
12189
|
}
|
|
12128
12190
|
),
|
|
12129
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
12191
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12130
12192
|
"button",
|
|
12131
12193
|
{
|
|
12132
12194
|
type: "button",
|
|
12133
12195
|
onClick: () => handleRemovePair(index),
|
|
12134
12196
|
disabled,
|
|
12135
|
-
className: (0, import_css55.cx)((0,
|
|
12197
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "remove-button")), styles.removeButton),
|
|
12136
12198
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
12137
|
-
children: /* @__PURE__ */ (0,
|
|
12199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(X_default, { width: 16, height: 16 })
|
|
12138
12200
|
}
|
|
12139
12201
|
)
|
|
12140
12202
|
]
|
|
12141
12203
|
},
|
|
12142
12204
|
`${pair.key}-${index}`
|
|
12143
12205
|
)),
|
|
12144
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
12145
|
-
/* @__PURE__ */ (0,
|
|
12206
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "add-row")), styles.addRow), children: [
|
|
12207
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12146
12208
|
TextField_default,
|
|
12147
12209
|
{
|
|
12148
12210
|
placeholder: keyPlaceholder,
|
|
12149
12211
|
value: newKey,
|
|
12150
12212
|
onChange: (e) => setNewKey(e.target.value),
|
|
12151
12213
|
disabled,
|
|
12152
|
-
className: (0, import_css55.cx)((0,
|
|
12214
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12153
12215
|
"aria-label": "New key"
|
|
12154
12216
|
}
|
|
12155
12217
|
),
|
|
12156
|
-
/* @__PURE__ */ (0,
|
|
12218
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12157
12219
|
TextField_default,
|
|
12158
12220
|
{
|
|
12159
12221
|
placeholder: valuePlaceholder,
|
|
12160
12222
|
value: newValue,
|
|
12161
12223
|
onChange: (e) => setNewValue(e.target.value),
|
|
12162
12224
|
disabled,
|
|
12163
|
-
className: (0, import_css55.cx)((0,
|
|
12225
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12164
12226
|
"aria-label": "New value",
|
|
12165
12227
|
onKeyPress: (e) => {
|
|
12166
12228
|
if (e.key === "Enter" && !isAddDisabled) {
|
|
@@ -12169,21 +12231,21 @@ var KeyValueInput = ({
|
|
|
12169
12231
|
}
|
|
12170
12232
|
}
|
|
12171
12233
|
),
|
|
12172
|
-
/* @__PURE__ */ (0,
|
|
12234
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12173
12235
|
"button",
|
|
12174
12236
|
{
|
|
12175
12237
|
type: "button",
|
|
12176
12238
|
onClick: handleAddPair,
|
|
12177
12239
|
disabled: isAddDisabled,
|
|
12178
|
-
className: (0, import_css55.cx)((0,
|
|
12240
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "add-button")), styles.addButton),
|
|
12179
12241
|
"aria-label": "Add new key-value pair",
|
|
12180
|
-
children: /* @__PURE__ */ (0,
|
|
12242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Plus_default, { width: 16, height: 16 })
|
|
12181
12243
|
}
|
|
12182
12244
|
)
|
|
12183
12245
|
] })
|
|
12184
12246
|
] }),
|
|
12185
|
-
(helperText || error) && /* @__PURE__ */ (0,
|
|
12186
|
-
maxPairs && /* @__PURE__ */ (0,
|
|
12247
|
+
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "helper-text")), styles.helperText), children: error || helperText }),
|
|
12248
|
+
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "counter")), styles.counterText), children: [
|
|
12187
12249
|
pairs.length,
|
|
12188
12250
|
" of ",
|
|
12189
12251
|
maxPairs,
|
|
@@ -12350,7 +12412,7 @@ var useStyles27 = (theme, colorScheme) => {
|
|
|
12350
12412
|
var BaseOrganizationProfile_styles_default = useStyles27;
|
|
12351
12413
|
|
|
12352
12414
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
12353
|
-
var
|
|
12415
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12354
12416
|
var BaseOrganizationProfile = ({
|
|
12355
12417
|
fallback = null,
|
|
12356
12418
|
className = "",
|
|
@@ -12387,13 +12449,13 @@ var BaseOrganizationProfile = ({
|
|
|
12387
12449
|
key: "created",
|
|
12388
12450
|
label: "Created Date",
|
|
12389
12451
|
editable: false,
|
|
12390
|
-
render: (value) => (0,
|
|
12452
|
+
render: (value) => (0, import_browser73.formatDate)(value)
|
|
12391
12453
|
},
|
|
12392
12454
|
{
|
|
12393
12455
|
key: "lastModified",
|
|
12394
12456
|
label: "Last Modified Date",
|
|
12395
12457
|
editable: false,
|
|
12396
|
-
render: (value) => (0,
|
|
12458
|
+
render: (value) => (0, import_browser73.formatDate)(value)
|
|
12397
12459
|
}
|
|
12398
12460
|
]
|
|
12399
12461
|
}) => {
|
|
@@ -12401,7 +12463,7 @@ var BaseOrganizationProfile = ({
|
|
|
12401
12463
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
12402
12464
|
const [editedOrganization, setEditedOrganization] = (0, import_react86.useState)(organization);
|
|
12403
12465
|
const [editingFields, setEditingFields] = (0, import_react86.useState)({});
|
|
12404
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
12466
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12405
12467
|
"svg",
|
|
12406
12468
|
{
|
|
12407
12469
|
width: "16",
|
|
@@ -12412,7 +12474,7 @@ var BaseOrganizationProfile = ({
|
|
|
12412
12474
|
strokeWidth: "2",
|
|
12413
12475
|
strokeLinecap: "round",
|
|
12414
12476
|
strokeLinejoin: "round",
|
|
12415
|
-
children: /* @__PURE__ */ (0,
|
|
12477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
12416
12478
|
}
|
|
12417
12479
|
);
|
|
12418
12480
|
const toggleFieldEdit = (0, import_react86.useCallback)((fieldName) => {
|
|
@@ -12475,7 +12537,7 @@ var BaseOrganizationProfile = ({
|
|
|
12475
12537
|
let fieldInput;
|
|
12476
12538
|
if (key === "attributes") {
|
|
12477
12539
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
12478
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
12540
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12479
12541
|
KeyValueInput_default,
|
|
12480
12542
|
{
|
|
12481
12543
|
value: attributesValue,
|
|
@@ -12513,26 +12575,26 @@ var BaseOrganizationProfile = ({
|
|
|
12513
12575
|
}
|
|
12514
12576
|
);
|
|
12515
12577
|
} else {
|
|
12516
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
12578
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TextField_default, { ...commonProps });
|
|
12517
12579
|
}
|
|
12518
|
-
return /* @__PURE__ */ (0,
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
12580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
12581
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: (0, import_css57.cx)(styles.label), children: label }),
|
|
12582
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.value), children: fieldInput })
|
|
12521
12583
|
] });
|
|
12522
12584
|
}
|
|
12523
12585
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
12524
12586
|
const isFieldEditable = editable && fieldEditable;
|
|
12525
12587
|
let displayValue;
|
|
12526
12588
|
if (hasValue) {
|
|
12527
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0,
|
|
12589
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
12528
12590
|
} else if (isFieldEditable) {
|
|
12529
12591
|
displayValue = getFieldPlaceholder(key);
|
|
12530
12592
|
} else {
|
|
12531
12593
|
displayValue = "-";
|
|
12532
12594
|
}
|
|
12533
|
-
return /* @__PURE__ */ (0,
|
|
12534
|
-
/* @__PURE__ */ (0,
|
|
12535
|
-
/* @__PURE__ */ (0,
|
|
12595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
12596
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: (0, import_css57.cx)(styles.label), children: label }),
|
|
12597
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.value, !hasValue && styles.valueEmpty), children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12536
12598
|
Button_default,
|
|
12537
12599
|
{
|
|
12538
12600
|
onClick: onStartEdit,
|
|
@@ -12555,8 +12617,8 @@ var BaseOrganizationProfile = ({
|
|
|
12555
12617
|
if (!shouldShow) {
|
|
12556
12618
|
return null;
|
|
12557
12619
|
}
|
|
12558
|
-
return /* @__PURE__ */ (0,
|
|
12559
|
-
/* @__PURE__ */ (0,
|
|
12620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.field), children: [
|
|
12621
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.fieldContent), children: renderField(
|
|
12560
12622
|
field,
|
|
12561
12623
|
isFieldEditing,
|
|
12562
12624
|
(value) => {
|
|
@@ -12566,8 +12628,8 @@ var BaseOrganizationProfile = ({
|
|
|
12566
12628
|
},
|
|
12567
12629
|
() => toggleFieldEdit(field.key)
|
|
12568
12630
|
) }),
|
|
12569
|
-
isFieldEditable && /* @__PURE__ */ (0,
|
|
12570
|
-
/* @__PURE__ */ (0,
|
|
12631
|
+
isFieldEditable && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.fieldActions), children: isFieldEditing ? /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
12632
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12571
12633
|
Button_default,
|
|
12572
12634
|
{
|
|
12573
12635
|
onClick: () => handleFieldSave(field.key),
|
|
@@ -12578,7 +12640,7 @@ var BaseOrganizationProfile = ({
|
|
|
12578
12640
|
children: saveButtonText
|
|
12579
12641
|
}
|
|
12580
12642
|
),
|
|
12581
|
-
/* @__PURE__ */ (0,
|
|
12643
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12582
12644
|
Button_default,
|
|
12583
12645
|
{
|
|
12584
12646
|
onClick: () => handleFieldCancel(field.key),
|
|
@@ -12589,7 +12651,7 @@ var BaseOrganizationProfile = ({
|
|
|
12589
12651
|
children: cancelButtonText
|
|
12590
12652
|
}
|
|
12591
12653
|
)
|
|
12592
|
-
] }) : hasValue && /* @__PURE__ */ (0,
|
|
12654
|
+
] }) : hasValue && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12593
12655
|
Button_default,
|
|
12594
12656
|
{
|
|
12595
12657
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -12598,7 +12660,7 @@ var BaseOrganizationProfile = ({
|
|
|
12598
12660
|
size: "small",
|
|
12599
12661
|
title: "Edit field",
|
|
12600
12662
|
className: (0, import_css57.cx)(styles.editButton),
|
|
12601
|
-
children: /* @__PURE__ */ (0,
|
|
12663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PencilIcon, {})
|
|
12602
12664
|
}
|
|
12603
12665
|
) })
|
|
12604
12666
|
] }, field.key);
|
|
@@ -12606,23 +12668,23 @@ var BaseOrganizationProfile = ({
|
|
|
12606
12668
|
if (!organization) {
|
|
12607
12669
|
return fallback;
|
|
12608
12670
|
}
|
|
12609
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
12610
|
-
/* @__PURE__ */ (0,
|
|
12611
|
-
/* @__PURE__ */ (0,
|
|
12612
|
-
/* @__PURE__ */ (0,
|
|
12613
|
-
/* @__PURE__ */ (0,
|
|
12614
|
-
organization.orgHandle && /* @__PURE__ */ (0,
|
|
12671
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Card_default, { className: (0, import_css57.cx)(styles.root, cardLayout && styles.card, className), children: [
|
|
12672
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.header), children: [
|
|
12673
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
12674
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.orgInfo), children: [
|
|
12675
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h2", { className: (0, import_css57.cx)(styles.name), children: organization.name }),
|
|
12676
|
+
organization.orgHandle && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("p", { className: (0, import_css57.cx)(styles.handle), children: [
|
|
12615
12677
|
"@",
|
|
12616
12678
|
organization.orgHandle
|
|
12617
12679
|
] })
|
|
12618
12680
|
] })
|
|
12619
12681
|
] }),
|
|
12620
|
-
/* @__PURE__ */ (0,
|
|
12682
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.infoContainer), children: fields.map((field, index) => renderOrganizationField(field)) })
|
|
12621
12683
|
] });
|
|
12622
12684
|
if (mode === "popup") {
|
|
12623
|
-
return /* @__PURE__ */ (0,
|
|
12624
|
-
/* @__PURE__ */ (0,
|
|
12625
|
-
/* @__PURE__ */ (0,
|
|
12685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Dialog_default.Content, { children: [
|
|
12686
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Dialog_default.Heading, { children: title }),
|
|
12687
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.popup), children: profileContent })
|
|
12626
12688
|
] }) });
|
|
12627
12689
|
}
|
|
12628
12690
|
return profileContent;
|
|
@@ -12630,8 +12692,8 @@ var BaseOrganizationProfile = ({
|
|
|
12630
12692
|
var BaseOrganizationProfile_default = BaseOrganizationProfile;
|
|
12631
12693
|
|
|
12632
12694
|
// src/api/getOrganization.ts
|
|
12633
|
-
var
|
|
12634
|
-
var httpClient7 =
|
|
12695
|
+
var import_browser74 = require("@asgardeo/browser");
|
|
12696
|
+
var httpClient7 = import_browser74.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser74.AsgardeoSPAClient.getInstance());
|
|
12635
12697
|
var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
12636
12698
|
const defaultFetcher = async (url, config) => {
|
|
12637
12699
|
const response = await httpClient7({
|
|
@@ -12647,7 +12709,7 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
12647
12709
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
12648
12710
|
};
|
|
12649
12711
|
};
|
|
12650
|
-
return (0,
|
|
12712
|
+
return (0, import_browser74.getOrganization)({
|
|
12651
12713
|
...requestConfig,
|
|
12652
12714
|
fetcher: fetcher || defaultFetcher
|
|
12653
12715
|
});
|
|
@@ -12655,8 +12717,8 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
12655
12717
|
var getOrganization_default = getOrganization;
|
|
12656
12718
|
|
|
12657
12719
|
// src/api/updateOrganization.ts
|
|
12658
|
-
var
|
|
12659
|
-
var httpClient8 =
|
|
12720
|
+
var import_browser75 = require("@asgardeo/browser");
|
|
12721
|
+
var httpClient8 = import_browser75.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser75.AsgardeoSPAClient.getInstance());
|
|
12660
12722
|
var updateOrganization = async ({
|
|
12661
12723
|
fetcher,
|
|
12662
12724
|
...requestConfig
|
|
@@ -12676,7 +12738,7 @@ var updateOrganization = async ({
|
|
|
12676
12738
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
12677
12739
|
};
|
|
12678
12740
|
};
|
|
12679
|
-
return (0,
|
|
12741
|
+
return (0, import_browser75.updateOrganization)({
|
|
12680
12742
|
...requestConfig,
|
|
12681
12743
|
fetcher: fetcher || defaultFetcher
|
|
12682
12744
|
});
|
|
@@ -12684,7 +12746,7 @@ var updateOrganization = async ({
|
|
|
12684
12746
|
var updateOrganization_default = updateOrganization;
|
|
12685
12747
|
|
|
12686
12748
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
12687
|
-
var
|
|
12749
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12688
12750
|
var OrganizationProfile = ({
|
|
12689
12751
|
organizationId,
|
|
12690
12752
|
mode = "default",
|
|
@@ -12692,8 +12754,8 @@ var OrganizationProfile = ({
|
|
|
12692
12754
|
onOpenChange,
|
|
12693
12755
|
onUpdate,
|
|
12694
12756
|
popupTitle,
|
|
12695
|
-
loadingFallback = /* @__PURE__ */ (0,
|
|
12696
|
-
errorFallback = /* @__PURE__ */ (0,
|
|
12757
|
+
loadingFallback = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: "Loading organization..." }),
|
|
12758
|
+
errorFallback = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: "Failed to load organization data" }),
|
|
12697
12759
|
...rest
|
|
12698
12760
|
}) => {
|
|
12699
12761
|
const { baseUrl } = useAsgardeo_default();
|
|
@@ -12729,7 +12791,7 @@ var OrganizationProfile = ({
|
|
|
12729
12791
|
const handleOrganizationUpdate = async (payload) => {
|
|
12730
12792
|
if (!baseUrl || !organizationId) return;
|
|
12731
12793
|
try {
|
|
12732
|
-
const operations = (0,
|
|
12794
|
+
const operations = (0, import_browser75.createPatchOperations)(payload);
|
|
12733
12795
|
await updateOrganization_default({
|
|
12734
12796
|
baseUrl,
|
|
12735
12797
|
organizationId,
|
|
@@ -12744,7 +12806,7 @@ var OrganizationProfile = ({
|
|
|
12744
12806
|
throw err;
|
|
12745
12807
|
}
|
|
12746
12808
|
};
|
|
12747
|
-
return /* @__PURE__ */ (0,
|
|
12809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12748
12810
|
BaseOrganizationProfile_default,
|
|
12749
12811
|
{
|
|
12750
12812
|
organization,
|
|
@@ -12994,21 +13056,21 @@ var useStyles28 = (theme, colorScheme) => {
|
|
|
12994
13056
|
var BaseOrganizationList_styles_default = useStyles28;
|
|
12995
13057
|
|
|
12996
13058
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
12997
|
-
var
|
|
13059
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12998
13060
|
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => {
|
|
12999
|
-
return /* @__PURE__ */ (0,
|
|
13000
|
-
/* @__PURE__ */ (0,
|
|
13001
|
-
/* @__PURE__ */ (0,
|
|
13002
|
-
/* @__PURE__ */ (0,
|
|
13003
|
-
/* @__PURE__ */ (0,
|
|
13004
|
-
/* @__PURE__ */ (0,
|
|
13061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationItem), children: [
|
|
13062
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationContent), children: [
|
|
13063
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Avatar_default, { variant: "square", name: organization.name, size: 48, alt: `${organization.name} logo` }),
|
|
13064
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationInfo), children: [
|
|
13065
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Typography_default, { variant: "h6", className: (0, import_css59.cx)(styles.organizationName), children: organization.name }),
|
|
13066
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css59.cx)(styles.organizationHandle), children: [
|
|
13005
13067
|
"@",
|
|
13006
13068
|
organization.orgHandle
|
|
13007
13069
|
] }),
|
|
13008
|
-
showStatus && /* @__PURE__ */ (0,
|
|
13070
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css59.cx)(styles.organizationStatus), children: [
|
|
13009
13071
|
t("organization.switcher.status.label"),
|
|
13010
13072
|
" ",
|
|
13011
|
-
/* @__PURE__ */ (0,
|
|
13073
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13012
13074
|
"span",
|
|
13013
13075
|
{
|
|
13014
13076
|
className: (0, import_css59.cx)(
|
|
@@ -13021,7 +13083,7 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13021
13083
|
] })
|
|
13022
13084
|
] })
|
|
13023
13085
|
] }),
|
|
13024
|
-
organization.canSwitch && /* @__PURE__ */ (0,
|
|
13086
|
+
organization.canSwitch && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.organizationActions), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13025
13087
|
Button_default,
|
|
13026
13088
|
{
|
|
13027
13089
|
onClick: (e) => {
|
|
@@ -13035,17 +13097,17 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13035
13097
|
) })
|
|
13036
13098
|
] }, organization.id);
|
|
13037
13099
|
};
|
|
13038
|
-
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0,
|
|
13039
|
-
/* @__PURE__ */ (0,
|
|
13040
|
-
/* @__PURE__ */ (0,
|
|
13100
|
+
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.loadingContainer), children: [
|
|
13101
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Spinner_default, { size: "medium" }),
|
|
13102
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css59.cx)(styles.loadingText), children: t("organization.switcher.loading.organizations") })
|
|
13041
13103
|
] });
|
|
13042
|
-
var defaultRenderError = (error, t, styles) => /* @__PURE__ */ (0,
|
|
13043
|
-
/* @__PURE__ */ (0,
|
|
13104
|
+
var defaultRenderError = (error, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.errorContainer), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Typography_default, { variant: "body1", color: "error", children: [
|
|
13105
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("strong", { children: t("organization.switcher.error.prefix") }),
|
|
13044
13106
|
" ",
|
|
13045
13107
|
error
|
|
13046
13108
|
] }) });
|
|
13047
|
-
var defaultRenderLoadMore = (onLoadMore, isLoading, t, styles) => /* @__PURE__ */ (0,
|
|
13048
|
-
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0,
|
|
13109
|
+
var defaultRenderLoadMore = (onLoadMore, isLoading, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Button_default, { onClick: onLoadMore, disabled: isLoading, className: (0, import_css59.cx)(styles.loadMoreButton), type: "button", fullWidth: true, children: isLoading ? t("organization.switcher.loading.more") : t("organization.switcher.load.more") });
|
|
13110
|
+
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.emptyContainer), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css59.cx)(styles.emptyText), children: t("organization.switcher.no.organizations") }) });
|
|
13049
13111
|
var BaseOrganizationList = ({
|
|
13050
13112
|
className = "",
|
|
13051
13113
|
allOrganizations,
|
|
@@ -13088,53 +13150,53 @@ var BaseOrganizationList = ({
|
|
|
13088
13150
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, isLoading2) => defaultRenderLoadMore(onLoadMore, isLoading2, t, styles));
|
|
13089
13151
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));
|
|
13090
13152
|
if (isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13091
|
-
const loadingContent = /* @__PURE__ */ (0,
|
|
13153
|
+
const loadingContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderLoadingWithStyles() });
|
|
13092
13154
|
if (mode === "popup") {
|
|
13093
|
-
return /* @__PURE__ */ (0,
|
|
13094
|
-
/* @__PURE__ */ (0,
|
|
13095
|
-
/* @__PURE__ */ (0,
|
|
13155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13156
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13157
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: loadingContent })
|
|
13096
13158
|
] }) });
|
|
13097
13159
|
}
|
|
13098
13160
|
return loadingContent;
|
|
13099
13161
|
}
|
|
13100
13162
|
if (error && organizationsWithSwitchAccess?.length === 0) {
|
|
13101
|
-
const errorContent = /* @__PURE__ */ (0,
|
|
13163
|
+
const errorContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderErrorWithStyles(error) });
|
|
13102
13164
|
if (mode === "popup") {
|
|
13103
|
-
return /* @__PURE__ */ (0,
|
|
13104
|
-
/* @__PURE__ */ (0,
|
|
13105
|
-
/* @__PURE__ */ (0,
|
|
13165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13166
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13167
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: errorContent })
|
|
13106
13168
|
] }) });
|
|
13107
13169
|
}
|
|
13108
13170
|
return errorContent;
|
|
13109
13171
|
}
|
|
13110
13172
|
if (!isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13111
|
-
const emptyContent = /* @__PURE__ */ (0,
|
|
13173
|
+
const emptyContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderEmptyWithStyles() });
|
|
13112
13174
|
if (mode === "popup") {
|
|
13113
|
-
return /* @__PURE__ */ (0,
|
|
13114
|
-
/* @__PURE__ */ (0,
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
13175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13176
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13177
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: emptyContent })
|
|
13116
13178
|
] }) });
|
|
13117
13179
|
}
|
|
13118
13180
|
return emptyContent;
|
|
13119
13181
|
}
|
|
13120
|
-
const organizationListContent = /* @__PURE__ */ (0,
|
|
13121
|
-
/* @__PURE__ */ (0,
|
|
13122
|
-
/* @__PURE__ */ (0,
|
|
13182
|
+
const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: [
|
|
13183
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.header), children: [
|
|
13184
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.headerInfo), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css59.cx)(styles.subtitle), children: t("organization.switcher.showing.count", {
|
|
13123
13185
|
showing: organizationsWithSwitchAccess?.length,
|
|
13124
13186
|
total: allOrganizations?.organizations?.length || 0
|
|
13125
13187
|
}) }) }),
|
|
13126
|
-
onRefresh && /* @__PURE__ */ (0,
|
|
13188
|
+
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Button_default, { onClick: onRefresh, className: (0, import_css59.cx)(styles.refreshButton), type: "button", variant: "outline", size: "small", children: t("organization.switcher.refresh.button") })
|
|
13127
13189
|
] }),
|
|
13128
|
-
/* @__PURE__ */ (0,
|
|
13190
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.listContainer), children: organizationsWithSwitchAccess?.map(
|
|
13129
13191
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
13130
13192
|
) }),
|
|
13131
|
-
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0,
|
|
13132
|
-
hasMore && fetchMore && /* @__PURE__ */ (0,
|
|
13193
|
+
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.errorMargin), children: renderErrorWithStyles(error) }),
|
|
13194
|
+
hasMore && fetchMore && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.loadMoreMargin), children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
13133
13195
|
] });
|
|
13134
13196
|
if (mode === "popup") {
|
|
13135
|
-
return /* @__PURE__ */ (0,
|
|
13136
|
-
/* @__PURE__ */ (0,
|
|
13137
|
-
/* @__PURE__ */ (0,
|
|
13197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13198
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13199
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: organizationListContent })
|
|
13138
13200
|
] }) });
|
|
13139
13201
|
}
|
|
13140
13202
|
return organizationListContent;
|
|
@@ -13205,7 +13267,7 @@ var useStyles29 = (theme, colorScheme) => {
|
|
|
13205
13267
|
var OrganizationList_styles_default = useStyles29;
|
|
13206
13268
|
|
|
13207
13269
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
13208
|
-
var
|
|
13270
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
13209
13271
|
var OrganizationList = ({
|
|
13210
13272
|
autoFetch = true,
|
|
13211
13273
|
filter = "",
|
|
@@ -13227,7 +13289,7 @@ var OrganizationList = ({
|
|
|
13227
13289
|
setAllOrganizations(await getAllOrganizations2());
|
|
13228
13290
|
})();
|
|
13229
13291
|
}, []);
|
|
13230
|
-
return /* @__PURE__ */ (0,
|
|
13292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: (0, import_css61.cx)(styles.root, className), style, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: (0, import_css61.cx)(styles.container), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
13231
13293
|
BaseOrganizationList_default,
|
|
13232
13294
|
{
|
|
13233
13295
|
allOrganizations,
|
|
@@ -13242,8 +13304,8 @@ var OrganizationList = ({
|
|
|
13242
13304
|
var OrganizationList_default = OrganizationList;
|
|
13243
13305
|
|
|
13244
13306
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
13245
|
-
var
|
|
13246
|
-
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
13307
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13308
|
+
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
13247
13309
|
"svg",
|
|
13248
13310
|
{
|
|
13249
13311
|
width,
|
|
@@ -13256,13 +13318,13 @@ var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @_
|
|
|
13256
13318
|
strokeLinecap: "round",
|
|
13257
13319
|
strokeLinejoin: "round",
|
|
13258
13320
|
children: [
|
|
13259
|
-
/* @__PURE__ */ (0,
|
|
13260
|
-
/* @__PURE__ */ (0,
|
|
13261
|
-
/* @__PURE__ */ (0,
|
|
13262
|
-
/* @__PURE__ */ (0,
|
|
13263
|
-
/* @__PURE__ */ (0,
|
|
13264
|
-
/* @__PURE__ */ (0,
|
|
13265
|
-
/* @__PURE__ */ (0,
|
|
13321
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
13322
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
13323
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
13324
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 6h4" }),
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 10h4" }),
|
|
13326
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 14h4" }),
|
|
13327
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 18h4" })
|
|
13266
13328
|
]
|
|
13267
13329
|
}
|
|
13268
13330
|
);
|
|
@@ -13270,7 +13332,7 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
13270
13332
|
var BuildingAlt_default = BuildingAlt;
|
|
13271
13333
|
|
|
13272
13334
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
13273
|
-
var
|
|
13335
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13274
13336
|
var OrganizationSwitcher = ({
|
|
13275
13337
|
currentOrganization: propCurrentOrganization,
|
|
13276
13338
|
fallback = null,
|
|
@@ -13294,7 +13356,7 @@ var OrganizationSwitcher = ({
|
|
|
13294
13356
|
return fallback;
|
|
13295
13357
|
}
|
|
13296
13358
|
if (!isSignedIn) {
|
|
13297
|
-
return /* @__PURE__ */ (0,
|
|
13359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, {});
|
|
13298
13360
|
}
|
|
13299
13361
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
13300
13362
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -13308,19 +13370,19 @@ var OrganizationSwitcher = ({
|
|
|
13308
13370
|
const defaultMenuItems = [];
|
|
13309
13371
|
if (currentOrganization) {
|
|
13310
13372
|
defaultMenuItems.push({
|
|
13311
|
-
icon: /* @__PURE__ */ (0,
|
|
13373
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(BuildingAlt_default, {}),
|
|
13312
13374
|
label: t("organization.switcher.manage.organizations"),
|
|
13313
13375
|
onClick: handleManageOrganizations
|
|
13314
13376
|
});
|
|
13315
13377
|
}
|
|
13316
13378
|
defaultMenuItems.push({
|
|
13317
|
-
icon: /* @__PURE__ */ (0,
|
|
13379
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
13318
13380
|
label: t("organization.switcher.create.organization"),
|
|
13319
13381
|
onClick: () => setIsCreateOrgOpen(true)
|
|
13320
13382
|
});
|
|
13321
13383
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
13322
|
-
return /* @__PURE__ */ (0,
|
|
13323
|
-
/* @__PURE__ */ (0,
|
|
13384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
13385
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13324
13386
|
BaseOrganizationSwitcher_default,
|
|
13325
13387
|
{
|
|
13326
13388
|
organizations,
|
|
@@ -13333,7 +13395,7 @@ var OrganizationSwitcher = ({
|
|
|
13333
13395
|
...props
|
|
13334
13396
|
}
|
|
13335
13397
|
),
|
|
13336
|
-
/* @__PURE__ */ (0,
|
|
13398
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13337
13399
|
CreateOrganization,
|
|
13338
13400
|
{
|
|
13339
13401
|
mode: "popup",
|
|
@@ -13347,7 +13409,7 @@ var OrganizationSwitcher = ({
|
|
|
13347
13409
|
}
|
|
13348
13410
|
}
|
|
13349
13411
|
),
|
|
13350
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
13412
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13351
13413
|
OrganizationProfile_default,
|
|
13352
13414
|
{
|
|
13353
13415
|
organizationId: currentOrganization.id,
|
|
@@ -13355,11 +13417,11 @@ var OrganizationSwitcher = ({
|
|
|
13355
13417
|
open: isProfileOpen,
|
|
13356
13418
|
onOpenChange: setIsProfileOpen,
|
|
13357
13419
|
cardLayout: true,
|
|
13358
|
-
loadingFallback: /* @__PURE__ */ (0,
|
|
13359
|
-
errorFallback: /* @__PURE__ */ (0,
|
|
13420
|
+
loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { children: t("organization.profile.loading") }),
|
|
13421
|
+
errorFallback: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { children: t("organization.profile.error") })
|
|
13360
13422
|
}
|
|
13361
13423
|
),
|
|
13362
|
-
/* @__PURE__ */ (0,
|
|
13424
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13363
13425
|
OrganizationList_default,
|
|
13364
13426
|
{
|
|
13365
13427
|
mode: "popup",
|
|
@@ -13379,5 +13441,5 @@ var OrganizationSwitcher = ({
|
|
|
13379
13441
|
var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
13380
13442
|
|
|
13381
13443
|
// src/index.ts
|
|
13382
|
-
var
|
|
13444
|
+
var import_browser76 = require("@asgardeo/browser");
|
|
13383
13445
|
//# sourceMappingURL=index.js.map
|