@asgardeo/react 0.25.7 → 0.25.8
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 +384 -314
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/adapters/FormContainer.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.d.ts +7 -2
- package/dist/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/v1/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/v1/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/v1/SignUpOptionFactory.d.ts +7 -2
- package/dist/components/presentation/auth/SignUp/v1/SignUpOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts.map +1 -1
- package/dist/index.js +115 -46
- package/dist/index.js.map +4 -4
- package/dist/utils/resolveFlowErrorMessage.d.ts +35 -0
- package/dist/utils/resolveFlowErrorMessage.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -6247,6 +6247,40 @@ var createSignInOptionFromAuthenticator = (authenticator, formValues, touchedFie
|
|
|
6247
6247
|
...options
|
|
6248
6248
|
});
|
|
6249
6249
|
|
|
6250
|
+
// src/utils/resolveFlowErrorMessage.ts
|
|
6251
|
+
var resolveFlowErrorMessage = (error, fallback) => {
|
|
6252
|
+
let raw = "";
|
|
6253
|
+
if (error instanceof Error) {
|
|
6254
|
+
raw = error.message;
|
|
6255
|
+
} else if (typeof error === "string") {
|
|
6256
|
+
raw = error;
|
|
6257
|
+
} else if (error && typeof error === "object") {
|
|
6258
|
+
const { description, message } = error;
|
|
6259
|
+
raw = typeof description === "string" && description || typeof message === "string" && message || "";
|
|
6260
|
+
}
|
|
6261
|
+
if (!raw) {
|
|
6262
|
+
return fallback;
|
|
6263
|
+
}
|
|
6264
|
+
const jsonStart = raw.indexOf("{");
|
|
6265
|
+
const jsonEnd = raw.lastIndexOf("}");
|
|
6266
|
+
if (jsonStart !== -1 && jsonEnd > jsonStart) {
|
|
6267
|
+
try {
|
|
6268
|
+
const payload = JSON.parse(raw.slice(jsonStart, jsonEnd + 1));
|
|
6269
|
+
const extracted = payload?.description || payload?.message;
|
|
6270
|
+
if (typeof extracted === "string" && extracted) {
|
|
6271
|
+
return extracted;
|
|
6272
|
+
}
|
|
6273
|
+
} catch {
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
const messagePart = raw.match(/Message:\s*([\s\S]+)$/);
|
|
6277
|
+
if (messagePart?.[1]?.trim()) {
|
|
6278
|
+
return messagePart[1].trim();
|
|
6279
|
+
}
|
|
6280
|
+
return raw;
|
|
6281
|
+
};
|
|
6282
|
+
var resolveFlowErrorMessage_default = resolveFlowErrorMessage;
|
|
6283
|
+
|
|
6250
6284
|
// src/components/primitives/Alert/Alert.tsx
|
|
6251
6285
|
var import_browser44 = require("@asgardeo/browser");
|
|
6252
6286
|
var import_css27 = require("@emotion/css");
|
|
@@ -7359,7 +7393,7 @@ var BaseSignInContent = ({
|
|
|
7359
7393
|
}
|
|
7360
7394
|
}
|
|
7361
7395
|
} catch (err) {
|
|
7362
|
-
const errorMessage = err
|
|
7396
|
+
const errorMessage = resolveFlowErrorMessage_default(err, t("errors.signin.flow.failure"));
|
|
7363
7397
|
setError(errorMessage);
|
|
7364
7398
|
onError?.(err);
|
|
7365
7399
|
} finally {
|
|
@@ -7568,7 +7602,7 @@ var BaseSignInContent = ({
|
|
|
7568
7602
|
}
|
|
7569
7603
|
}
|
|
7570
7604
|
} catch (err) {
|
|
7571
|
-
const errorMessage = err
|
|
7605
|
+
const errorMessage = resolveFlowErrorMessage_default(err, "Authenticator selection failed");
|
|
7572
7606
|
setError(errorMessage);
|
|
7573
7607
|
onError?.(err);
|
|
7574
7608
|
} finally {
|
|
@@ -7654,7 +7688,7 @@ var BaseSignInContent = ({
|
|
|
7654
7688
|
);
|
|
7655
7689
|
}
|
|
7656
7690
|
} catch (err) {
|
|
7657
|
-
const errorMessage = err
|
|
7691
|
+
const errorMessage = resolveFlowErrorMessage_default(err, t("errors.signin.initialization"));
|
|
7658
7692
|
setError(errorMessage);
|
|
7659
7693
|
onError?.(err);
|
|
7660
7694
|
} finally {
|
|
@@ -10490,10 +10524,11 @@ var import_browser70 = require("@asgardeo/browser");
|
|
|
10490
10524
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
10491
10525
|
var import_browser68 = require("@asgardeo/browser");
|
|
10492
10526
|
var import_css46 = require("@emotion/css");
|
|
10493
|
-
var
|
|
10527
|
+
var import_react76 = require("react");
|
|
10494
10528
|
|
|
10495
10529
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
10496
10530
|
var import_browser67 = require("@asgardeo/browser");
|
|
10531
|
+
var import_react74 = require("react");
|
|
10497
10532
|
|
|
10498
10533
|
// src/components/adapters/CheckboxInput.tsx
|
|
10499
10534
|
var import_browser60 = require("@asgardeo/browser");
|
|
@@ -10613,9 +10648,10 @@ var FormContainer = (props) => {
|
|
|
10613
10648
|
}
|
|
10614
10649
|
};
|
|
10615
10650
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("form", { onSubmit: handleFormSubmit, style: { display: "flex", flexDirection: "column" }, children: component.components.map(
|
|
10616
|
-
(childComponent) => createSignUpComponent({
|
|
10651
|
+
(childComponent, index) => createSignUpComponent({
|
|
10617
10652
|
...props,
|
|
10618
|
-
component: childComponent
|
|
10653
|
+
component: childComponent,
|
|
10654
|
+
key: childComponent.id || index
|
|
10619
10655
|
})
|
|
10620
10656
|
) }, component.id);
|
|
10621
10657
|
}
|
|
@@ -10914,7 +10950,7 @@ var Typography_default2 = TypographyComponent;
|
|
|
10914
10950
|
|
|
10915
10951
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
10916
10952
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
10917
|
-
var
|
|
10953
|
+
var createSignUpElement = ({ component, onSubmit, ...rest }) => {
|
|
10918
10954
|
switch (component.type) {
|
|
10919
10955
|
case import_browser67.EmbeddedFlowComponentType.Typography:
|
|
10920
10956
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
@@ -10978,6 +11014,10 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
10978
11014
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", {});
|
|
10979
11015
|
}
|
|
10980
11016
|
};
|
|
11017
|
+
var createSignUpComponent = ({ key, ...props }) => {
|
|
11018
|
+
const element = createSignUpElement(props);
|
|
11019
|
+
return key === void 0 || key === null ? element : (0, import_react74.cloneElement)(element, { key });
|
|
11020
|
+
};
|
|
10981
11021
|
var createSignUpOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createSignUpComponent({
|
|
10982
11022
|
component,
|
|
10983
11023
|
formErrors,
|
|
@@ -11007,8 +11047,8 @@ var renderSignUpComponents2 = (components, formValues, touchedFields, formErrors
|
|
|
11007
11047
|
|
|
11008
11048
|
// src/components/presentation/auth/SignUp/BaseSignUp.styles.ts
|
|
11009
11049
|
var import_css45 = require("@emotion/css");
|
|
11010
|
-
var
|
|
11011
|
-
var useStyles21 = (theme, colorScheme) => (0,
|
|
11050
|
+
var import_react75 = require("react");
|
|
11051
|
+
var useStyles21 = (theme, colorScheme) => (0, import_react75.useMemo)(() => {
|
|
11012
11052
|
const signUp = import_css45.css`
|
|
11013
11053
|
min-width: 420px;
|
|
11014
11054
|
margin: 0 auto;
|
|
@@ -11149,6 +11189,13 @@ var logger8 = (0, import_browser68.createPackageComponentLogger)(
|
|
|
11149
11189
|
"@asgardeo/react",
|
|
11150
11190
|
"BaseSignUp"
|
|
11151
11191
|
);
|
|
11192
|
+
var resolveAlertVariant = (type) => {
|
|
11193
|
+
const normalized = type?.toLowerCase() ?? "";
|
|
11194
|
+
if (normalized === "success" || normalized === "error" || normalized === "warning") {
|
|
11195
|
+
return normalized;
|
|
11196
|
+
}
|
|
11197
|
+
return "info";
|
|
11198
|
+
};
|
|
11152
11199
|
var BaseSignUpContent = ({
|
|
11153
11200
|
afterSignUpUrl,
|
|
11154
11201
|
onInitialize,
|
|
@@ -11173,31 +11220,9 @@ var BaseSignUpContent = ({
|
|
|
11173
11220
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
11174
11221
|
useAsgardeo_default();
|
|
11175
11222
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
11176
|
-
const handleError = (0,
|
|
11223
|
+
const handleError = (0, import_react76.useCallback)(
|
|
11177
11224
|
(error) => {
|
|
11178
|
-
|
|
11179
|
-
if (error && typeof error === "object") {
|
|
11180
|
-
if (error.code && (error.message || error.description)) {
|
|
11181
|
-
errorMessage = error.description || error.message;
|
|
11182
|
-
} else if (error instanceof Error && error.name === "AsgardeoAPIError") {
|
|
11183
|
-
try {
|
|
11184
|
-
const errorResponse = JSON.parse(error.message);
|
|
11185
|
-
if (errorResponse.description) {
|
|
11186
|
-
errorMessage = errorResponse.description;
|
|
11187
|
-
} else if (errorResponse.message) {
|
|
11188
|
-
errorMessage = errorResponse.message;
|
|
11189
|
-
} else {
|
|
11190
|
-
errorMessage = error.message;
|
|
11191
|
-
}
|
|
11192
|
-
} catch {
|
|
11193
|
-
errorMessage = error.message;
|
|
11194
|
-
}
|
|
11195
|
-
} else if (error.message) {
|
|
11196
|
-
errorMessage = error.message;
|
|
11197
|
-
}
|
|
11198
|
-
} else if (typeof error === "string") {
|
|
11199
|
-
errorMessage = error;
|
|
11200
|
-
}
|
|
11225
|
+
const errorMessage = resolveFlowErrorMessage_default(error, t("errors.signup.flow.failure"));
|
|
11201
11226
|
clearMessages();
|
|
11202
11227
|
addMessage({
|
|
11203
11228
|
message: errorMessage,
|
|
@@ -11206,11 +11231,25 @@ var BaseSignUpContent = ({
|
|
|
11206
11231
|
},
|
|
11207
11232
|
[t, addMessage, clearMessages]
|
|
11208
11233
|
);
|
|
11209
|
-
const [isLoading, setIsLoading] = (0,
|
|
11210
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
11211
|
-
const [
|
|
11212
|
-
const
|
|
11213
|
-
const
|
|
11234
|
+
const [isLoading, setIsLoading] = (0, import_react76.useState)(false);
|
|
11235
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react76.useState)(false);
|
|
11236
|
+
const [isFlowComplete, setIsFlowComplete] = (0, import_react76.useState)(false);
|
|
11237
|
+
const [currentFlow, setCurrentFlow] = (0, import_react76.useState)(null);
|
|
11238
|
+
const initializationAttemptedRef = (0, import_react76.useRef)(false);
|
|
11239
|
+
const handleFlowComplete = (0, import_react76.useCallback)(
|
|
11240
|
+
(response) => {
|
|
11241
|
+
setCurrentFlow(response);
|
|
11242
|
+
setIsFlowComplete(true);
|
|
11243
|
+
clearMessages();
|
|
11244
|
+
addMessage({
|
|
11245
|
+
message: t("signup.success"),
|
|
11246
|
+
type: "success"
|
|
11247
|
+
});
|
|
11248
|
+
onComplete?.(response);
|
|
11249
|
+
},
|
|
11250
|
+
[t, addMessage, clearMessages, onComplete]
|
|
11251
|
+
);
|
|
11252
|
+
const extractFormFields = (0, import_react76.useCallback)(
|
|
11214
11253
|
(components) => {
|
|
11215
11254
|
const fields = [];
|
|
11216
11255
|
const processComponents = (comps) => {
|
|
@@ -11263,7 +11302,7 @@ var BaseSignUpContent = ({
|
|
|
11263
11302
|
validateForm,
|
|
11264
11303
|
reset: resetForm
|
|
11265
11304
|
} = form;
|
|
11266
|
-
const setupFormFields = (0,
|
|
11305
|
+
const setupFormFields = (0, import_react76.useCallback)(
|
|
11267
11306
|
(flowResponse) => {
|
|
11268
11307
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
11269
11308
|
const initialValues = {};
|
|
@@ -11319,9 +11358,14 @@ var BaseSignUpContent = ({
|
|
|
11319
11358
|
};
|
|
11320
11359
|
try {
|
|
11321
11360
|
const continueResponse = await onSubmit(payload);
|
|
11361
|
+
if (!continueResponse) {
|
|
11362
|
+
popup.close();
|
|
11363
|
+
cleanup();
|
|
11364
|
+
return;
|
|
11365
|
+
}
|
|
11322
11366
|
onFlowChange?.(continueResponse);
|
|
11323
11367
|
if (continueResponse.flowStatus === import_browser68.EmbeddedFlowStatus.Complete) {
|
|
11324
|
-
|
|
11368
|
+
handleFlowComplete(continueResponse);
|
|
11325
11369
|
} else if (continueResponse.flowStatus === import_browser68.EmbeddedFlowStatus.Incomplete) {
|
|
11326
11370
|
setCurrentFlow(continueResponse);
|
|
11327
11371
|
setupFormFields(continueResponse);
|
|
@@ -11372,9 +11416,13 @@ var BaseSignUpContent = ({
|
|
|
11372
11416
|
};
|
|
11373
11417
|
try {
|
|
11374
11418
|
const continueResponse = await onSubmit(payload);
|
|
11419
|
+
if (!continueResponse) {
|
|
11420
|
+
popup.close();
|
|
11421
|
+
return;
|
|
11422
|
+
}
|
|
11375
11423
|
onFlowChange?.(continueResponse);
|
|
11376
11424
|
if (continueResponse.flowStatus === import_browser68.EmbeddedFlowStatus.Complete) {
|
|
11377
|
-
|
|
11425
|
+
handleFlowComplete(continueResponse);
|
|
11378
11426
|
} else if (continueResponse.flowStatus === import_browser68.EmbeddedFlowStatus.Incomplete) {
|
|
11379
11427
|
setCurrentFlow(continueResponse);
|
|
11380
11428
|
setupFormFields(continueResponse);
|
|
@@ -11420,9 +11468,12 @@ var BaseSignUpContent = ({
|
|
|
11420
11468
|
...actionId && { actionId }
|
|
11421
11469
|
};
|
|
11422
11470
|
const response = await onSubmit(payload);
|
|
11471
|
+
if (!response) {
|
|
11472
|
+
return;
|
|
11473
|
+
}
|
|
11423
11474
|
onFlowChange?.(response);
|
|
11424
11475
|
if (response.flowStatus === import_browser68.EmbeddedFlowStatus.Complete) {
|
|
11425
|
-
|
|
11476
|
+
handleFlowComplete(response);
|
|
11426
11477
|
return;
|
|
11427
11478
|
}
|
|
11428
11479
|
if (response.flowStatus === import_browser68.EmbeddedFlowStatus.Incomplete) {
|
|
@@ -11431,6 +11482,11 @@ var BaseSignUpContent = ({
|
|
|
11431
11482
|
}
|
|
11432
11483
|
setCurrentFlow(response);
|
|
11433
11484
|
setupFormFields(response);
|
|
11485
|
+
const flowError = response.data?.additionalData?.["error"];
|
|
11486
|
+
if (flowError) {
|
|
11487
|
+
clearMessages();
|
|
11488
|
+
addMessage({ message: String(flowError), type: "error" });
|
|
11489
|
+
}
|
|
11434
11490
|
}
|
|
11435
11491
|
} catch (err) {
|
|
11436
11492
|
handleError(err);
|
|
@@ -11465,7 +11521,7 @@ var BaseSignUpContent = ({
|
|
|
11465
11521
|
);
|
|
11466
11522
|
const errorClasses = (0, import_css46.cx)([(0, import_browser68.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
11467
11523
|
const messageClasses = (0, import_css46.cx)([(0, import_browser68.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
11468
|
-
const renderComponents = (0,
|
|
11524
|
+
const renderComponents = (0, import_react76.useCallback)(
|
|
11469
11525
|
(components) => renderSignUpComponents2(
|
|
11470
11526
|
components,
|
|
11471
11527
|
formValues,
|
|
@@ -11495,7 +11551,7 @@ var BaseSignUpContent = ({
|
|
|
11495
11551
|
handleSubmit
|
|
11496
11552
|
]
|
|
11497
11553
|
);
|
|
11498
|
-
(0,
|
|
11554
|
+
(0, import_react76.useEffect)(() => {
|
|
11499
11555
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
11500
11556
|
initializationAttemptedRef.current = true;
|
|
11501
11557
|
(async () => {
|
|
@@ -11503,11 +11559,14 @@ var BaseSignUpContent = ({
|
|
|
11503
11559
|
clearMessages();
|
|
11504
11560
|
try {
|
|
11505
11561
|
const response = await onInitialize();
|
|
11562
|
+
if (!response) {
|
|
11563
|
+
return;
|
|
11564
|
+
}
|
|
11506
11565
|
setCurrentFlow(response);
|
|
11507
11566
|
setIsFlowInitialized(true);
|
|
11508
11567
|
onFlowChange?.(response);
|
|
11509
11568
|
if (response.flowStatus === import_browser68.EmbeddedFlowStatus.Complete) {
|
|
11510
|
-
|
|
11569
|
+
handleFlowComplete(response);
|
|
11511
11570
|
return;
|
|
11512
11571
|
}
|
|
11513
11572
|
if (response.flowStatus === import_browser68.EmbeddedFlowStatus.Incomplete) {
|
|
@@ -11525,7 +11584,7 @@ var BaseSignUpContent = ({
|
|
|
11525
11584
|
isInitialized,
|
|
11526
11585
|
isFlowInitialized,
|
|
11527
11586
|
onInitialize,
|
|
11528
|
-
|
|
11587
|
+
handleFlowComplete,
|
|
11529
11588
|
onError,
|
|
11530
11589
|
onFlowChange,
|
|
11531
11590
|
setupFormFields,
|
|
@@ -11567,13 +11626,13 @@ var BaseSignUpContent = ({
|
|
|
11567
11626
|
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11568
11627
|
Alert_default,
|
|
11569
11628
|
{
|
|
11570
|
-
variant: message.type
|
|
11629
|
+
variant: resolveAlertVariant(message.type),
|
|
11571
11630
|
className: (0, import_css46.cx)(styles.flowMessageItem, messageClasses),
|
|
11572
11631
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Alert_default.Description, { children: message.message })
|
|
11573
11632
|
},
|
|
11574
11633
|
message.id || index
|
|
11575
11634
|
)) }),
|
|
11576
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
11635
|
+
!isFlowComplete && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
11577
11636
|
] })
|
|
11578
11637
|
] });
|
|
11579
11638
|
};
|
|
@@ -11590,7 +11649,7 @@ var BaseSignUp_default = BaseSignUp;
|
|
|
11590
11649
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
11591
11650
|
var import_browser69 = require("@asgardeo/browser");
|
|
11592
11651
|
var import_css47 = require("@emotion/css");
|
|
11593
|
-
var
|
|
11652
|
+
var import_react77 = require("react");
|
|
11594
11653
|
|
|
11595
11654
|
// src/utils/v2/getAuthComponentHeadings.ts
|
|
11596
11655
|
var getAuthComponentHeadings = (components, flowTitle, flowSubtitle, defaultTitle, defaultSubtitle) => {
|
|
@@ -11679,26 +11738,26 @@ var BaseSignUpContent2 = ({
|
|
|
11679
11738
|
showSubtitle = true
|
|
11680
11739
|
}) => {
|
|
11681
11740
|
const { theme, colorScheme } = useTheme_default();
|
|
11682
|
-
const customRenderers = (0,
|
|
11741
|
+
const customRenderers = (0, import_react77.useContext)(ComponentRendererContext_default);
|
|
11683
11742
|
const { t } = useTranslation_default();
|
|
11684
11743
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
11685
11744
|
const { meta, isInitialized: isSdkInitialized, getStorageManager } = useAsgardeo_default();
|
|
11686
11745
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
11687
|
-
const [isLoading, setIsLoading] = (0,
|
|
11688
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
11689
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
11690
|
-
const [apiError, setApiError] = (0,
|
|
11691
|
-
const [passkeyState, setPasskeyState] = (0,
|
|
11746
|
+
const [isLoading, setIsLoading] = (0, import_react77.useState)(false);
|
|
11747
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react77.useState)(false);
|
|
11748
|
+
const [currentFlow, setCurrentFlow] = (0, import_react77.useState)(null);
|
|
11749
|
+
const [apiError, setApiError] = (0, import_react77.useState)(null);
|
|
11750
|
+
const [passkeyState, setPasskeyState] = (0, import_react77.useState)({
|
|
11692
11751
|
actionId: null,
|
|
11693
11752
|
creationOptions: null,
|
|
11694
11753
|
error: null,
|
|
11695
11754
|
executionId: null,
|
|
11696
11755
|
isActive: false
|
|
11697
11756
|
});
|
|
11698
|
-
const challengeTokenRef = (0,
|
|
11699
|
-
const initializationAttemptedRef = (0,
|
|
11700
|
-
const passkeyProcessedRef = (0,
|
|
11701
|
-
(0,
|
|
11757
|
+
const challengeTokenRef = (0, import_react77.useRef)(null);
|
|
11758
|
+
const initializationAttemptedRef = (0, import_react77.useRef)(false);
|
|
11759
|
+
const passkeyProcessedRef = (0, import_react77.useRef)(false);
|
|
11760
|
+
(0, import_react77.useEffect)(() => {
|
|
11702
11761
|
if (!isSdkInitialized) return;
|
|
11703
11762
|
(async () => {
|
|
11704
11763
|
try {
|
|
@@ -11726,7 +11785,7 @@ var BaseSignUpContent2 = ({
|
|
|
11726
11785
|
logger9.warn("Failed to persist challenge token in storage.");
|
|
11727
11786
|
}
|
|
11728
11787
|
};
|
|
11729
|
-
const handleError = (0,
|
|
11788
|
+
const handleError = (0, import_react77.useCallback)(
|
|
11730
11789
|
(error) => {
|
|
11731
11790
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
11732
11791
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -11738,7 +11797,7 @@ var BaseSignUpContent2 = ({
|
|
|
11738
11797
|
},
|
|
11739
11798
|
[t, addMessage, clearMessages]
|
|
11740
11799
|
);
|
|
11741
|
-
const normalizeFlowResponseLocal = (0,
|
|
11800
|
+
const normalizeFlowResponseLocal = (0, import_react77.useCallback)(
|
|
11742
11801
|
(response) => {
|
|
11743
11802
|
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
11744
11803
|
return response;
|
|
@@ -11765,7 +11824,7 @@ var BaseSignUpContent2 = ({
|
|
|
11765
11824
|
},
|
|
11766
11825
|
[t, children]
|
|
11767
11826
|
);
|
|
11768
|
-
const extractFormFields = (0,
|
|
11827
|
+
const extractFormFields = (0, import_react77.useCallback)(
|
|
11769
11828
|
(components) => {
|
|
11770
11829
|
const fields = [];
|
|
11771
11830
|
const processComponents = (comps) => {
|
|
@@ -11816,7 +11875,7 @@ var BaseSignUpContent2 = ({
|
|
|
11816
11875
|
touchAllFields,
|
|
11817
11876
|
reset: resetForm
|
|
11818
11877
|
} = form;
|
|
11819
|
-
const setupFormFields = (0,
|
|
11878
|
+
const setupFormFields = (0, import_react77.useCallback)(
|
|
11820
11879
|
(flowResponse) => {
|
|
11821
11880
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
11822
11881
|
const initialValues = {};
|
|
@@ -11988,6 +12047,9 @@ var BaseSignUpContent2 = ({
|
|
|
11988
12047
|
inputs: filteredInputs
|
|
11989
12048
|
};
|
|
11990
12049
|
const rawResponse = await onSubmit(payload);
|
|
12050
|
+
if (!rawResponse) {
|
|
12051
|
+
return;
|
|
12052
|
+
}
|
|
11991
12053
|
const response = normalizeFlowResponseLocal(rawResponse);
|
|
11992
12054
|
onFlowChange?.(response);
|
|
11993
12055
|
await setChallengeToken(response.challengeToken ?? null);
|
|
@@ -12023,7 +12085,7 @@ var BaseSignUpContent2 = ({
|
|
|
12023
12085
|
setIsLoading(false);
|
|
12024
12086
|
}
|
|
12025
12087
|
};
|
|
12026
|
-
(0,
|
|
12088
|
+
(0, import_react77.useEffect)(() => {
|
|
12027
12089
|
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {
|
|
12028
12090
|
return;
|
|
12029
12091
|
}
|
|
@@ -12090,7 +12152,7 @@ var BaseSignUpContent2 = ({
|
|
|
12090
12152
|
);
|
|
12091
12153
|
const errorClasses = (0, import_css47.cx)([(0, import_browser69.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
12092
12154
|
const messageClasses = (0, import_css47.cx)([(0, import_browser69.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
12093
|
-
const renderComponents = (0,
|
|
12155
|
+
const renderComponents = (0, import_react77.useCallback)(
|
|
12094
12156
|
(components) => renderSignUpComponents(
|
|
12095
12157
|
components,
|
|
12096
12158
|
formValues,
|
|
@@ -12134,7 +12196,7 @@ var BaseSignUpContent2 = ({
|
|
|
12134
12196
|
state: urlParams.get("state")
|
|
12135
12197
|
};
|
|
12136
12198
|
};
|
|
12137
|
-
(0,
|
|
12199
|
+
(0, import_react77.useEffect)(() => {
|
|
12138
12200
|
const urlParams = getUrlParams2();
|
|
12139
12201
|
if (urlParams.code || urlParams.state) {
|
|
12140
12202
|
return;
|
|
@@ -12392,12 +12454,13 @@ var import_browser77 = require("@asgardeo/browser");
|
|
|
12392
12454
|
// src/components/presentation/auth/Recovery/v1/BaseRecovery.tsx
|
|
12393
12455
|
var import_browser75 = require("@asgardeo/browser");
|
|
12394
12456
|
var import_css48 = require("@emotion/css");
|
|
12395
|
-
var
|
|
12457
|
+
var import_react79 = require("react");
|
|
12396
12458
|
|
|
12397
12459
|
// src/components/presentation/auth/Recovery/v1/RecoveryOptionFactory.tsx
|
|
12398
12460
|
var import_browser74 = require("@asgardeo/browser");
|
|
12461
|
+
var import_react78 = require("react");
|
|
12399
12462
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12400
|
-
var
|
|
12463
|
+
var createRecoveryElement = ({ component, onSubmit, ...rest }) => {
|
|
12401
12464
|
switch (component.type) {
|
|
12402
12465
|
case import_browser74.EmbeddedFlowComponentType.Typography:
|
|
12403
12466
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
@@ -12461,6 +12524,10 @@ var createRecoveryComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
12461
12524
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", {});
|
|
12462
12525
|
}
|
|
12463
12526
|
};
|
|
12527
|
+
var createRecoveryComponent = ({ key, ...props }) => {
|
|
12528
|
+
const element = createRecoveryElement(props);
|
|
12529
|
+
return key === void 0 || key === null ? element : (0, import_react78.cloneElement)(element, { key });
|
|
12530
|
+
};
|
|
12464
12531
|
var createRecoveryOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createRecoveryComponent({
|
|
12465
12532
|
component,
|
|
12466
12533
|
formErrors,
|
|
@@ -12513,7 +12580,7 @@ var BaseRecoveryContent = ({
|
|
|
12513
12580
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
12514
12581
|
useAsgardeo_default();
|
|
12515
12582
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
12516
|
-
const handleError = (0,
|
|
12583
|
+
const handleError = (0, import_react79.useCallback)(
|
|
12517
12584
|
(error) => {
|
|
12518
12585
|
let errorMessage = t("errors.recovery.flow.failure");
|
|
12519
12586
|
if (error && typeof error === "object") {
|
|
@@ -12537,11 +12604,11 @@ var BaseRecoveryContent = ({
|
|
|
12537
12604
|
},
|
|
12538
12605
|
[t, addMessage, clearMessages]
|
|
12539
12606
|
);
|
|
12540
|
-
const [isLoading, setIsLoading] = (0,
|
|
12541
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
12542
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
12543
|
-
const initializationAttemptedRef = (0,
|
|
12544
|
-
const extractFormFields = (0,
|
|
12607
|
+
const [isLoading, setIsLoading] = (0, import_react79.useState)(false);
|
|
12608
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react79.useState)(false);
|
|
12609
|
+
const [currentFlow, setCurrentFlow] = (0, import_react79.useState)(null);
|
|
12610
|
+
const initializationAttemptedRef = (0, import_react79.useRef)(false);
|
|
12611
|
+
const extractFormFields = (0, import_react79.useCallback)(
|
|
12545
12612
|
(components) => {
|
|
12546
12613
|
const fields = [];
|
|
12547
12614
|
const processComponents = (comps) => {
|
|
@@ -12595,7 +12662,7 @@ var BaseRecoveryContent = ({
|
|
|
12595
12662
|
touchAllFields,
|
|
12596
12663
|
reset: resetForm
|
|
12597
12664
|
} = form;
|
|
12598
|
-
const setupFormFields = (0,
|
|
12665
|
+
const setupFormFields = (0, import_react79.useCallback)(
|
|
12599
12666
|
(flowResponse) => {
|
|
12600
12667
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
12601
12668
|
const initialValues = {};
|
|
@@ -12607,7 +12674,7 @@ var BaseRecoveryContent = ({
|
|
|
12607
12674
|
},
|
|
12608
12675
|
[extractFormFields, resetForm, setFormValue]
|
|
12609
12676
|
);
|
|
12610
|
-
const handleInputChange = (0,
|
|
12677
|
+
const handleInputChange = (0, import_react79.useCallback)(
|
|
12611
12678
|
(name, value) => {
|
|
12612
12679
|
setFormValue(name, value);
|
|
12613
12680
|
setFormTouched(name, true);
|
|
@@ -12682,7 +12749,7 @@ var BaseRecoveryContent = ({
|
|
|
12682
12749
|
);
|
|
12683
12750
|
const errorClasses = (0, import_css48.cx)([(0, import_browser75.withVendorCSSClassPrefix)("recovery__error")], errorClassName);
|
|
12684
12751
|
const messageClasses = (0, import_css48.cx)([(0, import_browser75.withVendorCSSClassPrefix)("recovery__messages")], messageClassName);
|
|
12685
|
-
const renderComponents = (0,
|
|
12752
|
+
const renderComponents = (0, import_react79.useCallback)(
|
|
12686
12753
|
(components) => renderRecoveryComponents2(
|
|
12687
12754
|
components,
|
|
12688
12755
|
formValues,
|
|
@@ -12713,7 +12780,7 @@ var BaseRecoveryContent = ({
|
|
|
12713
12780
|
variant
|
|
12714
12781
|
]
|
|
12715
12782
|
);
|
|
12716
|
-
(0,
|
|
12783
|
+
(0, import_react79.useEffect)(() => {
|
|
12717
12784
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
12718
12785
|
initializationAttemptedRef.current = true;
|
|
12719
12786
|
(async () => {
|
|
@@ -12797,7 +12864,7 @@ var BaseRecovery_default = BaseRecovery;
|
|
|
12797
12864
|
// src/components/presentation/auth/Recovery/v2/BaseRecovery.tsx
|
|
12798
12865
|
var import_browser76 = require("@asgardeo/browser");
|
|
12799
12866
|
var import_css49 = require("@emotion/css");
|
|
12800
|
-
var
|
|
12867
|
+
var import_react80 = require("react");
|
|
12801
12868
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12802
12869
|
var BaseRecoveryContent2 = ({
|
|
12803
12870
|
onInitialize,
|
|
@@ -12819,18 +12886,18 @@ var BaseRecoveryContent2 = ({
|
|
|
12819
12886
|
showSubtitle = true
|
|
12820
12887
|
}) => {
|
|
12821
12888
|
const { theme, colorScheme } = useTheme_default();
|
|
12822
|
-
const customRenderers = (0,
|
|
12889
|
+
const customRenderers = (0, import_react80.useContext)(ComponentRendererContext_default);
|
|
12823
12890
|
const { t } = useTranslation_default();
|
|
12824
12891
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
12825
12892
|
const { meta } = useAsgardeo_default();
|
|
12826
12893
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
12827
|
-
const [isLoading, setIsLoading] = (0,
|
|
12828
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
12829
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
12830
|
-
const [apiError, setApiError] = (0,
|
|
12831
|
-
const initializationAttemptedRef = (0,
|
|
12832
|
-
const challengeTokenRef = (0,
|
|
12833
|
-
const handleError = (0,
|
|
12894
|
+
const [isLoading, setIsLoading] = (0, import_react80.useState)(false);
|
|
12895
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react80.useState)(false);
|
|
12896
|
+
const [currentFlow, setCurrentFlow] = (0, import_react80.useState)(null);
|
|
12897
|
+
const [apiError, setApiError] = (0, import_react80.useState)(null);
|
|
12898
|
+
const initializationAttemptedRef = (0, import_react80.useRef)(false);
|
|
12899
|
+
const challengeTokenRef = (0, import_react80.useRef)(null);
|
|
12900
|
+
const handleError = (0, import_react80.useCallback)(
|
|
12834
12901
|
(error) => {
|
|
12835
12902
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
12836
12903
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -12839,7 +12906,7 @@ var BaseRecoveryContent2 = ({
|
|
|
12839
12906
|
},
|
|
12840
12907
|
[t, addMessage, clearMessages]
|
|
12841
12908
|
);
|
|
12842
|
-
const normalizeFlowResponseLocal = (0,
|
|
12909
|
+
const normalizeFlowResponseLocal = (0, import_react80.useCallback)(
|
|
12843
12910
|
(response) => {
|
|
12844
12911
|
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
12845
12912
|
return response;
|
|
@@ -12857,7 +12924,7 @@ var BaseRecoveryContent2 = ({
|
|
|
12857
12924
|
},
|
|
12858
12925
|
[t, meta]
|
|
12859
12926
|
);
|
|
12860
|
-
const extractFormFields = (0,
|
|
12927
|
+
const extractFormFields = (0, import_react80.useCallback)(
|
|
12861
12928
|
(components) => {
|
|
12862
12929
|
const fields = [];
|
|
12863
12930
|
const processComponents = (comps) => {
|
|
@@ -12908,7 +12975,7 @@ var BaseRecoveryContent2 = ({
|
|
|
12908
12975
|
touchAllFields,
|
|
12909
12976
|
reset: resetForm
|
|
12910
12977
|
} = form;
|
|
12911
|
-
const setupFormFields = (0,
|
|
12978
|
+
const setupFormFields = (0, import_react80.useCallback)(
|
|
12912
12979
|
(flowResponse) => {
|
|
12913
12980
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
12914
12981
|
const initialValues = {};
|
|
@@ -13000,7 +13067,7 @@ var BaseRecoveryContent2 = ({
|
|
|
13000
13067
|
);
|
|
13001
13068
|
const errorClasses = (0, import_css49.cx)([(0, import_browser76.withVendorCSSClassPrefix)("recovery__error")], errorClassName);
|
|
13002
13069
|
const messageClasses = (0, import_css49.cx)([(0, import_browser76.withVendorCSSClassPrefix)("recovery__messages")], messageClassName);
|
|
13003
|
-
const renderComponents = (0,
|
|
13070
|
+
const renderComponents = (0, import_react80.useCallback)(
|
|
13004
13071
|
(components) => renderRecoveryComponents(
|
|
13005
13072
|
components,
|
|
13006
13073
|
formValues,
|
|
@@ -13038,7 +13105,7 @@ var BaseRecoveryContent2 = ({
|
|
|
13038
13105
|
variant
|
|
13039
13106
|
]
|
|
13040
13107
|
);
|
|
13041
|
-
(0,
|
|
13108
|
+
(0, import_react80.useEffect)(() => {
|
|
13042
13109
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
13043
13110
|
initializationAttemptedRef.current = true;
|
|
13044
13111
|
(async () => {
|
|
@@ -13220,7 +13287,7 @@ var Recovery_default = Recovery;
|
|
|
13220
13287
|
|
|
13221
13288
|
// src/components/presentation/auth/Recovery/v2/Recovery.tsx
|
|
13222
13289
|
var import_browser79 = require("@asgardeo/browser");
|
|
13223
|
-
var
|
|
13290
|
+
var import_react81 = require("react");
|
|
13224
13291
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
13225
13292
|
var Recovery2 = ({
|
|
13226
13293
|
className,
|
|
@@ -13233,7 +13300,7 @@ var Recovery2 = ({
|
|
|
13233
13300
|
...rest
|
|
13234
13301
|
}) => {
|
|
13235
13302
|
const { recover, isInitialized, applicationId } = useAsgardeo_default();
|
|
13236
|
-
const handleInitialize = (0,
|
|
13303
|
+
const handleInitialize = (0, import_react81.useCallback)(
|
|
13237
13304
|
async (payload) => {
|
|
13238
13305
|
const urlParams = new URL(window.location.href).searchParams;
|
|
13239
13306
|
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
@@ -13258,11 +13325,11 @@ var Recovery2 = ({
|
|
|
13258
13325
|
},
|
|
13259
13326
|
[applicationId, tokenUrlParam, recover]
|
|
13260
13327
|
);
|
|
13261
|
-
const handleOnSubmit = (0,
|
|
13328
|
+
const handleOnSubmit = (0, import_react81.useCallback)(
|
|
13262
13329
|
async (payload) => await recover(payload),
|
|
13263
13330
|
[recover]
|
|
13264
13331
|
);
|
|
13265
|
-
const handleComplete = (0,
|
|
13332
|
+
const handleComplete = (0, import_react81.useCallback)(
|
|
13266
13333
|
(response) => {
|
|
13267
13334
|
onComplete?.(response);
|
|
13268
13335
|
if (afterRecoveryUrl) {
|
|
@@ -13304,17 +13371,17 @@ var Recovery_default3 = Recovery3;
|
|
|
13304
13371
|
|
|
13305
13372
|
// src/components/presentation/auth/InviteUser/v2/InviteUser.tsx
|
|
13306
13373
|
var import_browser82 = require("@asgardeo/browser");
|
|
13307
|
-
var
|
|
13374
|
+
var import_react84 = require("react");
|
|
13308
13375
|
|
|
13309
13376
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
13310
13377
|
var import_browser81 = require("@asgardeo/browser");
|
|
13311
13378
|
var import_css51 = require("@emotion/css");
|
|
13312
|
-
var
|
|
13379
|
+
var import_react83 = require("react");
|
|
13313
13380
|
|
|
13314
13381
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.ts
|
|
13315
13382
|
var import_css50 = require("@emotion/css");
|
|
13316
|
-
var
|
|
13317
|
-
var useStyles22 = (theme, colorScheme) => (0,
|
|
13383
|
+
var import_react82 = require("react");
|
|
13384
|
+
var useStyles22 = (theme, colorScheme) => (0, import_react82.useMemo)(() => {
|
|
13318
13385
|
const card = import_css50.css`
|
|
13319
13386
|
background: ${theme.vars.colors.background.surface};
|
|
13320
13387
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -13371,19 +13438,19 @@ var BaseInviteUser = ({
|
|
|
13371
13438
|
const { meta, isInitialized: isSdkInitialized, getStorageManager } = useAsgardeo_default();
|
|
13372
13439
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13373
13440
|
const { theme } = useTheme_default();
|
|
13374
|
-
const customRenderers = (0,
|
|
13441
|
+
const customRenderers = (0, import_react83.useContext)(ComponentRendererContext_default);
|
|
13375
13442
|
const styles = BaseInviteUser_styles_default(theme, theme.vars.colors.text.primary);
|
|
13376
|
-
const [isLoading, setIsLoading] = (0,
|
|
13377
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
13378
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
13379
|
-
const [apiError, setApiError] = (0,
|
|
13380
|
-
const [formValues, setFormValues] = (0,
|
|
13381
|
-
const [formErrors, setFormErrors] = (0,
|
|
13382
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
13383
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
13384
|
-
const challengeTokenRef = (0,
|
|
13385
|
-
const initializationAttemptedRef = (0,
|
|
13386
|
-
(0,
|
|
13443
|
+
const [isLoading, setIsLoading] = (0, import_react83.useState)(false);
|
|
13444
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react83.useState)(false);
|
|
13445
|
+
const [currentFlow, setCurrentFlow] = (0, import_react83.useState)(null);
|
|
13446
|
+
const [apiError, setApiError] = (0, import_react83.useState)(null);
|
|
13447
|
+
const [formValues, setFormValues] = (0, import_react83.useState)({});
|
|
13448
|
+
const [formErrors, setFormErrors] = (0, import_react83.useState)({});
|
|
13449
|
+
const [touchedFields, setTouchedFields] = (0, import_react83.useState)({});
|
|
13450
|
+
const [isFormValid, setIsFormValid] = (0, import_react83.useState)(true);
|
|
13451
|
+
const challengeTokenRef = (0, import_react83.useRef)(null);
|
|
13452
|
+
const initializationAttemptedRef = (0, import_react83.useRef)(false);
|
|
13453
|
+
(0, import_react83.useEffect)(() => {
|
|
13387
13454
|
if (!isSdkInitialized) return;
|
|
13388
13455
|
(async () => {
|
|
13389
13456
|
try {
|
|
@@ -13411,7 +13478,7 @@ var BaseInviteUser = ({
|
|
|
13411
13478
|
import_browser81.logger.warn("Failed to persist challenge token in storage.");
|
|
13412
13479
|
}
|
|
13413
13480
|
};
|
|
13414
|
-
const handleError = (0,
|
|
13481
|
+
const handleError = (0, import_react83.useCallback)(
|
|
13415
13482
|
(error) => {
|
|
13416
13483
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.inviteUser.errors.generic");
|
|
13417
13484
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -13419,7 +13486,7 @@ var BaseInviteUser = ({
|
|
|
13419
13486
|
},
|
|
13420
13487
|
[t, onError]
|
|
13421
13488
|
);
|
|
13422
|
-
const normalizeFlowResponseLocal = (0,
|
|
13489
|
+
const normalizeFlowResponseLocal = (0, import_react83.useCallback)(
|
|
13423
13490
|
(response) => {
|
|
13424
13491
|
if (!response?.data?.meta?.components) {
|
|
13425
13492
|
return response;
|
|
@@ -13447,7 +13514,7 @@ var BaseInviteUser = ({
|
|
|
13447
13514
|
},
|
|
13448
13515
|
[t, children]
|
|
13449
13516
|
);
|
|
13450
|
-
const handleInputChange = (0,
|
|
13517
|
+
const handleInputChange = (0, import_react83.useCallback)((name, value) => {
|
|
13451
13518
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
13452
13519
|
setFormErrors((prev) => {
|
|
13453
13520
|
const newErrors = { ...prev };
|
|
@@ -13455,10 +13522,10 @@ var BaseInviteUser = ({
|
|
|
13455
13522
|
return newErrors;
|
|
13456
13523
|
});
|
|
13457
13524
|
}, []);
|
|
13458
|
-
const handleInputBlur = (0,
|
|
13525
|
+
const handleInputBlur = (0, import_react83.useCallback)((name) => {
|
|
13459
13526
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
13460
13527
|
}, []);
|
|
13461
|
-
const validateForm = (0,
|
|
13528
|
+
const validateForm = (0, import_react83.useCallback)(
|
|
13462
13529
|
(components2) => {
|
|
13463
13530
|
const errors = {};
|
|
13464
13531
|
const validateComponents = (comps) => {
|
|
@@ -13482,7 +13549,7 @@ var BaseInviteUser = ({
|
|
|
13482
13549
|
},
|
|
13483
13550
|
[formValues]
|
|
13484
13551
|
);
|
|
13485
|
-
const handleSubmit = (0,
|
|
13552
|
+
const handleSubmit = (0, import_react83.useCallback)(
|
|
13486
13553
|
async (component, data) => {
|
|
13487
13554
|
if (!currentFlow) {
|
|
13488
13555
|
return;
|
|
@@ -13533,7 +13600,7 @@ var BaseInviteUser = ({
|
|
|
13533
13600
|
},
|
|
13534
13601
|
[currentFlow, formValues, validateForm, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]
|
|
13535
13602
|
);
|
|
13536
|
-
const resetFlow = (0,
|
|
13603
|
+
const resetFlow = (0, import_react83.useCallback)(() => {
|
|
13537
13604
|
setIsFlowInitialized(false);
|
|
13538
13605
|
setCurrentFlow(null);
|
|
13539
13606
|
setApiError(null);
|
|
@@ -13542,7 +13609,7 @@ var BaseInviteUser = ({
|
|
|
13542
13609
|
setTouchedFields({});
|
|
13543
13610
|
initializationAttemptedRef.current = false;
|
|
13544
13611
|
}, []);
|
|
13545
|
-
(0,
|
|
13612
|
+
(0, import_react83.useEffect)(() => {
|
|
13546
13613
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
13547
13614
|
initializationAttemptedRef.current = true;
|
|
13548
13615
|
(async () => {
|
|
@@ -13570,7 +13637,7 @@ var BaseInviteUser = ({
|
|
|
13570
13637
|
})();
|
|
13571
13638
|
}
|
|
13572
13639
|
}, [isInitialized, isFlowInitialized, onInitialize, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
13573
|
-
(0,
|
|
13640
|
+
(0, import_react83.useEffect)(() => {
|
|
13574
13641
|
if (currentFlow && isFlowInitialized) {
|
|
13575
13642
|
const components2 = currentFlow.data?.components || [];
|
|
13576
13643
|
if (components2.length > 0) {
|
|
@@ -13579,7 +13646,7 @@ var BaseInviteUser = ({
|
|
|
13579
13646
|
}
|
|
13580
13647
|
}
|
|
13581
13648
|
}, [formValues, currentFlow, isFlowInitialized, validateForm]);
|
|
13582
|
-
const extractHeadings = (0,
|
|
13649
|
+
const extractHeadings = (0, import_react83.useCallback)((components2) => {
|
|
13583
13650
|
let title2;
|
|
13584
13651
|
let subtitle2;
|
|
13585
13652
|
components2.forEach((comp) => {
|
|
@@ -13593,13 +13660,13 @@ var BaseInviteUser = ({
|
|
|
13593
13660
|
});
|
|
13594
13661
|
return { subtitle: subtitle2, title: title2 };
|
|
13595
13662
|
}, []);
|
|
13596
|
-
const filterHeadings = (0,
|
|
13663
|
+
const filterHeadings = (0, import_react83.useCallback)(
|
|
13597
13664
|
(components2) => components2.filter(
|
|
13598
13665
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
13599
13666
|
),
|
|
13600
13667
|
[]
|
|
13601
13668
|
);
|
|
13602
|
-
const renderComponents = (0,
|
|
13669
|
+
const renderComponents = (0, import_react83.useCallback)(
|
|
13603
13670
|
(components2) => renderInviteUserComponents(
|
|
13604
13671
|
components2,
|
|
13605
13672
|
formValues,
|
|
@@ -13732,7 +13799,7 @@ var InviteUser = ({
|
|
|
13732
13799
|
});
|
|
13733
13800
|
return response.data;
|
|
13734
13801
|
};
|
|
13735
|
-
const fetchOrganizationUnitChildren = (0,
|
|
13802
|
+
const fetchOrganizationUnitChildren = (0, import_react84.useCallback)(
|
|
13736
13803
|
async (parentId, limit, offset4) => {
|
|
13737
13804
|
const accessToken = await getAccessToken();
|
|
13738
13805
|
return (0, import_browser82.getOrganizationUnitChildren)({
|
|
@@ -13766,16 +13833,16 @@ var InviteUser = ({
|
|
|
13766
13833
|
var InviteUser_default = InviteUser;
|
|
13767
13834
|
|
|
13768
13835
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
13769
|
-
var
|
|
13836
|
+
var import_react87 = require("react");
|
|
13770
13837
|
|
|
13771
13838
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
13772
13839
|
var import_css53 = require("@emotion/css");
|
|
13773
|
-
var
|
|
13840
|
+
var import_react86 = require("react");
|
|
13774
13841
|
|
|
13775
13842
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.ts
|
|
13776
13843
|
var import_css52 = require("@emotion/css");
|
|
13777
|
-
var
|
|
13778
|
-
var useStyles23 = (theme, colorScheme) => (0,
|
|
13844
|
+
var import_react85 = require("react");
|
|
13845
|
+
var useStyles23 = (theme, colorScheme) => (0, import_react85.useMemo)(() => {
|
|
13779
13846
|
const card = import_css52.css`
|
|
13780
13847
|
background: ${theme.vars.colors.background.surface};
|
|
13781
13848
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -13833,22 +13900,22 @@ var BaseAcceptInvite = ({
|
|
|
13833
13900
|
const { meta, isInitialized, getStorageManager } = useAsgardeo_default();
|
|
13834
13901
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13835
13902
|
const { theme } = useTheme_default();
|
|
13836
|
-
const customRenderers = (0,
|
|
13903
|
+
const customRenderers = (0, import_react86.useContext)(ComponentRendererContext_default);
|
|
13837
13904
|
const styles = BaseAcceptInvite_styles_default(theme, theme.vars.colors.text.primary);
|
|
13838
|
-
const [isLoading, setIsLoading] = (0,
|
|
13839
|
-
const [isValidatingToken, setIsValidatingToken] = (0,
|
|
13840
|
-
const [isTokenInvalid, setIsTokenInvalid] = (0,
|
|
13841
|
-
const [isComplete, setIsComplete] = (0,
|
|
13842
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
13843
|
-
const [apiError, setApiError] = (0,
|
|
13844
|
-
const [formValues, setFormValues] = (0,
|
|
13845
|
-
const [formErrors, setFormErrors] = (0,
|
|
13846
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
13847
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
13848
|
-
const [isStorageReady, setIsStorageReady] = (0,
|
|
13849
|
-
const challengeTokenRef = (0,
|
|
13850
|
-
const tokenValidationAttemptedRef = (0,
|
|
13851
|
-
(0,
|
|
13905
|
+
const [isLoading, setIsLoading] = (0, import_react86.useState)(false);
|
|
13906
|
+
const [isValidatingToken, setIsValidatingToken] = (0, import_react86.useState)(true);
|
|
13907
|
+
const [isTokenInvalid, setIsTokenInvalid] = (0, import_react86.useState)(false);
|
|
13908
|
+
const [isComplete, setIsComplete] = (0, import_react86.useState)(false);
|
|
13909
|
+
const [currentFlow, setCurrentFlow] = (0, import_react86.useState)(null);
|
|
13910
|
+
const [apiError, setApiError] = (0, import_react86.useState)(null);
|
|
13911
|
+
const [formValues, setFormValues] = (0, import_react86.useState)({});
|
|
13912
|
+
const [formErrors, setFormErrors] = (0, import_react86.useState)({});
|
|
13913
|
+
const [touchedFields, setTouchedFields] = (0, import_react86.useState)({});
|
|
13914
|
+
const [isFormValid, setIsFormValid] = (0, import_react86.useState)(true);
|
|
13915
|
+
const [isStorageReady, setIsStorageReady] = (0, import_react86.useState)(false);
|
|
13916
|
+
const challengeTokenRef = (0, import_react86.useRef)(null);
|
|
13917
|
+
const tokenValidationAttemptedRef = (0, import_react86.useRef)(false);
|
|
13918
|
+
(0, import_react86.useEffect)(() => {
|
|
13852
13919
|
if (!isInitialized) return;
|
|
13853
13920
|
(async () => {
|
|
13854
13921
|
try {
|
|
@@ -13873,7 +13940,7 @@ var BaseAcceptInvite = ({
|
|
|
13873
13940
|
}
|
|
13874
13941
|
}
|
|
13875
13942
|
};
|
|
13876
|
-
const handleError = (0,
|
|
13943
|
+
const handleError = (0, import_react86.useCallback)(
|
|
13877
13944
|
(error) => {
|
|
13878
13945
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.acceptInvite.errors.generic");
|
|
13879
13946
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -13881,7 +13948,7 @@ var BaseAcceptInvite = ({
|
|
|
13881
13948
|
},
|
|
13882
13949
|
[t, onError]
|
|
13883
13950
|
);
|
|
13884
|
-
const normalizeFlowResponseLocal = (0,
|
|
13951
|
+
const normalizeFlowResponseLocal = (0, import_react86.useCallback)(
|
|
13885
13952
|
(response) => {
|
|
13886
13953
|
if (!response?.data?.meta?.components) {
|
|
13887
13954
|
return response;
|
|
@@ -13952,7 +14019,7 @@ var BaseAcceptInvite = ({
|
|
|
13952
14019
|
},
|
|
13953
14020
|
tokenValidationAttemptedRef
|
|
13954
14021
|
});
|
|
13955
|
-
const handleInputChange = (0,
|
|
14022
|
+
const handleInputChange = (0, import_react86.useCallback)((name, value) => {
|
|
13956
14023
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
13957
14024
|
setFormErrors((prev) => {
|
|
13958
14025
|
const newErrors = { ...prev };
|
|
@@ -13961,10 +14028,10 @@ var BaseAcceptInvite = ({
|
|
|
13961
14028
|
});
|
|
13962
14029
|
setIsFormValid(true);
|
|
13963
14030
|
}, []);
|
|
13964
|
-
const handleInputBlur = (0,
|
|
14031
|
+
const handleInputBlur = (0, import_react86.useCallback)((name) => {
|
|
13965
14032
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
13966
14033
|
}, []);
|
|
13967
|
-
const validateForm = (0,
|
|
14034
|
+
const validateForm = (0, import_react86.useCallback)(
|
|
13968
14035
|
(components2) => {
|
|
13969
14036
|
const errors = {};
|
|
13970
14037
|
const validateComponents = (comps) => {
|
|
@@ -13985,7 +14052,7 @@ var BaseAcceptInvite = ({
|
|
|
13985
14052
|
},
|
|
13986
14053
|
[formValues, t]
|
|
13987
14054
|
);
|
|
13988
|
-
const handleSubmit = (0,
|
|
14055
|
+
const handleSubmit = (0, import_react86.useCallback)(
|
|
13989
14056
|
async (component, data) => {
|
|
13990
14057
|
if (!currentFlow) {
|
|
13991
14058
|
return;
|
|
@@ -14060,7 +14127,7 @@ var BaseAcceptInvite = ({
|
|
|
14060
14127
|
normalizeFlowResponseLocal
|
|
14061
14128
|
]
|
|
14062
14129
|
);
|
|
14063
|
-
(0,
|
|
14130
|
+
(0, import_react86.useEffect)(() => {
|
|
14064
14131
|
if (tokenValidationAttemptedRef.current) {
|
|
14065
14132
|
return;
|
|
14066
14133
|
}
|
|
@@ -14114,7 +14181,7 @@ var BaseAcceptInvite = ({
|
|
|
14114
14181
|
}
|
|
14115
14182
|
})();
|
|
14116
14183
|
}, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
14117
|
-
const extractHeadings = (0,
|
|
14184
|
+
const extractHeadings = (0, import_react86.useCallback)((components2) => {
|
|
14118
14185
|
let title2;
|
|
14119
14186
|
let subtitle2;
|
|
14120
14187
|
components2.forEach((comp) => {
|
|
@@ -14128,7 +14195,7 @@ var BaseAcceptInvite = ({
|
|
|
14128
14195
|
});
|
|
14129
14196
|
return { subtitle: subtitle2, title: title2 };
|
|
14130
14197
|
}, []);
|
|
14131
|
-
const filterHeadings = (0,
|
|
14198
|
+
const filterHeadings = (0, import_react86.useCallback)(
|
|
14132
14199
|
(components2) => components2.filter(
|
|
14133
14200
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
14134
14201
|
),
|
|
@@ -14243,10 +14310,10 @@ var AcceptInvite = ({
|
|
|
14243
14310
|
showTitle = true,
|
|
14244
14311
|
showSubtitle = true
|
|
14245
14312
|
}) => {
|
|
14246
|
-
const { executionId: urlExecutionId, inviteToken: urlInviteToken } = (0,
|
|
14313
|
+
const { executionId: urlExecutionId, inviteToken: urlInviteToken } = (0, import_react87.useMemo)(() => getUrlParams(), []);
|
|
14247
14314
|
const executionId = executionIdProp || urlExecutionId;
|
|
14248
14315
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
14249
|
-
const apiBaseUrl = (0,
|
|
14316
|
+
const apiBaseUrl = (0, import_react87.useMemo)(() => {
|
|
14250
14317
|
if (baseUrl) {
|
|
14251
14318
|
return baseUrl;
|
|
14252
14319
|
}
|
|
@@ -14296,9 +14363,9 @@ var AcceptInvite_default = AcceptInvite;
|
|
|
14296
14363
|
|
|
14297
14364
|
// src/components/auth/Callback/Callback.tsx
|
|
14298
14365
|
var import_browser83 = require("@asgardeo/browser");
|
|
14299
|
-
var
|
|
14366
|
+
var import_react88 = require("react");
|
|
14300
14367
|
var Callback = ({ onNavigate, onError }) => {
|
|
14301
|
-
const processingRef = (0,
|
|
14368
|
+
const processingRef = (0, import_react88.useRef)(false);
|
|
14302
14369
|
const navigate6 = (path) => {
|
|
14303
14370
|
if (onNavigate) {
|
|
14304
14371
|
onNavigate(path);
|
|
@@ -14306,7 +14373,7 @@ var Callback = ({ onNavigate, onError }) => {
|
|
|
14306
14373
|
(0, import_browser83.navigate)(path);
|
|
14307
14374
|
}
|
|
14308
14375
|
};
|
|
14309
|
-
(0,
|
|
14376
|
+
(0, import_react88.useEffect)(() => {
|
|
14310
14377
|
const processOAuthCallback = () => {
|
|
14311
14378
|
if (processingRef.current) {
|
|
14312
14379
|
return;
|
|
@@ -14434,12 +14501,12 @@ var Organization_default = Organization5;
|
|
|
14434
14501
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
14435
14502
|
var import_browser89 = require("@asgardeo/browser");
|
|
14436
14503
|
var import_css61 = require("@emotion/css");
|
|
14437
|
-
var
|
|
14504
|
+
var import_react97 = require("react");
|
|
14438
14505
|
|
|
14439
14506
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
14440
14507
|
var import_browser84 = require("@asgardeo/browser");
|
|
14441
14508
|
var import_css54 = require("@emotion/css");
|
|
14442
|
-
var
|
|
14509
|
+
var import_react89 = require("react");
|
|
14443
14510
|
var useStyles24 = (theme, colorScheme) => {
|
|
14444
14511
|
const valuePlaceholder = import_css54.css`
|
|
14445
14512
|
font-style: italic;
|
|
@@ -14484,7 +14551,7 @@ var useStyles24 = (theme, colorScheme) => {
|
|
|
14484
14551
|
padding: ${theme.vars.spacing.unit};
|
|
14485
14552
|
vertical-align: top;
|
|
14486
14553
|
`;
|
|
14487
|
-
return (0,
|
|
14554
|
+
return (0, import_react89.useMemo)(() => {
|
|
14488
14555
|
const root = import_css54.css`
|
|
14489
14556
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
14490
14557
|
min-width: 600px;
|
|
@@ -14696,12 +14763,12 @@ var getDisplayName_default = getDisplayName;
|
|
|
14696
14763
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
14697
14764
|
var import_browser86 = require("@asgardeo/browser");
|
|
14698
14765
|
var import_css56 = require("@emotion/css");
|
|
14699
|
-
var
|
|
14766
|
+
var import_react91 = require("react");
|
|
14700
14767
|
|
|
14701
14768
|
// src/components/primitives/Avatar/Avatar.styles.ts
|
|
14702
14769
|
var import_css55 = require("@emotion/css");
|
|
14703
|
-
var
|
|
14704
|
-
var useStyles25 = (theme, colorScheme, size, variant, backgroundColor) => (0,
|
|
14770
|
+
var import_react90 = require("react");
|
|
14771
|
+
var useStyles25 = (theme, colorScheme, size, variant, backgroundColor) => (0, import_react90.useMemo)(() => {
|
|
14705
14772
|
const baseAvatar = import_css55.css`
|
|
14706
14773
|
align-items: center;
|
|
14707
14774
|
background: ${backgroundColor || theme.vars.colors.background.surface};
|
|
@@ -14795,7 +14862,7 @@ var Avatar = ({
|
|
|
14795
14862
|
const colors = generateColor(seed);
|
|
14796
14863
|
return `linear-gradient(${angle}deg, ${colors})`;
|
|
14797
14864
|
};
|
|
14798
|
-
const backgroundColor = (0,
|
|
14865
|
+
const backgroundColor = (0, import_react91.useMemo)(() => {
|
|
14799
14866
|
if (!name || imageUrl) {
|
|
14800
14867
|
return void 0;
|
|
14801
14868
|
}
|
|
@@ -14856,13 +14923,13 @@ var Avatar = ({
|
|
|
14856
14923
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
14857
14924
|
var import_browser87 = require("@asgardeo/browser");
|
|
14858
14925
|
var import_css58 = require("@emotion/css");
|
|
14859
|
-
var
|
|
14860
|
-
var
|
|
14926
|
+
var import_react93 = require("@floating-ui/react");
|
|
14927
|
+
var import_react94 = require("react");
|
|
14861
14928
|
|
|
14862
14929
|
// src/components/primitives/Dialog/Dialog.styles.ts
|
|
14863
14930
|
var import_css57 = require("@emotion/css");
|
|
14864
|
-
var
|
|
14865
|
-
var useStyles26 = (theme, colorScheme) => (0,
|
|
14931
|
+
var import_react92 = require("react");
|
|
14932
|
+
var useStyles26 = (theme, colorScheme) => (0, import_react92.useMemo)(() => {
|
|
14866
14933
|
const overlay = import_css57.css`
|
|
14867
14934
|
background-color: rgba(0, 0, 0, 0.5);
|
|
14868
14935
|
display: flex;
|
|
@@ -15023,23 +15090,23 @@ function useDialog({
|
|
|
15023
15090
|
open: controlledOpen,
|
|
15024
15091
|
onOpenChange: setControlledOpen
|
|
15025
15092
|
} = {}) {
|
|
15026
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
15027
|
-
const [labelId, setLabelId] = (0,
|
|
15028
|
-
const [descriptionId, setDescriptionId] = (0,
|
|
15093
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react94.useState)(initialOpen);
|
|
15094
|
+
const [labelId, setLabelId] = (0, import_react94.useState)();
|
|
15095
|
+
const [descriptionId, setDescriptionId] = (0, import_react94.useState)();
|
|
15029
15096
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
15030
15097
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
15031
|
-
const data = (0,
|
|
15098
|
+
const data = (0, import_react93.useFloating)({
|
|
15032
15099
|
onOpenChange: setOpen,
|
|
15033
15100
|
open
|
|
15034
15101
|
});
|
|
15035
15102
|
const { context } = data;
|
|
15036
|
-
const click = (0,
|
|
15103
|
+
const click = (0, import_react93.useClick)(context, {
|
|
15037
15104
|
enabled: controlledOpen == null
|
|
15038
15105
|
});
|
|
15039
|
-
const dismiss = (0,
|
|
15040
|
-
const role = (0,
|
|
15041
|
-
const interactions = (0,
|
|
15042
|
-
return (0,
|
|
15106
|
+
const dismiss = (0, import_react93.useDismiss)(context, { outsidePressEvent: "mousedown" });
|
|
15107
|
+
const role = (0, import_react93.useRole)(context);
|
|
15108
|
+
const interactions = (0, import_react93.useInteractions)([click, dismiss, role]);
|
|
15109
|
+
return (0, import_react94.useMemo)(
|
|
15043
15110
|
() => ({
|
|
15044
15111
|
open,
|
|
15045
15112
|
setOpen,
|
|
@@ -15053,9 +15120,9 @@ function useDialog({
|
|
|
15053
15120
|
[open, setOpen, interactions, data, labelId, descriptionId]
|
|
15054
15121
|
);
|
|
15055
15122
|
}
|
|
15056
|
-
var DialogContext = (0,
|
|
15123
|
+
var DialogContext = (0, import_react94.createContext)(null);
|
|
15057
15124
|
var useDialogContext = () => {
|
|
15058
|
-
const context = (0,
|
|
15125
|
+
const context = (0, import_react94.useContext)(DialogContext);
|
|
15059
15126
|
if (context == null) {
|
|
15060
15127
|
throw new Error("Dialog components must be wrapped in <Dialog />");
|
|
15061
15128
|
}
|
|
@@ -15065,13 +15132,13 @@ function Dialog({ children, ...options }) {
|
|
|
15065
15132
|
const dialog = useDialog(options);
|
|
15066
15133
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
15067
15134
|
}
|
|
15068
|
-
var DialogTrigger = (0,
|
|
15135
|
+
var DialogTrigger = (0, import_react94.forwardRef)(
|
|
15069
15136
|
({ children, asChild = false, ...props }, propRef) => {
|
|
15070
15137
|
const context = useDialogContext();
|
|
15071
15138
|
const childrenRef = children.ref;
|
|
15072
|
-
const ref = (0,
|
|
15073
|
-
if (asChild && (0,
|
|
15074
|
-
return (0,
|
|
15139
|
+
const ref = (0, import_react93.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
15140
|
+
if (asChild && (0, import_react94.isValidElement)(children)) {
|
|
15141
|
+
return (0, import_react94.cloneElement)(
|
|
15075
15142
|
children,
|
|
15076
15143
|
context.getReferenceProps({
|
|
15077
15144
|
ref,
|
|
@@ -15084,19 +15151,19 @@ var DialogTrigger = (0, import_react92.forwardRef)(
|
|
|
15084
15151
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
15085
15152
|
}
|
|
15086
15153
|
);
|
|
15087
|
-
var DialogContent = (0,
|
|
15154
|
+
var DialogContent = (0, import_react94.forwardRef)(
|
|
15088
15155
|
(props, propRef) => {
|
|
15089
15156
|
const { context: floatingContext, ...context } = useDialogContext();
|
|
15090
15157
|
const { theme, colorScheme } = useTheme_default();
|
|
15091
15158
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
15092
|
-
const ref = (0,
|
|
15159
|
+
const ref = (0, import_react93.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
15093
15160
|
if (!floatingContext.open) return null;
|
|
15094
|
-
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15095
|
-
|
|
15161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react93.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15162
|
+
import_react93.FloatingOverlay,
|
|
15096
15163
|
{
|
|
15097
15164
|
className: (0, import_css58.cx)((0, import_browser87.withVendorCSSClassPrefix)((0, import_browser87.bem)("dialog", "overlay")), styles["overlay"]),
|
|
15098
15165
|
lockScroll: true,
|
|
15099
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react93.FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15100
15167
|
"div",
|
|
15101
15168
|
{
|
|
15102
15169
|
ref,
|
|
@@ -15111,13 +15178,13 @@ var DialogContent = (0, import_react92.forwardRef)(
|
|
|
15111
15178
|
) });
|
|
15112
15179
|
}
|
|
15113
15180
|
);
|
|
15114
|
-
var DialogHeading = (0,
|
|
15181
|
+
var DialogHeading = (0, import_react94.forwardRef)(
|
|
15115
15182
|
({ children, ...props }, ref) => {
|
|
15116
15183
|
const context = useDialogContext();
|
|
15117
15184
|
const { theme, colorScheme } = useTheme_default();
|
|
15118
15185
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
15119
|
-
const id = (0,
|
|
15120
|
-
(0,
|
|
15186
|
+
const id = (0, import_react93.useId)();
|
|
15187
|
+
(0, import_react94.useLayoutEffect)(() => {
|
|
15121
15188
|
context.setLabelId(id);
|
|
15122
15189
|
return () => {
|
|
15123
15190
|
context.setLabelId(void 0);
|
|
@@ -15151,13 +15218,13 @@ var DialogHeading = (0, import_react92.forwardRef)(
|
|
|
15151
15218
|
] });
|
|
15152
15219
|
}
|
|
15153
15220
|
);
|
|
15154
|
-
var DialogDescription = (0,
|
|
15221
|
+
var DialogDescription = (0, import_react94.forwardRef)(
|
|
15155
15222
|
({ children, ...props }, ref) => {
|
|
15156
15223
|
const context = useDialogContext();
|
|
15157
15224
|
const { theme, colorScheme } = useTheme_default();
|
|
15158
15225
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
15159
|
-
const id = (0,
|
|
15160
|
-
(0,
|
|
15226
|
+
const id = (0, import_react93.useId)();
|
|
15227
|
+
(0, import_react94.useLayoutEffect)(() => {
|
|
15161
15228
|
context.setDescriptionId(id);
|
|
15162
15229
|
return () => {
|
|
15163
15230
|
context.setDescriptionId(void 0);
|
|
@@ -15175,17 +15242,17 @@ var DialogDescription = (0, import_react92.forwardRef)(
|
|
|
15175
15242
|
);
|
|
15176
15243
|
}
|
|
15177
15244
|
);
|
|
15178
|
-
var DialogClose = (0,
|
|
15245
|
+
var DialogClose = (0, import_react94.forwardRef)(
|
|
15179
15246
|
({ children, asChild = false, ...props }, propRef) => {
|
|
15180
15247
|
const context = useDialogContext();
|
|
15181
15248
|
const childrenRef = children?.ref;
|
|
15182
|
-
const ref = (0,
|
|
15249
|
+
const ref = (0, import_react93.useMergeRefs)([propRef, childrenRef]);
|
|
15183
15250
|
const handleClick = (event) => {
|
|
15184
15251
|
context.setOpen(false);
|
|
15185
15252
|
props.onClick?.(event);
|
|
15186
15253
|
};
|
|
15187
|
-
if (asChild && (0,
|
|
15188
|
-
return (0,
|
|
15254
|
+
if (asChild && (0, import_react94.isValidElement)(children)) {
|
|
15255
|
+
return (0, import_react94.cloneElement)(children, {
|
|
15189
15256
|
ref,
|
|
15190
15257
|
...props,
|
|
15191
15258
|
...children.props,
|
|
@@ -15220,12 +15287,12 @@ var Dialog_default = Dialog;
|
|
|
15220
15287
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
15221
15288
|
var import_browser88 = require("@asgardeo/browser");
|
|
15222
15289
|
var import_css60 = require("@emotion/css");
|
|
15223
|
-
var
|
|
15290
|
+
var import_react96 = require("react");
|
|
15224
15291
|
|
|
15225
15292
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
15226
15293
|
var import_css59 = require("@emotion/css");
|
|
15227
|
-
var
|
|
15228
|
-
var useStyles27 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0,
|
|
15294
|
+
var import_react95 = require("react");
|
|
15295
|
+
var useStyles27 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0, import_react95.useMemo)(() => {
|
|
15229
15296
|
const container = import_css59.css`
|
|
15230
15297
|
display: flex;
|
|
15231
15298
|
flex-direction: column;
|
|
@@ -15340,7 +15407,7 @@ var MultiInput = ({
|
|
|
15340
15407
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
15341
15408
|
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css60.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
15342
15409
|
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css60.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime108.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" }) });
|
|
15343
|
-
const handleAddValue = (0,
|
|
15410
|
+
const handleAddValue = (0, import_react96.useCallback)(
|
|
15344
15411
|
(newValue) => {
|
|
15345
15412
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
15346
15413
|
onChange([...values, newValue.trim()]);
|
|
@@ -15348,7 +15415,7 @@ var MultiInput = ({
|
|
|
15348
15415
|
},
|
|
15349
15416
|
[values, onChange, maxFields]
|
|
15350
15417
|
);
|
|
15351
|
-
const handleRemoveValue = (0,
|
|
15418
|
+
const handleRemoveValue = (0, import_react96.useCallback)(
|
|
15352
15419
|
(index) => {
|
|
15353
15420
|
if (values.length > minFields) {
|
|
15354
15421
|
const updatedValues = values.filter((_, i) => i !== index);
|
|
@@ -15357,7 +15424,7 @@ var MultiInput = ({
|
|
|
15357
15424
|
},
|
|
15358
15425
|
[values, onChange, minFields]
|
|
15359
15426
|
);
|
|
15360
|
-
const renderInputField = (0,
|
|
15427
|
+
const renderInputField = (0, import_react96.useCallback)(
|
|
15361
15428
|
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
15362
15429
|
const handleInputChange = (e) => {
|
|
15363
15430
|
const newValue = e.target ? e.target.value : e;
|
|
@@ -15399,8 +15466,8 @@ var MultiInput = ({
|
|
|
15399
15466
|
},
|
|
15400
15467
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
15401
15468
|
);
|
|
15402
|
-
const [currentInputValue, setCurrentInputValue] = (0,
|
|
15403
|
-
const handleInputSubmit = (0,
|
|
15469
|
+
const [currentInputValue, setCurrentInputValue] = (0, import_react96.useState)("");
|
|
15470
|
+
const handleInputSubmit = (0, import_react96.useCallback)(() => {
|
|
15404
15471
|
if (currentInputValue.trim() !== "") {
|
|
15405
15472
|
handleAddValue(currentInputValue);
|
|
15406
15473
|
setCurrentInputValue("");
|
|
@@ -15482,6 +15549,9 @@ var fieldsToSkip = [
|
|
|
15482
15549
|
"preferredMFAOption"
|
|
15483
15550
|
];
|
|
15484
15551
|
var readonlyFields = ["username", "userName", "user_name"];
|
|
15552
|
+
var normalizeMutability = (mutability) => (mutability ?? "").replace(/_/g, "").toLowerCase();
|
|
15553
|
+
var isReadOnlyMutability = (mutability) => normalizeMutability(mutability) === "readonly";
|
|
15554
|
+
var isReadWriteMutability = (mutability) => normalizeMutability(mutability) === "readwrite";
|
|
15485
15555
|
var BaseUserProfile = ({
|
|
15486
15556
|
fallback = null,
|
|
15487
15557
|
className = "",
|
|
@@ -15504,10 +15574,10 @@ var BaseUserProfile = ({
|
|
|
15504
15574
|
displayNameAttributes = []
|
|
15505
15575
|
}) => {
|
|
15506
15576
|
const { theme, colorScheme } = useTheme_default();
|
|
15507
|
-
const [editedUser, setEditedUser] = (0,
|
|
15508
|
-
const [editingFields, setEditingFields] = (0,
|
|
15577
|
+
const [editedUser, setEditedUser] = (0, import_react97.useState)(flattenedProfile || profile);
|
|
15578
|
+
const [editingFields, setEditingFields] = (0, import_react97.useState)({});
|
|
15509
15579
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15510
|
-
const shouldShowField = (0,
|
|
15580
|
+
const shouldShowField = (0, import_react97.useCallback)(
|
|
15511
15581
|
(fieldName) => {
|
|
15512
15582
|
if (fieldsToSkip.includes(fieldName)) {
|
|
15513
15583
|
return false;
|
|
@@ -15536,13 +15606,13 @@ var BaseUserProfile = ({
|
|
|
15536
15606
|
children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
15537
15607
|
}
|
|
15538
15608
|
);
|
|
15539
|
-
const toggleFieldEdit = (0,
|
|
15609
|
+
const toggleFieldEdit = (0, import_react97.useCallback)((fieldName) => {
|
|
15540
15610
|
setEditingFields((prev) => ({
|
|
15541
15611
|
...prev,
|
|
15542
15612
|
[fieldName]: !prev[fieldName]
|
|
15543
15613
|
}));
|
|
15544
15614
|
}, []);
|
|
15545
|
-
const getFieldPlaceholder = (0,
|
|
15615
|
+
const getFieldPlaceholder = (0, import_react97.useCallback)((schema) => {
|
|
15546
15616
|
const { type, displayName, description, name } = schema;
|
|
15547
15617
|
const fieldLabel = displayName || description || name || "value";
|
|
15548
15618
|
switch (type) {
|
|
@@ -15556,7 +15626,7 @@ var BaseUserProfile = ({
|
|
|
15556
15626
|
return `Enter your ${fieldLabel.toLowerCase()}`;
|
|
15557
15627
|
}
|
|
15558
15628
|
}, []);
|
|
15559
|
-
const formatLabel = (0,
|
|
15629
|
+
const formatLabel = (0, import_react97.useCallback)(
|
|
15560
15630
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
15561
15631
|
[]
|
|
15562
15632
|
);
|
|
@@ -15586,7 +15656,7 @@ var BaseUserProfile = ({
|
|
|
15586
15656
|
}
|
|
15587
15657
|
}
|
|
15588
15658
|
}
|
|
15589
|
-
const handleFieldSave = (0,
|
|
15659
|
+
const handleFieldSave = (0, import_react97.useCallback)(
|
|
15590
15660
|
(schema) => {
|
|
15591
15661
|
if (!onUpdate || !schema.name) return;
|
|
15592
15662
|
const fieldName = schema.name;
|
|
@@ -15616,7 +15686,7 @@ var BaseUserProfile = ({
|
|
|
15616
15686
|
},
|
|
15617
15687
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
15618
15688
|
);
|
|
15619
|
-
const handleFieldCancel = (0,
|
|
15689
|
+
const handleFieldCancel = (0, import_react97.useCallback)(
|
|
15620
15690
|
(fieldName) => {
|
|
15621
15691
|
const currentUser2 = flattenedProfile || profile;
|
|
15622
15692
|
setEditedUser((prev) => ({
|
|
@@ -15660,7 +15730,7 @@ var BaseUserProfile = ({
|
|
|
15660
15730
|
}
|
|
15661
15731
|
if (Array.isArray(value) || multiValued) {
|
|
15662
15732
|
const hasValues = Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== null && value !== "";
|
|
15663
|
-
const isEditable2 = editable && mutability
|
|
15733
|
+
const isEditable2 = editable && !isReadOnlyMutability(mutability) && !readonlyFields.includes(name || "");
|
|
15664
15734
|
if (isEditing && onEditValue && isEditable2) {
|
|
15665
15735
|
let currentValue;
|
|
15666
15736
|
if (editedUser && name && editedUser[name] !== void 0) {
|
|
@@ -15730,7 +15800,7 @@ var BaseUserProfile = ({
|
|
|
15730
15800
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
15731
15801
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ObjectDisplay, { data: value });
|
|
15732
15802
|
}
|
|
15733
|
-
if (isEditing && onEditValue && mutability
|
|
15803
|
+
if (isEditing && onEditValue && !isReadOnlyMutability(mutability) && !readonlyFields.includes(name || "")) {
|
|
15734
15804
|
let fieldValue;
|
|
15735
15805
|
if (editedUser && name && editedUser[name] !== void 0) {
|
|
15736
15806
|
fieldValue = editedUser[name];
|
|
@@ -15788,7 +15858,7 @@ var BaseUserProfile = ({
|
|
|
15788
15858
|
] });
|
|
15789
15859
|
}
|
|
15790
15860
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
15791
|
-
const isEditable = editable && mutability
|
|
15861
|
+
const isEditable = editable && !isReadOnlyMutability(mutability) && !readonlyFields.includes(name || "");
|
|
15792
15862
|
let displayValue;
|
|
15793
15863
|
if (hasValue) {
|
|
15794
15864
|
displayValue = String(value);
|
|
@@ -15818,7 +15888,7 @@ var BaseUserProfile = ({
|
|
|
15818
15888
|
const hasValue = schema.value !== void 0 && schema.value !== "" && schema.value !== null;
|
|
15819
15889
|
const isFieldEditing = editingFields[schema.name];
|
|
15820
15890
|
const isReadonlyField = readonlyFields.includes(schema.name);
|
|
15821
|
-
const shouldShow = hasValue || isFieldEditing || editable && schema.mutability
|
|
15891
|
+
const shouldShow = hasValue || isFieldEditing || editable && isReadWriteMutability(schema.mutability);
|
|
15822
15892
|
if (!shouldShow) {
|
|
15823
15893
|
return null;
|
|
15824
15894
|
}
|
|
@@ -15833,7 +15903,7 @@ var BaseUserProfile = ({
|
|
|
15833
15903
|
},
|
|
15834
15904
|
() => toggleFieldEdit(schema.name)
|
|
15835
15905
|
) }),
|
|
15836
|
-
editable && schema.mutability
|
|
15906
|
+
editable && !isReadOnlyMutability(schema.mutability) && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: styles.fieldActions, children: [
|
|
15837
15907
|
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
15838
15908
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
15839
15909
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
@@ -15958,7 +16028,7 @@ var BaseUserProfile_default = BaseUserProfile;
|
|
|
15958
16028
|
|
|
15959
16029
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
15960
16030
|
var import_browser91 = require("@asgardeo/browser");
|
|
15961
|
-
var
|
|
16031
|
+
var import_react98 = require("react");
|
|
15962
16032
|
|
|
15963
16033
|
// src/api/updateMeProfile.ts
|
|
15964
16034
|
var import_browser90 = require("@asgardeo/browser");
|
|
@@ -15993,7 +16063,7 @@ var UserProfile3 = ({ preferences, ...rest }) => {
|
|
|
15993
16063
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
15994
16064
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
15995
16065
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15996
|
-
const [error, setError] = (0,
|
|
16066
|
+
const [error, setError] = (0, import_react98.useState)(null);
|
|
15997
16067
|
const handleProfileUpdate = async (payload) => {
|
|
15998
16068
|
setError(null);
|
|
15999
16069
|
try {
|
|
@@ -16025,13 +16095,13 @@ var UserProfile_default = UserProfile3;
|
|
|
16025
16095
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
16026
16096
|
var import_browser92 = require("@asgardeo/browser");
|
|
16027
16097
|
var import_css63 = require("@emotion/css");
|
|
16028
|
-
var
|
|
16029
|
-
var
|
|
16098
|
+
var import_react100 = require("@floating-ui/react");
|
|
16099
|
+
var import_react101 = require("react");
|
|
16030
16100
|
|
|
16031
16101
|
// src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts
|
|
16032
16102
|
var import_css62 = require("@emotion/css");
|
|
16033
|
-
var
|
|
16034
|
-
var useStyles28 = (theme, colorScheme) => (0,
|
|
16103
|
+
var import_react99 = require("react");
|
|
16104
|
+
var useStyles28 = (theme, colorScheme) => (0, import_react99.useMemo)(() => {
|
|
16035
16105
|
const trigger = import_css62.css`
|
|
16036
16106
|
display: inline-flex;
|
|
16037
16107
|
align-items: center;
|
|
@@ -16234,19 +16304,19 @@ var BaseUserDropdown = ({
|
|
|
16234
16304
|
}) => {
|
|
16235
16305
|
const { theme, colorScheme } = useTheme_default();
|
|
16236
16306
|
const styles = BaseUserDropdown_styles_default(theme, colorScheme);
|
|
16237
|
-
const [isOpen, setIsOpen] = (0,
|
|
16238
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
16239
|
-
const { refs, floatingStyles, context } = (0,
|
|
16240
|
-
middleware: [(0,
|
|
16307
|
+
const [isOpen, setIsOpen] = (0, import_react101.useState)(false);
|
|
16308
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react101.useState)(null);
|
|
16309
|
+
const { refs, floatingStyles, context } = (0, import_react100.useFloating)({
|
|
16310
|
+
middleware: [(0, import_react100.offset)(5), (0, import_react100.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react100.shift)({ padding: 5 })],
|
|
16241
16311
|
onOpenChange: setIsOpen,
|
|
16242
16312
|
open: isOpen,
|
|
16243
16313
|
placement: "bottom-end",
|
|
16244
|
-
whileElementsMounted:
|
|
16314
|
+
whileElementsMounted: import_react100.autoUpdate
|
|
16245
16315
|
});
|
|
16246
|
-
const click = (0,
|
|
16247
|
-
const dismiss = (0,
|
|
16248
|
-
const role = (0,
|
|
16249
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
16316
|
+
const click = (0, import_react100.useClick)(context);
|
|
16317
|
+
const dismiss = (0, import_react100.useDismiss)(context);
|
|
16318
|
+
const role = (0, import_react100.useRole)(context);
|
|
16319
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react100.useInteractions)([click, dismiss, role]);
|
|
16250
16320
|
const defaultAttributeMappings = {
|
|
16251
16321
|
email: ["emails"],
|
|
16252
16322
|
firstName: ["name.givenName", "given_name"],
|
|
@@ -16321,7 +16391,7 @@ var BaseUserDropdown = ({
|
|
|
16321
16391
|
]
|
|
16322
16392
|
}
|
|
16323
16393
|
),
|
|
16324
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16394
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_react100.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_react100.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
16325
16395
|
"div",
|
|
16326
16396
|
{
|
|
16327
16397
|
ref: refs.setFloating,
|
|
@@ -16425,7 +16495,7 @@ var BaseUserDropdown = ({
|
|
|
16425
16495
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
16426
16496
|
|
|
16427
16497
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
16428
|
-
var
|
|
16498
|
+
var import_react102 = require("react");
|
|
16429
16499
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16430
16500
|
var UserDropdown = ({
|
|
16431
16501
|
children,
|
|
@@ -16435,7 +16505,7 @@ var UserDropdown = ({
|
|
|
16435
16505
|
...rest
|
|
16436
16506
|
}) => {
|
|
16437
16507
|
const { user, isLoading, signOut, meta } = useAsgardeo_default();
|
|
16438
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
16508
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react102.useState)(false);
|
|
16439
16509
|
const handleManageProfile = () => {
|
|
16440
16510
|
setIsProfileOpen(true);
|
|
16441
16511
|
};
|
|
@@ -16496,13 +16566,13 @@ var UserDropdown_default = UserDropdown;
|
|
|
16496
16566
|
|
|
16497
16567
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
16498
16568
|
var import_css65 = require("@emotion/css");
|
|
16499
|
-
var
|
|
16500
|
-
var
|
|
16569
|
+
var import_react104 = require("@floating-ui/react");
|
|
16570
|
+
var import_react105 = require("react");
|
|
16501
16571
|
|
|
16502
16572
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.ts
|
|
16503
16573
|
var import_css64 = require("@emotion/css");
|
|
16504
|
-
var
|
|
16505
|
-
var useStyles29 = (theme, colorScheme) => (0,
|
|
16574
|
+
var import_react103 = require("react");
|
|
16575
|
+
var useStyles29 = (theme, colorScheme) => (0, import_react103.useMemo)(() => {
|
|
16506
16576
|
const root = import_css64.css`
|
|
16507
16577
|
display: inline-block;
|
|
16508
16578
|
position: relative;
|
|
@@ -16784,21 +16854,21 @@ var BaseOrganizationSwitcher = ({
|
|
|
16784
16854
|
}) => {
|
|
16785
16855
|
const { theme, colorScheme, direction } = useTheme_default();
|
|
16786
16856
|
const styles = BaseOrganizationSwitcher_styles_default(theme, colorScheme);
|
|
16787
|
-
const [isOpen, setIsOpen] = (0,
|
|
16788
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
16857
|
+
const [isOpen, setIsOpen] = (0, import_react105.useState)(false);
|
|
16858
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react105.useState)(null);
|
|
16789
16859
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
16790
16860
|
const isRTL = direction === "rtl";
|
|
16791
|
-
const { refs, floatingStyles, context } = (0,
|
|
16792
|
-
middleware: [(0,
|
|
16861
|
+
const { refs, floatingStyles, context } = (0, import_react104.useFloating)({
|
|
16862
|
+
middleware: [(0, import_react104.offset)(5), (0, import_react104.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react104.shift)({ padding: 5 })],
|
|
16793
16863
|
onOpenChange: setIsOpen,
|
|
16794
16864
|
open: isOpen,
|
|
16795
16865
|
placement: "bottom-end",
|
|
16796
|
-
whileElementsMounted:
|
|
16866
|
+
whileElementsMounted: import_react104.autoUpdate
|
|
16797
16867
|
});
|
|
16798
|
-
const click = (0,
|
|
16799
|
-
const dismiss = (0,
|
|
16800
|
-
const role = (0,
|
|
16801
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
16868
|
+
const click = (0, import_react104.useClick)(context);
|
|
16869
|
+
const dismiss = (0, import_react104.useDismiss)(context);
|
|
16870
|
+
const role = (0, import_react104.useRole)(context);
|
|
16871
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react104.useInteractions)([click, dismiss, role]);
|
|
16802
16872
|
if (fallback && !currentOrganization && !loading && organizations.length === 0) {
|
|
16803
16873
|
return fallback;
|
|
16804
16874
|
}
|
|
@@ -16873,7 +16943,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
16873
16943
|
]
|
|
16874
16944
|
}
|
|
16875
16945
|
),
|
|
16876
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
16946
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_react104.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_react104.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
|
|
16877
16947
|
"div",
|
|
16878
16948
|
{
|
|
16879
16949
|
ref: refs.setFloating,
|
|
@@ -17032,7 +17102,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
17032
17102
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
17033
17103
|
|
|
17034
17104
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
17035
|
-
var
|
|
17105
|
+
var import_react118 = require("react");
|
|
17036
17106
|
|
|
17037
17107
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
17038
17108
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
@@ -17063,17 +17133,17 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
17063
17133
|
var BuildingAlt_default = BuildingAlt;
|
|
17064
17134
|
|
|
17065
17135
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
17066
|
-
var
|
|
17136
|
+
var import_react108 = require("react");
|
|
17067
17137
|
|
|
17068
17138
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
17069
17139
|
var import_browser93 = require("@asgardeo/browser");
|
|
17070
17140
|
var import_css67 = require("@emotion/css");
|
|
17071
|
-
var
|
|
17141
|
+
var import_react107 = require("react");
|
|
17072
17142
|
|
|
17073
17143
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts
|
|
17074
17144
|
var import_css66 = require("@emotion/css");
|
|
17075
|
-
var
|
|
17076
|
-
var useStyles30 = (theme, colorScheme) => (0,
|
|
17145
|
+
var import_react106 = require("react");
|
|
17146
|
+
var useStyles30 = (theme, colorScheme) => (0, import_react106.useMemo)(() => {
|
|
17077
17147
|
const root = import_css66.css`
|
|
17078
17148
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
17079
17149
|
min-width: 600px;
|
|
@@ -17272,13 +17342,13 @@ var BaseCreateOrganization = ({
|
|
|
17272
17342
|
const { theme, colorScheme } = useTheme_default();
|
|
17273
17343
|
const styles = BaseCreateOrganization_styles_default(theme, colorScheme);
|
|
17274
17344
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
17275
|
-
const [formData, setFormData] = (0,
|
|
17345
|
+
const [formData, setFormData] = (0, import_react107.useState)({
|
|
17276
17346
|
description: "",
|
|
17277
17347
|
handle: "",
|
|
17278
17348
|
name: "",
|
|
17279
17349
|
...initialValues
|
|
17280
17350
|
});
|
|
17281
|
-
const [formErrors, setFormErrors] = (0,
|
|
17351
|
+
const [formErrors, setFormErrors] = (0, import_react107.useState)({});
|
|
17282
17352
|
const validateForm = () => {
|
|
17283
17353
|
const errors = {};
|
|
17284
17354
|
if (!formData.name.trim()) {
|
|
@@ -17455,8 +17525,8 @@ var CreateOrganization = ({
|
|
|
17455
17525
|
}) => {
|
|
17456
17526
|
const { isSignedIn, baseUrl, instanceId } = useAsgardeo_default();
|
|
17457
17527
|
const { currentOrganization, revalidateMyOrganizations } = useOrganization_default();
|
|
17458
|
-
const [loading, setLoading] = (0,
|
|
17459
|
-
const [error, setError] = (0,
|
|
17528
|
+
const [loading, setLoading] = (0, import_react108.useState)(false);
|
|
17529
|
+
const [error, setError] = (0, import_react108.useState)(null);
|
|
17460
17530
|
if (!isSignedIn && fallback) {
|
|
17461
17531
|
return fallback;
|
|
17462
17532
|
}
|
|
@@ -17511,16 +17581,16 @@ var CreateOrganization = ({
|
|
|
17511
17581
|
|
|
17512
17582
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
17513
17583
|
var import_css71 = require("@emotion/css");
|
|
17514
|
-
var
|
|
17584
|
+
var import_react112 = require("react");
|
|
17515
17585
|
|
|
17516
17586
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
17517
17587
|
var import_css69 = require("@emotion/css");
|
|
17518
|
-
var
|
|
17588
|
+
var import_react110 = require("react");
|
|
17519
17589
|
|
|
17520
17590
|
// src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts
|
|
17521
17591
|
var import_css68 = require("@emotion/css");
|
|
17522
|
-
var
|
|
17523
|
-
var useStyles31 = (theme, colorScheme) => (0,
|
|
17592
|
+
var import_react109 = require("react");
|
|
17593
|
+
var useStyles31 = (theme, colorScheme) => (0, import_react109.useMemo)(() => {
|
|
17524
17594
|
const root = import_css68.css`
|
|
17525
17595
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
17526
17596
|
min-width: 600px;
|
|
@@ -17827,7 +17897,7 @@ var BaseOrganizationList = ({
|
|
|
17827
17897
|
const { theme, colorScheme } = useTheme_default();
|
|
17828
17898
|
const styles = BaseOrganizationList_styles_default(theme, colorScheme);
|
|
17829
17899
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
17830
|
-
const organizationsWithSwitchAccess = (0,
|
|
17900
|
+
const organizationsWithSwitchAccess = (0, import_react110.useMemo)(() => {
|
|
17831
17901
|
if (!allOrganizations?.organizations) {
|
|
17832
17902
|
return [];
|
|
17833
17903
|
}
|
|
@@ -17916,8 +17986,8 @@ var BaseOrganizationList_default = BaseOrganizationList;
|
|
|
17916
17986
|
|
|
17917
17987
|
// src/components/presentation/OrganizationList/OrganizationList.styles.ts
|
|
17918
17988
|
var import_css70 = require("@emotion/css");
|
|
17919
|
-
var
|
|
17920
|
-
var useStyles32 = (theme, colorScheme) => (0,
|
|
17989
|
+
var import_react111 = require("react");
|
|
17990
|
+
var useStyles32 = (theme, colorScheme) => (0, import_react111.useMemo)(() => {
|
|
17921
17991
|
const cssOrganizationListWrapper = import_css70.css`
|
|
17922
17992
|
/* Container wrapper styles for OrganizationList component */
|
|
17923
17993
|
width: 100%;
|
|
@@ -17984,10 +18054,10 @@ var OrganizationList = (props) => {
|
|
|
17984
18054
|
const { theme, colorScheme } = useTheme_default();
|
|
17985
18055
|
const styles = OrganizationList_styles_default(theme, colorScheme);
|
|
17986
18056
|
const { getAllOrganizations: getAllOrganizations2, error, isLoading, myOrganizations } = useOrganization_default();
|
|
17987
|
-
const [allOrganizations, setAllOrganizations] = (0,
|
|
18057
|
+
const [allOrganizations, setAllOrganizations] = (0, import_react112.useState)({
|
|
17988
18058
|
organizations: []
|
|
17989
18059
|
});
|
|
17990
|
-
(0,
|
|
18060
|
+
(0, import_react112.useEffect)(() => {
|
|
17991
18061
|
(async () => {
|
|
17992
18062
|
setAllOrganizations(await getAllOrganizations2());
|
|
17993
18063
|
})();
|
|
@@ -18008,17 +18078,17 @@ var OrganizationList_default = OrganizationList;
|
|
|
18008
18078
|
|
|
18009
18079
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
18010
18080
|
var import_browser99 = require("@asgardeo/browser");
|
|
18011
|
-
var
|
|
18081
|
+
var import_react117 = require("react");
|
|
18012
18082
|
|
|
18013
18083
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
18014
18084
|
var import_browser96 = require("@asgardeo/browser");
|
|
18015
18085
|
var import_css75 = require("@emotion/css");
|
|
18016
|
-
var
|
|
18086
|
+
var import_react116 = require("react");
|
|
18017
18087
|
|
|
18018
18088
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.ts
|
|
18019
18089
|
var import_css72 = require("@emotion/css");
|
|
18020
|
-
var
|
|
18021
|
-
var useStyles33 = (theme, colorScheme) => (0,
|
|
18090
|
+
var import_react113 = require("react");
|
|
18091
|
+
var useStyles33 = (theme, colorScheme) => (0, import_react113.useMemo)(
|
|
18022
18092
|
() => ({
|
|
18023
18093
|
attributeItem: import_css72.css`
|
|
18024
18094
|
display: flex;
|
|
@@ -18199,12 +18269,12 @@ var BaseOrganizationProfile_styles_default = useStyles33;
|
|
|
18199
18269
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
18200
18270
|
var import_browser95 = require("@asgardeo/browser");
|
|
18201
18271
|
var import_css74 = require("@emotion/css");
|
|
18202
|
-
var
|
|
18272
|
+
var import_react115 = require("react");
|
|
18203
18273
|
|
|
18204
18274
|
// src/components/primitives/KeyValueInput/KeyValueInput.styles.ts
|
|
18205
18275
|
var import_css73 = require("@emotion/css");
|
|
18206
|
-
var
|
|
18207
|
-
var useStyles34 = (theme, colorScheme, disabled, readOnly, hasError) => (0,
|
|
18276
|
+
var import_react114 = require("react");
|
|
18277
|
+
var useStyles34 = (theme, colorScheme, disabled, readOnly, hasError) => (0, import_react114.useMemo)(() => {
|
|
18208
18278
|
const container = import_css73.css`
|
|
18209
18279
|
display: flex;
|
|
18210
18280
|
flex-direction: column;
|
|
@@ -18379,10 +18449,10 @@ var KeyValueInput = ({
|
|
|
18379
18449
|
const { theme, colorScheme } = useTheme_default();
|
|
18380
18450
|
const styles = KeyValueInput_styles_default(theme, colorScheme, disabled, readOnly, !!error);
|
|
18381
18451
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
18382
|
-
const [pairs, setPairs] = (0,
|
|
18383
|
-
const [newKey, setNewKey] = (0,
|
|
18384
|
-
const [newValue, setNewValue] = (0,
|
|
18385
|
-
const handleAddPair = (0,
|
|
18452
|
+
const [pairs, setPairs] = (0, import_react115.useState)(initialPairs);
|
|
18453
|
+
const [newKey, setNewKey] = (0, import_react115.useState)("");
|
|
18454
|
+
const [newValue, setNewValue] = (0, import_react115.useState)("");
|
|
18455
|
+
const handleAddPair = (0, import_react115.useCallback)(() => {
|
|
18386
18456
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
18387
18457
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
18388
18458
|
const newPair = {
|
|
@@ -18400,7 +18470,7 @@ var KeyValueInput = ({
|
|
|
18400
18470
|
onAdd(newPair);
|
|
18401
18471
|
}
|
|
18402
18472
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
18403
|
-
const handleRemovePair = (0,
|
|
18473
|
+
const handleRemovePair = (0, import_react115.useCallback)(
|
|
18404
18474
|
(index) => {
|
|
18405
18475
|
const pairToRemove = pairs[index];
|
|
18406
18476
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -18414,7 +18484,7 @@ var KeyValueInput = ({
|
|
|
18414
18484
|
},
|
|
18415
18485
|
[pairs, onChange, onRemove]
|
|
18416
18486
|
);
|
|
18417
|
-
const handleUpdatePair = (0,
|
|
18487
|
+
const handleUpdatePair = (0, import_react115.useCallback)(
|
|
18418
18488
|
(index, field, newVal) => {
|
|
18419
18489
|
const updatedPairs = pairs.map((pair, i) => {
|
|
18420
18490
|
if (i === index) {
|
|
@@ -18616,8 +18686,8 @@ var BaseOrganizationProfile = ({
|
|
|
18616
18686
|
const { theme, colorScheme } = useTheme_default();
|
|
18617
18687
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
18618
18688
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
18619
|
-
const [editedOrganization, setEditedOrganization] = (0,
|
|
18620
|
-
const [editingFields, setEditingFields] = (0,
|
|
18689
|
+
const [editedOrganization, setEditedOrganization] = (0, import_react116.useState)(organization);
|
|
18690
|
+
const [editingFields, setEditingFields] = (0, import_react116.useState)({});
|
|
18621
18691
|
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
18622
18692
|
"svg",
|
|
18623
18693
|
{
|
|
@@ -18632,13 +18702,13 @@ var BaseOrganizationProfile = ({
|
|
|
18632
18702
|
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
18633
18703
|
}
|
|
18634
18704
|
);
|
|
18635
|
-
const toggleFieldEdit = (0,
|
|
18705
|
+
const toggleFieldEdit = (0, import_react116.useCallback)((fieldName) => {
|
|
18636
18706
|
setEditingFields((prev) => ({
|
|
18637
18707
|
...prev,
|
|
18638
18708
|
[fieldName]: !prev[fieldName]
|
|
18639
18709
|
}));
|
|
18640
18710
|
}, []);
|
|
18641
|
-
const getFieldPlaceholder = (0,
|
|
18711
|
+
const getFieldPlaceholder = (0, import_react116.useCallback)((fieldKey) => {
|
|
18642
18712
|
const fieldLabels = {
|
|
18643
18713
|
description: "organization description",
|
|
18644
18714
|
name: "organization name",
|
|
@@ -18649,7 +18719,7 @@ var BaseOrganizationProfile = ({
|
|
|
18649
18719
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
18650
18720
|
return `Enter ${fieldLabel}`;
|
|
18651
18721
|
}, []);
|
|
18652
|
-
const handleFieldSave = (0,
|
|
18722
|
+
const handleFieldSave = (0, import_react116.useCallback)(
|
|
18653
18723
|
(fieldKey) => {
|
|
18654
18724
|
if (!onUpdate || !fieldKey) return;
|
|
18655
18725
|
let fieldValue;
|
|
@@ -18668,7 +18738,7 @@ var BaseOrganizationProfile = ({
|
|
|
18668
18738
|
},
|
|
18669
18739
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
18670
18740
|
);
|
|
18671
|
-
const handleFieldCancel = (0,
|
|
18741
|
+
const handleFieldCancel = (0, import_react116.useCallback)(
|
|
18672
18742
|
(fieldKey) => {
|
|
18673
18743
|
setEditedOrganization((prev) => ({
|
|
18674
18744
|
...prev,
|
|
@@ -18942,7 +19012,7 @@ var OrganizationProfile = ({
|
|
|
18942
19012
|
}) => {
|
|
18943
19013
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
18944
19014
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
18945
|
-
const [organization, setOrganization] = (0,
|
|
19015
|
+
const [organization, setOrganization] = (0, import_react117.useState)(null);
|
|
18946
19016
|
const fetchOrganization = async () => {
|
|
18947
19017
|
if (!baseUrl || !organizationId) {
|
|
18948
19018
|
return;
|
|
@@ -18959,7 +19029,7 @@ var OrganizationProfile = ({
|
|
|
18959
19029
|
setOrganization(null);
|
|
18960
19030
|
}
|
|
18961
19031
|
};
|
|
18962
|
-
(0,
|
|
19032
|
+
(0, import_react117.useEffect)(() => {
|
|
18963
19033
|
fetchOrganization();
|
|
18964
19034
|
}, [baseUrl, organizationId]);
|
|
18965
19035
|
const handleOrganizationUpdate = async (payload) => {
|
|
@@ -19015,9 +19085,9 @@ var OrganizationSwitcher = ({
|
|
|
19015
19085
|
isLoading,
|
|
19016
19086
|
error
|
|
19017
19087
|
} = useOrganization_default();
|
|
19018
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0,
|
|
19019
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
19020
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0,
|
|
19088
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, import_react118.useState)(false);
|
|
19089
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react118.useState)(false);
|
|
19090
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, import_react118.useState)(false);
|
|
19021
19091
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
19022
19092
|
if (!isSignedIn && fallback) {
|
|
19023
19093
|
return fallback;
|
|
@@ -19110,13 +19180,13 @@ var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
|
19110
19180
|
|
|
19111
19181
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx
|
|
19112
19182
|
var import_css77 = require("@emotion/css");
|
|
19113
|
-
var
|
|
19114
|
-
var
|
|
19183
|
+
var import_react120 = require("@floating-ui/react");
|
|
19184
|
+
var import_react121 = require("react");
|
|
19115
19185
|
|
|
19116
19186
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.ts
|
|
19117
19187
|
var import_css76 = require("@emotion/css");
|
|
19118
|
-
var
|
|
19119
|
-
var useStyles35 = (theme, colorScheme) => (0,
|
|
19188
|
+
var import_react119 = require("react");
|
|
19189
|
+
var useStyles35 = (theme, colorScheme) => (0, import_react119.useMemo)(() => {
|
|
19120
19190
|
const root = import_css76.css`
|
|
19121
19191
|
display: inline-block;
|
|
19122
19192
|
position: relative;
|
|
@@ -19237,23 +19307,23 @@ var BaseLanguageSwitcher = ({
|
|
|
19237
19307
|
}) => {
|
|
19238
19308
|
const { theme, colorScheme } = useTheme_default();
|
|
19239
19309
|
const styles = BaseLanguageSwitcher_styles_default(theme, colorScheme);
|
|
19240
|
-
const [isOpen, setIsOpen] = (0,
|
|
19310
|
+
const [isOpen, setIsOpen] = (0, import_react121.useState)(false);
|
|
19241
19311
|
const hasMultipleLanguages = languages.length > 1;
|
|
19242
|
-
(0,
|
|
19312
|
+
(0, import_react121.useEffect)(() => {
|
|
19243
19313
|
if (!hasMultipleLanguages && isOpen) {
|
|
19244
19314
|
setIsOpen(false);
|
|
19245
19315
|
}
|
|
19246
19316
|
}, [hasMultipleLanguages, isOpen]);
|
|
19247
|
-
const { refs, floatingStyles, context } = (0,
|
|
19248
|
-
middleware: [(0,
|
|
19317
|
+
const { refs, floatingStyles, context } = (0, import_react120.useFloating)({
|
|
19318
|
+
middleware: [(0, import_react120.offset)(4), (0, import_react120.flip)(), (0, import_react120.shift)()],
|
|
19249
19319
|
onOpenChange: setIsOpen,
|
|
19250
19320
|
open: isOpen,
|
|
19251
|
-
whileElementsMounted:
|
|
19321
|
+
whileElementsMounted: import_react120.autoUpdate
|
|
19252
19322
|
});
|
|
19253
|
-
const click = (0,
|
|
19254
|
-
const dismiss = (0,
|
|
19255
|
-
const role = (0,
|
|
19256
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
19323
|
+
const click = (0, import_react120.useClick)(context, { enabled: hasMultipleLanguages });
|
|
19324
|
+
const dismiss = (0, import_react120.useDismiss)(context, { enabled: hasMultipleLanguages });
|
|
19325
|
+
const role = (0, import_react120.useRole)(context, { enabled: hasMultipleLanguages, role: "listbox" });
|
|
19326
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react120.useInteractions)([click, dismiss, role]);
|
|
19257
19327
|
const currentOption = languages.find((l) => l.code === currentLanguage);
|
|
19258
19328
|
if (children) {
|
|
19259
19329
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_jsx_runtime126.Fragment, { children: children({
|
|
@@ -19280,7 +19350,7 @@ var BaseLanguageSwitcher = ({
|
|
|
19280
19350
|
]
|
|
19281
19351
|
}
|
|
19282
19352
|
),
|
|
19283
|
-
isOpen && hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
19353
|
+
isOpen && hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_react120.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_react120.FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
19284
19354
|
"div",
|
|
19285
19355
|
{
|
|
19286
19356
|
ref: refs.setFloating,
|
|
@@ -19316,12 +19386,12 @@ var BaseLanguageSwitcher_default = BaseLanguageSwitcher;
|
|
|
19316
19386
|
|
|
19317
19387
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
19318
19388
|
var import_browser100 = require("@asgardeo/browser");
|
|
19319
|
-
var
|
|
19389
|
+
var import_react123 = require("react");
|
|
19320
19390
|
|
|
19321
19391
|
// src/contexts/FlowMeta/useFlowMeta.ts
|
|
19322
|
-
var
|
|
19392
|
+
var import_react122 = require("react");
|
|
19323
19393
|
var useFlowMeta = () => {
|
|
19324
|
-
const context = (0,
|
|
19394
|
+
const context = (0, import_react122.useContext)(FlowMetaContext_default);
|
|
19325
19395
|
if (!context) {
|
|
19326
19396
|
throw new Error("useFlowMeta must be used within a FlowMetaProvider");
|
|
19327
19397
|
}
|
|
@@ -19335,11 +19405,11 @@ var LanguageSwitcher = ({ children, className }) => {
|
|
|
19335
19405
|
const { meta, switchLanguage, isLoading } = useFlowMeta_default();
|
|
19336
19406
|
const { currentLanguage } = useTranslation_default();
|
|
19337
19407
|
const availableLanguageCodes = meta?.i18n?.languages ?? [];
|
|
19338
|
-
const effectiveLanguageCodes = (0,
|
|
19408
|
+
const effectiveLanguageCodes = (0, import_react123.useMemo)(
|
|
19339
19409
|
() => availableLanguageCodes.length > 0 ? availableLanguageCodes : [currentLanguage],
|
|
19340
19410
|
[availableLanguageCodes, currentLanguage]
|
|
19341
19411
|
);
|
|
19342
|
-
const languages = (0,
|
|
19412
|
+
const languages = (0, import_react123.useMemo)(
|
|
19343
19413
|
() => effectiveLanguageCodes.map((code) => ({
|
|
19344
19414
|
code,
|
|
19345
19415
|
// Resolve each label in its own locale so option names stay stable across UI language switches.
|
|
@@ -19348,7 +19418,7 @@ var LanguageSwitcher = ({ children, className }) => {
|
|
|
19348
19418
|
})),
|
|
19349
19419
|
[effectiveLanguageCodes]
|
|
19350
19420
|
);
|
|
19351
|
-
(0,
|
|
19421
|
+
(0, import_react123.useEffect)(() => {
|
|
19352
19422
|
if (availableLanguageCodes.length > 0 && !availableLanguageCodes.includes(currentLanguage)) {
|
|
19353
19423
|
switchLanguage(availableLanguageCodes[0]);
|
|
19354
19424
|
}
|