@asgardeo/react 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +620 -554
- 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 -363
- 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,38 @@ 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) => {
|
|
7471
|
+
const lowerName = name.toLowerCase();
|
|
7472
|
+
if (lowerName.includes("password")) {
|
|
7473
|
+
return "PASSWORD";
|
|
7474
|
+
}
|
|
7475
|
+
if (lowerName.includes("email")) {
|
|
7476
|
+
return "EMAIL";
|
|
7477
|
+
}
|
|
7452
7478
|
switch (type.toLowerCase()) {
|
|
7453
7479
|
case "email":
|
|
7454
7480
|
return "EMAIL";
|
|
@@ -7475,15 +7501,15 @@ var getInputPlaceholder = (name, type, t) => {
|
|
|
7475
7501
|
return placeholder;
|
|
7476
7502
|
};
|
|
7477
7503
|
var convertSimpleInputToComponent = (input, t) => {
|
|
7478
|
-
const variant = getInputVariant(input.type);
|
|
7504
|
+
const variant = getInputVariant(input.type, input.name);
|
|
7479
7505
|
const label = getInputLabel(input.name, input.type, t);
|
|
7480
7506
|
const placeholder = getInputPlaceholder(input.name, input.type, t);
|
|
7481
7507
|
return {
|
|
7482
7508
|
id: generateId("input"),
|
|
7483
|
-
type:
|
|
7509
|
+
type: import_browser49.EmbeddedFlowComponentType.Input,
|
|
7484
7510
|
variant,
|
|
7485
7511
|
config: {
|
|
7486
|
-
type: input.type
|
|
7512
|
+
type: input.type,
|
|
7487
7513
|
label,
|
|
7488
7514
|
placeholder,
|
|
7489
7515
|
required: input.required,
|
|
@@ -7502,7 +7528,7 @@ var convertActionToComponent = (action, t) => {
|
|
|
7502
7528
|
}
|
|
7503
7529
|
return {
|
|
7504
7530
|
id: generateId("action"),
|
|
7505
|
-
type:
|
|
7531
|
+
type: import_browser49.EmbeddedFlowComponentType.Button,
|
|
7506
7532
|
variant: "SECONDARY",
|
|
7507
7533
|
config: {
|
|
7508
7534
|
type: "button",
|
|
@@ -7518,7 +7544,7 @@ var transformSimpleToComponentDriven = (response, t) => {
|
|
|
7518
7544
|
const actionComponents = response?.data?.actions?.map((action) => convertActionToComponent(action, t)) || [];
|
|
7519
7545
|
const submitButton = inputComponents.length > 0 ? {
|
|
7520
7546
|
id: generateId("button"),
|
|
7521
|
-
type:
|
|
7547
|
+
type: import_browser49.EmbeddedFlowComponentType.Button,
|
|
7522
7548
|
variant: "PRIMARY",
|
|
7523
7549
|
config: {
|
|
7524
7550
|
type: "submit",
|
|
@@ -7535,7 +7561,7 @@ var transformSimpleToComponentDriven = (response, t) => {
|
|
|
7535
7561
|
if (formComponents.length > 0) {
|
|
7536
7562
|
result.push({
|
|
7537
7563
|
id: generateId("form"),
|
|
7538
|
-
type:
|
|
7564
|
+
type: import_browser49.EmbeddedFlowComponentType.Form,
|
|
7539
7565
|
config: {},
|
|
7540
7566
|
components: formComponents
|
|
7541
7567
|
});
|
|
@@ -7553,7 +7579,7 @@ var normalizeFlowResponse = (response, t) => {
|
|
|
7553
7579
|
};
|
|
7554
7580
|
|
|
7555
7581
|
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7556
|
-
var
|
|
7582
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7557
7583
|
var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
|
|
7558
7584
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
7559
7585
|
const { t } = useTranslation_default();
|
|
@@ -7575,7 +7601,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7575
7601
|
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
7576
7602
|
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
7577
7603
|
if (!flowIdFromUrl && !effectiveApplicationId) {
|
|
7578
|
-
const error = new
|
|
7604
|
+
const error = new import_browser50.AsgardeoRuntimeError(
|
|
7579
7605
|
"Either flowId or applicationId is required for authentication",
|
|
7580
7606
|
"SignIn-initializeFlow-RuntimeError-001",
|
|
7581
7607
|
"react",
|
|
@@ -7594,7 +7620,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7594
7620
|
} else {
|
|
7595
7621
|
response = await signIn({
|
|
7596
7622
|
applicationId: effectiveApplicationId,
|
|
7597
|
-
flowType:
|
|
7623
|
+
flowType: import_browser50.EmbeddedFlowType.Authentication
|
|
7598
7624
|
});
|
|
7599
7625
|
}
|
|
7600
7626
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
@@ -7607,7 +7633,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7607
7633
|
const err = error;
|
|
7608
7634
|
setFlowError(err);
|
|
7609
7635
|
onError?.(err);
|
|
7610
|
-
throw new
|
|
7636
|
+
throw new import_browser50.AsgardeoRuntimeError(
|
|
7611
7637
|
`Failed to initialize authentication flow: ${error instanceof Error ? error.message : String(error)}`,
|
|
7612
7638
|
"SignIn-initializeFlow-RuntimeError-002",
|
|
7613
7639
|
"react",
|
|
@@ -7627,7 +7653,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7627
7653
|
...payload
|
|
7628
7654
|
});
|
|
7629
7655
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
7630
|
-
if (response.flowStatus ===
|
|
7656
|
+
if (response.flowStatus === import_browser50.EmbeddedSignInFlowStatusV2.Complete) {
|
|
7631
7657
|
onSuccess && onSuccess({
|
|
7632
7658
|
redirectUrl: response.redirectUrl || afterSignInUrl,
|
|
7633
7659
|
...response.data
|
|
@@ -7643,7 +7669,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7643
7669
|
const err = error;
|
|
7644
7670
|
setFlowError(err);
|
|
7645
7671
|
onError?.(err);
|
|
7646
|
-
throw new
|
|
7672
|
+
throw new import_browser50.AsgardeoRuntimeError(
|
|
7647
7673
|
`Failed to submit authentication flow: ${error instanceof Error ? error.message : String(error)}`,
|
|
7648
7674
|
"SignIn-handleSubmit-RuntimeError-001",
|
|
7649
7675
|
"react",
|
|
@@ -7667,9 +7693,9 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7667
7693
|
components,
|
|
7668
7694
|
error: flowError
|
|
7669
7695
|
};
|
|
7670
|
-
return /* @__PURE__ */ (0,
|
|
7696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: children(renderProps) });
|
|
7671
7697
|
}
|
|
7672
|
-
return /* @__PURE__ */ (0,
|
|
7698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7673
7699
|
BaseSignIn_default2,
|
|
7674
7700
|
{
|
|
7675
7701
|
components,
|
|
@@ -7685,7 +7711,7 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7685
7711
|
var SignIn_default = SignIn;
|
|
7686
7712
|
|
|
7687
7713
|
// src/components/presentation/SignIn/SignIn.tsx
|
|
7688
|
-
var
|
|
7714
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
7689
7715
|
var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
7690
7716
|
const { signIn, afterSignInUrl, isInitialized, isLoading, platform } = useAsgardeo_default();
|
|
7691
7717
|
const handleInitialize = async () => {
|
|
@@ -7705,8 +7731,8 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7705
7731
|
window.location.href = url.toString();
|
|
7706
7732
|
}
|
|
7707
7733
|
};
|
|
7708
|
-
if (platform ===
|
|
7709
|
-
return /* @__PURE__ */ (0,
|
|
7734
|
+
if (platform === import_browser51.Platform.AsgardeoV2) {
|
|
7735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7710
7736
|
SignIn_default,
|
|
7711
7737
|
{
|
|
7712
7738
|
className,
|
|
@@ -7718,7 +7744,7 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7718
7744
|
}
|
|
7719
7745
|
);
|
|
7720
7746
|
}
|
|
7721
|
-
return /* @__PURE__ */ (0,
|
|
7747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7722
7748
|
BaseSignIn_default,
|
|
7723
7749
|
{
|
|
7724
7750
|
isLoading: isLoading || !isInitialized,
|
|
@@ -7735,15 +7761,15 @@ var SignIn2 = ({ className, size = "medium", children, ...rest }) => {
|
|
|
7735
7761
|
var SignIn_default2 = SignIn2;
|
|
7736
7762
|
|
|
7737
7763
|
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
7738
|
-
var
|
|
7764
|
+
var import_browser60 = require("@asgardeo/browser");
|
|
7739
7765
|
var import_css39 = require("@emotion/css");
|
|
7740
7766
|
var import_react62 = require("react");
|
|
7741
7767
|
|
|
7742
7768
|
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
7743
|
-
var
|
|
7769
|
+
var import_browser58 = require("@asgardeo/browser");
|
|
7744
7770
|
|
|
7745
7771
|
// src/components/adapters/CheckboxInput.tsx
|
|
7746
|
-
var
|
|
7772
|
+
var import_browser52 = require("@asgardeo/browser");
|
|
7747
7773
|
var CheckboxInput = ({
|
|
7748
7774
|
component,
|
|
7749
7775
|
formValues,
|
|
@@ -7757,7 +7783,7 @@ var CheckboxInput = ({
|
|
|
7757
7783
|
const value = formValues[fieldName] || false;
|
|
7758
7784
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7759
7785
|
return createField({
|
|
7760
|
-
type:
|
|
7786
|
+
type: import_browser52.FieldType.Checkbox,
|
|
7761
7787
|
name: fieldName,
|
|
7762
7788
|
label: config["label"] || "",
|
|
7763
7789
|
placeholder: config["placeholder"] || "",
|
|
@@ -7771,7 +7797,7 @@ var CheckboxInput = ({
|
|
|
7771
7797
|
var CheckboxInput_default = CheckboxInput;
|
|
7772
7798
|
|
|
7773
7799
|
// src/components/adapters/DateInput.tsx
|
|
7774
|
-
var
|
|
7800
|
+
var import_browser53 = require("@asgardeo/browser");
|
|
7775
7801
|
var DateInput = ({
|
|
7776
7802
|
component,
|
|
7777
7803
|
formValues,
|
|
@@ -7785,7 +7811,7 @@ var DateInput = ({
|
|
|
7785
7811
|
const value = formValues[fieldName] || "";
|
|
7786
7812
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7787
7813
|
return createField({
|
|
7788
|
-
type:
|
|
7814
|
+
type: import_browser53.FieldType.Date,
|
|
7789
7815
|
name: fieldName,
|
|
7790
7816
|
label: config["label"] || "",
|
|
7791
7817
|
placeholder: config["placeholder"] || "",
|
|
@@ -7799,13 +7825,13 @@ var DateInput = ({
|
|
|
7799
7825
|
var DateInput_default = DateInput;
|
|
7800
7826
|
|
|
7801
7827
|
// src/components/adapters/DividerComponent.tsx
|
|
7802
|
-
var
|
|
7828
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
7803
7829
|
var DividerComponent = ({ component }) => {
|
|
7804
7830
|
const { theme } = useTheme_default();
|
|
7805
7831
|
const config = component.config || {};
|
|
7806
7832
|
const text = config["text"] || "";
|
|
7807
7833
|
const variant = component.variant?.toLowerCase() || "horizontal";
|
|
7808
|
-
return /* @__PURE__ */ (0,
|
|
7834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7809
7835
|
Divider_default,
|
|
7810
7836
|
{
|
|
7811
7837
|
orientation: variant === "vertical" ? "vertical" : "horizontal",
|
|
@@ -7818,7 +7844,7 @@ var DividerComponent = ({ component }) => {
|
|
|
7818
7844
|
var DividerComponent_default = DividerComponent;
|
|
7819
7845
|
|
|
7820
7846
|
// src/components/adapters/EmailInput.tsx
|
|
7821
|
-
var
|
|
7847
|
+
var import_browser54 = require("@asgardeo/browser");
|
|
7822
7848
|
var EmailInput = ({
|
|
7823
7849
|
component,
|
|
7824
7850
|
formValues,
|
|
@@ -7832,7 +7858,7 @@ var EmailInput = ({
|
|
|
7832
7858
|
const value = formValues[fieldName] || "";
|
|
7833
7859
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7834
7860
|
return createField({
|
|
7835
|
-
type:
|
|
7861
|
+
type: import_browser54.FieldType.Email,
|
|
7836
7862
|
name: fieldName,
|
|
7837
7863
|
label: config["label"] || "Email",
|
|
7838
7864
|
placeholder: config["placeholder"] || "Enter your email",
|
|
@@ -7846,7 +7872,7 @@ var EmailInput = ({
|
|
|
7846
7872
|
var EmailInput_default = EmailInput;
|
|
7847
7873
|
|
|
7848
7874
|
// src/components/adapters/FormContainer.tsx
|
|
7849
|
-
var
|
|
7875
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
7850
7876
|
var FormContainer = (props) => {
|
|
7851
7877
|
const { component } = props;
|
|
7852
7878
|
if (component.components && component.components.length > 0) {
|
|
@@ -7859,19 +7885,19 @@ var FormContainer = (props) => {
|
|
|
7859
7885
|
props.onSubmit(submitButton, props.formValues);
|
|
7860
7886
|
}
|
|
7861
7887
|
};
|
|
7862
|
-
return /* @__PURE__ */ (0,
|
|
7888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("form", { onSubmit: handleFormSubmit, style: { display: "flex", flexDirection: "column" }, children: component.components.map(
|
|
7863
7889
|
(childComponent, index) => createSignUpComponent({
|
|
7864
7890
|
...props,
|
|
7865
7891
|
component: childComponent
|
|
7866
7892
|
})
|
|
7867
7893
|
) }, component.id);
|
|
7868
7894
|
}
|
|
7869
|
-
return /* @__PURE__ */ (0,
|
|
7895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", {}, component.id);
|
|
7870
7896
|
};
|
|
7871
7897
|
var FormContainer_default = FormContainer;
|
|
7872
7898
|
|
|
7873
7899
|
// src/components/adapters/ImageComponent.tsx
|
|
7874
|
-
var
|
|
7900
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7875
7901
|
var ImageComponent = ({ component }) => {
|
|
7876
7902
|
const { theme } = useTheme_default();
|
|
7877
7903
|
const config = component.config || {};
|
|
@@ -7888,7 +7914,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7888
7914
|
if (!src) {
|
|
7889
7915
|
return null;
|
|
7890
7916
|
}
|
|
7891
|
-
return /* @__PURE__ */ (0,
|
|
7917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7892
7918
|
"img",
|
|
7893
7919
|
{
|
|
7894
7920
|
src,
|
|
@@ -7903,7 +7929,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7903
7929
|
var ImageComponent_default = ImageComponent;
|
|
7904
7930
|
|
|
7905
7931
|
// src/components/adapters/NumberInput.tsx
|
|
7906
|
-
var
|
|
7932
|
+
var import_browser55 = require("@asgardeo/browser");
|
|
7907
7933
|
var NumberInput = ({
|
|
7908
7934
|
component,
|
|
7909
7935
|
formValues,
|
|
@@ -7917,7 +7943,7 @@ var NumberInput = ({
|
|
|
7917
7943
|
const value = formValues[fieldName] || "";
|
|
7918
7944
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7919
7945
|
return createField({
|
|
7920
|
-
type:
|
|
7946
|
+
type: import_browser55.FieldType.Number,
|
|
7921
7947
|
name: fieldName,
|
|
7922
7948
|
label: config["label"] || "",
|
|
7923
7949
|
placeholder: config["placeholder"] || "",
|
|
@@ -7931,7 +7957,7 @@ var NumberInput = ({
|
|
|
7931
7957
|
var NumberInput_default = NumberInput;
|
|
7932
7958
|
|
|
7933
7959
|
// src/components/adapters/PasswordInput.tsx
|
|
7934
|
-
var
|
|
7960
|
+
var import_browser56 = require("@asgardeo/browser");
|
|
7935
7961
|
var PasswordInput = ({
|
|
7936
7962
|
component,
|
|
7937
7963
|
formValues,
|
|
@@ -7977,7 +8003,7 @@ var PasswordInput = ({
|
|
|
7977
8003
|
});
|
|
7978
8004
|
const hint = validationHints.length > 0 ? validationHints.join(", ") : config["hint"] || "";
|
|
7979
8005
|
return createField({
|
|
7980
|
-
type:
|
|
8006
|
+
type: import_browser56.FieldType.Password,
|
|
7981
8007
|
name: fieldName,
|
|
7982
8008
|
label: config["label"] || "Password",
|
|
7983
8009
|
placeholder: config["placeholder"] || "Enter your password",
|
|
@@ -7991,7 +8017,7 @@ var PasswordInput = ({
|
|
|
7991
8017
|
var PasswordInput_default = PasswordInput;
|
|
7992
8018
|
|
|
7993
8019
|
// src/components/adapters/SubmitButton.tsx
|
|
7994
|
-
var
|
|
8020
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
7995
8021
|
var ButtonComponent = ({
|
|
7996
8022
|
component,
|
|
7997
8023
|
isLoading,
|
|
@@ -8024,7 +8050,7 @@ var ButtonComponent = ({
|
|
|
8024
8050
|
onSubmit(component);
|
|
8025
8051
|
}
|
|
8026
8052
|
};
|
|
8027
|
-
return /* @__PURE__ */ (0,
|
|
8053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
8028
8054
|
Button_default,
|
|
8029
8055
|
{
|
|
8030
8056
|
type: buttonType === "submit" ? "submit" : "button",
|
|
@@ -8035,7 +8061,7 @@ var ButtonComponent = ({
|
|
|
8035
8061
|
onClick: buttonType !== "submit" ? handleClick : void 0,
|
|
8036
8062
|
className: buttonClassName,
|
|
8037
8063
|
style: { width: "100%" },
|
|
8038
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
8064
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Spinner_default, { size: "small" }) : buttonText
|
|
8039
8065
|
},
|
|
8040
8066
|
component.id
|
|
8041
8067
|
);
|
|
@@ -8043,7 +8069,7 @@ var ButtonComponent = ({
|
|
|
8043
8069
|
var SubmitButton_default = ButtonComponent;
|
|
8044
8070
|
|
|
8045
8071
|
// src/components/adapters/TelephoneInput.tsx
|
|
8046
|
-
var
|
|
8072
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8047
8073
|
var TelephoneInput = ({
|
|
8048
8074
|
component,
|
|
8049
8075
|
formValues,
|
|
@@ -8056,7 +8082,7 @@ var TelephoneInput = ({
|
|
|
8056
8082
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
8057
8083
|
const value = formValues[fieldName] || "";
|
|
8058
8084
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
8059
|
-
return /* @__PURE__ */ (0,
|
|
8085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
8060
8086
|
TextField_default,
|
|
8061
8087
|
{
|
|
8062
8088
|
name: fieldName,
|
|
@@ -8076,7 +8102,7 @@ var TelephoneInput = ({
|
|
|
8076
8102
|
var TelephoneInput_default = TelephoneInput;
|
|
8077
8103
|
|
|
8078
8104
|
// src/components/adapters/TextInput.tsx
|
|
8079
|
-
var
|
|
8105
|
+
var import_browser57 = require("@asgardeo/browser");
|
|
8080
8106
|
var TextInput = ({
|
|
8081
8107
|
component,
|
|
8082
8108
|
formValues,
|
|
@@ -8090,7 +8116,7 @@ var TextInput = ({
|
|
|
8090
8116
|
const value = formValues[fieldName] || "";
|
|
8091
8117
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
8092
8118
|
return createField({
|
|
8093
|
-
type:
|
|
8119
|
+
type: import_browser57.FieldType.Text,
|
|
8094
8120
|
name: fieldName,
|
|
8095
8121
|
label: config["label"] || "",
|
|
8096
8122
|
placeholder: config["placeholder"] || "",
|
|
@@ -8104,7 +8130,7 @@ var TextInput = ({
|
|
|
8104
8130
|
var TextInput_default = TextInput;
|
|
8105
8131
|
|
|
8106
8132
|
// src/components/adapters/Typography.tsx
|
|
8107
|
-
var
|
|
8133
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
8108
8134
|
var TypographyComponent = ({ component }) => {
|
|
8109
8135
|
const { theme } = useTheme_default();
|
|
8110
8136
|
const config = component.config || {};
|
|
@@ -8145,7 +8171,7 @@ var TypographyComponent = ({ component }) => {
|
|
|
8145
8171
|
default:
|
|
8146
8172
|
typographyVariant = "body1";
|
|
8147
8173
|
}
|
|
8148
|
-
return /* @__PURE__ */ (0,
|
|
8174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
8149
8175
|
Typography_default,
|
|
8150
8176
|
{
|
|
8151
8177
|
variant: typographyVariant,
|
|
@@ -8158,66 +8184,66 @@ var TypographyComponent = ({ component }) => {
|
|
|
8158
8184
|
var Typography_default2 = TypographyComponent;
|
|
8159
8185
|
|
|
8160
8186
|
// src/components/presentation/SignUp/SignUpOptionFactory.tsx
|
|
8161
|
-
var
|
|
8187
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8162
8188
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
8163
8189
|
switch (component.type) {
|
|
8164
|
-
case
|
|
8165
|
-
return /* @__PURE__ */ (0,
|
|
8166
|
-
case
|
|
8190
|
+
case import_browser58.EmbeddedFlowComponentType.Typography:
|
|
8191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
8192
|
+
case import_browser58.EmbeddedFlowComponentType.Input:
|
|
8167
8193
|
const inputVariant = component.variant?.toUpperCase();
|
|
8168
8194
|
const inputType = component.config["type"]?.toLowerCase();
|
|
8169
8195
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
8170
|
-
return /* @__PURE__ */ (0,
|
|
8196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(EmailInput_default, { component, onSubmit, ...rest });
|
|
8171
8197
|
}
|
|
8172
8198
|
if (inputVariant === "PASSWORD" || inputType === "password") {
|
|
8173
|
-
return /* @__PURE__ */ (0,
|
|
8199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PasswordInput_default, { component, onSubmit, ...rest });
|
|
8174
8200
|
}
|
|
8175
8201
|
if (inputVariant === "TELEPHONE" || inputType === "tel") {
|
|
8176
|
-
return /* @__PURE__ */ (0,
|
|
8202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TelephoneInput_default, { component, onSubmit, ...rest });
|
|
8177
8203
|
}
|
|
8178
8204
|
if (inputVariant === "NUMBER" || inputType === "number") {
|
|
8179
|
-
return /* @__PURE__ */ (0,
|
|
8205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NumberInput_default, { component, onSubmit, ...rest });
|
|
8180
8206
|
}
|
|
8181
8207
|
if (inputVariant === "DATE" || inputType === "date") {
|
|
8182
|
-
return /* @__PURE__ */ (0,
|
|
8208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DateInput_default, { component, onSubmit, ...rest });
|
|
8183
8209
|
}
|
|
8184
8210
|
if (inputVariant === "CHECKBOX" || inputType === "checkbox") {
|
|
8185
|
-
return /* @__PURE__ */ (0,
|
|
8211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CheckboxInput_default, { component, onSubmit, ...rest });
|
|
8186
8212
|
}
|
|
8187
|
-
return /* @__PURE__ */ (0,
|
|
8188
|
-
case
|
|
8213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TextInput_default, { component, onSubmit, ...rest });
|
|
8214
|
+
case import_browser58.EmbeddedFlowComponentType.Button: {
|
|
8189
8215
|
const buttonVariant = component.variant?.toUpperCase();
|
|
8190
8216
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
8191
8217
|
if (buttonVariant === "SOCIAL") {
|
|
8192
8218
|
if (buttonText.toLowerCase().includes("google")) {
|
|
8193
|
-
return /* @__PURE__ */ (0,
|
|
8219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GoogleButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8194
8220
|
}
|
|
8195
8221
|
if (buttonText.toLowerCase().includes("github")) {
|
|
8196
|
-
return /* @__PURE__ */ (0,
|
|
8222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GitHubButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8197
8223
|
}
|
|
8198
8224
|
if (buttonText.toLowerCase().includes("microsoft")) {
|
|
8199
|
-
return /* @__PURE__ */ (0,
|
|
8225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MicrosoftButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8200
8226
|
}
|
|
8201
8227
|
if (buttonText.toLowerCase().includes("facebook")) {
|
|
8202
|
-
return /* @__PURE__ */ (0,
|
|
8228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FacebookButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8203
8229
|
}
|
|
8204
8230
|
if (buttonText.toLowerCase().includes("linkedin")) {
|
|
8205
|
-
return /* @__PURE__ */ (0,
|
|
8231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LinkedInButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8206
8232
|
}
|
|
8207
8233
|
if (buttonText.toLowerCase().includes("ethereum")) {
|
|
8208
|
-
return /* @__PURE__ */ (0,
|
|
8234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SignInWithEthereumButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
8209
8235
|
}
|
|
8210
8236
|
}
|
|
8211
|
-
return /* @__PURE__ */ (0,
|
|
8237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SubmitButton_default, { component, onSubmit, ...rest });
|
|
8212
8238
|
}
|
|
8213
|
-
case
|
|
8214
|
-
return /* @__PURE__ */ (0,
|
|
8215
|
-
case
|
|
8216
|
-
return /* @__PURE__ */ (0,
|
|
8217
|
-
case
|
|
8218
|
-
return /* @__PURE__ */ (0,
|
|
8239
|
+
case import_browser58.EmbeddedFlowComponentType.Form:
|
|
8240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormContainer_default, { component, onSubmit, ...rest });
|
|
8241
|
+
case import_browser58.EmbeddedFlowComponentType.Divider:
|
|
8242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DividerComponent_default, { component, onSubmit, ...rest });
|
|
8243
|
+
case import_browser58.EmbeddedFlowComponentType.Image:
|
|
8244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ImageComponent_default, { component, onSubmit, ...rest });
|
|
8219
8245
|
default:
|
|
8220
|
-
return /* @__PURE__ */ (0,
|
|
8246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", {});
|
|
8221
8247
|
}
|
|
8222
8248
|
};
|
|
8223
8249
|
var createSignUpOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createSignUpComponent({
|
|
@@ -8248,12 +8274,19 @@ var renderSignUpComponents = (components, formValues, touchedFields, formErrors,
|
|
|
8248
8274
|
).filter(Boolean);
|
|
8249
8275
|
|
|
8250
8276
|
// src/components/presentation/SignUp/transformer.ts
|
|
8251
|
-
var
|
|
8277
|
+
var import_browser59 = require("@asgardeo/browser");
|
|
8252
8278
|
var generateId2 = (prefix) => {
|
|
8253
8279
|
const suffix = Math.random().toString(36).substring(2, 6);
|
|
8254
8280
|
return `${prefix}_${suffix}`;
|
|
8255
8281
|
};
|
|
8256
|
-
var getInputVariant2 = (type) => {
|
|
8282
|
+
var getInputVariant2 = (type, name) => {
|
|
8283
|
+
const lowerName = name.toLowerCase();
|
|
8284
|
+
if (lowerName.includes("password")) {
|
|
8285
|
+
return "PASSWORD";
|
|
8286
|
+
}
|
|
8287
|
+
if (lowerName.includes("email")) {
|
|
8288
|
+
return "EMAIL";
|
|
8289
|
+
}
|
|
8257
8290
|
switch (type.toLowerCase()) {
|
|
8258
8291
|
case "email":
|
|
8259
8292
|
return "EMAIL";
|
|
@@ -8280,15 +8313,15 @@ var getInputPlaceholder2 = (name, type, t) => {
|
|
|
8280
8313
|
return placeholder;
|
|
8281
8314
|
};
|
|
8282
8315
|
var convertSimpleInputToComponent2 = (input, t) => {
|
|
8283
|
-
const variant = getInputVariant2(input.type);
|
|
8316
|
+
const variant = getInputVariant2(input.type, input.name);
|
|
8284
8317
|
const label = getInputLabel2(input.name, input.type, t);
|
|
8285
8318
|
const placeholder = getInputPlaceholder2(input.name, input.type, t);
|
|
8286
8319
|
return {
|
|
8287
8320
|
id: generateId2("input"),
|
|
8288
|
-
type:
|
|
8321
|
+
type: import_browser59.EmbeddedFlowComponentType.Input,
|
|
8289
8322
|
variant,
|
|
8290
8323
|
config: {
|
|
8291
|
-
type: input.type
|
|
8324
|
+
type: input.type,
|
|
8292
8325
|
label,
|
|
8293
8326
|
placeholder,
|
|
8294
8327
|
required: input.required,
|
|
@@ -8307,7 +8340,7 @@ var convertActionToComponent2 = (action, t) => {
|
|
|
8307
8340
|
}
|
|
8308
8341
|
return {
|
|
8309
8342
|
id: generateId2("action"),
|
|
8310
|
-
type:
|
|
8343
|
+
type: import_browser59.EmbeddedFlowComponentType.Button,
|
|
8311
8344
|
variant: "SECONDARY",
|
|
8312
8345
|
config: {
|
|
8313
8346
|
type: "button",
|
|
@@ -8323,7 +8356,7 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8323
8356
|
const actionComponents = response?.data?.actions?.map((action) => convertActionToComponent2(action, t)) || [];
|
|
8324
8357
|
const submitButton = inputComponents.length > 0 ? {
|
|
8325
8358
|
id: generateId2("button"),
|
|
8326
|
-
type:
|
|
8359
|
+
type: import_browser59.EmbeddedFlowComponentType.Button,
|
|
8327
8360
|
variant: "PRIMARY",
|
|
8328
8361
|
config: {
|
|
8329
8362
|
type: "submit",
|
|
@@ -8340,7 +8373,7 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8340
8373
|
if (formComponents.length > 0) {
|
|
8341
8374
|
result.push({
|
|
8342
8375
|
id: generateId2("form"),
|
|
8343
|
-
type:
|
|
8376
|
+
type: import_browser59.EmbeddedFlowComponentType.Form,
|
|
8344
8377
|
config: {},
|
|
8345
8378
|
components: formComponents
|
|
8346
8379
|
});
|
|
@@ -8350,6 +8383,38 @@ var transformSimpleToComponentDriven2 = (response, t) => {
|
|
|
8350
8383
|
}
|
|
8351
8384
|
return result;
|
|
8352
8385
|
};
|
|
8386
|
+
var extractErrorMessage = (error, t) => {
|
|
8387
|
+
let errorMessage = t("errors.sign.up.flow.failure");
|
|
8388
|
+
if (error && typeof error === "object") {
|
|
8389
|
+
if (error.flowStatus === "ERROR" && error.failureReason) {
|
|
8390
|
+
errorMessage = error.failureReason;
|
|
8391
|
+
} else if (error.code && (error.message || error.description)) {
|
|
8392
|
+
errorMessage = error.description || error.message;
|
|
8393
|
+
} else if (error instanceof Error && error.name === "AsgardeoAPIError") {
|
|
8394
|
+
try {
|
|
8395
|
+
const errorResponse = JSON.parse(
|
|
8396
|
+
error.message
|
|
8397
|
+
);
|
|
8398
|
+
if (errorResponse.failureReason) {
|
|
8399
|
+
errorMessage = errorResponse.failureReason;
|
|
8400
|
+
} else if (errorResponse.description) {
|
|
8401
|
+
errorMessage = errorResponse.description;
|
|
8402
|
+
} else if (errorResponse.message) {
|
|
8403
|
+
errorMessage = errorResponse.message;
|
|
8404
|
+
} else {
|
|
8405
|
+
errorMessage = error.message;
|
|
8406
|
+
}
|
|
8407
|
+
} catch {
|
|
8408
|
+
errorMessage = error.message;
|
|
8409
|
+
}
|
|
8410
|
+
} else if (error.message) {
|
|
8411
|
+
errorMessage = error.message;
|
|
8412
|
+
}
|
|
8413
|
+
} else if (typeof error === "string") {
|
|
8414
|
+
errorMessage = error;
|
|
8415
|
+
}
|
|
8416
|
+
return errorMessage;
|
|
8417
|
+
};
|
|
8353
8418
|
|
|
8354
8419
|
// src/components/presentation/SignUp/BaseSignUp.styles.ts
|
|
8355
8420
|
var import_css38 = require("@emotion/css");
|
|
@@ -8493,13 +8558,13 @@ var useStyles18 = (theme, colorScheme) => {
|
|
|
8493
8558
|
var BaseSignUp_styles_default = useStyles18;
|
|
8494
8559
|
|
|
8495
8560
|
// src/components/presentation/SignUp/BaseSignUp.tsx
|
|
8496
|
-
var
|
|
8561
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
8497
8562
|
var BaseSignUp = (props) => {
|
|
8498
8563
|
const { theme, colorScheme } = useTheme_default();
|
|
8499
8564
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
8500
|
-
return /* @__PURE__ */ (0,
|
|
8501
|
-
/* @__PURE__ */ (0,
|
|
8502
|
-
/* @__PURE__ */ (0,
|
|
8565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
8566
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Logo_default, { size: "large" }) }),
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BaseSignUpContent, { ...props }) })
|
|
8503
8568
|
] });
|
|
8504
8569
|
};
|
|
8505
8570
|
var BaseSignUpContent = ({
|
|
@@ -8521,12 +8586,22 @@ var BaseSignUpContent = ({
|
|
|
8521
8586
|
}) => {
|
|
8522
8587
|
const { theme, colorScheme } = useTheme_default();
|
|
8523
8588
|
const { t } = useTranslation_default();
|
|
8524
|
-
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages } = useFlow_default();
|
|
8589
|
+
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
8525
8590
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
8591
|
+
const handleError = (0, import_react62.useCallback)(
|
|
8592
|
+
(error) => {
|
|
8593
|
+
const errorMessage = extractErrorMessage(error, t);
|
|
8594
|
+
clearMessages();
|
|
8595
|
+
addMessage({
|
|
8596
|
+
type: "error",
|
|
8597
|
+
message: errorMessage
|
|
8598
|
+
});
|
|
8599
|
+
},
|
|
8600
|
+
[t, addMessage, clearMessages]
|
|
8601
|
+
);
|
|
8526
8602
|
const [isLoading, setIsLoading] = (0, import_react62.useState)(false);
|
|
8527
8603
|
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react62.useState)(false);
|
|
8528
8604
|
const [currentFlow, setCurrentFlow] = (0, import_react62.useState)(null);
|
|
8529
|
-
const [error, setError] = (0, import_react62.useState)(null);
|
|
8530
8605
|
const [formData, setFormData] = (0, import_react62.useState)({});
|
|
8531
8606
|
const initializationAttemptedRef = (0, import_react62.useRef)(false);
|
|
8532
8607
|
const normalizeFlowResponse2 = (0, import_react62.useCallback)(
|
|
@@ -8553,7 +8628,7 @@ var BaseSignUpContent = ({
|
|
|
8553
8628
|
const fields = [];
|
|
8554
8629
|
const processComponents = (comps) => {
|
|
8555
8630
|
comps.forEach((component) => {
|
|
8556
|
-
if (component.type ===
|
|
8631
|
+
if (component.type === import_browser60.EmbeddedFlowComponentType.Input) {
|
|
8557
8632
|
const config = component.config || {};
|
|
8558
8633
|
fields.push({
|
|
8559
8634
|
name: config.name || component.id,
|
|
@@ -8627,7 +8702,7 @@ var BaseSignUpContent = ({
|
|
|
8627
8702
|
return;
|
|
8628
8703
|
}
|
|
8629
8704
|
setIsLoading(true);
|
|
8630
|
-
|
|
8705
|
+
clearMessages();
|
|
8631
8706
|
try {
|
|
8632
8707
|
const filteredInputs = {};
|
|
8633
8708
|
if (data) {
|
|
@@ -8646,11 +8721,11 @@ var BaseSignUpContent = ({
|
|
|
8646
8721
|
const rawResponse = await onSubmit(payload);
|
|
8647
8722
|
const response = normalizeFlowResponse2(rawResponse);
|
|
8648
8723
|
onFlowChange?.(response);
|
|
8649
|
-
if (response.flowStatus ===
|
|
8724
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8650
8725
|
onComplete?.(response);
|
|
8651
8726
|
return;
|
|
8652
8727
|
}
|
|
8653
|
-
if (response.flowStatus ===
|
|
8728
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8654
8729
|
if (handleRedirectionIfNeeded(response, component)) {
|
|
8655
8730
|
return;
|
|
8656
8731
|
}
|
|
@@ -8658,15 +8733,14 @@ var BaseSignUpContent = ({
|
|
|
8658
8733
|
setupFormFields(response);
|
|
8659
8734
|
}
|
|
8660
8735
|
} catch (err) {
|
|
8661
|
-
|
|
8662
|
-
setError(errorMessage);
|
|
8736
|
+
handleError(err);
|
|
8663
8737
|
onError?.(err);
|
|
8664
8738
|
} finally {
|
|
8665
8739
|
setIsLoading(false);
|
|
8666
8740
|
}
|
|
8667
8741
|
};
|
|
8668
8742
|
const handleRedirectionIfNeeded = (response, component) => {
|
|
8669
|
-
if (response?.type ===
|
|
8743
|
+
if (response?.type === import_browser60.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL) {
|
|
8670
8744
|
const redirectUrl = response.data.redirectURL;
|
|
8671
8745
|
const popup = window.open(redirectUrl, "oauth_popup", "width=500,height=600,scrollbars=yes,resizable=yes");
|
|
8672
8746
|
if (!popup) {
|
|
@@ -8695,17 +8769,16 @@ var BaseSignUpContent = ({
|
|
|
8695
8769
|
try {
|
|
8696
8770
|
const continueResponse = await onSubmit(payload);
|
|
8697
8771
|
onFlowChange?.(continueResponse);
|
|
8698
|
-
if (continueResponse.flowStatus ===
|
|
8772
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8699
8773
|
onComplete?.(continueResponse);
|
|
8700
|
-
} else if (continueResponse.flowStatus ===
|
|
8774
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8701
8775
|
setCurrentFlow(continueResponse);
|
|
8702
8776
|
setupFormFields(continueResponse);
|
|
8703
8777
|
}
|
|
8704
8778
|
popup.close();
|
|
8705
8779
|
cleanup();
|
|
8706
8780
|
} catch (err) {
|
|
8707
|
-
|
|
8708
|
-
setError(errorMessage);
|
|
8781
|
+
handleError(err);
|
|
8709
8782
|
onError?.(err);
|
|
8710
8783
|
popup.close();
|
|
8711
8784
|
cleanup();
|
|
@@ -8736,9 +8809,9 @@ var BaseSignUpContent = ({
|
|
|
8736
8809
|
const url = new URL(popupUrl);
|
|
8737
8810
|
const code = url.searchParams.get("code");
|
|
8738
8811
|
const state = url.searchParams.get("state");
|
|
8739
|
-
const
|
|
8740
|
-
if (
|
|
8741
|
-
console.error("OAuth error:",
|
|
8812
|
+
const error = url.searchParams.get("error");
|
|
8813
|
+
if (error) {
|
|
8814
|
+
console.error("OAuth error:", error);
|
|
8742
8815
|
popup.close();
|
|
8743
8816
|
cleanup();
|
|
8744
8817
|
return;
|
|
@@ -8756,16 +8829,15 @@ var BaseSignUpContent = ({
|
|
|
8756
8829
|
try {
|
|
8757
8830
|
const continueResponse = await onSubmit(payload);
|
|
8758
8831
|
onFlowChange?.(continueResponse);
|
|
8759
|
-
if (continueResponse.flowStatus ===
|
|
8832
|
+
if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8760
8833
|
onComplete?.(continueResponse);
|
|
8761
|
-
} else if (continueResponse.flowStatus ===
|
|
8834
|
+
} else if (continueResponse.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8762
8835
|
setCurrentFlow(continueResponse);
|
|
8763
8836
|
setupFormFields(continueResponse);
|
|
8764
8837
|
}
|
|
8765
8838
|
popup.close();
|
|
8766
8839
|
} catch (err) {
|
|
8767
|
-
|
|
8768
|
-
setError(errorMessage);
|
|
8840
|
+
handleError(err);
|
|
8769
8841
|
onError?.(err);
|
|
8770
8842
|
popup.close();
|
|
8771
8843
|
}
|
|
@@ -8783,30 +8855,30 @@ var BaseSignUpContent = ({
|
|
|
8783
8855
|
};
|
|
8784
8856
|
const containerClasses = (0, import_css39.cx)(
|
|
8785
8857
|
[
|
|
8786
|
-
(0,
|
|
8787
|
-
(0,
|
|
8788
|
-
(0,
|
|
8858
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup"),
|
|
8859
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${size}`),
|
|
8860
|
+
(0, import_browser60.withVendorCSSClassPrefix)(`signup--${variant}`)
|
|
8789
8861
|
],
|
|
8790
8862
|
className
|
|
8791
8863
|
);
|
|
8792
8864
|
const inputClasses = (0, import_css39.cx)(
|
|
8793
8865
|
[
|
|
8794
|
-
(0,
|
|
8795
|
-
size === "small" && (0,
|
|
8796
|
-
size === "large" && (0,
|
|
8866
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__input"),
|
|
8867
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--small"),
|
|
8868
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__input--large")
|
|
8797
8869
|
],
|
|
8798
8870
|
inputClassName
|
|
8799
8871
|
);
|
|
8800
8872
|
const buttonClasses = (0, import_css39.cx)(
|
|
8801
8873
|
[
|
|
8802
|
-
(0,
|
|
8803
|
-
size === "small" && (0,
|
|
8804
|
-
size === "large" && (0,
|
|
8874
|
+
(0, import_browser60.withVendorCSSClassPrefix)("signup__button"),
|
|
8875
|
+
size === "small" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--small"),
|
|
8876
|
+
size === "large" && (0, import_browser60.withVendorCSSClassPrefix)("signup__button--large")
|
|
8805
8877
|
],
|
|
8806
8878
|
buttonClassName
|
|
8807
8879
|
);
|
|
8808
|
-
const errorClasses = (0, import_css39.cx)([(0,
|
|
8809
|
-
const messageClasses = (0, import_css39.cx)([(0,
|
|
8880
|
+
const errorClasses = (0, import_css39.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
8881
|
+
const messageClasses = (0, import_css39.cx)([(0, import_browser60.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
8810
8882
|
const renderComponents = (0, import_react62.useCallback)(
|
|
8811
8883
|
(components) => renderSignUpComponents(
|
|
8812
8884
|
components,
|
|
@@ -8818,7 +8890,6 @@ var BaseSignUpContent = ({
|
|
|
8818
8890
|
handleInputChange,
|
|
8819
8891
|
{
|
|
8820
8892
|
buttonClassName: buttonClasses,
|
|
8821
|
-
error,
|
|
8822
8893
|
inputClassName: inputClasses,
|
|
8823
8894
|
onSubmit: handleSubmit,
|
|
8824
8895
|
size,
|
|
@@ -8833,7 +8904,6 @@ var BaseSignUpContent = ({
|
|
|
8833
8904
|
isLoading,
|
|
8834
8905
|
size,
|
|
8835
8906
|
variant,
|
|
8836
|
-
error,
|
|
8837
8907
|
inputClasses,
|
|
8838
8908
|
buttonClasses,
|
|
8839
8909
|
handleSubmit
|
|
@@ -8844,23 +8914,22 @@ var BaseSignUpContent = ({
|
|
|
8844
8914
|
initializationAttemptedRef.current = true;
|
|
8845
8915
|
(async () => {
|
|
8846
8916
|
setIsLoading(true);
|
|
8847
|
-
|
|
8917
|
+
clearMessages();
|
|
8848
8918
|
try {
|
|
8849
8919
|
const rawResponse = await onInitialize();
|
|
8850
8920
|
const response = normalizeFlowResponse2(rawResponse);
|
|
8851
8921
|
setCurrentFlow(response);
|
|
8852
8922
|
setIsFlowInitialized(true);
|
|
8853
8923
|
onFlowChange?.(response);
|
|
8854
|
-
if (response.flowStatus ===
|
|
8924
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Complete) {
|
|
8855
8925
|
onComplete?.(response);
|
|
8856
8926
|
return;
|
|
8857
8927
|
}
|
|
8858
|
-
if (response.flowStatus ===
|
|
8928
|
+
if (response.flowStatus === import_browser60.EmbeddedFlowStatus.Incomplete) {
|
|
8859
8929
|
setupFormFields(response);
|
|
8860
8930
|
}
|
|
8861
8931
|
} catch (err) {
|
|
8862
|
-
|
|
8863
|
-
setError(errorMessage);
|
|
8932
|
+
handleError(err);
|
|
8864
8933
|
onError?.(err);
|
|
8865
8934
|
} finally {
|
|
8866
8935
|
setIsLoading(false);
|
|
@@ -8886,7 +8955,6 @@ var BaseSignUpContent = ({
|
|
|
8886
8955
|
touched: touchedFields,
|
|
8887
8956
|
isValid: isFormValid,
|
|
8888
8957
|
isLoading,
|
|
8889
|
-
error,
|
|
8890
8958
|
components: currentFlow?.data?.components || [],
|
|
8891
8959
|
handleInputChange,
|
|
8892
8960
|
handleSubmit,
|
|
@@ -8895,41 +8963,39 @@ var BaseSignUpContent = ({
|
|
|
8895
8963
|
subtitle: flowSubtitle || t("signup.subtitle"),
|
|
8896
8964
|
messages: flowMessages || []
|
|
8897
8965
|
};
|
|
8898
|
-
return /* @__PURE__ */ (0,
|
|
8966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
8899
8967
|
}
|
|
8900
8968
|
if (!isFlowInitialized && isLoading) {
|
|
8901
|
-
return /* @__PURE__ */ (0,
|
|
8969
|
+
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
8970
|
}
|
|
8903
8971
|
if (!currentFlow) {
|
|
8904
|
-
return /* @__PURE__ */ (0,
|
|
8905
|
-
/* @__PURE__ */ (0,
|
|
8906
|
-
/* @__PURE__ */ (0,
|
|
8972
|
+
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: [
|
|
8973
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Title, { children: t("errors.title") }),
|
|
8974
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: t("errors.sign.up.flow.initialization.failure") })
|
|
8907
8975
|
] }) }) });
|
|
8908
8976
|
}
|
|
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
|
-
] })
|
|
8977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: [
|
|
8978
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
8979
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.title") }),
|
|
8980
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.subtitle") }),
|
|
8981
|
+
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)(
|
|
8982
|
+
Alert_default,
|
|
8983
|
+
{
|
|
8984
|
+
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
8985
|
+
className: (0, import_css39.cx)(styles.flowMessageItem, messageClasses),
|
|
8986
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: message.message })
|
|
8987
|
+
},
|
|
8988
|
+
message.id || index
|
|
8989
|
+
)) })
|
|
8990
|
+
] }),
|
|
8991
|
+
/* @__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
8992
|
] });
|
|
8927
8993
|
};
|
|
8928
8994
|
var BaseSignUp_default = BaseSignUp;
|
|
8929
8995
|
|
|
8930
8996
|
// src/components/presentation/SignUp/SignUp.tsx
|
|
8931
|
-
var
|
|
8932
|
-
var
|
|
8997
|
+
var import_browser61 = require("@asgardeo/browser");
|
|
8998
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
8933
8999
|
var SignUp = ({
|
|
8934
9000
|
className,
|
|
8935
9001
|
size = "medium",
|
|
@@ -8943,23 +9009,23 @@ var SignUp = ({
|
|
|
8943
9009
|
const { signUp, isInitialized, applicationId, platform } = useAsgardeo_default();
|
|
8944
9010
|
const handleInitialize = async (payload) => {
|
|
8945
9011
|
const initialPayload = payload || {
|
|
8946
|
-
flowType:
|
|
8947
|
-
...platform ===
|
|
9012
|
+
flowType: import_browser61.EmbeddedFlowType.Registration,
|
|
9013
|
+
...platform === import_browser61.Platform.AsgardeoV2 && applicationId && { applicationId }
|
|
8948
9014
|
};
|
|
8949
9015
|
return await signUp(initialPayload);
|
|
8950
9016
|
};
|
|
8951
9017
|
const handleOnSubmit = async (payload) => await signUp(payload);
|
|
8952
9018
|
const handleComplete = (response) => {
|
|
8953
9019
|
onComplete?.(response);
|
|
8954
|
-
if (shouldRedirectAfterSignUp && response?.type !==
|
|
9020
|
+
if (shouldRedirectAfterSignUp && response?.type !== import_browser61.EmbeddedFlowResponseType.Redirection && afterSignUpUrl) {
|
|
8955
9021
|
window.location.href = afterSignUpUrl;
|
|
8956
9022
|
}
|
|
8957
|
-
if (shouldRedirectAfterSignUp && response?.type ===
|
|
9023
|
+
if (shouldRedirectAfterSignUp && response?.type === import_browser61.EmbeddedFlowResponseType.Redirection && response?.data?.redirectURL && !response.data.redirectURL.includes("oauth") && // Not a social provider redirect
|
|
8958
9024
|
!response.data.redirectURL.includes("auth")) {
|
|
8959
9025
|
window.location.href = response.data.redirectURL;
|
|
8960
9026
|
}
|
|
8961
9027
|
};
|
|
8962
|
-
return /* @__PURE__ */ (0,
|
|
9028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
8963
9029
|
BaseSignUp_default,
|
|
8964
9030
|
{
|
|
8965
9031
|
afterSignUpUrl,
|
|
@@ -8978,75 +9044,75 @@ var SignUp = ({
|
|
|
8978
9044
|
var SignUp_default = SignUp;
|
|
8979
9045
|
|
|
8980
9046
|
// src/components/presentation/User/BaseUser.tsx
|
|
8981
|
-
var
|
|
9047
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
8982
9048
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
8983
9049
|
if (!user) {
|
|
8984
|
-
return /* @__PURE__ */ (0,
|
|
9050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: fallback });
|
|
8985
9051
|
}
|
|
8986
|
-
return /* @__PURE__ */ (0,
|
|
9052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: children(user) });
|
|
8987
9053
|
};
|
|
8988
9054
|
BaseUser.displayName = "BaseUser";
|
|
8989
9055
|
var BaseUser_default = BaseUser;
|
|
8990
9056
|
|
|
8991
9057
|
// src/components/presentation/User/User.tsx
|
|
8992
|
-
var
|
|
9058
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
8993
9059
|
var User5 = ({ children, fallback = null }) => {
|
|
8994
9060
|
const { user } = useAsgardeo_default();
|
|
8995
|
-
return /* @__PURE__ */ (0,
|
|
9061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(BaseUser_default, { user, fallback, children });
|
|
8996
9062
|
};
|
|
8997
9063
|
User5.displayName = "User";
|
|
8998
9064
|
var User_default = User5;
|
|
8999
9065
|
|
|
9000
9066
|
// src/components/presentation/Organization/BaseOrganization.tsx
|
|
9001
|
-
var
|
|
9067
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
9002
9068
|
var BaseOrganization = ({ children, fallback = null, organization }) => {
|
|
9003
9069
|
if (!organization) {
|
|
9004
|
-
return /* @__PURE__ */ (0,
|
|
9070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: fallback });
|
|
9005
9071
|
}
|
|
9006
|
-
return /* @__PURE__ */ (0,
|
|
9072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: children(organization) });
|
|
9007
9073
|
};
|
|
9008
9074
|
BaseOrganization.displayName = "BaseOrganization";
|
|
9009
9075
|
var BaseOrganization_default = BaseOrganization;
|
|
9010
9076
|
|
|
9011
9077
|
// src/components/presentation/Organization/Organization.tsx
|
|
9012
|
-
var
|
|
9078
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
9013
9079
|
var Organization5 = ({ children, fallback = null }) => {
|
|
9014
9080
|
const { currentOrganization } = useOrganization_default();
|
|
9015
|
-
return /* @__PURE__ */ (0,
|
|
9081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(BaseOrganization_default, { organization: currentOrganization, fallback, children });
|
|
9016
9082
|
};
|
|
9017
9083
|
Organization5.displayName = "Organization";
|
|
9018
9084
|
var Organization_default = Organization5;
|
|
9019
9085
|
|
|
9020
9086
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
9021
|
-
var
|
|
9087
|
+
var import_browser67 = require("@asgardeo/browser");
|
|
9022
9088
|
var import_css47 = require("@emotion/css");
|
|
9023
9089
|
var import_react71 = require("react");
|
|
9024
9090
|
|
|
9025
9091
|
// src/utils/getMappedUserProfileValue.ts
|
|
9026
|
-
var
|
|
9092
|
+
var import_browser62 = require("@asgardeo/browser");
|
|
9027
9093
|
var getMappedUserProfileValue = (key, mappings, user) => {
|
|
9028
9094
|
if (!key || !mappings || !user) {
|
|
9029
9095
|
return void 0;
|
|
9030
9096
|
}
|
|
9031
9097
|
const mapping = mappings[key];
|
|
9032
9098
|
if (!mapping) {
|
|
9033
|
-
return (0,
|
|
9099
|
+
return (0, import_browser62.get)(user, key);
|
|
9034
9100
|
}
|
|
9035
9101
|
if (Array.isArray(mapping)) {
|
|
9036
9102
|
for (const path of mapping) {
|
|
9037
|
-
const value = (0,
|
|
9103
|
+
const value = (0, import_browser62.get)(user, path);
|
|
9038
9104
|
if (value !== void 0 && value !== null && value !== "") {
|
|
9039
9105
|
return value;
|
|
9040
9106
|
}
|
|
9041
9107
|
}
|
|
9042
9108
|
return void 0;
|
|
9043
9109
|
}
|
|
9044
|
-
return (0,
|
|
9110
|
+
return (0, import_browser62.get)(user, mapping);
|
|
9045
9111
|
};
|
|
9046
9112
|
var getMappedUserProfileValue_default = getMappedUserProfileValue;
|
|
9047
9113
|
|
|
9048
9114
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9049
|
-
var
|
|
9115
|
+
var import_browser63 = require("@asgardeo/browser");
|
|
9050
9116
|
var import_css41 = require("@emotion/css");
|
|
9051
9117
|
var import_react64 = require("react");
|
|
9052
9118
|
|
|
@@ -9118,7 +9184,7 @@ var useStyles19 = (theme, colorScheme, size, variant, backgroundColor) => {
|
|
|
9118
9184
|
var Avatar_styles_default = useStyles19;
|
|
9119
9185
|
|
|
9120
9186
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
9121
|
-
var
|
|
9187
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
9122
9188
|
var Avatar = ({
|
|
9123
9189
|
alt = "User avatar",
|
|
9124
9190
|
background = "random",
|
|
@@ -9165,33 +9231,33 @@ var Avatar = ({
|
|
|
9165
9231
|
const getInitials = (fullName) => fullName.split(" ").map((part) => part[0]).slice(0, 2).join("").toUpperCase();
|
|
9166
9232
|
const renderContent = () => {
|
|
9167
9233
|
if (imageUrl) {
|
|
9168
|
-
return /* @__PURE__ */ (0,
|
|
9234
|
+
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
9235
|
}
|
|
9170
9236
|
if (name) {
|
|
9171
9237
|
return getInitials(name);
|
|
9172
9238
|
}
|
|
9173
9239
|
if (isLoading) {
|
|
9174
|
-
return /* @__PURE__ */ (0,
|
|
9240
|
+
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
9241
|
}
|
|
9176
|
-
return /* @__PURE__ */ (0,
|
|
9242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9177
9243
|
"svg",
|
|
9178
9244
|
{
|
|
9179
9245
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9180
9246
|
viewBox: "0 0 640 640",
|
|
9181
|
-
className: (0, import_css41.cx)((0,
|
|
9182
|
-
children: /* @__PURE__ */ (0,
|
|
9247
|
+
className: (0, import_css41.cx)((0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "icon")), styles.icon),
|
|
9248
|
+
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
9249
|
}
|
|
9184
9250
|
);
|
|
9185
9251
|
};
|
|
9186
|
-
return /* @__PURE__ */ (0,
|
|
9252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9187
9253
|
"div",
|
|
9188
9254
|
{
|
|
9189
9255
|
className: (0, import_css41.cx)(
|
|
9190
|
-
(0,
|
|
9256
|
+
(0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar")),
|
|
9191
9257
|
styles.avatar,
|
|
9192
9258
|
styles.variant,
|
|
9193
|
-
(0,
|
|
9194
|
-
isDefaultState && (0,
|
|
9259
|
+
(0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", null, variant)),
|
|
9260
|
+
isDefaultState && (0, import_browser63.withVendorCSSClassPrefix)((0, import_browser63.bem)("avatar", "default")),
|
|
9195
9261
|
className
|
|
9196
9262
|
),
|
|
9197
9263
|
children: renderContent()
|
|
@@ -9201,14 +9267,14 @@ var Avatar = ({
|
|
|
9201
9267
|
var Avatar_default = Avatar;
|
|
9202
9268
|
|
|
9203
9269
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9204
|
-
var
|
|
9270
|
+
var import_browser64 = require("@asgardeo/browser");
|
|
9205
9271
|
var import_react66 = require("@floating-ui/react");
|
|
9206
9272
|
var import_css43 = require("@emotion/css");
|
|
9207
9273
|
var import_react67 = __toESM(require("react"), 1);
|
|
9208
9274
|
|
|
9209
9275
|
// src/components/primitives/Icons/LogOut.tsx
|
|
9210
|
-
var
|
|
9211
|
-
var LogOut = (props) => /* @__PURE__ */ (0,
|
|
9276
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
9277
|
+
var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
9212
9278
|
"svg",
|
|
9213
9279
|
{
|
|
9214
9280
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9222,17 +9288,17 @@ var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
|
9222
9288
|
strokeLinejoin: "round",
|
|
9223
9289
|
...props,
|
|
9224
9290
|
children: [
|
|
9225
|
-
/* @__PURE__ */ (0,
|
|
9226
|
-
/* @__PURE__ */ (0,
|
|
9227
|
-
/* @__PURE__ */ (0,
|
|
9291
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "m16 17 5-5-5-5" }),
|
|
9292
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "M21 12H9" }),
|
|
9293
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" })
|
|
9228
9294
|
]
|
|
9229
9295
|
}
|
|
9230
9296
|
);
|
|
9231
9297
|
var LogOut_default = LogOut;
|
|
9232
9298
|
|
|
9233
9299
|
// src/components/primitives/Icons/Plus.tsx
|
|
9234
|
-
var
|
|
9235
|
-
var Plus = (props) => /* @__PURE__ */ (0,
|
|
9300
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
9301
|
+
var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
9236
9302
|
"svg",
|
|
9237
9303
|
{
|
|
9238
9304
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9246,16 +9312,16 @@ var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
|
9246
9312
|
strokeLinejoin: "round",
|
|
9247
9313
|
...props,
|
|
9248
9314
|
children: [
|
|
9249
|
-
/* @__PURE__ */ (0,
|
|
9250
|
-
/* @__PURE__ */ (0,
|
|
9315
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("path", { d: "M5 12h14" }),
|
|
9316
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("path", { d: "M12 5v14" })
|
|
9251
9317
|
]
|
|
9252
9318
|
}
|
|
9253
9319
|
);
|
|
9254
9320
|
var Plus_default = Plus;
|
|
9255
9321
|
|
|
9256
9322
|
// src/components/primitives/Icons/User.tsx
|
|
9257
|
-
var
|
|
9258
|
-
var User7 = (props) => /* @__PURE__ */ (0,
|
|
9323
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
9324
|
+
var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
9259
9325
|
"svg",
|
|
9260
9326
|
{
|
|
9261
9327
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9269,16 +9335,16 @@ var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
|
9269
9335
|
strokeLinejoin: "round",
|
|
9270
9336
|
...props,
|
|
9271
9337
|
children: [
|
|
9272
|
-
/* @__PURE__ */ (0,
|
|
9273
|
-
/* @__PURE__ */ (0,
|
|
9338
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
9339
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("circle", { cx: "12", cy: "7", r: "4" })
|
|
9274
9340
|
]
|
|
9275
9341
|
}
|
|
9276
9342
|
);
|
|
9277
9343
|
var User_default2 = User7;
|
|
9278
9344
|
|
|
9279
9345
|
// src/components/primitives/Icons/X.tsx
|
|
9280
|
-
var
|
|
9281
|
-
var X = (props) => /* @__PURE__ */ (0,
|
|
9346
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
9347
|
+
var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
9282
9348
|
"svg",
|
|
9283
9349
|
{
|
|
9284
9350
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9292,8 +9358,8 @@ var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
|
9292
9358
|
strokeLinejoin: "round",
|
|
9293
9359
|
...props,
|
|
9294
9360
|
children: [
|
|
9295
|
-
/* @__PURE__ */ (0,
|
|
9296
|
-
/* @__PURE__ */ (0,
|
|
9361
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { d: "M18 6 6 18" }),
|
|
9362
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("path", { d: "m6 6 12 12" })
|
|
9297
9363
|
]
|
|
9298
9364
|
}
|
|
9299
9365
|
);
|
|
@@ -9365,7 +9431,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
9365
9431
|
var Dialog_styles_default = useStyles20;
|
|
9366
9432
|
|
|
9367
9433
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
9368
|
-
var
|
|
9434
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
9369
9435
|
function useDialog({
|
|
9370
9436
|
initialOpen = false,
|
|
9371
9437
|
open: controlledOpen,
|
|
@@ -9411,7 +9477,7 @@ var useDialogContext = () => {
|
|
|
9411
9477
|
};
|
|
9412
9478
|
function Dialog({ children, ...options }) {
|
|
9413
9479
|
const dialog = useDialog(options);
|
|
9414
|
-
return /* @__PURE__ */ (0,
|
|
9480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
9415
9481
|
}
|
|
9416
9482
|
var DialogTrigger = import_react67.default.forwardRef(
|
|
9417
9483
|
({ children, asChild = false, ...props }, propRef) => {
|
|
@@ -9429,7 +9495,7 @@ var DialogTrigger = import_react67.default.forwardRef(
|
|
|
9429
9495
|
})
|
|
9430
9496
|
);
|
|
9431
9497
|
}
|
|
9432
|
-
return /* @__PURE__ */ (0,
|
|
9498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
9433
9499
|
}
|
|
9434
9500
|
);
|
|
9435
9501
|
var DialogContent = import_react67.default.forwardRef((props, propRef) => {
|
|
@@ -9438,11 +9504,11 @@ var DialogContent = import_react67.default.forwardRef((props, propRef) => {
|
|
|
9438
9504
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
9439
9505
|
const ref = (0, import_react66.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
9440
9506
|
if (!floatingContext.open) return null;
|
|
9441
|
-
return /* @__PURE__ */ (0,
|
|
9507
|
+
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
9508
|
"div",
|
|
9443
9509
|
{
|
|
9444
9510
|
ref,
|
|
9445
|
-
className: (0, import_css43.cx)((0,
|
|
9511
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "content")), styles.content, props.className),
|
|
9446
9512
|
"aria-labelledby": context.labelId,
|
|
9447
9513
|
"aria-describedby": context.descriptionId,
|
|
9448
9514
|
...context.getFloatingProps(props),
|
|
@@ -9460,18 +9526,18 @@ var DialogHeading = import_react67.default.forwardRef(
|
|
|
9460
9526
|
context.setLabelId(id);
|
|
9461
9527
|
return () => context.setLabelId(void 0);
|
|
9462
9528
|
}, [id, context.setLabelId]);
|
|
9463
|
-
return /* @__PURE__ */ (0,
|
|
9464
|
-
/* @__PURE__ */ (0,
|
|
9529
|
+
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: [
|
|
9530
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9465
9531
|
"h2",
|
|
9466
9532
|
{
|
|
9467
9533
|
...props,
|
|
9468
9534
|
ref,
|
|
9469
9535
|
id,
|
|
9470
|
-
className: (0, import_css43.cx)((0,
|
|
9536
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "title")), styles.headerTitle),
|
|
9471
9537
|
children
|
|
9472
9538
|
}
|
|
9473
9539
|
),
|
|
9474
|
-
/* @__PURE__ */ (0,
|
|
9540
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9475
9541
|
Button_default,
|
|
9476
9542
|
{
|
|
9477
9543
|
color: "tertiary",
|
|
@@ -9480,7 +9546,7 @@ var DialogHeading = import_react67.default.forwardRef(
|
|
|
9480
9546
|
shape: "round",
|
|
9481
9547
|
onClick: () => context.setOpen(false),
|
|
9482
9548
|
"aria-label": "Close",
|
|
9483
|
-
children: /* @__PURE__ */ (0,
|
|
9549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(X_default, { width: 16, height: 16 })
|
|
9484
9550
|
}
|
|
9485
9551
|
)
|
|
9486
9552
|
] });
|
|
@@ -9496,13 +9562,13 @@ var DialogDescription = import_react67.default.forwardRef(
|
|
|
9496
9562
|
context.setDescriptionId(id);
|
|
9497
9563
|
return () => context.setDescriptionId(void 0);
|
|
9498
9564
|
}, [id, context.setDescriptionId]);
|
|
9499
|
-
return /* @__PURE__ */ (0,
|
|
9565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9500
9566
|
"p",
|
|
9501
9567
|
{
|
|
9502
9568
|
...props,
|
|
9503
9569
|
ref,
|
|
9504
9570
|
id,
|
|
9505
|
-
className: (0, import_css43.cx)((0,
|
|
9571
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "description")), styles.description, props.className),
|
|
9506
9572
|
children
|
|
9507
9573
|
}
|
|
9508
9574
|
);
|
|
@@ -9526,13 +9592,13 @@ var DialogClose = import_react67.default.forwardRef(({ children, asChild = false
|
|
|
9526
9592
|
onClick: handleClick
|
|
9527
9593
|
});
|
|
9528
9594
|
}
|
|
9529
|
-
return /* @__PURE__ */ (0,
|
|
9595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9530
9596
|
Button_default,
|
|
9531
9597
|
{
|
|
9532
9598
|
...props,
|
|
9533
9599
|
ref,
|
|
9534
9600
|
onClick: handleClick,
|
|
9535
|
-
className: (0, import_css43.cx)((0,
|
|
9601
|
+
className: (0, import_css43.cx)((0, import_browser64.withVendorCSSClassPrefix)((0, import_browser64.bem)("dialog", "close")), props.className),
|
|
9536
9602
|
variant: "text",
|
|
9537
9603
|
children
|
|
9538
9604
|
}
|
|
@@ -9553,7 +9619,7 @@ var Dialog_default = Dialog;
|
|
|
9553
9619
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9554
9620
|
var import_react69 = require("react");
|
|
9555
9621
|
var import_css45 = require("@emotion/css");
|
|
9556
|
-
var
|
|
9622
|
+
var import_browser65 = require("@asgardeo/browser");
|
|
9557
9623
|
|
|
9558
9624
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
9559
9625
|
var import_css44 = require("@emotion/css");
|
|
@@ -9649,7 +9715,7 @@ var useStyles21 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove
|
|
|
9649
9715
|
var MultiInput_styles_default = useStyles21;
|
|
9650
9716
|
|
|
9651
9717
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
9652
|
-
var
|
|
9718
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
9653
9719
|
var MultiInput = ({
|
|
9654
9720
|
label,
|
|
9655
9721
|
error,
|
|
@@ -9672,8 +9738,8 @@ var MultiInput = ({
|
|
|
9672
9738
|
const canAddMore = !maxFields || values.length < maxFields;
|
|
9673
9739
|
const canRemove = values.length > minFields;
|
|
9674
9740
|
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,
|
|
9741
|
+
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" }) });
|
|
9742
|
+
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
9743
|
const handleAddValue = (0, import_react69.useCallback)(
|
|
9678
9744
|
(newValue) => {
|
|
9679
9745
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
@@ -9717,9 +9783,9 @@ var MultiInput = ({
|
|
|
9717
9783
|
};
|
|
9718
9784
|
switch (fieldType) {
|
|
9719
9785
|
case "DATE_TIME":
|
|
9720
|
-
return /* @__PURE__ */ (0,
|
|
9786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DatePicker_default, { ...commonProps });
|
|
9721
9787
|
case "BOOLEAN":
|
|
9722
|
-
return /* @__PURE__ */ (0,
|
|
9788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9723
9789
|
Checkbox_default,
|
|
9724
9790
|
{
|
|
9725
9791
|
...commonProps,
|
|
@@ -9728,7 +9794,7 @@ var MultiInput = ({
|
|
|
9728
9794
|
}
|
|
9729
9795
|
);
|
|
9730
9796
|
default:
|
|
9731
|
-
return /* @__PURE__ */ (0,
|
|
9797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TextField_default, { ...commonProps, type });
|
|
9732
9798
|
}
|
|
9733
9799
|
},
|
|
9734
9800
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
@@ -9740,43 +9806,43 @@ var MultiInput = ({
|
|
|
9740
9806
|
setCurrentInputValue("");
|
|
9741
9807
|
}
|
|
9742
9808
|
}, [currentInputValue, handleAddValue]);
|
|
9743
|
-
return /* @__PURE__ */ (0,
|
|
9809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
9744
9810
|
FormControl_default,
|
|
9745
9811
|
{
|
|
9746
9812
|
error,
|
|
9747
9813
|
helperText,
|
|
9748
|
-
className: (0, import_css45.cx)((0,
|
|
9814
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input")), className),
|
|
9749
9815
|
style,
|
|
9750
9816
|
children: [
|
|
9751
|
-
label && /* @__PURE__ */ (0,
|
|
9752
|
-
/* @__PURE__ */ (0,
|
|
9753
|
-
/* @__PURE__ */ (0,
|
|
9817
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
9818
|
+
/* @__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: [
|
|
9819
|
+
/* @__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
9820
|
currentInputValue,
|
|
9755
9821
|
setCurrentInputValue,
|
|
9756
|
-
canAddMore ? /* @__PURE__ */ (0,
|
|
9822
|
+
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(PlusIcon, { className: styles.plusIcon }) : void 0,
|
|
9757
9823
|
canAddMore ? handleInputSubmit : void 0
|
|
9758
9824
|
) }) }),
|
|
9759
|
-
values.length > 0 && /* @__PURE__ */ (0,
|
|
9825
|
+
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
9826
|
"div",
|
|
9761
9827
|
{
|
|
9762
|
-
className: (0, import_css45.cx)((0,
|
|
9828
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "list-item")), styles.listItem),
|
|
9763
9829
|
children: [
|
|
9764
|
-
/* @__PURE__ */ (0,
|
|
9830
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9765
9831
|
"span",
|
|
9766
9832
|
{
|
|
9767
|
-
className: (0, import_css45.cx)((0,
|
|
9833
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "list-item-text")), styles.listItemText),
|
|
9768
9834
|
children: value
|
|
9769
9835
|
}
|
|
9770
9836
|
),
|
|
9771
|
-
canRemove && /* @__PURE__ */ (0,
|
|
9837
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9772
9838
|
"button",
|
|
9773
9839
|
{
|
|
9774
9840
|
type: "button",
|
|
9775
9841
|
onClick: () => handleRemoveValue(index),
|
|
9776
9842
|
disabled,
|
|
9777
|
-
className: (0, import_css45.cx)((0,
|
|
9843
|
+
className: (0, import_css45.cx)((0, import_browser65.withVendorCSSClassPrefix)((0, import_browser65.bem)("multi-input", "remove-button")), styles.removeButton),
|
|
9778
9844
|
title: "Remove value",
|
|
9779
|
-
children: /* @__PURE__ */ (0,
|
|
9845
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BinIcon, { className: styles.icon })
|
|
9780
9846
|
}
|
|
9781
9847
|
)
|
|
9782
9848
|
]
|
|
@@ -9793,7 +9859,7 @@ var MultiInput_default = MultiInput;
|
|
|
9793
9859
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
9794
9860
|
var import_css46 = require("@emotion/css");
|
|
9795
9861
|
var import_react70 = require("react");
|
|
9796
|
-
var
|
|
9862
|
+
var import_browser66 = require("@asgardeo/browser");
|
|
9797
9863
|
var useStyles22 = (theme, colorScheme) => {
|
|
9798
9864
|
const valuePlaceholder = import_css46.css`
|
|
9799
9865
|
font-style: italic;
|
|
@@ -9904,7 +9970,7 @@ var useStyles22 = (theme, colorScheme) => {
|
|
|
9904
9970
|
max-width: 350px;
|
|
9905
9971
|
text-align: start;
|
|
9906
9972
|
|
|
9907
|
-
.${(0,
|
|
9973
|
+
.${(0, import_browser66.withVendorCSSClassPrefix)("form-control")} {
|
|
9908
9974
|
margin-bottom: 0;
|
|
9909
9975
|
}
|
|
9910
9976
|
|
|
@@ -9975,7 +10041,7 @@ var getDisplayName = (mergedMappings, user) => {
|
|
|
9975
10041
|
var getDisplayName_default = getDisplayName;
|
|
9976
10042
|
|
|
9977
10043
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
9978
|
-
var
|
|
10044
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
9979
10045
|
var fieldsToSkip = [
|
|
9980
10046
|
"roles.default",
|
|
9981
10047
|
"active",
|
|
@@ -10035,7 +10101,7 @@ var BaseUserProfile = ({
|
|
|
10035
10101
|
},
|
|
10036
10102
|
[showFields, hideFields]
|
|
10037
10103
|
);
|
|
10038
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
10104
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10039
10105
|
"svg",
|
|
10040
10106
|
{
|
|
10041
10107
|
width: "16",
|
|
@@ -10046,7 +10112,7 @@ var BaseUserProfile = ({
|
|
|
10046
10112
|
strokeWidth: "2",
|
|
10047
10113
|
strokeLinecap: "round",
|
|
10048
10114
|
strokeLinejoin: "round",
|
|
10049
|
-
children: /* @__PURE__ */ (0,
|
|
10115
|
+
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
10116
|
}
|
|
10051
10117
|
);
|
|
10052
10118
|
const toggleFieldEdit = (0, import_react71.useCallback)((fieldName) => {
|
|
@@ -10071,12 +10137,12 @@ var BaseUserProfile = ({
|
|
|
10071
10137
|
}, []);
|
|
10072
10138
|
const ObjectDisplay = ({ data }) => {
|
|
10073
10139
|
if (!data || typeof data !== "object") return null;
|
|
10074
|
-
return /* @__PURE__ */ (0,
|
|
10075
|
-
/* @__PURE__ */ (0,
|
|
10140
|
+
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: [
|
|
10141
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: styles.objectKey, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("strong", { children: [
|
|
10076
10142
|
formatLabel(key),
|
|
10077
10143
|
":"
|
|
10078
10144
|
] }) }),
|
|
10079
|
-
/* @__PURE__ */ (0,
|
|
10145
|
+
/* @__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
10146
|
] }, key)) }) });
|
|
10081
10147
|
};
|
|
10082
10148
|
function set(obj, path, value) {
|
|
@@ -10103,7 +10169,7 @@ var BaseUserProfile = ({
|
|
|
10103
10169
|
fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
10104
10170
|
}
|
|
10105
10171
|
let payload = {};
|
|
10106
|
-
if (schema.schemaId && schema.schemaId !==
|
|
10172
|
+
if (schema.schemaId && schema.schemaId !== import_browser67.WellKnownSchemaIds.User) {
|
|
10107
10173
|
payload = {
|
|
10108
10174
|
[schema.schemaId]: {
|
|
10109
10175
|
[fieldName]: fieldValue
|
|
@@ -10149,9 +10215,9 @@ var BaseUserProfile = ({
|
|
|
10149
10215
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
10150
10216
|
const label = displayName || description || name || "";
|
|
10151
10217
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
10152
|
-
return /* @__PURE__ */ (0,
|
|
10153
|
-
/* @__PURE__ */ (0,
|
|
10154
|
-
/* @__PURE__ */ (0,
|
|
10218
|
+
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: [
|
|
10219
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
10220
|
+
/* @__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
10221
|
] }, index)) });
|
|
10156
10222
|
}
|
|
10157
10223
|
if (Array.isArray(value) || multiValued) {
|
|
@@ -10167,9 +10233,9 @@ var BaseUserProfile = ({
|
|
|
10167
10233
|
} else {
|
|
10168
10234
|
fieldValues = [];
|
|
10169
10235
|
}
|
|
10170
|
-
return /* @__PURE__ */ (0,
|
|
10171
|
-
/* @__PURE__ */ (0,
|
|
10172
|
-
/* @__PURE__ */ (0,
|
|
10236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10237
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10238
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10173
10239
|
MultiInput_default,
|
|
10174
10240
|
{
|
|
10175
10241
|
values: fieldValues,
|
|
@@ -10200,9 +10266,9 @@ var BaseUserProfile = ({
|
|
|
10200
10266
|
} else {
|
|
10201
10267
|
displayValue2 = "-";
|
|
10202
10268
|
}
|
|
10203
|
-
return /* @__PURE__ */ (0,
|
|
10204
|
-
/* @__PURE__ */ (0,
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10270
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10271
|
+
/* @__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
10272
|
Button_default,
|
|
10207
10273
|
{
|
|
10208
10274
|
onClick: onStartEdit,
|
|
@@ -10217,7 +10283,7 @@ var BaseUserProfile = ({
|
|
|
10217
10283
|
] });
|
|
10218
10284
|
}
|
|
10219
10285
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
10220
|
-
return /* @__PURE__ */ (0,
|
|
10286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ObjectDisplay, { data: value });
|
|
10221
10287
|
}
|
|
10222
10288
|
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
10223
10289
|
const fieldValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value || "";
|
|
@@ -10232,16 +10298,16 @@ var BaseUserProfile = ({
|
|
|
10232
10298
|
let field;
|
|
10233
10299
|
switch (type) {
|
|
10234
10300
|
case "STRING":
|
|
10235
|
-
field = /* @__PURE__ */ (0,
|
|
10301
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TextField_default, { ...commonProps });
|
|
10236
10302
|
break;
|
|
10237
10303
|
case "DATE_TIME":
|
|
10238
|
-
field = /* @__PURE__ */ (0,
|
|
10304
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(DatePicker_default, { ...commonProps });
|
|
10239
10305
|
break;
|
|
10240
10306
|
case "BOOLEAN":
|
|
10241
|
-
field = /* @__PURE__ */ (0,
|
|
10307
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Checkbox_default, { ...commonProps, checked: !!fieldValue, onChange: (e) => onEditValue(e.target.checked) });
|
|
10242
10308
|
break;
|
|
10243
10309
|
case "COMPLEX":
|
|
10244
|
-
field = /* @__PURE__ */ (0,
|
|
10310
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10245
10311
|
"textarea",
|
|
10246
10312
|
{
|
|
10247
10313
|
value: fieldValue,
|
|
@@ -10253,11 +10319,11 @@ var BaseUserProfile = ({
|
|
|
10253
10319
|
);
|
|
10254
10320
|
break;
|
|
10255
10321
|
default:
|
|
10256
|
-
field = /* @__PURE__ */ (0,
|
|
10322
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TextField_default, { ...commonProps });
|
|
10257
10323
|
}
|
|
10258
|
-
return /* @__PURE__ */ (0,
|
|
10259
|
-
/* @__PURE__ */ (0,
|
|
10260
|
-
/* @__PURE__ */ (0,
|
|
10324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10325
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10326
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: field })
|
|
10261
10327
|
] });
|
|
10262
10328
|
}
|
|
10263
10329
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
@@ -10270,9 +10336,9 @@ var BaseUserProfile = ({
|
|
|
10270
10336
|
} else {
|
|
10271
10337
|
displayValue = "-";
|
|
10272
10338
|
}
|
|
10273
|
-
return /* @__PURE__ */ (0,
|
|
10274
|
-
/* @__PURE__ */ (0,
|
|
10275
|
-
/* @__PURE__ */ (0,
|
|
10339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10340
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: label }),
|
|
10341
|
+
/* @__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
10342
|
Button_default,
|
|
10277
10343
|
{
|
|
10278
10344
|
onClick: onStartEdit,
|
|
@@ -10300,8 +10366,8 @@ var BaseUserProfile = ({
|
|
|
10300
10366
|
alignItems: "center",
|
|
10301
10367
|
gap: theme.vars.spacing.unit
|
|
10302
10368
|
};
|
|
10303
|
-
return /* @__PURE__ */ (0,
|
|
10304
|
-
/* @__PURE__ */ (0,
|
|
10369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.field, children: [
|
|
10370
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.fieldInner, children: renderSchemaField(
|
|
10305
10371
|
schema,
|
|
10306
10372
|
isFieldEditing,
|
|
10307
10373
|
(value) => {
|
|
@@ -10311,12 +10377,12 @@ var BaseUserProfile = ({
|
|
|
10311
10377
|
},
|
|
10312
10378
|
() => toggleFieldEdit(schema.name)
|
|
10313
10379
|
) }),
|
|
10314
|
-
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0,
|
|
10315
|
-
isFieldEditing && /* @__PURE__ */ (0,
|
|
10316
|
-
/* @__PURE__ */ (0,
|
|
10317
|
-
/* @__PURE__ */ (0,
|
|
10380
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: styles.fieldActions, children: [
|
|
10381
|
+
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
10382
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
10383
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button_default, { size: "small", color: "secondary", variant: "solid", onClick: () => handleFieldCancel(schema.name), children: "Cancel" })
|
|
10318
10384
|
] }),
|
|
10319
|
-
!isFieldEditing && hasValue && /* @__PURE__ */ (0,
|
|
10385
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10320
10386
|
Button_default,
|
|
10321
10387
|
{
|
|
10322
10388
|
size: "small",
|
|
@@ -10325,7 +10391,7 @@ var BaseUserProfile = ({
|
|
|
10325
10391
|
onClick: () => toggleFieldEdit(schema.name),
|
|
10326
10392
|
title: "Edit",
|
|
10327
10393
|
className: styles.editButton,
|
|
10328
|
-
children: /* @__PURE__ */ (0,
|
|
10394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PencilIcon, {})
|
|
10329
10395
|
}
|
|
10330
10396
|
)
|
|
10331
10397
|
] })
|
|
@@ -10337,7 +10403,7 @@ var BaseUserProfile = ({
|
|
|
10337
10403
|
const containerClasses = (0, import_css47.cx)(
|
|
10338
10404
|
styles.root,
|
|
10339
10405
|
cardLayout ? styles.card : "",
|
|
10340
|
-
(0,
|
|
10406
|
+
(0, import_browser67.withVendorCSSClassPrefix)("user-profile"),
|
|
10341
10407
|
className
|
|
10342
10408
|
);
|
|
10343
10409
|
const currentUser = flattenedProfile || profile;
|
|
@@ -10349,17 +10415,17 @@ var BaseUserProfile = ({
|
|
|
10349
10415
|
if (!shouldShowField(key)) return false;
|
|
10350
10416
|
return value !== void 0 && value !== "" && value !== null;
|
|
10351
10417
|
}).sort(([a], [b]) => a.localeCompare(b));
|
|
10352
|
-
return /* @__PURE__ */ (0,
|
|
10353
|
-
/* @__PURE__ */ (0,
|
|
10354
|
-
/* @__PURE__ */ (0,
|
|
10418
|
+
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: [
|
|
10419
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: styles.label, children: formatLabel(key) }),
|
|
10420
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.value, children: typeof value === "object" ? JSON.stringify(value, null, 2) : String(value) })
|
|
10355
10421
|
] }, key)) });
|
|
10356
10422
|
};
|
|
10357
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
10358
|
-
error && /* @__PURE__ */ (0,
|
|
10359
|
-
/* @__PURE__ */ (0,
|
|
10360
|
-
/* @__PURE__ */ (0,
|
|
10423
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Card_default, { className: containerClasses, children: [
|
|
10424
|
+
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: [
|
|
10425
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Alert_default.Title, { children: t("errors.title") || "Error" }),
|
|
10426
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Alert_default.Description, { children: error })
|
|
10361
10427
|
] }),
|
|
10362
|
-
/* @__PURE__ */ (0,
|
|
10428
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
10363
10429
|
Avatar,
|
|
10364
10430
|
{
|
|
10365
10431
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -10369,7 +10435,7 @@ var BaseUserProfile = ({
|
|
|
10369
10435
|
isLoading
|
|
10370
10436
|
}
|
|
10371
10437
|
) }),
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10438
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.infoContainer, children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
10373
10439
|
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
10374
10440
|
if (!editable) {
|
|
10375
10441
|
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
@@ -10386,13 +10452,13 @@ var BaseUserProfile = ({
|
|
|
10386
10452
|
...schema,
|
|
10387
10453
|
value
|
|
10388
10454
|
};
|
|
10389
|
-
return /* @__PURE__ */ (0,
|
|
10455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.info, children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
10390
10456
|
}) : renderProfileWithoutSchemas() })
|
|
10391
10457
|
] });
|
|
10392
10458
|
if (mode === "popup") {
|
|
10393
|
-
return /* @__PURE__ */ (0,
|
|
10394
|
-
/* @__PURE__ */ (0,
|
|
10395
|
-
/* @__PURE__ */ (0,
|
|
10459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Dialog_default.Content, { children: [
|
|
10460
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Dialog_default.Heading, { children: title ?? t("user.profile.title") }),
|
|
10461
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: styles.popup, children: profileContent })
|
|
10396
10462
|
] }) });
|
|
10397
10463
|
}
|
|
10398
10464
|
return profileContent;
|
|
@@ -10403,8 +10469,8 @@ var BaseUserProfile_default = BaseUserProfile;
|
|
|
10403
10469
|
var import_react72 = require("react");
|
|
10404
10470
|
|
|
10405
10471
|
// src/api/updateMeProfile.ts
|
|
10406
|
-
var
|
|
10407
|
-
var httpClient5 =
|
|
10472
|
+
var import_browser68 = require("@asgardeo/browser");
|
|
10473
|
+
var httpClient5 = import_browser68.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser68.AsgardeoSPAClient.getInstance());
|
|
10408
10474
|
var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
10409
10475
|
const defaultFetcher = async (url, config) => {
|
|
10410
10476
|
const response = await httpClient5({
|
|
@@ -10421,7 +10487,7 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
10421
10487
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
10422
10488
|
};
|
|
10423
10489
|
};
|
|
10424
|
-
return (0,
|
|
10490
|
+
return (0, import_browser68.updateMeProfile)({
|
|
10425
10491
|
...requestConfig,
|
|
10426
10492
|
fetcher: fetcher || defaultFetcher
|
|
10427
10493
|
});
|
|
@@ -10429,8 +10495,8 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
10429
10495
|
var updateMeProfile_default = updateMeProfile;
|
|
10430
10496
|
|
|
10431
10497
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
10432
|
-
var
|
|
10433
|
-
var
|
|
10498
|
+
var import_browser69 = require("@asgardeo/browser");
|
|
10499
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
10434
10500
|
var UserProfile3 = ({ ...rest }) => {
|
|
10435
10501
|
const { baseUrl, isLoading } = useAsgardeo_default();
|
|
10436
10502
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
@@ -10443,13 +10509,13 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10443
10509
|
onUpdateProfile(response);
|
|
10444
10510
|
} catch (error2) {
|
|
10445
10511
|
let message = t("user.profile.update.generic.error");
|
|
10446
|
-
if (error2 instanceof
|
|
10512
|
+
if (error2 instanceof import_browser69.AsgardeoError) {
|
|
10447
10513
|
message = error2?.message;
|
|
10448
10514
|
}
|
|
10449
10515
|
setError(message);
|
|
10450
10516
|
}
|
|
10451
10517
|
};
|
|
10452
|
-
return /* @__PURE__ */ (0,
|
|
10518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
10453
10519
|
BaseUserProfile_default,
|
|
10454
10520
|
{
|
|
10455
10521
|
profile,
|
|
@@ -10464,7 +10530,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
10464
10530
|
var UserProfile_default = UserProfile3;
|
|
10465
10531
|
|
|
10466
10532
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10467
|
-
var
|
|
10533
|
+
var import_browser70 = require("@asgardeo/browser");
|
|
10468
10534
|
var import_react74 = require("@floating-ui/react");
|
|
10469
10535
|
var import_css49 = require("@emotion/css");
|
|
10470
10536
|
var import_react75 = require("react");
|
|
@@ -10654,7 +10720,7 @@ var useStyles23 = (theme, colorScheme) => {
|
|
|
10654
10720
|
var BaseUserDropdown_styles_default = useStyles23;
|
|
10655
10721
|
|
|
10656
10722
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
10657
|
-
var
|
|
10723
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
10658
10724
|
var BaseUserDropdown = ({
|
|
10659
10725
|
fallback = null,
|
|
10660
10726
|
className = "",
|
|
@@ -10708,14 +10774,14 @@ var BaseUserDropdown = ({
|
|
|
10708
10774
|
defaultMenuItems.push({
|
|
10709
10775
|
label: "Manage Profile",
|
|
10710
10776
|
onClick: onManageProfile,
|
|
10711
|
-
icon: /* @__PURE__ */ (0,
|
|
10777
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(User_default2, { width: "16", height: "16" })
|
|
10712
10778
|
});
|
|
10713
10779
|
}
|
|
10714
10780
|
if (onSignOut) {
|
|
10715
10781
|
defaultMenuItems.push({
|
|
10716
10782
|
label: "Sign Out",
|
|
10717
10783
|
onClick: onSignOut,
|
|
10718
|
-
icon: /* @__PURE__ */ (0,
|
|
10784
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LogOut_default, { width: "16", height: "16" })
|
|
10719
10785
|
});
|
|
10720
10786
|
}
|
|
10721
10787
|
const allMenuItems = [...menuItems];
|
|
@@ -10725,18 +10791,18 @@ var BaseUserDropdown = ({
|
|
|
10725
10791
|
}
|
|
10726
10792
|
allMenuItems.push(...defaultMenuItems);
|
|
10727
10793
|
}
|
|
10728
|
-
return /* @__PURE__ */ (0,
|
|
10729
|
-
/* @__PURE__ */ (0,
|
|
10794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
10795
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10730
10796
|
Button_default,
|
|
10731
10797
|
{
|
|
10732
10798
|
ref: refs.setReference,
|
|
10733
|
-
className: (0, import_css49.cx)((0,
|
|
10799
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__trigger"), styles.trigger),
|
|
10734
10800
|
color: "tertiary",
|
|
10735
10801
|
variant: "text",
|
|
10736
10802
|
size: "medium",
|
|
10737
10803
|
...getReferenceProps(),
|
|
10738
10804
|
children: [
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
10805
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10740
10806
|
Avatar,
|
|
10741
10807
|
{
|
|
10742
10808
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10745,22 +10811,22 @@ var BaseUserDropdown = ({
|
|
|
10745
10811
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10746
10812
|
}
|
|
10747
10813
|
),
|
|
10748
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
10814
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10749
10815
|
Typography_default,
|
|
10750
10816
|
{
|
|
10751
10817
|
variant: "body2",
|
|
10752
|
-
className: (0, import_css49.cx)((0,
|
|
10818
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__trigger-label"), styles.userName),
|
|
10753
10819
|
children: getDisplayName_default(mergedMappings, user)
|
|
10754
10820
|
}
|
|
10755
10821
|
)
|
|
10756
10822
|
]
|
|
10757
10823
|
}
|
|
10758
10824
|
),
|
|
10759
|
-
isOpen && /* @__PURE__ */ (0,
|
|
10825
|
+
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
10826
|
"div",
|
|
10761
10827
|
{
|
|
10762
10828
|
ref: refs.setFloating,
|
|
10763
|
-
className: (0, import_css49.cx)((0,
|
|
10829
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__content"), styles.dropdownContent),
|
|
10764
10830
|
style: {
|
|
10765
10831
|
...floatingStyles,
|
|
10766
10832
|
// 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 +10835,8 @@ var BaseUserDropdown = ({
|
|
|
10769
10835
|
},
|
|
10770
10836
|
...getFloatingProps(),
|
|
10771
10837
|
children: [
|
|
10772
|
-
/* @__PURE__ */ (0,
|
|
10773
|
-
/* @__PURE__ */ (0,
|
|
10838
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header"), styles.dropdownHeader), children: [
|
|
10839
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10774
10840
|
Avatar,
|
|
10775
10841
|
{
|
|
10776
10842
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -10779,22 +10845,22 @@ var BaseUserDropdown = ({
|
|
|
10779
10845
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
10780
10846
|
}
|
|
10781
10847
|
),
|
|
10782
|
-
/* @__PURE__ */ (0,
|
|
10783
|
-
/* @__PURE__ */ (0,
|
|
10848
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-info"), styles.headerInfo), children: [
|
|
10849
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10784
10850
|
Typography_default,
|
|
10785
10851
|
{
|
|
10786
10852
|
noWrap: true,
|
|
10787
|
-
className: (0,
|
|
10853
|
+
className: (0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-name"),
|
|
10788
10854
|
variant: "body1",
|
|
10789
10855
|
fontWeight: "medium",
|
|
10790
10856
|
children: getDisplayName_default(mergedMappings, user)
|
|
10791
10857
|
}
|
|
10792
10858
|
),
|
|
10793
|
-
/* @__PURE__ */ (0,
|
|
10859
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10794
10860
|
Typography_default,
|
|
10795
10861
|
{
|
|
10796
10862
|
noWrap: true,
|
|
10797
|
-
className: (0,
|
|
10863
|
+
className: (0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__header-email"),
|
|
10798
10864
|
variant: "caption",
|
|
10799
10865
|
color: "secondary",
|
|
10800
10866
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -10802,31 +10868,31 @@ var BaseUserDropdown = ({
|
|
|
10802
10868
|
)
|
|
10803
10869
|
] })
|
|
10804
10870
|
] }),
|
|
10805
|
-
/* @__PURE__ */ (0,
|
|
10871
|
+
/* @__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
10872
|
"a",
|
|
10807
10873
|
{
|
|
10808
10874
|
href: item.href,
|
|
10809
10875
|
style: {
|
|
10810
10876
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
10811
10877
|
},
|
|
10812
|
-
className: (0, import_css49.cx)((0,
|
|
10878
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu-item"), styles.menuItemAnchor),
|
|
10813
10879
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
10814
10880
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
10815
10881
|
onFocus: () => setHoveredItemIndex(index),
|
|
10816
10882
|
onBlur: () => setHoveredItemIndex(null),
|
|
10817
10883
|
children: [
|
|
10818
10884
|
item.icon,
|
|
10819
|
-
/* @__PURE__ */ (0,
|
|
10885
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: item.label })
|
|
10820
10886
|
]
|
|
10821
10887
|
}
|
|
10822
|
-
) : /* @__PURE__ */ (0,
|
|
10888
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10823
10889
|
Button_default,
|
|
10824
10890
|
{
|
|
10825
10891
|
onClick: () => handleMenuItemClick(item),
|
|
10826
10892
|
style: {
|
|
10827
10893
|
backgroundColor: hoveredItemIndex === index ? theme.vars.colors.action?.hover : "transparent"
|
|
10828
10894
|
},
|
|
10829
|
-
className: (0, import_css49.cx)((0,
|
|
10895
|
+
className: (0, import_css49.cx)((0, import_browser70.withVendorCSSClassPrefix)("user-dropdown__menu-item"), styles.menuItem),
|
|
10830
10896
|
color: "tertiary",
|
|
10831
10897
|
variant: "text",
|
|
10832
10898
|
size: "small",
|
|
@@ -10845,7 +10911,7 @@ var BaseUserDropdown_default = BaseUserDropdown;
|
|
|
10845
10911
|
|
|
10846
10912
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
10847
10913
|
var import_react76 = require("react");
|
|
10848
|
-
var
|
|
10914
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
10849
10915
|
var UserDropdown = ({
|
|
10850
10916
|
children,
|
|
10851
10917
|
renderTrigger,
|
|
@@ -10874,14 +10940,14 @@ var UserDropdown = ({
|
|
|
10874
10940
|
closeProfile
|
|
10875
10941
|
};
|
|
10876
10942
|
if (children) {
|
|
10877
|
-
return /* @__PURE__ */ (0,
|
|
10943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10878
10944
|
children(renderProps),
|
|
10879
|
-
/* @__PURE__ */ (0,
|
|
10945
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10880
10946
|
] });
|
|
10881
10947
|
}
|
|
10882
10948
|
if (renderTrigger || renderDropdown) {
|
|
10883
|
-
return /* @__PURE__ */ (0,
|
|
10884
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0,
|
|
10949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10950
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
10885
10951
|
BaseUserDropdown_default,
|
|
10886
10952
|
{
|
|
10887
10953
|
user,
|
|
@@ -10891,11 +10957,11 @@ var UserDropdown = ({
|
|
|
10891
10957
|
...rest
|
|
10892
10958
|
}
|
|
10893
10959
|
),
|
|
10894
|
-
/* @__PURE__ */ (0,
|
|
10960
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10895
10961
|
] });
|
|
10896
10962
|
}
|
|
10897
|
-
return /* @__PURE__ */ (0,
|
|
10898
|
-
/* @__PURE__ */ (0,
|
|
10963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
10964
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
10899
10965
|
BaseUserDropdown_default,
|
|
10900
10966
|
{
|
|
10901
10967
|
user,
|
|
@@ -10905,7 +10971,7 @@ var UserDropdown = ({
|
|
|
10905
10971
|
...rest
|
|
10906
10972
|
}
|
|
10907
10973
|
),
|
|
10908
|
-
isProfileOpen && /* @__PURE__ */ (0,
|
|
10974
|
+
isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
10909
10975
|
] });
|
|
10910
10976
|
};
|
|
10911
10977
|
var UserDropdown_default = UserDropdown;
|
|
@@ -10916,9 +10982,9 @@ var import_css51 = require("@emotion/css");
|
|
|
10916
10982
|
var import_react79 = require("react");
|
|
10917
10983
|
|
|
10918
10984
|
// src/components/primitives/Icons/Building.tsx
|
|
10919
|
-
var
|
|
10920
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
10921
|
-
/* @__PURE__ */ (0,
|
|
10985
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
10986
|
+
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: [
|
|
10987
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
10922
10988
|
"path",
|
|
10923
10989
|
{
|
|
10924
10990
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -10928,25 +10994,25 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
10928
10994
|
strokeLinejoin: "round"
|
|
10929
10995
|
}
|
|
10930
10996
|
),
|
|
10931
|
-
/* @__PURE__ */ (0,
|
|
10932
|
-
/* @__PURE__ */ (0,
|
|
10933
|
-
/* @__PURE__ */ (0,
|
|
10934
|
-
/* @__PURE__ */ (0,
|
|
10935
|
-
/* @__PURE__ */ (0,
|
|
10936
|
-
/* @__PURE__ */ (0,
|
|
10997
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10998
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10999
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11000
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11001
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11002
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
10937
11003
|
] });
|
|
10938
11004
|
Building.displayName = "Building";
|
|
10939
11005
|
var Building_default = Building;
|
|
10940
11006
|
|
|
10941
11007
|
// src/components/primitives/Icons/Check.tsx
|
|
10942
|
-
var
|
|
10943
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
11008
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11009
|
+
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
11010
|
Check.displayName = "Check";
|
|
10945
11011
|
var Check_default = Check;
|
|
10946
11012
|
|
|
10947
11013
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
10948
|
-
var
|
|
10949
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
11014
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
11015
|
+
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
11016
|
ChevronDown.displayName = "ChevronDown";
|
|
10951
11017
|
var ChevronDown_default = ChevronDown;
|
|
10952
11018
|
|
|
@@ -11176,7 +11242,7 @@ var useStyles24 = (theme, colorScheme) => {
|
|
|
11176
11242
|
var BaseOrganizationSwitcher_styles_default = useStyles24;
|
|
11177
11243
|
|
|
11178
11244
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
11179
|
-
var
|
|
11245
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
11180
11246
|
var BaseOrganizationSwitcher = ({
|
|
11181
11247
|
organizations,
|
|
11182
11248
|
currentOrganization,
|
|
@@ -11230,8 +11296,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11230
11296
|
const switchableOrganizations = organizations.filter(
|
|
11231
11297
|
(org) => org.id !== currentOrganization?.id
|
|
11232
11298
|
);
|
|
11233
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0,
|
|
11234
|
-
/* @__PURE__ */ (0,
|
|
11299
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11300
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11235
11301
|
Avatar,
|
|
11236
11302
|
{
|
|
11237
11303
|
variant: "square",
|
|
@@ -11241,24 +11307,24 @@ var BaseOrganizationSwitcher = ({
|
|
|
11241
11307
|
alt: `${organization.name} avatar`
|
|
11242
11308
|
}
|
|
11243
11309
|
),
|
|
11244
|
-
/* @__PURE__ */ (0,
|
|
11245
|
-
/* @__PURE__ */ (0,
|
|
11246
|
-
/* @__PURE__ */ (0,
|
|
11247
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11310
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.organizationInfo), children: [
|
|
11311
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "body2", fontWeight: "medium", className: (0, import_css51.cx)(styles.organizationName), children: organization.name }),
|
|
11312
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.organizationMeta), children: [
|
|
11313
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
|
|
11248
11314
|
organization.memberCount,
|
|
11249
11315
|
" ",
|
|
11250
11316
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
11251
11317
|
] }),
|
|
11252
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11253
|
-
showRole && organization.role && /* @__PURE__ */ (0,
|
|
11318
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: " \u2022 " }),
|
|
11319
|
+
showRole && organization.role && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: (0, import_css51.cx)(styles.roleCapitalized), children: organization.role })
|
|
11254
11320
|
] })
|
|
11255
11321
|
] }),
|
|
11256
|
-
isSelected && /* @__PURE__ */ (0,
|
|
11322
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Check_default, { width: "16", height: "16", color: theme.vars.colors.text.primary })
|
|
11257
11323
|
] });
|
|
11258
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */ (0,
|
|
11259
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0,
|
|
11260
|
-
return /* @__PURE__ */ (0,
|
|
11261
|
-
/* @__PURE__ */ (0,
|
|
11324
|
+
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") }) });
|
|
11325
|
+
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 }) });
|
|
11326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.root, className), style, children: [
|
|
11327
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11262
11328
|
Button_default,
|
|
11263
11329
|
{
|
|
11264
11330
|
ref: refs.setReference,
|
|
@@ -11268,8 +11334,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11268
11334
|
size: "medium",
|
|
11269
11335
|
...getReferenceProps(),
|
|
11270
11336
|
children: [
|
|
11271
|
-
currentOrganization ? /* @__PURE__ */ (0,
|
|
11272
|
-
/* @__PURE__ */ (0,
|
|
11337
|
+
currentOrganization ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11338
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11273
11339
|
Avatar,
|
|
11274
11340
|
{
|
|
11275
11341
|
variant: "square",
|
|
@@ -11279,18 +11345,18 @@ var BaseOrganizationSwitcher = ({
|
|
|
11279
11345
|
alt: `${currentOrganization.name} avatar`
|
|
11280
11346
|
}
|
|
11281
11347
|
),
|
|
11282
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
11283
|
-
] }) : /* @__PURE__ */ (0,
|
|
11284
|
-
/* @__PURE__ */ (0,
|
|
11285
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
11348
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { variant: "body2", className: (0, import_css51.cx)(styles.triggerLabel), children: currentOrganization.name })
|
|
11349
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11350
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Building_default, { width: avatarSize, height: avatarSize }),
|
|
11351
|
+
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
11352
|
] }),
|
|
11287
|
-
/* @__PURE__ */ (0,
|
|
11353
|
+
/* @__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
11354
|
]
|
|
11289
11355
|
}
|
|
11290
11356
|
),
|
|
11291
|
-
isOpen && /* @__PURE__ */ (0,
|
|
11292
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
11293
|
-
/* @__PURE__ */ (0,
|
|
11357
|
+
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: [
|
|
11358
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.header), children: [
|
|
11359
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11294
11360
|
Avatar,
|
|
11295
11361
|
{
|
|
11296
11362
|
variant: "square",
|
|
@@ -11300,10 +11366,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11300
11366
|
alt: `${currentOrganization.name} avatar`
|
|
11301
11367
|
}
|
|
11302
11368
|
),
|
|
11303
|
-
/* @__PURE__ */ (0,
|
|
11304
|
-
/* @__PURE__ */ (0,
|
|
11305
|
-
/* @__PURE__ */ (0,
|
|
11306
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
11369
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.headerInfo), children: [
|
|
11370
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default, { noWrap: true, className: (0, import_css51.cx)(styles.headerName), variant: "body1", fontWeight: "medium", children: currentOrganization.name }),
|
|
11371
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_css51.cx)(styles.headerMeta), children: [
|
|
11372
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11307
11373
|
Typography_default,
|
|
11308
11374
|
{
|
|
11309
11375
|
noWrap: true,
|
|
@@ -11313,17 +11379,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
11313
11379
|
currentOrganization.memberCount,
|
|
11314
11380
|
" ",
|
|
11315
11381
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
11316
|
-
showRole && currentOrganization.role && /* @__PURE__ */ (0,
|
|
11382
|
+
showRole && currentOrganization.role && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
|
|
11317
11383
|
" \u2022 ",
|
|
11318
11384
|
currentOrganization.role
|
|
11319
11385
|
] })
|
|
11320
11386
|
]
|
|
11321
11387
|
}
|
|
11322
11388
|
),
|
|
11323
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0,
|
|
11389
|
+
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
11390
|
] })
|
|
11325
11391
|
] }),
|
|
11326
|
-
onManageProfile && /* @__PURE__ */ (0,
|
|
11392
|
+
onManageProfile && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11327
11393
|
Button_default,
|
|
11328
11394
|
{
|
|
11329
11395
|
onClick: onManageProfile,
|
|
@@ -11332,7 +11398,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
11332
11398
|
size: "small",
|
|
11333
11399
|
"aria-label": "Manage Organization Profile",
|
|
11334
11400
|
className: (0, import_css51.cx)(styles.manageButton),
|
|
11335
|
-
endIcon: /* @__PURE__ */ (0,
|
|
11401
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11336
11402
|
"svg",
|
|
11337
11403
|
{
|
|
11338
11404
|
width: "16",
|
|
@@ -11344,8 +11410,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
11344
11410
|
strokeLinecap: "round",
|
|
11345
11411
|
strokeLinejoin: "round",
|
|
11346
11412
|
children: [
|
|
11347
|
-
/* @__PURE__ */ (0,
|
|
11348
|
-
/* @__PURE__ */ (0,
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
11414
|
+
/* @__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
11415
|
]
|
|
11350
11416
|
}
|
|
11351
11417
|
),
|
|
@@ -11353,20 +11419,20 @@ var BaseOrganizationSwitcher = ({
|
|
|
11353
11419
|
}
|
|
11354
11420
|
)
|
|
11355
11421
|
] }),
|
|
11356
|
-
organizations.length > 1 && /* @__PURE__ */ (0,
|
|
11422
|
+
organizations.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11357
11423
|
"div",
|
|
11358
11424
|
{
|
|
11359
11425
|
className: (0, import_css51.cx)(styles.header, styles.sectionHeaderContainer),
|
|
11360
11426
|
style: {
|
|
11361
11427
|
borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : "none"
|
|
11362
11428
|
},
|
|
11363
|
-
children: /* @__PURE__ */ (0,
|
|
11429
|
+
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
11430
|
}
|
|
11365
11431
|
),
|
|
11366
|
-
/* @__PURE__ */ (0,
|
|
11432
|
+
/* @__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
11433
|
switchableOrganizations.map((organization) => {
|
|
11368
11434
|
const isSelected = false;
|
|
11369
|
-
return /* @__PURE__ */ (0,
|
|
11435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11370
11436
|
Button_default,
|
|
11371
11437
|
{
|
|
11372
11438
|
onClick: () => handleOrganizationSwitch(organization),
|
|
@@ -11384,10 +11450,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11384
11450
|
organization.id
|
|
11385
11451
|
);
|
|
11386
11452
|
}),
|
|
11387
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
11388
|
-
/* @__PURE__ */ (0,
|
|
11453
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
11454
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: (0, import_css51.cx)(styles.menuDivider) }),
|
|
11389
11455
|
menuItems.map(
|
|
11390
|
-
(item, index) => /* @__PURE__ */ (0,
|
|
11456
|
+
(item, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
11391
11457
|
"a",
|
|
11392
11458
|
{
|
|
11393
11459
|
href: item.href,
|
|
@@ -11401,10 +11467,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
11401
11467
|
onBlur: () => setHoveredItemIndex(null),
|
|
11402
11468
|
children: [
|
|
11403
11469
|
item.icon,
|
|
11404
|
-
/* @__PURE__ */ (0,
|
|
11470
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: item.label })
|
|
11405
11471
|
]
|
|
11406
11472
|
}
|
|
11407
|
-
) : /* @__PURE__ */ (0,
|
|
11473
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
11408
11474
|
Button_default,
|
|
11409
11475
|
{
|
|
11410
11476
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -11578,7 +11644,7 @@ var useStyles25 = (theme, colorScheme) => {
|
|
|
11578
11644
|
var BaseCreateOrganization_styles_default = useStyles25;
|
|
11579
11645
|
|
|
11580
11646
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
11581
|
-
var
|
|
11647
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
11582
11648
|
var BaseCreateOrganization = ({
|
|
11583
11649
|
cardLayout = true,
|
|
11584
11650
|
className = "",
|
|
@@ -11665,13 +11731,13 @@ var BaseCreateOrganization = ({
|
|
|
11665
11731
|
console.error("Form submission error:", submitError);
|
|
11666
11732
|
}
|
|
11667
11733
|
};
|
|
11668
|
-
const createOrganizationContent = /* @__PURE__ */ (0,
|
|
11669
|
-
/* @__PURE__ */ (0,
|
|
11670
|
-
error && /* @__PURE__ */ (0,
|
|
11671
|
-
/* @__PURE__ */ (0,
|
|
11672
|
-
/* @__PURE__ */ (0,
|
|
11734
|
+
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: [
|
|
11735
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("form", { id: "create-organization-form", className: (0, import_css53.cx)(styles.form), onSubmit: handleSubmit, children: [
|
|
11736
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Alert_default, { variant: "error", className: styles.errorAlert, children: [
|
|
11737
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Title, { children: "Error" }),
|
|
11738
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Alert_default.Description, { children: error })
|
|
11673
11739
|
] }),
|
|
11674
|
-
/* @__PURE__ */ (0,
|
|
11740
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.fieldGroup), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11675
11741
|
TextField_default,
|
|
11676
11742
|
{
|
|
11677
11743
|
label: `${t("organization.create.name.label")}`,
|
|
@@ -11684,7 +11750,7 @@ var BaseCreateOrganization = ({
|
|
|
11684
11750
|
className: (0, import_css53.cx)(styles.input)
|
|
11685
11751
|
}
|
|
11686
11752
|
) }),
|
|
11687
|
-
/* @__PURE__ */ (0,
|
|
11753
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: (0, import_css53.cx)(styles.fieldGroup), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11688
11754
|
TextField_default,
|
|
11689
11755
|
{
|
|
11690
11756
|
label: `${t("organization.create.handle.label") || "Organization Handle"}`,
|
|
@@ -11698,9 +11764,9 @@ var BaseCreateOrganization = ({
|
|
|
11698
11764
|
className: (0, import_css53.cx)(styles.input)
|
|
11699
11765
|
}
|
|
11700
11766
|
) }),
|
|
11701
|
-
/* @__PURE__ */ (0,
|
|
11702
|
-
/* @__PURE__ */ (0,
|
|
11703
|
-
/* @__PURE__ */ (0,
|
|
11767
|
+
/* @__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: [
|
|
11768
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InputLabel_default, { required: true, children: t("organization.create.description.label") }),
|
|
11769
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
11704
11770
|
"textarea",
|
|
11705
11771
|
{
|
|
11706
11772
|
className: (0, import_css53.cx)(styles.textarea, formErrors.description && styles.textareaError),
|
|
@@ -11714,23 +11780,23 @@ var BaseCreateOrganization = ({
|
|
|
11714
11780
|
] }) }),
|
|
11715
11781
|
renderAdditionalFields && renderAdditionalFields()
|
|
11716
11782
|
] }),
|
|
11717
|
-
/* @__PURE__ */ (0,
|
|
11718
|
-
onCancel && /* @__PURE__ */ (0,
|
|
11719
|
-
/* @__PURE__ */ (0,
|
|
11783
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: (0, import_css53.cx)(styles.actions), children: [
|
|
11784
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.cancel") }),
|
|
11785
|
+
/* @__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
11786
|
] })
|
|
11721
11787
|
] }) });
|
|
11722
11788
|
if (mode === "popup") {
|
|
11723
|
-
return /* @__PURE__ */ (0,
|
|
11724
|
-
/* @__PURE__ */ (0,
|
|
11725
|
-
/* @__PURE__ */ (0,
|
|
11789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Dialog_default.Content, { children: [
|
|
11790
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Dialog_default.Heading, { children: title }),
|
|
11791
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: styles.popup, children: createOrganizationContent })
|
|
11726
11792
|
] }) });
|
|
11727
11793
|
}
|
|
11728
11794
|
return createOrganizationContent;
|
|
11729
11795
|
};
|
|
11730
11796
|
|
|
11731
11797
|
// src/api/createOrganization.ts
|
|
11732
|
-
var
|
|
11733
|
-
var httpClient6 =
|
|
11798
|
+
var import_browser71 = require("@asgardeo/browser");
|
|
11799
|
+
var httpClient6 = import_browser71.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser71.AsgardeoSPAClient.getInstance());
|
|
11734
11800
|
var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
11735
11801
|
const defaultFetcher = async (url, config) => {
|
|
11736
11802
|
const response = await httpClient6({
|
|
@@ -11747,7 +11813,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
11747
11813
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
11748
11814
|
};
|
|
11749
11815
|
};
|
|
11750
|
-
return (0,
|
|
11816
|
+
return (0, import_browser71.createOrganization)({
|
|
11751
11817
|
...requestConfig,
|
|
11752
11818
|
fetcher: fetcher || defaultFetcher
|
|
11753
11819
|
});
|
|
@@ -11755,7 +11821,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
11755
11821
|
var createOrganization_default = createOrganization;
|
|
11756
11822
|
|
|
11757
11823
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
11758
|
-
var
|
|
11824
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
11759
11825
|
var CreateOrganization = ({
|
|
11760
11826
|
onCreateOrganization,
|
|
11761
11827
|
fallback = null,
|
|
@@ -11771,7 +11837,7 @@ var CreateOrganization = ({
|
|
|
11771
11837
|
return fallback;
|
|
11772
11838
|
}
|
|
11773
11839
|
if (!isSignedIn) {
|
|
11774
|
-
return /* @__PURE__ */ (0,
|
|
11840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, {});
|
|
11775
11841
|
}
|
|
11776
11842
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
11777
11843
|
const handleSubmit = async (payload) => {
|
|
@@ -11805,7 +11871,7 @@ var CreateOrganization = ({
|
|
|
11805
11871
|
setLoading(false);
|
|
11806
11872
|
}
|
|
11807
11873
|
};
|
|
11808
|
-
return /* @__PURE__ */ (0,
|
|
11874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
11809
11875
|
BaseCreateOrganization,
|
|
11810
11876
|
{
|
|
11811
11877
|
onSubmit: handleSubmit,
|
|
@@ -11822,12 +11888,12 @@ var CreateOrganization = ({
|
|
|
11822
11888
|
var import_react87 = require("react");
|
|
11823
11889
|
|
|
11824
11890
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
11825
|
-
var
|
|
11891
|
+
var import_browser73 = require("@asgardeo/browser");
|
|
11826
11892
|
var import_css57 = require("@emotion/css");
|
|
11827
11893
|
var import_react86 = require("react");
|
|
11828
11894
|
|
|
11829
11895
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
11830
|
-
var
|
|
11896
|
+
var import_browser72 = require("@asgardeo/browser");
|
|
11831
11897
|
var import_css55 = require("@emotion/css");
|
|
11832
11898
|
var import_react84 = require("react");
|
|
11833
11899
|
|
|
@@ -11987,7 +12053,7 @@ var useStyles26 = (theme, colorScheme, disabled, readOnly, hasError) => {
|
|
|
11987
12053
|
var KeyValueInput_styles_default = useStyles26;
|
|
11988
12054
|
|
|
11989
12055
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
11990
|
-
var
|
|
12056
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
11991
12057
|
var KeyValueInput = ({
|
|
11992
12058
|
className = "",
|
|
11993
12059
|
disabled = false,
|
|
@@ -12062,105 +12128,105 @@ var KeyValueInput = ({
|
|
|
12062
12128
|
);
|
|
12063
12129
|
const canAddMore = !maxPairs || pairs.length < maxPairs;
|
|
12064
12130
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
12065
|
-
return /* @__PURE__ */ (0,
|
|
12066
|
-
label && /* @__PURE__ */ (0,
|
|
12131
|
+
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: [
|
|
12132
|
+
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
12133
|
label,
|
|
12068
|
-
required && /* @__PURE__ */ (0,
|
|
12134
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12069
12135
|
"span",
|
|
12070
12136
|
{
|
|
12071
|
-
className: (0, import_css55.cx)((0,
|
|
12137
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "required")), styles.requiredIndicator),
|
|
12072
12138
|
children: " *"
|
|
12073
12139
|
}
|
|
12074
12140
|
)
|
|
12075
12141
|
] }),
|
|
12076
|
-
/* @__PURE__ */ (0,
|
|
12077
|
-
pairs.length === 0 && readOnly ? /* @__PURE__ */ (0,
|
|
12142
|
+
/* @__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: [
|
|
12143
|
+
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
12144
|
"div",
|
|
12079
12145
|
{
|
|
12080
|
-
className: (0, import_css55.cx)((0,
|
|
12146
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-pair")), styles.readOnlyPair),
|
|
12081
12147
|
children: [
|
|
12082
|
-
/* @__PURE__ */ (0,
|
|
12148
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12083
12149
|
"span",
|
|
12084
12150
|
{
|
|
12085
|
-
className: (0, import_css55.cx)((0,
|
|
12151
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-key")), styles.readOnlyKey),
|
|
12086
12152
|
children: [
|
|
12087
12153
|
pair.key,
|
|
12088
12154
|
":"
|
|
12089
12155
|
]
|
|
12090
12156
|
}
|
|
12091
12157
|
),
|
|
12092
|
-
/* @__PURE__ */ (0,
|
|
12158
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12093
12159
|
"span",
|
|
12094
12160
|
{
|
|
12095
|
-
className: (0, import_css55.cx)((0,
|
|
12161
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "readonly-value")), styles.readOnlyValue),
|
|
12096
12162
|
children: pair.value
|
|
12097
12163
|
}
|
|
12098
12164
|
)
|
|
12099
12165
|
]
|
|
12100
12166
|
},
|
|
12101
12167
|
`${pair.key}-${index}`
|
|
12102
|
-
)) : pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
12168
|
+
)) : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12103
12169
|
"div",
|
|
12104
12170
|
{
|
|
12105
|
-
className: (0, import_css55.cx)((0,
|
|
12171
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-row")), styles.pairRow),
|
|
12106
12172
|
children: [
|
|
12107
|
-
/* @__PURE__ */ (0,
|
|
12173
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12108
12174
|
TextField_default,
|
|
12109
12175
|
{
|
|
12110
12176
|
placeholder: keyPlaceholder,
|
|
12111
12177
|
value: pair.key,
|
|
12112
12178
|
onChange: (e) => handleUpdatePair(index, "key", e.target.value),
|
|
12113
12179
|
disabled: disabled || readOnly,
|
|
12114
|
-
className: (0, import_css55.cx)((0,
|
|
12180
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12115
12181
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
12116
12182
|
}
|
|
12117
12183
|
),
|
|
12118
|
-
/* @__PURE__ */ (0,
|
|
12184
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12119
12185
|
TextField_default,
|
|
12120
12186
|
{
|
|
12121
12187
|
placeholder: valuePlaceholder,
|
|
12122
12188
|
value: pair.value,
|
|
12123
12189
|
onChange: (e) => handleUpdatePair(index, "value", e.target.value),
|
|
12124
12190
|
disabled: disabled || readOnly,
|
|
12125
|
-
className: (0, import_css55.cx)((0,
|
|
12191
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12126
12192
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
12127
12193
|
}
|
|
12128
12194
|
),
|
|
12129
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
12195
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12130
12196
|
"button",
|
|
12131
12197
|
{
|
|
12132
12198
|
type: "button",
|
|
12133
12199
|
onClick: () => handleRemovePair(index),
|
|
12134
12200
|
disabled,
|
|
12135
|
-
className: (0, import_css55.cx)((0,
|
|
12201
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "remove-button")), styles.removeButton),
|
|
12136
12202
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
12137
|
-
children: /* @__PURE__ */ (0,
|
|
12203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(X_default, { width: 16, height: 16 })
|
|
12138
12204
|
}
|
|
12139
12205
|
)
|
|
12140
12206
|
]
|
|
12141
12207
|
},
|
|
12142
12208
|
`${pair.key}-${index}`
|
|
12143
12209
|
)),
|
|
12144
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
12145
|
-
/* @__PURE__ */ (0,
|
|
12210
|
+
!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: [
|
|
12211
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12146
12212
|
TextField_default,
|
|
12147
12213
|
{
|
|
12148
12214
|
placeholder: keyPlaceholder,
|
|
12149
12215
|
value: newKey,
|
|
12150
12216
|
onChange: (e) => setNewKey(e.target.value),
|
|
12151
12217
|
disabled,
|
|
12152
|
-
className: (0, import_css55.cx)((0,
|
|
12218
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12153
12219
|
"aria-label": "New key"
|
|
12154
12220
|
}
|
|
12155
12221
|
),
|
|
12156
|
-
/* @__PURE__ */ (0,
|
|
12222
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12157
12223
|
TextField_default,
|
|
12158
12224
|
{
|
|
12159
12225
|
placeholder: valuePlaceholder,
|
|
12160
12226
|
value: newValue,
|
|
12161
12227
|
onChange: (e) => setNewValue(e.target.value),
|
|
12162
12228
|
disabled,
|
|
12163
|
-
className: (0, import_css55.cx)((0,
|
|
12229
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "pair-input")), styles.pairInput),
|
|
12164
12230
|
"aria-label": "New value",
|
|
12165
12231
|
onKeyPress: (e) => {
|
|
12166
12232
|
if (e.key === "Enter" && !isAddDisabled) {
|
|
@@ -12169,21 +12235,21 @@ var KeyValueInput = ({
|
|
|
12169
12235
|
}
|
|
12170
12236
|
}
|
|
12171
12237
|
),
|
|
12172
|
-
/* @__PURE__ */ (0,
|
|
12238
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
12173
12239
|
"button",
|
|
12174
12240
|
{
|
|
12175
12241
|
type: "button",
|
|
12176
12242
|
onClick: handleAddPair,
|
|
12177
12243
|
disabled: isAddDisabled,
|
|
12178
|
-
className: (0, import_css55.cx)((0,
|
|
12244
|
+
className: (0, import_css55.cx)((0, import_browser72.withVendorCSSClassPrefix)((0, import_browser72.bem)("key-value-input", "add-button")), styles.addButton),
|
|
12179
12245
|
"aria-label": "Add new key-value pair",
|
|
12180
|
-
children: /* @__PURE__ */ (0,
|
|
12246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Plus_default, { width: 16, height: 16 })
|
|
12181
12247
|
}
|
|
12182
12248
|
)
|
|
12183
12249
|
] })
|
|
12184
12250
|
] }),
|
|
12185
|
-
(helperText || error) && /* @__PURE__ */ (0,
|
|
12186
|
-
maxPairs && /* @__PURE__ */ (0,
|
|
12251
|
+
(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 }),
|
|
12252
|
+
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
12253
|
pairs.length,
|
|
12188
12254
|
" of ",
|
|
12189
12255
|
maxPairs,
|
|
@@ -12350,7 +12416,7 @@ var useStyles27 = (theme, colorScheme) => {
|
|
|
12350
12416
|
var BaseOrganizationProfile_styles_default = useStyles27;
|
|
12351
12417
|
|
|
12352
12418
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
12353
|
-
var
|
|
12419
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12354
12420
|
var BaseOrganizationProfile = ({
|
|
12355
12421
|
fallback = null,
|
|
12356
12422
|
className = "",
|
|
@@ -12387,13 +12453,13 @@ var BaseOrganizationProfile = ({
|
|
|
12387
12453
|
key: "created",
|
|
12388
12454
|
label: "Created Date",
|
|
12389
12455
|
editable: false,
|
|
12390
|
-
render: (value) => (0,
|
|
12456
|
+
render: (value) => (0, import_browser73.formatDate)(value)
|
|
12391
12457
|
},
|
|
12392
12458
|
{
|
|
12393
12459
|
key: "lastModified",
|
|
12394
12460
|
label: "Last Modified Date",
|
|
12395
12461
|
editable: false,
|
|
12396
|
-
render: (value) => (0,
|
|
12462
|
+
render: (value) => (0, import_browser73.formatDate)(value)
|
|
12397
12463
|
}
|
|
12398
12464
|
]
|
|
12399
12465
|
}) => {
|
|
@@ -12401,7 +12467,7 @@ var BaseOrganizationProfile = ({
|
|
|
12401
12467
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
12402
12468
|
const [editedOrganization, setEditedOrganization] = (0, import_react86.useState)(organization);
|
|
12403
12469
|
const [editingFields, setEditingFields] = (0, import_react86.useState)({});
|
|
12404
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
12470
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12405
12471
|
"svg",
|
|
12406
12472
|
{
|
|
12407
12473
|
width: "16",
|
|
@@ -12412,7 +12478,7 @@ var BaseOrganizationProfile = ({
|
|
|
12412
12478
|
strokeWidth: "2",
|
|
12413
12479
|
strokeLinecap: "round",
|
|
12414
12480
|
strokeLinejoin: "round",
|
|
12415
|
-
children: /* @__PURE__ */ (0,
|
|
12481
|
+
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
12482
|
}
|
|
12417
12483
|
);
|
|
12418
12484
|
const toggleFieldEdit = (0, import_react86.useCallback)((fieldName) => {
|
|
@@ -12475,7 +12541,7 @@ var BaseOrganizationProfile = ({
|
|
|
12475
12541
|
let fieldInput;
|
|
12476
12542
|
if (key === "attributes") {
|
|
12477
12543
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
12478
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
12544
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12479
12545
|
KeyValueInput_default,
|
|
12480
12546
|
{
|
|
12481
12547
|
value: attributesValue,
|
|
@@ -12513,26 +12579,26 @@ var BaseOrganizationProfile = ({
|
|
|
12513
12579
|
}
|
|
12514
12580
|
);
|
|
12515
12581
|
} else {
|
|
12516
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
12582
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TextField_default, { ...commonProps });
|
|
12517
12583
|
}
|
|
12518
|
-
return /* @__PURE__ */ (0,
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
12584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
12585
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: (0, import_css57.cx)(styles.label), children: label }),
|
|
12586
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.value), children: fieldInput })
|
|
12521
12587
|
] });
|
|
12522
12588
|
}
|
|
12523
12589
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
12524
12590
|
const isFieldEditable = editable && fieldEditable;
|
|
12525
12591
|
let displayValue;
|
|
12526
12592
|
if (hasValue) {
|
|
12527
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0,
|
|
12593
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
12528
12594
|
} else if (isFieldEditable) {
|
|
12529
12595
|
displayValue = getFieldPlaceholder(key);
|
|
12530
12596
|
} else {
|
|
12531
12597
|
displayValue = "-";
|
|
12532
12598
|
}
|
|
12533
|
-
return /* @__PURE__ */ (0,
|
|
12534
|
-
/* @__PURE__ */ (0,
|
|
12535
|
-
/* @__PURE__ */ (0,
|
|
12599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
12600
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: (0, import_css57.cx)(styles.label), children: label }),
|
|
12601
|
+
/* @__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
12602
|
Button_default,
|
|
12537
12603
|
{
|
|
12538
12604
|
onClick: onStartEdit,
|
|
@@ -12555,8 +12621,8 @@ var BaseOrganizationProfile = ({
|
|
|
12555
12621
|
if (!shouldShow) {
|
|
12556
12622
|
return null;
|
|
12557
12623
|
}
|
|
12558
|
-
return /* @__PURE__ */ (0,
|
|
12559
|
-
/* @__PURE__ */ (0,
|
|
12624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.field), children: [
|
|
12625
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.fieldContent), children: renderField(
|
|
12560
12626
|
field,
|
|
12561
12627
|
isFieldEditing,
|
|
12562
12628
|
(value) => {
|
|
@@ -12566,8 +12632,8 @@ var BaseOrganizationProfile = ({
|
|
|
12566
12632
|
},
|
|
12567
12633
|
() => toggleFieldEdit(field.key)
|
|
12568
12634
|
) }),
|
|
12569
|
-
isFieldEditable && /* @__PURE__ */ (0,
|
|
12570
|
-
/* @__PURE__ */ (0,
|
|
12635
|
+
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: [
|
|
12636
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12571
12637
|
Button_default,
|
|
12572
12638
|
{
|
|
12573
12639
|
onClick: () => handleFieldSave(field.key),
|
|
@@ -12578,7 +12644,7 @@ var BaseOrganizationProfile = ({
|
|
|
12578
12644
|
children: saveButtonText
|
|
12579
12645
|
}
|
|
12580
12646
|
),
|
|
12581
|
-
/* @__PURE__ */ (0,
|
|
12647
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12582
12648
|
Button_default,
|
|
12583
12649
|
{
|
|
12584
12650
|
onClick: () => handleFieldCancel(field.key),
|
|
@@ -12589,7 +12655,7 @@ var BaseOrganizationProfile = ({
|
|
|
12589
12655
|
children: cancelButtonText
|
|
12590
12656
|
}
|
|
12591
12657
|
)
|
|
12592
|
-
] }) : hasValue && /* @__PURE__ */ (0,
|
|
12658
|
+
] }) : hasValue && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12593
12659
|
Button_default,
|
|
12594
12660
|
{
|
|
12595
12661
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -12598,7 +12664,7 @@ var BaseOrganizationProfile = ({
|
|
|
12598
12664
|
size: "small",
|
|
12599
12665
|
title: "Edit field",
|
|
12600
12666
|
className: (0, import_css57.cx)(styles.editButton),
|
|
12601
|
-
children: /* @__PURE__ */ (0,
|
|
12667
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PencilIcon, {})
|
|
12602
12668
|
}
|
|
12603
12669
|
) })
|
|
12604
12670
|
] }, field.key);
|
|
@@ -12606,23 +12672,23 @@ var BaseOrganizationProfile = ({
|
|
|
12606
12672
|
if (!organization) {
|
|
12607
12673
|
return fallback;
|
|
12608
12674
|
}
|
|
12609
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
12610
|
-
/* @__PURE__ */ (0,
|
|
12611
|
-
/* @__PURE__ */ (0,
|
|
12612
|
-
/* @__PURE__ */ (0,
|
|
12613
|
-
/* @__PURE__ */ (0,
|
|
12614
|
-
organization.orgHandle && /* @__PURE__ */ (0,
|
|
12675
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Card_default, { className: (0, import_css57.cx)(styles.root, cardLayout && styles.card, className), children: [
|
|
12676
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.header), children: [
|
|
12677
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
12678
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_css57.cx)(styles.orgInfo), children: [
|
|
12679
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h2", { className: (0, import_css57.cx)(styles.name), children: organization.name }),
|
|
12680
|
+
organization.orgHandle && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("p", { className: (0, import_css57.cx)(styles.handle), children: [
|
|
12615
12681
|
"@",
|
|
12616
12682
|
organization.orgHandle
|
|
12617
12683
|
] })
|
|
12618
12684
|
] })
|
|
12619
12685
|
] }),
|
|
12620
|
-
/* @__PURE__ */ (0,
|
|
12686
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.infoContainer), children: fields.map((field, index) => renderOrganizationField(field)) })
|
|
12621
12687
|
] });
|
|
12622
12688
|
if (mode === "popup") {
|
|
12623
|
-
return /* @__PURE__ */ (0,
|
|
12624
|
-
/* @__PURE__ */ (0,
|
|
12625
|
-
/* @__PURE__ */ (0,
|
|
12689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Dialog_default.Content, { children: [
|
|
12690
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Dialog_default.Heading, { children: title }),
|
|
12691
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css57.cx)(styles.popup), children: profileContent })
|
|
12626
12692
|
] }) });
|
|
12627
12693
|
}
|
|
12628
12694
|
return profileContent;
|
|
@@ -12630,8 +12696,8 @@ var BaseOrganizationProfile = ({
|
|
|
12630
12696
|
var BaseOrganizationProfile_default = BaseOrganizationProfile;
|
|
12631
12697
|
|
|
12632
12698
|
// src/api/getOrganization.ts
|
|
12633
|
-
var
|
|
12634
|
-
var httpClient7 =
|
|
12699
|
+
var import_browser74 = require("@asgardeo/browser");
|
|
12700
|
+
var httpClient7 = import_browser74.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser74.AsgardeoSPAClient.getInstance());
|
|
12635
12701
|
var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
12636
12702
|
const defaultFetcher = async (url, config) => {
|
|
12637
12703
|
const response = await httpClient7({
|
|
@@ -12647,7 +12713,7 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
12647
12713
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
12648
12714
|
};
|
|
12649
12715
|
};
|
|
12650
|
-
return (0,
|
|
12716
|
+
return (0, import_browser74.getOrganization)({
|
|
12651
12717
|
...requestConfig,
|
|
12652
12718
|
fetcher: fetcher || defaultFetcher
|
|
12653
12719
|
});
|
|
@@ -12655,8 +12721,8 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
12655
12721
|
var getOrganization_default = getOrganization;
|
|
12656
12722
|
|
|
12657
12723
|
// src/api/updateOrganization.ts
|
|
12658
|
-
var
|
|
12659
|
-
var httpClient8 =
|
|
12724
|
+
var import_browser75 = require("@asgardeo/browser");
|
|
12725
|
+
var httpClient8 = import_browser75.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser75.AsgardeoSPAClient.getInstance());
|
|
12660
12726
|
var updateOrganization = async ({
|
|
12661
12727
|
fetcher,
|
|
12662
12728
|
...requestConfig
|
|
@@ -12676,7 +12742,7 @@ var updateOrganization = async ({
|
|
|
12676
12742
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
12677
12743
|
};
|
|
12678
12744
|
};
|
|
12679
|
-
return (0,
|
|
12745
|
+
return (0, import_browser75.updateOrganization)({
|
|
12680
12746
|
...requestConfig,
|
|
12681
12747
|
fetcher: fetcher || defaultFetcher
|
|
12682
12748
|
});
|
|
@@ -12684,7 +12750,7 @@ var updateOrganization = async ({
|
|
|
12684
12750
|
var updateOrganization_default = updateOrganization;
|
|
12685
12751
|
|
|
12686
12752
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
12687
|
-
var
|
|
12753
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12688
12754
|
var OrganizationProfile = ({
|
|
12689
12755
|
organizationId,
|
|
12690
12756
|
mode = "default",
|
|
@@ -12692,8 +12758,8 @@ var OrganizationProfile = ({
|
|
|
12692
12758
|
onOpenChange,
|
|
12693
12759
|
onUpdate,
|
|
12694
12760
|
popupTitle,
|
|
12695
|
-
loadingFallback = /* @__PURE__ */ (0,
|
|
12696
|
-
errorFallback = /* @__PURE__ */ (0,
|
|
12761
|
+
loadingFallback = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: "Loading organization..." }),
|
|
12762
|
+
errorFallback = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: "Failed to load organization data" }),
|
|
12697
12763
|
...rest
|
|
12698
12764
|
}) => {
|
|
12699
12765
|
const { baseUrl } = useAsgardeo_default();
|
|
@@ -12729,7 +12795,7 @@ var OrganizationProfile = ({
|
|
|
12729
12795
|
const handleOrganizationUpdate = async (payload) => {
|
|
12730
12796
|
if (!baseUrl || !organizationId) return;
|
|
12731
12797
|
try {
|
|
12732
|
-
const operations = (0,
|
|
12798
|
+
const operations = (0, import_browser75.createPatchOperations)(payload);
|
|
12733
12799
|
await updateOrganization_default({
|
|
12734
12800
|
baseUrl,
|
|
12735
12801
|
organizationId,
|
|
@@ -12744,7 +12810,7 @@ var OrganizationProfile = ({
|
|
|
12744
12810
|
throw err;
|
|
12745
12811
|
}
|
|
12746
12812
|
};
|
|
12747
|
-
return /* @__PURE__ */ (0,
|
|
12813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12748
12814
|
BaseOrganizationProfile_default,
|
|
12749
12815
|
{
|
|
12750
12816
|
organization,
|
|
@@ -12994,21 +13060,21 @@ var useStyles28 = (theme, colorScheme) => {
|
|
|
12994
13060
|
var BaseOrganizationList_styles_default = useStyles28;
|
|
12995
13061
|
|
|
12996
13062
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
12997
|
-
var
|
|
13063
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12998
13064
|
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,
|
|
13065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationItem), children: [
|
|
13066
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationContent), children: [
|
|
13067
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Avatar_default, { variant: "square", name: organization.name, size: 48, alt: `${organization.name} logo` }),
|
|
13068
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.organizationInfo), children: [
|
|
13069
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Typography_default, { variant: "h6", className: (0, import_css59.cx)(styles.organizationName), children: organization.name }),
|
|
13070
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css59.cx)(styles.organizationHandle), children: [
|
|
13005
13071
|
"@",
|
|
13006
13072
|
organization.orgHandle
|
|
13007
13073
|
] }),
|
|
13008
|
-
showStatus && /* @__PURE__ */ (0,
|
|
13074
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css59.cx)(styles.organizationStatus), children: [
|
|
13009
13075
|
t("organization.switcher.status.label"),
|
|
13010
13076
|
" ",
|
|
13011
|
-
/* @__PURE__ */ (0,
|
|
13077
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13012
13078
|
"span",
|
|
13013
13079
|
{
|
|
13014
13080
|
className: (0, import_css59.cx)(
|
|
@@ -13021,7 +13087,7 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13021
13087
|
] })
|
|
13022
13088
|
] })
|
|
13023
13089
|
] }),
|
|
13024
|
-
organization.canSwitch && /* @__PURE__ */ (0,
|
|
13090
|
+
organization.canSwitch && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.organizationActions), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13025
13091
|
Button_default,
|
|
13026
13092
|
{
|
|
13027
13093
|
onClick: (e) => {
|
|
@@ -13035,17 +13101,17 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
13035
13101
|
) })
|
|
13036
13102
|
] }, organization.id);
|
|
13037
13103
|
};
|
|
13038
|
-
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0,
|
|
13039
|
-
/* @__PURE__ */ (0,
|
|
13040
|
-
/* @__PURE__ */ (0,
|
|
13104
|
+
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.loadingContainer), children: [
|
|
13105
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Spinner_default, { size: "medium" }),
|
|
13106
|
+
/* @__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
13107
|
] });
|
|
13042
|
-
var defaultRenderError = (error, t, styles) => /* @__PURE__ */ (0,
|
|
13043
|
-
/* @__PURE__ */ (0,
|
|
13108
|
+
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: [
|
|
13109
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("strong", { children: t("organization.switcher.error.prefix") }),
|
|
13044
13110
|
" ",
|
|
13045
13111
|
error
|
|
13046
13112
|
] }) });
|
|
13047
|
-
var defaultRenderLoadMore = (onLoadMore, isLoading, t, styles) => /* @__PURE__ */ (0,
|
|
13048
|
-
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0,
|
|
13113
|
+
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") });
|
|
13114
|
+
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
13115
|
var BaseOrganizationList = ({
|
|
13050
13116
|
className = "",
|
|
13051
13117
|
allOrganizations,
|
|
@@ -13088,53 +13154,53 @@ var BaseOrganizationList = ({
|
|
|
13088
13154
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, isLoading2) => defaultRenderLoadMore(onLoadMore, isLoading2, t, styles));
|
|
13089
13155
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));
|
|
13090
13156
|
if (isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13091
|
-
const loadingContent = /* @__PURE__ */ (0,
|
|
13157
|
+
const loadingContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderLoadingWithStyles() });
|
|
13092
13158
|
if (mode === "popup") {
|
|
13093
|
-
return /* @__PURE__ */ (0,
|
|
13094
|
-
/* @__PURE__ */ (0,
|
|
13095
|
-
/* @__PURE__ */ (0,
|
|
13159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13160
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13161
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: loadingContent })
|
|
13096
13162
|
] }) });
|
|
13097
13163
|
}
|
|
13098
13164
|
return loadingContent;
|
|
13099
13165
|
}
|
|
13100
13166
|
if (error && organizationsWithSwitchAccess?.length === 0) {
|
|
13101
|
-
const errorContent = /* @__PURE__ */ (0,
|
|
13167
|
+
const errorContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderErrorWithStyles(error) });
|
|
13102
13168
|
if (mode === "popup") {
|
|
13103
|
-
return /* @__PURE__ */ (0,
|
|
13104
|
-
/* @__PURE__ */ (0,
|
|
13105
|
-
/* @__PURE__ */ (0,
|
|
13169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13170
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13171
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: errorContent })
|
|
13106
13172
|
] }) });
|
|
13107
13173
|
}
|
|
13108
13174
|
return errorContent;
|
|
13109
13175
|
}
|
|
13110
13176
|
if (!isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
13111
|
-
const emptyContent = /* @__PURE__ */ (0,
|
|
13177
|
+
const emptyContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: renderEmptyWithStyles() });
|
|
13112
13178
|
if (mode === "popup") {
|
|
13113
|
-
return /* @__PURE__ */ (0,
|
|
13114
|
-
/* @__PURE__ */ (0,
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
13179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13180
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13181
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: emptyContent })
|
|
13116
13182
|
] }) });
|
|
13117
13183
|
}
|
|
13118
13184
|
return emptyContent;
|
|
13119
13185
|
}
|
|
13120
|
-
const organizationListContent = /* @__PURE__ */ (0,
|
|
13121
|
-
/* @__PURE__ */ (0,
|
|
13122
|
-
/* @__PURE__ */ (0,
|
|
13186
|
+
const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.root, className), style, children: [
|
|
13187
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_css59.cx)(styles.header), children: [
|
|
13188
|
+
/* @__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
13189
|
showing: organizationsWithSwitchAccess?.length,
|
|
13124
13190
|
total: allOrganizations?.organizations?.length || 0
|
|
13125
13191
|
}) }) }),
|
|
13126
|
-
onRefresh && /* @__PURE__ */ (0,
|
|
13192
|
+
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
13193
|
] }),
|
|
13128
|
-
/* @__PURE__ */ (0,
|
|
13194
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.listContainer), children: organizationsWithSwitchAccess?.map(
|
|
13129
13195
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
13130
13196
|
) }),
|
|
13131
|
-
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0,
|
|
13132
|
-
hasMore && fetchMore && /* @__PURE__ */ (0,
|
|
13197
|
+
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.errorMargin), children: renderErrorWithStyles(error) }),
|
|
13198
|
+
hasMore && fetchMore && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.loadMoreMargin), children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
13133
13199
|
] });
|
|
13134
13200
|
if (mode === "popup") {
|
|
13135
|
-
return /* @__PURE__ */ (0,
|
|
13136
|
-
/* @__PURE__ */ (0,
|
|
13137
|
-
/* @__PURE__ */ (0,
|
|
13201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Dialog_default.Content, { children: [
|
|
13202
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Dialog_default.Heading, { children: title }),
|
|
13203
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: (0, import_css59.cx)(styles.popupContent), children: organizationListContent })
|
|
13138
13204
|
] }) });
|
|
13139
13205
|
}
|
|
13140
13206
|
return organizationListContent;
|
|
@@ -13205,7 +13271,7 @@ var useStyles29 = (theme, colorScheme) => {
|
|
|
13205
13271
|
var OrganizationList_styles_default = useStyles29;
|
|
13206
13272
|
|
|
13207
13273
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
13208
|
-
var
|
|
13274
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
13209
13275
|
var OrganizationList = ({
|
|
13210
13276
|
autoFetch = true,
|
|
13211
13277
|
filter = "",
|
|
@@ -13227,7 +13293,7 @@ var OrganizationList = ({
|
|
|
13227
13293
|
setAllOrganizations(await getAllOrganizations2());
|
|
13228
13294
|
})();
|
|
13229
13295
|
}, []);
|
|
13230
|
-
return /* @__PURE__ */ (0,
|
|
13296
|
+
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
13297
|
BaseOrganizationList_default,
|
|
13232
13298
|
{
|
|
13233
13299
|
allOrganizations,
|
|
@@ -13242,8 +13308,8 @@ var OrganizationList = ({
|
|
|
13242
13308
|
var OrganizationList_default = OrganizationList;
|
|
13243
13309
|
|
|
13244
13310
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
13245
|
-
var
|
|
13246
|
-
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
13311
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13312
|
+
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
13247
13313
|
"svg",
|
|
13248
13314
|
{
|
|
13249
13315
|
width,
|
|
@@ -13256,13 +13322,13 @@ var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @_
|
|
|
13256
13322
|
strokeLinecap: "round",
|
|
13257
13323
|
strokeLinejoin: "round",
|
|
13258
13324
|
children: [
|
|
13259
|
-
/* @__PURE__ */ (0,
|
|
13260
|
-
/* @__PURE__ */ (0,
|
|
13261
|
-
/* @__PURE__ */ (0,
|
|
13262
|
-
/* @__PURE__ */ (0,
|
|
13263
|
-
/* @__PURE__ */ (0,
|
|
13264
|
-
/* @__PURE__ */ (0,
|
|
13265
|
-
/* @__PURE__ */ (0,
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
13326
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
13327
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
13328
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 6h4" }),
|
|
13329
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 10h4" }),
|
|
13330
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 14h4" }),
|
|
13331
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M10 18h4" })
|
|
13266
13332
|
]
|
|
13267
13333
|
}
|
|
13268
13334
|
);
|
|
@@ -13270,7 +13336,7 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
13270
13336
|
var BuildingAlt_default = BuildingAlt;
|
|
13271
13337
|
|
|
13272
13338
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
13273
|
-
var
|
|
13339
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13274
13340
|
var OrganizationSwitcher = ({
|
|
13275
13341
|
currentOrganization: propCurrentOrganization,
|
|
13276
13342
|
fallback = null,
|
|
@@ -13294,7 +13360,7 @@ var OrganizationSwitcher = ({
|
|
|
13294
13360
|
return fallback;
|
|
13295
13361
|
}
|
|
13296
13362
|
if (!isSignedIn) {
|
|
13297
|
-
return /* @__PURE__ */ (0,
|
|
13363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, {});
|
|
13298
13364
|
}
|
|
13299
13365
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
13300
13366
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -13308,19 +13374,19 @@ var OrganizationSwitcher = ({
|
|
|
13308
13374
|
const defaultMenuItems = [];
|
|
13309
13375
|
if (currentOrganization) {
|
|
13310
13376
|
defaultMenuItems.push({
|
|
13311
|
-
icon: /* @__PURE__ */ (0,
|
|
13377
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(BuildingAlt_default, {}),
|
|
13312
13378
|
label: t("organization.switcher.manage.organizations"),
|
|
13313
13379
|
onClick: handleManageOrganizations
|
|
13314
13380
|
});
|
|
13315
13381
|
}
|
|
13316
13382
|
defaultMenuItems.push({
|
|
13317
|
-
icon: /* @__PURE__ */ (0,
|
|
13383
|
+
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
13384
|
label: t("organization.switcher.create.organization"),
|
|
13319
13385
|
onClick: () => setIsCreateOrgOpen(true)
|
|
13320
13386
|
});
|
|
13321
13387
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
13322
|
-
return /* @__PURE__ */ (0,
|
|
13323
|
-
/* @__PURE__ */ (0,
|
|
13388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
13389
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13324
13390
|
BaseOrganizationSwitcher_default,
|
|
13325
13391
|
{
|
|
13326
13392
|
organizations,
|
|
@@ -13333,7 +13399,7 @@ var OrganizationSwitcher = ({
|
|
|
13333
13399
|
...props
|
|
13334
13400
|
}
|
|
13335
13401
|
),
|
|
13336
|
-
/* @__PURE__ */ (0,
|
|
13402
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13337
13403
|
CreateOrganization,
|
|
13338
13404
|
{
|
|
13339
13405
|
mode: "popup",
|
|
@@ -13347,7 +13413,7 @@ var OrganizationSwitcher = ({
|
|
|
13347
13413
|
}
|
|
13348
13414
|
}
|
|
13349
13415
|
),
|
|
13350
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
13416
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13351
13417
|
OrganizationProfile_default,
|
|
13352
13418
|
{
|
|
13353
13419
|
organizationId: currentOrganization.id,
|
|
@@ -13355,11 +13421,11 @@ var OrganizationSwitcher = ({
|
|
|
13355
13421
|
open: isProfileOpen,
|
|
13356
13422
|
onOpenChange: setIsProfileOpen,
|
|
13357
13423
|
cardLayout: true,
|
|
13358
|
-
loadingFallback: /* @__PURE__ */ (0,
|
|
13359
|
-
errorFallback: /* @__PURE__ */ (0,
|
|
13424
|
+
loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { children: t("organization.profile.loading") }),
|
|
13425
|
+
errorFallback: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { children: t("organization.profile.error") })
|
|
13360
13426
|
}
|
|
13361
13427
|
),
|
|
13362
|
-
/* @__PURE__ */ (0,
|
|
13428
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13363
13429
|
OrganizationList_default,
|
|
13364
13430
|
{
|
|
13365
13431
|
mode: "popup",
|
|
@@ -13379,5 +13445,5 @@ var OrganizationSwitcher = ({
|
|
|
13379
13445
|
var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
13380
13446
|
|
|
13381
13447
|
// src/index.ts
|
|
13382
|
-
var
|
|
13448
|
+
var import_browser76 = require("@asgardeo/browser");
|
|
13383
13449
|
//# sourceMappingURL=index.js.map
|