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