@asgardeo/react 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1150 -810
- 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/components/primitives/Icons/ArrowRightLeft.d.ts +29 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1002 -663
- 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,24 +8153,50 @@ 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
|
);
|
|
8002
8163
|
ArrowLeftRight.displayName = "ArrowLeftRight";
|
|
8003
8164
|
var ArrowLeftRight_default = ArrowLeftRight;
|
|
8004
8165
|
|
|
8166
|
+
// src/components/primitives/Icons/ArrowRightLeft.tsx
|
|
8167
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
8168
|
+
var ArrowRightLeft = ({ color = "currentColor", size = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
8169
|
+
"svg",
|
|
8170
|
+
{
|
|
8171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8172
|
+
width: size,
|
|
8173
|
+
height: size,
|
|
8174
|
+
viewBox: "0 0 24 24",
|
|
8175
|
+
fill: "none",
|
|
8176
|
+
stroke: color,
|
|
8177
|
+
strokeWidth: "2",
|
|
8178
|
+
strokeLinecap: "round",
|
|
8179
|
+
strokeLinejoin: "round",
|
|
8180
|
+
children: [
|
|
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" })
|
|
8185
|
+
]
|
|
8186
|
+
}
|
|
8187
|
+
);
|
|
8188
|
+
ArrowRightLeft.displayName = "ArrowRightLeft";
|
|
8189
|
+
var ArrowRightLeft_default = ArrowRightLeft;
|
|
8190
|
+
|
|
8005
8191
|
// src/components/primitives/Icons/flowIconRegistry.tsx
|
|
8006
8192
|
var flowIconRegistry = {
|
|
8007
|
-
ArrowLeftRight: ArrowLeftRight_default
|
|
8193
|
+
ArrowLeftRight: ArrowLeftRight_default,
|
|
8194
|
+
ArrowRightLeft: ArrowRightLeft_default
|
|
8008
8195
|
};
|
|
8009
8196
|
var flowIconRegistry_default = flowIconRegistry;
|
|
8010
8197
|
|
|
8011
8198
|
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
8012
|
-
var
|
|
8199
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8013
8200
|
var logger5 = (0, import_browser50.createPackageComponentLogger)(
|
|
8014
8201
|
"@asgardeo/react",
|
|
8015
8202
|
"AuthOptionFactory"
|
|
@@ -8050,11 +8237,11 @@ var getTypographyVariant = (variant) => {
|
|
|
8050
8237
|
};
|
|
8051
8238
|
return variantMap[variant] || "h3";
|
|
8052
8239
|
};
|
|
8053
|
-
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType,
|
|
8240
|
+
var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType, _componentVariant) => {
|
|
8054
8241
|
const providerId = `${provider}_auth`;
|
|
8055
8242
|
const providerMatches = actionId === providerId || eventType === providerId;
|
|
8056
|
-
if (
|
|
8057
|
-
return
|
|
8243
|
+
if (buttonText.toLowerCase().includes(provider)) {
|
|
8244
|
+
return true;
|
|
8058
8245
|
}
|
|
8059
8246
|
if (authType === "signup") {
|
|
8060
8247
|
return providerMatches || buttonText.toLowerCase().includes(provider);
|
|
@@ -8090,7 +8277,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8090
8277
|
type: fieldType,
|
|
8091
8278
|
value
|
|
8092
8279
|
});
|
|
8093
|
-
return (0,
|
|
8280
|
+
return (0, import_react63.cloneElement)(field, { key });
|
|
8094
8281
|
}
|
|
8095
8282
|
case import_browser50.EmbeddedFlowComponentTypeV2.Action: {
|
|
8096
8283
|
const actionId = component.id;
|
|
@@ -8104,31 +8291,53 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8104
8291
|
Object.keys(formValues).forEach((field) => {
|
|
8105
8292
|
formData[field] = formValues[field];
|
|
8106
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
|
+
}
|
|
8107
8316
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
8108
8317
|
}
|
|
8109
8318
|
};
|
|
8110
8319
|
if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType, componentVariant)) {
|
|
8111
|
-
return /* @__PURE__ */ (0,
|
|
8320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GoogleButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8112
8321
|
}
|
|
8113
8322
|
if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType, componentVariant)) {
|
|
8114
|
-
return /* @__PURE__ */ (0,
|
|
8323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GitHubButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8115
8324
|
}
|
|
8116
8325
|
if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType, componentVariant)) {
|
|
8117
|
-
return /* @__PURE__ */ (0,
|
|
8326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FacebookButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8118
8327
|
}
|
|
8119
8328
|
if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType, componentVariant)) {
|
|
8120
|
-
return /* @__PURE__ */ (0,
|
|
8329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(MicrosoftButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8121
8330
|
}
|
|
8122
8331
|
if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType, componentVariant)) {
|
|
8123
|
-
return /* @__PURE__ */ (0,
|
|
8332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LinkedInButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8124
8333
|
}
|
|
8125
8334
|
if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType, componentVariant)) {
|
|
8126
|
-
return /* @__PURE__ */ (0,
|
|
8335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SignInWithEthereumButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8127
8336
|
}
|
|
8128
8337
|
if (actionId === "prompt_mobile" || eventType === "prompt_mobile") {
|
|
8129
|
-
return /* @__PURE__ */ (0,
|
|
8338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SmsOtpButton_default, { onClick: handleClick, className: options.buttonClassName }, key);
|
|
8130
8339
|
}
|
|
8131
|
-
const startIconEl = component.startIcon ? /* @__PURE__ */ (0,
|
|
8340
|
+
const startIconEl = component.startIcon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8132
8341
|
"img",
|
|
8133
8342
|
{
|
|
8134
8343
|
src: component.startIcon,
|
|
@@ -8137,7 +8346,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8137
8346
|
style: { height: "1.25em", objectFit: "contain", width: "1.25em" }
|
|
8138
8347
|
}
|
|
8139
8348
|
) : null;
|
|
8140
|
-
const endIconEl = component.endIcon ? /* @__PURE__ */ (0,
|
|
8349
|
+
const endIconEl = component.endIcon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8141
8350
|
"img",
|
|
8142
8351
|
{
|
|
8143
8352
|
src: component.endIcon,
|
|
@@ -8146,12 +8355,12 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8146
8355
|
style: { height: "1.25em", objectFit: "contain", width: "1.25em" }
|
|
8147
8356
|
}
|
|
8148
8357
|
) : null;
|
|
8149
|
-
return /* @__PURE__ */ (0,
|
|
8358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8150
8359
|
Button_default,
|
|
8151
8360
|
{
|
|
8152
8361
|
fullWidth: true,
|
|
8153
8362
|
onClick: handleClick,
|
|
8154
|
-
disabled: isLoading || !isFormValid,
|
|
8363
|
+
disabled: isLoading || !isFormValid && !shouldSkipValidation || options.isTimeoutDisabled || component.config?.disabled,
|
|
8155
8364
|
className: options.buttonClassName,
|
|
8156
8365
|
"data-testid": "asgardeo-signin-submit",
|
|
8157
8366
|
variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline",
|
|
@@ -8165,10 +8374,10 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8165
8374
|
}
|
|
8166
8375
|
case import_browser50.EmbeddedFlowComponentTypeV2.Text: {
|
|
8167
8376
|
const variant = getTypographyVariant(component.variant);
|
|
8168
|
-
return /* @__PURE__ */ (0,
|
|
8377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Typography_default, { variant, children: resolve(component.label) }, key);
|
|
8169
8378
|
}
|
|
8170
8379
|
case import_browser50.EmbeddedFlowComponentTypeV2.Divider: {
|
|
8171
|
-
return /* @__PURE__ */ (0,
|
|
8380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Divider_default, { children: resolve(component.label) || "" }, key);
|
|
8172
8381
|
}
|
|
8173
8382
|
case import_browser50.EmbeddedFlowComponentTypeV2.Select: {
|
|
8174
8383
|
const identifier = component.ref;
|
|
@@ -8179,7 +8388,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8179
8388
|
label: typeof opt === "string" ? opt : String(opt.label ?? opt.value ?? ""),
|
|
8180
8389
|
value: typeof opt === "string" ? opt : String(opt.value ?? "")
|
|
8181
8390
|
}));
|
|
8182
|
-
return /* @__PURE__ */ (0,
|
|
8391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8183
8392
|
Select_default,
|
|
8184
8393
|
{
|
|
8185
8394
|
name: identifier,
|
|
@@ -8214,12 +8423,12 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8214
8423
|
}
|
|
8215
8424
|
)
|
|
8216
8425
|
).filter(Boolean);
|
|
8217
|
-
return /* @__PURE__ */ (0,
|
|
8426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { id: component.id, children: blockComponents }, key);
|
|
8218
8427
|
}
|
|
8219
8428
|
return null;
|
|
8220
8429
|
}
|
|
8221
8430
|
case import_browser50.EmbeddedFlowComponentTypeV2.RichText: {
|
|
8222
|
-
return /* @__PURE__ */ (0,
|
|
8431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8223
8432
|
"div",
|
|
8224
8433
|
{
|
|
8225
8434
|
className: richTextClass,
|
|
@@ -8229,15 +8438,17 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8229
8438
|
);
|
|
8230
8439
|
}
|
|
8231
8440
|
case import_browser50.EmbeddedFlowComponentTypeV2.Image: {
|
|
8232
|
-
|
|
8441
|
+
const explicitHeight = resolve(component.height?.toString());
|
|
8442
|
+
const explicitWidth = resolve(component.width?.toString());
|
|
8443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8233
8444
|
ImageComponent_default,
|
|
8234
8445
|
{
|
|
8235
8446
|
component: {
|
|
8236
8447
|
config: {
|
|
8237
8448
|
alt: resolve(component.alt) || resolve(component.label) || "Image",
|
|
8238
|
-
height:
|
|
8449
|
+
height: explicitHeight || (options.inStack ? "50" : "auto"),
|
|
8239
8450
|
src: resolve(component.src),
|
|
8240
|
-
width:
|
|
8451
|
+
width: explicitWidth || (options.inStack ? "50" : "100%")
|
|
8241
8452
|
}
|
|
8242
8453
|
},
|
|
8243
8454
|
formErrors: void 0,
|
|
@@ -8259,7 +8470,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8259
8470
|
logger5.warn(`Unknown icon name: "${iconName}". Skipping render.`);
|
|
8260
8471
|
return null;
|
|
8261
8472
|
}
|
|
8262
|
-
return /* @__PURE__ */ (0,
|
|
8473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(IconComponent, { size: component.size || 24, color: component.color || "currentColor" }, key);
|
|
8263
8474
|
}
|
|
8264
8475
|
case import_browser50.EmbeddedFlowComponentTypeV2.Stack: {
|
|
8265
8476
|
const direction = component.direction || "row";
|
|
@@ -8286,11 +8497,31 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
8286
8497
|
authType,
|
|
8287
8498
|
{
|
|
8288
8499
|
...options,
|
|
8500
|
+
inStack: true,
|
|
8289
8501
|
key: childComponent.id || `${component.id}_${index}`
|
|
8290
8502
|
}
|
|
8291
8503
|
)
|
|
8292
8504
|
) : [];
|
|
8293
|
-
return /* @__PURE__ */ (0,
|
|
8505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { style: stackStyle, children: stackChildren }, key);
|
|
8506
|
+
}
|
|
8507
|
+
case import_browser50.EmbeddedFlowComponentTypeV2.Consent: {
|
|
8508
|
+
const consentPromptRawData = options.additionalData?.["consentPrompt"];
|
|
8509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
8510
|
+
Consent_default,
|
|
8511
|
+
{
|
|
8512
|
+
consentData: consentPromptRawData,
|
|
8513
|
+
formValues,
|
|
8514
|
+
onInputChange
|
|
8515
|
+
},
|
|
8516
|
+
key
|
|
8517
|
+
);
|
|
8518
|
+
}
|
|
8519
|
+
case import_browser50.EmbeddedFlowComponentTypeV2.Timer: {
|
|
8520
|
+
const timerConfig = component.config || {};
|
|
8521
|
+
const textTemplate = timerConfig.text || "Time remaining: {time}";
|
|
8522
|
+
const timeoutMs = Number(options.additionalData?.["stepTimeout"]) || 0;
|
|
8523
|
+
const expiresIn = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3)) : 0;
|
|
8524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FlowTimer_default, { expiresIn, textTemplate }, key);
|
|
8294
8525
|
}
|
|
8295
8526
|
default:
|
|
8296
8527
|
logger5.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
@@ -8347,7 +8578,7 @@ var renderInviteUserComponents = (components, formValues, touchedFields, formErr
|
|
|
8347
8578
|
).filter(Boolean);
|
|
8348
8579
|
|
|
8349
8580
|
// src/components/presentation/auth/SignIn/v2/BaseSignIn.tsx
|
|
8350
|
-
var
|
|
8581
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
8351
8582
|
var BaseSignInContent2 = ({
|
|
8352
8583
|
components = [],
|
|
8353
8584
|
onSubmit,
|
|
@@ -8362,17 +8593,19 @@ var BaseSignInContent2 = ({
|
|
|
8362
8593
|
isLoading: externalIsLoading,
|
|
8363
8594
|
children,
|
|
8364
8595
|
showTitle = true,
|
|
8365
|
-
showSubtitle = true
|
|
8596
|
+
showSubtitle = true,
|
|
8597
|
+
additionalData = {},
|
|
8598
|
+
isTimeoutDisabled = false
|
|
8366
8599
|
}) => {
|
|
8367
8600
|
const { meta } = useAsgardeo_default();
|
|
8368
8601
|
const { theme } = useTheme_default();
|
|
8369
8602
|
const { t } = useTranslation_default();
|
|
8370
8603
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
8371
8604
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
8372
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
8373
|
-
const [apiError, setApiError] = (0,
|
|
8605
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react64.useState)(false);
|
|
8606
|
+
const [apiError, setApiError] = (0, import_react64.useState)(null);
|
|
8374
8607
|
const isLoading = externalIsLoading || isSubmitting;
|
|
8375
|
-
const handleError = (0,
|
|
8608
|
+
const handleError = (0, import_react64.useCallback)(
|
|
8376
8609
|
(error) => {
|
|
8377
8610
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
8378
8611
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -8384,7 +8617,7 @@ var BaseSignInContent2 = ({
|
|
|
8384
8617
|
},
|
|
8385
8618
|
[t, addMessage, clearMessages]
|
|
8386
8619
|
);
|
|
8387
|
-
const extractFormFields = (0,
|
|
8620
|
+
const extractFormFields = (0, import_react64.useCallback)(
|
|
8388
8621
|
(flowComponents) => {
|
|
8389
8622
|
const fields = [];
|
|
8390
8623
|
const processComponents = (comps) => {
|
|
@@ -8499,7 +8732,7 @@ var BaseSignInContent2 = ({
|
|
|
8499
8732
|
buttonClassName
|
|
8500
8733
|
);
|
|
8501
8734
|
const messageClasses = (0, import_css37.cx)([(0, import_browser51.withVendorCSSClassPrefix)("signin__messages")], messageClassName);
|
|
8502
|
-
const renderComponents = (0,
|
|
8735
|
+
const renderComponents = (0, import_react64.useCallback)(
|
|
8503
8736
|
(flowComponents) => renderSignInComponents(
|
|
8504
8737
|
flowComponents,
|
|
8505
8738
|
formValues,
|
|
@@ -8509,8 +8742,10 @@ var BaseSignInContent2 = ({
|
|
|
8509
8742
|
isFormValid,
|
|
8510
8743
|
handleInputChange,
|
|
8511
8744
|
{
|
|
8745
|
+
additionalData,
|
|
8512
8746
|
buttonClassName: buttonClasses,
|
|
8513
8747
|
inputClassName: inputClasses,
|
|
8748
|
+
isTimeoutDisabled,
|
|
8514
8749
|
meta,
|
|
8515
8750
|
onInputBlur: handleInputBlur,
|
|
8516
8751
|
onSubmit: handleSubmit,
|
|
@@ -8520,6 +8755,7 @@ var BaseSignInContent2 = ({
|
|
|
8520
8755
|
}
|
|
8521
8756
|
),
|
|
8522
8757
|
[
|
|
8758
|
+
additionalData,
|
|
8523
8759
|
formValues,
|
|
8524
8760
|
touchedFields,
|
|
8525
8761
|
formErrors,
|
|
@@ -8532,7 +8768,8 @@ var BaseSignInContent2 = ({
|
|
|
8532
8768
|
inputClasses,
|
|
8533
8769
|
buttonClasses,
|
|
8534
8770
|
handleInputBlur,
|
|
8535
|
-
handleSubmit
|
|
8771
|
+
handleSubmit,
|
|
8772
|
+
isTimeoutDisabled
|
|
8536
8773
|
]
|
|
8537
8774
|
);
|
|
8538
8775
|
if (children) {
|
|
@@ -8543,6 +8780,7 @@ var BaseSignInContent2 = ({
|
|
|
8543
8780
|
handleInputChange,
|
|
8544
8781
|
handleSubmit,
|
|
8545
8782
|
isLoading,
|
|
8783
|
+
isTimeoutDisabled,
|
|
8546
8784
|
isValid: isFormValid,
|
|
8547
8785
|
messages: flowMessages || [],
|
|
8548
8786
|
meta,
|
|
@@ -8555,13 +8793,13 @@ var BaseSignInContent2 = ({
|
|
|
8555
8793
|
},
|
|
8556
8794
|
values: formValues
|
|
8557
8795
|
};
|
|
8558
|
-
return /* @__PURE__ */ (0,
|
|
8796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: containerClasses, "data-testid": "asgardeo-signin", children: children(renderProps) });
|
|
8559
8797
|
}
|
|
8560
8798
|
if (isLoading) {
|
|
8561
|
-
return /* @__PURE__ */ (0,
|
|
8799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Spinner_default, {}) }) }) });
|
|
8562
8800
|
}
|
|
8563
8801
|
if (!components || components.length === 0) {
|
|
8564
|
-
return /* @__PURE__ */ (0,
|
|
8802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", children: t("errors.signin.components.not.available") }) }) }) });
|
|
8565
8803
|
}
|
|
8566
8804
|
const {
|
|
8567
8805
|
title: rawTitle,
|
|
@@ -8570,46 +8808,46 @@ var BaseSignInContent2 = ({
|
|
|
8570
8808
|
} = getAuthComponentHeadings_default(components, flowTitle, flowSubtitle, void 0, void 0);
|
|
8571
8809
|
const title = (0, import_browser51.resolveVars)(rawTitle, { meta, t });
|
|
8572
8810
|
const subtitle = (0, import_browser51.resolveVars)(rawSubtitle, { meta, t });
|
|
8573
|
-
return /* @__PURE__ */ (0,
|
|
8574
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
8575
|
-
showTitle && /* @__PURE__ */ (0,
|
|
8576
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
8811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default, { className: (0, import_css37.cx)(containerClasses, styles.card), "data-testid": "asgardeo-signin", variant, children: [
|
|
8812
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
8813
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
8814
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
8577
8815
|
] }),
|
|
8578
|
-
/* @__PURE__ */ (0,
|
|
8579
|
-
externalError && /* @__PURE__ */ (0,
|
|
8580
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
8816
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Card_default.Content, { children: [
|
|
8817
|
+
externalError && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default, { variant: "error", className: (0, import_css37.cx)(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: externalError.message }) }) }),
|
|
8818
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
8581
8819
|
Alert_default,
|
|
8582
8820
|
{
|
|
8583
8821
|
variant: message.type === "error" ? "error" : "info",
|
|
8584
8822
|
className: (0, import_css37.cx)(styles.flowMessageItem, messageClasses),
|
|
8585
|
-
children: /* @__PURE__ */ (0,
|
|
8823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Alert_default.Description, { children: message.message })
|
|
8586
8824
|
},
|
|
8587
8825
|
index
|
|
8588
8826
|
)) }),
|
|
8589
|
-
/* @__PURE__ */ (0,
|
|
8827
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.contentContainer, children: componentsWithoutHeadings && renderComponents(componentsWithoutHeadings) })
|
|
8590
8828
|
] })
|
|
8591
8829
|
] });
|
|
8592
8830
|
};
|
|
8593
8831
|
var BaseSignIn2 = ({ preferences, showLogo = true, ...rest }) => {
|
|
8594
8832
|
const { theme } = useTheme_default();
|
|
8595
8833
|
const styles = BaseSignIn_styles_default(theme, theme.vars.colors.text.primary);
|
|
8596
|
-
const content = /* @__PURE__ */ (0,
|
|
8597
|
-
showLogo && /* @__PURE__ */ (0,
|
|
8598
|
-
/* @__PURE__ */ (0,
|
|
8834
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
8835
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Logo_default, { size: "large" }) }),
|
|
8836
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BaseSignInContent2, { showLogo, ...rest }) })
|
|
8599
8837
|
] });
|
|
8600
8838
|
if (!preferences) return content;
|
|
8601
|
-
return /* @__PURE__ */ (0,
|
|
8839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ComponentPreferencesContext_default.Provider, { value: preferences, children: content });
|
|
8602
8840
|
};
|
|
8603
8841
|
var BaseSignIn_default2 = BaseSignIn2;
|
|
8604
8842
|
|
|
8605
8843
|
// src/components/presentation/auth/SignIn/BaseSignIn.tsx
|
|
8606
|
-
var
|
|
8844
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
8607
8845
|
var BaseSignIn3 = (props) => {
|
|
8608
8846
|
const { platform } = useAsgardeo_default();
|
|
8609
8847
|
if (platform === import_browser52.Platform.AsgardeoV2) {
|
|
8610
|
-
return /* @__PURE__ */ (0,
|
|
8848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BaseSignIn_default2, { ...props });
|
|
8611
8849
|
}
|
|
8612
|
-
return /* @__PURE__ */ (0,
|
|
8850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BaseSignIn_default, { ...props });
|
|
8613
8851
|
};
|
|
8614
8852
|
var BaseSignIn_default3 = BaseSignIn3;
|
|
8615
8853
|
|
|
@@ -8618,10 +8856,10 @@ var import_browser56 = require("@asgardeo/browser");
|
|
|
8618
8856
|
|
|
8619
8857
|
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
8620
8858
|
var import_browser55 = require("@asgardeo/browser");
|
|
8621
|
-
var
|
|
8859
|
+
var import_react66 = require("react");
|
|
8622
8860
|
|
|
8623
8861
|
// src/hooks/v2/useOAuthCallback.ts
|
|
8624
|
-
var
|
|
8862
|
+
var import_react65 = require("react");
|
|
8625
8863
|
function cleanupUrlParams() {
|
|
8626
8864
|
if (typeof window === "undefined") return;
|
|
8627
8865
|
const url = new URL(window.location.href);
|
|
@@ -8646,9 +8884,9 @@ function useOAuthCallback({
|
|
|
8646
8884
|
setFlowId,
|
|
8647
8885
|
tokenValidationAttemptedRef
|
|
8648
8886
|
}) {
|
|
8649
|
-
const internalRef = (0,
|
|
8887
|
+
const internalRef = (0, import_react65.useRef)(false);
|
|
8650
8888
|
const oauthCodeProcessedRef = processedRef ?? internalRef;
|
|
8651
|
-
(0,
|
|
8889
|
+
(0, import_react65.useEffect)(() => {
|
|
8652
8890
|
if (!isInitialized || isSubmitting) {
|
|
8653
8891
|
return;
|
|
8654
8892
|
}
|
|
@@ -8894,7 +9132,7 @@ var handlePasskeyAuthentication = async (challengeData) => {
|
|
|
8894
9132
|
};
|
|
8895
9133
|
|
|
8896
9134
|
// src/components/presentation/auth/SignIn/v2/SignIn.tsx
|
|
8897
|
-
var
|
|
9135
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
8898
9136
|
var SignIn = ({
|
|
8899
9137
|
className,
|
|
8900
9138
|
preferences,
|
|
@@ -8906,12 +9144,14 @@ var SignIn = ({
|
|
|
8906
9144
|
}) => {
|
|
8907
9145
|
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading, meta } = useAsgardeo_default();
|
|
8908
9146
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
8909
|
-
const [components, setComponents] = (0,
|
|
8910
|
-
const [
|
|
8911
|
-
const [
|
|
8912
|
-
const [
|
|
8913
|
-
const [
|
|
8914
|
-
const [
|
|
9147
|
+
const [components, setComponents] = (0, import_react66.useState)([]);
|
|
9148
|
+
const [additionalData, setAdditionalData] = (0, import_react66.useState)({});
|
|
9149
|
+
const [currentFlowId, setCurrentFlowId] = (0, import_react66.useState)(null);
|
|
9150
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react66.useState)(false);
|
|
9151
|
+
const [flowError, setFlowError] = (0, import_react66.useState)(null);
|
|
9152
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react66.useState)(false);
|
|
9153
|
+
const [isTimeoutDisabled, setIsTimeoutDisabled] = (0, import_react66.useState)(false);
|
|
9154
|
+
const [passkeyState, setPasskeyState] = (0, import_react66.useState)({
|
|
8915
9155
|
actionId: null,
|
|
8916
9156
|
challenge: null,
|
|
8917
9157
|
creationOptions: null,
|
|
@@ -8919,9 +9159,9 @@ var SignIn = ({
|
|
|
8919
9159
|
flowId: null,
|
|
8920
9160
|
isActive: false
|
|
8921
9161
|
});
|
|
8922
|
-
const initializationAttemptedRef = (0,
|
|
8923
|
-
const oauthCodeProcessedRef = (0,
|
|
8924
|
-
const passkeyProcessedRef = (0,
|
|
9162
|
+
const initializationAttemptedRef = (0, import_react66.useRef)(false);
|
|
9163
|
+
const oauthCodeProcessedRef = (0, import_react66.useRef)(false);
|
|
9164
|
+
const passkeyProcessedRef = (0, import_react66.useRef)(false);
|
|
8925
9165
|
const setFlowId = (flowId) => {
|
|
8926
9166
|
setCurrentFlowId(flowId);
|
|
8927
9167
|
if (flowId) {
|
|
@@ -8934,6 +9174,7 @@ var SignIn = ({
|
|
|
8934
9174
|
setFlowId(null);
|
|
8935
9175
|
setIsFlowInitialized(false);
|
|
8936
9176
|
sessionStorage.removeItem("asgardeo_auth_id");
|
|
9177
|
+
setIsTimeoutDisabled(false);
|
|
8937
9178
|
oauthCodeProcessedRef.current = false;
|
|
8938
9179
|
};
|
|
8939
9180
|
const getUrlParams2 = () => {
|
|
@@ -9031,7 +9272,11 @@ var SignIn = ({
|
|
|
9031
9272
|
if (handleRedirection(response)) {
|
|
9032
9273
|
return;
|
|
9033
9274
|
}
|
|
9034
|
-
const {
|
|
9275
|
+
const {
|
|
9276
|
+
flowId: normalizedFlowId,
|
|
9277
|
+
components: normalizedComponents,
|
|
9278
|
+
additionalData: normalizedAdditionalData
|
|
9279
|
+
} = normalizeFlowResponse(
|
|
9035
9280
|
response,
|
|
9036
9281
|
t,
|
|
9037
9282
|
{
|
|
@@ -9042,7 +9287,9 @@ var SignIn = ({
|
|
|
9042
9287
|
if (normalizedFlowId && normalizedComponents) {
|
|
9043
9288
|
setFlowId(normalizedFlowId);
|
|
9044
9289
|
setComponents(normalizedComponents);
|
|
9290
|
+
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9045
9291
|
setIsFlowInitialized(true);
|
|
9292
|
+
setIsTimeoutDisabled(false);
|
|
9046
9293
|
cleanupFlowUrlParams();
|
|
9047
9294
|
}
|
|
9048
9295
|
} catch (error) {
|
|
@@ -9053,33 +9300,104 @@ var SignIn = ({
|
|
|
9053
9300
|
initializationAttemptedRef.current = false;
|
|
9054
9301
|
}
|
|
9055
9302
|
};
|
|
9056
|
-
(0,
|
|
9303
|
+
(0, import_react66.useEffect)(() => {
|
|
9057
9304
|
const urlParams = getUrlParams2();
|
|
9058
9305
|
if (urlParams.error) {
|
|
9059
9306
|
handleOAuthError(urlParams.error, urlParams.errorDescription);
|
|
9060
9307
|
return;
|
|
9061
9308
|
}
|
|
9062
9309
|
handleAuthId(urlParams.authId);
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
}
|
|
9310
|
+
}, []);
|
|
9311
|
+
(0, import_react66.useEffect)(() => {
|
|
9066
9312
|
const currentUrlParams = getUrlParams2();
|
|
9067
9313
|
if (isInitialized && !isLoading && !isFlowInitialized && !initializationAttemptedRef.current && !currentFlowId && !currentUrlParams.code && !currentUrlParams.state && !isSubmitting && !oauthCodeProcessedRef.current) {
|
|
9068
9314
|
initializationAttemptedRef.current = true;
|
|
9069
9315
|
initializeFlow();
|
|
9070
9316
|
}
|
|
9071
9317
|
}, [isInitialized, isLoading, isFlowInitialized, currentFlowId]);
|
|
9318
|
+
(0, import_react66.useEffect)(() => {
|
|
9319
|
+
const timeoutMs = Number(additionalData?.["stepTimeout"]) || 0;
|
|
9320
|
+
if (timeoutMs <= 0 || !isFlowInitialized) {
|
|
9321
|
+
setIsTimeoutDisabled(false);
|
|
9322
|
+
return void 0;
|
|
9323
|
+
}
|
|
9324
|
+
const remaining = Math.max(0, Math.floor((timeoutMs - Date.now()) / 1e3));
|
|
9325
|
+
const handleTimeout = () => {
|
|
9326
|
+
const errorMessage = t("errors.signin.timeout") || "Time allowed to complete the step has expired.";
|
|
9327
|
+
setError(new Error(errorMessage));
|
|
9328
|
+
setIsTimeoutDisabled(true);
|
|
9329
|
+
};
|
|
9330
|
+
if (remaining <= 0) {
|
|
9331
|
+
handleTimeout();
|
|
9332
|
+
return void 0;
|
|
9333
|
+
}
|
|
9334
|
+
const timerId = setTimeout(() => {
|
|
9335
|
+
handleTimeout();
|
|
9336
|
+
}, remaining * 1e3);
|
|
9337
|
+
return () => clearTimeout(timerId);
|
|
9338
|
+
}, [additionalData?.["stepTimeout"], isFlowInitialized, t]);
|
|
9072
9339
|
const handleSubmit = async (payload) => {
|
|
9073
9340
|
const effectiveFlowId = payload.flowId || currentFlowId;
|
|
9074
9341
|
if (!effectiveFlowId) {
|
|
9075
9342
|
throw new Error("No active flow ID");
|
|
9076
9343
|
}
|
|
9344
|
+
const processedInputs = { ...payload.inputs };
|
|
9345
|
+
if (additionalData?.["consentPrompt"]) {
|
|
9346
|
+
try {
|
|
9347
|
+
const consentPromptRawData = additionalData["consentPrompt"];
|
|
9348
|
+
const purposes = typeof consentPromptRawData === "string" ? JSON.parse(consentPromptRawData) : consentPromptRawData.purposes || consentPromptRawData;
|
|
9349
|
+
let isDeny = false;
|
|
9350
|
+
if (payload.action) {
|
|
9351
|
+
const findAction = (comps) => {
|
|
9352
|
+
if (!comps || comps.length === 0) return null;
|
|
9353
|
+
const found = comps.find((c) => c.id === payload.action);
|
|
9354
|
+
if (found) return found;
|
|
9355
|
+
return comps.reduce((acc, c) => {
|
|
9356
|
+
if (acc) return acc;
|
|
9357
|
+
if (c.components) return findAction(c.components);
|
|
9358
|
+
return null;
|
|
9359
|
+
}, null);
|
|
9360
|
+
};
|
|
9361
|
+
const submitAction = findAction(components);
|
|
9362
|
+
if (submitAction && submitAction.variant?.toLowerCase() !== "primary") {
|
|
9363
|
+
isDeny = true;
|
|
9364
|
+
}
|
|
9365
|
+
}
|
|
9366
|
+
const decisions = {
|
|
9367
|
+
purposes: purposes.map((p) => ({
|
|
9368
|
+
approved: !isDeny,
|
|
9369
|
+
elements: [
|
|
9370
|
+
...(p.essential || []).map((attr) => ({
|
|
9371
|
+
approved: !isDeny,
|
|
9372
|
+
name: attr
|
|
9373
|
+
})),
|
|
9374
|
+
...(p.optional || []).map((attr) => {
|
|
9375
|
+
const key = `__consent_opt__${p.purpose_id}__${attr}`;
|
|
9376
|
+
return {
|
|
9377
|
+
approved: isDeny ? false : processedInputs[key] !== "false",
|
|
9378
|
+
name: attr
|
|
9379
|
+
};
|
|
9380
|
+
})
|
|
9381
|
+
],
|
|
9382
|
+
purpose_name: p.purpose_name
|
|
9383
|
+
}))
|
|
9384
|
+
};
|
|
9385
|
+
processedInputs["consent_decisions"] = JSON.stringify(decisions);
|
|
9386
|
+
Object.keys(processedInputs).forEach((key) => {
|
|
9387
|
+
if (key.startsWith("__consent_opt__")) {
|
|
9388
|
+
delete processedInputs[key];
|
|
9389
|
+
}
|
|
9390
|
+
});
|
|
9391
|
+
} catch (e) {
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9077
9394
|
try {
|
|
9078
9395
|
setIsSubmitting(true);
|
|
9079
9396
|
setFlowError(null);
|
|
9080
9397
|
const response = await signIn({
|
|
9081
9398
|
flowId: effectiveFlowId,
|
|
9082
|
-
...payload
|
|
9399
|
+
...payload,
|
|
9400
|
+
inputs: processedInputs
|
|
9083
9401
|
});
|
|
9084
9402
|
if (handleRedirection(response)) {
|
|
9085
9403
|
return;
|
|
@@ -9099,7 +9417,11 @@ var SignIn = ({
|
|
|
9099
9417
|
setIsSubmitting(false);
|
|
9100
9418
|
return;
|
|
9101
9419
|
}
|
|
9102
|
-
const {
|
|
9420
|
+
const {
|
|
9421
|
+
flowId: normalizedFlowId,
|
|
9422
|
+
components: normalizedComponents,
|
|
9423
|
+
additionalData: normalizedAdditionalData
|
|
9424
|
+
} = normalizeFlowResponse(
|
|
9103
9425
|
response,
|
|
9104
9426
|
t,
|
|
9105
9427
|
{
|
|
@@ -9139,6 +9461,8 @@ var SignIn = ({
|
|
|
9139
9461
|
if (normalizedFlowId && normalizedComponents) {
|
|
9140
9462
|
setFlowId(normalizedFlowId);
|
|
9141
9463
|
setComponents(normalizedComponents);
|
|
9464
|
+
setAdditionalData(normalizedAdditionalData ?? {});
|
|
9465
|
+
setIsTimeoutDisabled(false);
|
|
9142
9466
|
setIsFlowInitialized(true);
|
|
9143
9467
|
cleanupFlowUrlParams();
|
|
9144
9468
|
if (response?.failureReason) {
|
|
@@ -9170,7 +9494,7 @@ var SignIn = ({
|
|
|
9170
9494
|
processedRef: oauthCodeProcessedRef,
|
|
9171
9495
|
setFlowId
|
|
9172
9496
|
});
|
|
9173
|
-
(0,
|
|
9497
|
+
(0, import_react66.useEffect)(() => {
|
|
9174
9498
|
if (!passkeyState.isActive || !passkeyState.challenge && !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
9175
9499
|
return;
|
|
9176
9500
|
}
|
|
@@ -9223,21 +9547,25 @@ var SignIn = ({
|
|
|
9223
9547
|
}, [passkeyState.isActive, passkeyState.challenge, passkeyState.creationOptions, passkeyState.flowId]);
|
|
9224
9548
|
if (children) {
|
|
9225
9549
|
const renderProps = {
|
|
9550
|
+
additionalData,
|
|
9226
9551
|
components,
|
|
9227
9552
|
error: flowError,
|
|
9228
9553
|
initialize: initializeFlow,
|
|
9229
9554
|
isInitialized: isFlowInitialized,
|
|
9230
9555
|
isLoading: isLoading || isSubmitting || !isInitialized,
|
|
9556
|
+
isTimeoutDisabled,
|
|
9231
9557
|
meta,
|
|
9232
9558
|
onSubmit: handleSubmit
|
|
9233
9559
|
};
|
|
9234
|
-
return /* @__PURE__ */ (0,
|
|
9560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: children(renderProps) });
|
|
9235
9561
|
}
|
|
9236
|
-
return /* @__PURE__ */ (0,
|
|
9562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
9237
9563
|
BaseSignIn_default2,
|
|
9238
9564
|
{
|
|
9565
|
+
additionalData,
|
|
9239
9566
|
components,
|
|
9240
9567
|
isLoading: isLoading || !isInitialized || !isFlowInitialized,
|
|
9568
|
+
isTimeoutDisabled,
|
|
9241
9569
|
onSubmit: handleSubmit,
|
|
9242
9570
|
onError: handleError,
|
|
9243
9571
|
error: flowError,
|
|
@@ -9251,7 +9579,7 @@ var SignIn = ({
|
|
|
9251
9579
|
var SignIn_default = SignIn;
|
|
9252
9580
|
|
|
9253
9581
|
// src/components/presentation/auth/SignIn/SignIn.tsx
|
|
9254
|
-
var
|
|
9582
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
9255
9583
|
var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) => {
|
|
9256
9584
|
const { signIn, afterSignInUrl, isInitialized, isLoading, platform } = useAsgardeo_default();
|
|
9257
9585
|
const handleInitialize = async () => await signIn({ response_mode: "direct" });
|
|
@@ -9268,7 +9596,7 @@ var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) =
|
|
|
9268
9596
|
}
|
|
9269
9597
|
};
|
|
9270
9598
|
if (platform === import_browser56.Platform.AsgardeoV2) {
|
|
9271
|
-
return /* @__PURE__ */ (0,
|
|
9599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9272
9600
|
SignIn_default,
|
|
9273
9601
|
{
|
|
9274
9602
|
className,
|
|
@@ -9281,7 +9609,7 @@ var SignIn2 = ({ className, size = "medium", children, preferences, ...rest }) =
|
|
|
9281
9609
|
}
|
|
9282
9610
|
);
|
|
9283
9611
|
}
|
|
9284
|
-
return /* @__PURE__ */ (0,
|
|
9612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9285
9613
|
BaseSignIn_default3,
|
|
9286
9614
|
{
|
|
9287
9615
|
isLoading: isLoading || !isInitialized,
|
|
@@ -9307,7 +9635,7 @@ var import_browser67 = require("@asgardeo/browser");
|
|
|
9307
9635
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
9308
9636
|
var import_browser65 = require("@asgardeo/browser");
|
|
9309
9637
|
var import_css39 = require("@emotion/css");
|
|
9310
|
-
var
|
|
9638
|
+
var import_react68 = require("react");
|
|
9311
9639
|
|
|
9312
9640
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
9313
9641
|
var import_browser64 = require("@asgardeo/browser");
|
|
@@ -9369,13 +9697,13 @@ var DateInput = ({
|
|
|
9369
9697
|
var DateInput_default = DateInput;
|
|
9370
9698
|
|
|
9371
9699
|
// src/components/adapters/DividerComponent.tsx
|
|
9372
|
-
var
|
|
9700
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
9373
9701
|
var DividerComponent = ({ component }) => {
|
|
9374
9702
|
const { theme } = useTheme_default();
|
|
9375
9703
|
const config = component.config || {};
|
|
9376
9704
|
const text = config["text"] || "";
|
|
9377
9705
|
const variant = component.variant?.toLowerCase() || "horizontal";
|
|
9378
|
-
return /* @__PURE__ */ (0,
|
|
9706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
9379
9707
|
Divider_default,
|
|
9380
9708
|
{
|
|
9381
9709
|
orientation: variant === "vertical" ? "vertical" : "horizontal",
|
|
@@ -9416,7 +9744,7 @@ var EmailInput = ({
|
|
|
9416
9744
|
var EmailInput_default = EmailInput;
|
|
9417
9745
|
|
|
9418
9746
|
// src/components/adapters/FormContainer.tsx
|
|
9419
|
-
var
|
|
9747
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
9420
9748
|
var FormContainer = (props) => {
|
|
9421
9749
|
const { component } = props;
|
|
9422
9750
|
if (component.components && component.components.length > 0) {
|
|
@@ -9429,14 +9757,14 @@ var FormContainer = (props) => {
|
|
|
9429
9757
|
props.onSubmit(submitButton, props.formValues);
|
|
9430
9758
|
}
|
|
9431
9759
|
};
|
|
9432
|
-
return /* @__PURE__ */ (0,
|
|
9760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("form", { onSubmit: handleFormSubmit, style: { display: "flex", flexDirection: "column" }, children: component.components.map(
|
|
9433
9761
|
(childComponent) => createSignUpComponent({
|
|
9434
9762
|
...props,
|
|
9435
9763
|
component: childComponent
|
|
9436
9764
|
})
|
|
9437
9765
|
) }, component.id);
|
|
9438
9766
|
}
|
|
9439
|
-
return /* @__PURE__ */ (0,
|
|
9767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", {}, component.id);
|
|
9440
9768
|
};
|
|
9441
9769
|
var FormContainer_default = FormContainer;
|
|
9442
9770
|
|
|
@@ -9562,7 +9890,7 @@ var SelectInput = ({
|
|
|
9562
9890
|
var SelectInput_default = SelectInput;
|
|
9563
9891
|
|
|
9564
9892
|
// src/components/adapters/SubmitButton.tsx
|
|
9565
|
-
var
|
|
9893
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
9566
9894
|
var ButtonComponent = ({
|
|
9567
9895
|
component,
|
|
9568
9896
|
isLoading,
|
|
@@ -9584,6 +9912,7 @@ var ButtonComponent = ({
|
|
|
9584
9912
|
case "TEXT":
|
|
9585
9913
|
return { color: "primary", variant: "text" };
|
|
9586
9914
|
case "SOCIAL":
|
|
9915
|
+
case "OUTLINED":
|
|
9587
9916
|
return { color: "primary", variant: "outline" };
|
|
9588
9917
|
default:
|
|
9589
9918
|
return { color: "primary", variant: "solid" };
|
|
@@ -9595,7 +9924,7 @@ var ButtonComponent = ({
|
|
|
9595
9924
|
onSubmit(component);
|
|
9596
9925
|
}
|
|
9597
9926
|
};
|
|
9598
|
-
return /* @__PURE__ */ (0,
|
|
9927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
9599
9928
|
Button_default,
|
|
9600
9929
|
{
|
|
9601
9930
|
type: buttonType === "submit" ? "submit" : "button",
|
|
@@ -9606,7 +9935,7 @@ var ButtonComponent = ({
|
|
|
9606
9935
|
onClick: buttonType !== "submit" ? handleClick : void 0,
|
|
9607
9936
|
className: buttonClassName,
|
|
9608
9937
|
style: { width: "100%" },
|
|
9609
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
9938
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Spinner_default, { size: "small" }) : buttonText
|
|
9610
9939
|
},
|
|
9611
9940
|
component.id
|
|
9612
9941
|
);
|
|
@@ -9614,7 +9943,7 @@ var ButtonComponent = ({
|
|
|
9614
9943
|
var SubmitButton_default = ButtonComponent;
|
|
9615
9944
|
|
|
9616
9945
|
// src/components/adapters/TelephoneInput.tsx
|
|
9617
|
-
var
|
|
9946
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
9618
9947
|
var TelephoneInput = ({
|
|
9619
9948
|
component,
|
|
9620
9949
|
formValues,
|
|
@@ -9627,7 +9956,7 @@ var TelephoneInput = ({
|
|
|
9627
9956
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
9628
9957
|
const value = formValues[fieldName] || "";
|
|
9629
9958
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
9630
|
-
return /* @__PURE__ */ (0,
|
|
9959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
9631
9960
|
TextField_default,
|
|
9632
9961
|
{
|
|
9633
9962
|
name: fieldName,
|
|
@@ -9675,7 +10004,7 @@ var TextInput = ({
|
|
|
9675
10004
|
var TextInput_default = TextInput;
|
|
9676
10005
|
|
|
9677
10006
|
// src/components/adapters/Typography.tsx
|
|
9678
|
-
var
|
|
10007
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
9679
10008
|
var TypographyComponent = ({ component }) => {
|
|
9680
10009
|
const { theme } = useTheme_default();
|
|
9681
10010
|
const config = component.config || {};
|
|
@@ -9716,7 +10045,7 @@ var TypographyComponent = ({ component }) => {
|
|
|
9716
10045
|
default:
|
|
9717
10046
|
typographyVariant = "body1";
|
|
9718
10047
|
}
|
|
9719
|
-
return /* @__PURE__ */ (0,
|
|
10048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
9720
10049
|
Typography_default,
|
|
9721
10050
|
{
|
|
9722
10051
|
variant: typographyVariant,
|
|
@@ -9729,69 +10058,69 @@ var TypographyComponent = ({ component }) => {
|
|
|
9729
10058
|
var Typography_default2 = TypographyComponent;
|
|
9730
10059
|
|
|
9731
10060
|
// src/components/presentation/auth/SignUp/v1/SignUpOptionFactory.tsx
|
|
9732
|
-
var
|
|
10061
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
9733
10062
|
var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
9734
10063
|
switch (component.type) {
|
|
9735
10064
|
case import_browser64.EmbeddedFlowComponentType.Typography:
|
|
9736
|
-
return /* @__PURE__ */ (0,
|
|
10065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography_default2, { component, onSubmit, ...rest });
|
|
9737
10066
|
case import_browser64.EmbeddedFlowComponentType.Input: {
|
|
9738
10067
|
const inputVariant = component.variant?.toUpperCase();
|
|
9739
10068
|
const inputType = component.config["type"]?.toLowerCase();
|
|
9740
10069
|
if (inputVariant === "EMAIL" || inputType === "email") {
|
|
9741
|
-
return /* @__PURE__ */ (0,
|
|
10070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EmailInput_default, { component, onSubmit, ...rest });
|
|
9742
10071
|
}
|
|
9743
10072
|
if (inputVariant === "PASSWORD" || inputType === "password") {
|
|
9744
|
-
return /* @__PURE__ */ (0,
|
|
10073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(PasswordInput_default, { component, onSubmit, ...rest });
|
|
9745
10074
|
}
|
|
9746
10075
|
if (inputVariant === "TELEPHONE" || inputType === "tel") {
|
|
9747
|
-
return /* @__PURE__ */ (0,
|
|
10076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TelephoneInput_default, { component, onSubmit, ...rest });
|
|
9748
10077
|
}
|
|
9749
10078
|
if (inputVariant === "NUMBER" || inputType === "number") {
|
|
9750
|
-
return /* @__PURE__ */ (0,
|
|
10079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(NumberInput_default, { component, onSubmit, ...rest });
|
|
9751
10080
|
}
|
|
9752
10081
|
if (inputVariant === "DATE" || inputType === "date") {
|
|
9753
|
-
return /* @__PURE__ */ (0,
|
|
10082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DateInput_default, { component, onSubmit, ...rest });
|
|
9754
10083
|
}
|
|
9755
10084
|
if (inputVariant === "CHECKBOX" || inputType === "checkbox") {
|
|
9756
|
-
return /* @__PURE__ */ (0,
|
|
10085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CheckboxInput_default, { component, onSubmit, ...rest });
|
|
9757
10086
|
}
|
|
9758
|
-
return /* @__PURE__ */ (0,
|
|
10087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TextInput_default, { component, onSubmit, ...rest });
|
|
9759
10088
|
}
|
|
9760
10089
|
case import_browser64.EmbeddedFlowComponentType.Button: {
|
|
9761
10090
|
const buttonVariant = component.variant?.toUpperCase();
|
|
9762
10091
|
const buttonText = component.config["text"] || component.config["label"] || "";
|
|
9763
10092
|
if (buttonVariant === "SOCIAL") {
|
|
9764
10093
|
if (buttonText.toLowerCase().includes("google")) {
|
|
9765
|
-
return /* @__PURE__ */ (0,
|
|
10094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(GoogleButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9766
10095
|
}
|
|
9767
10096
|
if (buttonText.toLowerCase().includes("github")) {
|
|
9768
|
-
return /* @__PURE__ */ (0,
|
|
10097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(GitHubButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9769
10098
|
}
|
|
9770
10099
|
if (buttonText.toLowerCase().includes("microsoft")) {
|
|
9771
|
-
return /* @__PURE__ */ (0,
|
|
10100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(MicrosoftButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9772
10101
|
}
|
|
9773
10102
|
if (buttonText.toLowerCase().includes("facebook")) {
|
|
9774
|
-
return /* @__PURE__ */ (0,
|
|
10103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FacebookButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9775
10104
|
}
|
|
9776
10105
|
if (buttonText.toLowerCase().includes("linkedin")) {
|
|
9777
|
-
return /* @__PURE__ */ (0,
|
|
10106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LinkedInButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9778
10107
|
}
|
|
9779
10108
|
if (buttonText.toLowerCase().includes("ethereum")) {
|
|
9780
|
-
return /* @__PURE__ */ (0,
|
|
10109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SignInWithEthereumButton_default, { onClick: () => onSubmit(component, {}), ...rest, children: buttonText });
|
|
9781
10110
|
}
|
|
9782
10111
|
}
|
|
9783
|
-
return /* @__PURE__ */ (0,
|
|
10112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SubmitButton_default, { component, onSubmit, ...rest });
|
|
9784
10113
|
}
|
|
9785
10114
|
case import_browser64.EmbeddedFlowComponentType.Form:
|
|
9786
|
-
return /* @__PURE__ */ (0,
|
|
10115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FormContainer_default, { component, onSubmit, ...rest });
|
|
9787
10116
|
case import_browser64.EmbeddedFlowComponentType.Select:
|
|
9788
|
-
return /* @__PURE__ */ (0,
|
|
10117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectInput_default, { component, onSubmit, ...rest });
|
|
9789
10118
|
case import_browser64.EmbeddedFlowComponentType.Divider:
|
|
9790
|
-
return /* @__PURE__ */ (0,
|
|
10119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DividerComponent_default, { component, onSubmit, ...rest });
|
|
9791
10120
|
case import_browser64.EmbeddedFlowComponentType.Image:
|
|
9792
|
-
return /* @__PURE__ */ (0,
|
|
10121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ImageComponent_default, { component, onSubmit, ...rest });
|
|
9793
10122
|
default:
|
|
9794
|
-
return /* @__PURE__ */ (0,
|
|
10123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", {});
|
|
9795
10124
|
}
|
|
9796
10125
|
};
|
|
9797
10126
|
var createSignUpOptionFromComponent = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => createSignUpComponent({
|
|
@@ -9823,8 +10152,8 @@ var renderSignUpComponents2 = (components, formValues, touchedFields, formErrors
|
|
|
9823
10152
|
|
|
9824
10153
|
// src/components/presentation/auth/SignUp/BaseSignUp.styles.ts
|
|
9825
10154
|
var import_css38 = require("@emotion/css");
|
|
9826
|
-
var
|
|
9827
|
-
var useStyles17 = (theme, colorScheme) => (0,
|
|
10155
|
+
var import_react67 = require("react");
|
|
10156
|
+
var useStyles17 = (theme, colorScheme) => (0, import_react67.useMemo)(() => {
|
|
9828
10157
|
const signUp = import_css38.css`
|
|
9829
10158
|
min-width: 420px;
|
|
9830
10159
|
margin: 0 auto;
|
|
@@ -9960,7 +10289,7 @@ var useStyles17 = (theme, colorScheme) => (0, import_react66.useMemo)(() => {
|
|
|
9960
10289
|
var BaseSignUp_styles_default = useStyles17;
|
|
9961
10290
|
|
|
9962
10291
|
// src/components/presentation/auth/SignUp/v1/BaseSignUp.tsx
|
|
9963
|
-
var
|
|
10292
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
9964
10293
|
var logger6 = (0, import_browser65.createPackageComponentLogger)(
|
|
9965
10294
|
"@asgardeo/react",
|
|
9966
10295
|
"BaseSignUp"
|
|
@@ -9989,7 +10318,7 @@ var BaseSignUpContent = ({
|
|
|
9989
10318
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
9990
10319
|
useAsgardeo_default();
|
|
9991
10320
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
9992
|
-
const handleError = (0,
|
|
10321
|
+
const handleError = (0, import_react68.useCallback)(
|
|
9993
10322
|
(error) => {
|
|
9994
10323
|
let errorMessage = t("errors.signup.flow.failure");
|
|
9995
10324
|
if (error && typeof error === "object") {
|
|
@@ -10022,11 +10351,11 @@ var BaseSignUpContent = ({
|
|
|
10022
10351
|
},
|
|
10023
10352
|
[t, addMessage, clearMessages]
|
|
10024
10353
|
);
|
|
10025
|
-
const [isLoading, setIsLoading] = (0,
|
|
10026
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
10027
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10028
|
-
const initializationAttemptedRef = (0,
|
|
10029
|
-
const extractFormFields = (0,
|
|
10354
|
+
const [isLoading, setIsLoading] = (0, import_react68.useState)(false);
|
|
10355
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react68.useState)(false);
|
|
10356
|
+
const [currentFlow, setCurrentFlow] = (0, import_react68.useState)(null);
|
|
10357
|
+
const initializationAttemptedRef = (0, import_react68.useRef)(false);
|
|
10358
|
+
const extractFormFields = (0, import_react68.useCallback)(
|
|
10030
10359
|
(components) => {
|
|
10031
10360
|
const fields = [];
|
|
10032
10361
|
const processComponents = (comps) => {
|
|
@@ -10079,7 +10408,7 @@ var BaseSignUpContent = ({
|
|
|
10079
10408
|
validateForm,
|
|
10080
10409
|
reset: resetForm
|
|
10081
10410
|
} = form;
|
|
10082
|
-
const setupFormFields = (0,
|
|
10411
|
+
const setupFormFields = (0, import_react68.useCallback)(
|
|
10083
10412
|
(flowResponse) => {
|
|
10084
10413
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
10085
10414
|
const initialValues = {};
|
|
@@ -10281,7 +10610,7 @@ var BaseSignUpContent = ({
|
|
|
10281
10610
|
);
|
|
10282
10611
|
const errorClasses = (0, import_css39.cx)([(0, import_browser65.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
10283
10612
|
const messageClasses = (0, import_css39.cx)([(0, import_browser65.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
10284
|
-
const renderComponents = (0,
|
|
10613
|
+
const renderComponents = (0, import_react68.useCallback)(
|
|
10285
10614
|
(components) => renderSignUpComponents2(
|
|
10286
10615
|
components,
|
|
10287
10616
|
formValues,
|
|
@@ -10311,7 +10640,7 @@ var BaseSignUpContent = ({
|
|
|
10311
10640
|
handleSubmit
|
|
10312
10641
|
]
|
|
10313
10642
|
);
|
|
10314
|
-
(0,
|
|
10643
|
+
(0, import_react68.useEffect)(() => {
|
|
10315
10644
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
10316
10645
|
initializationAttemptedRef.current = true;
|
|
10317
10646
|
(async () => {
|
|
@@ -10363,42 +10692,42 @@ var BaseSignUpContent = ({
|
|
|
10363
10692
|
validateForm,
|
|
10364
10693
|
values: formValues
|
|
10365
10694
|
};
|
|
10366
|
-
return /* @__PURE__ */ (0,
|
|
10695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
10367
10696
|
}
|
|
10368
10697
|
if (!isFlowInitialized && isLoading) {
|
|
10369
|
-
return /* @__PURE__ */ (0,
|
|
10698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
10370
10699
|
}
|
|
10371
10700
|
if (!currentFlow) {
|
|
10372
|
-
return /* @__PURE__ */ (0,
|
|
10373
|
-
/* @__PURE__ */ (0,
|
|
10374
|
-
/* @__PURE__ */ (0,
|
|
10701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
10702
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Title, { children: t("errors.heading") }),
|
|
10703
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
10375
10704
|
] }) }) });
|
|
10376
10705
|
}
|
|
10377
|
-
return /* @__PURE__ */ (0,
|
|
10378
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
10379
|
-
showTitle && /* @__PURE__ */ (0,
|
|
10380
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
10706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default, { className: (0, import_css39.cx)(containerClasses, styles.card), variant, children: [
|
|
10707
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
10708
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card_default.Title, { level: 2, className: styles.title, children: flowTitle || t("signup.heading") }),
|
|
10709
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: flowSubtitle || t("signup.subheading") })
|
|
10381
10710
|
] }),
|
|
10382
|
-
/* @__PURE__ */ (0,
|
|
10383
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
10711
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card_default.Content, { children: [
|
|
10712
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
10384
10713
|
Alert_default,
|
|
10385
10714
|
{
|
|
10386
10715
|
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
10387
10716
|
className: (0, import_css39.cx)(styles.flowMessageItem, messageClasses),
|
|
10388
|
-
children: /* @__PURE__ */ (0,
|
|
10717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default.Description, { children: message.message })
|
|
10389
10718
|
},
|
|
10390
10719
|
message.id || index
|
|
10391
10720
|
)) }),
|
|
10392
|
-
/* @__PURE__ */ (0,
|
|
10721
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.contentContainer, children: currentFlow.data?.components && currentFlow.data.components.length > 0 ? renderComponents(currentFlow.data.components) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
10393
10722
|
] })
|
|
10394
10723
|
] });
|
|
10395
10724
|
};
|
|
10396
10725
|
var BaseSignUp = ({ showLogo = true, ...rest }) => {
|
|
10397
10726
|
const { theme, colorScheme } = useTheme_default();
|
|
10398
10727
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10399
|
-
return /* @__PURE__ */ (0,
|
|
10400
|
-
showLogo && /* @__PURE__ */ (0,
|
|
10401
|
-
/* @__PURE__ */ (0,
|
|
10728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { children: [
|
|
10729
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Logo_default, { size: "large" }) }),
|
|
10730
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(BaseSignUpContent, { showLogo, ...rest }) })
|
|
10402
10731
|
] });
|
|
10403
10732
|
};
|
|
10404
10733
|
var BaseSignUp_default = BaseSignUp;
|
|
@@ -10406,8 +10735,8 @@ var BaseSignUp_default = BaseSignUp;
|
|
|
10406
10735
|
// src/components/presentation/auth/SignUp/v2/BaseSignUp.tsx
|
|
10407
10736
|
var import_browser66 = require("@asgardeo/browser");
|
|
10408
10737
|
var import_css40 = require("@emotion/css");
|
|
10409
|
-
var
|
|
10410
|
-
var
|
|
10738
|
+
var import_react69 = require("react");
|
|
10739
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
10411
10740
|
var logger7 = (0, import_browser66.createPackageComponentLogger)(
|
|
10412
10741
|
"@asgardeo/react",
|
|
10413
10742
|
"BaseSignUp"
|
|
@@ -10437,20 +10766,20 @@ var BaseSignUpContent2 = ({
|
|
|
10437
10766
|
const { subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages } = useFlow_default();
|
|
10438
10767
|
const { meta } = useAsgardeo_default();
|
|
10439
10768
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10440
|
-
const [isLoading, setIsLoading] = (0,
|
|
10441
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
10442
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
10443
|
-
const [apiError, setApiError] = (0,
|
|
10444
|
-
const [passkeyState, setPasskeyState] = (0,
|
|
10769
|
+
const [isLoading, setIsLoading] = (0, import_react69.useState)(false);
|
|
10770
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react69.useState)(false);
|
|
10771
|
+
const [currentFlow, setCurrentFlow] = (0, import_react69.useState)(null);
|
|
10772
|
+
const [apiError, setApiError] = (0, import_react69.useState)(null);
|
|
10773
|
+
const [passkeyState, setPasskeyState] = (0, import_react69.useState)({
|
|
10445
10774
|
actionId: null,
|
|
10446
10775
|
creationOptions: null,
|
|
10447
10776
|
error: null,
|
|
10448
10777
|
flowId: null,
|
|
10449
10778
|
isActive: false
|
|
10450
10779
|
});
|
|
10451
|
-
const initializationAttemptedRef = (0,
|
|
10452
|
-
const passkeyProcessedRef = (0,
|
|
10453
|
-
const handleError = (0,
|
|
10780
|
+
const initializationAttemptedRef = (0, import_react69.useRef)(false);
|
|
10781
|
+
const passkeyProcessedRef = (0, import_react69.useRef)(false);
|
|
10782
|
+
const handleError = (0, import_react69.useCallback)(
|
|
10454
10783
|
(error) => {
|
|
10455
10784
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t);
|
|
10456
10785
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -10462,7 +10791,7 @@ var BaseSignUpContent2 = ({
|
|
|
10462
10791
|
},
|
|
10463
10792
|
[t, addMessage, clearMessages]
|
|
10464
10793
|
);
|
|
10465
|
-
const normalizeFlowResponseLocal = (0,
|
|
10794
|
+
const normalizeFlowResponseLocal = (0, import_react69.useCallback)(
|
|
10466
10795
|
(response) => {
|
|
10467
10796
|
if (response?.data?.components && Array.isArray(response.data.components)) {
|
|
10468
10797
|
return response;
|
|
@@ -10489,7 +10818,7 @@ var BaseSignUpContent2 = ({
|
|
|
10489
10818
|
},
|
|
10490
10819
|
[t, children]
|
|
10491
10820
|
);
|
|
10492
|
-
const extractFormFields = (0,
|
|
10821
|
+
const extractFormFields = (0, import_react69.useCallback)(
|
|
10493
10822
|
(components) => {
|
|
10494
10823
|
const fields = [];
|
|
10495
10824
|
const processComponents = (comps) => {
|
|
@@ -10540,7 +10869,7 @@ var BaseSignUpContent2 = ({
|
|
|
10540
10869
|
touchAllFields,
|
|
10541
10870
|
reset: resetForm
|
|
10542
10871
|
} = form;
|
|
10543
|
-
const setupFormFields = (0,
|
|
10872
|
+
const setupFormFields = (0, import_react69.useCallback)(
|
|
10544
10873
|
(flowResponse) => {
|
|
10545
10874
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
10546
10875
|
const initialValues = {};
|
|
@@ -10742,7 +11071,7 @@ var BaseSignUpContent2 = ({
|
|
|
10742
11071
|
setIsLoading(false);
|
|
10743
11072
|
}
|
|
10744
11073
|
};
|
|
10745
|
-
(0,
|
|
11074
|
+
(0, import_react69.useEffect)(() => {
|
|
10746
11075
|
if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.flowId) {
|
|
10747
11076
|
return;
|
|
10748
11077
|
}
|
|
@@ -10808,7 +11137,7 @@ var BaseSignUpContent2 = ({
|
|
|
10808
11137
|
);
|
|
10809
11138
|
const errorClasses = (0, import_css40.cx)([(0, import_browser66.withVendorCSSClassPrefix)("signup__error")], errorClassName);
|
|
10810
11139
|
const messageClasses = (0, import_css40.cx)([(0, import_browser66.withVendorCSSClassPrefix)("signup__messages")], messageClassName);
|
|
10811
|
-
const renderComponents = (0,
|
|
11140
|
+
const renderComponents = (0, import_react69.useCallback)(
|
|
10812
11141
|
(components) => renderSignUpComponents(
|
|
10813
11142
|
components,
|
|
10814
11143
|
formValues,
|
|
@@ -10848,7 +11177,7 @@ var BaseSignUpContent2 = ({
|
|
|
10848
11177
|
state: urlParams.get("state")
|
|
10849
11178
|
};
|
|
10850
11179
|
};
|
|
10851
|
-
(0,
|
|
11180
|
+
(0, import_react69.useEffect)(() => {
|
|
10852
11181
|
const urlParams = getUrlParams2();
|
|
10853
11182
|
if (urlParams.code || urlParams.state) {
|
|
10854
11183
|
return;
|
|
@@ -10911,15 +11240,15 @@ var BaseSignUpContent2 = ({
|
|
|
10911
11240
|
},
|
|
10912
11241
|
values: formValues
|
|
10913
11242
|
};
|
|
10914
|
-
return /* @__PURE__ */ (0,
|
|
11243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: containerClasses, children: children(renderProps) });
|
|
10915
11244
|
}
|
|
10916
11245
|
if (!isFlowInitialized && isLoading) {
|
|
10917
|
-
return /* @__PURE__ */ (0,
|
|
11246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
10918
11247
|
}
|
|
10919
11248
|
if (!currentFlow) {
|
|
10920
|
-
return /* @__PURE__ */ (0,
|
|
10921
|
-
/* @__PURE__ */ (0,
|
|
10922
|
-
/* @__PURE__ */ (0,
|
|
11249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Alert_default, { variant: "error", className: errorClasses, children: [
|
|
11250
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Title, { children: t("errors.heading") }),
|
|
11251
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: t("errors.signup.flow.initialization.failure") })
|
|
10923
11252
|
] }) }) });
|
|
10924
11253
|
}
|
|
10925
11254
|
const componentsToRender = currentFlow.data?.components || [];
|
|
@@ -10930,46 +11259,46 @@ var BaseSignUpContent2 = ({
|
|
|
10930
11259
|
t("signup.heading"),
|
|
10931
11260
|
t("signup.subheading")
|
|
10932
11261
|
);
|
|
10933
|
-
return /* @__PURE__ */ (0,
|
|
10934
|
-
(showTitle || showSubtitle) && /* @__PURE__ */ (0,
|
|
10935
|
-
showTitle && /* @__PURE__ */ (0,
|
|
10936
|
-
showSubtitle && /* @__PURE__ */ (0,
|
|
11262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default, { className: (0, import_css40.cx)(containerClasses, styles.card), variant, children: [
|
|
11263
|
+
(showTitle || showSubtitle) && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
11264
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
11265
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
10937
11266
|
] }),
|
|
10938
|
-
/* @__PURE__ */ (0,
|
|
10939
|
-
externalError && /* @__PURE__ */ (0,
|
|
10940
|
-
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0,
|
|
11267
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(Card_default.Content, { children: [
|
|
11268
|
+
externalError && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.flowMessagesContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default, { variant: "error", className: (0, import_css40.cx)(styles.flowMessageItem, messageClasses), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: externalError.message }) }) }),
|
|
11269
|
+
flowMessages && flowMessages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.flowMessagesContainer, children: flowMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
10941
11270
|
Alert_default,
|
|
10942
11271
|
{
|
|
10943
11272
|
variant: message.type?.toLowerCase() === "error" ? "error" : "info",
|
|
10944
11273
|
className: (0, import_css40.cx)(styles.flowMessageItem, messageClasses),
|
|
10945
|
-
children: /* @__PURE__ */ (0,
|
|
11274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default.Description, { children: message.message })
|
|
10946
11275
|
},
|
|
10947
11276
|
message.id || index
|
|
10948
11277
|
)) }),
|
|
10949
|
-
/* @__PURE__ */ (0,
|
|
11278
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.contentContainer, children: componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography_default, { variant: "body1", children: t("errors.signup.components.not.available") }) }) })
|
|
10950
11279
|
] })
|
|
10951
11280
|
] });
|
|
10952
11281
|
};
|
|
10953
11282
|
var BaseSignUp2 = ({ preferences, showLogo = true, ...rest }) => {
|
|
10954
11283
|
const { theme, colorScheme } = useTheme_default();
|
|
10955
11284
|
const styles = BaseSignUp_styles_default(theme, colorScheme);
|
|
10956
|
-
const content = /* @__PURE__ */ (0,
|
|
10957
|
-
showLogo && /* @__PURE__ */ (0,
|
|
10958
|
-
/* @__PURE__ */ (0,
|
|
11285
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { children: [
|
|
11286
|
+
showLogo && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: styles.logoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Logo_default, { size: "large" }) }),
|
|
11287
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(BaseSignUpContent2, { showLogo, ...rest }) })
|
|
10959
11288
|
] });
|
|
10960
11289
|
if (!preferences) return content;
|
|
10961
|
-
return /* @__PURE__ */ (0,
|
|
11290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ComponentPreferencesContext_default.Provider, { value: preferences, children: content });
|
|
10962
11291
|
};
|
|
10963
11292
|
var BaseSignUp_default2 = BaseSignUp2;
|
|
10964
11293
|
|
|
10965
11294
|
// src/components/presentation/auth/SignUp/BaseSignUp.tsx
|
|
10966
|
-
var
|
|
11295
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
10967
11296
|
var BaseSignUp3 = (props) => {
|
|
10968
11297
|
const { platform } = useAsgardeo_default();
|
|
10969
11298
|
if (platform === import_browser67.Platform.AsgardeoV2) {
|
|
10970
|
-
return /* @__PURE__ */ (0,
|
|
11299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BaseSignUp_default2, { ...props });
|
|
10971
11300
|
}
|
|
10972
|
-
return /* @__PURE__ */ (0,
|
|
11301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(BaseSignUp_default, { ...props });
|
|
10973
11302
|
};
|
|
10974
11303
|
var BaseSignUp_default3 = BaseSignUp3;
|
|
10975
11304
|
|
|
@@ -10978,7 +11307,7 @@ var import_browser70 = require("@asgardeo/browser");
|
|
|
10978
11307
|
|
|
10979
11308
|
// src/components/presentation/auth/SignUp/v1/SignUp.tsx
|
|
10980
11309
|
var import_browser68 = require("@asgardeo/browser");
|
|
10981
|
-
var
|
|
11310
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
10982
11311
|
var SignUp = ({
|
|
10983
11312
|
className,
|
|
10984
11313
|
size = "medium",
|
|
@@ -11007,7 +11336,7 @@ var SignUp = ({
|
|
|
11007
11336
|
window.location.href = response.data.redirectURL;
|
|
11008
11337
|
}
|
|
11009
11338
|
};
|
|
11010
|
-
return /* @__PURE__ */ (0,
|
|
11339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11011
11340
|
BaseSignUp_default,
|
|
11012
11341
|
{
|
|
11013
11342
|
afterSignUpUrl,
|
|
@@ -11030,7 +11359,7 @@ var SignUp_default = SignUp;
|
|
|
11030
11359
|
|
|
11031
11360
|
// src/components/presentation/auth/SignUp/v2/SignUp.tsx
|
|
11032
11361
|
var import_browser69 = require("@asgardeo/browser");
|
|
11033
|
-
var
|
|
11362
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11034
11363
|
var SignUp2 = ({
|
|
11035
11364
|
className,
|
|
11036
11365
|
size = "medium",
|
|
@@ -11068,7 +11397,7 @@ var SignUp2 = ({
|
|
|
11068
11397
|
window.location.href = response.data.redirectURL;
|
|
11069
11398
|
}
|
|
11070
11399
|
};
|
|
11071
|
-
return /* @__PURE__ */ (0,
|
|
11400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11072
11401
|
BaseSignUp_default2,
|
|
11073
11402
|
{
|
|
11074
11403
|
afterSignUpUrl,
|
|
@@ -11090,13 +11419,13 @@ var SignUp2 = ({
|
|
|
11090
11419
|
var SignUp_default2 = SignUp2;
|
|
11091
11420
|
|
|
11092
11421
|
// src/components/presentation/auth/SignUp/SignUp.tsx
|
|
11093
|
-
var
|
|
11422
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
11094
11423
|
var SignUp3 = (props) => {
|
|
11095
11424
|
const { platform } = useAsgardeo_default();
|
|
11096
11425
|
if (platform === import_browser70.Platform.AsgardeoV2) {
|
|
11097
|
-
return /* @__PURE__ */ (0,
|
|
11426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SignUp_default2, { ...props });
|
|
11098
11427
|
}
|
|
11099
|
-
return /* @__PURE__ */ (0,
|
|
11428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SignUp_default, { ...props });
|
|
11100
11429
|
};
|
|
11101
11430
|
var SignUp_default3 = SignUp3;
|
|
11102
11431
|
|
|
@@ -11106,12 +11435,12 @@ var import_browser72 = require("@asgardeo/browser");
|
|
|
11106
11435
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
11107
11436
|
var import_browser71 = require("@asgardeo/browser");
|
|
11108
11437
|
var import_css42 = require("@emotion/css");
|
|
11109
|
-
var
|
|
11438
|
+
var import_react71 = require("react");
|
|
11110
11439
|
|
|
11111
11440
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.styles.ts
|
|
11112
11441
|
var import_css41 = require("@emotion/css");
|
|
11113
|
-
var
|
|
11114
|
-
var useStyles18 = (theme, colorScheme) => (0,
|
|
11442
|
+
var import_react70 = require("react");
|
|
11443
|
+
var useStyles18 = (theme, colorScheme) => (0, import_react70.useMemo)(() => {
|
|
11115
11444
|
const card = import_css41.css`
|
|
11116
11445
|
background: ${theme.vars.colors.background.surface};
|
|
11117
11446
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -11149,7 +11478,7 @@ var useStyles18 = (theme, colorScheme) => (0, import_react69.useMemo)(() => {
|
|
|
11149
11478
|
var BaseInviteUser_styles_default = useStyles18;
|
|
11150
11479
|
|
|
11151
11480
|
// src/components/presentation/auth/InviteUser/v2/BaseInviteUser.tsx
|
|
11152
|
-
var
|
|
11481
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
11153
11482
|
var BaseInviteUser = ({
|
|
11154
11483
|
onInitialize,
|
|
11155
11484
|
onSubmit,
|
|
@@ -11169,18 +11498,18 @@ var BaseInviteUser = ({
|
|
|
11169
11498
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
11170
11499
|
const { theme } = useTheme_default();
|
|
11171
11500
|
const styles = BaseInviteUser_styles_default(theme, theme.vars.colors.text.primary);
|
|
11172
|
-
const [isLoading, setIsLoading] = (0,
|
|
11173
|
-
const [isFlowInitialized, setIsFlowInitialized] = (0,
|
|
11174
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
11175
|
-
const [apiError, setApiError] = (0,
|
|
11176
|
-
const [formValues, setFormValues] = (0,
|
|
11177
|
-
const [formErrors, setFormErrors] = (0,
|
|
11178
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
11179
|
-
const [inviteLink, setInviteLink] = (0,
|
|
11180
|
-
const [inviteLinkCopied, setInviteLinkCopied] = (0,
|
|
11181
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
11182
|
-
const initializationAttemptedRef = (0,
|
|
11183
|
-
const handleError = (0,
|
|
11501
|
+
const [isLoading, setIsLoading] = (0, import_react71.useState)(false);
|
|
11502
|
+
const [isFlowInitialized, setIsFlowInitialized] = (0, import_react71.useState)(false);
|
|
11503
|
+
const [currentFlow, setCurrentFlow] = (0, import_react71.useState)(null);
|
|
11504
|
+
const [apiError, setApiError] = (0, import_react71.useState)(null);
|
|
11505
|
+
const [formValues, setFormValues] = (0, import_react71.useState)({});
|
|
11506
|
+
const [formErrors, setFormErrors] = (0, import_react71.useState)({});
|
|
11507
|
+
const [touchedFields, setTouchedFields] = (0, import_react71.useState)({});
|
|
11508
|
+
const [inviteLink, setInviteLink] = (0, import_react71.useState)();
|
|
11509
|
+
const [inviteLinkCopied, setInviteLinkCopied] = (0, import_react71.useState)(false);
|
|
11510
|
+
const [isFormValid, setIsFormValid] = (0, import_react71.useState)(true);
|
|
11511
|
+
const initializationAttemptedRef = (0, import_react71.useRef)(false);
|
|
11512
|
+
const handleError = (0, import_react71.useCallback)(
|
|
11184
11513
|
(error) => {
|
|
11185
11514
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.inviteUser.errors.generic");
|
|
11186
11515
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -11188,7 +11517,7 @@ var BaseInviteUser = ({
|
|
|
11188
11517
|
},
|
|
11189
11518
|
[t, onError]
|
|
11190
11519
|
);
|
|
11191
|
-
const normalizeFlowResponseLocal = (0,
|
|
11520
|
+
const normalizeFlowResponseLocal = (0, import_react71.useCallback)(
|
|
11192
11521
|
(response) => {
|
|
11193
11522
|
if (!response?.data?.meta?.components) {
|
|
11194
11523
|
return response;
|
|
@@ -11216,7 +11545,7 @@ var BaseInviteUser = ({
|
|
|
11216
11545
|
},
|
|
11217
11546
|
[t, children]
|
|
11218
11547
|
);
|
|
11219
|
-
const handleInputChange = (0,
|
|
11548
|
+
const handleInputChange = (0, import_react71.useCallback)((name, value) => {
|
|
11220
11549
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
11221
11550
|
setFormErrors((prev) => {
|
|
11222
11551
|
const newErrors = { ...prev };
|
|
@@ -11224,10 +11553,10 @@ var BaseInviteUser = ({
|
|
|
11224
11553
|
return newErrors;
|
|
11225
11554
|
});
|
|
11226
11555
|
}, []);
|
|
11227
|
-
const handleInputBlur = (0,
|
|
11556
|
+
const handleInputBlur = (0, import_react71.useCallback)((name) => {
|
|
11228
11557
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
11229
11558
|
}, []);
|
|
11230
|
-
const validateForm = (0,
|
|
11559
|
+
const validateForm = (0, import_react71.useCallback)(
|
|
11231
11560
|
(components2) => {
|
|
11232
11561
|
const errors = {};
|
|
11233
11562
|
const validateComponents = (comps) => {
|
|
@@ -11251,7 +11580,7 @@ var BaseInviteUser = ({
|
|
|
11251
11580
|
},
|
|
11252
11581
|
[formValues]
|
|
11253
11582
|
);
|
|
11254
|
-
const handleSubmit = (0,
|
|
11583
|
+
const handleSubmit = (0, import_react71.useCallback)(
|
|
11255
11584
|
async (component, data) => {
|
|
11256
11585
|
if (!currentFlow) {
|
|
11257
11586
|
return;
|
|
@@ -11314,7 +11643,7 @@ var BaseInviteUser = ({
|
|
|
11314
11643
|
normalizeFlowResponseLocal
|
|
11315
11644
|
]
|
|
11316
11645
|
);
|
|
11317
|
-
const copyInviteLink = (0,
|
|
11646
|
+
const copyInviteLink = (0, import_react71.useCallback)(async () => {
|
|
11318
11647
|
if (!inviteLink) return;
|
|
11319
11648
|
try {
|
|
11320
11649
|
await navigator.clipboard.writeText(inviteLink);
|
|
@@ -11331,7 +11660,7 @@ var BaseInviteUser = ({
|
|
|
11331
11660
|
setTimeout(() => setInviteLinkCopied(false), 3e3);
|
|
11332
11661
|
}
|
|
11333
11662
|
}, [inviteLink]);
|
|
11334
|
-
const resetFlow = (0,
|
|
11663
|
+
const resetFlow = (0, import_react71.useCallback)(() => {
|
|
11335
11664
|
setIsFlowInitialized(false);
|
|
11336
11665
|
setCurrentFlow(null);
|
|
11337
11666
|
setApiError(null);
|
|
@@ -11342,7 +11671,7 @@ var BaseInviteUser = ({
|
|
|
11342
11671
|
setInviteLinkCopied(false);
|
|
11343
11672
|
initializationAttemptedRef.current = false;
|
|
11344
11673
|
}, []);
|
|
11345
|
-
(0,
|
|
11674
|
+
(0, import_react71.useEffect)(() => {
|
|
11346
11675
|
if (isInitialized && !isFlowInitialized && !initializationAttemptedRef.current) {
|
|
11347
11676
|
initializationAttemptedRef.current = true;
|
|
11348
11677
|
(async () => {
|
|
@@ -11369,7 +11698,7 @@ var BaseInviteUser = ({
|
|
|
11369
11698
|
})();
|
|
11370
11699
|
}
|
|
11371
11700
|
}, [isInitialized, isFlowInitialized, onInitialize, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
11372
|
-
(0,
|
|
11701
|
+
(0, import_react71.useEffect)(() => {
|
|
11373
11702
|
if (currentFlow && isFlowInitialized) {
|
|
11374
11703
|
const components2 = currentFlow.data?.components || [];
|
|
11375
11704
|
if (components2.length > 0) {
|
|
@@ -11378,7 +11707,7 @@ var BaseInviteUser = ({
|
|
|
11378
11707
|
}
|
|
11379
11708
|
}
|
|
11380
11709
|
}, [formValues, currentFlow, isFlowInitialized, validateForm]);
|
|
11381
|
-
const extractHeadings = (0,
|
|
11710
|
+
const extractHeadings = (0, import_react71.useCallback)((components2) => {
|
|
11382
11711
|
let title2;
|
|
11383
11712
|
let subtitle2;
|
|
11384
11713
|
components2.forEach((comp) => {
|
|
@@ -11392,13 +11721,13 @@ var BaseInviteUser = ({
|
|
|
11392
11721
|
});
|
|
11393
11722
|
return { subtitle: subtitle2, title: title2 };
|
|
11394
11723
|
}, []);
|
|
11395
|
-
const filterHeadings = (0,
|
|
11724
|
+
const filterHeadings = (0, import_react71.useCallback)(
|
|
11396
11725
|
(components2) => components2.filter(
|
|
11397
11726
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
11398
11727
|
),
|
|
11399
11728
|
[]
|
|
11400
11729
|
);
|
|
11401
|
-
const renderComponents = (0,
|
|
11730
|
+
const renderComponents = (0, import_react71.useCallback)(
|
|
11402
11731
|
(components2) => renderInviteUserComponents(
|
|
11403
11732
|
components2,
|
|
11404
11733
|
formValues,
|
|
@@ -11453,28 +11782,28 @@ var BaseInviteUser = ({
|
|
|
11453
11782
|
values: formValues
|
|
11454
11783
|
};
|
|
11455
11784
|
if (children) {
|
|
11456
|
-
return /* @__PURE__ */ (0,
|
|
11785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className, children: children(renderProps) });
|
|
11457
11786
|
}
|
|
11458
11787
|
if (!isInitialized) {
|
|
11459
|
-
return /* @__PURE__ */ (0,
|
|
11788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
11460
11789
|
}
|
|
11461
11790
|
if (!isFlowInitialized && isLoading) {
|
|
11462
|
-
return /* @__PURE__ */ (0,
|
|
11791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "2rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "medium" }) }) }) });
|
|
11463
11792
|
}
|
|
11464
11793
|
if (!currentFlow && apiError) {
|
|
11465
|
-
return /* @__PURE__ */ (0,
|
|
11466
|
-
/* @__PURE__ */ (0,
|
|
11467
|
-
/* @__PURE__ */ (0,
|
|
11794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Alert_default, { variant: "error", children: [
|
|
11795
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Title, { children: "Error" }),
|
|
11796
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: apiError.message })
|
|
11468
11797
|
] }) }) });
|
|
11469
11798
|
}
|
|
11470
11799
|
if (isInviteGenerated && inviteLink) {
|
|
11471
|
-
return /* @__PURE__ */ (0,
|
|
11472
|
-
/* @__PURE__ */ (0,
|
|
11473
|
-
/* @__PURE__ */ (0,
|
|
11474
|
-
/* @__PURE__ */ (0,
|
|
11475
|
-
/* @__PURE__ */ (0,
|
|
11476
|
-
/* @__PURE__ */ (0,
|
|
11477
|
-
/* @__PURE__ */ (0,
|
|
11800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: [
|
|
11801
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Invite Link Generated!" }) }),
|
|
11802
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Content, { children: [
|
|
11803
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "success", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: "Share this link with the user to complete their registration." }) }),
|
|
11804
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { style: { marginTop: "1rem" }, children: [
|
|
11805
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body2", style: { marginBottom: "0.5rem" }, children: "Invite Link" }),
|
|
11806
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
11478
11807
|
"div",
|
|
11479
11808
|
{
|
|
11480
11809
|
style: {
|
|
@@ -11487,26 +11816,26 @@ var BaseInviteUser = ({
|
|
|
11487
11816
|
wordBreak: "break-all"
|
|
11488
11817
|
},
|
|
11489
11818
|
children: [
|
|
11490
|
-
/* @__PURE__ */ (0,
|
|
11491
|
-
/* @__PURE__ */ (0,
|
|
11819
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body2", style: { flex: 1 }, children: inviteLink }),
|
|
11820
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button_default, { variant: "outline", size: "small", onClick: copyInviteLink, children: inviteLinkCopied ? "Copied!" : "Copy" })
|
|
11492
11821
|
]
|
|
11493
11822
|
}
|
|
11494
11823
|
)
|
|
11495
11824
|
] }),
|
|
11496
|
-
/* @__PURE__ */ (0,
|
|
11825
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", gap: "0.5rem", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button_default, { variant: "outline", onClick: resetFlow, children: "Invite Another User" }) })
|
|
11497
11826
|
] })
|
|
11498
11827
|
] });
|
|
11499
11828
|
}
|
|
11500
|
-
return /* @__PURE__ */ (0,
|
|
11501
|
-
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0,
|
|
11502
|
-
showTitle && title && /* @__PURE__ */ (0,
|
|
11503
|
-
showSubtitle && subtitle && /* @__PURE__ */ (0,
|
|
11829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default, { className: (0, import_css42.cx)(className, styles.card), variant, children: [
|
|
11830
|
+
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
11831
|
+
showTitle && title && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
11832
|
+
showSubtitle && subtitle && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
11504
11833
|
] }),
|
|
11505
|
-
/* @__PURE__ */ (0,
|
|
11506
|
-
apiError && /* @__PURE__ */ (0,
|
|
11507
|
-
/* @__PURE__ */ (0,
|
|
11508
|
-
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0,
|
|
11509
|
-
isLoading && /* @__PURE__ */ (0,
|
|
11834
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Card_default.Content, { children: [
|
|
11835
|
+
apiError && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "error", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default.Description, { children: apiError.message }) }) }),
|
|
11836
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { children: [
|
|
11837
|
+
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography_default, { variant: "body1", children: "No form components available" }) }),
|
|
11838
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Spinner_default, { size: "small" }) })
|
|
11510
11839
|
] })
|
|
11511
11840
|
] })
|
|
11512
11841
|
] });
|
|
@@ -11514,7 +11843,7 @@ var BaseInviteUser = ({
|
|
|
11514
11843
|
var BaseInviteUser_default = BaseInviteUser;
|
|
11515
11844
|
|
|
11516
11845
|
// src/components/presentation/auth/InviteUser/v2/InviteUser.tsx
|
|
11517
|
-
var
|
|
11846
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
11518
11847
|
var InviteUser = ({
|
|
11519
11848
|
onInviteLinkGenerated,
|
|
11520
11849
|
onError,
|
|
@@ -11558,7 +11887,7 @@ var InviteUser = ({
|
|
|
11558
11887
|
});
|
|
11559
11888
|
return response.data;
|
|
11560
11889
|
};
|
|
11561
|
-
return /* @__PURE__ */ (0,
|
|
11890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
11562
11891
|
BaseInviteUser_default,
|
|
11563
11892
|
{
|
|
11564
11893
|
onInitialize: handleInitialize,
|
|
@@ -11579,16 +11908,16 @@ var InviteUser = ({
|
|
|
11579
11908
|
var InviteUser_default = InviteUser;
|
|
11580
11909
|
|
|
11581
11910
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
11582
|
-
var
|
|
11911
|
+
var import_react74 = require("react");
|
|
11583
11912
|
|
|
11584
11913
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
11585
11914
|
var import_css44 = require("@emotion/css");
|
|
11586
|
-
var
|
|
11915
|
+
var import_react73 = require("react");
|
|
11587
11916
|
|
|
11588
11917
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.styles.ts
|
|
11589
11918
|
var import_css43 = require("@emotion/css");
|
|
11590
|
-
var
|
|
11591
|
-
var useStyles19 = (theme, colorScheme) => (0,
|
|
11919
|
+
var import_react72 = require("react");
|
|
11920
|
+
var useStyles19 = (theme, colorScheme) => (0, import_react72.useMemo)(() => {
|
|
11592
11921
|
const card = import_css43.css`
|
|
11593
11922
|
background: ${theme.vars.colors.background.surface};
|
|
11594
11923
|
border-radius: ${theme.vars.borderRadius.large};
|
|
@@ -11626,7 +11955,7 @@ var useStyles19 = (theme, colorScheme) => (0, import_react71.useMemo)(() => {
|
|
|
11626
11955
|
var BaseAcceptInvite_styles_default = useStyles19;
|
|
11627
11956
|
|
|
11628
11957
|
// src/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.tsx
|
|
11629
|
-
var
|
|
11958
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11630
11959
|
var BaseAcceptInvite = ({
|
|
11631
11960
|
flowId,
|
|
11632
11961
|
inviteToken,
|
|
@@ -11647,19 +11976,19 @@ var BaseAcceptInvite = ({
|
|
|
11647
11976
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
11648
11977
|
const { theme } = useTheme_default();
|
|
11649
11978
|
const styles = BaseAcceptInvite_styles_default(theme, theme.vars.colors.text.primary);
|
|
11650
|
-
const [isLoading, setIsLoading] = (0,
|
|
11651
|
-
const [isValidatingToken, setIsValidatingToken] = (0,
|
|
11652
|
-
const [isTokenInvalid, setIsTokenInvalid] = (0,
|
|
11653
|
-
const [isComplete, setIsComplete] = (0,
|
|
11654
|
-
const [currentFlow, setCurrentFlow] = (0,
|
|
11655
|
-
const [apiError, setApiError] = (0,
|
|
11656
|
-
const [formValues, setFormValues] = (0,
|
|
11657
|
-
const [formErrors, setFormErrors] = (0,
|
|
11658
|
-
const [touchedFields, setTouchedFields] = (0,
|
|
11659
|
-
const [isFormValid, setIsFormValid] = (0,
|
|
11660
|
-
const [completionTitle, setCompletionTitle] = (0,
|
|
11661
|
-
const tokenValidationAttemptedRef = (0,
|
|
11662
|
-
const handleError = (0,
|
|
11979
|
+
const [isLoading, setIsLoading] = (0, import_react73.useState)(false);
|
|
11980
|
+
const [isValidatingToken, setIsValidatingToken] = (0, import_react73.useState)(true);
|
|
11981
|
+
const [isTokenInvalid, setIsTokenInvalid] = (0, import_react73.useState)(false);
|
|
11982
|
+
const [isComplete, setIsComplete] = (0, import_react73.useState)(false);
|
|
11983
|
+
const [currentFlow, setCurrentFlow] = (0, import_react73.useState)(null);
|
|
11984
|
+
const [apiError, setApiError] = (0, import_react73.useState)(null);
|
|
11985
|
+
const [formValues, setFormValues] = (0, import_react73.useState)({});
|
|
11986
|
+
const [formErrors, setFormErrors] = (0, import_react73.useState)({});
|
|
11987
|
+
const [touchedFields, setTouchedFields] = (0, import_react73.useState)({});
|
|
11988
|
+
const [isFormValid, setIsFormValid] = (0, import_react73.useState)(true);
|
|
11989
|
+
const [completionTitle, setCompletionTitle] = (0, import_react73.useState)(void 0);
|
|
11990
|
+
const tokenValidationAttemptedRef = (0, import_react73.useRef)(false);
|
|
11991
|
+
const handleError = (0, import_react73.useCallback)(
|
|
11663
11992
|
(error) => {
|
|
11664
11993
|
const errorMessage = error?.failureReason || extractErrorMessage(error, t, "components.acceptInvite.errors.generic");
|
|
11665
11994
|
setApiError(error instanceof Error ? error : new Error(errorMessage));
|
|
@@ -11667,7 +11996,7 @@ var BaseAcceptInvite = ({
|
|
|
11667
11996
|
},
|
|
11668
11997
|
[t, onError]
|
|
11669
11998
|
);
|
|
11670
|
-
const normalizeFlowResponseLocal = (0,
|
|
11999
|
+
const normalizeFlowResponseLocal = (0, import_react73.useCallback)(
|
|
11671
12000
|
(response) => {
|
|
11672
12001
|
if (!response?.data?.meta?.components) {
|
|
11673
12002
|
return response;
|
|
@@ -11727,7 +12056,7 @@ var BaseAcceptInvite = ({
|
|
|
11727
12056
|
},
|
|
11728
12057
|
tokenValidationAttemptedRef
|
|
11729
12058
|
});
|
|
11730
|
-
const handleInputChange = (0,
|
|
12059
|
+
const handleInputChange = (0, import_react73.useCallback)((name, value) => {
|
|
11731
12060
|
setFormValues((prev) => ({ ...prev, [name]: value }));
|
|
11732
12061
|
setFormErrors((prev) => {
|
|
11733
12062
|
const newErrors = { ...prev };
|
|
@@ -11735,10 +12064,10 @@ var BaseAcceptInvite = ({
|
|
|
11735
12064
|
return newErrors;
|
|
11736
12065
|
});
|
|
11737
12066
|
}, []);
|
|
11738
|
-
const handleInputBlur = (0,
|
|
12067
|
+
const handleInputBlur = (0, import_react73.useCallback)((name) => {
|
|
11739
12068
|
setTouchedFields((prev) => ({ ...prev, [name]: true }));
|
|
11740
12069
|
}, []);
|
|
11741
|
-
const validateForm = (0,
|
|
12070
|
+
const validateForm = (0, import_react73.useCallback)(
|
|
11742
12071
|
(components2) => {
|
|
11743
12072
|
const errors = {};
|
|
11744
12073
|
const validateComponents = (comps) => {
|
|
@@ -11759,7 +12088,7 @@ var BaseAcceptInvite = ({
|
|
|
11759
12088
|
},
|
|
11760
12089
|
[formValues]
|
|
11761
12090
|
);
|
|
11762
|
-
const handleSubmit = (0,
|
|
12091
|
+
const handleSubmit = (0, import_react73.useCallback)(
|
|
11763
12092
|
async (component, data) => {
|
|
11764
12093
|
if (!currentFlow) {
|
|
11765
12094
|
return;
|
|
@@ -11838,7 +12167,7 @@ var BaseAcceptInvite = ({
|
|
|
11838
12167
|
normalizeFlowResponseLocal
|
|
11839
12168
|
]
|
|
11840
12169
|
);
|
|
11841
|
-
(0,
|
|
12170
|
+
(0, import_react73.useEffect)(() => {
|
|
11842
12171
|
if (tokenValidationAttemptedRef.current) {
|
|
11843
12172
|
return;
|
|
11844
12173
|
}
|
|
@@ -11880,7 +12209,7 @@ var BaseAcceptInvite = ({
|
|
|
11880
12209
|
}
|
|
11881
12210
|
})();
|
|
11882
12211
|
}, [flowId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);
|
|
11883
|
-
const extractHeadings = (0,
|
|
12212
|
+
const extractHeadings = (0, import_react73.useCallback)((components2) => {
|
|
11884
12213
|
let title2;
|
|
11885
12214
|
let subtitle2;
|
|
11886
12215
|
components2.forEach((comp) => {
|
|
@@ -11894,13 +12223,13 @@ var BaseAcceptInvite = ({
|
|
|
11894
12223
|
});
|
|
11895
12224
|
return { subtitle: subtitle2, title: title2 };
|
|
11896
12225
|
}, []);
|
|
11897
|
-
const filterHeadings = (0,
|
|
12226
|
+
const filterHeadings = (0, import_react73.useCallback)(
|
|
11898
12227
|
(components2) => components2.filter(
|
|
11899
12228
|
(comp) => !(comp.type === "TEXT" && (comp.variant === "HEADING_1" || comp.variant === "HEADING_2"))
|
|
11900
12229
|
),
|
|
11901
12230
|
[]
|
|
11902
12231
|
);
|
|
11903
|
-
const renderComponents = (0,
|
|
12232
|
+
const renderComponents = (0, import_react73.useCallback)(
|
|
11904
12233
|
(components2) => renderInviteUserComponents(
|
|
11905
12234
|
components2,
|
|
11906
12235
|
formValues,
|
|
@@ -11955,50 +12284,50 @@ var BaseAcceptInvite = ({
|
|
|
11955
12284
|
values: formValues
|
|
11956
12285
|
};
|
|
11957
12286
|
if (children) {
|
|
11958
|
-
return /* @__PURE__ */ (0,
|
|
12287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className, children: children(renderProps) });
|
|
11959
12288
|
}
|
|
11960
12289
|
if (isValidatingToken) {
|
|
11961
|
-
return /* @__PURE__ */ (0,
|
|
11962
|
-
/* @__PURE__ */ (0,
|
|
11963
|
-
/* @__PURE__ */ (0,
|
|
12290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: { alignItems: "center", display: "flex", flexDirection: "column", gap: "1rem", padding: "2rem" }, children: [
|
|
12291
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Spinner_default, { size: "medium" }),
|
|
12292
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", children: "Validating your invite link..." })
|
|
11964
12293
|
] }) }) });
|
|
11965
12294
|
}
|
|
11966
12295
|
if (isTokenInvalid) {
|
|
11967
|
-
return /* @__PURE__ */ (0,
|
|
11968
|
-
/* @__PURE__ */ (0,
|
|
11969
|
-
/* @__PURE__ */ (0,
|
|
11970
|
-
/* @__PURE__ */ (0,
|
|
11971
|
-
/* @__PURE__ */ (0,
|
|
11972
|
-
/* @__PURE__ */ (0,
|
|
12296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12297
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Invalid Invite Link" }) }),
|
|
12298
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12299
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Alert_default, { variant: "error", children: [
|
|
12300
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Title, { children: "Unable to verify invite" }),
|
|
12301
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: apiError?.message || "This invite link is invalid or has expired. Please contact your administrator for a new invite." })
|
|
11973
12302
|
] }),
|
|
11974
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12303
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "outline", onClick: onGoToSignIn, children: "Go to Sign In" }) })
|
|
11975
12304
|
] })
|
|
11976
12305
|
] });
|
|
11977
12306
|
}
|
|
11978
12307
|
if (isComplete) {
|
|
11979
|
-
return /* @__PURE__ */ (0,
|
|
11980
|
-
/* @__PURE__ */ (0,
|
|
11981
|
-
/* @__PURE__ */ (0,
|
|
11982
|
-
/* @__PURE__ */ (0,
|
|
11983
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12309
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Header, { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: "Account Setup Complete!" }) }),
|
|
12310
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12311
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "success", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: "Your account has been successfully set up. You can now sign in with your credentials." }) }),
|
|
12312
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "solid", color: "primary", onClick: onGoToSignIn, children: "Sign In" }) })
|
|
11984
12313
|
] })
|
|
11985
12314
|
] });
|
|
11986
12315
|
}
|
|
11987
|
-
return /* @__PURE__ */ (0,
|
|
11988
|
-
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0,
|
|
11989
|
-
showTitle && title && /* @__PURE__ */ (0,
|
|
11990
|
-
showSubtitle && subtitle && /* @__PURE__ */ (0,
|
|
12316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { className: (0, import_css44.cx)(className, styles.card), variant, children: [
|
|
12317
|
+
(showTitle || showSubtitle) && (title || subtitle) && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Header, { className: styles.header, children: [
|
|
12318
|
+
showTitle && title && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card_default.Title, { level: 2, className: styles.title, children: title }),
|
|
12319
|
+
showSubtitle && subtitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", className: styles.subtitle, children: subtitle })
|
|
11991
12320
|
] }),
|
|
11992
|
-
/* @__PURE__ */ (0,
|
|
11993
|
-
apiError && /* @__PURE__ */ (0,
|
|
11994
|
-
/* @__PURE__ */ (0,
|
|
11995
|
-
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0,
|
|
11996
|
-
isLoading && /* @__PURE__ */ (0,
|
|
12321
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default.Content, { children: [
|
|
12322
|
+
apiError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "error", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default.Description, { children: apiError.message }) }) }),
|
|
12323
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12324
|
+
componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? renderComponents(componentsWithoutHeadings) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Alert_default, { variant: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography_default, { variant: "body1", children: "No form components available" }) }),
|
|
12325
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "1rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Spinner_default, { size: "small" }) })
|
|
11997
12326
|
] }),
|
|
11998
|
-
onGoToSignIn && /* @__PURE__ */ (0,
|
|
12327
|
+
onGoToSignIn && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { marginTop: "1.5rem", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Typography_default, { variant: "body2", children: [
|
|
11999
12328
|
"Already have an account?",
|
|
12000
12329
|
" ",
|
|
12001
|
-
/* @__PURE__ */ (0,
|
|
12330
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button_default, { variant: "text", onClick: onGoToSignIn, style: { minWidth: "auto", padding: 0 }, children: "Sign In" })
|
|
12002
12331
|
] }) })
|
|
12003
12332
|
] })
|
|
12004
12333
|
] });
|
|
@@ -12006,7 +12335,7 @@ var BaseAcceptInvite = ({
|
|
|
12006
12335
|
var BaseAcceptInvite_default = BaseAcceptInvite;
|
|
12007
12336
|
|
|
12008
12337
|
// src/components/presentation/auth/AcceptInvite/v2/AcceptInvite.tsx
|
|
12009
|
-
var
|
|
12338
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
12010
12339
|
var getUrlParams = () => {
|
|
12011
12340
|
if (typeof window === "undefined") {
|
|
12012
12341
|
return {};
|
|
@@ -12032,10 +12361,10 @@ var AcceptInvite = ({
|
|
|
12032
12361
|
showTitle = true,
|
|
12033
12362
|
showSubtitle = true
|
|
12034
12363
|
}) => {
|
|
12035
|
-
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0,
|
|
12364
|
+
const { flowId: urlFlowId, inviteToken: urlInviteToken } = (0, import_react74.useMemo)(() => getUrlParams(), []);
|
|
12036
12365
|
const flowId = flowIdProp || urlFlowId;
|
|
12037
12366
|
const inviteToken = inviteTokenProp || urlInviteToken;
|
|
12038
|
-
const apiBaseUrl = (0,
|
|
12367
|
+
const apiBaseUrl = (0, import_react74.useMemo)(() => {
|
|
12039
12368
|
if (baseUrl) {
|
|
12040
12369
|
return baseUrl;
|
|
12041
12370
|
}
|
|
@@ -12062,7 +12391,7 @@ var AcceptInvite = ({
|
|
|
12062
12391
|
}
|
|
12063
12392
|
return response.json();
|
|
12064
12393
|
};
|
|
12065
|
-
return /* @__PURE__ */ (0,
|
|
12394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12066
12395
|
BaseAcceptInvite_default,
|
|
12067
12396
|
{
|
|
12068
12397
|
flowId,
|
|
@@ -12085,9 +12414,9 @@ var AcceptInvite_default = AcceptInvite;
|
|
|
12085
12414
|
|
|
12086
12415
|
// src/components/auth/Callback/Callback.tsx
|
|
12087
12416
|
var import_browser73 = require("@asgardeo/browser");
|
|
12088
|
-
var
|
|
12417
|
+
var import_react75 = require("react");
|
|
12089
12418
|
var Callback = ({ onNavigate, onError }) => {
|
|
12090
|
-
const processingRef = (0,
|
|
12419
|
+
const processingRef = (0, import_react75.useRef)(false);
|
|
12091
12420
|
const navigate6 = (path) => {
|
|
12092
12421
|
if (onNavigate) {
|
|
12093
12422
|
onNavigate(path);
|
|
@@ -12095,7 +12424,7 @@ var Callback = ({ onNavigate, onError }) => {
|
|
|
12095
12424
|
(0, import_browser73.navigate)(path);
|
|
12096
12425
|
}
|
|
12097
12426
|
};
|
|
12098
|
-
(0,
|
|
12427
|
+
(0, import_react75.useEffect)(() => {
|
|
12099
12428
|
const processOAuthCallback = () => {
|
|
12100
12429
|
if (processingRef.current) {
|
|
12101
12430
|
return;
|
|
@@ -12173,45 +12502,45 @@ var Callback = ({ onNavigate, onError }) => {
|
|
|
12173
12502
|
};
|
|
12174
12503
|
|
|
12175
12504
|
// src/components/presentation/User/BaseUser.tsx
|
|
12176
|
-
var
|
|
12505
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12177
12506
|
var BaseUser = ({ user, children, fallback = null }) => {
|
|
12178
12507
|
if (!user) {
|
|
12179
|
-
return /* @__PURE__ */ (0,
|
|
12508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: fallback });
|
|
12180
12509
|
}
|
|
12181
|
-
return /* @__PURE__ */ (0,
|
|
12510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: children(user) });
|
|
12182
12511
|
};
|
|
12183
12512
|
BaseUser.displayName = "BaseUser";
|
|
12184
12513
|
var BaseUser_default = BaseUser;
|
|
12185
12514
|
|
|
12186
12515
|
// src/components/presentation/User/User.tsx
|
|
12187
|
-
var
|
|
12516
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12188
12517
|
var User5 = ({ children, fallback = null }) => {
|
|
12189
12518
|
const { user } = useAsgardeo_default();
|
|
12190
|
-
return /* @__PURE__ */ (0,
|
|
12519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BaseUser_default, { user, fallback, children });
|
|
12191
12520
|
};
|
|
12192
12521
|
User5.displayName = "User";
|
|
12193
12522
|
var User_default = User5;
|
|
12194
12523
|
|
|
12195
12524
|
// src/components/presentation/Organization/BaseOrganization.tsx
|
|
12196
|
-
var
|
|
12525
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12197
12526
|
var BaseOrganization = ({
|
|
12198
12527
|
children,
|
|
12199
12528
|
fallback = null,
|
|
12200
12529
|
organization
|
|
12201
12530
|
}) => {
|
|
12202
12531
|
if (!organization) {
|
|
12203
|
-
return /* @__PURE__ */ (0,
|
|
12532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: fallback });
|
|
12204
12533
|
}
|
|
12205
|
-
return /* @__PURE__ */ (0,
|
|
12534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: children(organization) });
|
|
12206
12535
|
};
|
|
12207
12536
|
BaseOrganization.displayName = "BaseOrganization";
|
|
12208
12537
|
var BaseOrganization_default = BaseOrganization;
|
|
12209
12538
|
|
|
12210
12539
|
// src/components/presentation/Organization/Organization.tsx
|
|
12211
|
-
var
|
|
12540
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12212
12541
|
var Organization5 = ({ children, fallback = null }) => {
|
|
12213
12542
|
const { currentOrganization } = useOrganization_default();
|
|
12214
|
-
return /* @__PURE__ */ (0,
|
|
12543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BaseOrganization_default, { organization: currentOrganization, fallback, children });
|
|
12215
12544
|
};
|
|
12216
12545
|
Organization5.displayName = "Organization";
|
|
12217
12546
|
var Organization_default = Organization5;
|
|
@@ -12219,12 +12548,12 @@ var Organization_default = Organization5;
|
|
|
12219
12548
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
12220
12549
|
var import_browser79 = require("@asgardeo/browser");
|
|
12221
12550
|
var import_css52 = require("@emotion/css");
|
|
12222
|
-
var
|
|
12551
|
+
var import_react84 = require("react");
|
|
12223
12552
|
|
|
12224
12553
|
// src/components/presentation/UserProfile/BaseUserProfile.styles.ts
|
|
12225
12554
|
var import_browser74 = require("@asgardeo/browser");
|
|
12226
12555
|
var import_css45 = require("@emotion/css");
|
|
12227
|
-
var
|
|
12556
|
+
var import_react76 = require("react");
|
|
12228
12557
|
var useStyles20 = (theme, colorScheme) => {
|
|
12229
12558
|
const valuePlaceholder = import_css45.css`
|
|
12230
12559
|
font-style: italic;
|
|
@@ -12269,7 +12598,7 @@ var useStyles20 = (theme, colorScheme) => {
|
|
|
12269
12598
|
padding: ${theme.vars.spacing.unit};
|
|
12270
12599
|
vertical-align: top;
|
|
12271
12600
|
`;
|
|
12272
|
-
return (0,
|
|
12601
|
+
return (0, import_react76.useMemo)(() => {
|
|
12273
12602
|
const root = import_css45.css`
|
|
12274
12603
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
12275
12604
|
min-width: 600px;
|
|
@@ -12481,12 +12810,12 @@ var getDisplayName_default = getDisplayName;
|
|
|
12481
12810
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
12482
12811
|
var import_browser76 = require("@asgardeo/browser");
|
|
12483
12812
|
var import_css47 = require("@emotion/css");
|
|
12484
|
-
var
|
|
12813
|
+
var import_react78 = require("react");
|
|
12485
12814
|
|
|
12486
12815
|
// src/components/primitives/Avatar/Avatar.styles.ts
|
|
12487
12816
|
var import_css46 = require("@emotion/css");
|
|
12488
|
-
var
|
|
12489
|
-
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0,
|
|
12817
|
+
var import_react77 = require("react");
|
|
12818
|
+
var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0, import_react77.useMemo)(() => {
|
|
12490
12819
|
const baseAvatar = import_css46.css`
|
|
12491
12820
|
align-items: center;
|
|
12492
12821
|
background: ${backgroundColor || theme.vars.colors.background.surface};
|
|
@@ -12550,7 +12879,7 @@ var useStyles21 = (theme, colorScheme, size, variant, backgroundColor) => (0, im
|
|
|
12550
12879
|
var Avatar_styles_default = useStyles21;
|
|
12551
12880
|
|
|
12552
12881
|
// src/components/primitives/Avatar/Avatar.tsx
|
|
12553
|
-
var
|
|
12882
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12554
12883
|
var Avatar = ({
|
|
12555
12884
|
alt = "User avatar",
|
|
12556
12885
|
background = "random",
|
|
@@ -12580,7 +12909,7 @@ var Avatar = ({
|
|
|
12580
12909
|
const colors = generateColor(seed);
|
|
12581
12910
|
return `linear-gradient(${angle}deg, ${colors})`;
|
|
12582
12911
|
};
|
|
12583
|
-
const backgroundColor = (0,
|
|
12912
|
+
const backgroundColor = (0, import_react78.useMemo)(() => {
|
|
12584
12913
|
if (!name || imageUrl) {
|
|
12585
12914
|
return void 0;
|
|
12586
12915
|
}
|
|
@@ -12597,7 +12926,7 @@ var Avatar = ({
|
|
|
12597
12926
|
const getInitials = (fullName) => fullName.split(" ").map((part) => part[0]).slice(0, 2).join("").toUpperCase();
|
|
12598
12927
|
const renderContent = () => {
|
|
12599
12928
|
if (imageUrl) {
|
|
12600
|
-
return /* @__PURE__ */ (0,
|
|
12929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12601
12930
|
"img",
|
|
12602
12931
|
{
|
|
12603
12932
|
src: imageUrl,
|
|
@@ -12610,19 +12939,19 @@ var Avatar = ({
|
|
|
12610
12939
|
return getInitials(name);
|
|
12611
12940
|
}
|
|
12612
12941
|
if (isLoading) {
|
|
12613
|
-
return /* @__PURE__ */ (0,
|
|
12942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: (0, import_css47.cx)((0, import_browser76.withVendorCSSClassPrefix)((0, import_browser76.bem)("avatar", "skeleton")), styles["skeleton"]) });
|
|
12614
12943
|
}
|
|
12615
|
-
return /* @__PURE__ */ (0,
|
|
12944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12616
12945
|
"svg",
|
|
12617
12946
|
{
|
|
12618
12947
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12619
12948
|
viewBox: "0 0 640 640",
|
|
12620
12949
|
className: (0, import_css47.cx)((0, import_browser76.withVendorCSSClassPrefix)((0, import_browser76.bem)("avatar", "icon")), styles["icon"]),
|
|
12621
|
-
children: /* @__PURE__ */ (0,
|
|
12950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
12622
12951
|
}
|
|
12623
12952
|
);
|
|
12624
12953
|
};
|
|
12625
|
-
return /* @__PURE__ */ (0,
|
|
12954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12626
12955
|
"div",
|
|
12627
12956
|
{
|
|
12628
12957
|
className: (0, import_css47.cx)(
|
|
@@ -12641,13 +12970,13 @@ var Avatar = ({
|
|
|
12641
12970
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
12642
12971
|
var import_browser77 = require("@asgardeo/browser");
|
|
12643
12972
|
var import_css49 = require("@emotion/css");
|
|
12644
|
-
var
|
|
12645
|
-
var
|
|
12973
|
+
var import_react80 = require("@floating-ui/react");
|
|
12974
|
+
var import_react81 = require("react");
|
|
12646
12975
|
|
|
12647
12976
|
// src/components/primitives/Dialog/Dialog.styles.ts
|
|
12648
12977
|
var import_css48 = require("@emotion/css");
|
|
12649
|
-
var
|
|
12650
|
-
var useStyles22 = (theme, colorScheme) => (0,
|
|
12978
|
+
var import_react79 = require("react");
|
|
12979
|
+
var useStyles22 = (theme, colorScheme) => (0, import_react79.useMemo)(() => {
|
|
12651
12980
|
const overlay = import_css48.css`
|
|
12652
12981
|
background-color: rgba(0, 0, 0, 0.5);
|
|
12653
12982
|
display: flex;
|
|
@@ -12709,8 +13038,8 @@ var useStyles22 = (theme, colorScheme) => (0, import_react78.useMemo)(() => {
|
|
|
12709
13038
|
var Dialog_styles_default = useStyles22;
|
|
12710
13039
|
|
|
12711
13040
|
// src/components/primitives/Icons/LogOut.tsx
|
|
12712
|
-
var
|
|
12713
|
-
var LogOut = (props) => /* @__PURE__ */ (0,
|
|
13041
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
13042
|
+
var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
12714
13043
|
"svg",
|
|
12715
13044
|
{
|
|
12716
13045
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12724,17 +13053,17 @@ var LogOut = (props) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
|
12724
13053
|
strokeLinejoin: "round",
|
|
12725
13054
|
...props,
|
|
12726
13055
|
children: [
|
|
12727
|
-
/* @__PURE__ */ (0,
|
|
12728
|
-
/* @__PURE__ */ (0,
|
|
12729
|
-
/* @__PURE__ */ (0,
|
|
13056
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "m16 17 5-5-5-5" }),
|
|
13057
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "M21 12H9" }),
|
|
13058
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" })
|
|
12730
13059
|
]
|
|
12731
13060
|
}
|
|
12732
13061
|
);
|
|
12733
13062
|
var LogOut_default = LogOut;
|
|
12734
13063
|
|
|
12735
13064
|
// src/components/primitives/Icons/Plus.tsx
|
|
12736
|
-
var
|
|
12737
|
-
var Plus = (props) => /* @__PURE__ */ (0,
|
|
13065
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
13066
|
+
var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
12738
13067
|
"svg",
|
|
12739
13068
|
{
|
|
12740
13069
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12748,16 +13077,16 @@ var Plus = (props) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
|
12748
13077
|
strokeLinejoin: "round",
|
|
12749
13078
|
...props,
|
|
12750
13079
|
children: [
|
|
12751
|
-
/* @__PURE__ */ (0,
|
|
12752
|
-
/* @__PURE__ */ (0,
|
|
13080
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M5 12h14" }),
|
|
13081
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M12 5v14" })
|
|
12753
13082
|
]
|
|
12754
13083
|
}
|
|
12755
13084
|
);
|
|
12756
13085
|
var Plus_default = Plus;
|
|
12757
13086
|
|
|
12758
13087
|
// src/components/primitives/Icons/User.tsx
|
|
12759
|
-
var
|
|
12760
|
-
var User7 = (props) => /* @__PURE__ */ (0,
|
|
13088
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
13089
|
+
var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
12761
13090
|
"svg",
|
|
12762
13091
|
{
|
|
12763
13092
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12771,16 +13100,16 @@ var User7 = (props) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
|
12771
13100
|
strokeLinejoin: "round",
|
|
12772
13101
|
...props,
|
|
12773
13102
|
children: [
|
|
12774
|
-
/* @__PURE__ */ (0,
|
|
12775
|
-
/* @__PURE__ */ (0,
|
|
13103
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
13104
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("circle", { cx: "12", cy: "7", r: "4" })
|
|
12776
13105
|
]
|
|
12777
13106
|
}
|
|
12778
13107
|
);
|
|
12779
13108
|
var User_default2 = User7;
|
|
12780
13109
|
|
|
12781
13110
|
// src/components/primitives/Icons/X.tsx
|
|
12782
|
-
var
|
|
12783
|
-
var X = (props) => /* @__PURE__ */ (0,
|
|
13111
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13112
|
+
var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
12784
13113
|
"svg",
|
|
12785
13114
|
{
|
|
12786
13115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12794,37 +13123,37 @@ var X = (props) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
|
12794
13123
|
strokeLinejoin: "round",
|
|
12795
13124
|
...props,
|
|
12796
13125
|
children: [
|
|
12797
|
-
/* @__PURE__ */ (0,
|
|
12798
|
-
/* @__PURE__ */ (0,
|
|
13126
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M18 6 6 18" }),
|
|
13127
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "m6 6 12 12" })
|
|
12799
13128
|
]
|
|
12800
13129
|
}
|
|
12801
13130
|
);
|
|
12802
13131
|
var X_default = X;
|
|
12803
13132
|
|
|
12804
13133
|
// src/components/primitives/Dialog/Dialog.tsx
|
|
12805
|
-
var
|
|
13134
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
12806
13135
|
function useDialog({
|
|
12807
13136
|
initialOpen = false,
|
|
12808
13137
|
open: controlledOpen,
|
|
12809
13138
|
onOpenChange: setControlledOpen
|
|
12810
13139
|
} = {}) {
|
|
12811
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
12812
|
-
const [labelId, setLabelId] = (0,
|
|
12813
|
-
const [descriptionId, setDescriptionId] = (0,
|
|
13140
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react81.useState)(initialOpen);
|
|
13141
|
+
const [labelId, setLabelId] = (0, import_react81.useState)();
|
|
13142
|
+
const [descriptionId, setDescriptionId] = (0, import_react81.useState)();
|
|
12814
13143
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
12815
13144
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
12816
|
-
const data = (0,
|
|
13145
|
+
const data = (0, import_react80.useFloating)({
|
|
12817
13146
|
onOpenChange: setOpen,
|
|
12818
13147
|
open
|
|
12819
13148
|
});
|
|
12820
13149
|
const { context } = data;
|
|
12821
|
-
const click = (0,
|
|
13150
|
+
const click = (0, import_react80.useClick)(context, {
|
|
12822
13151
|
enabled: controlledOpen == null
|
|
12823
13152
|
});
|
|
12824
|
-
const dismiss = (0,
|
|
12825
|
-
const role = (0,
|
|
12826
|
-
const interactions = (0,
|
|
12827
|
-
return (0,
|
|
13153
|
+
const dismiss = (0, import_react80.useDismiss)(context, { outsidePressEvent: "mousedown" });
|
|
13154
|
+
const role = (0, import_react80.useRole)(context);
|
|
13155
|
+
const interactions = (0, import_react80.useInteractions)([click, dismiss, role]);
|
|
13156
|
+
return (0, import_react81.useMemo)(
|
|
12828
13157
|
() => ({
|
|
12829
13158
|
open,
|
|
12830
13159
|
setOpen,
|
|
@@ -12838,9 +13167,9 @@ function useDialog({
|
|
|
12838
13167
|
[open, setOpen, interactions, data, labelId, descriptionId]
|
|
12839
13168
|
);
|
|
12840
13169
|
}
|
|
12841
|
-
var DialogContext = (0,
|
|
13170
|
+
var DialogContext = (0, import_react81.createContext)(null);
|
|
12842
13171
|
var useDialogContext = () => {
|
|
12843
|
-
const context = (0,
|
|
13172
|
+
const context = (0, import_react81.useContext)(DialogContext);
|
|
12844
13173
|
if (context == null) {
|
|
12845
13174
|
throw new Error("Dialog components must be wrapped in <Dialog />");
|
|
12846
13175
|
}
|
|
@@ -12848,15 +13177,15 @@ var useDialogContext = () => {
|
|
|
12848
13177
|
};
|
|
12849
13178
|
function Dialog({ children, ...options }) {
|
|
12850
13179
|
const dialog = useDialog(options);
|
|
12851
|
-
return /* @__PURE__ */ (0,
|
|
13180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DialogContext.Provider, { value: dialog, children });
|
|
12852
13181
|
}
|
|
12853
|
-
var DialogTrigger = (0,
|
|
13182
|
+
var DialogTrigger = (0, import_react81.forwardRef)(
|
|
12854
13183
|
({ children, asChild = false, ...props }, propRef) => {
|
|
12855
13184
|
const context = useDialogContext();
|
|
12856
13185
|
const childrenRef = children.ref;
|
|
12857
|
-
const ref = (0,
|
|
12858
|
-
if (asChild && (0,
|
|
12859
|
-
return (0,
|
|
13186
|
+
const ref = (0, import_react80.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
13187
|
+
if (asChild && (0, import_react81.isValidElement)(children)) {
|
|
13188
|
+
return (0, import_react81.cloneElement)(
|
|
12860
13189
|
children,
|
|
12861
13190
|
context.getReferenceProps({
|
|
12862
13191
|
ref,
|
|
@@ -12866,22 +13195,22 @@ var DialogTrigger = (0, import_react80.forwardRef)(
|
|
|
12866
13195
|
})
|
|
12867
13196
|
);
|
|
12868
13197
|
}
|
|
12869
|
-
return /* @__PURE__ */ (0,
|
|
13198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("button", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
|
|
12870
13199
|
}
|
|
12871
13200
|
);
|
|
12872
|
-
var DialogContent = (0,
|
|
13201
|
+
var DialogContent = (0, import_react81.forwardRef)(
|
|
12873
13202
|
(props, propRef) => {
|
|
12874
13203
|
const { context: floatingContext, ...context } = useDialogContext();
|
|
12875
13204
|
const { theme, colorScheme } = useTheme_default();
|
|
12876
13205
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12877
|
-
const ref = (0,
|
|
13206
|
+
const ref = (0, import_react80.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
12878
13207
|
if (!floatingContext.open) return null;
|
|
12879
|
-
return /* @__PURE__ */ (0,
|
|
12880
|
-
|
|
13208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_react80.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13209
|
+
import_react80.FloatingOverlay,
|
|
12881
13210
|
{
|
|
12882
13211
|
className: (0, import_css49.cx)((0, import_browser77.withVendorCSSClassPrefix)((0, import_browser77.bem)("dialog", "overlay")), styles["overlay"]),
|
|
12883
13212
|
lockScroll: true,
|
|
12884
|
-
children: /* @__PURE__ */ (0,
|
|
13213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_react80.FloatingFocusManager, { context: floatingContext, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12885
13214
|
"div",
|
|
12886
13215
|
{
|
|
12887
13216
|
ref,
|
|
@@ -12896,20 +13225,20 @@ var DialogContent = (0, import_react80.forwardRef)(
|
|
|
12896
13225
|
) });
|
|
12897
13226
|
}
|
|
12898
13227
|
);
|
|
12899
|
-
var DialogHeading = (0,
|
|
13228
|
+
var DialogHeading = (0, import_react81.forwardRef)(
|
|
12900
13229
|
({ children, ...props }, ref) => {
|
|
12901
13230
|
const context = useDialogContext();
|
|
12902
13231
|
const { theme, colorScheme } = useTheme_default();
|
|
12903
13232
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12904
|
-
const id = (0,
|
|
12905
|
-
(0,
|
|
13233
|
+
const id = (0, import_react80.useId)();
|
|
13234
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
12906
13235
|
context.setLabelId(id);
|
|
12907
13236
|
return () => {
|
|
12908
13237
|
context.setLabelId(void 0);
|
|
12909
13238
|
};
|
|
12910
13239
|
}, [id, context.setLabelId]);
|
|
12911
|
-
return /* @__PURE__ */ (0,
|
|
12912
|
-
/* @__PURE__ */ (0,
|
|
13240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: (0, import_css49.cx)((0, import_browser77.withVendorCSSClassPrefix)((0, import_browser77.bem)("dialog", "header")), styles["header"]), children: [
|
|
13241
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12913
13242
|
"h2",
|
|
12914
13243
|
{
|
|
12915
13244
|
...props,
|
|
@@ -12919,7 +13248,7 @@ var DialogHeading = (0, import_react80.forwardRef)(
|
|
|
12919
13248
|
children
|
|
12920
13249
|
}
|
|
12921
13250
|
),
|
|
12922
|
-
/* @__PURE__ */ (0,
|
|
13251
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12923
13252
|
Button_default,
|
|
12924
13253
|
{
|
|
12925
13254
|
color: "tertiary",
|
|
@@ -12930,25 +13259,25 @@ var DialogHeading = (0, import_react80.forwardRef)(
|
|
|
12930
13259
|
context.setOpen(false);
|
|
12931
13260
|
},
|
|
12932
13261
|
"aria-label": "Close",
|
|
12933
|
-
children: /* @__PURE__ */ (0,
|
|
13262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(X_default, { width: 16, height: 16 })
|
|
12934
13263
|
}
|
|
12935
13264
|
)
|
|
12936
13265
|
] });
|
|
12937
13266
|
}
|
|
12938
13267
|
);
|
|
12939
|
-
var DialogDescription = (0,
|
|
13268
|
+
var DialogDescription = (0, import_react81.forwardRef)(
|
|
12940
13269
|
({ children, ...props }, ref) => {
|
|
12941
13270
|
const context = useDialogContext();
|
|
12942
13271
|
const { theme, colorScheme } = useTheme_default();
|
|
12943
13272
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
12944
|
-
const id = (0,
|
|
12945
|
-
(0,
|
|
13273
|
+
const id = (0, import_react80.useId)();
|
|
13274
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
12946
13275
|
context.setDescriptionId(id);
|
|
12947
13276
|
return () => {
|
|
12948
13277
|
context.setDescriptionId(void 0);
|
|
12949
13278
|
};
|
|
12950
13279
|
}, [id, context.setDescriptionId]);
|
|
12951
|
-
return /* @__PURE__ */ (0,
|
|
13280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12952
13281
|
"p",
|
|
12953
13282
|
{
|
|
12954
13283
|
...props,
|
|
@@ -12960,24 +13289,24 @@ var DialogDescription = (0, import_react80.forwardRef)(
|
|
|
12960
13289
|
);
|
|
12961
13290
|
}
|
|
12962
13291
|
);
|
|
12963
|
-
var DialogClose = (0,
|
|
13292
|
+
var DialogClose = (0, import_react81.forwardRef)(
|
|
12964
13293
|
({ children, asChild = false, ...props }, propRef) => {
|
|
12965
13294
|
const context = useDialogContext();
|
|
12966
13295
|
const childrenRef = children?.ref;
|
|
12967
|
-
const ref = (0,
|
|
13296
|
+
const ref = (0, import_react80.useMergeRefs)([propRef, childrenRef]);
|
|
12968
13297
|
const handleClick = (event) => {
|
|
12969
13298
|
context.setOpen(false);
|
|
12970
13299
|
props.onClick?.(event);
|
|
12971
13300
|
};
|
|
12972
|
-
if (asChild && (0,
|
|
12973
|
-
return (0,
|
|
13301
|
+
if (asChild && (0, import_react81.isValidElement)(children)) {
|
|
13302
|
+
return (0, import_react81.cloneElement)(children, {
|
|
12974
13303
|
ref,
|
|
12975
13304
|
...props,
|
|
12976
13305
|
...children.props,
|
|
12977
13306
|
onClick: handleClick
|
|
12978
13307
|
});
|
|
12979
13308
|
}
|
|
12980
|
-
return /* @__PURE__ */ (0,
|
|
13309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
12981
13310
|
Button_default,
|
|
12982
13311
|
{
|
|
12983
13312
|
...props,
|
|
@@ -13005,12 +13334,12 @@ var Dialog_default = Dialog;
|
|
|
13005
13334
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
13006
13335
|
var import_browser78 = require("@asgardeo/browser");
|
|
13007
13336
|
var import_css51 = require("@emotion/css");
|
|
13008
|
-
var
|
|
13337
|
+
var import_react83 = require("react");
|
|
13009
13338
|
|
|
13010
13339
|
// src/components/primitives/MultiInput/MultiInput.styles.ts
|
|
13011
13340
|
var import_css50 = require("@emotion/css");
|
|
13012
|
-
var
|
|
13013
|
-
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0,
|
|
13341
|
+
var import_react82 = require("react");
|
|
13342
|
+
var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove) => (0, import_react82.useMemo)(() => {
|
|
13014
13343
|
const container = import_css50.css`
|
|
13015
13344
|
display: flex;
|
|
13016
13345
|
flex-direction: column;
|
|
@@ -13100,7 +13429,7 @@ var useStyles23 = (theme, colorScheme, disabled, hasError, canAddMore, canRemove
|
|
|
13100
13429
|
var MultiInput_styles_default = useStyles23;
|
|
13101
13430
|
|
|
13102
13431
|
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
13103
|
-
var
|
|
13432
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
13104
13433
|
var MultiInput = ({
|
|
13105
13434
|
label,
|
|
13106
13435
|
error,
|
|
@@ -13123,9 +13452,9 @@ var MultiInput = ({
|
|
|
13123
13452
|
const canAddMore = !maxFields || values.length < maxFields;
|
|
13124
13453
|
const canRemove = values.length > minFields;
|
|
13125
13454
|
const styles = MultiInput_styles_default(theme, colorScheme, !!disabled, !!error, canAddMore, canRemove);
|
|
13126
|
-
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0,
|
|
13127
|
-
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0,
|
|
13128
|
-
const handleAddValue = (0,
|
|
13455
|
+
const PlusIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css51.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
13456
|
+
const BinIcon = ({ iconClassName }) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: (0, import_css51.cx)(styles["icon"], iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6" }) });
|
|
13457
|
+
const handleAddValue = (0, import_react83.useCallback)(
|
|
13129
13458
|
(newValue) => {
|
|
13130
13459
|
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
13131
13460
|
onChange([...values, newValue.trim()]);
|
|
@@ -13133,7 +13462,7 @@ var MultiInput = ({
|
|
|
13133
13462
|
},
|
|
13134
13463
|
[values, onChange, maxFields]
|
|
13135
13464
|
);
|
|
13136
|
-
const handleRemoveValue = (0,
|
|
13465
|
+
const handleRemoveValue = (0, import_react83.useCallback)(
|
|
13137
13466
|
(index) => {
|
|
13138
13467
|
if (values.length > minFields) {
|
|
13139
13468
|
const updatedValues = values.filter((_, i) => i !== index);
|
|
@@ -13142,7 +13471,7 @@ var MultiInput = ({
|
|
|
13142
13471
|
},
|
|
13143
13472
|
[values, onChange, minFields]
|
|
13144
13473
|
);
|
|
13145
|
-
const renderInputField = (0,
|
|
13474
|
+
const renderInputField = (0, import_react83.useCallback)(
|
|
13146
13475
|
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
13147
13476
|
const handleInputChange = (e) => {
|
|
13148
13477
|
const newValue = e.target ? e.target.value : e;
|
|
@@ -13168,9 +13497,9 @@ var MultiInput = ({
|
|
|
13168
13497
|
};
|
|
13169
13498
|
switch (fieldType) {
|
|
13170
13499
|
case "DATE_TIME":
|
|
13171
|
-
return /* @__PURE__ */ (0,
|
|
13500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(DatePicker_default, { ...commonProps });
|
|
13172
13501
|
case "BOOLEAN":
|
|
13173
|
-
return /* @__PURE__ */ (0,
|
|
13502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13174
13503
|
Checkbox_default,
|
|
13175
13504
|
{
|
|
13176
13505
|
...commonProps,
|
|
@@ -13179,19 +13508,19 @@ var MultiInput = ({
|
|
|
13179
13508
|
}
|
|
13180
13509
|
);
|
|
13181
13510
|
default:
|
|
13182
|
-
return /* @__PURE__ */ (0,
|
|
13511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(TextField_default, { ...commonProps, type });
|
|
13183
13512
|
}
|
|
13184
13513
|
},
|
|
13185
13514
|
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
13186
13515
|
);
|
|
13187
|
-
const [currentInputValue, setCurrentInputValue] = (0,
|
|
13188
|
-
const handleInputSubmit = (0,
|
|
13516
|
+
const [currentInputValue, setCurrentInputValue] = (0, import_react83.useState)("");
|
|
13517
|
+
const handleInputSubmit = (0, import_react83.useCallback)(() => {
|
|
13189
13518
|
if (currentInputValue.trim() !== "") {
|
|
13190
13519
|
handleAddValue(currentInputValue);
|
|
13191
13520
|
setCurrentInputValue("");
|
|
13192
13521
|
}
|
|
13193
13522
|
}, [currentInputValue, handleAddValue]);
|
|
13194
|
-
return /* @__PURE__ */ (0,
|
|
13523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13195
13524
|
FormControl_default,
|
|
13196
13525
|
{
|
|
13197
13526
|
error,
|
|
@@ -13199,27 +13528,27 @@ var MultiInput = ({
|
|
|
13199
13528
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input")), className),
|
|
13200
13529
|
style,
|
|
13201
13530
|
children: [
|
|
13202
|
-
label && /* @__PURE__ */ (0,
|
|
13203
|
-
/* @__PURE__ */ (0,
|
|
13204
|
-
/* @__PURE__ */ (0,
|
|
13531
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
13532
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "container")), styles["container"]), children: [
|
|
13533
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "input-row")), styles["inputRow"]), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "input-wrapper")), styles["inputWrapper"]), children: renderInputField(
|
|
13205
13534
|
currentInputValue,
|
|
13206
13535
|
setCurrentInputValue,
|
|
13207
|
-
canAddMore ? /* @__PURE__ */ (0,
|
|
13536
|
+
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PlusIcon, { iconClassName: styles["plusIcon"] }) : void 0,
|
|
13208
13537
|
canAddMore ? handleInputSubmit : void 0
|
|
13209
13538
|
) }) }),
|
|
13210
|
-
values.length > 0 && /* @__PURE__ */ (0,
|
|
13539
|
+
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-container")), styles["listContainer"]), children: values.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13211
13540
|
"div",
|
|
13212
13541
|
{
|
|
13213
13542
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-item")), styles["listItem"]),
|
|
13214
13543
|
children: [
|
|
13215
|
-
/* @__PURE__ */ (0,
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13216
13545
|
"span",
|
|
13217
13546
|
{
|
|
13218
13547
|
className: (0, import_css51.cx)((0, import_browser78.withVendorCSSClassPrefix)((0, import_browser78.bem)("multi-input", "list-item-text")), styles["listItemText"]),
|
|
13219
13548
|
children: value
|
|
13220
13549
|
}
|
|
13221
13550
|
),
|
|
13222
|
-
canRemove && /* @__PURE__ */ (0,
|
|
13551
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13223
13552
|
"button",
|
|
13224
13553
|
{
|
|
13225
13554
|
type: "button",
|
|
@@ -13230,7 +13559,7 @@ var MultiInput = ({
|
|
|
13230
13559
|
styles["removeButton"]
|
|
13231
13560
|
),
|
|
13232
13561
|
title: "Remove value",
|
|
13233
|
-
children: /* @__PURE__ */ (0,
|
|
13562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(BinIcon, { iconClassName: styles["icon"] })
|
|
13234
13563
|
}
|
|
13235
13564
|
)
|
|
13236
13565
|
]
|
|
@@ -13245,7 +13574,7 @@ var MultiInput = ({
|
|
|
13245
13574
|
var MultiInput_default = MultiInput;
|
|
13246
13575
|
|
|
13247
13576
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
13248
|
-
var
|
|
13577
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13249
13578
|
var fieldsToSkip = [
|
|
13250
13579
|
"roles.default",
|
|
13251
13580
|
"active",
|
|
@@ -13289,10 +13618,10 @@ var BaseUserProfile = ({
|
|
|
13289
13618
|
displayNameAttributes = []
|
|
13290
13619
|
}) => {
|
|
13291
13620
|
const { theme, colorScheme } = useTheme_default();
|
|
13292
|
-
const [editedUser, setEditedUser] = (0,
|
|
13293
|
-
const [editingFields, setEditingFields] = (0,
|
|
13621
|
+
const [editedUser, setEditedUser] = (0, import_react84.useState)(flattenedProfile || profile);
|
|
13622
|
+
const [editingFields, setEditingFields] = (0, import_react84.useState)({});
|
|
13294
13623
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13295
|
-
const shouldShowField = (0,
|
|
13624
|
+
const shouldShowField = (0, import_react84.useCallback)(
|
|
13296
13625
|
(fieldName) => {
|
|
13297
13626
|
if (fieldsToSkip.includes(fieldName)) {
|
|
13298
13627
|
return false;
|
|
@@ -13307,7 +13636,7 @@ var BaseUserProfile = ({
|
|
|
13307
13636
|
},
|
|
13308
13637
|
[showFields, hideFields]
|
|
13309
13638
|
);
|
|
13310
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
13639
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13311
13640
|
"svg",
|
|
13312
13641
|
{
|
|
13313
13642
|
width: "16",
|
|
@@ -13318,16 +13647,16 @@ var BaseUserProfile = ({
|
|
|
13318
13647
|
strokeWidth: "2",
|
|
13319
13648
|
strokeLinecap: "round",
|
|
13320
13649
|
strokeLinejoin: "round",
|
|
13321
|
-
children: /* @__PURE__ */ (0,
|
|
13650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
13322
13651
|
}
|
|
13323
13652
|
);
|
|
13324
|
-
const toggleFieldEdit = (0,
|
|
13653
|
+
const toggleFieldEdit = (0, import_react84.useCallback)((fieldName) => {
|
|
13325
13654
|
setEditingFields((prev) => ({
|
|
13326
13655
|
...prev,
|
|
13327
13656
|
[fieldName]: !prev[fieldName]
|
|
13328
13657
|
}));
|
|
13329
13658
|
}, []);
|
|
13330
|
-
const getFieldPlaceholder = (0,
|
|
13659
|
+
const getFieldPlaceholder = (0, import_react84.useCallback)((schema) => {
|
|
13331
13660
|
const { type, displayName, description, name } = schema;
|
|
13332
13661
|
const fieldLabel = displayName || description || name || "value";
|
|
13333
13662
|
switch (type) {
|
|
@@ -13341,19 +13670,19 @@ var BaseUserProfile = ({
|
|
|
13341
13670
|
return `Enter your ${fieldLabel.toLowerCase()}`;
|
|
13342
13671
|
}
|
|
13343
13672
|
}, []);
|
|
13344
|
-
const formatLabel = (0,
|
|
13673
|
+
const formatLabel = (0, import_react84.useCallback)(
|
|
13345
13674
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
13346
13675
|
[]
|
|
13347
13676
|
);
|
|
13348
13677
|
const styles = BaseUserProfile_styles_default(theme, colorScheme);
|
|
13349
13678
|
const ObjectDisplay = ({ data }) => {
|
|
13350
13679
|
if (!data || typeof data !== "object") return null;
|
|
13351
|
-
return /* @__PURE__ */ (0,
|
|
13352
|
-
/* @__PURE__ */ (0,
|
|
13680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("table", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("tr", { children: [
|
|
13681
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("td", { className: styles.objectKey, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("strong", { children: [
|
|
13353
13682
|
formatLabel(key),
|
|
13354
13683
|
":"
|
|
13355
13684
|
] }) }),
|
|
13356
|
-
/* @__PURE__ */ (0,
|
|
13685
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("td", { className: styles.objectValue, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
13357
13686
|
] }, key)) }) });
|
|
13358
13687
|
};
|
|
13359
13688
|
function set(obj, path, value) {
|
|
@@ -13371,7 +13700,7 @@ var BaseUserProfile = ({
|
|
|
13371
13700
|
}
|
|
13372
13701
|
}
|
|
13373
13702
|
}
|
|
13374
|
-
const handleFieldSave = (0,
|
|
13703
|
+
const handleFieldSave = (0, import_react84.useCallback)(
|
|
13375
13704
|
(schema) => {
|
|
13376
13705
|
if (!onUpdate || !schema.name) return;
|
|
13377
13706
|
const fieldName = schema.name;
|
|
@@ -13401,7 +13730,7 @@ var BaseUserProfile = ({
|
|
|
13401
13730
|
},
|
|
13402
13731
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
13403
13732
|
);
|
|
13404
|
-
const handleFieldCancel = (0,
|
|
13733
|
+
const handleFieldCancel = (0, import_react84.useCallback)(
|
|
13405
13734
|
(fieldName) => {
|
|
13406
13735
|
const currentUser2 = flattenedProfile || profile;
|
|
13407
13736
|
setEditedUser((prev) => ({
|
|
@@ -13428,7 +13757,7 @@ var BaseUserProfile = ({
|
|
|
13428
13757
|
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
13429
13758
|
const label = displayName || description || name || "";
|
|
13430
13759
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
13431
|
-
return /* @__PURE__ */ (0,
|
|
13760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_jsx_runtime98.Fragment, { children: subAttributes.map((subAttr, index) => {
|
|
13432
13761
|
let displayValue2;
|
|
13433
13762
|
if (Array.isArray(subAttr.value)) {
|
|
13434
13763
|
displayValue2 = subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
|
|
@@ -13437,9 +13766,9 @@ var BaseUserProfile = ({
|
|
|
13437
13766
|
} else {
|
|
13438
13767
|
displayValue2 = String(subAttr.value);
|
|
13439
13768
|
}
|
|
13440
|
-
return /* @__PURE__ */ (0,
|
|
13441
|
-
/* @__PURE__ */ (0,
|
|
13442
|
-
/* @__PURE__ */ (0,
|
|
13769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.field, children: [
|
|
13770
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
13771
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: displayValue2 })
|
|
13443
13772
|
] }, index);
|
|
13444
13773
|
}) });
|
|
13445
13774
|
}
|
|
@@ -13463,9 +13792,9 @@ var BaseUserProfile = ({
|
|
|
13463
13792
|
} else {
|
|
13464
13793
|
fieldValues = [];
|
|
13465
13794
|
}
|
|
13466
|
-
return /* @__PURE__ */ (0,
|
|
13467
|
-
/* @__PURE__ */ (0,
|
|
13468
|
-
/* @__PURE__ */ (0,
|
|
13795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13797
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13469
13798
|
MultiInput_default,
|
|
13470
13799
|
{
|
|
13471
13800
|
values: fieldValues,
|
|
@@ -13496,9 +13825,9 @@ var BaseUserProfile = ({
|
|
|
13496
13825
|
} else {
|
|
13497
13826
|
displayValue2 = "-";
|
|
13498
13827
|
}
|
|
13499
|
-
return /* @__PURE__ */ (0,
|
|
13500
|
-
/* @__PURE__ */ (0,
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13829
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13830
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: (0, import_css52.cx)(styles.value, !hasValues ? styles.valuePlaceholder : ""), children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13502
13831
|
Button_default,
|
|
13503
13832
|
{
|
|
13504
13833
|
onClick: onStartEdit,
|
|
@@ -13513,7 +13842,7 @@ var BaseUserProfile = ({
|
|
|
13513
13842
|
] });
|
|
13514
13843
|
}
|
|
13515
13844
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
13516
|
-
return /* @__PURE__ */ (0,
|
|
13845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value });
|
|
13517
13846
|
}
|
|
13518
13847
|
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
13519
13848
|
let fieldValue;
|
|
@@ -13535,13 +13864,13 @@ var BaseUserProfile = ({
|
|
|
13535
13864
|
let field;
|
|
13536
13865
|
switch (type) {
|
|
13537
13866
|
case "STRING":
|
|
13538
|
-
field = /* @__PURE__ */ (0,
|
|
13867
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(TextField_default, { ...commonProps });
|
|
13539
13868
|
break;
|
|
13540
13869
|
case "DATE_TIME":
|
|
13541
|
-
field = /* @__PURE__ */ (0,
|
|
13870
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(DatePicker_default, { ...commonProps });
|
|
13542
13871
|
break;
|
|
13543
13872
|
case "BOOLEAN":
|
|
13544
|
-
field = /* @__PURE__ */ (0,
|
|
13873
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13545
13874
|
Checkbox_default,
|
|
13546
13875
|
{
|
|
13547
13876
|
...commonProps,
|
|
@@ -13553,7 +13882,7 @@ var BaseUserProfile = ({
|
|
|
13553
13882
|
);
|
|
13554
13883
|
break;
|
|
13555
13884
|
case "COMPLEX":
|
|
13556
|
-
field = /* @__PURE__ */ (0,
|
|
13885
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13557
13886
|
"textarea",
|
|
13558
13887
|
{
|
|
13559
13888
|
value: fieldValue,
|
|
@@ -13565,11 +13894,11 @@ var BaseUserProfile = ({
|
|
|
13565
13894
|
);
|
|
13566
13895
|
break;
|
|
13567
13896
|
default:
|
|
13568
|
-
field = /* @__PURE__ */ (0,
|
|
13897
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(TextField_default, { ...commonProps });
|
|
13569
13898
|
}
|
|
13570
|
-
return /* @__PURE__ */ (0,
|
|
13571
|
-
/* @__PURE__ */ (0,
|
|
13572
|
-
/* @__PURE__ */ (0,
|
|
13899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13900
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13901
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.value, children: field })
|
|
13573
13902
|
] });
|
|
13574
13903
|
}
|
|
13575
13904
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
@@ -13582,9 +13911,9 @@ var BaseUserProfile = ({
|
|
|
13582
13911
|
} else {
|
|
13583
13912
|
displayValue = "-";
|
|
13584
13913
|
}
|
|
13585
|
-
return /* @__PURE__ */ (0,
|
|
13586
|
-
/* @__PURE__ */ (0,
|
|
13587
|
-
/* @__PURE__ */ (0,
|
|
13914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13915
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: styles.label, children: label }),
|
|
13916
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: (0, import_css52.cx)(styles.value, !hasValue ? styles.valuePlaceholder : ""), children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13588
13917
|
Button_default,
|
|
13589
13918
|
{
|
|
13590
13919
|
onClick: onStartEdit,
|
|
@@ -13607,8 +13936,8 @@ var BaseUserProfile = ({
|
|
|
13607
13936
|
if (!shouldShow) {
|
|
13608
13937
|
return null;
|
|
13609
13938
|
}
|
|
13610
|
-
return /* @__PURE__ */ (0,
|
|
13611
|
-
/* @__PURE__ */ (0,
|
|
13939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.field, children: [
|
|
13940
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.fieldInner, children: renderSchemaField(
|
|
13612
13941
|
schema,
|
|
13613
13942
|
isFieldEditing,
|
|
13614
13943
|
(value) => {
|
|
@@ -13618,10 +13947,10 @@ var BaseUserProfile = ({
|
|
|
13618
13947
|
},
|
|
13619
13948
|
() => toggleFieldEdit(schema.name)
|
|
13620
13949
|
) }),
|
|
13621
|
-
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0,
|
|
13622
|
-
isFieldEditing && /* @__PURE__ */ (0,
|
|
13623
|
-
/* @__PURE__ */ (0,
|
|
13624
|
-
/* @__PURE__ */ (0,
|
|
13950
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.fieldActions, children: [
|
|
13951
|
+
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13952
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
13953
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13625
13954
|
Button_default,
|
|
13626
13955
|
{
|
|
13627
13956
|
size: "small",
|
|
@@ -13632,7 +13961,7 @@ var BaseUserProfile = ({
|
|
|
13632
13961
|
}
|
|
13633
13962
|
)
|
|
13634
13963
|
] }),
|
|
13635
|
-
!isFieldEditing && hasValue && /* @__PURE__ */ (0,
|
|
13964
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13636
13965
|
Button_default,
|
|
13637
13966
|
{
|
|
13638
13967
|
size: "small",
|
|
@@ -13641,7 +13970,7 @@ var BaseUserProfile = ({
|
|
|
13641
13970
|
onClick: () => toggleFieldEdit(schema.name),
|
|
13642
13971
|
title: "Edit",
|
|
13643
13972
|
className: styles.editButton,
|
|
13644
|
-
children: /* @__PURE__ */ (0,
|
|
13973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(PencilIcon, {})
|
|
13645
13974
|
}
|
|
13646
13975
|
)
|
|
13647
13976
|
] })
|
|
@@ -13664,9 +13993,9 @@ var BaseUserProfile = ({
|
|
|
13664
13993
|
if (!shouldShowField(key)) return false;
|
|
13665
13994
|
return value !== void 0 && value !== "" && value !== null;
|
|
13666
13995
|
}).sort(([a], [b]) => a.localeCompare(b));
|
|
13667
|
-
return /* @__PURE__ */ (0,
|
|
13668
|
-
/* @__PURE__ */ (0,
|
|
13669
|
-
/* @__PURE__ */ (0,
|
|
13996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
13997
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.profileSummary, children: [
|
|
13998
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13670
13999
|
Avatar,
|
|
13671
14000
|
{
|
|
13672
14001
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -13676,32 +14005,32 @@ var BaseUserProfile = ({
|
|
|
13676
14005
|
isLoading
|
|
13677
14006
|
}
|
|
13678
14007
|
),
|
|
13679
|
-
/* @__PURE__ */ (0,
|
|
13680
|
-
getMappedUserProfileValue_default("email", mergedMappings, currentUser) && /* @__PURE__ */ (0,
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Typography_default, { variant: "h3", fontWeight: "medium", children: displayName }),
|
|
14009
|
+
getMappedUserProfileValue_default("email", mergedMappings, currentUser) && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Typography_default, { variant: "body2", color: "textSecondary", children: getMappedUserProfileValue_default("email", mergedMappings, currentUser) })
|
|
13681
14010
|
] }),
|
|
13682
|
-
/* @__PURE__ */ (0,
|
|
13683
|
-
profileEntries.map(([key, value], index) => /* @__PURE__ */ (0,
|
|
13684
|
-
/* @__PURE__ */ (0,
|
|
13685
|
-
/* @__PURE__ */ (0,
|
|
13686
|
-
/* @__PURE__ */ (0,
|
|
14011
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Divider_default, {}),
|
|
14012
|
+
profileEntries.map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
|
|
14013
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: styles.sectionRow, children: [
|
|
14014
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.sectionLabel, children: formatLabel(key) }),
|
|
14015
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.sectionValue, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
13687
14016
|
] }),
|
|
13688
|
-
index < profileEntries.length - 1 && /* @__PURE__ */ (0,
|
|
14017
|
+
index < profileEntries.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Divider_default, {})
|
|
13689
14018
|
] }, key))
|
|
13690
14019
|
] });
|
|
13691
14020
|
};
|
|
13692
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
13693
|
-
error && /* @__PURE__ */ (0,
|
|
14021
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Card_default, { className: containerClasses, children: [
|
|
14022
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
13694
14023
|
Alert_default,
|
|
13695
14024
|
{
|
|
13696
14025
|
variant: "error",
|
|
13697
14026
|
className: (0, import_css52.cx)((0, import_browser79.withVendorCSSClassPrefix)((0, import_browser79.bem)("user-profile", "alert")), styles.alert),
|
|
13698
14027
|
children: [
|
|
13699
|
-
/* @__PURE__ */ (0,
|
|
13700
|
-
/* @__PURE__ */ (0,
|
|
14028
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Alert_default.Title, { children: t("errors.heading") || "Error" }),
|
|
14029
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Alert_default.Description, { children: error })
|
|
13701
14030
|
]
|
|
13702
14031
|
}
|
|
13703
14032
|
),
|
|
13704
|
-
schemas && schemas.length > 0 && /* @__PURE__ */ (0,
|
|
14033
|
+
schemas && schemas.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13705
14034
|
Avatar,
|
|
13706
14035
|
{
|
|
13707
14036
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -13711,7 +14040,7 @@ var BaseUserProfile = ({
|
|
|
13711
14040
|
isLoading
|
|
13712
14041
|
}
|
|
13713
14042
|
) }),
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.infoContainer, children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
|
|
13715
14044
|
if (!schema.name || !shouldShowField(schema.name)) return false;
|
|
13716
14045
|
if (!editable) {
|
|
13717
14046
|
const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
|
|
@@ -13728,13 +14057,13 @@ var BaseUserProfile = ({
|
|
|
13728
14057
|
...schema,
|
|
13729
14058
|
value
|
|
13730
14059
|
};
|
|
13731
|
-
return /* @__PURE__ */ (0,
|
|
14060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.info, children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
13732
14061
|
}) : renderProfileWithoutSchemas() })
|
|
13733
14062
|
] });
|
|
13734
14063
|
if (mode === "popup") {
|
|
13735
|
-
return /* @__PURE__ */ (0,
|
|
13736
|
-
/* @__PURE__ */ (0,
|
|
13737
|
-
/* @__PURE__ */ (0,
|
|
14064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Dialog_default.Content, { children: [
|
|
14065
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Dialog_default.Heading, { children: title ?? t("user.profile.heading") }),
|
|
14066
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: styles.popup, children: profileContent })
|
|
13738
14067
|
] }) });
|
|
13739
14068
|
}
|
|
13740
14069
|
return profileContent;
|
|
@@ -13743,7 +14072,7 @@ var BaseUserProfile_default = BaseUserProfile;
|
|
|
13743
14072
|
|
|
13744
14073
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
13745
14074
|
var import_browser81 = require("@asgardeo/browser");
|
|
13746
|
-
var
|
|
14075
|
+
var import_react85 = require("react");
|
|
13747
14076
|
|
|
13748
14077
|
// src/api/updateMeProfile.ts
|
|
13749
14078
|
var import_browser80 = require("@asgardeo/browser");
|
|
@@ -13773,12 +14102,12 @@ var updateMeProfile = async ({ fetcher, instanceId = 0, ...requestConfig }) => {
|
|
|
13773
14102
|
var updateMeProfile_default = updateMeProfile;
|
|
13774
14103
|
|
|
13775
14104
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
13776
|
-
var
|
|
14105
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13777
14106
|
var UserProfile3 = ({ preferences, ...rest }) => {
|
|
13778
14107
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
13779
14108
|
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
13780
14109
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
13781
|
-
const [error, setError] = (0,
|
|
14110
|
+
const [error, setError] = (0, import_react85.useState)(null);
|
|
13782
14111
|
const handleProfileUpdate = async (payload) => {
|
|
13783
14112
|
setError(null);
|
|
13784
14113
|
try {
|
|
@@ -13792,7 +14121,7 @@ var UserProfile3 = ({ preferences, ...rest }) => {
|
|
|
13792
14121
|
setError(message);
|
|
13793
14122
|
}
|
|
13794
14123
|
};
|
|
13795
|
-
return /* @__PURE__ */ (0,
|
|
14124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
13796
14125
|
BaseUserProfile_default,
|
|
13797
14126
|
{
|
|
13798
14127
|
profile,
|
|
@@ -13810,13 +14139,13 @@ var UserProfile_default = UserProfile3;
|
|
|
13810
14139
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
13811
14140
|
var import_browser82 = require("@asgardeo/browser");
|
|
13812
14141
|
var import_css54 = require("@emotion/css");
|
|
13813
|
-
var
|
|
13814
|
-
var
|
|
14142
|
+
var import_react87 = require("@floating-ui/react");
|
|
14143
|
+
var import_react88 = require("react");
|
|
13815
14144
|
|
|
13816
14145
|
// src/components/presentation/UserDropdown/BaseUserDropdown.styles.ts
|
|
13817
14146
|
var import_css53 = require("@emotion/css");
|
|
13818
|
-
var
|
|
13819
|
-
var useStyles24 = (theme, colorScheme) => (0,
|
|
14147
|
+
var import_react86 = require("react");
|
|
14148
|
+
var useStyles24 = (theme, colorScheme) => (0, import_react86.useMemo)(() => {
|
|
13820
14149
|
const trigger = import_css53.css`
|
|
13821
14150
|
display: inline-flex;
|
|
13822
14151
|
align-items: center;
|
|
@@ -14003,7 +14332,7 @@ var useStyles24 = (theme, colorScheme) => (0, import_react85.useMemo)(() => {
|
|
|
14003
14332
|
var BaseUserDropdown_styles_default = useStyles24;
|
|
14004
14333
|
|
|
14005
14334
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
14006
|
-
var
|
|
14335
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
14007
14336
|
var BaseUserDropdown = ({
|
|
14008
14337
|
fallback = null,
|
|
14009
14338
|
className = "",
|
|
@@ -14019,19 +14348,19 @@ var BaseUserDropdown = ({
|
|
|
14019
14348
|
}) => {
|
|
14020
14349
|
const { theme, colorScheme } = useTheme_default();
|
|
14021
14350
|
const styles = BaseUserDropdown_styles_default(theme, colorScheme);
|
|
14022
|
-
const [isOpen, setIsOpen] = (0,
|
|
14023
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
14024
|
-
const { refs, floatingStyles, context } = (0,
|
|
14025
|
-
middleware: [(0,
|
|
14351
|
+
const [isOpen, setIsOpen] = (0, import_react88.useState)(false);
|
|
14352
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react88.useState)(null);
|
|
14353
|
+
const { refs, floatingStyles, context } = (0, import_react87.useFloating)({
|
|
14354
|
+
middleware: [(0, import_react87.offset)(5), (0, import_react87.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react87.shift)({ padding: 5 })],
|
|
14026
14355
|
onOpenChange: setIsOpen,
|
|
14027
14356
|
open: isOpen,
|
|
14028
14357
|
placement: "bottom-end",
|
|
14029
|
-
whileElementsMounted:
|
|
14358
|
+
whileElementsMounted: import_react87.autoUpdate
|
|
14030
14359
|
});
|
|
14031
|
-
const click = (0,
|
|
14032
|
-
const dismiss = (0,
|
|
14033
|
-
const role = (0,
|
|
14034
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
14360
|
+
const click = (0, import_react87.useClick)(context);
|
|
14361
|
+
const dismiss = (0, import_react87.useDismiss)(context);
|
|
14362
|
+
const role = (0, import_react87.useRole)(context);
|
|
14363
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react87.useInteractions)([click, dismiss, role]);
|
|
14035
14364
|
const defaultAttributeMappings = {
|
|
14036
14365
|
email: ["emails"],
|
|
14037
14366
|
firstName: ["name.givenName", "given_name"],
|
|
@@ -14055,14 +14384,14 @@ var BaseUserDropdown = ({
|
|
|
14055
14384
|
const defaultMenuItems = [];
|
|
14056
14385
|
if (onManageProfile) {
|
|
14057
14386
|
defaultMenuItems.push({
|
|
14058
|
-
icon: /* @__PURE__ */ (0,
|
|
14387
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(User_default2, { width: "16", height: "16" }),
|
|
14059
14388
|
label: "Manage Profile",
|
|
14060
14389
|
onClick: onManageProfile
|
|
14061
14390
|
});
|
|
14062
14391
|
}
|
|
14063
14392
|
if (onSignOut) {
|
|
14064
14393
|
defaultMenuItems.push({
|
|
14065
|
-
icon: /* @__PURE__ */ (0,
|
|
14394
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LogOut_default, { width: "16", height: "16" }),
|
|
14066
14395
|
label: "Sign Out",
|
|
14067
14396
|
onClick: onSignOut
|
|
14068
14397
|
});
|
|
@@ -14074,8 +14403,8 @@ var BaseUserDropdown = ({
|
|
|
14074
14403
|
}
|
|
14075
14404
|
allMenuItems.push(...defaultMenuItems);
|
|
14076
14405
|
}
|
|
14077
|
-
return /* @__PURE__ */ (0,
|
|
14078
|
-
/* @__PURE__ */ (0,
|
|
14406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
14407
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14079
14408
|
Button_default,
|
|
14080
14409
|
{
|
|
14081
14410
|
ref: refs.setReference,
|
|
@@ -14086,7 +14415,7 @@ var BaseUserDropdown = ({
|
|
|
14086
14415
|
"data-testid": "asgardeo-user-dropdown-trigger",
|
|
14087
14416
|
...getReferenceProps(),
|
|
14088
14417
|
children: [
|
|
14089
|
-
/* @__PURE__ */ (0,
|
|
14418
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14090
14419
|
Avatar,
|
|
14091
14420
|
{
|
|
14092
14421
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -14095,7 +14424,7 @@ var BaseUserDropdown = ({
|
|
|
14095
14424
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
14096
14425
|
}
|
|
14097
14426
|
),
|
|
14098
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14427
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14099
14428
|
Typography_default,
|
|
14100
14429
|
{
|
|
14101
14430
|
variant: "body2",
|
|
@@ -14106,7 +14435,7 @@ var BaseUserDropdown = ({
|
|
|
14106
14435
|
]
|
|
14107
14436
|
}
|
|
14108
14437
|
),
|
|
14109
|
-
isOpen && /* @__PURE__ */ (0,
|
|
14438
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react87.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react87.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14110
14439
|
"div",
|
|
14111
14440
|
{
|
|
14112
14441
|
ref: refs.setFloating,
|
|
@@ -14119,8 +14448,8 @@ var BaseUserDropdown = ({
|
|
|
14119
14448
|
},
|
|
14120
14449
|
...getFloatingProps(),
|
|
14121
14450
|
children: [
|
|
14122
|
-
/* @__PURE__ */ (0,
|
|
14123
|
-
/* @__PURE__ */ (0,
|
|
14451
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__header"), styles["dropdownHeader"]), children: [
|
|
14452
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14124
14453
|
Avatar,
|
|
14125
14454
|
{
|
|
14126
14455
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -14129,8 +14458,8 @@ var BaseUserDropdown = ({
|
|
|
14129
14458
|
alt: `${getDisplayName_default(mergedMappings, user)}'s avatar`
|
|
14130
14459
|
}
|
|
14131
14460
|
),
|
|
14132
|
-
/* @__PURE__ */ (0,
|
|
14133
|
-
/* @__PURE__ */ (0,
|
|
14461
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__header-info"), styles["headerInfo"]), children: [
|
|
14462
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14134
14463
|
Typography_default,
|
|
14135
14464
|
{
|
|
14136
14465
|
noWrap: true,
|
|
@@ -14140,7 +14469,7 @@ var BaseUserDropdown = ({
|
|
|
14140
14469
|
children: getDisplayName_default(mergedMappings, user)
|
|
14141
14470
|
}
|
|
14142
14471
|
),
|
|
14143
|
-
/* @__PURE__ */ (0,
|
|
14472
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14144
14473
|
Typography_default,
|
|
14145
14474
|
{
|
|
14146
14475
|
noWrap: true,
|
|
@@ -14152,9 +14481,9 @@ var BaseUserDropdown = ({
|
|
|
14152
14481
|
)
|
|
14153
14482
|
] })
|
|
14154
14483
|
] }),
|
|
14155
|
-
/* @__PURE__ */ (0,
|
|
14484
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__menu"), styles["dropdownMenu"]), children: allMenuItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { children: (() => {
|
|
14156
14485
|
if (item.label === "") {
|
|
14157
|
-
return /* @__PURE__ */ (0,
|
|
14486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14158
14487
|
"div",
|
|
14159
14488
|
{
|
|
14160
14489
|
className: (0, import_css54.cx)((0, import_browser82.withVendorCSSClassPrefix)("user-dropdown__menu-divider"), styles["divider"])
|
|
@@ -14162,7 +14491,7 @@ var BaseUserDropdown = ({
|
|
|
14162
14491
|
);
|
|
14163
14492
|
}
|
|
14164
14493
|
if (item.href) {
|
|
14165
|
-
return /* @__PURE__ */ (0,
|
|
14494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
14166
14495
|
"a",
|
|
14167
14496
|
{
|
|
14168
14497
|
href: item.href,
|
|
@@ -14179,12 +14508,12 @@ var BaseUserDropdown = ({
|
|
|
14179
14508
|
onBlur: () => setHoveredItemIndex(null),
|
|
14180
14509
|
children: [
|
|
14181
14510
|
item.icon,
|
|
14182
|
-
/* @__PURE__ */ (0,
|
|
14511
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: item.label })
|
|
14183
14512
|
]
|
|
14184
14513
|
}
|
|
14185
14514
|
);
|
|
14186
14515
|
}
|
|
14187
|
-
return /* @__PURE__ */ (0,
|
|
14516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14188
14517
|
Button_default,
|
|
14189
14518
|
{
|
|
14190
14519
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -14210,8 +14539,8 @@ var BaseUserDropdown = ({
|
|
|
14210
14539
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
14211
14540
|
|
|
14212
14541
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
14213
|
-
var
|
|
14214
|
-
var
|
|
14542
|
+
var import_react89 = require("react");
|
|
14543
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
14215
14544
|
var UserDropdown = ({
|
|
14216
14545
|
children,
|
|
14217
14546
|
renderTrigger,
|
|
@@ -14220,7 +14549,7 @@ var UserDropdown = ({
|
|
|
14220
14549
|
...rest
|
|
14221
14550
|
}) => {
|
|
14222
14551
|
const { user, isLoading, signOut, meta } = useAsgardeo_default();
|
|
14223
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
14552
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react89.useState)(false);
|
|
14224
14553
|
const handleManageProfile = () => {
|
|
14225
14554
|
setIsProfileOpen(true);
|
|
14226
14555
|
};
|
|
@@ -14243,14 +14572,14 @@ var UserDropdown = ({
|
|
|
14243
14572
|
user
|
|
14244
14573
|
};
|
|
14245
14574
|
if (children) {
|
|
14246
|
-
return /* @__PURE__ */ (0,
|
|
14575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14247
14576
|
children(renderProps),
|
|
14248
|
-
/* @__PURE__ */ (0,
|
|
14577
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14249
14578
|
] });
|
|
14250
14579
|
}
|
|
14251
14580
|
if (renderTrigger || renderDropdown) {
|
|
14252
|
-
return /* @__PURE__ */ (0,
|
|
14253
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0,
|
|
14581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14582
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14254
14583
|
BaseUserDropdown,
|
|
14255
14584
|
{
|
|
14256
14585
|
user,
|
|
@@ -14260,11 +14589,11 @@ var UserDropdown = ({
|
|
|
14260
14589
|
...rest
|
|
14261
14590
|
}
|
|
14262
14591
|
),
|
|
14263
|
-
/* @__PURE__ */ (0,
|
|
14592
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14264
14593
|
] });
|
|
14265
14594
|
}
|
|
14266
|
-
return /* @__PURE__ */ (0,
|
|
14267
|
-
/* @__PURE__ */ (0,
|
|
14595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
14596
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14268
14597
|
BaseUserDropdown,
|
|
14269
14598
|
{
|
|
14270
14599
|
user,
|
|
@@ -14274,20 +14603,20 @@ var UserDropdown = ({
|
|
|
14274
14603
|
...rest
|
|
14275
14604
|
}
|
|
14276
14605
|
),
|
|
14277
|
-
isProfileOpen && /* @__PURE__ */ (0,
|
|
14606
|
+
isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
14278
14607
|
] });
|
|
14279
14608
|
};
|
|
14280
14609
|
var UserDropdown_default = UserDropdown;
|
|
14281
14610
|
|
|
14282
14611
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
14283
14612
|
var import_css56 = require("@emotion/css");
|
|
14284
|
-
var
|
|
14285
|
-
var
|
|
14613
|
+
var import_react91 = require("@floating-ui/react");
|
|
14614
|
+
var import_react92 = require("react");
|
|
14286
14615
|
|
|
14287
14616
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.styles.ts
|
|
14288
14617
|
var import_css55 = require("@emotion/css");
|
|
14289
|
-
var
|
|
14290
|
-
var useStyles25 = (theme, colorScheme) => (0,
|
|
14618
|
+
var import_react90 = require("react");
|
|
14619
|
+
var useStyles25 = (theme, colorScheme) => (0, import_react90.useMemo)(() => {
|
|
14291
14620
|
const root = import_css55.css`
|
|
14292
14621
|
display: inline-block;
|
|
14293
14622
|
position: relative;
|
|
@@ -14510,9 +14839,9 @@ var useStyles25 = (theme, colorScheme) => (0, import_react89.useMemo)(() => {
|
|
|
14510
14839
|
var BaseOrganizationSwitcher_styles_default = useStyles25;
|
|
14511
14840
|
|
|
14512
14841
|
// src/components/primitives/Icons/Building.tsx
|
|
14513
|
-
var
|
|
14514
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14515
|
-
/* @__PURE__ */ (0,
|
|
14842
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
14843
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
14844
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
14516
14845
|
"path",
|
|
14517
14846
|
{
|
|
14518
14847
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -14522,30 +14851,30 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
14522
14851
|
strokeLinejoin: "round"
|
|
14523
14852
|
}
|
|
14524
14853
|
),
|
|
14525
|
-
/* @__PURE__ */ (0,
|
|
14526
|
-
/* @__PURE__ */ (0,
|
|
14527
|
-
/* @__PURE__ */ (0,
|
|
14528
|
-
/* @__PURE__ */ (0,
|
|
14529
|
-
/* @__PURE__ */ (0,
|
|
14530
|
-
/* @__PURE__ */ (0,
|
|
14854
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14855
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14856
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14857
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14858
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
14859
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
14531
14860
|
] });
|
|
14532
14861
|
Building.displayName = "Building";
|
|
14533
14862
|
var Building_default = Building;
|
|
14534
14863
|
|
|
14535
14864
|
// src/components/primitives/Icons/Check.tsx
|
|
14536
|
-
var
|
|
14537
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14865
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
14866
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
14538
14867
|
Check.displayName = "Check";
|
|
14539
14868
|
var Check_default = Check;
|
|
14540
14869
|
|
|
14541
14870
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
14542
|
-
var
|
|
14543
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
14871
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
14872
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
14544
14873
|
ChevronDown.displayName = "ChevronDown";
|
|
14545
14874
|
var ChevronDown_default = ChevronDown;
|
|
14546
14875
|
|
|
14547
14876
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
14548
|
-
var
|
|
14877
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
14549
14878
|
var BaseOrganizationSwitcher = ({
|
|
14550
14879
|
organizations,
|
|
14551
14880
|
currentOrganization,
|
|
@@ -14569,21 +14898,21 @@ var BaseOrganizationSwitcher = ({
|
|
|
14569
14898
|
}) => {
|
|
14570
14899
|
const { theme, colorScheme, direction } = useTheme_default();
|
|
14571
14900
|
const styles = BaseOrganizationSwitcher_styles_default(theme, colorScheme);
|
|
14572
|
-
const [isOpen, setIsOpen] = (0,
|
|
14573
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
14901
|
+
const [isOpen, setIsOpen] = (0, import_react92.useState)(false);
|
|
14902
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react92.useState)(null);
|
|
14574
14903
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
14575
14904
|
const isRTL = direction === "rtl";
|
|
14576
|
-
const { refs, floatingStyles, context } = (0,
|
|
14577
|
-
middleware: [(0,
|
|
14905
|
+
const { refs, floatingStyles, context } = (0, import_react91.useFloating)({
|
|
14906
|
+
middleware: [(0, import_react91.offset)(5), (0, import_react91.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react91.shift)({ padding: 5 })],
|
|
14578
14907
|
onOpenChange: setIsOpen,
|
|
14579
14908
|
open: isOpen,
|
|
14580
14909
|
placement: "bottom-end",
|
|
14581
|
-
whileElementsMounted:
|
|
14910
|
+
whileElementsMounted: import_react91.autoUpdate
|
|
14582
14911
|
});
|
|
14583
|
-
const click = (0,
|
|
14584
|
-
const dismiss = (0,
|
|
14585
|
-
const role = (0,
|
|
14586
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
14912
|
+
const click = (0, import_react91.useClick)(context);
|
|
14913
|
+
const dismiss = (0, import_react91.useDismiss)(context);
|
|
14914
|
+
const role = (0, import_react91.useRole)(context);
|
|
14915
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react91.useInteractions)([click, dismiss, role]);
|
|
14587
14916
|
if (fallback && !currentOrganization && !loading && organizations.length === 0) {
|
|
14588
14917
|
return fallback;
|
|
14589
14918
|
}
|
|
@@ -14600,8 +14929,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14600
14929
|
const switchableOrganizations = organizations.filter(
|
|
14601
14930
|
(org) => org.id !== currentOrganization?.id
|
|
14602
14931
|
);
|
|
14603
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0,
|
|
14604
|
-
/* @__PURE__ */ (0,
|
|
14932
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14933
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14605
14934
|
Avatar,
|
|
14606
14935
|
{
|
|
14607
14936
|
variant: "square",
|
|
@@ -14611,24 +14940,24 @@ var BaseOrganizationSwitcher = ({
|
|
|
14611
14940
|
alt: `${organization.name} avatar`
|
|
14612
14941
|
}
|
|
14613
14942
|
),
|
|
14614
|
-
/* @__PURE__ */ (0,
|
|
14615
|
-
/* @__PURE__ */ (0,
|
|
14616
|
-
/* @__PURE__ */ (0,
|
|
14617
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
14943
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["organizationInfo"]), children: [
|
|
14944
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", fontWeight: "medium", className: (0, import_css56.cx)(styles["organizationName"]), children: organization.name }),
|
|
14945
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["organizationMeta"]), children: [
|
|
14946
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("span", { children: [
|
|
14618
14947
|
organization.memberCount,
|
|
14619
14948
|
" ",
|
|
14620
14949
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
14621
14950
|
] }),
|
|
14622
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
14623
|
-
showRole && organization.role && /* @__PURE__ */ (0,
|
|
14951
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: " \u2022 " }),
|
|
14952
|
+
showRole && organization.role && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { className: (0, import_css56.cx)(styles["roleCapitalized"]), children: organization.role })
|
|
14624
14953
|
] })
|
|
14625
14954
|
] }),
|
|
14626
|
-
isSelected && /* @__PURE__ */ (0,
|
|
14955
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Check_default, { width: "16", height: "16", color: theme.vars.colors.text.primary })
|
|
14627
14956
|
] });
|
|
14628
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */ (0,
|
|
14629
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0,
|
|
14630
|
-
return /* @__PURE__ */ (0,
|
|
14631
|
-
/* @__PURE__ */ (0,
|
|
14957
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["loadingContainer"]), children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", className: (0, import_css56.cx)(styles["loadingText"]), children: t("organization.switcher.loading.placeholder.organizations") }) });
|
|
14958
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["errorContainer"]), children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", className: (0, import_css56.cx)(styles["errorText"]), children: errorMessage }) });
|
|
14959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["root"], className), style, children: [
|
|
14960
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14632
14961
|
Button_default,
|
|
14633
14962
|
{
|
|
14634
14963
|
ref: refs.setReference,
|
|
@@ -14638,8 +14967,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14638
14967
|
size: "medium",
|
|
14639
14968
|
...getReferenceProps(),
|
|
14640
14969
|
children: [
|
|
14641
|
-
currentOrganization ? /* @__PURE__ */ (0,
|
|
14642
|
-
/* @__PURE__ */ (0,
|
|
14970
|
+
currentOrganization ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14971
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14643
14972
|
Avatar,
|
|
14644
14973
|
{
|
|
14645
14974
|
variant: "square",
|
|
@@ -14649,16 +14978,16 @@ var BaseOrganizationSwitcher = ({
|
|
|
14649
14978
|
alt: `${currentOrganization.name} avatar`
|
|
14650
14979
|
}
|
|
14651
14980
|
),
|
|
14652
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14653
|
-
] }) : /* @__PURE__ */ (0,
|
|
14654
|
-
/* @__PURE__ */ (0,
|
|
14655
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
14981
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", className: (0, import_css56.cx)(styles["triggerLabel"]), children: currentOrganization.name })
|
|
14982
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14983
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Building_default, { width: avatarSize, height: avatarSize }),
|
|
14984
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "body2", className: (0, import_css56.cx)(styles["triggerLabel"]), children: t("elements.fields.organization.select.label") })
|
|
14656
14985
|
] }),
|
|
14657
|
-
/* @__PURE__ */ (0,
|
|
14986
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { style: { display: "inline-flex", transform: isRTL ? "scaleX(-1)" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ChevronDown_default, { width: "16", height: "16" }) })
|
|
14658
14987
|
]
|
|
14659
14988
|
}
|
|
14660
14989
|
),
|
|
14661
|
-
isOpen && /* @__PURE__ */ (0,
|
|
14990
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_react91.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_react91.FloatingFocusManager, { context, modal: false, initialFocus: -1, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14662
14991
|
"div",
|
|
14663
14992
|
{
|
|
14664
14993
|
ref: refs.setFloating,
|
|
@@ -14666,8 +14995,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14666
14995
|
style: floatingStyles,
|
|
14667
14996
|
...getFloatingProps(),
|
|
14668
14997
|
children: [
|
|
14669
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
14670
|
-
/* @__PURE__ */ (0,
|
|
14998
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["header"]), children: [
|
|
14999
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14671
15000
|
Avatar,
|
|
14672
15001
|
{
|
|
14673
15002
|
variant: "square",
|
|
@@ -14677,10 +15006,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14677
15006
|
alt: `${currentOrganization.name} avatar`
|
|
14678
15007
|
}
|
|
14679
15008
|
),
|
|
14680
|
-
/* @__PURE__ */ (0,
|
|
14681
|
-
/* @__PURE__ */ (0,
|
|
14682
|
-
/* @__PURE__ */ (0,
|
|
14683
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
15009
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["headerInfo"]), children: [
|
|
15010
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { noWrap: true, className: (0, import_css56.cx)(styles["headerName"]), variant: "body1", fontWeight: "medium", children: currentOrganization.name }),
|
|
15011
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: (0, import_css56.cx)(styles["headerMeta"]), children: [
|
|
15012
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14684
15013
|
Typography_default,
|
|
14685
15014
|
{
|
|
14686
15015
|
noWrap: true,
|
|
@@ -14690,17 +15019,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
14690
15019
|
currentOrganization.memberCount,
|
|
14691
15020
|
" ",
|
|
14692
15021
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
14693
|
-
showRole && currentOrganization.role && /* @__PURE__ */ (0,
|
|
15022
|
+
showRole && currentOrganization.role && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("span", { children: [
|
|
14694
15023
|
" \u2022 ",
|
|
14695
15024
|
currentOrganization.role
|
|
14696
15025
|
] })
|
|
14697
15026
|
]
|
|
14698
15027
|
}
|
|
14699
15028
|
),
|
|
14700
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0,
|
|
15029
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { noWrap: true, className: (0, import_css56.cx)(styles["headerRole"]), variant: "caption", color: "secondary", children: currentOrganization.role })
|
|
14701
15030
|
] })
|
|
14702
15031
|
] }),
|
|
14703
|
-
onManageProfile && /* @__PURE__ */ (0,
|
|
15032
|
+
onManageProfile && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14704
15033
|
Button_default,
|
|
14705
15034
|
{
|
|
14706
15035
|
onClick: onManageProfile,
|
|
@@ -14709,7 +15038,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
14709
15038
|
size: "small",
|
|
14710
15039
|
"aria-label": "Manage Organization Profile",
|
|
14711
15040
|
className: (0, import_css56.cx)(styles["manageButton"]),
|
|
14712
|
-
endIcon: /* @__PURE__ */ (0,
|
|
15041
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14713
15042
|
"svg",
|
|
14714
15043
|
{
|
|
14715
15044
|
width: "16",
|
|
@@ -14721,8 +15050,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
14721
15050
|
strokeLinecap: "round",
|
|
14722
15051
|
strokeLinejoin: "round",
|
|
14723
15052
|
children: [
|
|
14724
|
-
/* @__PURE__ */ (0,
|
|
14725
|
-
/* @__PURE__ */ (0,
|
|
15053
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
15054
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
14726
15055
|
]
|
|
14727
15056
|
}
|
|
14728
15057
|
),
|
|
@@ -14730,27 +15059,27 @@ var BaseOrganizationSwitcher = ({
|
|
|
14730
15059
|
}
|
|
14731
15060
|
)
|
|
14732
15061
|
] }),
|
|
14733
|
-
organizations.length > 1 && /* @__PURE__ */ (0,
|
|
15062
|
+
organizations.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14734
15063
|
"div",
|
|
14735
15064
|
{
|
|
14736
15065
|
className: (0, import_css56.cx)(styles["header"], styles["sectionHeaderContainer"]),
|
|
14737
15066
|
style: {
|
|
14738
15067
|
borderTop: currentOrganization ? `1px solid ${theme.vars.colors.border}` : "none"
|
|
14739
15068
|
},
|
|
14740
|
-
children: /* @__PURE__ */ (0,
|
|
15069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Typography_default, { variant: "caption", fontWeight: 600, className: (0, import_css56.cx)(styles["sectionHeader"]), children: t("organization.switcher.switch.organization") })
|
|
14741
15070
|
}
|
|
14742
15071
|
),
|
|
14743
|
-
/* @__PURE__ */ (0,
|
|
15072
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["menu"]), children: (() => {
|
|
14744
15073
|
if (loading) {
|
|
14745
15074
|
return renderLoading ? renderLoading() : defaultRenderLoading2();
|
|
14746
15075
|
}
|
|
14747
15076
|
if (error) {
|
|
14748
15077
|
return renderError ? renderError(error) : defaultRenderError2(error);
|
|
14749
15078
|
}
|
|
14750
|
-
return /* @__PURE__ */ (0,
|
|
15079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
14751
15080
|
switchableOrganizations.map((organization) => {
|
|
14752
15081
|
const isSelected = false;
|
|
14753
|
-
return /* @__PURE__ */ (0,
|
|
15082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14754
15083
|
Button_default,
|
|
14755
15084
|
{
|
|
14756
15085
|
onClick: () => handleOrganizationSwitch(organization),
|
|
@@ -14768,10 +15097,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14768
15097
|
organization.id
|
|
14769
15098
|
);
|
|
14770
15099
|
}),
|
|
14771
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
14772
|
-
/* @__PURE__ */ (0,
|
|
15100
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
15101
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: (0, import_css56.cx)(styles["menuDivider"]) }),
|
|
14773
15102
|
menuItems.map(
|
|
14774
|
-
(item, index) => /* @__PURE__ */ (0,
|
|
15103
|
+
(item, index) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
14775
15104
|
"a",
|
|
14776
15105
|
{
|
|
14777
15106
|
href: item.href,
|
|
@@ -14785,10 +15114,10 @@ var BaseOrganizationSwitcher = ({
|
|
|
14785
15114
|
onBlur: () => setHoveredItemIndex(null),
|
|
14786
15115
|
children: [
|
|
14787
15116
|
item.icon,
|
|
14788
|
-
/* @__PURE__ */ (0,
|
|
15117
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: item.label })
|
|
14789
15118
|
]
|
|
14790
15119
|
}
|
|
14791
|
-
) : /* @__PURE__ */ (0,
|
|
15120
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
14792
15121
|
Button_default,
|
|
14793
15122
|
{
|
|
14794
15123
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -14817,11 +15146,11 @@ var BaseOrganizationSwitcher = ({
|
|
|
14817
15146
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
14818
15147
|
|
|
14819
15148
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
14820
|
-
var
|
|
15149
|
+
var import_react105 = require("react");
|
|
14821
15150
|
|
|
14822
15151
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
14823
|
-
var
|
|
14824
|
-
var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
15152
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
15153
|
+
var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
|
|
14825
15154
|
"svg",
|
|
14826
15155
|
{
|
|
14827
15156
|
width,
|
|
@@ -14834,13 +15163,13 @@ var BuildingAlt = ({ height = 24, width = 24 }) => /* @__PURE__ */ (0, import_js
|
|
|
14834
15163
|
strokeLinecap: "round",
|
|
14835
15164
|
strokeLinejoin: "round",
|
|
14836
15165
|
children: [
|
|
14837
|
-
/* @__PURE__ */ (0,
|
|
14838
|
-
/* @__PURE__ */ (0,
|
|
14839
|
-
/* @__PURE__ */ (0,
|
|
14840
|
-
/* @__PURE__ */ (0,
|
|
14841
|
-
/* @__PURE__ */ (0,
|
|
14842
|
-
/* @__PURE__ */ (0,
|
|
14843
|
-
/* @__PURE__ */ (0,
|
|
15166
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
15168
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
15169
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 6h4" }),
|
|
15170
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 10h4" }),
|
|
15171
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 14h4" }),
|
|
15172
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("path", { d: "M10 18h4" })
|
|
14844
15173
|
]
|
|
14845
15174
|
}
|
|
14846
15175
|
);
|
|
@@ -14848,17 +15177,17 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
14848
15177
|
var BuildingAlt_default = BuildingAlt;
|
|
14849
15178
|
|
|
14850
15179
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
14851
|
-
var
|
|
15180
|
+
var import_react95 = require("react");
|
|
14852
15181
|
|
|
14853
15182
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
14854
15183
|
var import_browser83 = require("@asgardeo/browser");
|
|
14855
15184
|
var import_css58 = require("@emotion/css");
|
|
14856
|
-
var
|
|
15185
|
+
var import_react94 = require("react");
|
|
14857
15186
|
|
|
14858
15187
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.styles.ts
|
|
14859
15188
|
var import_css57 = require("@emotion/css");
|
|
14860
|
-
var
|
|
14861
|
-
var useStyles26 = (theme, colorScheme) => (0,
|
|
15189
|
+
var import_react93 = require("react");
|
|
15190
|
+
var useStyles26 = (theme, colorScheme) => (0, import_react93.useMemo)(() => {
|
|
14862
15191
|
const root = import_css57.css`
|
|
14863
15192
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
14864
15193
|
min-width: 600px;
|
|
@@ -14994,7 +15323,7 @@ var useStyles26 = (theme, colorScheme) => (0, import_react92.useMemo)(() => {
|
|
|
14994
15323
|
var BaseCreateOrganization_styles_default = useStyles26;
|
|
14995
15324
|
|
|
14996
15325
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
14997
|
-
var
|
|
15326
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14998
15327
|
var logger8 = (0, import_browser83.createPackageComponentLogger)(
|
|
14999
15328
|
"@asgardeo/react",
|
|
15000
15329
|
"BaseCreateOrganization"
|
|
@@ -15021,13 +15350,13 @@ var BaseCreateOrganization = ({
|
|
|
15021
15350
|
const { theme, colorScheme } = useTheme_default();
|
|
15022
15351
|
const styles = BaseCreateOrganization_styles_default(theme, colorScheme);
|
|
15023
15352
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15024
|
-
const [formData, setFormData] = (0,
|
|
15353
|
+
const [formData, setFormData] = (0, import_react94.useState)({
|
|
15025
15354
|
description: "",
|
|
15026
15355
|
handle: "",
|
|
15027
15356
|
name: "",
|
|
15028
15357
|
...initialValues
|
|
15029
15358
|
});
|
|
15030
|
-
const [formErrors, setFormErrors] = (0,
|
|
15359
|
+
const [formErrors, setFormErrors] = (0, import_react94.useState)({});
|
|
15031
15360
|
const validateForm = () => {
|
|
15032
15361
|
const errors = {};
|
|
15033
15362
|
if (!formData.name.trim()) {
|
|
@@ -15084,13 +15413,13 @@ var BaseCreateOrganization = ({
|
|
|
15084
15413
|
logger8.error("Form submission error:");
|
|
15085
15414
|
}
|
|
15086
15415
|
};
|
|
15087
|
-
const createOrganizationContent = /* @__PURE__ */ (0,
|
|
15088
|
-
/* @__PURE__ */ (0,
|
|
15089
|
-
error && /* @__PURE__ */ (0,
|
|
15090
|
-
/* @__PURE__ */ (0,
|
|
15091
|
-
/* @__PURE__ */ (0,
|
|
15416
|
+
const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["root"], cardLayout && styles["card"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: (0, import_css58.cx)(styles["content"]), children: [
|
|
15417
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("form", { id: "create-organization-form", className: (0, import_css58.cx)(styles["form"]), onSubmit: handleSubmit, children: [
|
|
15418
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Alert_default, { variant: "error", className: styles["errorAlert"], children: [
|
|
15419
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Alert_default.Title, { children: "Error" }),
|
|
15420
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Alert_default.Description, { children: error })
|
|
15092
15421
|
] }),
|
|
15093
|
-
/* @__PURE__ */ (0,
|
|
15422
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15094
15423
|
TextField_default,
|
|
15095
15424
|
{
|
|
15096
15425
|
label: `${t("elements.fields.organization.name.label")}`,
|
|
@@ -15103,7 +15432,7 @@ var BaseCreateOrganization = ({
|
|
|
15103
15432
|
className: (0, import_css58.cx)(styles["input"])
|
|
15104
15433
|
}
|
|
15105
15434
|
) }),
|
|
15106
|
-
/* @__PURE__ */ (0,
|
|
15435
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15107
15436
|
TextField_default,
|
|
15108
15437
|
{
|
|
15109
15438
|
label: `${t("elements.fields.organization.handle.label") || "Organization Handle"}`,
|
|
@@ -15117,9 +15446,9 @@ var BaseCreateOrganization = ({
|
|
|
15117
15446
|
className: (0, import_css58.cx)(styles["input"])
|
|
15118
15447
|
}
|
|
15119
15448
|
) }),
|
|
15120
|
-
/* @__PURE__ */ (0,
|
|
15121
|
-
/* @__PURE__ */ (0,
|
|
15122
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: (0, import_css58.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(FormControl_default, { error: formErrors.description, children: [
|
|
15450
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(InputLabel_default, { required: true, children: t("elements.fields.organization.description.label") }),
|
|
15451
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
15123
15452
|
"textarea",
|
|
15124
15453
|
{
|
|
15125
15454
|
className: (0, import_css58.cx)(styles["textarea"], formErrors.description && styles["textareaError"]),
|
|
@@ -15133,15 +15462,15 @@ var BaseCreateOrganization = ({
|
|
|
15133
15462
|
] }) }),
|
|
15134
15463
|
renderAdditionalFields && renderAdditionalFields()
|
|
15135
15464
|
] }),
|
|
15136
|
-
/* @__PURE__ */ (0,
|
|
15137
|
-
onCancel && /* @__PURE__ */ (0,
|
|
15138
|
-
/* @__PURE__ */ (0,
|
|
15465
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: (0, import_css58.cx)(styles["actions"]), children: [
|
|
15466
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.buttons.cancel.text") }),
|
|
15467
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.buttons.create_organization.loading.text") : t("organization.create.buttons.create_organization.text") })
|
|
15139
15468
|
] })
|
|
15140
15469
|
] }) });
|
|
15141
15470
|
if (mode === "popup") {
|
|
15142
|
-
return /* @__PURE__ */ (0,
|
|
15143
|
-
/* @__PURE__ */ (0,
|
|
15144
|
-
/* @__PURE__ */ (0,
|
|
15471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Dialog_default.Content, { children: [
|
|
15472
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Dialog_default.Heading, { children: title }),
|
|
15473
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: styles["popup"], children: createOrganizationContent })
|
|
15145
15474
|
] }) });
|
|
15146
15475
|
}
|
|
15147
15476
|
return createOrganizationContent;
|
|
@@ -15179,7 +15508,7 @@ var createOrganization = async ({
|
|
|
15179
15508
|
var createOrganization_default = createOrganization;
|
|
15180
15509
|
|
|
15181
15510
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
15182
|
-
var
|
|
15511
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
15183
15512
|
var CreateOrganization = ({
|
|
15184
15513
|
onCreateOrganization,
|
|
15185
15514
|
fallback = null,
|
|
@@ -15189,13 +15518,13 @@ var CreateOrganization = ({
|
|
|
15189
15518
|
}) => {
|
|
15190
15519
|
const { isSignedIn, baseUrl, instanceId } = useAsgardeo_default();
|
|
15191
15520
|
const { currentOrganization, revalidateMyOrganizations } = useOrganization_default();
|
|
15192
|
-
const [loading, setLoading] = (0,
|
|
15193
|
-
const [error, setError] = (0,
|
|
15521
|
+
const [loading, setLoading] = (0, import_react95.useState)(false);
|
|
15522
|
+
const [error, setError] = (0, import_react95.useState)(null);
|
|
15194
15523
|
if (!isSignedIn && fallback) {
|
|
15195
15524
|
return fallback;
|
|
15196
15525
|
}
|
|
15197
15526
|
if (!isSignedIn) {
|
|
15198
|
-
return /* @__PURE__ */ (0,
|
|
15527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_jsx_runtime108.Fragment, {});
|
|
15199
15528
|
}
|
|
15200
15529
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
15201
15530
|
const handleSubmit = async (payload) => {
|
|
@@ -15230,7 +15559,7 @@ var CreateOrganization = ({
|
|
|
15230
15559
|
setLoading(false);
|
|
15231
15560
|
}
|
|
15232
15561
|
};
|
|
15233
|
-
return /* @__PURE__ */ (0,
|
|
15562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
15234
15563
|
BaseCreateOrganization,
|
|
15235
15564
|
{
|
|
15236
15565
|
onSubmit: handleSubmit,
|
|
@@ -15245,16 +15574,16 @@ var CreateOrganization = ({
|
|
|
15245
15574
|
|
|
15246
15575
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
15247
15576
|
var import_css62 = require("@emotion/css");
|
|
15248
|
-
var
|
|
15577
|
+
var import_react99 = require("react");
|
|
15249
15578
|
|
|
15250
15579
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
15251
15580
|
var import_css60 = require("@emotion/css");
|
|
15252
|
-
var
|
|
15581
|
+
var import_react97 = require("react");
|
|
15253
15582
|
|
|
15254
15583
|
// src/components/presentation/OrganizationList/BaseOrganizationList.styles.ts
|
|
15255
15584
|
var import_css59 = require("@emotion/css");
|
|
15256
|
-
var
|
|
15257
|
-
var useStyles27 = (theme, colorScheme) => (0,
|
|
15585
|
+
var import_react96 = require("react");
|
|
15586
|
+
var useStyles27 = (theme, colorScheme) => (0, import_react96.useMemo)(() => {
|
|
15258
15587
|
const root = import_css59.css`
|
|
15259
15588
|
padding: calc(${theme.vars.spacing.unit} * 4);
|
|
15260
15589
|
min-width: 600px;
|
|
@@ -15478,20 +15807,20 @@ var useStyles27 = (theme, colorScheme) => (0, import_react95.useMemo)(() => {
|
|
|
15478
15807
|
var BaseOrganizationList_styles_default = useStyles27;
|
|
15479
15808
|
|
|
15480
15809
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
15481
|
-
var
|
|
15482
|
-
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => /* @__PURE__ */ (0,
|
|
15483
|
-
/* @__PURE__ */ (0,
|
|
15484
|
-
/* @__PURE__ */ (0,
|
|
15485
|
-
/* @__PURE__ */ (0,
|
|
15486
|
-
/* @__PURE__ */ (0,
|
|
15487
|
-
/* @__PURE__ */ (0,
|
|
15810
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
15811
|
+
var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect, showStatus) => /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationItem), children: [
|
|
15812
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationContent), children: [
|
|
15813
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Avatar, { variant: "square", name: organization.name, size: 48, alt: `${organization.name} logo` }),
|
|
15814
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.organizationInfo), children: [
|
|
15815
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "h6", className: (0, import_css60.cx)(styles.organizationName), children: organization.name }),
|
|
15816
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles.organizationHandle), children: [
|
|
15488
15817
|
"@",
|
|
15489
15818
|
organization.orgHandle
|
|
15490
15819
|
] }),
|
|
15491
|
-
showStatus && /* @__PURE__ */ (0,
|
|
15820
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles.organizationStatus), children: [
|
|
15492
15821
|
t("organization.switcher.status.label"),
|
|
15493
15822
|
" ",
|
|
15494
|
-
/* @__PURE__ */ (0,
|
|
15823
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15495
15824
|
"span",
|
|
15496
15825
|
{
|
|
15497
15826
|
className: (0, import_css60.cx)(
|
|
@@ -15504,7 +15833,7 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
15504
15833
|
] })
|
|
15505
15834
|
] })
|
|
15506
15835
|
] }),
|
|
15507
|
-
organization.canSwitch && /* @__PURE__ */ (0,
|
|
15836
|
+
organization.canSwitch && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.organizationActions), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15508
15837
|
Button_default,
|
|
15509
15838
|
{
|
|
15510
15839
|
onClick: (e) => {
|
|
@@ -15517,17 +15846,17 @@ var defaultRenderOrganization = (organization, styles, t, onOrganizationSelect,
|
|
|
15517
15846
|
}
|
|
15518
15847
|
) })
|
|
15519
15848
|
] }, organization.id);
|
|
15520
|
-
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0,
|
|
15521
|
-
/* @__PURE__ */ (0,
|
|
15522
|
-
/* @__PURE__ */ (0,
|
|
15849
|
+
var defaultRenderLoading = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles.loadingContainer), children: [
|
|
15850
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Spinner_default, { size: "medium" }),
|
|
15851
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css60.cx)(styles.loadingText), children: t("organization.switcher.loading.placeholder.organizations") })
|
|
15523
15852
|
] });
|
|
15524
|
-
var defaultRenderError = (errorMessage, t, styles) => /* @__PURE__ */ (0,
|
|
15525
|
-
/* @__PURE__ */ (0,
|
|
15853
|
+
var defaultRenderError = (errorMessage, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.errorContainer), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Typography_default, { variant: "body1", color: "error", children: [
|
|
15854
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("strong", { children: t("organization.switcher.error.prefix") }),
|
|
15526
15855
|
" ",
|
|
15527
15856
|
errorMessage
|
|
15528
15857
|
] }) });
|
|
15529
|
-
var defaultRenderLoadMore = (onLoadMore, isLoadingMore, t, styles) => /* @__PURE__ */ (0,
|
|
15530
|
-
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0,
|
|
15858
|
+
var defaultRenderLoadMore = (onLoadMore, isLoadingMore, t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Button_default, { onClick: onLoadMore, disabled: isLoadingMore, className: (0, import_css60.cx)(styles.loadMoreButton), type: "button", fullWidth: true, children: isLoadingMore ? t("organization.switcher.loading.more") : t("organization.switcher.buttons.load_more.text") });
|
|
15859
|
+
var defaultRenderEmpty = (t, styles) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles.emptyContainer), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body1", color: "textSecondary", className: (0, import_css60.cx)(styles.emptyText), children: t("organization.switcher.no.organizations") }) });
|
|
15531
15860
|
var BaseOrganizationList = ({
|
|
15532
15861
|
className = "",
|
|
15533
15862
|
allOrganizations,
|
|
@@ -15555,7 +15884,7 @@ var BaseOrganizationList = ({
|
|
|
15555
15884
|
const { theme, colorScheme } = useTheme_default();
|
|
15556
15885
|
const styles = BaseOrganizationList_styles_default(theme, colorScheme);
|
|
15557
15886
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
15558
|
-
const organizationsWithSwitchAccess = (0,
|
|
15887
|
+
const organizationsWithSwitchAccess = (0, import_react97.useMemo)(() => {
|
|
15559
15888
|
if (!allOrganizations?.organizations) {
|
|
15560
15889
|
return [];
|
|
15561
15890
|
}
|
|
@@ -15571,42 +15900,42 @@ var BaseOrganizationList = ({
|
|
|
15571
15900
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, loadingMore) => defaultRenderLoadMore(onLoadMore, loadingMore, t, styles));
|
|
15572
15901
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles, t, onOrganizationSelect, showStatus));
|
|
15573
15902
|
if (isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
15574
|
-
const loadingContent = /* @__PURE__ */ (0,
|
|
15903
|
+
const loadingContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderLoadingWithStyles() });
|
|
15575
15904
|
if (mode === "popup") {
|
|
15576
|
-
return /* @__PURE__ */ (0,
|
|
15577
|
-
/* @__PURE__ */ (0,
|
|
15578
|
-
/* @__PURE__ */ (0,
|
|
15905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15906
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15907
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: loadingContent })
|
|
15579
15908
|
] }) });
|
|
15580
15909
|
}
|
|
15581
15910
|
return loadingContent;
|
|
15582
15911
|
}
|
|
15583
15912
|
if (error && organizationsWithSwitchAccess?.length === 0) {
|
|
15584
|
-
const errorContent = /* @__PURE__ */ (0,
|
|
15913
|
+
const errorContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderErrorWithStyles(error) });
|
|
15585
15914
|
if (mode === "popup") {
|
|
15586
|
-
return /* @__PURE__ */ (0,
|
|
15587
|
-
/* @__PURE__ */ (0,
|
|
15588
|
-
/* @__PURE__ */ (0,
|
|
15915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15916
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15917
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: errorContent })
|
|
15589
15918
|
] }) });
|
|
15590
15919
|
}
|
|
15591
15920
|
return errorContent;
|
|
15592
15921
|
}
|
|
15593
15922
|
if (!isLoading && organizationsWithSwitchAccess?.length === 0) {
|
|
15594
|
-
const emptyContent = /* @__PURE__ */ (0,
|
|
15923
|
+
const emptyContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: renderEmptyWithStyles() });
|
|
15595
15924
|
if (mode === "popup") {
|
|
15596
|
-
return /* @__PURE__ */ (0,
|
|
15597
|
-
/* @__PURE__ */ (0,
|
|
15598
|
-
/* @__PURE__ */ (0,
|
|
15925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15926
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15927
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: emptyContent })
|
|
15599
15928
|
] }) });
|
|
15600
15929
|
}
|
|
15601
15930
|
return emptyContent;
|
|
15602
15931
|
}
|
|
15603
|
-
const organizationListContent = /* @__PURE__ */ (0,
|
|
15604
|
-
/* @__PURE__ */ (0,
|
|
15605
|
-
/* @__PURE__ */ (0,
|
|
15932
|
+
const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles["root"], className), style, children: [
|
|
15933
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: (0, import_css60.cx)(styles["header"]), children: [
|
|
15934
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["headerInfo"]), children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css60.cx)(styles["subtitle"]), children: t("organization.switcher.showing.count", {
|
|
15606
15935
|
showing: organizationsWithSwitchAccess?.length,
|
|
15607
15936
|
total: allOrganizations?.organizations?.length || 0
|
|
15608
15937
|
}) }) }),
|
|
15609
|
-
onRefresh && /* @__PURE__ */ (0,
|
|
15938
|
+
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
15610
15939
|
Button_default,
|
|
15611
15940
|
{
|
|
15612
15941
|
onClick: onRefresh,
|
|
@@ -15618,16 +15947,16 @@ var BaseOrganizationList = ({
|
|
|
15618
15947
|
}
|
|
15619
15948
|
)
|
|
15620
15949
|
] }),
|
|
15621
|
-
/* @__PURE__ */ (0,
|
|
15950
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["listContainer"]), children: organizationsWithSwitchAccess?.map(
|
|
15622
15951
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
15623
15952
|
) }),
|
|
15624
|
-
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0,
|
|
15625
|
-
hasMore && fetchMore && /* @__PURE__ */ (0,
|
|
15953
|
+
error && organizationsWithSwitchAccess?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["errorMargin"]), children: renderErrorWithStyles(error) }),
|
|
15954
|
+
hasMore && fetchMore && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["loadMoreMargin"]), children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
15626
15955
|
] });
|
|
15627
15956
|
if (mode === "popup") {
|
|
15628
|
-
return /* @__PURE__ */ (0,
|
|
15629
|
-
/* @__PURE__ */ (0,
|
|
15630
|
-
/* @__PURE__ */ (0,
|
|
15957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Dialog_default.Content, { children: [
|
|
15958
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Dialog_default.Heading, { children: title }),
|
|
15959
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: (0, import_css60.cx)(styles["popupContent"]), children: organizationListContent })
|
|
15631
15960
|
] }) });
|
|
15632
15961
|
}
|
|
15633
15962
|
return organizationListContent;
|
|
@@ -15636,8 +15965,8 @@ var BaseOrganizationList_default = BaseOrganizationList;
|
|
|
15636
15965
|
|
|
15637
15966
|
// src/components/presentation/OrganizationList/OrganizationList.styles.ts
|
|
15638
15967
|
var import_css61 = require("@emotion/css");
|
|
15639
|
-
var
|
|
15640
|
-
var useStyles28 = (theme, colorScheme) => (0,
|
|
15968
|
+
var import_react98 = require("react");
|
|
15969
|
+
var useStyles28 = (theme, colorScheme) => (0, import_react98.useMemo)(() => {
|
|
15641
15970
|
const cssOrganizationListWrapper = import_css61.css`
|
|
15642
15971
|
/* Container wrapper styles for OrganizationList component */
|
|
15643
15972
|
width: 100%;
|
|
@@ -15697,22 +16026,22 @@ var useStyles28 = (theme, colorScheme) => (0, import_react97.useMemo)(() => {
|
|
|
15697
16026
|
var OrganizationList_styles_default = useStyles28;
|
|
15698
16027
|
|
|
15699
16028
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
15700
|
-
var
|
|
16029
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
15701
16030
|
var OrganizationList = (props) => {
|
|
15702
16031
|
const { onOrganizationSelect, className = "", style, ...baseProps } = props;
|
|
15703
16032
|
const { autoFetch, filter, limit, recursive, ...filteredBaseProps } = baseProps;
|
|
15704
16033
|
const { theme, colorScheme } = useTheme_default();
|
|
15705
16034
|
const styles = OrganizationList_styles_default(theme, colorScheme);
|
|
15706
16035
|
const { getAllOrganizations: getAllOrganizations2, error, isLoading, myOrganizations } = useOrganization_default();
|
|
15707
|
-
const [allOrganizations, setAllOrganizations] = (0,
|
|
16036
|
+
const [allOrganizations, setAllOrganizations] = (0, import_react99.useState)({
|
|
15708
16037
|
organizations: []
|
|
15709
16038
|
});
|
|
15710
|
-
(0,
|
|
16039
|
+
(0, import_react99.useEffect)(() => {
|
|
15711
16040
|
(async () => {
|
|
15712
16041
|
setAllOrganizations(await getAllOrganizations2());
|
|
15713
16042
|
})();
|
|
15714
16043
|
}, []);
|
|
15715
|
-
return /* @__PURE__ */ (0,
|
|
16044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: (0, import_css62.cx)(styles["root"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: (0, import_css62.cx)(styles["container"]), children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
15716
16045
|
BaseOrganizationList,
|
|
15717
16046
|
{
|
|
15718
16047
|
allOrganizations,
|
|
@@ -15728,17 +16057,17 @@ var OrganizationList_default = OrganizationList;
|
|
|
15728
16057
|
|
|
15729
16058
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
15730
16059
|
var import_browser89 = require("@asgardeo/browser");
|
|
15731
|
-
var
|
|
16060
|
+
var import_react104 = require("react");
|
|
15732
16061
|
|
|
15733
16062
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
15734
16063
|
var import_browser86 = require("@asgardeo/browser");
|
|
15735
16064
|
var import_css66 = require("@emotion/css");
|
|
15736
|
-
var
|
|
16065
|
+
var import_react103 = require("react");
|
|
15737
16066
|
|
|
15738
16067
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.styles.ts
|
|
15739
16068
|
var import_css63 = require("@emotion/css");
|
|
15740
|
-
var
|
|
15741
|
-
var useStyles29 = (theme, colorScheme) => (0,
|
|
16069
|
+
var import_react100 = require("react");
|
|
16070
|
+
var useStyles29 = (theme, colorScheme) => (0, import_react100.useMemo)(
|
|
15742
16071
|
() => ({
|
|
15743
16072
|
attributeItem: import_css63.css`
|
|
15744
16073
|
display: flex;
|
|
@@ -15894,12 +16223,12 @@ var BaseOrganizationProfile_styles_default = useStyles29;
|
|
|
15894
16223
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
15895
16224
|
var import_browser85 = require("@asgardeo/browser");
|
|
15896
16225
|
var import_css65 = require("@emotion/css");
|
|
15897
|
-
var
|
|
16226
|
+
var import_react102 = require("react");
|
|
15898
16227
|
|
|
15899
16228
|
// src/components/primitives/KeyValueInput/KeyValueInput.styles.ts
|
|
15900
16229
|
var import_css64 = require("@emotion/css");
|
|
15901
|
-
var
|
|
15902
|
-
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0,
|
|
16230
|
+
var import_react101 = require("react");
|
|
16231
|
+
var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0, import_react101.useMemo)(() => {
|
|
15903
16232
|
const container = import_css64.css`
|
|
15904
16233
|
display: flex;
|
|
15905
16234
|
flex-direction: column;
|
|
@@ -16051,7 +16380,7 @@ var useStyles30 = (theme, colorScheme, disabled, readOnly, hasError) => (0, impo
|
|
|
16051
16380
|
var KeyValueInput_styles_default = useStyles30;
|
|
16052
16381
|
|
|
16053
16382
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
16054
|
-
var
|
|
16383
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16055
16384
|
var KeyValueInput = ({
|
|
16056
16385
|
className = "",
|
|
16057
16386
|
disabled = false,
|
|
@@ -16074,10 +16403,10 @@ var KeyValueInput = ({
|
|
|
16074
16403
|
const { theme, colorScheme } = useTheme_default();
|
|
16075
16404
|
const styles = KeyValueInput_styles_default(theme, colorScheme, disabled, readOnly, !!error);
|
|
16076
16405
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
16077
|
-
const [pairs, setPairs] = (0,
|
|
16078
|
-
const [newKey, setNewKey] = (0,
|
|
16079
|
-
const [newValue, setNewValue] = (0,
|
|
16080
|
-
const handleAddPair = (0,
|
|
16406
|
+
const [pairs, setPairs] = (0, import_react102.useState)(initialPairs);
|
|
16407
|
+
const [newKey, setNewKey] = (0, import_react102.useState)("");
|
|
16408
|
+
const [newValue, setNewValue] = (0, import_react102.useState)("");
|
|
16409
|
+
const handleAddPair = (0, import_react102.useCallback)(() => {
|
|
16081
16410
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
16082
16411
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
16083
16412
|
const newPair = {
|
|
@@ -16095,7 +16424,7 @@ var KeyValueInput = ({
|
|
|
16095
16424
|
onAdd(newPair);
|
|
16096
16425
|
}
|
|
16097
16426
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
16098
|
-
const handleRemovePair = (0,
|
|
16427
|
+
const handleRemovePair = (0, import_react102.useCallback)(
|
|
16099
16428
|
(index) => {
|
|
16100
16429
|
const pairToRemove = pairs[index];
|
|
16101
16430
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -16109,7 +16438,7 @@ var KeyValueInput = ({
|
|
|
16109
16438
|
},
|
|
16110
16439
|
[pairs, onChange, onRemove]
|
|
16111
16440
|
);
|
|
16112
|
-
const handleUpdatePair = (0,
|
|
16441
|
+
const handleUpdatePair = (0, import_react102.useCallback)(
|
|
16113
16442
|
(index, field, newVal) => {
|
|
16114
16443
|
const updatedPairs = pairs.map((pair, i) => {
|
|
16115
16444
|
if (i === index) {
|
|
@@ -16128,18 +16457,18 @@ var KeyValueInput = ({
|
|
|
16128
16457
|
const isAddDisabled = disabled || readOnly || !canAddMore || !newKey.trim() || !newValue.trim();
|
|
16129
16458
|
const renderReadOnlyContent = () => {
|
|
16130
16459
|
if (pairs.length === 0) {
|
|
16131
|
-
return /* @__PURE__ */ (0,
|
|
16460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "empty-state")), styles["emptyState"]), children: "No attributes defined" });
|
|
16132
16461
|
}
|
|
16133
|
-
return pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
16462
|
+
return pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
16134
16463
|
"div",
|
|
16135
16464
|
{
|
|
16136
16465
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-pair")), styles["readOnlyPair"]),
|
|
16137
16466
|
children: [
|
|
16138
|
-
/* @__PURE__ */ (0,
|
|
16467
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("span", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-key")), styles["readOnlyKey"]), children: [
|
|
16139
16468
|
pair.key,
|
|
16140
16469
|
":"
|
|
16141
16470
|
] }),
|
|
16142
|
-
/* @__PURE__ */ (0,
|
|
16471
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16143
16472
|
"span",
|
|
16144
16473
|
{
|
|
16145
16474
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "readonly-value")), styles["readOnlyValue"]),
|
|
@@ -16151,10 +16480,10 @@ var KeyValueInput = ({
|
|
|
16151
16480
|
`${pair.key}-${index}`
|
|
16152
16481
|
));
|
|
16153
16482
|
};
|
|
16154
|
-
return /* @__PURE__ */ (0,
|
|
16155
|
-
label && /* @__PURE__ */ (0,
|
|
16483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input")), styles["container"], className), children: [
|
|
16484
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("label", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "label")), styles["label"]), children: [
|
|
16156
16485
|
label,
|
|
16157
|
-
required && /* @__PURE__ */ (0,
|
|
16486
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16158
16487
|
"span",
|
|
16159
16488
|
{
|
|
16160
16489
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "required")), styles["requiredIndicator"]),
|
|
@@ -16162,13 +16491,13 @@ var KeyValueInput = ({
|
|
|
16162
16491
|
}
|
|
16163
16492
|
)
|
|
16164
16493
|
] }),
|
|
16165
|
-
/* @__PURE__ */ (0,
|
|
16166
|
-
readOnly ? renderReadOnlyContent() : pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
16494
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "pairs-list")), styles["pairsList"]), children: [
|
|
16495
|
+
readOnly ? renderReadOnlyContent() : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
16167
16496
|
"div",
|
|
16168
16497
|
{
|
|
16169
16498
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "pair-row")), styles["pairRow"]),
|
|
16170
16499
|
children: [
|
|
16171
|
-
/* @__PURE__ */ (0,
|
|
16500
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16172
16501
|
TextField_default,
|
|
16173
16502
|
{
|
|
16174
16503
|
placeholder: keyPlaceholder,
|
|
@@ -16179,7 +16508,7 @@ var KeyValueInput = ({
|
|
|
16179
16508
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
16180
16509
|
}
|
|
16181
16510
|
),
|
|
16182
|
-
/* @__PURE__ */ (0,
|
|
16511
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16183
16512
|
TextField_default,
|
|
16184
16513
|
{
|
|
16185
16514
|
placeholder: valuePlaceholder,
|
|
@@ -16190,7 +16519,7 @@ var KeyValueInput = ({
|
|
|
16190
16519
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
16191
16520
|
}
|
|
16192
16521
|
),
|
|
16193
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
16522
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16194
16523
|
"button",
|
|
16195
16524
|
{
|
|
16196
16525
|
type: "button",
|
|
@@ -16201,15 +16530,15 @@ var KeyValueInput = ({
|
|
|
16201
16530
|
styles["removeButton"]
|
|
16202
16531
|
),
|
|
16203
16532
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
16204
|
-
children: /* @__PURE__ */ (0,
|
|
16533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(X_default, { width: 16, height: 16 })
|
|
16205
16534
|
}
|
|
16206
16535
|
)
|
|
16207
16536
|
]
|
|
16208
16537
|
},
|
|
16209
16538
|
`${pair.key}-${index}`
|
|
16210
16539
|
)),
|
|
16211
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
16212
|
-
/* @__PURE__ */ (0,
|
|
16540
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "add-row")), styles["addRow"]), children: [
|
|
16541
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16213
16542
|
TextField_default,
|
|
16214
16543
|
{
|
|
16215
16544
|
placeholder: keyPlaceholder,
|
|
@@ -16220,7 +16549,7 @@ var KeyValueInput = ({
|
|
|
16220
16549
|
"aria-label": "New key"
|
|
16221
16550
|
}
|
|
16222
16551
|
),
|
|
16223
|
-
/* @__PURE__ */ (0,
|
|
16552
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16224
16553
|
TextField_default,
|
|
16225
16554
|
{
|
|
16226
16555
|
placeholder: valuePlaceholder,
|
|
@@ -16236,7 +16565,7 @@ var KeyValueInput = ({
|
|
|
16236
16565
|
}
|
|
16237
16566
|
}
|
|
16238
16567
|
),
|
|
16239
|
-
/* @__PURE__ */ (0,
|
|
16568
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16240
16569
|
"button",
|
|
16241
16570
|
{
|
|
16242
16571
|
type: "button",
|
|
@@ -16244,13 +16573,13 @@ var KeyValueInput = ({
|
|
|
16244
16573
|
disabled: isAddDisabled,
|
|
16245
16574
|
className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "add-button")), styles["addButton"]),
|
|
16246
16575
|
"aria-label": "Add new key-value pair",
|
|
16247
|
-
children: /* @__PURE__ */ (0,
|
|
16576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Plus_default, { width: 16, height: 16 })
|
|
16248
16577
|
}
|
|
16249
16578
|
)
|
|
16250
16579
|
] })
|
|
16251
16580
|
] }),
|
|
16252
|
-
(helperText || error) && /* @__PURE__ */ (0,
|
|
16253
|
-
maxPairs && /* @__PURE__ */ (0,
|
|
16581
|
+
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "helper-text")), styles["helperText"]), children: error || helperText }),
|
|
16582
|
+
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: (0, import_css65.cx)((0, import_browser85.withVendorCSSClassPrefix)((0, import_browser85.bem)("key-value-input", "counter")), styles["counterText"]), children: [
|
|
16254
16583
|
pairs.length,
|
|
16255
16584
|
" of ",
|
|
16256
16585
|
maxPairs,
|
|
@@ -16261,7 +16590,7 @@ var KeyValueInput = ({
|
|
|
16261
16590
|
var KeyValueInput_default = KeyValueInput;
|
|
16262
16591
|
|
|
16263
16592
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
16264
|
-
var
|
|
16593
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16265
16594
|
var BaseOrganizationProfile = ({
|
|
16266
16595
|
fallback = null,
|
|
16267
16596
|
className = "",
|
|
@@ -16308,9 +16637,9 @@ var BaseOrganizationProfile = ({
|
|
|
16308
16637
|
}) => {
|
|
16309
16638
|
const { theme, colorScheme } = useTheme_default();
|
|
16310
16639
|
const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
|
|
16311
|
-
const [editedOrganization, setEditedOrganization] = (0,
|
|
16312
|
-
const [editingFields, setEditingFields] = (0,
|
|
16313
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
16640
|
+
const [editedOrganization, setEditedOrganization] = (0, import_react103.useState)(organization);
|
|
16641
|
+
const [editingFields, setEditingFields] = (0, import_react103.useState)({});
|
|
16642
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16314
16643
|
"svg",
|
|
16315
16644
|
{
|
|
16316
16645
|
width: "16",
|
|
@@ -16321,16 +16650,16 @@ var BaseOrganizationProfile = ({
|
|
|
16321
16650
|
strokeWidth: "2",
|
|
16322
16651
|
strokeLinecap: "round",
|
|
16323
16652
|
strokeLinejoin: "round",
|
|
16324
|
-
children: /* @__PURE__ */ (0,
|
|
16653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
16325
16654
|
}
|
|
16326
16655
|
);
|
|
16327
|
-
const toggleFieldEdit = (0,
|
|
16656
|
+
const toggleFieldEdit = (0, import_react103.useCallback)((fieldName) => {
|
|
16328
16657
|
setEditingFields((prev) => ({
|
|
16329
16658
|
...prev,
|
|
16330
16659
|
[fieldName]: !prev[fieldName]
|
|
16331
16660
|
}));
|
|
16332
16661
|
}, []);
|
|
16333
|
-
const getFieldPlaceholder = (0,
|
|
16662
|
+
const getFieldPlaceholder = (0, import_react103.useCallback)((fieldKey) => {
|
|
16334
16663
|
const fieldLabels = {
|
|
16335
16664
|
description: "organization description",
|
|
16336
16665
|
name: "organization name",
|
|
@@ -16341,7 +16670,7 @@ var BaseOrganizationProfile = ({
|
|
|
16341
16670
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
16342
16671
|
return `Enter ${fieldLabel}`;
|
|
16343
16672
|
}, []);
|
|
16344
|
-
const handleFieldSave = (0,
|
|
16673
|
+
const handleFieldSave = (0, import_react103.useCallback)(
|
|
16345
16674
|
(fieldKey) => {
|
|
16346
16675
|
if (!onUpdate || !fieldKey) return;
|
|
16347
16676
|
let fieldValue;
|
|
@@ -16360,7 +16689,7 @@ var BaseOrganizationProfile = ({
|
|
|
16360
16689
|
},
|
|
16361
16690
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
16362
16691
|
);
|
|
16363
|
-
const handleFieldCancel = (0,
|
|
16692
|
+
const handleFieldCancel = (0, import_react103.useCallback)(
|
|
16364
16693
|
(fieldKey) => {
|
|
16365
16694
|
setEditedOrganization((prev) => ({
|
|
16366
16695
|
...prev,
|
|
@@ -16391,7 +16720,7 @@ var BaseOrganizationProfile = ({
|
|
|
16391
16720
|
let fieldInput;
|
|
16392
16721
|
if (key === "attributes") {
|
|
16393
16722
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
16394
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
16723
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16395
16724
|
KeyValueInput_default,
|
|
16396
16725
|
{
|
|
16397
16726
|
value: attributesValue,
|
|
@@ -16429,26 +16758,26 @@ var BaseOrganizationProfile = ({
|
|
|
16429
16758
|
}
|
|
16430
16759
|
);
|
|
16431
16760
|
} else {
|
|
16432
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
16761
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TextField_default, { ...commonProps });
|
|
16433
16762
|
}
|
|
16434
|
-
return /* @__PURE__ */ (0,
|
|
16435
|
-
/* @__PURE__ */ (0,
|
|
16436
|
-
/* @__PURE__ */ (0,
|
|
16763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16764
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: (0, import_css66.cx)(styles["label"]), children: label }),
|
|
16765
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["value"]), children: fieldInput })
|
|
16437
16766
|
] });
|
|
16438
16767
|
}
|
|
16439
16768
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
16440
16769
|
const isFieldEditable = editable && fieldEditable;
|
|
16441
16770
|
let displayValue;
|
|
16442
16771
|
if (hasValue) {
|
|
16443
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0,
|
|
16772
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
16444
16773
|
} else if (isFieldEditable) {
|
|
16445
16774
|
displayValue = getFieldPlaceholder(key);
|
|
16446
16775
|
} else {
|
|
16447
16776
|
displayValue = "-";
|
|
16448
16777
|
}
|
|
16449
|
-
return /* @__PURE__ */ (0,
|
|
16450
|
-
/* @__PURE__ */ (0,
|
|
16451
|
-
/* @__PURE__ */ (0,
|
|
16778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16779
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: (0, import_css66.cx)(styles["label"]), children: label }),
|
|
16780
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["value"], !hasValue && styles["valueEmpty"]), children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16452
16781
|
Button_default,
|
|
16453
16782
|
{
|
|
16454
16783
|
onClick: onStartEdit,
|
|
@@ -16471,8 +16800,8 @@ var BaseOrganizationProfile = ({
|
|
|
16471
16800
|
if (!shouldShow) {
|
|
16472
16801
|
return null;
|
|
16473
16802
|
}
|
|
16474
|
-
return /* @__PURE__ */ (0,
|
|
16475
|
-
/* @__PURE__ */ (0,
|
|
16803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["field"]), children: [
|
|
16804
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["fieldContent"]), children: renderField(
|
|
16476
16805
|
field,
|
|
16477
16806
|
isFieldEditing,
|
|
16478
16807
|
(value) => {
|
|
@@ -16482,8 +16811,8 @@ var BaseOrganizationProfile = ({
|
|
|
16482
16811
|
},
|
|
16483
16812
|
() => toggleFieldEdit(field.key)
|
|
16484
16813
|
) }),
|
|
16485
|
-
isFieldEditable && /* @__PURE__ */ (0,
|
|
16486
|
-
/* @__PURE__ */ (0,
|
|
16814
|
+
isFieldEditable && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["fieldActions"]), children: isFieldEditing ? /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
|
|
16815
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16487
16816
|
Button_default,
|
|
16488
16817
|
{
|
|
16489
16818
|
onClick: () => handleFieldSave(field.key),
|
|
@@ -16494,7 +16823,7 @@ var BaseOrganizationProfile = ({
|
|
|
16494
16823
|
children: saveButtonText
|
|
16495
16824
|
}
|
|
16496
16825
|
),
|
|
16497
|
-
/* @__PURE__ */ (0,
|
|
16826
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16498
16827
|
Button_default,
|
|
16499
16828
|
{
|
|
16500
16829
|
onClick: () => handleFieldCancel(field.key),
|
|
@@ -16505,7 +16834,7 @@ var BaseOrganizationProfile = ({
|
|
|
16505
16834
|
children: cancelButtonText
|
|
16506
16835
|
}
|
|
16507
16836
|
)
|
|
16508
|
-
] }) : hasValue && /* @__PURE__ */ (0,
|
|
16837
|
+
] }) : hasValue && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16509
16838
|
Button_default,
|
|
16510
16839
|
{
|
|
16511
16840
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -16514,7 +16843,7 @@ var BaseOrganizationProfile = ({
|
|
|
16514
16843
|
size: "small",
|
|
16515
16844
|
title: "Edit field",
|
|
16516
16845
|
className: (0, import_css66.cx)(styles["editButton"]),
|
|
16517
|
-
children: /* @__PURE__ */ (0,
|
|
16846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(PencilIcon, {})
|
|
16518
16847
|
}
|
|
16519
16848
|
) })
|
|
16520
16849
|
] }, field.key);
|
|
@@ -16522,23 +16851,23 @@ var BaseOrganizationProfile = ({
|
|
|
16522
16851
|
if (!organization) {
|
|
16523
16852
|
return fallback;
|
|
16524
16853
|
}
|
|
16525
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
16526
|
-
/* @__PURE__ */ (0,
|
|
16527
|
-
/* @__PURE__ */ (0,
|
|
16528
|
-
/* @__PURE__ */ (0,
|
|
16529
|
-
/* @__PURE__ */ (0,
|
|
16530
|
-
organization.orgHandle && /* @__PURE__ */ (0,
|
|
16854
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Card_default, { className: (0, import_css66.cx)(styles["root"], cardLayout && styles["card"], className), children: [
|
|
16855
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["header"]), children: [
|
|
16856
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
16857
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_css66.cx)(styles["orgInfo"]), children: [
|
|
16858
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("h2", { className: (0, import_css66.cx)(styles["name"]), children: organization.name }),
|
|
16859
|
+
organization.orgHandle && /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("p", { className: (0, import_css66.cx)(styles["handle"]), children: [
|
|
16531
16860
|
"@",
|
|
16532
16861
|
organization.orgHandle
|
|
16533
16862
|
] })
|
|
16534
16863
|
] })
|
|
16535
16864
|
] }),
|
|
16536
|
-
/* @__PURE__ */ (0,
|
|
16865
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["infoContainer"]), children: fields.map((field) => renderOrganizationField(field)) })
|
|
16537
16866
|
] });
|
|
16538
16867
|
if (mode === "popup") {
|
|
16539
|
-
return /* @__PURE__ */ (0,
|
|
16540
|
-
/* @__PURE__ */ (0,
|
|
16541
|
-
/* @__PURE__ */ (0,
|
|
16868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Dialog_default, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Dialog_default.Content, { children: [
|
|
16869
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Dialog_default.Heading, { children: title }),
|
|
16870
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_css66.cx)(styles["popup"]), children: profileContent })
|
|
16542
16871
|
] }) });
|
|
16543
16872
|
}
|
|
16544
16873
|
return profileContent;
|
|
@@ -16607,7 +16936,7 @@ var updateOrganization = async ({
|
|
|
16607
16936
|
var updateOrganization_default = updateOrganization;
|
|
16608
16937
|
|
|
16609
16938
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
16610
|
-
var
|
|
16939
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
16611
16940
|
var logger9 = (0, import_browser89.createPackageComponentLogger)(
|
|
16612
16941
|
"@asgardeo/react",
|
|
16613
16942
|
"OrganizationProfile"
|
|
@@ -16626,7 +16955,7 @@ var OrganizationProfile = ({
|
|
|
16626
16955
|
}) => {
|
|
16627
16956
|
const { baseUrl, instanceId } = useAsgardeo_default();
|
|
16628
16957
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
16629
|
-
const [organization, setOrganization] = (0,
|
|
16958
|
+
const [organization, setOrganization] = (0, import_react104.useState)(null);
|
|
16630
16959
|
const fetchOrganization = async () => {
|
|
16631
16960
|
if (!baseUrl || !organizationId) {
|
|
16632
16961
|
return;
|
|
@@ -16643,7 +16972,7 @@ var OrganizationProfile = ({
|
|
|
16643
16972
|
setOrganization(null);
|
|
16644
16973
|
}
|
|
16645
16974
|
};
|
|
16646
|
-
(0,
|
|
16975
|
+
(0, import_react104.useEffect)(() => {
|
|
16647
16976
|
fetchOrganization();
|
|
16648
16977
|
}, [baseUrl, organizationId]);
|
|
16649
16978
|
const handleOrganizationUpdate = async (payload) => {
|
|
@@ -16665,7 +16994,7 @@ var OrganizationProfile = ({
|
|
|
16665
16994
|
throw err;
|
|
16666
16995
|
}
|
|
16667
16996
|
};
|
|
16668
|
-
return /* @__PURE__ */ (0,
|
|
16997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
16669
16998
|
BaseOrganizationProfile_default,
|
|
16670
16999
|
{
|
|
16671
17000
|
organization,
|
|
@@ -16682,7 +17011,7 @@ var OrganizationProfile = ({
|
|
|
16682
17011
|
var OrganizationProfile_default = OrganizationProfile;
|
|
16683
17012
|
|
|
16684
17013
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
16685
|
-
var
|
|
17014
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
16686
17015
|
var OrganizationSwitcher = ({
|
|
16687
17016
|
currentOrganization: propCurrentOrganization,
|
|
16688
17017
|
fallback = null,
|
|
@@ -16699,15 +17028,15 @@ var OrganizationSwitcher = ({
|
|
|
16699
17028
|
isLoading,
|
|
16700
17029
|
error
|
|
16701
17030
|
} = useOrganization_default();
|
|
16702
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0,
|
|
16703
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
16704
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0,
|
|
17031
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, import_react105.useState)(false);
|
|
17032
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react105.useState)(false);
|
|
17033
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, import_react105.useState)(false);
|
|
16705
17034
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
16706
17035
|
if (!isSignedIn && fallback) {
|
|
16707
17036
|
return fallback;
|
|
16708
17037
|
}
|
|
16709
17038
|
if (!isSignedIn) {
|
|
16710
|
-
return /* @__PURE__ */ (0,
|
|
17039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_jsx_runtime114.Fragment, {});
|
|
16711
17040
|
}
|
|
16712
17041
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
16713
17042
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -16721,19 +17050,19 @@ var OrganizationSwitcher = ({
|
|
|
16721
17050
|
const defaultMenuItems = [];
|
|
16722
17051
|
if (currentOrganization) {
|
|
16723
17052
|
defaultMenuItems.push({
|
|
16724
|
-
icon: /* @__PURE__ */ (0,
|
|
17053
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(BuildingAlt_default, {}),
|
|
16725
17054
|
label: t("organization.switcher.manage.organizations"),
|
|
16726
17055
|
onClick: handleManageOrganizations
|
|
16727
17056
|
});
|
|
16728
17057
|
}
|
|
16729
17058
|
defaultMenuItems.push({
|
|
16730
|
-
icon: /* @__PURE__ */ (0,
|
|
17059
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
16731
17060
|
label: t("organization.switcher.create.organization"),
|
|
16732
17061
|
onClick: () => setIsCreateOrgOpen(true)
|
|
16733
17062
|
});
|
|
16734
17063
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
16735
|
-
return /* @__PURE__ */ (0,
|
|
16736
|
-
/* @__PURE__ */ (0,
|
|
17064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
17065
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16737
17066
|
BaseOrganizationSwitcher,
|
|
16738
17067
|
{
|
|
16739
17068
|
organizations,
|
|
@@ -16747,7 +17076,7 @@ var OrganizationSwitcher = ({
|
|
|
16747
17076
|
...props
|
|
16748
17077
|
}
|
|
16749
17078
|
),
|
|
16750
|
-
/* @__PURE__ */ (0,
|
|
17079
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16751
17080
|
CreateOrganization,
|
|
16752
17081
|
{
|
|
16753
17082
|
mode: "popup",
|
|
@@ -16761,7 +17090,7 @@ var OrganizationSwitcher = ({
|
|
|
16761
17090
|
}
|
|
16762
17091
|
}
|
|
16763
17092
|
),
|
|
16764
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
17093
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16765
17094
|
OrganizationProfile_default,
|
|
16766
17095
|
{
|
|
16767
17096
|
organizationId: currentOrganization.id,
|
|
@@ -16769,11 +17098,11 @@ var OrganizationSwitcher = ({
|
|
|
16769
17098
|
open: isProfileOpen,
|
|
16770
17099
|
onOpenChange: setIsProfileOpen,
|
|
16771
17100
|
cardLayout: true,
|
|
16772
|
-
loadingFallback: /* @__PURE__ */ (0,
|
|
16773
|
-
errorFallback: /* @__PURE__ */ (0,
|
|
17101
|
+
loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { children: t("organization.profile.loading") }),
|
|
17102
|
+
errorFallback: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { children: t("organization.profile.error") })
|
|
16774
17103
|
}
|
|
16775
17104
|
),
|
|
16776
|
-
/* @__PURE__ */ (0,
|
|
17105
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
16777
17106
|
OrganizationList_default,
|
|
16778
17107
|
{
|
|
16779
17108
|
mode: "popup",
|
|
@@ -16794,13 +17123,13 @@ var OrganizationSwitcher_default = OrganizationSwitcher;
|
|
|
16794
17123
|
|
|
16795
17124
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx
|
|
16796
17125
|
var import_css68 = require("@emotion/css");
|
|
16797
|
-
var
|
|
16798
|
-
var
|
|
17126
|
+
var import_react107 = require("@floating-ui/react");
|
|
17127
|
+
var import_react108 = require("react");
|
|
16799
17128
|
|
|
16800
17129
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.ts
|
|
16801
17130
|
var import_css67 = require("@emotion/css");
|
|
16802
|
-
var
|
|
16803
|
-
var useStyles31 = (theme, colorScheme) => (0,
|
|
17131
|
+
var import_react106 = require("react");
|
|
17132
|
+
var useStyles31 = (theme, colorScheme) => (0, import_react106.useMemo)(() => {
|
|
16804
17133
|
const root = import_css67.css`
|
|
16805
17134
|
display: inline-block;
|
|
16806
17135
|
position: relative;
|
|
@@ -16910,7 +17239,7 @@ var useStyles31 = (theme, colorScheme) => (0, import_react105.useMemo)(() => {
|
|
|
16910
17239
|
var BaseLanguageSwitcher_styles_default = useStyles31;
|
|
16911
17240
|
|
|
16912
17241
|
// src/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.tsx
|
|
16913
|
-
var
|
|
17242
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
16914
17243
|
var BaseLanguageSwitcher = ({
|
|
16915
17244
|
children,
|
|
16916
17245
|
className,
|
|
@@ -16921,28 +17250,34 @@ var BaseLanguageSwitcher = ({
|
|
|
16921
17250
|
}) => {
|
|
16922
17251
|
const { theme, colorScheme } = useTheme_default();
|
|
16923
17252
|
const styles = BaseLanguageSwitcher_styles_default(theme, colorScheme);
|
|
16924
|
-
const [isOpen, setIsOpen] = (0,
|
|
16925
|
-
const
|
|
16926
|
-
|
|
17253
|
+
const [isOpen, setIsOpen] = (0, import_react108.useState)(false);
|
|
17254
|
+
const hasMultipleLanguages = languages.length > 1;
|
|
17255
|
+
(0, import_react108.useEffect)(() => {
|
|
17256
|
+
if (!hasMultipleLanguages && isOpen) {
|
|
17257
|
+
setIsOpen(false);
|
|
17258
|
+
}
|
|
17259
|
+
}, [hasMultipleLanguages, isOpen]);
|
|
17260
|
+
const { refs, floatingStyles, context } = (0, import_react107.useFloating)({
|
|
17261
|
+
middleware: [(0, import_react107.offset)(4), (0, import_react107.flip)(), (0, import_react107.shift)()],
|
|
16927
17262
|
onOpenChange: setIsOpen,
|
|
16928
17263
|
open: isOpen,
|
|
16929
|
-
whileElementsMounted:
|
|
17264
|
+
whileElementsMounted: import_react107.autoUpdate
|
|
16930
17265
|
});
|
|
16931
|
-
const click = (0,
|
|
16932
|
-
const dismiss = (0,
|
|
16933
|
-
const role = (0,
|
|
16934
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
17266
|
+
const click = (0, import_react107.useClick)(context, { enabled: hasMultipleLanguages });
|
|
17267
|
+
const dismiss = (0, import_react107.useDismiss)(context, { enabled: hasMultipleLanguages });
|
|
17268
|
+
const role = (0, import_react107.useRole)(context, { enabled: hasMultipleLanguages, role: "listbox" });
|
|
17269
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react107.useInteractions)([click, dismiss, role]);
|
|
16935
17270
|
const currentOption = languages.find((l) => l.code === currentLanguage);
|
|
16936
17271
|
if (children) {
|
|
16937
|
-
return /* @__PURE__ */ (0,
|
|
17272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_jsx_runtime115.Fragment, { children: children({
|
|
16938
17273
|
currentLanguage,
|
|
16939
17274
|
isLoading,
|
|
16940
17275
|
languages,
|
|
16941
17276
|
onLanguageChange
|
|
16942
17277
|
}) });
|
|
16943
17278
|
}
|
|
16944
|
-
return /* @__PURE__ */ (0,
|
|
16945
|
-
/* @__PURE__ */ (0,
|
|
17279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: (0, import_css68.cx)(styles["root"], className), children: [
|
|
17280
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
|
|
16946
17281
|
"button",
|
|
16947
17282
|
{
|
|
16948
17283
|
ref: refs.setReference,
|
|
@@ -16952,13 +17287,13 @@ var BaseLanguageSwitcher = ({
|
|
|
16952
17287
|
...getReferenceProps(),
|
|
16953
17288
|
className: styles["trigger"],
|
|
16954
17289
|
children: [
|
|
16955
|
-
currentOption && /* @__PURE__ */ (0,
|
|
16956
|
-
/* @__PURE__ */ (0,
|
|
16957
|
-
/* @__PURE__ */ (0,
|
|
17290
|
+
currentOption && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["triggerEmoji"], children: currentOption.emoji }),
|
|
17291
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["triggerLabel"], children: currentOption?.displayName ?? currentLanguage }),
|
|
17292
|
+
hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(ChevronDown_default, {})
|
|
16958
17293
|
]
|
|
16959
17294
|
}
|
|
16960
17295
|
),
|
|
16961
|
-
isOpen && /* @__PURE__ */ (0,
|
|
17296
|
+
isOpen && hasMultipleLanguages && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_react107.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_react107.FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
16962
17297
|
"div",
|
|
16963
17298
|
{
|
|
16964
17299
|
ref: refs.setFloating,
|
|
@@ -16967,7 +17302,7 @@ var BaseLanguageSwitcher = ({
|
|
|
16967
17302
|
className: styles["content"],
|
|
16968
17303
|
role: "listbox",
|
|
16969
17304
|
"aria-label": "Select language",
|
|
16970
|
-
children: languages.map((lang) => /* @__PURE__ */ (0,
|
|
17305
|
+
children: languages.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
|
|
16971
17306
|
"button",
|
|
16972
17307
|
{
|
|
16973
17308
|
type: "button",
|
|
@@ -16979,9 +17314,9 @@ var BaseLanguageSwitcher = ({
|
|
|
16979
17314
|
setIsOpen(false);
|
|
16980
17315
|
},
|
|
16981
17316
|
children: [
|
|
16982
|
-
/* @__PURE__ */ (0,
|
|
16983
|
-
/* @__PURE__ */ (0,
|
|
16984
|
-
lang.code === currentLanguage && /* @__PURE__ */ (0,
|
|
17317
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["optionEmoji"], children: lang.emoji }),
|
|
17318
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["optionLabel"], children: lang.displayName }),
|
|
17319
|
+
lang.code === currentLanguage && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: styles["checkIcon"], children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Check_default, {}) })
|
|
16985
17320
|
]
|
|
16986
17321
|
},
|
|
16987
17322
|
lang.code
|
|
@@ -16994,12 +17329,12 @@ var BaseLanguageSwitcher_default = BaseLanguageSwitcher;
|
|
|
16994
17329
|
|
|
16995
17330
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
16996
17331
|
var import_browser90 = require("@asgardeo/browser");
|
|
16997
|
-
var
|
|
17332
|
+
var import_react110 = require("react");
|
|
16998
17333
|
|
|
16999
17334
|
// src/contexts/FlowMeta/useFlowMeta.ts
|
|
17000
|
-
var
|
|
17335
|
+
var import_react109 = require("react");
|
|
17001
17336
|
var useFlowMeta = () => {
|
|
17002
|
-
const context = (0,
|
|
17337
|
+
const context = (0, import_react109.useContext)(FlowMetaContext_default);
|
|
17003
17338
|
if (!context) {
|
|
17004
17339
|
throw new Error("useFlowMeta must be used within a FlowMetaProvider");
|
|
17005
17340
|
}
|
|
@@ -17008,25 +17343,30 @@ var useFlowMeta = () => {
|
|
|
17008
17343
|
var useFlowMeta_default = useFlowMeta;
|
|
17009
17344
|
|
|
17010
17345
|
// src/components/presentation/LanguageSwitcher/LanguageSwitcher.tsx
|
|
17011
|
-
var
|
|
17346
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17012
17347
|
var LanguageSwitcher = ({ children, className }) => {
|
|
17013
17348
|
const { meta, switchLanguage, isLoading } = useFlowMeta_default();
|
|
17014
17349
|
const { currentLanguage } = useTranslation_default();
|
|
17015
17350
|
const availableLanguageCodes = meta?.i18n?.languages ?? [];
|
|
17016
|
-
const
|
|
17017
|
-
|
|
17351
|
+
const effectiveLanguageCodes = (0, import_react110.useMemo)(() => {
|
|
17352
|
+
const fallbackCodes = availableLanguageCodes.length > 0 ? availableLanguageCodes : [currentLanguage];
|
|
17353
|
+
return Array.from(/* @__PURE__ */ new Set([currentLanguage, ...fallbackCodes]));
|
|
17354
|
+
}, [availableLanguageCodes, currentLanguage]);
|
|
17355
|
+
const languages = (0, import_react110.useMemo)(
|
|
17356
|
+
() => effectiveLanguageCodes.map((code) => ({
|
|
17018
17357
|
code,
|
|
17019
|
-
|
|
17358
|
+
// Resolve each label in its own locale so option names stay stable across UI language switches.
|
|
17359
|
+
displayName: (0, import_browser90.resolveLocaleDisplayName)(code, code) || code,
|
|
17020
17360
|
emoji: (0, import_browser90.resolveLocaleEmoji)(code)
|
|
17021
17361
|
})),
|
|
17022
|
-
[
|
|
17362
|
+
[effectiveLanguageCodes]
|
|
17023
17363
|
);
|
|
17024
17364
|
const handleLanguageChange = (language) => {
|
|
17025
17365
|
if (language !== currentLanguage) {
|
|
17026
17366
|
switchLanguage(language);
|
|
17027
17367
|
}
|
|
17028
17368
|
};
|
|
17029
|
-
return /* @__PURE__ */ (0,
|
|
17369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17030
17370
|
BaseLanguageSwitcher_default,
|
|
17031
17371
|
{
|
|
17032
17372
|
currentLanguage,
|