@asgardeo/react 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1108 -809
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/adapters/Consent.d.ts +90 -0
- package/dist/components/adapters/ConsentCheckboxList.d.ts +94 -0
- package/dist/components/adapters/FlowTimer.d.ts +62 -0
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +8 -0
- package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +12 -0
- package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +956 -657
- package/dist/index.js.map +4 -4
- package/dist/utils/v2/flowTransformer.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -61,6 +61,8 @@ __export(index_exports, {
|
|
|
61
61
|
Checkbox: () => Checkbox_default,
|
|
62
62
|
CircleAlert: () => CircleAlert_default,
|
|
63
63
|
CircleCheck: () => CircleCheck_default,
|
|
64
|
+
Consent: () => Consent_default,
|
|
65
|
+
ConsentCheckboxList: () => ConsentCheckboxList_default,
|
|
64
66
|
CreateOrganization: () => CreateOrganization,
|
|
65
67
|
DatePicker: () => DatePicker_default,
|
|
66
68
|
Divider: () => Divider_default,
|
|
@@ -77,6 +79,7 @@ __export(index_exports, {
|
|
|
77
79
|
FieldFactory: () => FieldFactory,
|
|
78
80
|
FlowContext: () => FlowContext_default,
|
|
79
81
|
FlowProvider: () => FlowProvider_default,
|
|
82
|
+
FlowTimer: () => FlowTimer_default,
|
|
80
83
|
FormControl: () => FormControl_default,
|
|
81
84
|
GitHubButton: () => GitHubButton_default,
|
|
82
85
|
GoogleButton: () => GoogleButton_default,
|
|
@@ -135,6 +138,7 @@ __export(index_exports, {
|
|
|
135
138
|
createSignInOptionFromAuthenticator: () => createSignInOptionFromAuthenticator,
|
|
136
139
|
getActiveTheme: () => import_browser91.getActiveTheme,
|
|
137
140
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
141
|
+
getConsentOptionalKey: () => getConsentOptionalKey,
|
|
138
142
|
getMeOrganizations: () => getMeOrganizations_default,
|
|
139
143
|
getMeProfile: () => getScim2Me_default,
|
|
140
144
|
getOrganization: () => getOrganization_default,
|
|
@@ -7728,7 +7732,7 @@ var BaseSignIn_default = BaseSignIn;
|
|
|
7728
7732
|
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
7729
7733
|
var import_browser51 = require("@asgardeo/browser");
|
|
7730
7734
|
var import_css37 = require("@emotion/css");
|
|
7731
|
-
var
|
|
7735
|
+
var import_react64 = require("react");
|
|
7732
7736
|
|
|
7733
7737
|
// src/utils/v2/resolveTranslationsInObject.ts
|
|
7734
7738
|
var import_browser49 = require("@asgardeo/browser");
|
|
@@ -7840,7 +7844,16 @@ var normalizeFlowResponse = (response, t, options = {}, meta) => {
|
|
|
7840
7844
|
if (errorMessage && throwOnError) {
|
|
7841
7845
|
throw response;
|
|
7842
7846
|
}
|
|
7847
|
+
const additionalData = response?.data?.additionalData ?? {};
|
|
7848
|
+
if (typeof additionalData["consentPrompt"] === "string") {
|
|
7849
|
+
try {
|
|
7850
|
+
const parsed = JSON.parse(additionalData["consentPrompt"]);
|
|
7851
|
+
additionalData["consentPrompt"] = { purposes: Array.isArray(parsed) ? parsed : [] };
|
|
7852
|
+
} catch {
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7843
7855
|
return {
|
|
7856
|
+
additionalData,
|
|
7844
7857
|
components: transformComponents(response, t, resolveTranslations, meta),
|
|
7845
7858
|
flowId: response.flowId
|
|
7846
7859
|
};
|
|
@@ -7910,10 +7923,158 @@ var getAuthComponentHeadings_default = getAuthComponentHeadings;
|
|
|
7910
7923
|
var import_browser50 = require("@asgardeo/browser");
|
|
7911
7924
|
var import_css36 = require("@emotion/css");
|
|
7912
7925
|
var import_dompurify = __toESM(require("dompurify"), 1);
|
|
7926
|
+
var import_react63 = require("react");
|
|
7927
|
+
|
|
7928
|
+
// src/components/adapters/ConsentCheckboxList.tsx
|
|
7929
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
7930
|
+
var getConsentOptionalKey = (purposeId, attrName) => `__consent_opt__${purposeId}__${attrName}`;
|
|
7931
|
+
var ConsentCheckboxList = ({
|
|
7932
|
+
variant,
|
|
7933
|
+
purpose,
|
|
7934
|
+
formValues,
|
|
7935
|
+
onInputChange,
|
|
7936
|
+
children
|
|
7937
|
+
}) => {
|
|
7938
|
+
const attributes = variant === "ESSENTIAL" ? purpose.essential : purpose.optional;
|
|
7939
|
+
if (!attributes || attributes.length === 0) {
|
|
7940
|
+
return null;
|
|
7941
|
+
}
|
|
7942
|
+
const isEssential = variant === "ESSENTIAL";
|
|
7943
|
+
const isChecked = (attrName) => {
|
|
7944
|
+
if (isEssential) {
|
|
7945
|
+
return true;
|
|
7946
|
+
}
|
|
7947
|
+
const key = getConsentOptionalKey(purpose.purpose_id, attrName);
|
|
7948
|
+
return formValues[key] !== "false";
|
|
7949
|
+
};
|
|
7950
|
+
const handleChange = (attrName, checked) => {
|
|
7951
|
+
const key = getConsentOptionalKey(purpose.purpose_id, attrName);
|
|
7952
|
+
onInputChange(key, checked ? "true" : "false");
|
|
7953
|
+
};
|
|
7954
|
+
if (children) {
|
|
7955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: children({ attributes, handleChange, isChecked, variant }) });
|
|
7956
|
+
}
|
|
7957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7958
|
+
"div",
|
|
7959
|
+
{
|
|
7960
|
+
style: {
|
|
7961
|
+
display: "flex",
|
|
7962
|
+
flexDirection: "column",
|
|
7963
|
+
gap: "0.25rem",
|
|
7964
|
+
margin: "0.25rem 0 0.5rem"
|
|
7965
|
+
},
|
|
7966
|
+
children: attributes.map((attr) => {
|
|
7967
|
+
const inputId = `consent_${isEssential ? "ess" : "opt"}_${purpose.purpose_id}_${attr}`;
|
|
7968
|
+
const checked = isChecked(attr);
|
|
7969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7970
|
+
Checkbox_default,
|
|
7971
|
+
{
|
|
7972
|
+
id: inputId,
|
|
7973
|
+
checked,
|
|
7974
|
+
disabled: isEssential,
|
|
7975
|
+
label: attr,
|
|
7976
|
+
onChange: isEssential ? void 0 : (e) => handleChange(attr, e.target.checked)
|
|
7977
|
+
},
|
|
7978
|
+
attr
|
|
7979
|
+
);
|
|
7980
|
+
})
|
|
7981
|
+
}
|
|
7982
|
+
);
|
|
7983
|
+
};
|
|
7984
|
+
var ConsentCheckboxList_default = ConsentCheckboxList;
|
|
7985
|
+
|
|
7986
|
+
// src/components/adapters/Consent.tsx
|
|
7987
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
7988
|
+
var Consent = ({ consentData, formValues, onInputChange, children }) => {
|
|
7989
|
+
if (!consentData) return null;
|
|
7990
|
+
let purposes = [];
|
|
7991
|
+
try {
|
|
7992
|
+
const parsed = typeof consentData === "string" ? JSON.parse(consentData) : consentData;
|
|
7993
|
+
purposes = Array.isArray(parsed) ? parsed : parsed.purposes || [];
|
|
7994
|
+
} catch (e) {
|
|
7995
|
+
return null;
|
|
7996
|
+
}
|
|
7997
|
+
if (purposes.length === 0) return null;
|
|
7998
|
+
if (children) {
|
|
7999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: children({ formValues, onInputChange, purposes }) });
|
|
8000
|
+
}
|
|
8001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "1rem", marginTop: "0.25rem" }, children: purposes.map((purpose, purposeIndex) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { style: { paddingBottom: "1rem" }, children: [
|
|
8002
|
+
purpose.essential && purpose.essential.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { style: { marginTop: "0.5rem" }, children: [
|
|
8003
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Typography_default, { variant: "subtitle2", fontWeight: "bold", children: "Essential Attributes" }),
|
|
8004
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8005
|
+
ConsentCheckboxList_default,
|
|
8006
|
+
{
|
|
8007
|
+
variant: "ESSENTIAL",
|
|
8008
|
+
purpose,
|
|
8009
|
+
formValues,
|
|
8010
|
+
onInputChange
|
|
8011
|
+
}
|
|
8012
|
+
)
|
|
8013
|
+
] }),
|
|
8014
|
+
purpose.optional && purpose.optional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { style: { marginTop: "0.5rem" }, children: [
|
|
8015
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Typography_default, { variant: "subtitle2", fontWeight: "bold", children: "Optional Attributes" }),
|
|
8016
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8017
|
+
ConsentCheckboxList_default,
|
|
8018
|
+
{
|
|
8019
|
+
variant: "OPTIONAL",
|
|
8020
|
+
purpose,
|
|
8021
|
+
formValues,
|
|
8022
|
+
onInputChange
|
|
8023
|
+
}
|
|
8024
|
+
)
|
|
8025
|
+
] })
|
|
8026
|
+
] }, purpose.purpose_id || purposeIndex)) });
|
|
8027
|
+
};
|
|
8028
|
+
var Consent_default = Consent;
|
|
8029
|
+
|
|
8030
|
+
// src/components/adapters/FlowTimer.tsx
|
|
7913
8031
|
var import_react62 = require("react");
|
|
8032
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8033
|
+
var FlowTimer = ({
|
|
8034
|
+
expiresIn = 0,
|
|
8035
|
+
textTemplate = "Time remaining: {time}",
|
|
8036
|
+
children
|
|
8037
|
+
}) => {
|
|
8038
|
+
const [remaining, setRemaining] = (0, import_react62.useState)(expiresIn > 0 ? expiresIn : 0);
|
|
8039
|
+
(0, import_react62.useEffect)(() => {
|
|
8040
|
+
if (expiresIn <= 0) {
|
|
8041
|
+
return void 0;
|
|
8042
|
+
}
|
|
8043
|
+
setRemaining(expiresIn);
|
|
8044
|
+
const interval = setInterval(() => {
|
|
8045
|
+
setRemaining((prev) => {
|
|
8046
|
+
if (prev <= 1) {
|
|
8047
|
+
clearInterval(interval);
|
|
8048
|
+
return 0;
|
|
8049
|
+
}
|
|
8050
|
+
return prev - 1;
|
|
8051
|
+
});
|
|
8052
|
+
}, 1e3);
|
|
8053
|
+
return () => clearInterval(interval);
|
|
8054
|
+
}, [expiresIn]);
|
|
8055
|
+
if (expiresIn <= 0) {
|
|
8056
|
+
return null;
|
|
8057
|
+
}
|
|
8058
|
+
const formatTime = (seconds) => {
|
|
8059
|
+
if (seconds <= 0) {
|
|
8060
|
+
return "Timed out";
|
|
8061
|
+
}
|
|
8062
|
+
const m = Math.floor(seconds / 60);
|
|
8063
|
+
const s = seconds % 60;
|
|
8064
|
+
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
8065
|
+
};
|
|
8066
|
+
const isExpired = remaining <= 0;
|
|
8067
|
+
const formattedTime = formatTime(remaining);
|
|
8068
|
+
if (children) {
|
|
8069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, { children: children({ formattedTime, isExpired, remaining }) });
|
|
8070
|
+
}
|
|
8071
|
+
const displayText = isExpired ? "Timed out" : textTemplate.replace("{time}", formattedTime);
|
|
8072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography_default, { variant: "body2", children: displayText });
|
|
8073
|
+
};
|
|
8074
|
+
var FlowTimer_default = FlowTimer;
|
|
7914
8075
|
|
|
7915
8076
|
// src/components/adapters/ImageComponent.tsx
|
|
7916
|
-
var
|
|
8077
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7917
8078
|
var ImageComponent = ({ component }) => {
|
|
7918
8079
|
const { theme } = useTheme_default();
|
|
7919
8080
|
const config = component.config || {};
|
|
@@ -7930,7 +8091,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7930
8091
|
if (!src) {
|
|
7931
8092
|
return null;
|
|
7932
8093
|
}
|
|
7933
|
-
return /* @__PURE__ */ (0,
|
|
8094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7934
8095
|
"img",
|
|
7935
8096
|
{
|
|
7936
8097
|
src,
|
|
@@ -7947,7 +8108,7 @@ var ImageComponent = ({ component }) => {
|
|
|
7947
8108
|
var ImageComponent_default = ImageComponent;
|
|
7948
8109
|
|
|
7949
8110
|
// src/components/adapters/SmsOtpButton.tsx
|
|
7950
|
-
var
|
|
8111
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
7951
8112
|
var SmsOtpButton = ({
|
|
7952
8113
|
isLoading,
|
|
7953
8114
|
preferences,
|
|
@@ -7955,7 +8116,7 @@ var SmsOtpButton = ({
|
|
|
7955
8116
|
...rest
|
|
7956
8117
|
}) => {
|
|
7957
8118
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
7958
|
-
return /* @__PURE__ */ (0,
|
|
8119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7959
8120
|
Button_default,
|
|
7960
8121
|
{
|
|
7961
8122
|
...rest,
|
|
@@ -7964,7 +8125,7 @@ var SmsOtpButton = ({
|
|
|
7964
8125
|
color: "secondary",
|
|
7965
8126
|
variant: "solid",
|
|
7966
8127
|
disabled: isLoading,
|
|
7967
|
-
startIcon: /* @__PURE__ */ (0,
|
|
8128
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7968
8129
|
"path",
|
|
7969
8130
|
{
|
|
7970
8131
|
fill: "currentColor",
|
|
@@ -7978,8 +8139,8 @@ var SmsOtpButton = ({
|
|
|
7978
8139
|
var SmsOtpButton_default = SmsOtpButton;
|
|
7979
8140
|
|
|
7980
8141
|
// src/components/primitives/Icons/ArrowLeftRight.tsx
|
|
7981
|
-
var
|
|
7982
|
-
var ArrowLeftRight = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */ (0,
|
|
8142
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8143
|
+
var ArrowLeftRight = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
7983
8144
|
"svg",
|
|
7984
8145
|
{
|
|
7985
8146
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7992,10 +8153,10 @@ var ArrowLeftRight = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */
|
|
|
7992
8153
|
strokeLinecap: "round",
|
|
7993
8154
|
strokeLinejoin: "round",
|
|
7994
8155
|
children: [
|
|
7995
|
-
/* @__PURE__ */ (0,
|
|
7996
|
-
/* @__PURE__ */ (0,
|
|
7997
|
-
/* @__PURE__ */ (0,
|
|
7998
|
-
/* @__PURE__ */ (0,
|
|
8156
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: "M8 3 4 7l4 4" }),
|
|
8157
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: "M4 7h16" }),
|
|
8158
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: "m16 21 4-4-4-4" }),
|
|
8159
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: "M20 17H4" })
|
|
7999
8160
|
]
|
|
8000
8161
|
}
|
|
8001
8162
|
);
|
|
@@ -8003,8 +8164,8 @@ ArrowLeftRight.displayName = "ArrowLeftRight";
|
|
|
8003
8164
|
var ArrowLeftRight_default = ArrowLeftRight;
|
|
8004
8165
|
|
|
8005
8166
|
// src/components/primitives/Icons/ArrowRightLeft.tsx
|
|
8006
|
-
var
|
|
8007
|
-
var ArrowRightLeft = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */ (0,
|
|
8167
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
8168
|
+
var ArrowRightLeft = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
8008
8169
|
"svg",
|
|
8009
8170
|
{
|
|
8010
8171
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -8017,10 +8178,10 @@ var ArrowRightLeft = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */
|
|
|
8017
8178
|
strokeLinecap: "round",
|
|
8018
8179
|
strokeLinejoin: "round",
|
|
8019
8180
|
children: [
|
|
8020
|
-
/* @__PURE__ */ (0,
|
|
8021
|
-
/* @__PURE__ */ (0,
|
|
8022
|
-
/* @__PURE__ */ (0,
|
|
8023
|
-
/* @__PURE__ */ (0,
|
|
8181
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "m16 3 4 4-4 4" }),
|
|
8182
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "M20 7H4" }),
|
|
8183
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "m8 21-4-4 4-4" }),
|
|
8184
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "M4 17h16" })
|
|
8024
8185
|
]
|
|
8025
8186
|
}
|
|
8026
8187
|
);
|
|
@@ -8035,7 +8196,7 @@ var flowIconRegistry = {
|
|
|
8035
8196
|
var flowIconRegistry_default = flowIconRegistry;
|
|
8036
8197
|
|
|
8037
8198
|
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
8038
|
-
var
|
|
8199
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8039
8200
|
var logger5 = (0, import_browser50.createPackageComponentLogger)(
|
|
8040
8201
|
"@asgardeo/react",
|
|
8041
8202
|
"AuthOptionFactory"
|
|
@@ -8116,7 +8277,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8116
8277
|
type: fieldType,
|
|
8117
8278
|
value
|
|
8118
8279
|
});
|
|
8119
|
-
return (0,
|
|
8280
|
+
return (0, import_react63.cloneElement)(field, { key });
|
|
8120
8281
|
}
|
|
8121
8282
|
case import_browser50.EmbeddedFlowComponentTypeV2.Action: {
|
|
8122
8283
|
const actionId = component.id;
|
|
@@ -8130,31 +8291,53 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8130
8291
|
Object.keys(formValues).forEach((field) => {
|
|
8131
8292
|
formData[field] = formValues[field];
|
|
8132
8293
|
});
|
|
8294
|
+
const consentPrompt = options.additionalData?.["consentPrompt"];
|
|
8295
|
+
if (consentPrompt && eventType.toUpperCase() === import_browser50.EmbeddedFlowEventTypeV2.Submit) {
|
|
8296
|
+
const isDeny = componentVariant.toLowerCase() !== "primary";
|
|
8297
|
+
const decisions = {
|
|
8298
|
+
purposes: consentPrompt.purposes.map(
|
|
8299
|
+
(p) => ({
|
|
8300
|
+
approved: !isDeny,
|
|
8301
|
+
elements: [
|
|
8302
|
+
...p.essential.map((attr) => ({ approved: !isDeny, name: attr })),
|
|
8303
|
+
...p.optional.map(
|
|
8304
|
+
(attr) => ({
|
|
8305
|
+
approved: isDeny ? false : formValues[getConsentOptionalKey(p.purpose_id, attr)] !== "false",
|
|
8306
|
+
name: attr
|
|
8307
|
+
})
|
|
8308
|
+
)
|
|
8309
|
+
],
|
|
8310
|
+
purpose_name: p.purpose_name
|
|
8311
|
+
})
|
|
8312
|
+
)
|
|
8313
|
+
};
|
|
8314
|
+
formData["consent_decisions"] = JSON.stringify(decisions);
|
|
8315
|
+
}
|
|
8133
8316
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
8134
8317
|
}
|
|
8135
8318
|
};
|
|
8136
8319
|
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType, componentVariant)) {
|
|
8137
|
-
return /* @__PURE__ */ (0,
|
|
8320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GoogleButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8138
8321
|
}
|
|
8139
8322
|
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType, componentVariant)) {
|
|
8140
|
-
return /* @__PURE__ */ (0,
|
|
8323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GitHubButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8141
8324
|
}
|
|
8142
8325
|
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType, componentVariant)) {
|
|
8143
|
-
return /* @__PURE__ */ (0,
|
|
8326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FacebookButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8144
8327
|
}
|
|
8145
8328
|
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType, componentVariant)) {
|
|
8146
|
-
return /* @__PURE__ */ (0,
|
|
8329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MicrosoftButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8147
8330
|
}
|
|
8148
8331
|
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType, componentVariant)) {
|
|
8149
|
-
return /* @__PURE__ */ (0,
|
|
8332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LinkedInButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8150
8333
|
}
|
|
8151
8334
|
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType, componentVariant)) {
|
|
8152
|
-
return /* @__PURE__ */ (0,
|
|
8335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SignInWithEthereumButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8153
8336
|
}
|
|
8154
8337
|
if (actionId === "prompt_mobile" || eventType === "prompt_mobile") {
|
|
8155
|
-
return /* @__PURE__ */ (0,
|
|
8338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SmsOtpButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8156
8339
|
}
|
|
8157
|
-
const startIconEl = component.startIcon ? /* @__PURE__ */ (0,
|
|
8340
|
+
const startIconEl = component.startIcon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8158
8341
|
"img",
|
|
8159
8342
|
{
|
|
8160
8343
|
src: component.startIcon,
|
|
@@ -8163,7 +8346,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8163
8346
|
style: { height: "1.25em", objectFit: "contain", width: "1.25em" }
|
|
8164
8347
|
}
|
|
8165
8348
|
) : null;
|
|
8166
|
-
const endIconEl = component.endIcon ? /* @__PURE__ */ (0,
|
|
8349
|
+
const endIconEl = component.endIcon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8167
8350
|
"img",
|
|
8168
8351
|
{
|
|
8169
8352
|
src: component.endIcon,
|
|
@@ -8172,12 +8355,12 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8172
8355
|
style: { height: "1.25em", objectFit: "contain", width: "1.25em" }
|
|
8173
8356
|
}
|
|
8174
8357
|
) : null;
|
|
8175
|
-
return /* @__PURE__ */ (0,
|
|
8358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8176
8359
|
Button_default,
|
|
8177
8360
|
{
|
|
8178
8361
|
fullWidth: true,
|
|
8179
8362
|
onClick: handleClick,
|
|
8180
|
-
disabled: isLoading || !isFormValid,
|
|
8363
|
+
disabled: isLoading || !isFormValid && !shouldSkipValidation || options.isTimeoutDisabled || component.config?.disabled,
|
|
8181
8364
|
className: options.buttonClassName,
|
|
8182
8365
|
"data-testid": "asgardeo-signin-submit",
|
|
8183
8366
|
variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline",
|
|
@@ -8191,10 +8374,10 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8191
8374
|
}
|
|
8192
8375
|
case import_browser50.EmbeddedFlowComponentTypeV2.Text: {
|
|
8193
8376
|
const variant = getTypographyVariant(component.variant);
|
|
8194
|
-
return /* @__PURE__ */ (0,
|
|
8377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Typography_default, { variant, children: resolve(component.label) }, key);
|
|
8195
8378
|
}
|
|
8196
8379
|
case import_browser50.EmbeddedFlowComponentTypeV2.Divider: {
|
|
8197
|
-
return /* @__PURE__ */ (0,
|
|
8380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Divider_default, { children: resolve(component.label) || "" }, key);
|
|
8198
8381
|
}
|
|
8199
8382
|
case import_browser50.EmbeddedFlowComponentTypeV2.Select: {
|
|
8200
8383
|
const identifier = component.ref;
|
|
@@ -8205,7 +8388,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8205
8388
|
label: typeof opt === "string" ? opt : String(opt.label ?? opt.value ?? ""),
|
|
8206
8389
|
value: typeof opt === "string" ? opt : String(opt.value ?? "")
|
|
8207
8390
|
}));
|
|
8208
|
-
return /* @__PURE__ */ (0,
|
|
8391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8209
8392
|
Select_default,
|
|
8210
8393
|
{
|
|
8211
8394
|
name: identifier,
|
|
@@ -8240,12 +8423,12 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8240
8423
|
}
|
|
8241
8424
|
)
|
|
8242
8425
|
).filter(Boolean);
|
|
8243
|
-
return /* @__PURE__ */ (0,
|
|
8426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { id: component.id, children: blockComponents }, key);
|
|
8244
8427
|
}
|
|
8245
8428
|
return null;
|
|
8246
8429
|
}
|
|
8247
8430
|
case import_browser50.EmbeddedFlowComponentTypeV2.RichText: {
|
|
8248
|
-
return /* @__PURE__ */ (0,
|
|
8431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8249
8432
|
"div",
|
|
8250
8433
|
{
|
|
8251
8434
|
className: richTextClass,
|
|
@@ -8257,7 +8440,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8257
8440
|
case import_browser50.EmbeddedFlowComponentTypeV2.Image: {
|
|
8258
8441
|
const explicitHeight = resolve(component.height?.toString());
|
|
8259
8442
|
const explicitWidth = resolve(component.width?.toString());
|
|
8260
|
-
return /* @__PURE__ */ (0,
|
|
8443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8261
8444
|
ImageComponent_default,
|
|
8262
8445
|
{
|
|
8263
8446
|
component: {
|
|
@@ -8287,7 +8470,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8287
8470
|
logger5.warn(`Unknown icon name: "${iconName}". Skipping render.`);
|
|
8288
8471
|
return null;
|
|
8289
8472
|
}
|
|
8290
|
-
return /* @__PURE__ */ (0,
|
|
8473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(IconComponent, { size: component.size || 24, color: component.color || "currentColor" }, key);
|
|
8291
8474
|
}
|
|
8292
8475
|
case import_browser50.EmbeddedFlowComponentTypeV2.Stack: {
|
|
8293
8476
|
const direction = component.direction || "row";
|
|
@@ -8319,7 +8502,26 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8319
8502
|
}
|
|
8320
8503
|
)
|
|
8321
8504
|
) : [];
|
|
8322
|
-
return /* @__PURE__ */ (0,
|
|
8505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { style: stackStyle, children: stackChildren }, key);
|
|
8506
|
+
}
|
|
8507
|
+
case import_browser50.EmbeddedFlowComponentTypeV2.Consent: {
|
|
8508
|
+
const consentPromptRawData = options.additionalData?.["consentPrompt"];
|
|
8509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8510
|
+
Consent_default,
|
|
8511
|
+
{
|
|
8512
|
+
consentData: consentPromptRawData,
|
|
8513
|
+
formValues,
|
|
8514
|
+
onInputChange
|
|
8515
|
+
},
|
|
8516
|
+
key
|
|
8517
|
+
);
|
|
8518
|
+
}
|
|
8519
|
+
case import_browser50.EmbeddedFlowComponentTypeV2.Timer: {
|
|
8520
|
+
const timerConfig = component.config || {};
|
|
8521
|
+
const textTemplate = timerConfig.text || "Time remaining: {time}";
|
|
8522
|
+
const timeoutMs = Number(options.additionalData?.["stepTimeout"]) || 0;
|
|
8523
|
+
const expiresIn = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3)) : 0;
|
|
8524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FlowTimer_default, { expiresIn, textTemplate }, key);
|
|
8323
8525
|
}
|
|
8324
8526
|
default:
|
|
8325
8527
|
logger5.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
@@ -8376,7 +8578,7 @@ var renderInviteUserComponents = (components, formValues, touchedFields, formErr
|
|
|
8376
8578
|
).filter(Boolean);
|
|
8377
8579
|
|
|
8378
8580
|
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
8379
|
-
var
|
|
8581
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
8380
8582
|
var BaseSignInContent2 = ({
|
|
8381
8583
|
components = [],
|
|
8382
8584
|
onSubmit,
|
|
@@ -8391,17 +8593,19 @@ var BaseSignInContent2 = ({
|
|
|
8391
8593
|
isLoading: externalIsLoading,
|
|
8392
8594
|
children,
|
|
8393
8595
|
showTitle = true,
|
|
8394
|
-
showSubtitle = true
|
|
8596
|
+
showSubtitle = true,
|
|
8597
|
+
additionalData = {},
|
|
8598
|
+
isTimeoutDisabled = false
|
|
8395
8599
|
}) => {
|
|
8396
8600
|
const { meta } = useAsgardeo_default();
|
|
8397
8601
|
const { theme } = useTheme_default();
|
|
8398
8602
|
const { t } = useTranslation_default();
|
|
8399
8603
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
8400
8604
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
8401
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
8402
|
-
const [apiError, setApiError] = (0,
|
|
8605
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react64.useState)(false);
|
|
8606
|
+
const [apiError, setApiError] = (0, import_react64.useState)(null);
|
|
8403
8607
|
const isLoading = externalIsLoading || isSubmitting;
|
|
8404
|
-
const handleError = (0,
|
|
8608
|
+
const handleError = (0, import_react64.useCallback)(
|
|
8405
8609
|
(error) => {
|
|
8406
8610
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
8407
8611
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -8413,7 +8617,7 @@ var BaseSignInContent2 = ({
|
|
|
8413
8617
|
},
|
|
8414
8618
|
[t, addMessage, clearMessages]
|
|
8415
8619
|
);
|
|
8416
|
-
const extractFormFields = (0,
|
|
8620
|
+
const extractFormFields = (0, import_react64.useCallback)(
|
|
8417
8621
|
(flowComponents) => {
|
|
8418
8622
|
const fields = [];
|
|
8419
8623
|
const processComponents = (comps) => {
|
|
@@ -8528,7 +8732,7 @@ var BaseSignInContent2 = ({
|
|
|
8528
8732
|
buttonClassName
|
|
8529
8733
|
);
|
|
8530
8734
|
const messageClasses = (0, import_css37.cx)([(0, import_browser51.withVendorCSSClassPrefix)("signin__messages")], messageClassName);
|
|
8531
|
-
const renderComponents = (0,
|
|
8735
|
+
const renderComponents = (0, import_react64.useCallback)(
|
|
8532
8736
|
(flowComponents) => renderSignInComponents(
|
|
8533
8737
|
flowComponents,
|
|
8534
8738
|
formValues,
|
|
@@ -8538,8 +8742,10 @@ var BaseSignInContent2 = ({
|
|
|
8538
8742
|
isFormValid,
|
|
8539
8743
|
handleInputChange,
|
|
8540
8744
|
{
|
|
8745
|
+
additionalData,
|
|
8541
8746
|
buttonClassName: buttonClasses,
|
|
8542
8747
|
inputClassName: inputClasses,
|
|
8748
|
+
isTimeoutDisabled,
|
|
8543
8749
|
meta,
|
|
8544
8750
|
onInputBlur: handleInputBlur,
|
|
8545
8751
|
onSubmit: handleSubmit,
|
|
@@ -8549,6 +8755,7 @@ var BaseSignInContent2 = ({
|
|
|
8549
8755
|
}
|
|
8550
8756
|
),
|
|
8551
8757
|
[
|
|
8758
|
+
additionalData,
|
|
8552
8759
|
formValues,
|
|
8553
8760
|
touchedFields,
|
|
8554
8761
|
formErrors,
|
|
@@ -8561,7 +8768,8 @@ var BaseSignInContent2 = ({
|
|
|
8561
8768
|
inputClasses,
|
|
8562
8769
|
buttonClasses,
|
|
8563
8770
|
handleInputBlur,
|
|
8564
|
-
handleSubmit
|
|
8771
|
+
handleSubmit,
|
|
8772
|
+
isTimeoutDisabled
|
|
8565
8773
|
]
|
|
8566
8774
|
);
|
|
8567
8775
|
if (children) {
|
|
@@ -8572,6 +8780,7 @@ var BaseSignInContent2 = ({
|
|
|
8572
8780
|
handleInputChange,
|
|
8573
8781
|
handleSubmit,
|
|
8574
8782
|
isLoading,
|
|
8783
|
+
isTimeoutDisabled,
|
|
8575
8784
|
isValid: isFormValid,
|
|
8576
8785
|
messages: flowMessages || [],
|
|
8577
8786
|
meta,
|
|
@@ -8584,13 +8793,13 @@ var BaseSignInContent2 = ({
|
|
|
8584
8793
|
},
|
|
8585
8794
|
values: formValues
|
|
8586
8795
|
};
|
|
8587
|
-
return /* @__PURE__ */ (0,
|
|
8796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: containerClasses, "data-testid": "asgardeo-signin", children: children(renderProps) });
|
|
8588
8797
|
}
|
|
8589
8798
|
if (isLoading) {
|
|
8590
|
-
return /* @__PURE__ */ (0,
|
|
8799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Spinner_default, {}) }) }) });
|
|
8591
8800
|
}
|
|
8592
8801
|
if (!components || components.length === 0) {
|
|
8593
|
-
return /* @__PURE__ */ (0,
|
|
8802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", children: t("errors.signin.components.not.available") }) }) }) });
|
|
8594
8803
|
}
|
|
8595
8804
|
const {
|
|
8596
8805
|
title: rawTitle,
|
|
@@ -8599,46 +8808,46 @@ var BaseSignInContent2 = ({
|
|
|
8599
8808
|
} = getAuthComponentHeadings_default(components, flowTitle, flowSubtitle, void 0, void 0);
|
|
8600
8809
|
const title = (0, import_browser51.resolveVars)(rawTitle, { meta, t });
|
|
8601
8810
|
const subtitle = (0, import_browser51.resolveVars)(rawSubtitle, { meta, t });
|
|
8602
|
-
return /* @__PURE__ */ (0,
|
|
8603
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
8604
|
-
showTitle && /* @__PURE__ */ (0,
|
|
8605
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
8811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: [
|
|
8812
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
8813
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
8814
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
8606
8815
|
] }),
|
|
8607
|
-
/* @__PURE__ */ (0,
|
|
8608
|
-
externalError && /* @__PURE__ */ (0,
|
|
8609
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
8816
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Content, { children: [
|
|
8817
|
+
externalError && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default, { variant: "error", className: (0, import_css37.cx)(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: externalError.message }) }) }),
|
|
8818
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
8610
8819
|
Alert_default,
|
|
8611
8820
|
{
|
|
8612
8821
|
variant: message.type === "error" ? "error" : "info",
|
|
8613
8822
|
className: (0, import_css37.cx)(styles.flowMessageItem, messageClasses),
|
|
8614
|
-
children: /* @__PURE__ */ (0,
|
|
8823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: message.message })
|
|
8615
8824
|
},
|
|
8616
8825
|
index
|
|
8617
8826
|
)) }),
|
|
8618
|
-
/* @__PURE__ */ (0,
|
|
8827
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.contentContainer, children: componentsWithoutHeadings && renderComponents(componentsWithoutHeadings) })
|
|
8619
8828
|
] })
|
|
8620
8829
|
] });
|
|
8621
8830
|
};
|
|
8622
8831
|
var BaseSignIn2 = ({ preferences, showLogo = true, ...rest }) => {
|
|
8623
8832
|
const { theme } = useTheme_default();
|
|
8624
8833
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
8625
|
-
const content = /* @__PURE__ */ (0,
|
|
8626
|
-
showLogo && /* @__PURE__ */ (0,
|
|
8627
|
-
/* @__PURE__ */ (0,
|
|
8834
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
8835
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Logo_default, { size: "large" }) }),
|
|
8836
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BaseSignInContent2, { showLogo, ...rest }) })
|
|
8628
8837
|
] });
|
|
8629
8838
|
if (!preferences) return content;
|
|
8630
|
-
return /* @__PURE__ */ (0,
|
|
8839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ComponentPreferencesContext_default.Provider, { value: preferences, children: content });
|
|
8631
8840
|
};
|
|
8632
8841
|
var BaseSignIn_default2 = BaseSignIn2;
|
|
8633
8842
|
|
|
8634
8843
|
// src/components/presentation/auth/SignIn/BaseSignIn.tsx
|
|
8635
|
-
var
|
|
8844
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
8636
8845
|
var BaseSignIn3 = (props) => {
|
|
8637
8846
|
const { platform } = useAsgardeo_default();
|
|
8638
8847
|
if (platform === import_browser52.Platform.AsgardeoV2) {
|
|
8639
|
-
return /* @__PURE__ */ (0,
|
|
8848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BaseSignIn_default2, { ...props });
|
|
8640
8849
|
}
|
|
8641
|
-
return /* @__PURE__ */ (0,
|
|
8850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BaseSignIn_default, { ...props });
|
|
8642
8851
|
};
|
|
8643
8852
|
var BaseSignIn_default3 = BaseSignIn3;
|
|
8644
8853
|
|
|
@@ -8647,10 +8856,10 @@ var import_browser56 = require("@asgardeo/browser");
|
|
|
8647
8856
|
|
|
8648
8857
|
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
8649
8858
|
var import_browser55 = require("@asgardeo/browser");
|
|
8650
|
-
var
|
|
8859
|
+
var import_react66 = require("react");
|
|
8651
8860
|
|
|
8652
8861
|
// src/hooks/v2/useOAuthCallback.ts
|
|
8653
|
-
var
|
|
8862
|
+
var import_react65 = require("react");
|
|
8654
8863
|
function cleanupUrlParams() {
|
|
8655
8864
|
if (typeof window === "undefined") return;
|
|
8656
8865
|
const url = new URL(window.location.href);
|
|
@@ -8675,9 +8884,9 @@ function useOAuthCallback({
|
|
|
8675
8884
|
setFlowId,
|
|
8676
8885
|
tokenValidationAttemptedRef
|
|
8677
8886
|
}) {
|
|
8678
|
-
const internalRef = (0,
|
|
8887
|
+
const internalRef = (0, import_react65.useRef)(false);
|
|
8679
8888
|
const oauthCodeProcessedRef = processedRef ?? internalRef;
|
|
8680
|
-
(0,
|
|
8889
|
+
(0, import_react65.useEffect)(() => {
|
|
8681
8890
|
if (!isInitialized || isSubmitting) {
|
|
8682
8891
|
return;
|
|
8683
8892
|
}
|
|
@@ -8923,7 +9132,7 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8923
9132
|
};
|
|
8924
9133
|
|
|
8925
9134
|
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
8926
|
-
var
|
|
9135
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
8927
9136
|
var SignIn = ({
|
|
8928
9137
|
className,
|
|
8929
9138
|
preferences,
|
|
@@ -8935,12 +9144,14 @@ var SignIn = ({
|
|
|
8935
9144
|
}) => {
|
|
8936
9145
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading, meta } = useAsgardeo_default();
|
|
8937
9146
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
8938
|
-
const [components, setComponents] = (0,
|
|
8939
|
-
const [
|
|
8940
|
-
const [
|
|
8941
|
-
const [
|
|
8942
|
-
const [
|
|
8943
|
-
const [
|
|
9147
|
+
const [components, setComponents] = (0, import_react66.useState)([]);
|
|
9148
|
+
const [additionalData, setAdditionalData] = (0, import_react66.useState)({});
|
|
9149
|
+
const [currentFlowId, setCurrentFlowId] = (0, import_react66.useState)(null);
|
|
9150
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react66.useState)(false);
|
|
9151
|
+
const [flowError, setFlowError] = (0, import_react66.useState)(null);
|
|
9152
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react66.useState)(false);
|
|
9153
|
+
const [isTimeoutDisabled, setIsTimeoutDisabled] = (0, import_react66.useState)(false);
|
|
9154
|
+
const [passkeyState, setPasskeyState] = (0, import_react66.useState)({
|
|
8944
9155
|
actionId: null,
|
|
8945
9156
|
challenge: null,
|
|
8946
9157
|
creationOptions: null,
|
|
@@ -8948,9 +9159,9 @@ var SignIn = ({
|
|
|
8948
9159
|
flowId: null,
|
|
8949
9160
|
isActive: false
|
|
8950
9161
|
});
|
|
8951
|
-
const initializationAttemptedRef = (0,
|
|
8952
|
-
const oauthCodeProcessedRef = (0,
|
|
8953
|
-
const passkeyProcessedRef = (0,
|
|
9162
|
+
const initializationAttemptedRef = (0, import_react66.useRef)(false);
|
|
9163
|
+
const oauthCodeProcessedRef = (0, import_react66.useRef)(false);
|
|
9164
|
+
const passkeyProcessedRef = (0, import_react66.useRef)(false);
|
|
8954
9165
|
const setFlowId = (flowId) => {
|
|
8955
9166
|
setCurrentFlowId(flowId);
|
|
8956
9167
|
if (flowId) {
|
|
@@ -8963,6 +9174,7 @@ var SignIn = ({
|
|
|
8963
9174
|
setFlowId(null);
|
|
8964
9175
|
setIsFlowInitialized(false);
|
|
8965
9176
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
9177
|
+
setIsTimeoutDisabled(false);
|
|
8966
9178
|
oauthCodeProcessedRef.current = false;
|
|
8967
9179
|
};
|
|
8968
9180
|
const getUrlParams2 = () => {
|
|
@@ -9060,7 +9272,11 @@ var SignIn = ({
|
|
|
9060
9272
|
if (handleRedirection(response)) {
|
|
9061
9273
|
return;
|
|
9062
9274
|
}
|
|
9063
|
-
const {
|
|
9275
|
+
const {
|
|
9276
|
+
flowId: normalizedFlowId,
|
|
9277
|
+
components: normalizedComponents,
|
|
9278
|
+
additionalData: normalizedAdditionalData
|
|
9279
|
+
} = normalizeFlowResponse(
|
|
9064
9280
|
response,
|
|
9065
9281
|
t,
|
|
9066
9282
|
{
|
|
@@ -9071,7 +9287,9 @@ var SignIn = ({
|
|
|
9071
9287
|
if (normalizedFlowId && normalizedComponents) {
|
|
9072
9288
|
setFlowId(normalizedFlowId);
|
|
9073
9289
|
setComponents(normalizedComponents);
|
|
9290
|
+
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9074
9291
|
setIsFlowInitialized(true);
|
|
9292
|
+
setIsTimeoutDisabled(false);
|
|
9075
9293
|
cleanupFlowUrlParams();
|
|
9076
9294
|
}
|
|
9077
9295
|
} catch (error) {
|
|
@@ -9082,33 +9300,104 @@ var SignIn = ({
|
|
|
9082
9300
|
initializationAttemptedRef.current = false;
|
|
9083
9301
|
}
|
|
9084
9302
|
};
|
|
9085
|
-
(0,
|
|
9303
|
+
(0, import_react66.useEffect)(() => {
|
|
9086
9304
|
const urlParams = getUrlParams2();
|
|
9087
9305
|
if (urlParams.error) {
|
|
9088
9306
|
handleOAuthError(urlParams.error, urlParams.errorDescription);
|
|
9089
9307
|
return;
|
|
9090
9308
|
}
|
|
9091
9309
|
handleAuthId(urlParams.authId);
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
}
|
|
9310
|
+
}, []);
|
|
9311
|
+
(0, import_react66.useEffect)(() => {
|
|
9095
9312
|
const currentUrlParams = getUrlParams2();
|
|
9096
9313
|
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !currentFlowId && !currentUrlParams.code && !currentUrlParams.state && !isSubmitting && !oauthCodeProcessedRef.current) {
|
|
9097
9314
|
initializationAttemptedRef.current = true;
|
|
9098
9315
|
initializeFlow();
|
|
9099
9316
|
}
|
|
9100
9317
|
}, [isInitialized, isLoading, isFlowInitialized, currentFlowId]);
|
|
9318
|
+
(0, import_react66.useEffect)(() => {
|
|
9319
|
+
const timeoutMs = Number(additionalData?.["stepTimeout"]) || 0;
|
|
9320
|
+
if (timeoutMs <= 0 || !isFlowInitialized) {
|
|
9321
|
+
setIsTimeoutDisabled(false);
|
|
9322
|
+
return void 0;
|
|
9323
|
+
}
|
|
9324
|
+
const remaining = Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3));
|
|
9325
|
+
const handleTimeout = () => {
|
|
9326
|
+
const errorMessage = t("errors.signin.timeout") || "Time allowed to complete the step has expired.";
|
|
9327
|
+
setError(new Error(errorMessage));
|
|
9328
|
+
setIsTimeoutDisabled(true);
|
|
9329
|
+
};
|
|
9330
|
+
if (remaining <= 0) {
|
|
9331
|
+
handleTimeout();
|
|
9332
|
+
return void 0;
|
|
9333
|
+
}
|
|
9334
|
+
const timerId = setTimeout(() => {
|
|
9335
|
+
handleTimeout();
|
|
9336
|
+
}, remaining * 1e3);
|
|
9337
|
+
return () => clearTimeout(timerId);
|
|
9338
|
+
}, [additionalData?.["stepTimeout"], isFlowInitialized, t]);
|
|
9101
9339
|
const handleSubmit = async (payload) => {
|
|
9102
9340
|
const effectiveFlowId = payload.flowId || currentFlowId;
|
|
9103
9341
|
if (!effectiveFlowId) {
|
|
9104
9342
|
throw new Error("No active flow ID");
|
|
9105
9343
|
}
|
|
9344
|
+
const processedInputs = { ...payload.inputs };
|
|
9345
|
+
if (additionalData?.["consentPrompt"]) {
|
|
9346
|
+
try {
|
|
9347
|
+
const consentPromptRawData = additionalData["consentPrompt"];
|
|
9348
|
+
const purposes = typeof consentPromptRawData === "string" ? JSON.parse(consentPromptRawData) : consentPromptRawData.purposes || consentPromptRawData;
|
|
9349
|
+
let isDeny = false;
|
|
9350
|
+
if (payload.action) {
|
|
9351
|
+
const findAction = (comps) => {
|
|
9352
|
+
if (!comps || comps.length === 0) return null;
|
|
9353
|
+
const found = comps.find((c) => c.id === payload.action);
|
|
9354
|
+
if (found) return found;
|
|
9355
|
+
return comps.reduce((acc, c) => {
|
|
9356
|
+
if (acc) return acc;
|
|
9357
|
+
if (c.components) return findAction(c.components);
|
|
9358
|
+
return null;
|
|
9359
|
+
}, null);
|
|
9360
|
+
};
|
|
9361
|
+
const submitAction = findAction(components);
|
|
9362
|
+
if (submitAction && submitAction.variant?.toLowerCase() !== "primary") {
|
|
9363
|
+
isDeny = true;
|
|
9364
|
+
}
|
|
9365
|
+
}
|
|
9366
|
+
const decisions = {
|
|
9367
|
+
purposes: purposes.map((p) => ({
|
|
9368
|
+
approved: !isDeny,
|
|
9369
|
+
elements: [
|
|
9370
|
+
...(p.essential || []).map((attr) => ({
|
|
9371
|
+
approved: !isDeny,
|
|
9372
|
+
name: attr
|
|
9373
|
+
})),
|
|
9374
|
+
...(p.optional || []).map((attr) => {
|
|
9375
|
+
const key = `__consent_opt__${p.purpose_id}__${attr}`;
|
|
9376
|
+
return {
|
|
9377
|
+
approved: isDeny ? false : processedInputs[key] !== "false",
|
|
9378
|
+
name: attr
|
|
9379
|
+
};
|
|
9380
|
+
})
|
|
9381
|
+
],
|
|
9382
|
+
purpose_name: p.purpose_name
|
|
9383
|
+
}))
|
|
9384
|
+
};
|
|
9385
|
+
processedInputs["consent_decisions"] = JSON.stringify(decisions);
|
|
9386
|
+
Object.keys(processedInputs).forEach((key) => {
|
|
9387
|
+
if (key.startsWith("__consent_opt__")) {
|
|
9388
|
+
delete processedInputs[key];
|
|
9389
|
+
}
|
|
9390
|
+
});
|
|
9391
|
+
} catch (e) {
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9106
9394
|
try {
|
|
9107
9395
|
setIsSubmitting(true);
|
|
9108
9396
|
setFlowError(null);
|
|
9109
9397
|
const response = await signIn({
|
|
9110
9398
|
flowId: effectiveFlowId,
|
|
9111
|
-
...payload
|
|
9399
|
+
...payload,
|
|
9400
|
+
inputs: processedInputs
|
|
9112
9401
|
});
|
|
9113
9402
|
if (handleRedirection(response)) {
|
|
9114
9403
|
return;
|
|
@@ -9128,7 +9417,11 @@ var SignIn = ({
|
|
|
9128
9417
|
setIsSubmitting(false);
|
|
9129
9418
|
return;
|
|
9130
9419
|
}
|
|
9131
|
-
const {
|
|
9420
|
+
const {
|
|
9421
|
+
flowId: normalizedFlowId,
|
|
9422
|
+
components: normalizedComponents,
|
|
9423
|
+
additionalData: normalizedAdditionalData
|
|
9424
|
+
} = normalizeFlowResponse(
|
|
9132
9425
|
response,
|
|
9133
9426
|
t,
|
|
9134
9427
|
{
|
|
@@ -9168,6 +9461,8 @@ var SignIn = ({
|
|
|
9168
9461
|
if (normalizedFlowId && normalizedComponents) {
|
|
9169
9462
|
setFlowId(normalizedFlowId);
|
|
9170
9463
|
setComponents(normalizedComponents);
|
|
9464
|
+
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9465
|
+
setIsTimeoutDisabled(false);
|
|
9171
9466
|
setIsFlowInitialized(true);
|
|
9172
9467
|
cleanupFlowUrlParams();
|
|
9173
9468
|
if (response?.failureReason) {
|
|
@@ -9199,7 +9494,7 @@ var SignIn = ({
|
|
|
9199
9494
|
processedRef: oauthCodeProcessedRef,
|
|
9200
9495
|
setFlowId
|
|
9201
9496
|
});
|
|
9202
|
-
(0,
|
|
9497
|
+
(0, import_react66.useEffect)(() => {
|
|
9203
9498
|
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
9204
9499
|
return;
|
|
9205
9500
|
}
|
|
@@ -9252,21 +9547,25 @@ var SignIn = ({
|
|
|
9252
9547
|
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.flowId]);
|
|
9253
9548
|
if (children) {
|
|
9254
9549
|
const renderProps = {
|
|
9550
|
+
additionalData,
|
|
9255
9551
|
components,
|
|
9256
9552
|
error: flowError,
|
|
9257
9553
|
initialize: initializeFlow,
|
|
9258
9554
|
isInitialized: isFlowInitialized,
|
|
9259
9555
|
isLoading: isLoading || isSubmitting || !isInitialized,
|
|
9556
|
+
isTimeoutDisabled,
|
|
9260
9557
|
meta,
|
|
9261
9558
|
onSubmit: handleSubmit
|
|
9262
9559
|
};
|
|
9263
|
-
return /* @__PURE__ */ (0,
|
|
9560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: children(renderProps) });
|
|
9264
9561
|
}
|
|
9265
|
-
return /* @__PURE__ */ (0,
|
|
9562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
9266
9563
|
BaseSignIn_default2,
|
|
9267
9564
|
{
|
|
9565
|
+
additionalData,
|
|
9268
9566
|
components,
|
|
9269
9567
|
isLoading: isLoading || !isInitialized || !isFlowInitialized,
|
|
9568
|
+
isTimeoutDisabled,
|
|
9270
9569
|
onSubmit: handleSubmit,
|
|
9271
9570
|
onError: handleError,
|
|
9272
9571
|
error: flowError,
|
|
@@ -9280,7 +9579,7 @@ var SignIn = ({
|
|
|
9280
9579
|
var SignIn_default = SignIn;
|
|
9281
9580
|
|
|
9282
9581
|
// src/components/presentation/auth/SignIn/SignIn.tsx
|
|
9283
|
-
var
|
|
9582
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
9284
9583
|
var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) => {
|
|
9285
9584
|
const { signIn, afterSignInUrl, isInitialized, isLoading, platform } = useAsgardeo_default();
|
|
9286
9585
|
const handleInitialize = async () => await signIn({ response_mode: "direct" });
|
|
@@ -9297,7 +9596,7 @@ var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) =
|
|
|
9297
9596
|
}
|
|
9298
9597
|
};
|
|
9299
9598
|
if (platform === import_browser56.Platform.AsgardeoV2) {
|
|
9300
|
-
return /* @__PURE__ */ (0,
|
|
9599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9301
9600
|
SignIn_default,
|
|
9302
9601
|
{
|
|
9303
9602
|
className,
|
|
@@ -9310,7 +9609,7 @@ var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) =
|
|
|
9310
9609
|
}
|
|
9311
9610
|
);
|
|
9312
9611
|
}
|
|
9313
|
-
return /* @__PURE__ */ (0,
|
|
9612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9314
9613
|
BaseSignIn_default3,
|
|
9315
9614
|
{
|
|
9316
9615
|
isLoading: isLoading || !isInitialized,
|
|
@@ -9336,7 +9635,7 @@ var import_browser67 = require("@asgardeo/browser");
|
|
|
9336
9635
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
9337
9636
|
var import_browser65 = require("@asgardeo/browser");
|
|
9338
9637
|
var import_css39 = require("@emotion/css");
|
|
9339
|
-
var
|
|
9638
|
+
var import_react68 = require("react");
|
|
9340
9639
|
|
|
9341
9640
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
9342
9641
|
var import_browser64 = require("@asgardeo/browser");
|
|
@@ -9398,13 +9697,13 @@ var DateInput = ({
|
|
|
9398
9697
|
var DateInput_default = DateInput;
|
|
9399
9698
|
|
|
9400
9699
|
// src/components/adapters/DividerComponent.tsx
|
|
9401
|
-
var
|
|
9700
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
9402
9701
|
var DividerComponent = ({ component }) => {
|
|
9403
9702
|
const { theme } = useTheme_default();
|
|
9404
9703
|
const config = component.config || {};
|
|
9405
9704
|
const text = config["text"] || "";
|
|
9406
9705
|
const variant = component.variant?.toLowerCase() || "horizontal";
|
|
9407
|
-
return /* @__PURE__ */ (0,
|
|
9706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
9408
9707
|
Divider_default,
|
|
9409
9708
|
{
|
|
9410
9709
|
orientation: variant === "vertical" ? "vertical" : "horizontal",
|
|
@@ -9445,7 +9744,7 @@ var EmailInput = ({
|
|
|
9445
9744
|
var EmailInput_default = EmailInput;
|
|
9446
9745
|
|
|
9447
9746
|
// src/components/adapters/FormContainer.tsx
|
|
9448
|
-
var
|
|
9747
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
9449
9748
|
var FormContainer = (props) => {
|
|
9450
9749
|
const { component } = props;
|
|
9451
9750
|
if (component.components && component.components.length > 0) {
|
|
@@ -9458,14 +9757,14 @@ var FormContainer = (props) => {
|
|
|
9458
9757
|
props.onSubmit(submitButton, props.formValues);
|
|
9459
9758
|
}
|
|
9460
9759
|
};
|
|
9461
|
-
return /* @__PURE__ */ (0,
|
|
9760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("form", { onSubmit: handleFormSubmit, style: { display: "flex", flexDirection: "column" }, children: component.components.map(
|
|
9462
9761
|
(childComponent) => createSignUpComponent({
|
|
9463
9762
|
...props,
|
|
9464
9763
|
component: childComponent
|
|
9465
9764
|
})
|
|
9466
9765
|
) }, component.id);
|
|
9467
9766
|
}
|
|
9468
|
-
return /* @__PURE__ */ (0,
|
|
9767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", {}, component.id);
|
|
9469
9768
|
};
|
|
9470
9769
|
var FormContainer_default = FormContainer;
|
|
9471
9770
|
|
|
@@ -9591,7 +9890,7 @@ var SelectInput = ({
|
|
|
9591
9890
|
var SelectInput_default = SelectInput;
|
|
9592
9891
|
|
|
9593
9892
|
// src/components/adapters/SubmitButton.tsx
|
|
9594
|
-
var
|
|
9893
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
9595
9894
|
var ButtonComponent = ({
|
|
9596
9895
|
component,
|
|
9597
9896
|
isLoading,
|
|
@@ -9625,7 +9924,7 @@ var ButtonComponent = ({
|
|
|
9625
9924
|
onSubmit(component);
|
|
9626
9925
|
}
|
|
9627
9926
|
};
|
|
9628
|
-
return /* @__PURE__ */ (0,
|
|
9927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9629
9928
|
Button_default,
|
|
9630
9929
|
{
|
|
9631
9930
|
type: buttonType === "submit" ? "submit" : "button",
|
|
@@ -9636,7 +9935,7 @@ var ButtonComponent = ({
|
|
|
9636
9935
|
onClick: buttonType !== "submit" ? handleClick : void 0,
|
|
9637
9936
|
className: buttonClassName,
|
|
9638
9937
|
style: { width: "100%" },
|
|
9639
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
9938
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Spinner_default, { size: "small" }) : buttonText
|
|
9640
9939
|
},
|
|
9641
9940
|
component.id
|
|
9642
9941
|
);
|
|
@@ -9644,7 +9943,7 @@ var ButtonComponent = ({
|
|
|
9644
9943
|
var SubmitButton_default = ButtonComponent;
|
|
9645
9944
|
|
|
9646
9945
|
// src/components/adapters/TelephoneInput.tsx
|
|
9647
|
-
var
|
|
9946
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
9648
9947
|
var TelephoneInput = ({
|
|
9649
9948
|
component,
|
|
9650
9949
|
formValues,
|
|
@@ -9657,7 +9956,7 @@ var TelephoneInput = ({
|
|
|
9657
9956
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
9658
9957
|
const value = formValues[fieldName] || "";
|
|
9659
9958
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
9660
|
-
return /* @__PURE__ */ (0,
|
|
9959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
9661
9960
|
TextField_default,
|
|
9662
9961
|
{
|
|
9663
9962
|
name: fieldName,
|
|
@@ -9705,7 +10004,7 @@ var TextInput = ({
|
|
|
9705
10004
|
var TextInput_default = TextInput;
|
|
9706
10005
|
|
|
9707
10006
|
// src/components/adapters/Typography.tsx
|
|
9708
|
-
var
|
|
10007
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
9709
10008
|
var TypographyComponent = ({ component }) => {
|
|
9710
10009
|
const { theme } = useTheme_default();
|
|
9711
10010
|
const config = component.config || {};
|
|
@@ -9746,7 +10045,7 @@ var TypographyComponent = ({ component }) => {
|
|
|
9746
10045
|
default:
|
|
9747
10046
|
typographyVariant = "body1";
|
|
9748
10047
|
}
|
|
9749
|
-
return /* @__PURE__ */ (0,
|
|
10048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
9750
10049
|
Typography_default,
|
|
9751
10050
|
{
|
|
9752
10051
|
variant: typographyVariant,
|
|
@@ -9759,69 +10058,69 @@ var TypographyComponent = ({ component }) => {
|
|
|
9759
10058
|
var Typography_default2 = TypographyComponent;
|
|
9760
10059
|
|
|
9761
10060
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
9762
|
-
var
|
|
10061
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
9763
10062
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
9764
10063
|
switch (component.type) {
|
|
9765
10064
|
case import_browser64.EmbeddedFlowComponentType.Typography:
|
|
9766
|
-
return /* @__PURE__ */ (0,
|
|
10065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
9767
10066
|
case import_browser64.EmbeddedFlowComponentType.Input: {
|
|
9768
10067
|
const inputVariant = component.variant?.toUpperCase();
|
|
9769
10068
|
const inputType = component.config["type"]?.toLowerCase();
|
|
9770
10069
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
9771
|
-
return /* @__PURE__ */ (0,
|
|
10070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EmailInput_default, { component, onSubmit, ...rest });
|
|
9772
10071
|
}
|
|
9773
10072
|
if (inputVariant === "PASSWORD" || inputType === "password") {
|
|
9774
|
-
return /* @__PURE__ */ (0,
|
|
10073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(PasswordInput_default, { component, onSubmit, ...rest });
|
|
9775
10074
|
}
|
|
9776
10075
|
if (inputVariant === "TELEPHONE" || inputType === "tel") {
|
|
9777
|
-
return /* @__PURE__ */ (0,
|
|
10076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TelephoneInput_default, { component, onSubmit, ...rest });
|
|
9778
10077
|
}
|
|
9779
10078
|
if (inputVariant === "NUMBER" || inputType === "number") {
|
|
9780
|
-
return /* @__PURE__ */ (0,
|
|
10079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(NumberInput_default, { component, onSubmit, ...rest });
|
|
9781
10080
|
}
|
|
9782
10081
|
if (inputVariant === "DATE" || inputType === "date") {
|
|
9783
|
-
return /* @__PURE__ */ (0,
|
|
10082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DateInput_default, { component, onSubmit, ...rest });
|
|
9784
10083
|
}
|
|
9785
10084
|
if (inputVariant === "CHECKBOX" || inputType === "checkbox") {
|
|
9786
|
-
return /* @__PURE__ */ (0,
|
|
10085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CheckboxInput_default, { component, onSubmit, ...rest });
|
|
9787
10086
|
}
|
|
9788
|
-
return /* @__PURE__ */ (0,
|
|
10087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TextInput_default, { component, onSubmit, ...rest });
|
|
9789
10088
|
}
|
|
9790
10089
|
case import_browser64.EmbeddedFlowComponentType.Button: {
|
|
9791
10090
|
const buttonVariant = component.variant?.toUpperCase();
|
|
9792
10091
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
9793
10092
|
if (buttonVariant === "SOCIAL") {
|
|
9794
10093
|
if (buttonText.toLowerCase().includes("google")) {
|
|
9795
|
-
return /* @__PURE__ */ (0,
|
|
10094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(GoogleButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9796
10095
|
}
|
|
9797
10096
|
if (buttonText.toLowerCase().includes("github")) {
|
|
9798
|
-
return /* @__PURE__ */ (0,
|
|
10097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(GitHubButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9799
10098
|
}
|
|
9800
10099
|
if (buttonText.toLowerCase().includes("microsoft")) {
|
|
9801
|
-
return /* @__PURE__ */ (0,
|
|
10100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(MicrosoftButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9802
10101
|
}
|
|
9803
10102
|
if (buttonText.toLowerCase().includes("facebook")) {
|
|
9804
|
-
return /* @__PURE__ */ (0,
|
|
10103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FacebookButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9805
10104
|
}
|
|
9806
10105
|
if (buttonText.toLowerCase().includes("linkedin")) {
|
|
9807
|
-
return /* @__PURE__ */ (0,
|
|
10106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LinkedInButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9808
10107
|
}
|
|
9809
10108
|
if (buttonText.toLowerCase().includes("ethereum")) {
|
|
9810
|
-
return /* @__PURE__ */ (0,
|
|
10109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SignInWithEthereumButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9811
10110
|
}
|
|
9812
10111
|
}
|
|
9813
|
-
return /* @__PURE__ */ (0,
|
|
10112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SubmitButton_default, { component, onSubmit, ...rest });
|
|
9814
10113
|
}
|
|
9815
10114
|
case import_browser64.EmbeddedFlowComponentType.Form:
|
|
9816
|
-
return /* @__PURE__ */ (0,
|
|
10115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FormContainer_default, { component, onSubmit, ...rest });
|
|
9817
10116
|
case import_browser64.EmbeddedFlowComponentType.Select:
|
|
9818
|
-
return /* @__PURE__ */ (0,
|
|
10117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectInput_default, { component, onSubmit, ...rest });
|
|
9819
10118
|
case import_browser64.EmbeddedFlowComponentType.Divider:
|
|
9820
|
-
return /* @__PURE__ */ (0,
|
|
10119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DividerComponent_default, { component, onSubmit, ...rest });
|
|
9821
10120
|
case import_browser64.EmbeddedFlowComponentType.Image:
|
|
9822
|
-
return /* @__PURE__ */ (0,
|
|
10121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ImageComponent_default, { component, onSubmit, ...rest });
|
|
9823
10122
|
default:
|
|
9824
|
-
return /* @__PURE__ */ (0,
|
|
10123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", {});
|
|
9825
10124
|
}
|
|
9826
10125
|
};
|
|
9827
10126
|
var createSignUpOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createSignUpComponent({
|
|
@@ -9853,8 +10152,8 @@ var renderSignUpComponents2 = (components, formValues, touchedFields, formErrors
|
|
|
9853
10152
|
|
|
9854
10153
|
// src/components/presentation/auth/SignUp/BaseSignUp.styles.ts
|
|
9855
10154
|
var import_css38 = require("@emotion/css");
|
|
9856
|
-
var
|
|
9857
|
-
var useStyles17 = (theme, colorScheme) => (0,
|
|
10155
|
+
var import_react67 = require("react");
|
|
10156
|
+
var useStyles17 = (theme, colorScheme) => (0, import_react67.useMemo)(() => {
|
|
9858
10157
|
const signUp = import_css38.css`
|
|
9859
10158
|
min-width: 420px;
|
|
9860
10159
|
margin: 0 auto;
|
|
@@ -9990,7 +10289,7 @@ var useStyles17 = (theme, colorScheme) => (0, import_react66.useMemo)(() => {
|
|
|
9990
10289
|
var BaseSignUp_styles_default = useStyles17;
|
|
9991
10290
|
|
|
9992
10291
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
9993
|
-
var
|
|
10292
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
9994
10293
|
var logger6 = (0, import_browser65.createPackageComponentLogger)(
|
|
9995
10294
|
"@asgardeo/react",
|
|
9996
10295
|
"BaseSignUp"
|
|
@@ -10019,7 +10318,7 @@ var BaseSignUpContent = ({
|
|
|
10019
10318
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
10020
10319
|
useAsgardeo_default();
|
|
10021
10320
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10022
|
-
const handleError = (0,
|
|
10321
|
+
const handleError = (0, import_react68.useCallback)(
|
|
10023
10322
|
(error) => {
|
|
10024
10323
|
let errorMessage = t("errors.signup.flow.failure");
|
|
10025
10324
|
if (error && typeof error === "object") {
|
|
@@ -10052,11 +10351,11 @@ var BaseSignUpContent = ({
|
|
|
10052
10351
|
},
|
|
10053
10352
|
[t, addMessage, clearMessages]
|
|
10054
10353
|
);
|
|
10055
|
-
const [isLoading, setIsLoading] = (0,
|
|
10056
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
10057
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10058
|
-
const initializationAttemptedRef = (0,
|
|
10059
|
-
const extractFormFields = (0,
|
|
10354
|
+
const [isLoading, setIsLoading] = (0, import_react68.useState)(false);
|
|
10355
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react68.useState)(false);
|
|
10356
|
+
const [currentFlow, setCurrentFlow] = (0, import_react68.useState)(null);
|
|
10357
|
+
const initializationAttemptedRef = (0, import_react68.useRef)(false);
|
|
10358
|
+
const extractFormFields = (0, import_react68.useCallback)(
|
|
10060
10359
|
(components) => {
|
|
10061
10360
|
const fields = [];
|
|
10062
10361
|
const processComponents = (comps) => {
|
|
@@ -10109,7 +10408,7 @@ var BaseSignUpContent = ({
|
|
|
10109
10408
|
validateForm,
|
|
10110
10409
|
reset: resetForm
|
|
10111
10410
|
} = form;
|
|
10112
|
-
const setupFormFields = (0,
|
|
10411
|
+
const setupFormFields = (0, import_react68.useCallback)(
|
|
10113
10412
|
(flowResponse) => {
|
|
10114
10413
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
10115
10414
|
const initialValues = {};
|
|
@@ -10311,7 +10610,7 @@ var BaseSignUpContent = ({
|
|
|
10311
10610
|
);
|
|
10312
10611
|
const errorClasses = (0, import_css39.cx)([(0, import_browser65.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
10313
10612
|
const messageClasses = (0, import_css39.cx)([(0, import_browser65.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
10314
|
-
const renderComponents = (0,
|
|
10613
|
+
const renderComponents = (0, import_react68.useCallback)(
|
|
10315
10614
|
(components) => renderSignUpComponents2(
|
|
10316
10615
|
components,
|
|
10317
10616
|
formValues,
|
|
@@ -10341,7 +10640,7 @@ var BaseSignUpContent = ({
|
|
|
10341
10640
|
handleSubmit
|
|
10342
10641
|
]
|
|
10343
10642
|
);
|
|
10344
|
-
(0,
|
|
10643
|
+
(0, import_react68.useEffect)(() => {
|
|
10345
10644
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
10346
10645
|
initializationAttemptedRef.current = true;
|
|
10347
10646
|
(async () => {
|
|
@@ -10393,42 +10692,42 @@ var BaseSignUpContent = ({
|
|
|
10393
10692
|
validateForm,
|
|
10394
10693
|
values: formValues
|
|
10395
10694
|
};
|
|
10396
|
-
return /* @__PURE__ */ (0,
|
|
10695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
10397
10696
|
}
|
|
10398
10697
|
if (!isFlowInitialized && isLoading) {
|
|
10399
|
-
return /* @__PURE__ */ (0,
|
|
10698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
10400
10699
|
}
|
|
10401
10700
|
if (!currentFlow) {
|
|
10402
|
-
return /* @__PURE__ */ (0,
|
|
10403
|
-
/* @__PURE__ */ (0,
|
|
10404
|
-
/* @__PURE__ */ (0,
|
|
10701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
10702
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Title, { children: t("errors.heading") }),
|
|
10703
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
10405
10704
|
] }) }) });
|
|
10406
10705
|
}
|
|
10407
|
-
return /* @__PURE__ */ (0,
|
|
10408
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
10409
|
-
showTitle && /* @__PURE__ */ (0,
|
|
10410
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
10706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: [
|
|
10707
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
10708
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.heading") }),
|
|
10709
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.subheading") })
|
|
10411
10710
|
] }),
|
|
10412
|
-
/* @__PURE__ */ (0,
|
|
10413
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
10711
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default.Content, { children: [
|
|
10712
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
10414
10713
|
Alert_default,
|
|
10415
10714
|
{
|
|
10416
10715
|
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
10417
10716
|
className: (0, import_css39.cx)(styles.flowMessageItem, messageClasses),
|
|
10418
|
-
children: /* @__PURE__ */ (0,
|
|
10717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Description, { children: message.message })
|
|
10419
10718
|
},
|
|
10420
10719
|
message.id || index
|
|
10421
10720
|
)) }),
|
|
10422
|
-
/* @__PURE__ */ (0,
|
|
10721
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
10423
10722
|
] })
|
|
10424
10723
|
] });
|
|
10425
10724
|
};
|
|
10426
10725
|
var BaseSignUp = ({ showLogo = true, ...rest }) => {
|
|
10427
10726
|
const { theme, colorScheme } = useTheme_default();
|
|
10428
10727
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10429
|
-
return /* @__PURE__ */ (0,
|
|
10430
|
-
showLogo && /* @__PURE__ */ (0,
|
|
10431
|
-
/* @__PURE__ */ (0,
|
|
10728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { children: [
|
|
10729
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Logo_default, { size: "large" }) }),
|
|
10730
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(BaseSignUpContent, { showLogo, ...rest }) })
|
|
10432
10731
|
] });
|
|
10433
10732
|
};
|
|
10434
10733
|
var BaseSignUp_default = BaseSignUp;
|
|
@@ -10436,8 +10735,8 @@ var BaseSignUp_default = BaseSignUp;
|
|
|
10436
10735
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
10437
10736
|
var import_browser66 = require("@asgardeo/browser");
|
|
10438
10737
|
var import_css40 = require("@emotion/css");
|
|
10439
|
-
var
|
|
10440
|
-
var
|
|
10738
|
+
var import_react69 = require("react");
|
|
10739
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
10441
10740
|
var logger7 = (0, import_browser66.createPackageComponentLogger)(
|
|
10442
10741
|
"@asgardeo/react",
|
|
10443
10742
|
"BaseSignUp"
|
|
@@ -10467,20 +10766,20 @@ var BaseSignUpContent2 = ({
|
|
|
10467
10766
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
10468
10767
|
const { meta } = useAsgardeo_default();
|
|
10469
10768
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10470
|
-
const [isLoading, setIsLoading] = (0,
|
|
10471
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
10472
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10473
|
-
const [apiError, setApiError] = (0,
|
|
10474
|
-
const [passkeyState, setPasskeyState] = (0,
|
|
10769
|
+
const [isLoading, setIsLoading] = (0, import_react69.useState)(false);
|
|
10770
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react69.useState)(false);
|
|
10771
|
+
const [currentFlow, setCurrentFlow] = (0, import_react69.useState)(null);
|
|
10772
|
+
const [apiError, setApiError] = (0, import_react69.useState)(null);
|
|
10773
|
+
const [passkeyState, setPasskeyState] = (0, import_react69.useState)({
|
|
10475
10774
|
actionId: null,
|
|
10476
10775
|
creationOptions: null,
|
|
10477
10776
|
error: null,
|
|
10478
10777
|
flowId: null,
|
|
10479
10778
|
isActive: false
|
|
10480
10779
|
});
|
|
10481
|
-
const initializationAttemptedRef = (0,
|
|
10482
|
-
const passkeyProcessedRef = (0,
|
|
10483
|
-
const handleError = (0,
|
|
10780
|
+
const initializationAttemptedRef = (0, import_react69.useRef)(false);
|
|
10781
|
+
const passkeyProcessedRef = (0, import_react69.useRef)(false);
|
|
10782
|
+
const handleError = (0, import_react69.useCallback)(
|
|
10484
10783
|
(error) => {
|
|
10485
10784
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
10486
10785
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -10492,7 +10791,7 @@ var BaseSignUpContent2 = ({
|
|
|
10492
10791
|
},
|
|
10493
10792
|
[t, addMessage, clearMessages]
|
|
10494
10793
|
);
|
|
10495
|
-
const normalizeFlowResponseLocal = (0,
|
|
10794
|
+
const normalizeFlowResponseLocal = (0, import_react69.useCallback)(
|
|
10496
10795
|
(response) => {
|
|
10497
10796
|
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
10498
10797
|
return response;
|
|
@@ -10519,7 +10818,7 @@ var BaseSignUpContent2 = ({
|
|
|
10519
10818
|
},
|
|
10520
10819
|
[t, children]
|
|
10521
10820
|
);
|
|
10522
|
-
const extractFormFields = (0,
|
|
10821
|
+
const extractFormFields = (0, import_react69.useCallback)(
|
|
10523
10822
|
(components) => {
|
|
10524
10823
|
const fields = [];
|
|
10525
10824
|
const processComponents = (comps) => {
|
|
@@ -10570,7 +10869,7 @@ var BaseSignUpContent2 = ({
|
|
|
10570
10869
|
touchAllFields,
|
|
10571
10870
|
reset: resetForm
|
|
10572
10871
|
} = form;
|
|
10573
|
-
const setupFormFields = (0,
|
|
10872
|
+
const setupFormFields = (0, import_react69.useCallback)(
|
|
10574
10873
|
(flowResponse) => {
|
|
10575
10874
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
10576
10875
|
const initialValues = {};
|
|
@@ -10772,7 +11071,7 @@ var BaseSignUpContent2 = ({
|
|
|
10772
11071
|
setIsLoading(false);
|
|
10773
11072
|
}
|
|
10774
11073
|
};
|
|
10775
|
-
(0,
|
|
11074
|
+
(0, import_react69.useEffect)(() => {
|
|
10776
11075
|
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
10777
11076
|
return;
|
|
10778
11077
|
}
|
|
@@ -10838,7 +11137,7 @@ var BaseSignUpContent2 = ({
|
|
|
10838
11137
|
);
|
|
10839
11138
|
const errorClasses = (0, import_css40.cx)([(0, import_browser66.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
10840
11139
|
const messageClasses = (0, import_css40.cx)([(0, import_browser66.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
10841
|
-
const renderComponents = (0,
|
|
11140
|
+
const renderComponents = (0, import_react69.useCallback)(
|
|
10842
11141
|
(components) => renderSignUpComponents(
|
|
10843
11142
|
components,
|
|
10844
11143
|
formValues,
|
|
@@ -10878,7 +11177,7 @@ var BaseSignUpContent2 = ({
|
|
|
10878
11177
|
state: urlParams.get("state")
|
|
10879
11178
|
};
|
|
10880
11179
|
};
|
|
10881
|
-
(0,
|
|
11180
|
+
(0, import_react69.useEffect)(() => {
|
|
10882
11181
|
const urlParams = getUrlParams2();
|
|
10883
11182
|
if (urlParams.code || urlParams.state) {
|
|
10884
11183
|
return;
|
|
@@ -10941,15 +11240,15 @@ var BaseSignUpContent2 = ({
|
|
|
10941
11240
|
},
|
|
10942
11241
|
values: formValues
|
|
10943
11242
|
};
|
|
10944
|
-
return /* @__PURE__ */ (0,
|
|
11243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
10945
11244
|
}
|
|
10946
11245
|
if (!isFlowInitialized && isLoading) {
|
|
10947
|
-
return /* @__PURE__ */ (0,
|
|
11246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
10948
11247
|
}
|
|
10949
11248
|
if (!currentFlow) {
|
|
10950
|
-
return /* @__PURE__ */ (0,
|
|
10951
|
-
/* @__PURE__ */ (0,
|
|
10952
|
-
/* @__PURE__ */ (0,
|
|
11249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
11250
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Title, { children: t("errors.heading") }),
|
|
11251
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
10953
11252
|
] }) }) });
|
|
10954
11253
|
}
|
|
10955
11254
|
const componentsToRender = currentFlow.data?.components || [];
|
|
@@ -10960,46 +11259,46 @@ var BaseSignUpContent2 = ({
|
|
|
10960
11259
|
t("signup.heading"),
|
|
10961
11260
|
t("signup.subheading")
|
|
10962
11261
|
);
|
|
10963
|
-
return /* @__PURE__ */ (0,
|
|
10964
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
10965
|
-
showTitle && /* @__PURE__ */ (0,
|
|
10966
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
11262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: [
|
|
11263
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
11264
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
11265
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
10967
11266
|
] }),
|
|
10968
|
-
/* @__PURE__ */ (0,
|
|
10969
|
-
externalError && /* @__PURE__ */ (0,
|
|
10970
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
11267
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default.Content, { children: [
|
|
11268
|
+
externalError && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default, { variant: "error", className: (0, import_css40.cx)(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: externalError.message }) }) }),
|
|
11269
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
10971
11270
|
Alert_default,
|
|
10972
11271
|
{
|
|
10973
11272
|
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
10974
11273
|
className: (0, import_css40.cx)(styles.flowMessageItem, messageClasses),
|
|
10975
|
-
children: /* @__PURE__ */ (0,
|
|
11274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: message.message })
|
|
10976
11275
|
},
|
|
10977
11276
|
message.id || index
|
|
10978
11277
|
)) }),
|
|
10979
|
-
/* @__PURE__ */ (0,
|
|
11278
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.contentContainer, children: componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
10980
11279
|
] })
|
|
10981
11280
|
] });
|
|
10982
11281
|
};
|
|
10983
11282
|
var BaseSignUp2 = ({ preferences, showLogo = true, ...rest }) => {
|
|
10984
11283
|
const { theme, colorScheme } = useTheme_default();
|
|
10985
11284
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10986
|
-
const content = /* @__PURE__ */ (0,
|
|
10987
|
-
showLogo && /* @__PURE__ */ (0,
|
|
10988
|
-
/* @__PURE__ */ (0,
|
|
11285
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { children: [
|
|
11286
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Logo_default, { size: "large" }) }),
|
|
11287
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(BaseSignUpContent2, { showLogo, ...rest }) })
|
|
10989
11288
|
] });
|
|
10990
11289
|
if (!preferences) return content;
|
|
10991
|
-
return /* @__PURE__ */ (0,
|
|
11290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ComponentPreferencesContext_default.Provider, { value: preferences, children: content });
|
|
10992
11291
|
};
|
|
10993
11292
|
var BaseSignUp_default2 = BaseSignUp2;
|
|
10994
11293
|
|
|
10995
11294
|
// src/components/presentation/auth/SignUp/BaseSignUp.tsx
|
|
10996
|
-
var
|
|
11295
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
10997
11296
|
var BaseSignUp3 = (props) => {
|
|
10998
11297
|
const { platform } = useAsgardeo_default();
|
|
10999
11298
|
if (platform === import_browser67.Platform.AsgardeoV2) {
|
|
11000
|
-
return /* @__PURE__ */ (0,
|
|
11299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BaseSignUp_default2, { ...props });
|
|
11001
11300
|
}
|
|
11002
|
-
return /* @__PURE__ */ (0,
|
|
11301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BaseSignUp_default, { ...props });
|
|
11003
11302
|
};
|
|
11004
11303
|
var BaseSignUp_default3 = BaseSignUp3;
|
|
11005
11304
|
|
|
@@ -11008,7 +11307,7 @@ var import_browser70 = require("@asgardeo/browser");
|
|
|
11008
11307
|
|
|
11009
11308
|
// src/components/presentation/auth/SignUp/v1/SignUp.tsx
|
|
11010
11309
|
var import_browser68 = require("@asgardeo/browser");
|
|
11011
|
-
var
|
|
11310
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11012
11311
|
var SignUp = ({
|
|
11013
11312
|
className,
|
|
11014
11313
|
size = "medium",
|
|
@@ -11037,7 +11336,7 @@ var SignUp = ({
|
|
|
11037
11336
|
window.location.href = response.data.redirectURL;
|
|
11038
11337
|
}
|
|
11039
11338
|
};
|
|
11040
|
-
return /* @__PURE__ */ (0,
|
|
11339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11041
11340
|
BaseSignUp_default,
|
|
11042
11341
|
{
|
|
11043
11342
|
afterSignUpUrl,
|
|
@@ -11060,7 +11359,7 @@ var SignUp_default = SignUp;
|
|
|
11060
11359
|
|
|
11061
11360
|
// src/components/presentation/auth/SignUp/v2/SignUp.tsx
|
|
11062
11361
|
var import_browser69 = require("@asgardeo/browser");
|
|
11063
|
-
var
|
|
11362
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11064
11363
|
var SignUp2 = ({
|
|
11065
11364
|
className,
|
|
11066
11365
|
size = "medium",
|
|
@@ -11098,7 +11397,7 @@ var SignUp2 = ({
|
|
|
11098
11397
|
window.location.href = response.data.redirectURL;
|
|
11099
11398
|
}
|
|
11100
11399
|
};
|
|
11101
|
-
return /* @__PURE__ */ (0,
|
|
11400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11102
11401
|
BaseSignUp_default2,
|
|
11103
11402
|
{
|
|
11104
11403
|
afterSignUpUrl,
|
|
@@ -11120,13 +11419,13 @@ var SignUp2 = ({
|
|
|
11120
11419
|
var SignUp_default2 = SignUp2;
|
|
11121
11420
|
|
|
11122
11421
|
// src/components/presentation/auth/SignUp/SignUp.tsx
|
|
11123
|
-
var
|
|
11422
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
11124
11423
|
var SignUp3 = (props) => {
|
|
11125
11424
|
const { platform } = useAsgardeo_default();
|
|
11126
11425
|
if (platform === import_browser70.Platform.AsgardeoV2) {
|
|
11127
|
-
return /* @__PURE__ */ (0,
|
|
11426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SignUp_default2, { ...props });
|
|
11128
11427
|
}
|
|
11129
|
-
return /* @__PURE__ */ (0,
|
|
11428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SignUp_default, { ...props });
|
|
11130
11429
|
};
|
|
11131
11430
|
var SignUp_default3 = SignUp3;
|
|
11132
11431
|
|
|
@@ -11136,12 +11435,12 @@ var import_browser72 = require("@asgardeo/browser");
|
|
|
11136
11435
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
11137
11436
|
var import_browser71 = require("@asgardeo/browser");
|
|
11138
11437
|
var import_css42 = require("@emotion/css");
|
|
11139
|
-
var
|
|
11438
|
+
var import_react71 = require("react");
|
|
11140
11439
|
|
|
11141
11440
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.ts
|
|
11142
11441
|
var import_css41 = require("@emotion/css");
|
|
11143
|
-
var
|
|
11144
|
-
var useStyles18 = (theme, colorScheme) => (0,
|
|
11442
|
+
var import_react70 = require("react");
|
|
11443
|
+
var useStyles18 = (theme, colorScheme) => (0, import_react70.useMemo)(() => {
|
|
11145
11444
|
const card = import_css41.css`
|
|
11146
11445
|
background: ${theme.vars.colors.background.surface};
|
|
11147
11446
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -11179,7 +11478,7 @@ var useStyles18 = (theme, colorScheme) => (0, import_react69.useMemo)(() => {
|
|
|
11179
11478
|
var BaseInviteUser_styles_default = useStyles18;
|
|
11180
11479
|
|
|
11181
11480
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
11182
|
-
var
|
|
11481
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
11183
11482
|
var BaseInviteUser = ({
|
|
11184
11483
|
onInitialize,
|
|
11185
11484
|
onSubmit,
|
|
@@ -11199,18 +11498,18 @@ var BaseInviteUser = ({
|
|
|
11199
11498
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
11200
11499
|
const { theme } = useTheme_default();
|
|
11201
11500
|
const styles = BaseInviteUser_styles_default(theme, theme.vars.colors.text.primary);
|
|
11202
|
-
const [isLoading, setIsLoading] = (0,
|
|
11203
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
11204
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
11205
|
-
const [apiError, setApiError] = (0,
|
|
11206
|
-
const [formValues, setFormValues] = (0,
|
|
11207
|
-
const [formErrors, setFormErrors] = (0,
|
|
11208
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
11209
|
-
const [inviteLink, setInviteLink] = (0,
|
|
11210
|
-
const [inviteLinkCopied, setInviteLinkCopied] = (0,
|
|
11211
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
11212
|
-
const initializationAttemptedRef = (0,
|
|
11213
|
-
const handleError = (0,
|
|
11501
|
+
const [isLoading, setIsLoading] = (0, import_react71.useState)(false);
|
|
11502
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react71.useState)(false);
|
|
11503
|
+
const [currentFlow, setCurrentFlow] = (0, import_react71.useState)(null);
|
|
11504
|
+
const [apiError, setApiError] = (0, import_react71.useState)(null);
|
|
11505
|
+
const [formValues, setFormValues] = (0, import_react71.useState)({});
|
|
11506
|
+
const [formErrors, setFormErrors] = (0, import_react71.useState)({});
|
|
11507
|
+
const [touchedFields, setTouchedFields] = (0, import_react71.useState)({});
|
|
11508
|
+
const [inviteLink, setInviteLink] = (0, import_react71.useState)();
|
|
11509
|
+
const [inviteLinkCopied, setInviteLinkCopied] = (0, import_react71.useState)(false);
|
|
11510
|
+
const [isFormValid, setIsFormValid] = (0, import_react71.useState)(true);
|
|
11511
|
+
const initializationAttemptedRef = (0, import_react71.useRef)(false);
|
|
11512
|
+
const handleError = (0, import_react71.useCallback)(
|
|
11214
11513
|
(error) => {
|
|
11215
11514
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.inviteUser.errors.generic");
|
|
11216
11515
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -11218,7 +11517,7 @@ var BaseInviteUser = ({
|
|
|
11218
11517
|
},
|
|
11219
11518
|
[t, onError]
|
|
11220
11519
|
);
|
|
11221
|
-
const normalizeFlowResponseLocal = (0,
|
|
11520
|
+
const normalizeFlowResponseLocal = (0, import_react71.useCallback)(
|
|
11222
11521
|
(response) => {
|
|
11223
11522
|
if (!response?.data?.meta?.components) {
|
|
11224
11523
|
return response;
|
|
@@ -11246,7 +11545,7 @@ var BaseInviteUser = ({
|
|
|
11246
11545
|
},
|
|
11247
11546
|
[t, children]
|
|
11248
11547
|
);
|
|
11249
|
-
const handleInputChange = (0,
|
|
11548
|
+
const handleInputChange = (0, import_react71.useCallback)((name, value) => {
|
|
11250
11549
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
11251
11550
|
setFormErrors((prev) => {
|
|
11252
11551
|
const newErrors = { ...prev };
|
|
@@ -11254,10 +11553,10 @@ var BaseInviteUser = ({
|
|
|
11254
11553
|
return newErrors;
|
|
11255
11554
|
});
|
|
11256
11555
|
}, []);
|
|
11257
|
-
const handleInputBlur = (0,
|
|
11556
|
+
const handleInputBlur = (0, import_react71.useCallback)((name) => {
|
|
11258
11557
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
11259
11558
|
}, []);
|
|
11260
|
-
const validateForm = (0,
|
|
11559
|
+
const validateForm = (0, import_react71.useCallback)(
|
|
11261
11560
|
(components2) => {
|
|
11262
11561
|
const errors = {};
|
|
11263
11562
|
const validateComponents = (comps) => {
|
|
@@ -11281,7 +11580,7 @@ var BaseInviteUser = ({
|
|
|
11281
11580
|
},
|
|
11282
11581
|
[formValues]
|
|
11283
11582
|
);
|
|
11284
|
-
const handleSubmit = (0,
|
|
11583
|
+
const handleSubmit = (0, import_react71.useCallback)(
|
|
11285
11584
|
async (component, data) => {
|
|
11286
11585
|
if (!currentFlow) {
|
|
11287
11586
|
return;
|
|
@@ -11344,7 +11643,7 @@ var BaseInviteUser = ({
|
|
|
11344
11643
|
normalizeFlowResponseLocal
|
|
11345
11644
|
]
|
|
11346
11645
|
);
|
|
11347
|
-
const copyInviteLink = (0,
|
|
11646
|
+
const copyInviteLink = (0, import_react71.useCallback)(async () => {
|
|
11348
11647
|
if (!inviteLink) return;
|
|
11349
11648
|
try {
|
|
11350
11649
|
await navigator.clipboard.writeText(inviteLink);
|
|
@@ -11361,7 +11660,7 @@ var BaseInviteUser = ({
|
|
|
11361
11660
|
setTimeout(() => setInviteLinkCopied(false), 3e3);
|
|
11362
11661
|
}
|
|
11363
11662
|
}, [inviteLink]);
|
|
11364
|
-
const resetFlow = (0,
|
|
11663
|
+
const resetFlow = (0, import_react71.useCallback)(() => {
|
|
11365
11664
|
setIsFlowInitialized(false);
|
|
11366
11665
|
setCurrentFlow(null);
|
|
11367
11666
|
setApiError(null);
|
|
@@ -11372,7 +11671,7 @@ var BaseInviteUser = ({
|
|
|
11372
11671
|
setInviteLinkCopied(false);
|
|
11373
11672
|
initializationAttemptedRef.current = false;
|
|
11374
11673
|
}, []);
|
|
11375
|
-
(0,
|
|
11674
|
+
(0, import_react71.useEffect)(() => {
|
|
11376
11675
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
11377
11676
|
initializationAttemptedRef.current = true;
|
|
11378
11677
|
(async () => {
|
|
@@ -11399,7 +11698,7 @@ var BaseInviteUser = ({
|
|
|
11399
11698
|
})();
|
|
11400
11699
|
}
|
|
11401
11700
|
}, [isInitialized, isFlowInitialized, onInitialize, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
11402
|
-
(0,
|
|
11701
|
+
(0, import_react71.useEffect)(() => {
|
|
11403
11702
|
if (currentFlow && isFlowInitialized) {
|
|
11404
11703
|
const components2 = currentFlow.data?.components || [];
|
|
11405
11704
|
if (components2.length > 0) {
|
|
@@ -11408,7 +11707,7 @@ var BaseInviteUser = ({
|
|
|
11408
11707
|
}
|
|
11409
11708
|
}
|
|
11410
11709
|
}, [formValues, currentFlow, isFlowInitialized, validateForm]);
|
|
11411
|
-
const extractHeadings = (0,
|
|
11710
|
+
const extractHeadings = (0, import_react71.useCallback)((components2) => {
|
|
11412
11711
|
let title2;
|
|
11413
11712
|
let subtitle2;
|
|
11414
11713
|
components2.forEach((comp) => {
|
|
@@ -11422,13 +11721,13 @@ var BaseInviteUser = ({
|
|
|
11422
11721
|
});
|
|
11423
11722
|
return { subtitle: subtitle2, title: title2 };
|
|
11424
11723
|
}, []);
|
|
11425
|
-
const filterHeadings = (0,
|
|
11724
|
+
const filterHeadings = (0, import_react71.useCallback)(
|
|
11426
11725
|
(components2) => components2.filter(
|
|
11427
11726
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
11428
11727
|
),
|
|
11429
11728
|
[]
|
|
11430
11729
|
);
|
|
11431
|
-
const renderComponents = (0,
|
|
11730
|
+
const renderComponents = (0, import_react71.useCallback)(
|
|
11432
11731
|
(components2) => renderInviteUserComponents(
|
|
11433
11732
|
components2,
|
|
11434
11733
|
formValues,
|
|
@@ -11483,28 +11782,28 @@ var BaseInviteUser = ({
|
|
|
11483
11782
|
values: formValues
|
|
11484
11783
|
};
|
|
11485
11784
|
if (children) {
|
|
11486
|
-
return /* @__PURE__ */ (0,
|
|
11785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className, children: children(renderProps) });
|
|
11487
11786
|
}
|
|
11488
11787
|
if (!isInitialized) {
|
|
11489
|
-
return /* @__PURE__ */ (0,
|
|
11788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
11490
11789
|
}
|
|
11491
11790
|
if (!isFlowInitialized && isLoading) {
|
|
11492
|
-
return /* @__PURE__ */ (0,
|
|
11791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
11493
11792
|
}
|
|
11494
11793
|
if (!currentFlow && apiError) {
|
|
11495
|
-
return /* @__PURE__ */ (0,
|
|
11496
|
-
/* @__PURE__ */ (0,
|
|
11497
|
-
/* @__PURE__ */ (0,
|
|
11794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Alert_default, { variant: "error", children: [
|
|
11795
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Title, { children: "Error" }),
|
|
11796
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: apiError.message })
|
|
11498
11797
|
] }) }) });
|
|
11499
11798
|
}
|
|
11500
11799
|
if (isInviteGenerated && inviteLink) {
|
|
11501
|
-
return /* @__PURE__ */ (0,
|
|
11502
|
-
/* @__PURE__ */ (0,
|
|
11503
|
-
/* @__PURE__ */ (0,
|
|
11504
|
-
/* @__PURE__ */ (0,
|
|
11505
|
-
/* @__PURE__ */ (0,
|
|
11506
|
-
/* @__PURE__ */ (0,
|
|
11507
|
-
/* @__PURE__ */ (0,
|
|
11800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: [
|
|
11801
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Invite Link Generated!" }) }),
|
|
11802
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Content, { children: [
|
|
11803
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "success", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: "Share this link with the user to complete their registration." }) }),
|
|
11804
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
11805
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body2", style: { marginBottom: "0.5rem" }, children: "Invite Link" }),
|
|
11806
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
11508
11807
|
"div",
|
|
11509
11808
|
{
|
|
11510
11809
|
style: {
|
|
@@ -11517,26 +11816,26 @@ var BaseInviteUser = ({
|
|
|
11517
11816
|
wordBreak: "break-all"
|
|
11518
11817
|
},
|
|
11519
11818
|
children: [
|
|
11520
|
-
/* @__PURE__ */ (0,
|
|
11521
|
-
/* @__PURE__ */ (0,
|
|
11819
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body2", style: { flex: 1 }, children: inviteLink }),
|
|
11820
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button_default, { variant: "outline", size: "small", onClick: copyInviteLink, children: inviteLinkCopied ? "Copied!" : "Copy" })
|
|
11522
11821
|
]
|
|
11523
11822
|
}
|
|
11524
11823
|
)
|
|
11525
11824
|
] }),
|
|
11526
|
-
/* @__PURE__ */ (0,
|
|
11825
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", gap: "0.5rem", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button_default, { variant: "outline", onClick: resetFlow, children: "Invite Another User" }) })
|
|
11527
11826
|
] })
|
|
11528
11827
|
] });
|
|
11529
11828
|
}
|
|
11530
|
-
return /* @__PURE__ */ (0,
|
|
11531
|
-
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0,
|
|
11532
|
-
showTitle && title && /* @__PURE__ */ (0,
|
|
11533
|
-
showSubtitle && subtitle && /* @__PURE__ */ (0,
|
|
11829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: [
|
|
11830
|
+
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
11831
|
+
showTitle && title && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
11832
|
+
showSubtitle && subtitle && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
11534
11833
|
] }),
|
|
11535
|
-
/* @__PURE__ */ (0,
|
|
11536
|
-
apiError && /* @__PURE__ */ (0,
|
|
11537
|
-
/* @__PURE__ */ (0,
|
|
11538
|
-
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0,
|
|
11539
|
-
isLoading && /* @__PURE__ */ (0,
|
|
11834
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Content, { children: [
|
|
11835
|
+
apiError && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "error", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: apiError.message }) }) }),
|
|
11836
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { children: [
|
|
11837
|
+
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body1", children: "No form components available" }) }),
|
|
11838
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "small" }) })
|
|
11540
11839
|
] })
|
|
11541
11840
|
] })
|
|
11542
11841
|
] });
|
|
@@ -11544,7 +11843,7 @@ var BaseInviteUser = ({
|
|
|
11544
11843
|
var BaseInviteUser_default = BaseInviteUser;
|
|
11545
11844
|
|
|
11546
11845
|
// src/components/presentation/auth/InviteUser/v2/InviteUser.tsx
|
|
11547
|
-
var
|
|
11846
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
11548
11847
|
var InviteUser = ({
|
|
11549
11848
|
onInviteLinkGenerated,
|
|
11550
11849
|
onError,
|
|
@@ -11588,7 +11887,7 @@ var InviteUser = ({
|
|
|
11588
11887
|
});
|
|
11589
11888
|
return response.data;
|
|
11590
11889
|
};
|
|
11591
|
-
return /* @__PURE__ */ (0,
|
|
11890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
11592
11891
|
BaseInviteUser_default,
|
|
11593
11892
|
{
|
|
11594
11893
|
onInitialize: handleInitialize,
|
|
@@ -11609,16 +11908,16 @@ var InviteUser = ({
|
|
|
11609
11908
|
var InviteUser_default = InviteUser;
|
|
11610
11909
|
|
|
11611
11910
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
11612
|
-
var
|
|
11911
|
+
var import_react74 = require("react");
|
|
11613
11912
|
|
|
11614
11913
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
11615
11914
|
var import_css44 = require("@emotion/css");
|
|
11616
|
-
var
|
|
11915
|
+
var import_react73 = require("react");
|
|
11617
11916
|
|
|
11618
11917
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.ts
|
|
11619
11918
|
var import_css43 = require("@emotion/css");
|
|
11620
|
-
var
|
|
11621
|
-
var useStyles19 = (theme, colorScheme) => (0,
|
|
11919
|
+
var import_react72 = require("react");
|
|
11920
|
+
var useStyles19 = (theme, colorScheme) => (0, import_react72.useMemo)(() => {
|
|
11622
11921
|
const card = import_css43.css`
|
|
11623
11922
|
background: ${theme.vars.colors.background.surface};
|
|
11624
11923
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -11656,7 +11955,7 @@ var useStyles19 = (theme, colorScheme) => (0, import_react71.useMemo)(() => {
|
|
|
11656
11955
|
var BaseAcceptInvite_styles_default = useStyles19;
|
|
11657
11956
|
|
|
11658
11957
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
11659
|
-
var
|
|
11958
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11660
11959
|
var BaseAcceptInvite = ({
|
|
11661
11960
|
flowId,
|
|
11662
11961
|
inviteToken,
|
|
@@ -11677,19 +11976,19 @@ var BaseAcceptInvite = ({
|
|
|
11677
11976
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
11678
11977
|
const { theme } = useTheme_default();
|
|
11679
11978
|
const styles = BaseAcceptInvite_styles_default(theme, theme.vars.colors.text.primary);
|
|
11680
|
-
const [isLoading, setIsLoading] = (0,
|
|
11681
|
-
const [isValidatingToken, setIsValidatingToken] = (0,
|
|
11682
|
-
const [isTokenInvalid, setIsTokenInvalid] = (0,
|
|
11683
|
-
const [isComplete, setIsComplete] = (0,
|
|
11684
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
11685
|
-
const [apiError, setApiError] = (0,
|
|
11686
|
-
const [formValues, setFormValues] = (0,
|
|
11687
|
-
const [formErrors, setFormErrors] = (0,
|
|
11688
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
11689
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
11690
|
-
const [completionTitle, setCompletionTitle] = (0,
|
|
11691
|
-
const tokenValidationAttemptedRef = (0,
|
|
11692
|
-
const handleError = (0,
|
|
11979
|
+
const [isLoading, setIsLoading] = (0, import_react73.useState)(false);
|
|
11980
|
+
const [isValidatingToken, setIsValidatingToken] = (0, import_react73.useState)(true);
|
|
11981
|
+
const [isTokenInvalid, setIsTokenInvalid] = (0, import_react73.useState)(false);
|
|
11982
|
+
const [isComplete, setIsComplete] = (0, import_react73.useState)(false);
|
|
11983
|
+
const [currentFlow, setCurrentFlow] = (0, import_react73.useState)(null);
|
|
11984
|
+
const [apiError, setApiError] = (0, import_react73.useState)(null);
|
|
11985
|
+
const [formValues, setFormValues] = (0, import_react73.useState)({});
|
|
11986
|
+
const [formErrors, setFormErrors] = (0, import_react73.useState)({});
|
|
11987
|
+
const [touchedFields, setTouchedFields] = (0, import_react73.useState)({});
|
|
11988
|
+
const [isFormValid, setIsFormValid] = (0, import_react73.useState)(true);
|
|
11989
|
+
const [completionTitle, setCompletionTitle] = (0, import_react73.useState)(void 0);
|
|
11990
|
+
const tokenValidationAttemptedRef = (0, import_react73.useRef)(false);
|
|
11991
|
+
const handleError = (0, import_react73.useCallback)(
|
|
11693
11992
|
(error) => {
|
|
11694
11993
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.acceptInvite.errors.generic");
|
|
11695
11994
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -11697,7 +11996,7 @@ var BaseAcceptInvite = ({
|
|
|
11697
11996
|
},
|
|
11698
11997
|
[t, onError]
|
|
11699
11998
|
);
|
|
11700
|
-
const normalizeFlowResponseLocal = (0,
|
|
11999
|
+
const normalizeFlowResponseLocal = (0, import_react73.useCallback)(
|
|
11701
12000
|
(response) => {
|
|
11702
12001
|
if (!response?.data?.meta?.components) {
|
|
11703
12002
|
return response;
|
|
@@ -11757,7 +12056,7 @@ var BaseAcceptInvite = ({
|
|
|
11757
12056
|
},
|
|
11758
12057
|
tokenValidationAttemptedRef
|
|
11759
12058
|
});
|
|
11760
|
-
const handleInputChange = (0,
|
|
12059
|
+
const handleInputChange = (0, import_react73.useCallback)((name, value) => {
|
|
11761
12060
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
11762
12061
|
setFormErrors((prev) => {
|
|
11763
12062
|
const newErrors = { ...prev };
|
|
@@ -11765,10 +12064,10 @@ var BaseAcceptInvite = ({
|
|
|
11765
12064
|
return newErrors;
|
|
11766
12065
|
});
|
|
11767
12066
|
}, []);
|
|
11768
|
-
const handleInputBlur = (0,
|
|
12067
|
+
const handleInputBlur = (0, import_react73.useCallback)((name) => {
|
|
11769
12068
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
11770
12069
|
}, []);
|
|
11771
|
-
const validateForm = (0,
|
|
12070
|
+
const validateForm = (0, import_react73.useCallback)(
|
|
11772
12071
|
(components2) => {
|
|
11773
12072
|
const errors = {};
|
|
11774
12073
|
const validateComponents = (comps) => {
|
|
@@ -11789,7 +12088,7 @@ var BaseAcceptInvite = ({
|
|
|
11789
12088
|
},
|
|
11790
12089
|
[formValues]
|
|
11791
12090
|
);
|
|
11792
|
-
const handleSubmit = (0,
|
|
12091
|
+
const handleSubmit = (0, import_react73.useCallback)(
|
|
11793
12092
|
async (component, data) => {
|
|
11794
12093
|
if (!currentFlow) {
|
|
11795
12094
|
return;
|
|
@@ -11868,7 +12167,7 @@ var BaseAcceptInvite = ({
|
|
|
11868
12167
|
normalizeFlowResponseLocal
|
|
11869
12168
|
]
|
|
11870
12169
|
);
|
|
11871
|
-
(0,
|
|
12170
|
+
(0, import_react73.useEffect)(() => {
|
|
11872
12171
|
if (tokenValidationAttemptedRef.current) {
|
|
11873
12172
|
return;
|
|
11874
12173
|
}
|
|
@@ -11910,7 +12209,7 @@ var BaseAcceptInvite = ({
|
|
|
11910
12209
|
}
|
|
11911
12210
|
})();
|
|
11912
12211
|
}, [flowId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
11913
|
-
const extractHeadings = (0,
|
|
12212
|
+
const extractHeadings = (0, import_react73.useCallback)((components2) => {
|
|
11914
12213
|
let title2;
|
|
11915
12214
|
let subtitle2;
|
|
11916
12215
|
components2.forEach((comp) => {
|
|
@@ -11924,13 +12223,13 @@ var BaseAcceptInvite = ({
|
|
|
11924
12223
|
});
|
|
11925
12224
|
return { subtitle: subtitle2, title: title2 };
|
|
11926
12225
|
}, []);
|
|
11927
|
-
const filterHeadings = (0,
|
|
12226
|
+
const filterHeadings = (0, import_react73.useCallback)(
|
|
11928
12227
|
(components2) => components2.filter(
|
|
11929
12228
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
11930
12229
|
),
|
|
11931
12230
|
[]
|
|
11932
12231
|
);
|
|
11933
|
-
const renderComponents = (0,
|
|
12232
|
+
const renderComponents = (0, import_react73.useCallback)(
|
|
11934
12233
|
(components2) => renderInviteUserComponents(
|
|
11935
12234
|
components2,
|
|
11936
12235
|
formValues,
|
|
@@ -11985,50 +12284,50 @@ var BaseAcceptInvite = ({
|
|
|
11985
12284
|
values: formValues
|
|
11986
12285
|
};
|
|
11987
12286
|
if (children) {
|
|
11988
|
-
return /* @__PURE__ */ (0,
|
|
12287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className, children: children(renderProps) });
|
|
11989
12288
|
}
|
|
11990
12289
|
if (isValidatingToken) {
|
|
11991
|
-
return /* @__PURE__ */ (0,
|
|
11992
|
-
/* @__PURE__ */ (0,
|
|
11993
|
-
/* @__PURE__ */ (0,
|
|
12290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: { alignItems: "center", display: "flex", flexDirection: "column", gap: "1rem", padding: "2rem" }, children: [
|
|
12291
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Spinner_default, { size: "medium" }),
|
|
12292
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", children: "Validating your invite link..." })
|
|
11994
12293
|
] }) }) });
|
|
11995
12294
|
}
|
|
11996
12295
|
if (isTokenInvalid) {
|
|
11997
|
-
return /* @__PURE__ */ (0,
|
|
11998
|
-
/* @__PURE__ */ (0,
|
|
11999
|
-
/* @__PURE__ */ (0,
|
|
12000
|
-
/* @__PURE__ */ (0,
|
|
12001
|
-
/* @__PURE__ */ (0,
|
|
12002
|
-
/* @__PURE__ */ (0,
|
|
12296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12297
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Invalid Invite Link" }) }),
|
|
12298
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12299
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Alert_default, { variant: "error", children: [
|
|
12300
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Title, { children: "Unable to verify invite" }),
|
|
12301
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: apiError?.message || "This invite link is invalid or has expired. Please contact your administrator for a new invite." })
|
|
12003
12302
|
] }),
|
|
12004
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12303
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "outline", onClick: onGoToSignIn, children: "Go to Sign In" }) })
|
|
12005
12304
|
] })
|
|
12006
12305
|
] });
|
|
12007
12306
|
}
|
|
12008
12307
|
if (isComplete) {
|
|
12009
|
-
return /* @__PURE__ */ (0,
|
|
12010
|
-
/* @__PURE__ */ (0,
|
|
12011
|
-
/* @__PURE__ */ (0,
|
|
12012
|
-
/* @__PURE__ */ (0,
|
|
12013
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12309
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Account Setup Complete!" }) }),
|
|
12310
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12311
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "success", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: "Your account has been successfully set up. You can now sign in with your credentials." }) }),
|
|
12312
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "solid", color: "primary", onClick: onGoToSignIn, children: "Sign In" }) })
|
|
12014
12313
|
] })
|
|
12015
12314
|
] });
|
|
12016
12315
|
}
|
|
12017
|
-
return /* @__PURE__ */ (0,
|
|
12018
|
-
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0,
|
|
12019
|
-
showTitle && title && /* @__PURE__ */ (0,
|
|
12020
|
-
showSubtitle && subtitle && /* @__PURE__ */ (0,
|
|
12316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12317
|
+
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
12318
|
+
showTitle && title && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
12319
|
+
showSubtitle && subtitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
12021
12320
|
] }),
|
|
12022
|
-
/* @__PURE__ */ (0,
|
|
12023
|
-
apiError && /* @__PURE__ */ (0,
|
|
12024
|
-
/* @__PURE__ */ (0,
|
|
12025
|
-
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0,
|
|
12026
|
-
isLoading && /* @__PURE__ */ (0,
|
|
12321
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12322
|
+
apiError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "error", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: apiError.message }) }) }),
|
|
12323
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12324
|
+
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", children: "No form components available" }) }),
|
|
12325
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Spinner_default, { size: "small" }) })
|
|
12027
12326
|
] }),
|
|
12028
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12327
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { marginTop: "1.5rem", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Typography_default, { variant: "body2", children: [
|
|
12029
12328
|
"Already have an account?",
|
|
12030
12329
|
" ",
|
|
12031
|
-
/* @__PURE__ */ (0,
|
|
12330
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "text", onClick: onGoToSignIn, style: { minWidth: "auto", padding: 0 }, children: "Sign In" })
|
|
12032
12331
|
] }) })
|
|
12033
12332
|
] })
|
|
12034
12333
|
] });
|
|
@@ -12036,7 +12335,7 @@ var BaseAcceptInvite = ({
|
|
|
12036
12335
|
var BaseAcceptInvite_default = BaseAcceptInvite;
|
|
12037
12336
|
|
|
12038
12337
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
12039
|
-
var
|
|
12338
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
12040
12339
|
var getUrlParams = () => {
|
|
12041
12340
|
if (typeof window === "undefined") {
|
|
12042
12341
|
return {};
|
|
@@ -12062,10 +12361,10 @@ var AcceptInvite = ({
|
|
|
12062
12361
|
showTitle = true,
|
|
12063
12362
|
showSubtitle = true
|
|
12064
12363
|
}) => {
|
|
12065
|
-
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0,
|
|
12364
|
+
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0, import_react74.useMemo)(() => getUrlParams(), []);
|
|
12066
12365
|
const flowId = flowIdProp || urlFlowId;
|
|
12067
12366
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
12068
|
-
const apiBaseUrl = (0,
|
|
12367
|
+
const apiBaseUrl = (0, import_react74.useMemo)(() => {
|
|
12069
12368
|
if (baseUrl) {
|
|
12070
12369
|
return baseUrl;
|
|
12071
12370
|
}
|
|
@@ -12092,7 +12391,7 @@ var AcceptInvite = ({
|
|
|
12092
12391
|
}
|
|
12093
12392
|
return response.json();
|
|
12094
12393
|
};
|
|
12095
|
-
return /* @__PURE__ */ (0,
|
|
12394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12096
12395
|
BaseAcceptInvite_default,
|
|
12097
12396
|
{
|
|
12098
12397
|
flowId,
|
|
@@ -12115,9 +12414,9 @@ var AcceptInvite_default = AcceptInvite;
|
|
|
12115
12414
|
|
|
12116
12415
|
// src/components/auth/Callback/Callback.tsx
|
|
12117
12416
|
var import_browser73 = require("@asgardeo/browser");
|
|
12118
|
-
var
|
|
12417
|
+
var import_react75 = require("react");
|
|
12119
12418
|
var Callback = ({ onNavigate, onError }) => {
|
|
12120
|
-
const processingRef = (0,
|
|
12419
|
+
const processingRef = (0, import_react75.useRef)(false);
|
|
12121
12420
|
const navigate6 = (path) => {
|
|
12122
12421
|
if (onNavigate) {
|
|
12123
12422
|
onNavigate(path);
|
|
@@ -12125,7 +12424,7 @@ var Callback = ({ onNavigate, onError }) => {
|
|
|
12125
12424
|
(0, import_browser73.navigate)(path);
|
|
12126
12425
|
}
|
|
12127
12426
|
};
|
|
12128
|
-
(0,
|
|
12427
|
+
(0, import_react75.useEffect)(() => {
|
|
12129
12428
|
const processOAuthCallback = () => {
|
|
12130
12429
|
if (processingRef.current) {
|
|
12131
12430
|
return;
|
|
@@ -12203,45 +12502,45 @@ var Callback = ({ onNavigate, onError }) => {
|
|
|
12203
12502
|
};
|
|
12204
12503
|
|
|
12205
12504
|
// src/components/presentation/User/BaseUser.tsx
|
|
12206
|
-
var
|
|
12505
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12207
12506
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
12208
12507
|
if (!user) {
|
|
12209
|
-
return /* @__PURE__ */ (0,
|
|
12508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: fallback });
|
|
12210
12509
|
}
|
|
12211
|
-
return /* @__PURE__ */ (0,
|
|
12510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: children(user) });
|
|
12212
12511
|
};
|
|
12213
12512
|
BaseUser.displayName = "BaseUser";
|
|
12214
12513
|
var BaseUser_default = BaseUser;
|
|
12215
12514
|
|
|
12216
12515
|
// src/components/presentation/User/User.tsx
|
|
12217
|
-
var
|
|
12516
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12218
12517
|
var User5 = ({ children, fallback = null }) => {
|
|
12219
12518
|
const { user } = useAsgardeo_default();
|
|
12220
|
-
return /* @__PURE__ */ (0,
|
|
12519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BaseUser_default, { user, fallback, children });
|
|
12221
12520
|
};
|
|
12222
12521
|
User5.displayName = "User";
|
|
12223
12522
|
var User_default = User5;
|
|
12224
12523
|
|
|
12225
12524
|
// src/components/presentation/Organization/BaseOrganization.tsx
|
|
12226
|
-
var
|
|
12525
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12227
12526
|
var BaseOrganization = ({
|
|
12228
12527
|
children,
|
|
12229
12528
|
fallback = null,
|
|
12230
12529
|
organization
|
|
12231
12530
|
}) => {
|
|
12232
12531
|
if (!organization) {
|
|
12233
|
-
return /* @__PURE__ */ (0,
|
|
12532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: fallback });
|
|
12234
12533
|
}
|
|
12235
|
-
return /* @__PURE__ */ (0,
|
|
12534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: children(organization) });
|
|
12236
12535
|
};
|
|
12237
12536
|
BaseOrganization.displayName = "BaseOrganization";
|
|
12238
12537
|
var BaseOrganization_default = BaseOrganization;
|
|
12239
12538
|
|
|
12240
12539
|
// src/components/presentation/Organization/Organization.tsx
|
|
12241
|
-
var
|
|
12540
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12242
12541
|
var Organization5 = ({ children, fallback = null }) => {
|
|
12243
12542
|
const { currentOrganization } = useOrganization_default();
|
|
12244
|
-
return /* @__PURE__ */ (0,
|
|
12543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BaseOrganization_default, { organization: currentOrganization, fallback, children });
|
|
12245
12544
|
};
|
|
12246
12545
|
Organization5.displayName = "Organization";
|
|
12247
12546
|
var Organization_default = Organization5;
|
|
@@ -12249,12 +12548,12 @@ var Organization_default = Organization5;
|
|
|
12249
12548
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
12250
12549
|
var import_browser79 = require("@asgardeo/browser");
|
|
12251
12550
|
var import_css52 = require("@emotion/css");
|
|
12252
|
-
var
|
|
12551
|
+
var import_react84 = require("react");
|
|
12253
12552
|
|
|
12254
12553
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
12255
12554
|
var import_browser74 = require("@asgardeo/browser");
|
|
12256
12555
|
var import_css45 = require("@emotion/css");
|
|
12257
|
-
var
|
|
12556
|
+
var import_react76 = require("react");
|
|
12258
12557
|
var useStyles20 = (theme, colorScheme) => {
|
|
12259
12558
|
const valuePlaceholder = import_css45.css`
|
|
12260
12559
|
font-style: italic;
|
|
@@ -12299,7 +12598,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
12299
12598
|
padding: ${theme.vars.spacing.unit};
|
|
12300
12599
|
vertical-align: top;
|
|
12301
12600
|
`;
|
|
12302
|
-
return (0,
|
|
12601
|
+
return (0, import_react76.useMemo)(() => {
|
|
12303
12602
|
const root = import_css45.css`
|
|
12304
12603
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
12305
12604
|
min-width: 600px;
|
|
@@ -12511,12 +12810,12 @@ var getDisplayName_default = getDisplayName;
|
|
|
12511
12810
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
12512
12811
|
var import_browser76 = require("@asgardeo/browser");
|
|
12513
12812
|
var import_css47 = require("@emotion/css");
|
|
12514
|
-
var
|
|
12813
|
+
var import_react78 = require("react");
|
|
12515
12814
|
|
|
12516
12815
|
// src/components/primitives/Avatar/Avatar.styles.ts
|
|
12517
12816
|
var import_css46 = require("@emotion/css");
|
|
12518
|
-
var
|
|
12519
|
-
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0,
|
|
12817
|
+
var import_react77 = require("react");
|
|
12818
|
+
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0, import_react77.useMemo)(() => {
|
|
12520
12819
|
const baseAvatar = import_css46.css`
|
|
12521
12820
|
align-items: center;
|
|
12522
12821
|
background: ${backgroundColor || theme.vars.colors.background.surface};
|
|
@@ -12580,7 +12879,7 @@ var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0, im
|
|
|
12580
12879
|
var Avatar_styles_default = useStyles21;
|
|
12581
12880
|
|
|
12582
12881
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
12583
|
-
var
|
|
12882
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12584
12883
|
var Avatar = ({
|
|
12585
12884
|
alt = "User avatar",
|
|
12586
12885
|
background = "random",
|
|
@@ -12610,7 +12909,7 @@ var Avatar = ({
|
|
|
12610
12909
|
const colors = generateColor(seed);
|
|
12611
12910
|
return `linear-gradient(${angle}deg, ${colors})`;
|
|
12612
12911
|
};
|
|
12613
|
-
const backgroundColor = (0,
|
|
12912
|
+
const backgroundColor = (0, import_react78.useMemo)(() => {
|
|
12614
12913
|
if (!name || imageUrl) {
|
|
12615
12914
|
return void 0;
|
|
12616
12915
|
}
|
|
@@ -12627,7 +12926,7 @@ var Avatar = ({
|
|
|
12627
12926
|
const getInitials = (fullName) => fullName.split(" ").map((part) => part[0]).slice(0, 2).join("").toUpperCase();
|
|
12628
12927
|
const renderContent = () => {
|
|
12629
12928
|
if (imageUrl) {
|
|
12630
|
-
return /* @__PURE__ */ (0,
|
|
12929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12631
12930
|
"img",
|
|
12632
12931
|
{
|
|
12633
12932
|
src: imageUrl,
|
|
@@ -12640,19 +12939,19 @@ var Avatar = ({
|
|
|
12640
12939
|
return getInitials(name);
|
|
12641
12940
|
}
|
|
12642
12941
|
if (isLoading) {
|
|
12643
|
-
return /* @__PURE__ */ (0,
|
|
12942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css47.cx)((0, import_browser76.withVendorCSSClassPrefix)((0, import_browser76.bem)("avatar", "skeleton")), styles["skeleton"]) });
|
|
12644
12943
|
}
|
|
12645
|
-
return /* @__PURE__ */ (0,
|
|
12944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12646
12945
|
"svg",
|
|
12647
12946
|
{
|
|
12648
12947
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12649
12948
|
viewBox: "0 0 640 640",
|
|
12650
12949
|
className: (0, import_css47.cx)((0, import_browser76.withVendorCSSClassPrefix)((0, import_browser76.bem)("avatar", "icon")), styles["icon"]),
|
|
12651
|
-
children: /* @__PURE__ */ (0,
|
|
12950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
12652
12951
|
}
|
|
12653
12952
|
);
|
|
12654
12953
|
};
|
|
12655
|
-
return /* @__PURE__ */ (0,
|
|
12954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12656
12955
|
"div",
|
|
12657
12956
|
{
|
|
12658
12957
|
className: (0, import_css47.cx)(
|
|
@@ -12671,13 +12970,13 @@ var Avatar = ({
|
|
|
12671
12970
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
12672
12971
|
var import_browser77 = require("@asgardeo/browser");
|
|
12673
12972
|
var import_css49 = require("@emotion/css");
|
|
12674
|
-
var
|
|
12675
|
-
var
|
|
12973
|
+
var import_react80 = require("@floating-ui/react");
|
|
12974
|
+
var import_react81 = require("react");
|
|
12676
12975
|
|
|
12677
12976
|
// src/components/primitives/Dialog/Dialog.styles.ts
|
|
12678
12977
|
var import_css48 = require("@emotion/css");
|
|
12679
|
-
var
|
|
12680
|
-
var useStyles22 = (theme, colorScheme) => (0,
|
|
12978
|
+
var import_react79 = require("react");
|
|
12979
|
+
var useStyles22 = (theme, colorScheme) => (0, import_react79.useMemo)(() => {
|
|
12681
12980
|
const overlay = import_css48.css`
|
|
12682
12981
|
background-color: rgba(0, 0, 0, 0.5);
|
|
12683
12982
|
display: flex;
|
|
@@ -12739,8 +13038,8 @@ var useStyles22 = (theme, colorScheme) => (0, import_react78.useMemo)(() => {
|
|
|
12739
13038
|
var Dialog_styles_default = useStyles22;
|
|
12740
13039
|
|
|
12741
13040
|
// src/components/primitives/Icons/LogOut.tsx
|
|
12742
|
-
var
|
|
12743
|
-
var LogOut = (props) => /* @__PURE__ */ (0,
|
|
13041
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
13042
|
+
var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
12744
13043
|
"svg",
|
|
12745
13044
|
{
|
|
12746
13045
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12754,17 +13053,17 @@ var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
|
12754
13053
|
strokeLinejoin: "round",
|
|
12755
13054
|
...props,
|
|
12756
13055
|
children: [
|
|
12757
|
-
/* @__PURE__ */ (0,
|
|
12758
|
-
/* @__PURE__ */ (0,
|
|
12759
|
-
/* @__PURE__ */ (0,
|
|
13056
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "m16 17 5-5-5-5" }),
|
|
13057
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "M21 12H9" }),
|
|
13058
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" })
|
|
12760
13059
|
]
|
|
12761
13060
|
}
|
|
12762
13061
|
);
|
|
12763
13062
|
var LogOut_default = LogOut;
|
|
12764
13063
|
|
|
12765
13064
|
// src/components/primitives/Icons/Plus.tsx
|
|
12766
|
-
var
|
|
12767
|
-
var Plus = (props) => /* @__PURE__ */ (0,
|
|
13065
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
13066
|
+
var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
12768
13067
|
"svg",
|
|
12769
13068
|
{
|
|
12770
13069
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12778,16 +13077,16 @@ var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
|
12778
13077
|
strokeLinejoin: "round",
|
|
12779
13078
|
...props,
|
|
12780
13079
|
children: [
|
|
12781
|
-
/* @__PURE__ */ (0,
|
|
12782
|
-
/* @__PURE__ */ (0,
|
|
13080
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M5 12h14" }),
|
|
13081
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M12 5v14" })
|
|
12783
13082
|
]
|
|
12784
13083
|
}
|
|
12785
13084
|
);
|
|
12786
13085
|
var Plus_default = Plus;
|
|
12787
13086
|
|
|
12788
13087
|
// src/components/primitives/Icons/User.tsx
|
|
12789
|
-
var
|
|
12790
|
-
var User7 = (props) => /* @__PURE__ */ (0,
|
|
13088
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
13089
|
+
var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
12791
13090
|
"svg",
|
|
12792
13091
|
{
|
|
12793
13092
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12801,16 +13100,16 @@ var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
|
12801
13100
|
strokeLinejoin: "round",
|
|
12802
13101
|
...props,
|
|
12803
13102
|
children: [
|
|
12804
|
-
/* @__PURE__ */ (0,
|
|
12805
|
-
/* @__PURE__ */ (0,
|
|
13103
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
13104
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("circle", { cx: "12", cy: "7", r: "4" })
|
|
12806
13105
|
]
|
|
12807
13106
|
}
|
|
12808
13107
|
);
|
|
12809
13108
|
var User_default2 = User7;
|
|
12810
13109
|
|
|
12811
13110
|
// src/components/primitives/Icons/X.tsx
|
|
12812
|
-
var
|
|
12813
|
-
var X = (props) => /* @__PURE__ */ (0,
|
|
13111
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13112
|
+
var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
12814
13113
|
"svg",
|
|
12815
13114
|
{
|
|
12816
13115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12824,37 +13123,37 @@ var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
|
12824
13123
|
strokeLinejoin: "round",
|
|
12825
13124
|
...props,
|
|
12826
13125
|
children: [
|
|
12827
|
-
/* @__PURE__ */ (0,
|
|
12828
|
-
/* @__PURE__ */ (0,
|
|
13126
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M18 6 6 18" }),
|
|
13127
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "m6 6 12 12" })
|
|
12829
13128
|
]
|
|
12830
13129
|
}
|
|
12831
13130
|
);
|
|
12832
13131
|
var X_default = X;
|
|
12833
13132
|
|
|
12834
13133
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
12835
|
-
var
|
|
13134
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
12836
13135
|
function useDialog({
|
|
12837
13136
|
initialOpen = false,
|
|
12838
13137
|
open: controlledOpen,
|
|
12839
13138
|
onOpenChange: setControlledOpen
|
|
12840
13139
|
} = {}) {
|
|
12841
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
12842
|
-
const [labelId, setLabelId] = (0,
|
|
12843
|
-
const [descriptionId, setDescriptionId] = (0,
|
|
13140
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react81.useState)(initialOpen);
|
|
13141
|
+
const [labelId, setLabelId] = (0, import_react81.useState)();
|
|
13142
|
+
const [descriptionId, setDescriptionId] = (0, import_react81.useState)();
|
|
12844
13143
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
12845
13144
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
12846
|
-
const data = (0,
|
|
13145
|
+
const data = (0, import_react80.useFloating)({
|
|
12847
13146
|
onOpenChange: setOpen,
|
|
12848
13147
|
open
|
|
12849
13148
|
});
|
|
12850
13149
|
const { context } = data;
|
|
12851
|
-
const click = (0,
|
|
13150
|
+
const click = (0, import_react80.useClick)(context, {
|
|
12852
13151
|
enabled: controlledOpen == null
|
|
12853
13152
|
});
|
|
12854
|
-
const dismiss = (0,
|
|
12855
|
-
const role = (0,
|
|
12856
|
-
const interactions = (0,
|
|
12857
|
-
return (0,
|
|
13153
|
+
const dismiss = (0, import_react80.useDismiss)(context, { outsidePressEvent: "mousedown" });
|
|
13154
|
+
const role = (0, import_react80.useRole)(context);
|
|
13155
|
+
const interactions = (0, import_react80.useInteractions)([click, dismiss, role]);
|
|
13156
|
+
return (0, import_react81.useMemo)(
|
|
12858
13157
|
() => ({
|
|
12859
13158
|
open,
|
|
12860
13159
|
setOpen,
|
|
@@ -12868,9 +13167,9 @@ function useDialog({
|
|
|
12868
13167
|
[open, setOpen, interactions, data, labelId, descriptionId]
|
|
12869
13168
|
);
|
|
12870
13169
|
}
|
|
12871
|
-
var DialogContext = (0,
|
|
13170
|
+
var DialogContext = (0, import_react81.createContext)(null);
|
|
12872
13171
|
var useDialogContext = () => {
|
|
12873
|
-
const context = (0,
|
|
13172
|
+
const context = (0, import_react81.useContext)(DialogContext);
|
|
12874
13173
|
if (context == null) {
|
|
12875
13174
|
throw new Error("Dialog components must be wrapped in <Dialog />");
|
|
12876
13175
|
}
|
|
@@ -12878,15 +13177,15 @@ var useDialogContext = () => {
|
|
|
12878
13177
|
};
|
|
12879
13178
|
function Dialog({ children, ...options }) {
|
|
12880
13179
|
const dialog = useDialog(options);
|
|
12881
|
-
return /* @__PURE__ */ (0,
|
|
13180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
12882
13181
|
}
|
|
12883
|
-
var DialogTrigger = (0,
|
|
13182
|
+
var DialogTrigger = (0, import_react81.forwardRef)(
|
|
12884
13183
|
({ children, asChild = false, ...props }, propRef) => {
|
|
12885
13184
|
const context = useDialogContext();
|
|
12886
13185
|
const childrenRef = children.ref;
|
|
12887
|
-
const ref = (0,
|
|
12888
|
-
if (asChild && (0,
|
|
12889
|
-
return (0,
|
|
13186
|
+
const ref = (0, import_react80.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
13187
|
+
if (asChild && (0, import_react81.isValidElement)(children)) {
|
|
13188
|
+
return (0, import_react81.cloneElement)(
|
|
12890
13189
|
children,
|
|
12891
13190
|
context.getReferenceProps({
|
|
12892
13191
|
ref,
|
|
@@ -12896,22 +13195,22 @@ var DialogTrigger = (0, import_react80.forwardRef)(
|
|
|
12896
13195
|
})
|
|
12897
13196
|
);
|
|
12898
13197
|
}
|
|
12899
|
-
return /* @__PURE__ */ (0,
|
|
13198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
12900
13199
|
}
|
|
12901
13200
|
);
|
|
12902
|
-
var DialogContent = (0,
|
|
13201
|
+
var DialogContent = (0, import_react81.forwardRef)(
|
|
12903
13202
|
(props, propRef) => {
|
|
12904
13203
|
const { context: floatingContext, ...context } = useDialogContext();
|
|
12905
13204
|
const { theme, colorScheme } = useTheme_default();
|
|
12906
13205
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12907
|
-
const ref = (0,
|
|
13206
|
+
const ref = (0, import_react80.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
12908
13207
|
if (!floatingContext.open) return null;
|
|
12909
|
-
return /* @__PURE__ */ (0,
|
|
12910
|
-
|
|
13208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_react80.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13209
|
+
import_react80.FloatingOverlay,
|
|
12911
13210
|
{
|
|
12912
13211
|
className: (0, import_css49.cx)((0, import_browser77.withVendorCSSClassPrefix)((0, import_browser77.bem)("dialog", "overlay")), styles["overlay"]),
|
|
12913
13212
|
lockScroll: true,
|
|
12914
|
-
children: /* @__PURE__ */ (0,
|
|
13213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_react80.FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12915
13214
|
"div",
|
|
12916
13215
|
{
|
|
12917
13216
|
ref,
|
|
@@ -12926,20 +13225,20 @@ var DialogContent = (0, import_react80.forwardRef)(
|
|
|
12926
13225
|
) });
|
|
12927
13226
|
}
|
|
12928
13227
|
);
|
|
12929
|
-
var DialogHeading = (0,
|
|
13228
|
+
var DialogHeading = (0, import_react81.forwardRef)(
|
|
12930
13229
|
({ children, ...props }, ref) => {
|
|
12931
13230
|
const context = useDialogContext();
|
|
12932
13231
|
const { theme, colorScheme } = useTheme_default();
|
|
12933
13232
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12934
|
-
const id = (0,
|
|
12935
|
-
(0,
|
|
13233
|
+
const id = (0, import_react80.useId)();
|
|
13234
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
12936
13235
|
context.setLabelId(id);
|
|
12937
13236
|
return () => {
|
|
12938
13237
|
context.setLabelId(void 0);
|
|
12939
13238
|
};
|
|
12940
13239
|
}, [id, context.setLabelId]);
|
|
12941
|
-
return /* @__PURE__ */ (0,
|
|
12942
|
-
/* @__PURE__ */ (0,
|
|
13240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser77.withVendorCSSClassPrefix)((0, import_browser77.bem)("dialog", "header")), styles["header"]), children: [
|
|
13241
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12943
13242
|
"h2",
|
|
12944
13243
|
{
|
|
12945
13244
|
...props,
|
|
@@ -12949,7 +13248,7 @@ var DialogHeading = (0, import_react80.forwardRef)(
|
|
|
12949
13248
|
children
|
|
12950
13249
|
}
|
|
12951
13250
|
),
|
|
12952
|
-
/* @__PURE__ */ (0,
|
|
13251
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12953
13252
|
Button_default,
|
|
12954
13253
|
{
|
|
12955
13254
|
color: "tertiary",
|
|
@@ -12960,25 +13259,25 @@ var DialogHeading = (0, import_react80.forwardRef)(
|
|
|
12960
13259
|
context.setOpen(false);
|
|
12961
13260
|
},
|
|
12962
13261
|
"aria-label": "Close",
|
|
12963
|
-
children: /* @__PURE__ */ (0,
|
|
13262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(X_default, { width: 16, height: 16 })
|
|
12964
13263
|
}
|
|
12965
13264
|
)
|
|
12966
13265
|
] });
|
|
12967
13266
|
}
|
|
12968
13267
|
);
|
|
12969
|
-
var DialogDescription = (0,
|
|
13268
|
+
var DialogDescription = (0, import_react81.forwardRef)(
|
|
12970
13269
|
({ children, ...props }, ref) => {
|
|
12971
13270
|
const context = useDialogContext();
|
|
12972
13271
|
const { theme, colorScheme } = useTheme_default();
|
|
12973
13272
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12974
|
-
const id = (0,
|
|
12975
|
-
(0,
|
|
13273
|
+
const id = (0, import_react80.useId)();
|
|
13274
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
12976
13275
|
context.setDescriptionId(id);
|
|
12977
13276
|
return () => {
|
|
12978
13277
|
context.setDescriptionId(void 0);
|
|
12979
13278
|
};
|
|
12980
13279
|
}, [id, context.setDescriptionId]);
|
|
12981
|
-
return /* @__PURE__ */ (0,
|
|
13280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12982
13281
|
"p",
|
|
12983
13282
|
{
|
|
12984
13283
|
...props,
|
|
@@ -12990,24 +13289,24 @@ var DialogDescription = (0, import_react80.forwardRef)(
|
|
|
12990
13289
|
);
|
|
12991
13290
|
}
|
|
12992
13291
|
);
|
|
12993
|
-
var DialogClose = (0,
|
|
13292
|
+
var DialogClose = (0, import_react81.forwardRef)(
|
|
12994
13293
|
({ children, asChild = false, ...props }, propRef) => {
|
|
12995
13294
|
const context = useDialogContext();
|
|
12996
13295
|
const childrenRef = children?.ref;
|
|
12997
|
-
const ref = (0,
|
|
13296
|
+
const ref = (0, import_react80.useMergeRefs)([propRef, childrenRef]);
|
|
12998
13297
|
const handleClick = (event) => {
|
|
12999
13298
|
context.setOpen(false);
|
|
13000
13299
|
props.onClick?.(event);
|
|
13001
13300
|
};
|
|
13002
|
-
if (asChild && (0,
|
|
13003
|
-
return (0,
|
|
13301
|
+
if (asChild && (0, import_react81.isValidElement)(children)) {
|
|
13302
|
+
return (0, import_react81.cloneElement)(children, {
|
|
13004
13303
|
ref,
|
|
13005
13304
|
...props,
|
|
13006
13305
|
...children.props,
|
|
13007
13306
|
onClick: handleClick
|
|
13008
13307
|
});
|
|
13009
13308
|
}
|
|
13010
|
-
return /* @__PURE__ */ (0,
|
|
13309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13011
13310
|
Button_default,
|
|
13012
13311
|
{
|
|
13013
13312
|
...props,
|
|
@@ -13035,12 +13334,12 @@ var Dialog_default = Dialog;
|
|
|
13035
13334
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
13036
13335
|
var import_browser78 = require("@asgardeo/browser");
|
|
13037
13336
|
var import_css51 = require("@emotion/css");
|
|
13038
|
-
var
|
|
13337
|
+
var import_react83 = require("react");
|
|
13039
13338
|
|
|
13040
13339
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
13041
13340
|
var import_css50 = require("@emotion/css");
|
|
13042
|
-
var
|
|
13043
|
-
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0,
|
|
13341
|
+
var import_react82 = require("react");
|
|
13342
|
+
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0, import_react82.useMemo)(() => {
|
|
13044
13343
|
const container = import_css50.css`
|
|
13045
13344
|
display: flex;
|
|
13046
13345
|
flex-direction: column;
|
|
@@ -13130,7 +13429,7 @@ var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove
|
|
|
13130
13429
|
var MultiInput_styles_default = useStyles23;
|
|
13131
13430
|
|
|
13132
13431
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
13133
|
-
var
|
|
13432
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
13134
13433
|
var MultiInput = ({
|
|
13135
13434
|
label,
|
|
13136
13435
|
error,
|
|
@@ -13153,9 +13452,9 @@ var MultiInput = ({
|
|
|
13153
13452
|
const canAddMore = !maxFields || values.length < maxFields;
|
|
13154
13453
|
const canRemove = values.length > minFields;
|
|
13155
13454
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
13156
|
-
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0,
|
|
13157
|
-
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0,
|
|
13158
|
-
const handleAddValue = (0,
|
|
13455
|
+
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css51.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
13456
|
+
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css51.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime97.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" }) });
|
|
13457
|
+
const handleAddValue = (0, import_react83.useCallback)(
|
|
13159
13458
|
(newValue) => {
|
|
13160
13459
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
13161
13460
|
onChange([...values, newValue.trim()]);
|
|
@@ -13163,7 +13462,7 @@ var MultiInput = ({
|
|
|
13163
13462
|
},
|
|
13164
13463
|
[values, onChange, maxFields]
|
|
13165
13464
|
);
|
|
13166
|
-
const handleRemoveValue = (0,
|
|
13465
|
+
const handleRemoveValue = (0, import_react83.useCallback)(
|
|
13167
13466
|
(index) => {
|
|
13168
13467
|
if (values.length > minFields) {
|
|
13169
13468
|
const updatedValues = values.filter((_, i) => i !== index);
|
|
@@ -13172,7 +13471,7 @@ var MultiInput = ({
|
|
|
13172
13471
|
},
|
|
13173
13472
|
[values, onChange, minFields]
|
|
13174
13473
|
);
|
|
13175
|
-
const renderInputField = (0,
|
|
13474
|
+
const renderInputField = (0, import_react83.useCallback)(
|
|
13176
13475
|
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
13177
13476
|
const handleInputChange = (e) => {
|
|
13178
13477
|
const newValue = e.target ? e.target.value : e;
|
|
@@ -13198,9 +13497,9 @@ var MultiInput = ({
|
|
|
13198
13497
|
};
|
|
13199
13498
|
switch (fieldType) {
|
|
13200
13499
|
case "DATE_TIME":
|
|
13201
|
-
return /* @__PURE__ */ (0,
|
|
13500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(DatePicker_default, { ...commonProps });
|
|
13202
13501
|
case "BOOLEAN":
|
|
13203
|
-
return /* @__PURE__ */ (0,
|
|
13502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13204
13503
|
Checkbox_default,
|
|
13205
13504
|
{
|
|
13206
13505
|
...commonProps,
|
|
@@ -13209,19 +13508,19 @@ var MultiInput = ({
|
|
|
13209
13508
|
}
|
|
13210
13509
|
);
|
|
13211
13510
|
default:
|
|
13212
|
-
return /* @__PURE__ */ (0,
|
|
13511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(TextField_default, { ...commonProps, type });
|
|
13213
13512
|
}
|
|
13214
13513
|
},
|
|
13215
13514
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
13216
13515
|
);
|
|
13217
|
-
const [currentInputValue, setCurrentInputValue] = (0,
|
|
13218
|
-
const handleInputSubmit = (0,
|
|
13516
|
+
const [currentInputValue, setCurrentInputValue] = (0, import_react83.useState)("");
|
|
13517
|
+
const handleInputSubmit = (0, import_react83.useCallback)(() => {
|
|
13219
13518
|
if (currentInputValue.trim() !== "") {
|
|
13220
13519
|
handleAddValue(currentInputValue);
|
|
13221
13520
|
setCurrentInputValue("");
|
|
13222
13521
|
}
|
|
13223
13522
|
}, [currentInputValue, handleAddValue]);
|
|
13224
|
-
return /* @__PURE__ */ (0,
|
|
13523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13225
13524
|
FormControl_default,
|
|
13226
13525
|
{
|
|
13227
13526
|
error,
|
|
@@ -13229,27 +13528,27 @@ var MultiInput = ({
|
|
|
13229
13528
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input")), className),
|
|
13230
13529
|
style,
|
|
13231
13530
|
children: [
|
|
13232
|
-
label && /* @__PURE__ */ (0,
|
|
13233
|
-
/* @__PURE__ */ (0,
|
|
13234
|
-
/* @__PURE__ */ (0,
|
|
13531
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
13532
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "container")), styles["container"]), children: [
|
|
13533
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "input-row")), styles["inputRow"]), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "input-wrapper")), styles["inputWrapper"]), children: renderInputField(
|
|
13235
13534
|
currentInputValue,
|
|
13236
13535
|
setCurrentInputValue,
|
|
13237
|
-
canAddMore ? /* @__PURE__ */ (0,
|
|
13536
|
+
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PlusIcon, { iconClassName: styles["plusIcon"] }) : void 0,
|
|
13238
13537
|
canAddMore ? handleInputSubmit : void 0
|
|
13239
13538
|
) }) }),
|
|
13240
|
-
values.length > 0 && /* @__PURE__ */ (0,
|
|
13539
|
+
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-container")), styles["listContainer"]), children: values.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13241
13540
|
"div",
|
|
13242
13541
|
{
|
|
13243
13542
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-item")), styles["listItem"]),
|
|
13244
13543
|
children: [
|
|
13245
|
-
/* @__PURE__ */ (0,
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13246
13545
|
"span",
|
|
13247
13546
|
{
|
|
13248
13547
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-item-text")), styles["listItemText"]),
|
|
13249
13548
|
children: value
|
|
13250
13549
|
}
|
|
13251
13550
|
),
|
|
13252
|
-
canRemove && /* @__PURE__ */ (0,
|
|
13551
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13253
13552
|
"button",
|
|
13254
13553
|
{
|
|
13255
13554
|
type: "button",
|
|
@@ -13260,7 +13559,7 @@ var MultiInput = ({
|
|
|
13260
13559
|
styles["removeButton"]
|
|
13261
13560
|
),
|
|
13262
13561
|
title: "Remove value",
|
|
13263
|
-
children: /* @__PURE__ */ (0,
|
|
13562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(BinIcon, { iconClassName: styles["icon"] })
|
|
13264
13563
|
}
|
|
13265
13564
|
)
|
|
13266
13565
|
]
|
|
@@ -13275,7 +13574,7 @@ var MultiInput = ({
|
|
|
13275
13574
|
var MultiInput_default = MultiInput;
|
|
13276
13575
|
|
|
13277
13576
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
13278
|
-
var
|
|
13577
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13279
13578
|
var fieldsToSkip = [
|
|
13280
13579
|
"roles.default",
|
|
13281
13580
|
"active",
|
|
@@ -13319,10 +13618,10 @@ var BaseUserProfile = ({
|
|
|
13319
13618
|
displayNameAttributes = []
|
|
13320
13619
|
}) => {
|
|
13321
13620
|
const { theme, colorScheme } = useTheme_default();
|
|
13322
|
-
const [editedUser, setEditedUser] = (0,
|
|
13323
|
-
const [editingFields, setEditingFields] = (0,
|
|
13621
|
+
const [editedUser, setEditedUser] = (0, import_react84.useState)(flattenedProfile || profile);
|
|
13622
|
+
const [editingFields, setEditingFields] = (0, import_react84.useState)({});
|
|
13324
13623
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13325
|
-
const shouldShowField = (0,
|
|
13624
|
+
const shouldShowField = (0, import_react84.useCallback)(
|
|
13326
13625
|
(fieldName) => {
|
|
13327
13626
|
if (fieldsToSkip.includes(fieldName)) {
|
|
13328
13627
|
return false;
|
|
@@ -13337,7 +13636,7 @@ var BaseUserProfile = ({
|
|
|
13337
13636
|
},
|
|
13338
13637
|
[showFields, hideFields]
|
|
13339
13638
|
);
|
|
13340
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
13639
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13341
13640
|
"svg",
|
|
13342
13641
|
{
|
|
13343
13642
|
width: "16",
|
|
@@ -13348,16 +13647,16 @@ var BaseUserProfile = ({
|
|
|
13348
13647
|
strokeWidth: "2",
|
|
13349
13648
|
strokeLinecap: "round",
|
|
13350
13649
|
strokeLinejoin: "round",
|
|
13351
|
-
children: /* @__PURE__ */ (0,
|
|
13650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
13352
13651
|
}
|
|
13353
13652
|
);
|
|
13354
|
-
const toggleFieldEdit = (0,
|
|
13653
|
+
const toggleFieldEdit = (0, import_react84.useCallback)((fieldName) => {
|
|
13355
13654
|
setEditingFields((prev) => ({
|
|
13356
13655
|
...prev,
|
|
13357
13656
|
[fieldName]: !prev[fieldName]
|
|
13358
13657
|
}));
|
|
13359
13658
|
}, []);
|
|
13360
|
-
const getFieldPlaceholder = (0,
|
|
13659
|
+
const getFieldPlaceholder = (0, import_react84.useCallback)((schema) => {
|
|
13361
13660
|
const { type, displayName, description, name } = schema;
|
|
13362
13661
|
const fieldLabel = displayName || description || name || "value";
|
|
13363
13662
|
switch (type) {
|
|
@@ -13371,19 +13670,19 @@ var BaseUserProfile = ({
|
|
|
13371
13670
|
return `Enter your ${fieldLabel.toLowerCase()}`;
|
|
13372
13671
|
}
|
|
13373
13672
|
}, []);
|
|
13374
|
-
const formatLabel = (0,
|
|
13673
|
+
const formatLabel = (0, import_react84.useCallback)(
|
|
13375
13674
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
13376
13675
|
[]
|
|
13377
13676
|
);
|
|
13378
13677
|
const styles = BaseUserProfile_styles_default(theme, colorScheme);
|
|
13379
13678
|
const ObjectDisplay = ({ data }) => {
|
|
13380
13679
|
if (!data || typeof data !== "object") return null;
|
|
13381
|
-
return /* @__PURE__ */ (0,
|
|
13382
|
-
/* @__PURE__ */ (0,
|
|
13680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("table", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("tr", { children: [
|
|
13681
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("td", { className: styles.objectKey, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("strong", { children: [
|
|
13383
13682
|
formatLabel(key),
|
|
13384
13683
|
":"
|
|
13385
13684
|
] }) }),
|
|
13386
|
-
/* @__PURE__ */ (0,
|
|
13685
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("td", { className: styles.objectValue, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
13387
13686
|
] }, key)) }) });
|
|
13388
13687
|
};
|
|
13389
13688
|
function set(obj, path, value) {
|
|
@@ -13401,7 +13700,7 @@ var BaseUserProfile = ({
|
|
|
13401
13700
|
}
|
|
13402
13701
|
}
|
|
13403
13702
|
}
|
|
13404
|
-
const handleFieldSave = (0,
|
|
13703
|
+
const handleFieldSave = (0, import_react84.useCallback)(
|
|
13405
13704
|
(schema) => {
|
|
13406
13705
|
if (!onUpdate || !schema.name) return;
|
|
13407
13706
|
const fieldName = schema.name;
|
|
@@ -13431,7 +13730,7 @@ var BaseUserProfile = ({
|
|
|
13431
13730
|
},
|
|
13432
13731
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
13433
13732
|
);
|
|
13434
|
-
const handleFieldCancel = (0,
|
|
13733
|
+
const handleFieldCancel = (0, import_react84.useCallback)(
|
|
13435
13734
|
(fieldName) => {
|
|
13436
13735
|
const currentUser2 = flattenedProfile || profile;
|
|
13437
13736
|
setEditedUser((prev) => ({
|
|
@@ -13458,7 +13757,7 @@ var BaseUserProfile = ({
|
|
|
13458
13757
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
13459
13758
|
const label = displayName || description || name || "";
|
|
13460
13759
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
13461
|
-
return /* @__PURE__ */ (0,
|
|
13760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_jsx_runtime98.Fragment, { children: subAttributes.map((subAttr, index) => {
|
|
13462
13761
|
let displayValue2;
|
|
13463
13762
|
if (Array.isArray(subAttr.value)) {
|
|
13464
13763
|
displayValue2 = subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
|
|
@@ -13467,9 +13766,9 @@ var BaseUserProfile = ({
|
|
|
13467
13766
|
} else {
|
|
13468
13767
|
displayValue2 = String(subAttr.value);
|
|
13469
13768
|
}
|
|
13470
|
-
return /* @__PURE__ */ (0,
|
|
13471
|
-
/* @__PURE__ */ (0,
|
|
13472
|
-
/* @__PURE__ */ (0,
|
|
13769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.field, children: [
|
|
13770
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
13771
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: displayValue2 })
|
|
13473
13772
|
] }, index);
|
|
13474
13773
|
}) });
|
|
13475
13774
|
}
|
|
@@ -13493,9 +13792,9 @@ var BaseUserProfile = ({
|
|
|
13493
13792
|
} else {
|
|
13494
13793
|
fieldValues = [];
|
|
13495
13794
|
}
|
|
13496
|
-
return /* @__PURE__ */ (0,
|
|
13497
|
-
/* @__PURE__ */ (0,
|
|
13498
|
-
/* @__PURE__ */ (0,
|
|
13795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13797
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13499
13798
|
MultiInput_default,
|
|
13500
13799
|
{
|
|
13501
13800
|
values: fieldValues,
|
|
@@ -13526,9 +13825,9 @@ var BaseUserProfile = ({
|
|
|
13526
13825
|
} else {
|
|
13527
13826
|
displayValue2 = "-";
|
|
13528
13827
|
}
|
|
13529
|
-
return /* @__PURE__ */ (0,
|
|
13530
|
-
/* @__PURE__ */ (0,
|
|
13531
|
-
/* @__PURE__ */ (0,
|
|
13828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13829
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13830
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: (0, import_css52.cx)(styles.value, !hasValues ? styles.valuePlaceholder : ""), children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13532
13831
|
Button_default,
|
|
13533
13832
|
{
|
|
13534
13833
|
onClick: onStartEdit,
|
|
@@ -13543,7 +13842,7 @@ var BaseUserProfile = ({
|
|
|
13543
13842
|
] });
|
|
13544
13843
|
}
|
|
13545
13844
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
13546
|
-
return /* @__PURE__ */ (0,
|
|
13845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value });
|
|
13547
13846
|
}
|
|
13548
13847
|
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
13549
13848
|
let fieldValue;
|
|
@@ -13565,13 +13864,13 @@ var BaseUserProfile = ({
|
|
|
13565
13864
|
let field;
|
|
13566
13865
|
switch (type) {
|
|
13567
13866
|
case "STRING":
|
|
13568
|
-
field = /* @__PURE__ */ (0,
|
|
13867
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(TextField_default, { ...commonProps });
|
|
13569
13868
|
break;
|
|
13570
13869
|
case "DATE_TIME":
|
|
13571
|
-
field = /* @__PURE__ */ (0,
|
|
13870
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(DatePicker_default, { ...commonProps });
|
|
13572
13871
|
break;
|
|
13573
13872
|
case "BOOLEAN":
|
|
13574
|
-
field = /* @__PURE__ */ (0,
|
|
13873
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13575
13874
|
Checkbox_default,
|
|
13576
13875
|
{
|
|
13577
13876
|
...commonProps,
|
|
@@ -13583,7 +13882,7 @@ var BaseUserProfile = ({
|
|
|
13583
13882
|
);
|
|
13584
13883
|
break;
|
|
13585
13884
|
case "COMPLEX":
|
|
13586
|
-
field = /* @__PURE__ */ (0,
|
|
13885
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13587
13886
|
"textarea",
|
|
13588
13887
|
{
|
|
13589
13888
|
value: fieldValue,
|
|
@@ -13595,11 +13894,11 @@ var BaseUserProfile = ({
|
|
|
13595
13894
|
);
|
|
13596
13895
|
break;
|
|
13597
13896
|
default:
|
|
13598
|
-
field = /* @__PURE__ */ (0,
|
|
13897
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(TextField_default, { ...commonProps });
|
|
13599
13898
|
}
|
|
13600
|
-
return /* @__PURE__ */ (0,
|
|
13601
|
-
/* @__PURE__ */ (0,
|
|
13602
|
-
/* @__PURE__ */ (0,
|
|
13899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13900
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13901
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: field })
|
|
13603
13902
|
] });
|
|
13604
13903
|
}
|
|
13605
13904
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
@@ -13612,9 +13911,9 @@ var BaseUserProfile = ({
|
|
|
13612
13911
|
} else {
|
|
13613
13912
|
displayValue = "-";
|
|
13614
13913
|
}
|
|
13615
|
-
return /* @__PURE__ */ (0,
|
|
13616
|
-
/* @__PURE__ */ (0,
|
|
13617
|
-
/* @__PURE__ */ (0,
|
|
13914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13915
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13916
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: (0, import_css52.cx)(styles.value, !hasValue ? styles.valuePlaceholder : ""), children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13618
13917
|
Button_default,
|
|
13619
13918
|
{
|
|
13620
13919
|
onClick: onStartEdit,
|
|
@@ -13637,8 +13936,8 @@ var BaseUserProfile = ({
|
|
|
13637
13936
|
if (!shouldShow) {
|
|
13638
13937
|
return null;
|
|
13639
13938
|
}
|
|
13640
|
-
return /* @__PURE__ */ (0,
|
|
13641
|
-
/* @__PURE__ */ (0,
|
|
13939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.field, children: [
|
|
13940
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.fieldInner, children: renderSchemaField(
|
|
13642
13941
|
schema,
|
|
13643
13942
|
isFieldEditing,
|
|
13644
13943
|
(value) => {
|
|
@@ -13648,10 +13947,10 @@ var BaseUserProfile = ({
|
|
|
13648
13947
|
},
|
|
13649
13948
|
() => toggleFieldEdit(schema.name)
|
|
13650
13949
|
) }),
|
|
13651
|
-
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0,
|
|
13652
|
-
isFieldEditing && /* @__PURE__ */ (0,
|
|
13653
|
-
/* @__PURE__ */ (0,
|
|
13654
|
-
/* @__PURE__ */ (0,
|
|
13950
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.fieldActions, children: [
|
|
13951
|
+
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13952
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
13953
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13655
13954
|
Button_default,
|
|
13656
13955
|
{
|
|
13657
13956
|
size: "small",
|
|
@@ -13662,7 +13961,7 @@ var BaseUserProfile = ({
|
|
|
13662
13961
|
}
|
|
13663
13962
|
)
|
|
13664
13963
|
] }),
|
|
13665
|
-
!isFieldEditing && hasValue && /* @__PURE__ */ (0,
|
|
13964
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13666
13965
|
Button_default,
|
|
13667
13966
|
{
|
|
13668
13967
|
size: "small",
|
|
@@ -13671,7 +13970,7 @@ var BaseUserProfile = ({
|
|
|
13671
13970
|
onClick: () => toggleFieldEdit(schema.name),
|
|
13672
13971
|
title: "Edit",
|
|
13673
13972
|
className: styles.editButton,
|
|
13674
|
-
children: /* @__PURE__ */ (0,
|
|
13973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PencilIcon, {})
|
|
13675
13974
|
}
|
|
13676
13975
|
)
|
|
13677
13976
|
] })
|
|
@@ -13694,9 +13993,9 @@ var BaseUserProfile = ({
|
|
|
13694
13993
|
if (!shouldShowField(key)) return false;
|
|
13695
13994
|
return value !== void 0 && value !== "" && value !== null;
|
|
13696
13995
|
}).sort(([a], [b]) => a.localeCompare(b));
|
|
13697
|
-
return /* @__PURE__ */ (0,
|
|
13698
|
-
/* @__PURE__ */ (0,
|
|
13699
|
-
/* @__PURE__ */ (0,
|
|
13996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13997
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.profileSummary, children: [
|
|
13998
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13700
13999
|
Avatar,
|
|
13701
14000
|
{
|
|
13702
14001
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -13706,32 +14005,32 @@ var BaseUserProfile = ({
|
|
|
13706
14005
|
isLoading
|
|
13707
14006
|
}
|
|
13708
14007
|
),
|
|
13709
|
-
/* @__PURE__ */ (0,
|
|
13710
|
-
getMappedUserProfileValue_default("email", mergedMappings, currentUser) && /* @__PURE__ */ (0,
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Typography_default, { variant: "h3", fontWeight: "medium", children: displayName }),
|
|
14009
|
+
getMappedUserProfileValue_default("email", mergedMappings, currentUser) && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Typography_default, { variant: "body2", color: "textSecondary", children: getMappedUserProfileValue_default("email", mergedMappings, currentUser) })
|
|
13711
14010
|
] }),
|
|
13712
|
-
/* @__PURE__ */ (0,
|
|
13713
|
-
profileEntries.map(([key, value], index) => /* @__PURE__ */ (0,
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
13715
|
-
/* @__PURE__ */ (0,
|
|
13716
|
-
/* @__PURE__ */ (0,
|
|
14011
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Divider_default, {}),
|
|
14012
|
+
profileEntries.map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
|
|
14013
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.sectionRow, children: [
|
|
14014
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.sectionLabel, children: formatLabel(key) }),
|
|
14015
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.sectionValue, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
13717
14016
|
] }),
|
|
13718
|
-
index < profileEntries.length - 1 && /* @__PURE__ */ (0,
|
|
14017
|
+
index < profileEntries.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Divider_default, {})
|
|
13719
14018
|
] }, key))
|
|
13720
14019
|
] });
|
|
13721
14020
|
};
|
|
13722
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
13723
|
-
error && /* @__PURE__ */ (0,
|
|
14021
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Card_default, { className: containerClasses, children: [
|
|
14022
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
13724
14023
|
Alert_default,
|
|
13725
14024
|
{
|
|
13726
14025
|
variant: "error",
|
|
13727
14026
|
className: (0, import_css52.cx)((0, import_browser79.withVendorCSSClassPrefix)((0, import_browser79.bem)("user-profile", "alert")), styles.alert),
|
|
13728
14027
|
children: [
|
|
13729
|
-
/* @__PURE__ */ (0,
|
|
13730
|
-
/* @__PURE__ */ (0,
|
|
14028
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Alert_default.Title, { children: t("errors.heading") || "Error" }),
|
|
14029
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Alert_default.Description, { children: error })
|
|
13731
14030
|
]
|
|
13732
14031
|
}
|
|
13733
14032
|
),
|
|
13734
|
-
schemas && schemas.length > 0 && /* @__PURE__ */ (0,
|
|
14033
|
+
schemas && schemas.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13735
14034
|
Avatar,
|
|
13736
14035
|
{
|
|
13737
14036
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -13741,7 +14040,7 @@ var BaseUserProfile = ({
|
|
|
13741
14040
|
isLoading
|
|
13742
14041
|
}
|
|
13743
14042
|
) }),
|
|
13744
|
-
/* @__PURE__ */ (0,
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.infoContainer, children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
13745
14044
|
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
13746
14045
|
if (!editable) {
|
|
13747
14046
|
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
@@ -13758,13 +14057,13 @@ var BaseUserProfile = ({
|
|
|
13758
14057
|
...schema,
|
|
13759
14058
|
value
|
|
13760
14059
|
};
|
|
13761
|
-
return /* @__PURE__ */ (0,
|
|
14060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.info, children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
13762
14061
|
}) : renderProfileWithoutSchemas() })
|
|
13763
14062
|
] });
|
|
13764
14063
|
if (mode === "popup") {
|
|
13765
|
-
return /* @__PURE__ */ (0,
|
|
13766
|
-
/* @__PURE__ */ (0,
|
|
13767
|
-
/* @__PURE__ */ (0,
|
|
14064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Dialog_default.Content, { children: [
|
|
14065
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Dialog_default.Heading, { children: title ?? t("user.profile.heading") }),
|
|
14066
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.popup, children: profileContent })
|
|
13768
14067
|
] }) });
|
|
13769
14068
|
}
|
|
13770
14069
|
return profileContent;
|
|
@@ -13773,7 +14072,7 @@ var BaseUserProfile_default = BaseUserProfile;
|
|
|
13773
14072
|
|
|
13774
14073
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
13775
14074
|
var import_browser81 = require("@asgardeo/browser");
|
|
13776
|
-
var
|
|
14075
|
+
var import_react85 = require("react");
|
|
13777
14076
|
|
|
13778
14077
|
// src/api/updateMeProfile.ts
|
|
13779
14078
|
var import_browser80 = require("@asgardeo/browser");
|
|
@@ -13803,12 +14102,12 @@ var updateMeProfile = async ({ fetcher, instanceId = 0, ...requestConfig }) => {
|
|
|
13803
14102
|
var updateMeProfile_default = updateMeProfile;
|
|
13804
14103
|
|
|
13805
14104
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
13806
|
-
var
|
|
14105
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13807
14106
|
var UserProfile3 = ({ preferences, ...rest }) => {
|
|
13808
14107
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
13809
14108
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
13810
14109
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13811
|
-
const [error, setError] = (0,
|
|
14110
|
+
const [error, setError] = (0, import_react85.useState)(null);
|
|
13812
14111
|
const handleProfileUpdate = async (payload) => {
|
|
13813
14112
|
setError(null);
|
|
13814
14113
|
try {
|
|
@@ -13822,7 +14121,7 @@ var UserProfile3 = ({ preferences, ...rest }) => {
|
|
|
13822
14121
|
setError(message);
|
|
13823
14122
|
}
|
|
13824
14123
|
};
|
|
13825
|
-
return /* @__PURE__ */ (0,
|
|
14124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
13826
14125
|
BaseUserProfile_default,
|
|
13827
14126
|
{
|
|
13828
14127
|
profile,
|
|
@@ -13840,13 +14139,13 @@ var UserProfile_default = UserProfile3;
|
|
|
13840
14139
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
13841
14140
|
var import_browser82 = require("@asgardeo/browser");
|
|
13842
14141
|
var import_css54 = require("@emotion/css");
|
|
13843
|
-
var
|
|
13844
|
-
var
|
|
14142
|
+
var import_react87 = require("@floating-ui/react");
|
|
14143
|
+
var import_react88 = require("react");
|
|
13845
14144
|
|
|
13846
14145
|
// src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts
|
|
13847
14146
|
var import_css53 = require("@emotion/css");
|
|
13848
|
-
var
|
|
13849
|
-
var useStyles24 = (theme, colorScheme) => (0,
|
|
14147
|
+
var import_react86 = require("react");
|
|
14148
|
+
var useStyles24 = (theme, colorScheme) => (0, import_react86.useMemo)(() => {
|
|
13850
14149
|
const trigger = import_css53.css`
|
|
13851
14150
|
display: inline-flex;
|
|
13852
14151
|
align-items: center;
|
|
@@ -14033,7 +14332,7 @@ var useStyles24 = (theme, colorScheme) => (0, import_react85.useMemo)(() => {
|
|
|
14033
14332
|
var BaseUserDropdown_styles_default = useStyles24;
|
|
14034
14333
|
|
|
14035
14334
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
14036
|
-
var
|
|
14335
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
14037
14336
|
var BaseUserDropdown = ({
|
|
14038
14337
|
fallback = null,
|
|
14039
14338
|
className = "",
|
|
@@ -14049,19 +14348,19 @@ var BaseUserDropdown = ({
|
|
|
14049
14348
|
}) => {
|
|
14050
14349
|
const { theme, colorScheme } = useTheme_default();
|
|
14051
14350
|
const styles = BaseUserDropdown_styles_default(theme, colorScheme);
|
|
14052
|
-
const [isOpen, setIsOpen] = (0,
|
|
14053
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
14054
|
-
const { refs, floatingStyles, context } = (0,
|
|
14055
|
-
middleware: [(0,
|
|
14351
|
+
const [isOpen, setIsOpen] = (0, import_react88.useState)(false);
|
|
14352
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react88.useState)(null);
|
|
14353
|
+
const { refs, floatingStyles, context } = (0, import_react87.useFloating)({
|
|
14354
|
+
middleware: [(0, import_react87.offset)(5), (0, import_react87.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react87.shift)({ padding: 5 })],
|
|
14056
14355
|
onOpenChange: setIsOpen,
|
|
14057
14356
|
open: isOpen,
|
|
14058
14357
|
placement: "bottom-end",
|
|
14059
|
-
whileElementsMounted:
|
|
14358
|
+
whileElementsMounted: import_react87.autoUpdate
|
|
14060
14359
|
});
|
|
14061
|
-
const click = (0,
|
|
14062
|
-
const dismiss = (0,
|
|
14063
|
-
const role = (0,
|
|
14064
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
14360
|
+
const click = (0, import_react87.useClick)(context);
|
|
14361
|
+
const dismiss = (0, import_react87.useDismiss)(context);
|
|
14362
|
+
const role = (0, import_react87.useRole)(context);
|
|
14363
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react87.useInteractions)([click, dismiss, role]);
|
|
14065
14364
|
const defaultAttributeMappings = {
|
|
14066
14365
|
email: ["emails"],
|
|
14067
14366
|
firstName: ["name.givenName", "given_name"],
|
|
@@ -14085,14 +14384,14 @@ var BaseUserDropdown = ({
|
|
|
14085
14384
|
const defaultMenuItems = [];
|
|
14086
14385
|
if (onManageProfile) {
|
|
14087
14386
|
defaultMenuItems.push({
|
|
14088
|
-
icon: /* @__PURE__ */ (0,
|
|
14387
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(User_default2, { width: "16", height: "16" }),
|
|
14089
14388
|
label: "Manage Profile",
|
|
14090
14389
|
onClick: onManageProfile
|
|
14091
14390
|
});
|
|
14092
14391
|
}
|
|
14093
14392
|
if (onSignOut) {
|
|
14094
14393
|
defaultMenuItems.push({
|
|
14095
|
-
icon: /* @__PURE__ */ (0,
|
|
14394
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LogOut_default, { width: "16", height: "16" }),
|
|
14096
14395
|
label: "Sign Out",
|
|
14097
14396
|
onClick: onSignOut
|
|
14098
14397
|
});
|
|
@@ -14104,8 +14403,8 @@ var BaseUserDropdown = ({
|
|
|
14104
14403
|
}
|
|
14105
14404
|
allMenuItems.push(...defaultMenuItems);
|
|
14106
14405
|
}
|
|
14107
|
-
return /* @__PURE__ */ (0,
|
|
14108
|
-
/* @__PURE__ */ (0,
|
|
14406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
14407
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14109
14408
|
Button_default,
|
|
14110
14409
|
{
|
|
14111
14410
|
ref: refs.setReference,
|
|
@@ -14116,7 +14415,7 @@ var BaseUserDropdown = ({
|
|
|
14116
14415
|
"data-testid": "asgardeo-user-dropdown-trigger",
|
|
14117
14416
|
...getReferenceProps(),
|
|
14118
14417
|
children: [
|
|
14119
|
-
/* @__PURE__ */ (0,
|
|
14418
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14120
14419
|
Avatar,
|
|
14121
14420
|
{
|
|
14122
14421
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -14125,7 +14424,7 @@ var BaseUserDropdown = ({
|
|
|
14125
14424
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
14126
14425
|
}
|
|
14127
14426
|
),
|
|
14128
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14427
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14129
14428
|
Typography_default,
|
|
14130
14429
|
{
|
|
14131
14430
|
variant: "body2",
|
|
@@ -14136,7 +14435,7 @@ var BaseUserDropdown = ({
|
|
|
14136
14435
|
]
|
|
14137
14436
|
}
|
|
14138
14437
|
),
|
|
14139
|
-
isOpen && /* @__PURE__ */ (0,
|
|
14438
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react87.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react87.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14140
14439
|
"div",
|
|
14141
14440
|
{
|
|
14142
14441
|
ref: refs.setFloating,
|
|
@@ -14149,8 +14448,8 @@ var BaseUserDropdown = ({
|
|
|
14149
14448
|
},
|
|
14150
14449
|
...getFloatingProps(),
|
|
14151
14450
|
children: [
|
|
14152
|
-
/* @__PURE__ */ (0,
|
|
14153
|
-
/* @__PURE__ */ (0,
|
|
14451
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__header"), styles["dropdownHeader"]), children: [
|
|
14452
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14154
14453
|
Avatar,
|
|
14155
14454
|
{
|
|
14156
14455
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -14159,8 +14458,8 @@ var BaseUserDropdown = ({
|
|
|
14159
14458
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
14160
14459
|
}
|
|
14161
14460
|
),
|
|
14162
|
-
/* @__PURE__ */ (0,
|
|
14163
|
-
/* @__PURE__ */ (0,
|
|
14461
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__header-info"), styles["headerInfo"]), children: [
|
|
14462
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14164
14463
|
Typography_default,
|
|
14165
14464
|
{
|
|
14166
14465
|
noWrap: true,
|
|
@@ -14170,7 +14469,7 @@ var BaseUserDropdown = ({
|
|
|
14170
14469
|
children: getDisplayName_default(mergedMappings, user)
|
|
14171
14470
|
}
|
|
14172
14471
|
),
|
|
14173
|
-
/* @__PURE__ */ (0,
|
|
14472
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14174
14473
|
Typography_default,
|
|
14175
14474
|
{
|
|
14176
14475
|
noWrap: true,
|
|
@@ -14182,9 +14481,9 @@ var BaseUserDropdown = ({
|
|
|
14182
14481
|
)
|
|
14183
14482
|
] })
|
|
14184
14483
|
] }),
|
|
14185
|
-
/* @__PURE__ */ (0,
|
|
14484
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__menu"), styles["dropdownMenu"]), children: allMenuItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { children: (() => {
|
|
14186
14485
|
if (item.label === "") {
|
|
14187
|
-
return /* @__PURE__ */ (0,
|
|
14486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14188
14487
|
"div",
|
|
14189
14488
|
{
|
|
14190
14489
|
className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__menu-divider"), styles["divider"])
|
|
@@ -14192,7 +14491,7 @@ var BaseUserDropdown = ({
|
|
|
14192
14491
|
);
|
|
14193
14492
|
}
|
|
14194
14493
|
if (item.href) {
|
|
14195
|
-
return /* @__PURE__ */ (0,
|
|
14494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14196
14495
|
"a",
|
|
14197
14496
|
{
|
|
14198
14497
|
href: item.href,
|
|
@@ -14209,12 +14508,12 @@ var BaseUserDropdown = ({
|
|
|
14209
14508
|
onBlur: () => setHoveredItemIndex(null),
|
|
14210
14509
|
children: [
|
|
14211
14510
|
item.icon,
|
|
14212
|
-
/* @__PURE__ */ (0,
|
|
14511
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: item.label })
|
|
14213
14512
|
]
|
|
14214
14513
|
}
|
|
14215
14514
|
);
|
|
14216
14515
|
}
|
|
14217
|
-
return /* @__PURE__ */ (0,
|
|
14516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14218
14517
|
Button_default,
|
|
14219
14518
|
{
|
|
14220
14519
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -14240,8 +14539,8 @@ var BaseUserDropdown = ({
|
|
|
14240
14539
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
14241
14540
|
|
|
14242
14541
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
14243
|
-
var
|
|
14244
|
-
var
|
|
14542
|
+
var import_react89 = require("react");
|
|
14543
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
14245
14544
|
var UserDropdown = ({
|
|
14246
14545
|
children,
|
|
14247
14546
|
renderTrigger,
|
|
@@ -14250,7 +14549,7 @@ var UserDropdown = ({
|
|
|
14250
14549
|
...rest
|
|
14251
14550
|
}) => {
|
|
14252
14551
|
const { user, isLoading, signOut, meta } = useAsgardeo_default();
|
|
14253
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
14552
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react89.useState)(false);
|
|
14254
14553
|
const handleManageProfile = () => {
|
|
14255
14554
|
setIsProfileOpen(true);
|
|
14256
14555
|
};
|
|
@@ -14273,14 +14572,14 @@ var UserDropdown = ({
|
|
|
14273
14572
|
user
|
|
14274
14573
|
};
|
|
14275
14574
|
if (children) {
|
|
14276
|
-
return /* @__PURE__ */ (0,
|
|
14575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14277
14576
|
children(renderProps),
|
|
14278
|
-
/* @__PURE__ */ (0,
|
|
14577
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14279
14578
|
] });
|
|
14280
14579
|
}
|
|
14281
14580
|
if (renderTrigger || renderDropdown) {
|
|
14282
|
-
return /* @__PURE__ */ (0,
|
|
14283
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0,
|
|
14581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14582
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14284
14583
|
BaseUserDropdown,
|
|
14285
14584
|
{
|
|
14286
14585
|
user,
|
|
@@ -14290,11 +14589,11 @@ var UserDropdown = ({
|
|
|
14290
14589
|
...rest
|
|
14291
14590
|
}
|
|
14292
14591
|
),
|
|
14293
|
-
/* @__PURE__ */ (0,
|
|
14592
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14294
14593
|
] });
|
|
14295
14594
|
}
|
|
14296
|
-
return /* @__PURE__ */ (0,
|
|
14297
|
-
/* @__PURE__ */ (0,
|
|
14595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14596
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14298
14597
|
BaseUserDropdown,
|
|
14299
14598
|
{
|
|
14300
14599
|
user,
|
|
@@ -14304,20 +14603,20 @@ var UserDropdown = ({
|
|
|
14304
14603
|
...rest
|
|
14305
14604
|
}
|
|
14306
14605
|
),
|
|
14307
|
-
isProfileOpen && /* @__PURE__ */ (0,
|
|
14606
|
+
isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14308
14607
|
] });
|
|
14309
14608
|
};
|
|
14310
14609
|
var UserDropdown_default = UserDropdown;
|
|
14311
14610
|
|
|
14312
14611
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
14313
14612
|
var import_css56 = require("@emotion/css");
|
|
14314
|
-
var
|
|
14315
|
-
var
|
|
14613
|
+
var import_react91 = require("@floating-ui/react");
|
|
14614
|
+
var import_react92 = require("react");
|
|
14316
14615
|
|
|
14317
14616
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.ts
|
|
14318
14617
|
var import_css55 = require("@emotion/css");
|
|
14319
|
-
var
|
|
14320
|
-
var useStyles25 = (theme, colorScheme) => (0,
|
|
14618
|
+
var import_react90 = require("react");
|
|
14619
|
+
var useStyles25 = (theme, colorScheme) => (0, import_react90.useMemo)(() => {
|
|
14321
14620
|
const root = import_css55.css`
|
|
14322
14621
|
display: inline-block;
|
|
14323
14622
|
position: relative;
|
|
@@ -14540,9 +14839,9 @@ var useStyles25 = (theme, colorScheme) => (0, import_react89.useMemo)(() => {
|
|
|
14540
14839
|
var BaseOrganizationSwitcher_styles_default = useStyles25;
|
|
14541
14840
|
|
|
14542
14841
|
// src/components/primitives/Icons/Building.tsx
|
|
14543
|
-
var
|
|
14544
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14545
|
-
/* @__PURE__ */ (0,
|
|
14842
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
14843
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
14844
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
14546
14845
|
"path",
|
|
14547
14846
|
{
|
|
14548
14847
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -14552,30 +14851,30 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
14552
14851
|
strokeLinejoin: "round"
|
|
14553
14852
|
}
|
|
14554
14853
|
),
|
|
14555
|
-
/* @__PURE__ */ (0,
|
|
14556
|
-
/* @__PURE__ */ (0,
|
|
14557
|
-
/* @__PURE__ */ (0,
|
|
14558
|
-
/* @__PURE__ */ (0,
|
|
14559
|
-
/* @__PURE__ */ (0,
|
|
14560
|
-
/* @__PURE__ */ (0,
|
|
14854
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14855
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14856
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14857
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14858
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14859
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
14561
14860
|
] });
|
|
14562
14861
|
Building.displayName = "Building";
|
|
14563
14862
|
var Building_default = Building;
|
|
14564
14863
|
|
|
14565
14864
|
// src/components/primitives/Icons/Check.tsx
|
|
14566
|
-
var
|
|
14567
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14865
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
14866
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
14568
14867
|
Check.displayName = "Check";
|
|
14569
14868
|
var Check_default = Check;
|
|
14570
14869
|
|
|
14571
14870
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
14572
|
-
var
|
|
14573
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14871
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
14872
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
14574
14873
|
ChevronDown.displayName = "ChevronDown";
|
|
14575
14874
|
var ChevronDown_default = ChevronDown;
|
|
14576
14875
|
|
|
14577
14876
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
14578
|
-
var
|
|
14877
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
14579
14878
|
var BaseOrganizationSwitcher = ({
|
|
14580
14879
|
organizations,
|
|
14581
14880
|
currentOrganization,
|
|
@@ -14599,21 +14898,21 @@ var BaseOrganizationSwitcher = ({
|
|
|
14599
14898
|
}) => {
|
|
14600
14899
|
const { theme, colorScheme, direction } = useTheme_default();
|
|
14601
14900
|
const styles = BaseOrganizationSwitcher_styles_default(theme, colorScheme);
|
|
14602
|
-
const [isOpen, setIsOpen] = (0,
|
|
14603
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
14901
|
+
const [isOpen, setIsOpen] = (0, import_react92.useState)(false);
|
|
14902
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react92.useState)(null);
|
|
14604
14903
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
14605
14904
|
const isRTL = direction === "rtl";
|
|
14606
|
-
const { refs, floatingStyles, context } = (0,
|
|
14607
|
-
middleware: [(0,
|
|
14905
|
+
const { refs, floatingStyles, context } = (0, import_react91.useFloating)({
|
|
14906
|
+
middleware: [(0, import_react91.offset)(5), (0, import_react91.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react91.shift)({ padding: 5 })],
|
|
14608
14907
|
onOpenChange: setIsOpen,
|
|
14609
14908
|
open: isOpen,
|
|
14610
14909
|
placement: "bottom-end",
|
|
14611
|
-
whileElementsMounted:
|
|
14910
|
+
whileElementsMounted: import_react91.autoUpdate
|
|
14612
14911
|
});
|
|
14613
|
-
const click = (0,
|
|
14614
|
-
const dismiss = (0,
|
|
14615
|
-
const role = (0,
|
|
14616
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
14912
|
+
const click = (0, import_react91.useClick)(context);
|
|
14913
|
+
const dismiss = (0, import_react91.useDismiss)(context);
|
|
14914
|
+
const role = (0, import_react91.useRole)(context);
|
|
14915
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react91.useInteractions)([click, dismiss, role]);
|
|
14617
14916
|
if (fallback && !currentOrganization && !loading && organizations.length === 0) {
|
|
14618
14917
|
return fallback;
|
|
14619
14918
|
}
|
|
@@ -14630,8 +14929,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14630
14929
|
const switchableOrganizations = organizations.filter(
|
|
14631
14930
|
(org) => org.id !== currentOrganization?.id
|
|
14632
14931
|
);
|
|
14633
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0,
|
|
14634
|
-
/* @__PURE__ */ (0,
|
|
14932
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14933
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14635
14934
|
Avatar,
|
|
14636
14935
|
{
|
|
14637
14936
|
variant: "square",
|
|
@@ -14641,24 +14940,24 @@ var BaseOrganizationSwitcher = ({
|
|
|
14641
14940
|
alt: `${organization.name} avatar`
|
|
14642
14941
|
}
|
|
14643
14942
|
),
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
14646
|
-
/* @__PURE__ */ (0,
|
|
14647
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
14943
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["organizationInfo"]), children: [
|
|
14944
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", fontWeight: "medium", className: (0, import_css56.cx)(styles["organizationName"]), children: organization.name }),
|
|
14945
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["organizationMeta"]), children: [
|
|
14946
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("span", { children: [
|
|
14648
14947
|
organization.memberCount,
|
|
14649
14948
|
" ",
|
|
14650
14949
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
14651
14950
|
] }),
|
|
14652
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
14653
|
-
showRole && organization.role && /* @__PURE__ */ (0,
|
|
14951
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: " \u2022 " }),
|
|
14952
|
+
showRole && organization.role && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: (0, import_css56.cx)(styles["roleCapitalized"]), children: organization.role })
|
|
14654
14953
|
] })
|
|
14655
14954
|
] }),
|
|
14656
|
-
isSelected && /* @__PURE__ */ (0,
|
|
14955
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Check_default, { width: "16", height: "16", color: theme.vars.colors.text.primary })
|
|
14657
14956
|
] });
|
|
14658
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */ (0,
|
|
14659
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0,
|
|
14660
|
-
return /* @__PURE__ */ (0,
|
|
14661
|
-
/* @__PURE__ */ (0,
|
|
14957
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["loadingContainer"]), children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", className: (0, import_css56.cx)(styles["loadingText"]), children: t("organization.switcher.loading.placeholder.organizations") }) });
|
|
14958
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["errorContainer"]), children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", className: (0, import_css56.cx)(styles["errorText"]), children: errorMessage }) });
|
|
14959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["root"], className), style, children: [
|
|
14960
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14662
14961
|
Button_default,
|
|
14663
14962
|
{
|
|
14664
14963
|
ref: refs.setReference,
|
|
@@ -14668,8 +14967,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14668
14967
|
size: "medium",
|
|
14669
14968
|
...getReferenceProps(),
|
|
14670
14969
|
children: [
|
|
14671
|
-
currentOrganization ? /* @__PURE__ */ (0,
|
|
14672
|
-
/* @__PURE__ */ (0,
|
|
14970
|
+
currentOrganization ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14971
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14673
14972
|
Avatar,
|
|
14674
14973
|
{
|
|
14675
14974
|
variant: "square",
|
|
@@ -14679,16 +14978,16 @@ var BaseOrganizationSwitcher = ({
|
|
|
14679
14978
|
alt: `${currentOrganization.name} avatar`
|
|
14680
14979
|
}
|
|
14681
14980
|
),
|
|
14682
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14683
|
-
] }) : /* @__PURE__ */ (0,
|
|
14684
|
-
/* @__PURE__ */ (0,
|
|
14685
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14981
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", className: (0, import_css56.cx)(styles["triggerLabel"]), children: currentOrganization.name })
|
|
14982
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14983
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Building_default, { width: avatarSize, height: avatarSize }),
|
|
14984
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", className: (0, import_css56.cx)(styles["triggerLabel"]), children: t("elements.fields.organization.select.label") })
|
|
14686
14985
|
] }),
|
|
14687
|
-
/* @__PURE__ */ (0,
|
|
14986
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { style: { display: "inline-flex", transform: isRTL ? "scaleX(-1)" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ChevronDown_default, { width: "16", height: "16" }) })
|
|
14688
14987
|
]
|
|
14689
14988
|
}
|
|
14690
14989
|
),
|
|
14691
|
-
isOpen && /* @__PURE__ */ (0,
|
|
14990
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_react91.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_react91.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14692
14991
|
"div",
|
|
14693
14992
|
{
|
|
14694
14993
|
ref: refs.setFloating,
|
|
@@ -14696,8 +14995,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14696
14995
|
style: floatingStyles,
|
|
14697
14996
|
...getFloatingProps(),
|
|
14698
14997
|
children: [
|
|
14699
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
14700
|
-
/* @__PURE__ */ (0,
|
|
14998
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["header"]), children: [
|
|
14999
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14701
15000
|
Avatar,
|
|
14702
15001
|
{
|
|
14703
15002
|
variant: "square",
|
|
@@ -14707,10 +15006,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14707
15006
|
alt: `${currentOrganization.name} avatar`
|
|
14708
15007
|
}
|
|
14709
15008
|
),
|
|
14710
|
-
/* @__PURE__ */ (0,
|
|
14711
|
-
/* @__PURE__ */ (0,
|
|
14712
|
-
/* @__PURE__ */ (0,
|
|
14713
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
15009
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["headerInfo"]), children: [
|
|
15010
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { noWrap: true, className: (0, import_css56.cx)(styles["headerName"]), variant: "body1", fontWeight: "medium", children: currentOrganization.name }),
|
|
15011
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["headerMeta"]), children: [
|
|
15012
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14714
15013
|
Typography_default,
|
|
14715
15014
|
{
|
|
14716
15015
|
noWrap: true,
|
|
@@ -14720,17 +15019,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
14720
15019
|
currentOrganization.memberCount,
|
|
14721
15020
|
" ",
|
|
14722
15021
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
14723
|
-
showRole && currentOrganization.role && /* @__PURE__ */ (0,
|
|
15022
|
+
showRole && currentOrganization.role && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("span", { children: [
|
|
14724
15023
|
" \u2022 ",
|
|
14725
15024
|
currentOrganization.role
|
|
14726
15025
|
] })
|
|
14727
15026
|
]
|
|
14728
15027
|
}
|
|
14729
15028
|
),
|
|
14730
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0,
|
|
15029
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { noWrap: true, className: (0, import_css56.cx)(styles["headerRole"]), variant: "caption", color: "secondary", children: currentOrganization.role })
|
|
14731
15030
|
] })
|
|
14732
15031
|
] }),
|
|
14733
|
-
onManageProfile && /* @__PURE__ */ (0,
|
|
15032
|
+
onManageProfile && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14734
15033
|
Button_default,
|
|
14735
15034
|
{
|
|
14736
15035
|
onClick: onManageProfile,
|
|
@@ -14739,7 +15038,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
14739
15038
|
size: "small",
|
|
14740
15039
|
"aria-label": "Manage Organization Profile",
|
|
14741
15040
|
className: (0, import_css56.cx)(styles["manageButton"]),
|
|
14742
|
-
endIcon: /* @__PURE__ */ (0,
|
|
15041
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14743
15042
|
"svg",
|
|
14744
15043
|
{
|
|
14745
15044
|
width: "16",
|
|
@@ -14751,8 +15050,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14751
15050
|
strokeLinecap: "round",
|
|
14752
15051
|
strokeLinejoin: "round",
|
|
14753
15052
|
children: [
|
|
14754
|
-
/* @__PURE__ */ (0,
|
|
14755
|
-
/* @__PURE__ */ (0,
|
|
15053
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
15054
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
14756
15055
|
]
|
|
14757
15056
|
}
|
|
14758
15057
|
),
|
|
@@ -14760,27 +15059,27 @@ var BaseOrganizationSwitcher = ({
|
|
|
14760
15059
|
}
|
|
14761
15060
|
)
|
|
14762
15061
|
] }),
|
|
14763
|
-
organizations.length > 1 && /* @__PURE__ */ (0,
|
|
15062
|
+
organizations.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14764
15063
|
"div",
|
|
14765
15064
|
{
|
|
14766
15065
|
className: (0, import_css56.cx)(styles["header"], styles["sectionHeaderContainer"]),
|
|
14767
15066
|
style: {
|
|
14768
15067
|
borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : "none"
|
|
14769
15068
|
},
|
|
14770
|
-
children: /* @__PURE__ */ (0,
|
|
15069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", fontWeight: 600, className: (0, import_css56.cx)(styles["sectionHeader"]), children: t("organization.switcher.switch.organization") })
|
|
14771
15070
|
}
|
|
14772
15071
|
),
|
|
14773
|
-
/* @__PURE__ */ (0,
|
|
15072
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["menu"]), children: (() => {
|
|
14774
15073
|
if (loading) {
|
|
14775
15074
|
return renderLoading ? renderLoading() : defaultRenderLoading2();
|
|
14776
15075
|
}
|
|
14777
15076
|
if (error) {
|
|
14778
15077
|
return renderError ? renderError(error) : defaultRenderError2(error);
|
|
14779
15078
|
}
|
|
14780
|
-
return /* @__PURE__ */ (0,
|
|
15079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14781
15080
|
switchableOrganizations.map((organization) => {
|
|
14782
15081
|
const isSelected = false;
|
|
14783
|
-
return /* @__PURE__ */ (0,
|
|
15082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14784
15083
|
Button_default,
|
|
14785
15084
|
{
|
|
14786
15085
|
onClick: () => handleOrganizationSwitch(organization),
|
|
@@ -14798,10 +15097,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14798
15097
|
organization.id
|
|
14799
15098
|
);
|
|
14800
15099
|
}),
|
|
14801
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
14802
|
-
/* @__PURE__ */ (0,
|
|
15100
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
15101
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["menuDivider"]) }),
|
|
14803
15102
|
menuItems.map(
|
|
14804
|
-
(item, index) => /* @__PURE__ */ (0,
|
|
15103
|
+
(item, index) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14805
15104
|
"a",
|
|
14806
15105
|
{
|
|
14807
15106
|
href: item.href,
|
|
@@ -14815,10 +15114,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14815
15114
|
onBlur: () => setHoveredItemIndex(null),
|
|
14816
15115
|
children: [
|
|
14817
15116
|
item.icon,
|
|
14818
|
-
/* @__PURE__ */ (0,
|
|
15117
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: item.label })
|
|
14819
15118
|
]
|
|
14820
15119
|
}
|
|
14821
|
-
) : /* @__PURE__ */ (0,
|
|
15120
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14822
15121
|
Button_default,
|
|
14823
15122
|
{
|
|
14824
15123
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -14847,11 +15146,11 @@ var BaseOrganizationSwitcher = ({
|
|
|
14847
15146
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
14848
15147
|
|
|
14849
15148
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
14850
|
-
var
|
|
15149
|
+
var import_react105 = require("react");
|
|
14851
15150
|
|
|
14852
15151
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
14853
|
-
var
|
|
14854
|
-
var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
15152
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
15153
|
+
var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
|
|
14855
15154
|
"svg",
|
|
14856
15155
|
{
|
|
14857
15156
|
width,
|
|
@@ -14864,13 +15163,13 @@ var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0, import_js
|
|
|
14864
15163
|
strokeLinecap: "round",
|
|
14865
15164
|
strokeLinejoin: "round",
|
|
14866
15165
|
children: [
|
|
14867
|
-
/* @__PURE__ */ (0,
|
|
14868
|
-
/* @__PURE__ */ (0,
|
|
14869
|
-
/* @__PURE__ */ (0,
|
|
14870
|
-
/* @__PURE__ */ (0,
|
|
14871
|
-
/* @__PURE__ */ (0,
|
|
14872
|
-
/* @__PURE__ */ (0,
|
|
14873
|
-
/* @__PURE__ */ (0,
|
|
15166
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
15168
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
15169
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 6h4" }),
|
|
15170
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 10h4" }),
|
|
15171
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 14h4" }),
|
|
15172
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 18h4" })
|
|
14874
15173
|
]
|
|
14875
15174
|
}
|
|
14876
15175
|
);
|
|
@@ -14878,17 +15177,17 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
14878
15177
|
var BuildingAlt_default = BuildingAlt;
|
|
14879
15178
|
|
|
14880
15179
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
14881
|
-
var
|
|
15180
|
+
var import_react95 = require("react");
|
|
14882
15181
|
|
|
14883
15182
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
14884
15183
|
var import_browser83 = require("@asgardeo/browser");
|
|
14885
15184
|
var import_css58 = require("@emotion/css");
|
|
14886
|
-
var
|
|
15185
|
+
var import_react94 = require("react");
|
|
14887
15186
|
|
|
14888
15187
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts
|
|
14889
15188
|
var import_css57 = require("@emotion/css");
|
|
14890
|
-
var
|
|
14891
|
-
var useStyles26 = (theme, colorScheme) => (0,
|
|
15189
|
+
var import_react93 = require("react");
|
|
15190
|
+
var useStyles26 = (theme, colorScheme) => (0, import_react93.useMemo)(() => {
|
|
14892
15191
|
const root = import_css57.css`
|
|
14893
15192
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
14894
15193
|
min-width: 600px;
|
|
@@ -15024,7 +15323,7 @@ var useStyles26 = (theme, colorScheme) => (0, import_react92.useMemo)(() => {
|
|
|
15024
15323
|
var BaseCreateOrganization_styles_default = useStyles26;
|
|
15025
15324
|
|
|
15026
15325
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
15027
|
-
var
|
|
15326
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
15028
15327
|
var logger8 = (0, import_browser83.createPackageComponentLogger)(
|
|
15029
15328
|
"@asgardeo/react",
|
|
15030
15329
|
"BaseCreateOrganization"
|
|
@@ -15051,13 +15350,13 @@ var BaseCreateOrganization = ({
|
|
|
15051
15350
|
const { theme, colorScheme } = useTheme_default();
|
|
15052
15351
|
const styles = BaseCreateOrganization_styles_default(theme, colorScheme);
|
|
15053
15352
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15054
|
-
const [formData, setFormData] = (0,
|
|
15353
|
+
const [formData, setFormData] = (0, import_react94.useState)({
|
|
15055
15354
|
description: "",
|
|
15056
15355
|
handle: "",
|
|
15057
15356
|
name: "",
|
|
15058
15357
|
...initialValues
|
|
15059
15358
|
});
|
|
15060
|
-
const [formErrors, setFormErrors] = (0,
|
|
15359
|
+
const [formErrors, setFormErrors] = (0, import_react94.useState)({});
|
|
15061
15360
|
const validateForm = () => {
|
|
15062
15361
|
const errors = {};
|
|
15063
15362
|
if (!formData.name.trim()) {
|
|
@@ -15114,13 +15413,13 @@ var BaseCreateOrganization = ({
|
|
|
15114
15413
|
logger8.error("Form submission error:");
|
|
15115
15414
|
}
|
|
15116
15415
|
};
|
|
15117
|
-
const createOrganizationContent = /* @__PURE__ */ (0,
|
|
15118
|
-
/* @__PURE__ */ (0,
|
|
15119
|
-
error && /* @__PURE__ */ (0,
|
|
15120
|
-
/* @__PURE__ */ (0,
|
|
15121
|
-
/* @__PURE__ */ (0,
|
|
15416
|
+
const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["root"], cardLayout && styles["card"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: (0, import_css58.cx)(styles["content"]), children: [
|
|
15417
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("form", { id: "create-organization-form", className: (0, import_css58.cx)(styles["form"]), onSubmit: handleSubmit, children: [
|
|
15418
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Alert_default, { variant: "error", className: styles["errorAlert"], children: [
|
|
15419
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Alert_default.Title, { children: "Error" }),
|
|
15420
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Alert_default.Description, { children: error })
|
|
15122
15421
|
] }),
|
|
15123
|
-
/* @__PURE__ */ (0,
|
|
15422
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15124
15423
|
TextField_default,
|
|
15125
15424
|
{
|
|
15126
15425
|
label: `${t("elements.fields.organization.name.label")}`,
|
|
@@ -15133,7 +15432,7 @@ var BaseCreateOrganization = ({
|
|
|
15133
15432
|
className: (0, import_css58.cx)(styles["input"])
|
|
15134
15433
|
}
|
|
15135
15434
|
) }),
|
|
15136
|
-
/* @__PURE__ */ (0,
|
|
15435
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15137
15436
|
TextField_default,
|
|
15138
15437
|
{
|
|
15139
15438
|
label: `${t("elements.fields.organization.handle.label") || "Organization Handle"}`,
|
|
@@ -15147,9 +15446,9 @@ var BaseCreateOrganization = ({
|
|
|
15147
15446
|
className: (0, import_css58.cx)(styles["input"])
|
|
15148
15447
|
}
|
|
15149
15448
|
) }),
|
|
15150
|
-
/* @__PURE__ */ (0,
|
|
15151
|
-
/* @__PURE__ */ (0,
|
|
15152
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(FormControl_default, { error: formErrors.description, children: [
|
|
15450
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(InputLabel_default, { required: true, children: t("elements.fields.organization.description.label") }),
|
|
15451
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15153
15452
|
"textarea",
|
|
15154
15453
|
{
|
|
15155
15454
|
className: (0, import_css58.cx)(styles["textarea"], formErrors.description && styles["textareaError"]),
|
|
@@ -15163,15 +15462,15 @@ var BaseCreateOrganization = ({
|
|
|
15163
15462
|
] }) }),
|
|
15164
15463
|
renderAdditionalFields && renderAdditionalFields()
|
|
15165
15464
|
] }),
|
|
15166
|
-
/* @__PURE__ */ (0,
|
|
15167
|
-
onCancel && /* @__PURE__ */ (0,
|
|
15168
|
-
/* @__PURE__ */ (0,
|
|
15465
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: (0, import_css58.cx)(styles["actions"]), children: [
|
|
15466
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.buttons.cancel.text") }),
|
|
15467
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.buttons.create_organization.loading.text") : t("organization.create.buttons.create_organization.text") })
|
|
15169
15468
|
] })
|
|
15170
15469
|
] }) });
|
|
15171
15470
|
if (mode === "popup") {
|
|
15172
|
-
return /* @__PURE__ */ (0,
|
|
15173
|
-
/* @__PURE__ */ (0,
|
|
15174
|
-
/* @__PURE__ */ (0,
|
|
15471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Dialog_default.Content, { children: [
|
|
15472
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Dialog_default.Heading, { children: title }),
|
|
15473
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: styles["popup"], children: createOrganizationContent })
|
|
15175
15474
|
] }) });
|
|
15176
15475
|
}
|
|
15177
15476
|
return createOrganizationContent;
|
|
@@ -15209,7 +15508,7 @@ var createOrganization = async ({
|
|
|
15209
15508
|
var createOrganization_default = createOrganization;
|
|
15210
15509
|
|
|
15211
15510
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
15212
|
-
var
|
|
15511
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
15213
15512
|
var CreateOrganization = ({
|
|
15214
15513
|
onCreateOrganization,
|
|
15215
15514
|
fallback = null,
|
|
@@ -15219,13 +15518,13 @@ var CreateOrganization = ({
|
|
|
15219
15518
|
}) => {
|
|
15220
15519
|
const { isSignedIn, baseUrl, instanceId } = useAsgardeo_default();
|
|
15221
15520
|
const { currentOrganization, revalidateMyOrganizations } = useOrganization_default();
|
|
15222
|
-
const [loading, setLoading] = (0,
|
|
15223
|
-
const [error, setError] = (0,
|
|
15521
|
+
const [loading, setLoading] = (0, import_react95.useState)(false);
|
|
15522
|
+
const [error, setError] = (0, import_react95.useState)(null);
|
|
15224
15523
|
if (!isSignedIn && fallback) {
|
|
15225
15524
|
return fallback;
|
|
15226
15525
|
}
|
|
15227
15526
|
if (!isSignedIn) {
|
|
15228
|
-
return /* @__PURE__ */ (0,
|
|
15527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_jsx_runtime108.Fragment, {});
|
|
15229
15528
|
}
|
|
15230
15529
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
15231
15530
|
const handleSubmit = async (payload) => {
|
|
@@ -15260,7 +15559,7 @@ var CreateOrganization = ({
|
|
|
15260
15559
|
setLoading(false);
|
|
15261
15560
|
}
|
|
15262
15561
|
};
|
|
15263
|
-
return /* @__PURE__ */ (0,
|
|
15562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
15264
15563
|
BaseCreateOrganization,
|
|
15265
15564
|
{
|
|
15266
15565
|
onSubmit: handleSubmit,
|
|
@@ -15275,16 +15574,16 @@ var CreateOrganization = ({
|
|
|
15275
15574
|
|
|
15276
15575
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
15277
15576
|
var import_css62 = require("@emotion/css");
|
|
15278
|
-
var
|
|
15577
|
+
var import_react99 = require("react");
|
|
15279
15578
|
|
|
15280
15579
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
15281
15580
|
var import_css60 = require("@emotion/css");
|
|
15282
|
-
var
|
|
15581
|
+
var import_react97 = require("react");
|
|
15283
15582
|
|
|
15284
15583
|
// src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts
|
|
15285
15584
|
var import_css59 = require("@emotion/css");
|
|
15286
|
-
var
|
|
15287
|
-
var useStyles27 = (theme, colorScheme) => (0,
|
|
15585
|
+
var import_react96 = require("react");
|
|
15586
|
+
var useStyles27 = (theme, colorScheme) => (0, import_react96.useMemo)(() => {
|
|
15288
15587
|
const root = import_css59.css`
|
|
15289
15588
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
15290
15589
|
min-width: 600px;
|
|
@@ -15508,20 +15807,20 @@ var useStyles27 = (theme, colorScheme) => (0, import_react95.useMemo)(() => {
|
|
|
15508
15807
|
var BaseOrganizationList_styles_default = useStyles27;
|
|
15509
15808
|
|
|
15510
15809
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
15511
|
-
var
|
|
15512
|
-
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => /* @__PURE__ */ (0,
|
|
15513
|
-
/* @__PURE__ */ (0,
|
|
15514
|
-
/* @__PURE__ */ (0,
|
|
15515
|
-
/* @__PURE__ */ (0,
|
|
15516
|
-
/* @__PURE__ */ (0,
|
|
15517
|
-
/* @__PURE__ */ (0,
|
|
15810
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
15811
|
+
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationItem), children: [
|
|
15812
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationContent), children: [
|
|
15813
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Avatar, { variant: "square", name: organization.name, size: 48, alt: `${organization.name} logo` }),
|
|
15814
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationInfo), children: [
|
|
15815
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "h6", className: (0, import_css60.cx)(styles.organizationName), children: organization.name }),
|
|
15816
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles.organizationHandle), children: [
|
|
15518
15817
|
"@",
|
|
15519
15818
|
organization.orgHandle
|
|
15520
15819
|
] }),
|
|
15521
|
-
showStatus && /* @__PURE__ */ (0,
|
|
15820
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles.organizationStatus), children: [
|
|
15522
15821
|
t("organization.switcher.status.label"),
|
|
15523
15822
|
" ",
|
|
15524
|
-
/* @__PURE__ */ (0,
|
|
15823
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15525
15824
|
"span",
|
|
15526
15825
|
{
|
|
15527
15826
|
className: (0, import_css60.cx)(
|
|
@@ -15534,7 +15833,7 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
15534
15833
|
] })
|
|
15535
15834
|
] })
|
|
15536
15835
|
] }),
|
|
15537
|
-
organization.canSwitch && /* @__PURE__ */ (0,
|
|
15836
|
+
organization.canSwitch && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.organizationActions), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15538
15837
|
Button_default,
|
|
15539
15838
|
{
|
|
15540
15839
|
onClick: (e) => {
|
|
@@ -15547,17 +15846,17 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
15547
15846
|
}
|
|
15548
15847
|
) })
|
|
15549
15848
|
] }, organization.id);
|
|
15550
|
-
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0,
|
|
15551
|
-
/* @__PURE__ */ (0,
|
|
15552
|
-
/* @__PURE__ */ (0,
|
|
15849
|
+
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.loadingContainer), children: [
|
|
15850
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Spinner_default, { size: "medium" }),
|
|
15851
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css60.cx)(styles.loadingText), children: t("organization.switcher.loading.placeholder.organizations") })
|
|
15553
15852
|
] });
|
|
15554
|
-
var defaultRenderError = (errorMessage, t, styles) => /* @__PURE__ */ (0,
|
|
15555
|
-
/* @__PURE__ */ (0,
|
|
15853
|
+
var defaultRenderError = (errorMessage, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.errorContainer), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body1", color: "error", children: [
|
|
15854
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("strong", { children: t("organization.switcher.error.prefix") }),
|
|
15556
15855
|
" ",
|
|
15557
15856
|
errorMessage
|
|
15558
15857
|
] }) });
|
|
15559
|
-
var defaultRenderLoadMore = (onLoadMore, isLoadingMore, t, styles) => /* @__PURE__ */ (0,
|
|
15560
|
-
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0,
|
|
15858
|
+
var defaultRenderLoadMore = (onLoadMore, isLoadingMore, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Button_default, { onClick: onLoadMore, disabled: isLoadingMore, className: (0, import_css60.cx)(styles.loadMoreButton), type: "button", fullWidth: true, children: isLoadingMore ? t("organization.switcher.loading.more") : t("organization.switcher.buttons.load_more.text") });
|
|
15859
|
+
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.emptyContainer), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css60.cx)(styles.emptyText), children: t("organization.switcher.no.organizations") }) });
|
|
15561
15860
|
var BaseOrganizationList = ({
|
|
15562
15861
|
className = "",
|
|
15563
15862
|
allOrganizations,
|
|
@@ -15585,7 +15884,7 @@ var BaseOrganizationList = ({
|
|
|
15585
15884
|
const { theme, colorScheme } = useTheme_default();
|
|
15586
15885
|
const styles = BaseOrganizationList_styles_default(theme, colorScheme);
|
|
15587
15886
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15588
|
-
const organizationsWithSwitchAccess = (0,
|
|
15887
|
+
const organizationsWithSwitchAccess = (0, import_react97.useMemo)(() => {
|
|
15589
15888
|
if (!allOrganizations?.organizations) {
|
|
15590
15889
|
return [];
|
|
15591
15890
|
}
|
|
@@ -15601,42 +15900,42 @@ var BaseOrganizationList = ({
|
|
|
15601
15900
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, loadingMore) => defaultRenderLoadMore(onLoadMore, loadingMore, t, styles));
|
|
15602
15901
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));
|
|
15603
15902
|
if (isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
15604
|
-
const loadingContent = /* @__PURE__ */ (0,
|
|
15903
|
+
const loadingContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderLoadingWithStyles() });
|
|
15605
15904
|
if (mode === "popup") {
|
|
15606
|
-
return /* @__PURE__ */ (0,
|
|
15607
|
-
/* @__PURE__ */ (0,
|
|
15608
|
-
/* @__PURE__ */ (0,
|
|
15905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15906
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15907
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: loadingContent })
|
|
15609
15908
|
] }) });
|
|
15610
15909
|
}
|
|
15611
15910
|
return loadingContent;
|
|
15612
15911
|
}
|
|
15613
15912
|
if (error && organizationsWithSwitchAccess?.length === 0) {
|
|
15614
|
-
const errorContent = /* @__PURE__ */ (0,
|
|
15913
|
+
const errorContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderErrorWithStyles(error) });
|
|
15615
15914
|
if (mode === "popup") {
|
|
15616
|
-
return /* @__PURE__ */ (0,
|
|
15617
|
-
/* @__PURE__ */ (0,
|
|
15618
|
-
/* @__PURE__ */ (0,
|
|
15915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15916
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15917
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: errorContent })
|
|
15619
15918
|
] }) });
|
|
15620
15919
|
}
|
|
15621
15920
|
return errorContent;
|
|
15622
15921
|
}
|
|
15623
15922
|
if (!isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
15624
|
-
const emptyContent = /* @__PURE__ */ (0,
|
|
15923
|
+
const emptyContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderEmptyWithStyles() });
|
|
15625
15924
|
if (mode === "popup") {
|
|
15626
|
-
return /* @__PURE__ */ (0,
|
|
15627
|
-
/* @__PURE__ */ (0,
|
|
15628
|
-
/* @__PURE__ */ (0,
|
|
15925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15926
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15927
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: emptyContent })
|
|
15629
15928
|
] }) });
|
|
15630
15929
|
}
|
|
15631
15930
|
return emptyContent;
|
|
15632
15931
|
}
|
|
15633
|
-
const organizationListContent = /* @__PURE__ */ (0,
|
|
15634
|
-
/* @__PURE__ */ (0,
|
|
15635
|
-
/* @__PURE__ */ (0,
|
|
15932
|
+
const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: [
|
|
15933
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles["header"]), children: [
|
|
15934
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["headerInfo"]), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles["subtitle"]), children: t("organization.switcher.showing.count", {
|
|
15636
15935
|
showing: organizationsWithSwitchAccess?.length,
|
|
15637
15936
|
total: allOrganizations?.organizations?.length || 0
|
|
15638
15937
|
}) }) }),
|
|
15639
|
-
onRefresh && /* @__PURE__ */ (0,
|
|
15938
|
+
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15640
15939
|
Button_default,
|
|
15641
15940
|
{
|
|
15642
15941
|
onClick: onRefresh,
|
|
@@ -15648,16 +15947,16 @@ var BaseOrganizationList = ({
|
|
|
15648
15947
|
}
|
|
15649
15948
|
)
|
|
15650
15949
|
] }),
|
|
15651
|
-
/* @__PURE__ */ (0,
|
|
15950
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["listContainer"]), children: organizationsWithSwitchAccess?.map(
|
|
15652
15951
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
15653
15952
|
) }),
|
|
15654
|
-
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0,
|
|
15655
|
-
hasMore && fetchMore && /* @__PURE__ */ (0,
|
|
15953
|
+
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["errorMargin"]), children: renderErrorWithStyles(error) }),
|
|
15954
|
+
hasMore && fetchMore && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["loadMoreMargin"]), children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
15656
15955
|
] });
|
|
15657
15956
|
if (mode === "popup") {
|
|
15658
|
-
return /* @__PURE__ */ (0,
|
|
15659
|
-
/* @__PURE__ */ (0,
|
|
15660
|
-
/* @__PURE__ */ (0,
|
|
15957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15958
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15959
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: organizationListContent })
|
|
15661
15960
|
] }) });
|
|
15662
15961
|
}
|
|
15663
15962
|
return organizationListContent;
|
|
@@ -15666,8 +15965,8 @@ var BaseOrganizationList_default = BaseOrganizationList;
|
|
|
15666
15965
|
|
|
15667
15966
|
// src/components/presentation/OrganizationList/OrganizationList.styles.ts
|
|
15668
15967
|
var import_css61 = require("@emotion/css");
|
|
15669
|
-
var
|
|
15670
|
-
var useStyles28 = (theme, colorScheme) => (0,
|
|
15968
|
+
var import_react98 = require("react");
|
|
15969
|
+
var useStyles28 = (theme, colorScheme) => (0, import_react98.useMemo)(() => {
|
|
15671
15970
|
const cssOrganizationListWrapper = import_css61.css`
|
|
15672
15971
|
/* Container wrapper styles for OrganizationList component */
|
|
15673
15972
|
width: 100%;
|
|
@@ -15727,22 +16026,22 @@ var useStyles28 = (theme, colorScheme) => (0, import_react97.useMemo)(() => {
|
|
|
15727
16026
|
var OrganizationList_styles_default = useStyles28;
|
|
15728
16027
|
|
|
15729
16028
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
15730
|
-
var
|
|
16029
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
15731
16030
|
var OrganizationList = (props) => {
|
|
15732
16031
|
const { onOrganizationSelect, className = "", style, ...baseProps } = props;
|
|
15733
16032
|
const { autoFetch, filter, limit, recursive, ...filteredBaseProps } = baseProps;
|
|
15734
16033
|
const { theme, colorScheme } = useTheme_default();
|
|
15735
16034
|
const styles = OrganizationList_styles_default(theme, colorScheme);
|
|
15736
16035
|
const { getAllOrganizations: getAllOrganizations2, error, isLoading, myOrganizations } = useOrganization_default();
|
|
15737
|
-
const [allOrganizations, setAllOrganizations] = (0,
|
|
16036
|
+
const [allOrganizations, setAllOrganizations] = (0, import_react99.useState)({
|
|
15738
16037
|
organizations: []
|
|
15739
16038
|
});
|
|
15740
|
-
(0,
|
|
16039
|
+
(0, import_react99.useEffect)(() => {
|
|
15741
16040
|
(async () => {
|
|
15742
16041
|
setAllOrganizations(await getAllOrganizations2());
|
|
15743
16042
|
})();
|
|
15744
16043
|
}, []);
|
|
15745
|
-
return /* @__PURE__ */ (0,
|
|
16044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: (0, import_css62.cx)(styles["root"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: (0, import_css62.cx)(styles["container"]), children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
15746
16045
|
BaseOrganizationList,
|
|
15747
16046
|
{
|
|
15748
16047
|
allOrganizations,
|
|
@@ -15758,17 +16057,17 @@ var OrganizationList_default = OrganizationList;
|
|
|
15758
16057
|
|
|
15759
16058
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
15760
16059
|
var import_browser89 = require("@asgardeo/browser");
|
|
15761
|
-
var
|
|
16060
|
+
var import_react104 = require("react");
|
|
15762
16061
|
|
|
15763
16062
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
15764
16063
|
var import_browser86 = require("@asgardeo/browser");
|
|
15765
16064
|
var import_css66 = require("@emotion/css");
|
|
15766
|
-
var
|
|
16065
|
+
var import_react103 = require("react");
|
|
15767
16066
|
|
|
15768
16067
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.ts
|
|
15769
16068
|
var import_css63 = require("@emotion/css");
|
|
15770
|
-
var
|
|
15771
|
-
var useStyles29 = (theme, colorScheme) => (0,
|
|
16069
|
+
var import_react100 = require("react");
|
|
16070
|
+
var useStyles29 = (theme, colorScheme) => (0, import_react100.useMemo)(
|
|
15772
16071
|
() => ({
|
|
15773
16072
|
attributeItem: import_css63.css`
|
|
15774
16073
|
display: flex;
|
|
@@ -15924,12 +16223,12 @@ var BaseOrganizationProfile_styles_default = useStyles29;
|
|
|
15924
16223
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
15925
16224
|
var import_browser85 = require("@asgardeo/browser");
|
|
15926
16225
|
var import_css65 = require("@emotion/css");
|
|
15927
|
-
var
|
|
16226
|
+
var import_react102 = require("react");
|
|
15928
16227
|
|
|
15929
16228
|
// src/components/primitives/KeyValueInput/KeyValueInput.styles.ts
|
|
15930
16229
|
var import_css64 = require("@emotion/css");
|
|
15931
|
-
var
|
|
15932
|
-
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0,
|
|
16230
|
+
var import_react101 = require("react");
|
|
16231
|
+
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0, import_react101.useMemo)(() => {
|
|
15933
16232
|
const container = import_css64.css`
|
|
15934
16233
|
display: flex;
|
|
15935
16234
|
flex-direction: column;
|
|
@@ -16081,7 +16380,7 @@ var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0, impo
|
|
|
16081
16380
|
var KeyValueInput_styles_default = useStyles30;
|
|
16082
16381
|
|
|
16083
16382
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
16084
|
-
var
|
|
16383
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16085
16384
|
var KeyValueInput = ({
|
|
16086
16385
|
className = "",
|
|
16087
16386
|
disabled = false,
|
|
@@ -16104,10 +16403,10 @@ var KeyValueInput = ({
|
|
|
16104
16403
|
const { theme, colorScheme } = useTheme_default();
|
|
16105
16404
|
const styles = KeyValueInput_styles_default(theme, colorScheme, disabled, readOnly, !!error);
|
|
16106
16405
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
16107
|
-
const [pairs, setPairs] = (0,
|
|
16108
|
-
const [newKey, setNewKey] = (0,
|
|
16109
|
-
const [newValue, setNewValue] = (0,
|
|
16110
|
-
const handleAddPair = (0,
|
|
16406
|
+
const [pairs, setPairs] = (0, import_react102.useState)(initialPairs);
|
|
16407
|
+
const [newKey, setNewKey] = (0, import_react102.useState)("");
|
|
16408
|
+
const [newValue, setNewValue] = (0, import_react102.useState)("");
|
|
16409
|
+
const handleAddPair = (0, import_react102.useCallback)(() => {
|
|
16111
16410
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
16112
16411
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
16113
16412
|
const newPair = {
|
|
@@ -16125,7 +16424,7 @@ var KeyValueInput = ({
|
|
|
16125
16424
|
onAdd(newPair);
|
|
16126
16425
|
}
|
|
16127
16426
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
16128
|
-
const handleRemovePair = (0,
|
|
16427
|
+
const handleRemovePair = (0, import_react102.useCallback)(
|
|
16129
16428
|
(index) => {
|
|
16130
16429
|
const pairToRemove = pairs[index];
|
|
16131
16430
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -16139,7 +16438,7 @@ var KeyValueInput = ({
|
|
|
16139
16438
|
},
|
|
16140
16439
|
[pairs, onChange, onRemove]
|
|
16141
16440
|
);
|
|
16142
|
-
const handleUpdatePair = (0,
|
|
16441
|
+
const handleUpdatePair = (0, import_react102.useCallback)(
|
|
16143
16442
|
(index, field, newVal) => {
|
|
16144
16443
|
const updatedPairs = pairs.map((pair, i) => {
|
|
16145
16444
|
if (i === index) {
|
|
@@ -16158,18 +16457,18 @@ var KeyValueInput = ({
|
|
|
16158
16457
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
16159
16458
|
const renderReadOnlyContent = () => {
|
|
16160
16459
|
if (pairs.length === 0) {
|
|
16161
|
-
return /* @__PURE__ */ (0,
|
|
16460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "empty-state")), styles["emptyState"]), children: "No attributes defined" });
|
|
16162
16461
|
}
|
|
16163
|
-
return pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
16462
|
+
return pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
16164
16463
|
"div",
|
|
16165
16464
|
{
|
|
16166
16465
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-pair")), styles["readOnlyPair"]),
|
|
16167
16466
|
children: [
|
|
16168
|
-
/* @__PURE__ */ (0,
|
|
16467
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("span", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-key")), styles["readOnlyKey"]), children: [
|
|
16169
16468
|
pair.key,
|
|
16170
16469
|
":"
|
|
16171
16470
|
] }),
|
|
16172
|
-
/* @__PURE__ */ (0,
|
|
16471
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16173
16472
|
"span",
|
|
16174
16473
|
{
|
|
16175
16474
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-value")), styles["readOnlyValue"]),
|
|
@@ -16181,10 +16480,10 @@ var KeyValueInput = ({
|
|
|
16181
16480
|
`${pair.key}-${index}`
|
|
16182
16481
|
));
|
|
16183
16482
|
};
|
|
16184
|
-
return /* @__PURE__ */ (0,
|
|
16185
|
-
label && /* @__PURE__ */ (0,
|
|
16483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input")), styles["container"], className), children: [
|
|
16484
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("label", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "label")), styles["label"]), children: [
|
|
16186
16485
|
label,
|
|
16187
|
-
required && /* @__PURE__ */ (0,
|
|
16486
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16188
16487
|
"span",
|
|
16189
16488
|
{
|
|
16190
16489
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "required")), styles["requiredIndicator"]),
|
|
@@ -16192,13 +16491,13 @@ var KeyValueInput = ({
|
|
|
16192
16491
|
}
|
|
16193
16492
|
)
|
|
16194
16493
|
] }),
|
|
16195
|
-
/* @__PURE__ */ (0,
|
|
16196
|
-
readOnly ? renderReadOnlyContent() : pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
16494
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "pairs-list")), styles["pairsList"]), children: [
|
|
16495
|
+
readOnly ? renderReadOnlyContent() : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
16197
16496
|
"div",
|
|
16198
16497
|
{
|
|
16199
16498
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "pair-row")), styles["pairRow"]),
|
|
16200
16499
|
children: [
|
|
16201
|
-
/* @__PURE__ */ (0,
|
|
16500
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16202
16501
|
TextField_default,
|
|
16203
16502
|
{
|
|
16204
16503
|
placeholder: keyPlaceholder,
|
|
@@ -16209,7 +16508,7 @@ var KeyValueInput = ({
|
|
|
16209
16508
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
16210
16509
|
}
|
|
16211
16510
|
),
|
|
16212
|
-
/* @__PURE__ */ (0,
|
|
16511
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16213
16512
|
TextField_default,
|
|
16214
16513
|
{
|
|
16215
16514
|
placeholder: valuePlaceholder,
|
|
@@ -16220,7 +16519,7 @@ var KeyValueInput = ({
|
|
|
16220
16519
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
16221
16520
|
}
|
|
16222
16521
|
),
|
|
16223
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
16522
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16224
16523
|
"button",
|
|
16225
16524
|
{
|
|
16226
16525
|
type: "button",
|
|
@@ -16231,15 +16530,15 @@ var KeyValueInput = ({
|
|
|
16231
16530
|
styles["removeButton"]
|
|
16232
16531
|
),
|
|
16233
16532
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
16234
|
-
children: /* @__PURE__ */ (0,
|
|
16533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(X_default, { width: 16, height: 16 })
|
|
16235
16534
|
}
|
|
16236
16535
|
)
|
|
16237
16536
|
]
|
|
16238
16537
|
},
|
|
16239
16538
|
`${pair.key}-${index}`
|
|
16240
16539
|
)),
|
|
16241
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
16242
|
-
/* @__PURE__ */ (0,
|
|
16540
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "add-row")), styles["addRow"]), children: [
|
|
16541
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16243
16542
|
TextField_default,
|
|
16244
16543
|
{
|
|
16245
16544
|
placeholder: keyPlaceholder,
|
|
@@ -16250,7 +16549,7 @@ var KeyValueInput = ({
|
|
|
16250
16549
|
"aria-label": "New key"
|
|
16251
16550
|
}
|
|
16252
16551
|
),
|
|
16253
|
-
/* @__PURE__ */ (0,
|
|
16552
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16254
16553
|
TextField_default,
|
|
16255
16554
|
{
|
|
16256
16555
|
placeholder: valuePlaceholder,
|
|
@@ -16266,7 +16565,7 @@ var KeyValueInput = ({
|
|
|
16266
16565
|
}
|
|
16267
16566
|
}
|
|
16268
16567
|
),
|
|
16269
|
-
/* @__PURE__ */ (0,
|
|
16568
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16270
16569
|
"button",
|
|
16271
16570
|
{
|
|
16272
16571
|
type: "button",
|
|
@@ -16274,13 +16573,13 @@ var KeyValueInput = ({
|
|
|
16274
16573
|
disabled: isAddDisabled,
|
|
16275
16574
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "add-button")), styles["addButton"]),
|
|
16276
16575
|
"aria-label": "Add new key-value pair",
|
|
16277
|
-
children: /* @__PURE__ */ (0,
|
|
16576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Plus_default, { width: 16, height: 16 })
|
|
16278
16577
|
}
|
|
16279
16578
|
)
|
|
16280
16579
|
] })
|
|
16281
16580
|
] }),
|
|
16282
|
-
(helperText || error) && /* @__PURE__ */ (0,
|
|
16283
|
-
maxPairs && /* @__PURE__ */ (0,
|
|
16581
|
+
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "helper-text")), styles["helperText"]), children: error || helperText }),
|
|
16582
|
+
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "counter")), styles["counterText"]), children: [
|
|
16284
16583
|
pairs.length,
|
|
16285
16584
|
" of ",
|
|
16286
16585
|
maxPairs,
|
|
@@ -16291,7 +16590,7 @@ var KeyValueInput = ({
|
|
|
16291
16590
|
var KeyValueInput_default = KeyValueInput;
|
|
16292
16591
|
|
|
16293
16592
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
16294
|
-
var
|
|
16593
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16295
16594
|
var BaseOrganizationProfile = ({
|
|
16296
16595
|
fallback = null,
|
|
16297
16596
|
className = "",
|
|
@@ -16338,9 +16637,9 @@ var BaseOrganizationProfile = ({
|
|
|
16338
16637
|
}) => {
|
|
16339
16638
|
const { theme, colorScheme } = useTheme_default();
|
|
16340
16639
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
16341
|
-
const [editedOrganization, setEditedOrganization] = (0,
|
|
16342
|
-
const [editingFields, setEditingFields] = (0,
|
|
16343
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
16640
|
+
const [editedOrganization, setEditedOrganization] = (0, import_react103.useState)(organization);
|
|
16641
|
+
const [editingFields, setEditingFields] = (0, import_react103.useState)({});
|
|
16642
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16344
16643
|
"svg",
|
|
16345
16644
|
{
|
|
16346
16645
|
width: "16",
|
|
@@ -16351,16 +16650,16 @@ var BaseOrganizationProfile = ({
|
|
|
16351
16650
|
strokeWidth: "2",
|
|
16352
16651
|
strokeLinecap: "round",
|
|
16353
16652
|
strokeLinejoin: "round",
|
|
16354
|
-
children: /* @__PURE__ */ (0,
|
|
16653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
16355
16654
|
}
|
|
16356
16655
|
);
|
|
16357
|
-
const toggleFieldEdit = (0,
|
|
16656
|
+
const toggleFieldEdit = (0, import_react103.useCallback)((fieldName) => {
|
|
16358
16657
|
setEditingFields((prev) => ({
|
|
16359
16658
|
...prev,
|
|
16360
16659
|
[fieldName]: !prev[fieldName]
|
|
16361
16660
|
}));
|
|
16362
16661
|
}, []);
|
|
16363
|
-
const getFieldPlaceholder = (0,
|
|
16662
|
+
const getFieldPlaceholder = (0, import_react103.useCallback)((fieldKey) => {
|
|
16364
16663
|
const fieldLabels = {
|
|
16365
16664
|
description: "organization description",
|
|
16366
16665
|
name: "organization name",
|
|
@@ -16371,7 +16670,7 @@ var BaseOrganizationProfile = ({
|
|
|
16371
16670
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
16372
16671
|
return `Enter ${fieldLabel}`;
|
|
16373
16672
|
}, []);
|
|
16374
|
-
const handleFieldSave = (0,
|
|
16673
|
+
const handleFieldSave = (0, import_react103.useCallback)(
|
|
16375
16674
|
(fieldKey) => {
|
|
16376
16675
|
if (!onUpdate || !fieldKey) return;
|
|
16377
16676
|
let fieldValue;
|
|
@@ -16390,7 +16689,7 @@ var BaseOrganizationProfile = ({
|
|
|
16390
16689
|
},
|
|
16391
16690
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
16392
16691
|
);
|
|
16393
|
-
const handleFieldCancel = (0,
|
|
16692
|
+
const handleFieldCancel = (0, import_react103.useCallback)(
|
|
16394
16693
|
(fieldKey) => {
|
|
16395
16694
|
setEditedOrganization((prev) => ({
|
|
16396
16695
|
...prev,
|
|
@@ -16421,7 +16720,7 @@ var BaseOrganizationProfile = ({
|
|
|
16421
16720
|
let fieldInput;
|
|
16422
16721
|
if (key === "attributes") {
|
|
16423
16722
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
16424
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
16723
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16425
16724
|
KeyValueInput_default,
|
|
16426
16725
|
{
|
|
16427
16726
|
value: attributesValue,
|
|
@@ -16459,26 +16758,26 @@ var BaseOrganizationProfile = ({
|
|
|
16459
16758
|
}
|
|
16460
16759
|
);
|
|
16461
16760
|
} else {
|
|
16462
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
16761
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TextField_default, { ...commonProps });
|
|
16463
16762
|
}
|
|
16464
|
-
return /* @__PURE__ */ (0,
|
|
16465
|
-
/* @__PURE__ */ (0,
|
|
16466
|
-
/* @__PURE__ */ (0,
|
|
16763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16764
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: (0, import_css66.cx)(styles["label"]), children: label }),
|
|
16765
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["value"]), children: fieldInput })
|
|
16467
16766
|
] });
|
|
16468
16767
|
}
|
|
16469
16768
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
16470
16769
|
const isFieldEditable = editable && fieldEditable;
|
|
16471
16770
|
let displayValue;
|
|
16472
16771
|
if (hasValue) {
|
|
16473
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0,
|
|
16772
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
16474
16773
|
} else if (isFieldEditable) {
|
|
16475
16774
|
displayValue = getFieldPlaceholder(key);
|
|
16476
16775
|
} else {
|
|
16477
16776
|
displayValue = "-";
|
|
16478
16777
|
}
|
|
16479
|
-
return /* @__PURE__ */ (0,
|
|
16480
|
-
/* @__PURE__ */ (0,
|
|
16481
|
-
/* @__PURE__ */ (0,
|
|
16778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16779
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: (0, import_css66.cx)(styles["label"]), children: label }),
|
|
16780
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["value"], !hasValue && styles["valueEmpty"]), children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16482
16781
|
Button_default,
|
|
16483
16782
|
{
|
|
16484
16783
|
onClick: onStartEdit,
|
|
@@ -16501,8 +16800,8 @@ var BaseOrganizationProfile = ({
|
|
|
16501
16800
|
if (!shouldShow) {
|
|
16502
16801
|
return null;
|
|
16503
16802
|
}
|
|
16504
|
-
return /* @__PURE__ */ (0,
|
|
16505
|
-
/* @__PURE__ */ (0,
|
|
16803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["field"]), children: [
|
|
16804
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["fieldContent"]), children: renderField(
|
|
16506
16805
|
field,
|
|
16507
16806
|
isFieldEditing,
|
|
16508
16807
|
(value) => {
|
|
@@ -16512,8 +16811,8 @@ var BaseOrganizationProfile = ({
|
|
|
16512
16811
|
},
|
|
16513
16812
|
() => toggleFieldEdit(field.key)
|
|
16514
16813
|
) }),
|
|
16515
|
-
isFieldEditable && /* @__PURE__ */ (0,
|
|
16516
|
-
/* @__PURE__ */ (0,
|
|
16814
|
+
isFieldEditable && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["fieldActions"]), children: isFieldEditing ? /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16815
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16517
16816
|
Button_default,
|
|
16518
16817
|
{
|
|
16519
16818
|
onClick: () => handleFieldSave(field.key),
|
|
@@ -16524,7 +16823,7 @@ var BaseOrganizationProfile = ({
|
|
|
16524
16823
|
children: saveButtonText
|
|
16525
16824
|
}
|
|
16526
16825
|
),
|
|
16527
|
-
/* @__PURE__ */ (0,
|
|
16826
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16528
16827
|
Button_default,
|
|
16529
16828
|
{
|
|
16530
16829
|
onClick: () => handleFieldCancel(field.key),
|
|
@@ -16535,7 +16834,7 @@ var BaseOrganizationProfile = ({
|
|
|
16535
16834
|
children: cancelButtonText
|
|
16536
16835
|
}
|
|
16537
16836
|
)
|
|
16538
|
-
] }) : hasValue && /* @__PURE__ */ (0,
|
|
16837
|
+
] }) : hasValue && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16539
16838
|
Button_default,
|
|
16540
16839
|
{
|
|
16541
16840
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -16544,7 +16843,7 @@ var BaseOrganizationProfile = ({
|
|
|
16544
16843
|
size: "small",
|
|
16545
16844
|
title: "Edit field",
|
|
16546
16845
|
className: (0, import_css66.cx)(styles["editButton"]),
|
|
16547
|
-
children: /* @__PURE__ */ (0,
|
|
16846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(PencilIcon, {})
|
|
16548
16847
|
}
|
|
16549
16848
|
) })
|
|
16550
16849
|
] }, field.key);
|
|
@@ -16552,23 +16851,23 @@ var BaseOrganizationProfile = ({
|
|
|
16552
16851
|
if (!organization) {
|
|
16553
16852
|
return fallback;
|
|
16554
16853
|
}
|
|
16555
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
16556
|
-
/* @__PURE__ */ (0,
|
|
16557
|
-
/* @__PURE__ */ (0,
|
|
16558
|
-
/* @__PURE__ */ (0,
|
|
16559
|
-
/* @__PURE__ */ (0,
|
|
16560
|
-
organization.orgHandle && /* @__PURE__ */ (0,
|
|
16854
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Card_default, { className: (0, import_css66.cx)(styles["root"], cardLayout && styles["card"], className), children: [
|
|
16855
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["header"]), children: [
|
|
16856
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
16857
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["orgInfo"]), children: [
|
|
16858
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("h2", { className: (0, import_css66.cx)(styles["name"]), children: organization.name }),
|
|
16859
|
+
organization.orgHandle && /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("p", { className: (0, import_css66.cx)(styles["handle"]), children: [
|
|
16561
16860
|
"@",
|
|
16562
16861
|
organization.orgHandle
|
|
16563
16862
|
] })
|
|
16564
16863
|
] })
|
|
16565
16864
|
] }),
|
|
16566
|
-
/* @__PURE__ */ (0,
|
|
16865
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["infoContainer"]), children: fields.map((field) => renderOrganizationField(field)) })
|
|
16567
16866
|
] });
|
|
16568
16867
|
if (mode === "popup") {
|
|
16569
|
-
return /* @__PURE__ */ (0,
|
|
16570
|
-
/* @__PURE__ */ (0,
|
|
16571
|
-
/* @__PURE__ */ (0,
|
|
16868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Dialog_default.Content, { children: [
|
|
16869
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Dialog_default.Heading, { children: title }),
|
|
16870
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["popup"]), children: profileContent })
|
|
16572
16871
|
] }) });
|
|
16573
16872
|
}
|
|
16574
16873
|
return profileContent;
|
|
@@ -16637,7 +16936,7 @@ var updateOrganization = async ({
|
|
|
16637
16936
|
var updateOrganization_default = updateOrganization;
|
|
16638
16937
|
|
|
16639
16938
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
16640
|
-
var
|
|
16939
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
16641
16940
|
var logger9 = (0, import_browser89.createPackageComponentLogger)(
|
|
16642
16941
|
"@asgardeo/react",
|
|
16643
16942
|
"OrganizationProfile"
|
|
@@ -16656,7 +16955,7 @@ var OrganizationProfile = ({
|
|
|
16656
16955
|
}) => {
|
|
16657
16956
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
16658
16957
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
16659
|
-
const [organization, setOrganization] = (0,
|
|
16958
|
+
const [organization, setOrganization] = (0, import_react104.useState)(null);
|
|
16660
16959
|
const fetchOrganization = async () => {
|
|
16661
16960
|
if (!baseUrl || !organizationId) {
|
|
16662
16961
|
return;
|
|
@@ -16673,7 +16972,7 @@ var OrganizationProfile = ({
|
|
|
16673
16972
|
setOrganization(null);
|
|
16674
16973
|
}
|
|
16675
16974
|
};
|
|
16676
|
-
(0,
|
|
16975
|
+
(0, import_react104.useEffect)(() => {
|
|
16677
16976
|
fetchOrganization();
|
|
16678
16977
|
}, [baseUrl, organizationId]);
|
|
16679
16978
|
const handleOrganizationUpdate = async (payload) => {
|
|
@@ -16695,7 +16994,7 @@ var OrganizationProfile = ({
|
|
|
16695
16994
|
throw err;
|
|
16696
16995
|
}
|
|
16697
16996
|
};
|
|
16698
|
-
return /* @__PURE__ */ (0,
|
|
16997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
16699
16998
|
BaseOrganizationProfile_default,
|
|
16700
16999
|
{
|
|
16701
17000
|
organization,
|
|
@@ -16712,7 +17011,7 @@ var OrganizationProfile = ({
|
|
|
16712
17011
|
var OrganizationProfile_default = OrganizationProfile;
|
|
16713
17012
|
|
|
16714
17013
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
16715
|
-
var
|
|
17014
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
16716
17015
|
var OrganizationSwitcher = ({
|
|
16717
17016
|
currentOrganization: propCurrentOrganization,
|
|
16718
17017
|
fallback = null,
|
|
@@ -16729,15 +17028,15 @@ var OrganizationSwitcher = ({
|
|
|
16729
17028
|
isLoading,
|
|
16730
17029
|
error
|
|
16731
17030
|
} = useOrganization_default();
|
|
16732
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0,
|
|
16733
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
16734
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0,
|
|
17031
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, import_react105.useState)(false);
|
|
17032
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react105.useState)(false);
|
|
17033
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, import_react105.useState)(false);
|
|
16735
17034
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
16736
17035
|
if (!isSignedIn && fallback) {
|
|
16737
17036
|
return fallback;
|
|
16738
17037
|
}
|
|
16739
17038
|
if (!isSignedIn) {
|
|
16740
|
-
return /* @__PURE__ */ (0,
|
|
17039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_jsx_runtime114.Fragment, {});
|
|
16741
17040
|
}
|
|
16742
17041
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
16743
17042
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -16751,19 +17050,19 @@ var OrganizationSwitcher = ({
|
|
|
16751
17050
|
const defaultMenuItems = [];
|
|
16752
17051
|
if (currentOrganization) {
|
|
16753
17052
|
defaultMenuItems.push({
|
|
16754
|
-
icon: /* @__PURE__ */ (0,
|
|
17053
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(BuildingAlt_default, {}),
|
|
16755
17054
|
label: t("organization.switcher.manage.organizations"),
|
|
16756
17055
|
onClick: handleManageOrganizations
|
|
16757
17056
|
});
|
|
16758
17057
|
}
|
|
16759
17058
|
defaultMenuItems.push({
|
|
16760
|
-
icon: /* @__PURE__ */ (0,
|
|
17059
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
16761
17060
|
label: t("organization.switcher.create.organization"),
|
|
16762
17061
|
onClick: () => setIsCreateOrgOpen(true)
|
|
16763
17062
|
});
|
|
16764
17063
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
16765
|
-
return /* @__PURE__ */ (0,
|
|
16766
|
-
/* @__PURE__ */ (0,
|
|
17064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
17065
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16767
17066
|
BaseOrganizationSwitcher,
|
|
16768
17067
|
{
|
|
16769
17068
|
organizations,
|
|
@@ -16777,7 +17076,7 @@ var OrganizationSwitcher = ({
|
|
|
16777
17076
|
...props
|
|
16778
17077
|
}
|
|
16779
17078
|
),
|
|
16780
|
-
/* @__PURE__ */ (0,
|
|
17079
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16781
17080
|
CreateOrganization,
|
|
16782
17081
|
{
|
|
16783
17082
|
mode: "popup",
|
|
@@ -16791,7 +17090,7 @@ var OrganizationSwitcher = ({
|
|
|
16791
17090
|
}
|
|
16792
17091
|
}
|
|
16793
17092
|
),
|
|
16794
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
17093
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16795
17094
|
OrganizationProfile_default,
|
|
16796
17095
|
{
|
|
16797
17096
|
organizationId: currentOrganization.id,
|
|
@@ -16799,11 +17098,11 @@ var OrganizationSwitcher = ({
|
|
|
16799
17098
|
open: isProfileOpen,
|
|
16800
17099
|
onOpenChange: setIsProfileOpen,
|
|
16801
17100
|
cardLayout: true,
|
|
16802
|
-
loadingFallback: /* @__PURE__ */ (0,
|
|
16803
|
-
errorFallback: /* @__PURE__ */ (0,
|
|
17101
|
+
loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { children: t("organization.profile.loading") }),
|
|
17102
|
+
errorFallback: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { children: t("organization.profile.error") })
|
|
16804
17103
|
}
|
|
16805
17104
|
),
|
|
16806
|
-
/* @__PURE__ */ (0,
|
|
17105
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16807
17106
|
OrganizationList_default,
|
|
16808
17107
|
{
|
|
16809
17108
|
mode: "popup",
|
|
@@ -16824,13 +17123,13 @@ var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
|
16824
17123
|
|
|
16825
17124
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx
|
|
16826
17125
|
var import_css68 = require("@emotion/css");
|
|
16827
|
-
var
|
|
16828
|
-
var
|
|
17126
|
+
var import_react107 = require("@floating-ui/react");
|
|
17127
|
+
var import_react108 = require("react");
|
|
16829
17128
|
|
|
16830
17129
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.ts
|
|
16831
17130
|
var import_css67 = require("@emotion/css");
|
|
16832
|
-
var
|
|
16833
|
-
var useStyles31 = (theme, colorScheme) => (0,
|
|
17131
|
+
var import_react106 = require("react");
|
|
17132
|
+
var useStyles31 = (theme, colorScheme) => (0, import_react106.useMemo)(() => {
|
|
16834
17133
|
const root = import_css67.css`
|
|
16835
17134
|
display: inline-block;
|
|
16836
17135
|
position: relative;
|
|
@@ -16940,7 +17239,7 @@ var useStyles31 = (theme, colorScheme) => (0, import_react105.useMemo)(() => {
|
|
|
16940
17239
|
var BaseLanguageSwitcher_styles_default = useStyles31;
|
|
16941
17240
|
|
|
16942
17241
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx
|
|
16943
|
-
var
|
|
17242
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
16944
17243
|
var BaseLanguageSwitcher = ({
|
|
16945
17244
|
children,
|
|
16946
17245
|
className,
|
|
@@ -16951,34 +17250,34 @@ var BaseLanguageSwitcher = ({
|
|
|
16951
17250
|
}) => {
|
|
16952
17251
|
const { theme, colorScheme } = useTheme_default();
|
|
16953
17252
|
const styles = BaseLanguageSwitcher_styles_default(theme, colorScheme);
|
|
16954
|
-
const [isOpen, setIsOpen] = (0,
|
|
17253
|
+
const [isOpen, setIsOpen] = (0, import_react108.useState)(false);
|
|
16955
17254
|
const hasMultipleLanguages = languages.length > 1;
|
|
16956
|
-
(0,
|
|
17255
|
+
(0, import_react108.useEffect)(() => {
|
|
16957
17256
|
if (!hasMultipleLanguages && isOpen) {
|
|
16958
17257
|
setIsOpen(false);
|
|
16959
17258
|
}
|
|
16960
17259
|
}, [hasMultipleLanguages, isOpen]);
|
|
16961
|
-
const { refs, floatingStyles, context } = (0,
|
|
16962
|
-
middleware: [(0,
|
|
17260
|
+
const { refs, floatingStyles, context } = (0, import_react107.useFloating)({
|
|
17261
|
+
middleware: [(0, import_react107.offset)(4), (0, import_react107.flip)(), (0, import_react107.shift)()],
|
|
16963
17262
|
onOpenChange: setIsOpen,
|
|
16964
17263
|
open: isOpen,
|
|
16965
|
-
whileElementsMounted:
|
|
17264
|
+
whileElementsMounted: import_react107.autoUpdate
|
|
16966
17265
|
});
|
|
16967
|
-
const click = (0,
|
|
16968
|
-
const dismiss = (0,
|
|
16969
|
-
const role = (0,
|
|
16970
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
17266
|
+
const click = (0, import_react107.useClick)(context, { enabled: hasMultipleLanguages });
|
|
17267
|
+
const dismiss = (0, import_react107.useDismiss)(context, { enabled: hasMultipleLanguages });
|
|
17268
|
+
const role = (0, import_react107.useRole)(context, { enabled: hasMultipleLanguages, role: "listbox" });
|
|
17269
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react107.useInteractions)([click, dismiss, role]);
|
|
16971
17270
|
const currentOption = languages.find((l) => l.code === currentLanguage);
|
|
16972
17271
|
if (children) {
|
|
16973
|
-
return /* @__PURE__ */ (0,
|
|
17272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_jsx_runtime115.Fragment, { children: children({
|
|
16974
17273
|
currentLanguage,
|
|
16975
17274
|
isLoading,
|
|
16976
17275
|
languages,
|
|
16977
17276
|
onLanguageChange
|
|
16978
17277
|
}) });
|
|
16979
17278
|
}
|
|
16980
|
-
return /* @__PURE__ */ (0,
|
|
16981
|
-
/* @__PURE__ */ (0,
|
|
17279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: (0, import_css68.cx)(styles["root"], className), children: [
|
|
17280
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
|
|
16982
17281
|
"button",
|
|
16983
17282
|
{
|
|
16984
17283
|
ref: refs.setReference,
|
|
@@ -16988,13 +17287,13 @@ var BaseLanguageSwitcher = ({
|
|
|
16988
17287
|
...getReferenceProps(),
|
|
16989
17288
|
className: styles["trigger"],
|
|
16990
17289
|
children: [
|
|
16991
|
-
currentOption && /* @__PURE__ */ (0,
|
|
16992
|
-
/* @__PURE__ */ (0,
|
|
16993
|
-
hasMultipleLanguages && /* @__PURE__ */ (0,
|
|
17290
|
+
currentOption && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["triggerEmoji"], children: currentOption.emoji }),
|
|
17291
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["triggerLabel"], children: currentOption?.displayName ?? currentLanguage }),
|
|
17292
|
+
hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(ChevronDown_default, {})
|
|
16994
17293
|
]
|
|
16995
17294
|
}
|
|
16996
17295
|
),
|
|
16997
|
-
isOpen && hasMultipleLanguages && /* @__PURE__ */ (0,
|
|
17296
|
+
isOpen && hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_react107.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_react107.FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
16998
17297
|
"div",
|
|
16999
17298
|
{
|
|
17000
17299
|
ref: refs.setFloating,
|
|
@@ -17003,7 +17302,7 @@ var BaseLanguageSwitcher = ({
|
|
|
17003
17302
|
className: styles["content"],
|
|
17004
17303
|
role: "listbox",
|
|
17005
17304
|
"aria-label": "Select language",
|
|
17006
|
-
children: languages.map((lang) => /* @__PURE__ */ (0,
|
|
17305
|
+
children: languages.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
|
|
17007
17306
|
"button",
|
|
17008
17307
|
{
|
|
17009
17308
|
type: "button",
|
|
@@ -17015,9 +17314,9 @@ var BaseLanguageSwitcher = ({
|
|
|
17015
17314
|
setIsOpen(false);
|
|
17016
17315
|
},
|
|
17017
17316
|
children: [
|
|
17018
|
-
/* @__PURE__ */ (0,
|
|
17019
|
-
/* @__PURE__ */ (0,
|
|
17020
|
-
lang.code === currentLanguage && /* @__PURE__ */ (0,
|
|
17317
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["optionEmoji"], children: lang.emoji }),
|
|
17318
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["optionLabel"], children: lang.displayName }),
|
|
17319
|
+
lang.code === currentLanguage && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["checkIcon"], children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Check_default, {}) })
|
|
17021
17320
|
]
|
|
17022
17321
|
},
|
|
17023
17322
|
lang.code
|
|
@@ -17030,12 +17329,12 @@ var BaseLanguageSwitcher_default = BaseLanguageSwitcher;
|
|
|
17030
17329
|
|
|
17031
17330
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
17032
17331
|
var import_browser90 = require("@asgardeo/browser");
|
|
17033
|
-
var
|
|
17332
|
+
var import_react110 = require("react");
|
|
17034
17333
|
|
|
17035
17334
|
// src/contexts/FlowMeta/useFlowMeta.ts
|
|
17036
|
-
var
|
|
17335
|
+
var import_react109 = require("react");
|
|
17037
17336
|
var useFlowMeta = () => {
|
|
17038
|
-
const context = (0,
|
|
17337
|
+
const context = (0, import_react109.useContext)(FlowMetaContext_default);
|
|
17039
17338
|
if (!context) {
|
|
17040
17339
|
throw new Error("useFlowMeta must be used within a FlowMetaProvider");
|
|
17041
17340
|
}
|
|
@@ -17044,16 +17343,16 @@ var useFlowMeta = () => {
|
|
|
17044
17343
|
var useFlowMeta_default = useFlowMeta;
|
|
17045
17344
|
|
|
17046
17345
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
17047
|
-
var
|
|
17346
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17048
17347
|
var LanguageSwitcher = ({ children, className }) => {
|
|
17049
17348
|
const { meta, switchLanguage, isLoading } = useFlowMeta_default();
|
|
17050
17349
|
const { currentLanguage } = useTranslation_default();
|
|
17051
17350
|
const availableLanguageCodes = meta?.i18n?.languages ?? [];
|
|
17052
|
-
const effectiveLanguageCodes = (0,
|
|
17351
|
+
const effectiveLanguageCodes = (0, import_react110.useMemo)(() => {
|
|
17053
17352
|
const fallbackCodes = availableLanguageCodes.length > 0 ? availableLanguageCodes : [currentLanguage];
|
|
17054
17353
|
return Array.from(/* @__PURE__ */ new Set([currentLanguage, ...fallbackCodes]));
|
|
17055
17354
|
}, [availableLanguageCodes, currentLanguage]);
|
|
17056
|
-
const languages = (0,
|
|
17355
|
+
const languages = (0, import_react110.useMemo)(
|
|
17057
17356
|
() => effectiveLanguageCodes.map((code) => ({
|
|
17058
17357
|
code,
|
|
17059
17358
|
// Resolve each label in its own locale so option names stay stable across UI language switches.
|
|
@@ -17067,7 +17366,7 @@ var LanguageSwitcher = ({ children, className }) => {
|
|
|
17067
17366
|
switchLanguage(language);
|
|
17068
17367
|
}
|
|
17069
17368
|
};
|
|
17070
|
-
return /* @__PURE__ */ (0,
|
|
17369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17071
17370
|
BaseLanguageSwitcher_default,
|
|
17072
17371
|
{
|
|
17073
17372
|
currentLanguage,
|