@axinom/mosaic-id-link 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IdentityServiceClient/IdentityServiceClient.d.ts.map +1 -1
- package/dist/components/EnsureAuthentication/EnsureAuthentication.d.ts.map +1 -1
- package/dist/index.es.js +94 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +94 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/IdentityServiceClient/IdentityServiceClient.ts +4 -0
- package/src/components/EnsureAuthentication/EnsureAuthentication.tsx +1 -0
- package/src/components/Login/Login.tsx +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityServiceClient.d.ts","sourceRoot":"","sources":["../../src/IdentityServiceClient/IdentityServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"IdentityServiceClient.d.ts","sourceRoot":"","sources":["../../src/IdentityServiceClient/IdentityServiceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EAGrB,aAAa,EACd,MAAM,yBAAyB,CAAC;AAWjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,MAAM,sBAAsB,GAAG,CACjC;IACE,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC;IACzC,SAAS,EAAE,oBAAoB,EAAE,CAAC;CACnC,GACD;IACE,MAAM,EACF,wBAAwB,CAAC,iBAAiB,GAC1C,wBAAwB,CAAC,sBAAsB,GAC/C,wBAAwB,CAAC,oBAAoB,GAC7C,wBAAwB,CAAC,KAAK,CAAC;CACpC,CACJ,GAAG;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,+BAA+B,EAAE,MAAM,CAAC;CACzC;AAED,MAAM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MAAM,EACnB,uBAAuB,EAAE,MAAM,KAC5B,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAC9B,qBAAqB,KAC5B,qBA8aF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnsureAuthentication.d.ts","sourceRoot":"","sources":["../../../src/components/EnsureAuthentication/EnsureAuthentication.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAUjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAkGD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"EnsureAuthentication.d.ts","sourceRoot":"","sources":["../../../src/components/EnsureAuthentication/EnsureAuthentication.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAUjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAkGD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA8FpE,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -7136,13 +7136,13 @@ const Login = ({ providers, brandingOptions, isDirectSignInEnabled, }) => {
|
|
|
7136
7136
|
React__default.createElement("div", { className: classes$5.whiteBox },
|
|
7137
7137
|
React__default.createElement("div", { className: classes$5.logo },
|
|
7138
7138
|
React__default.createElement("img", { alt: "Customer logo", src: (_b = brandingOptions === null || brandingOptions === void 0 ? void 0 : brandingOptions.companyLogo) !== null && _b !== void 0 ? _b : mosaicLogo })),
|
|
7139
|
-
isDirectSignInEnabled && axAuthConfig.enabled && (React__default.createElement("div", { className: classes$5.tabs },
|
|
7139
|
+
isDirectSignInEnabled && (axAuthConfig === null || axAuthConfig === void 0 ? void 0 : axAuthConfig.enabled) && (React__default.createElement("div", { className: classes$5.tabs },
|
|
7140
7140
|
React__default.createElement("div", { className: activeTab === 'signIn' ? activeTabClass : classes$5.tab, onClick: () => changeTab('signIn') }, "Sign In"),
|
|
7141
7141
|
React__default.createElement("div", { className: activeTab === 'signUp' ? activeTabClass : classes$5.tab, onClick: () => changeTab('signUp') }, "Sign Up"))),
|
|
7142
7142
|
React__default.createElement("div", { className: classes$5.tabContent },
|
|
7143
7143
|
React__default.createElement("div", { id: "signIn", className: activeTab === 'signIn' ? classes$5.active : classes$5.content },
|
|
7144
7144
|
errorMessage && (React__default.createElement("div", { className: classes$5.errorMessage, "data-test-id": "login-error-message" }, errorMessage)),
|
|
7145
|
-
isDirectSignInEnabled && axAuthConfig.enabled && (React__default.createElement(React__default.Fragment, null,
|
|
7145
|
+
isDirectSignInEnabled && (axAuthConfig === null || axAuthConfig === void 0 ? void 0 : axAuthConfig.enabled) && (React__default.createElement(React__default.Fragment, null,
|
|
7146
7146
|
React__default.createElement(Formik, { initialValues: {}, onSubmit: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7147
7147
|
yield directSignIn();
|
|
7148
7148
|
}) },
|
|
@@ -7163,10 +7163,10 @@ const Login = ({ providers, brandingOptions, isDirectSignInEnabled, }) => {
|
|
|
7163
7163
|
React__default.createElement("div", { className: classes$5.forgotPassword, "data-test-id": "forgot-password" },
|
|
7164
7164
|
React__default.createElement("a", { onClick: () => setIsForgotPassword(true) }, "Forgot Password")))),
|
|
7165
7165
|
isDirectSignInEnabled &&
|
|
7166
|
-
axAuthConfig.enabled &&
|
|
7166
|
+
(axAuthConfig === null || axAuthConfig === void 0 ? void 0 : axAuthConfig.enabled) &&
|
|
7167
7167
|
enabledExternalProvidersCount > 0 && (React__default.createElement("div", { className: classes$5.separator },
|
|
7168
7168
|
React__default.createElement("span", null, "or"))),
|
|
7169
|
-
isDirectSignInEnabled && !axAuthConfig.enabled && (React__default.createElement("div", { className: classes$5.authTitle }, "Sign In")),
|
|
7169
|
+
isDirectSignInEnabled && !(axAuthConfig === null || axAuthConfig === void 0 ? void 0 : axAuthConfig.enabled) && (React__default.createElement("div", { className: classes$5.authTitle }, "Sign In")),
|
|
7170
7170
|
providersToRender.map((idp) => idp.enabled && (React__default.createElement("div", { className: classes$5.buttonIdp, key: idp.idpId, onClick: () => {
|
|
7171
7171
|
window.location.assign(getIdpAuthUrl(idp.idpId, originUrl, isDirectSignInEnabled !== null && isDirectSignInEnabled !== void 0 ? isDirectSignInEnabled : false));
|
|
7172
7172
|
}, "data-test-id": `login-with:${idp.idpId}` },
|
|
@@ -7375,6 +7375,7 @@ const EnsureAuthentication = ({ children, brandingOptions, }) => {
|
|
|
7375
7375
|
}
|
|
7376
7376
|
}
|
|
7377
7377
|
catch (error) {
|
|
7378
|
+
console.error(error);
|
|
7378
7379
|
setIsProbableApiMismatch(true);
|
|
7379
7380
|
}
|
|
7380
7381
|
finally {
|
|
@@ -11631,6 +11632,7 @@ const createIdentityServiceClient = (config) => {
|
|
|
11631
11632
|
return token.response;
|
|
11632
11633
|
});
|
|
11633
11634
|
let tokenLoadingPromise = null;
|
|
11635
|
+
let axAuthClientId;
|
|
11634
11636
|
return {
|
|
11635
11637
|
/**
|
|
11636
11638
|
* Adds an event handler that will be raised whenever a new token response is loaded from the backend.
|
|
@@ -11657,6 +11659,9 @@ const createIdentityServiceClient = (config) => {
|
|
|
11657
11659
|
if (configStatusResponse.code === dist.ConfigStatusResponseCode.SUCCESS) {
|
|
11658
11660
|
const providers = configStatusResponse.enabledIdentityProviders.map((idpConfig) => {
|
|
11659
11661
|
var _a, _b;
|
|
11662
|
+
if (idpConfig.idProvider === dist.IdentityProvider.AX_AUTH) {
|
|
11663
|
+
axAuthClientId = idpConfig.clientId;
|
|
11664
|
+
}
|
|
11660
11665
|
return {
|
|
11661
11666
|
idpId: idpConfig.idProvider,
|
|
11662
11667
|
displayName: (_a = idpConfig.customBrandingConfig.displayName) !== null && _a !== void 0 ? _a : '',
|
|
@@ -11753,16 +11758,99 @@ const createIdentityServiceClient = (config) => {
|
|
|
11753
11758
|
},
|
|
11754
11759
|
initiateSignUp(initiateSignUpRequest, axAuthManagementBaseUrl) {
|
|
11755
11760
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11756
|
-
{
|
|
11761
|
+
if (!axAuthClientId) {
|
|
11757
11762
|
throw new Error('Invalid configuration. AxAuthClientId is missing.');
|
|
11758
11763
|
}
|
|
11764
|
+
const variables = {
|
|
11765
|
+
input: {
|
|
11766
|
+
firstName: initiateSignUpRequest.firstName,
|
|
11767
|
+
lastName: initiateSignUpRequest.lastName,
|
|
11768
|
+
email: initiateSignUpRequest.email,
|
|
11769
|
+
password: initiateSignUpRequest.password,
|
|
11770
|
+
oAuthClientId: axAuthClientId,
|
|
11771
|
+
},
|
|
11772
|
+
};
|
|
11773
|
+
try {
|
|
11774
|
+
const userSignUpResponse = yield fetch(`${axAuthManagementBaseUrl}`, {
|
|
11775
|
+
method: 'POST',
|
|
11776
|
+
cache: 'no-cache',
|
|
11777
|
+
redirect: 'follow',
|
|
11778
|
+
referrerPolicy: 'origin',
|
|
11779
|
+
headers: {
|
|
11780
|
+
'content-type': 'application/json',
|
|
11781
|
+
},
|
|
11782
|
+
body: stringifyGqlQuery(InitiateManagementUserSignUpDocument, variables),
|
|
11783
|
+
});
|
|
11784
|
+
if (userSignUpResponse.ok) {
|
|
11785
|
+
const responseBody = yield userSignUpResponse.json();
|
|
11786
|
+
if (responseBody.errors) {
|
|
11787
|
+
return {
|
|
11788
|
+
isSuccess: false,
|
|
11789
|
+
errorMessage: responseBody.errors[0].message,
|
|
11790
|
+
};
|
|
11791
|
+
}
|
|
11792
|
+
return { isSuccess: true };
|
|
11793
|
+
}
|
|
11794
|
+
const responseBody = yield userSignUpResponse.text();
|
|
11795
|
+
return {
|
|
11796
|
+
isSuccess: false,
|
|
11797
|
+
errorMessage: `Unknown error occurred while initiating user sign up process. Original error: ${responseBody}`,
|
|
11798
|
+
};
|
|
11799
|
+
}
|
|
11800
|
+
catch (e) {
|
|
11801
|
+
const error = e;
|
|
11802
|
+
return {
|
|
11803
|
+
isSuccess: false,
|
|
11804
|
+
errorMessage: `Unknown error occurred while initiating user sign up process. Original error: ${error.message}`,
|
|
11805
|
+
};
|
|
11806
|
+
}
|
|
11759
11807
|
});
|
|
11760
11808
|
},
|
|
11761
11809
|
initiatePasswordReset(email, axAuthManagementBaseUrl) {
|
|
11762
11810
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11763
|
-
{
|
|
11811
|
+
if (!axAuthClientId) {
|
|
11764
11812
|
throw new Error('Invalid configuration. AxAuthClientId is missing.');
|
|
11765
11813
|
}
|
|
11814
|
+
const variables = {
|
|
11815
|
+
input: {
|
|
11816
|
+
email,
|
|
11817
|
+
oAuthClientId: axAuthClientId,
|
|
11818
|
+
},
|
|
11819
|
+
};
|
|
11820
|
+
try {
|
|
11821
|
+
const passwordResetResponse = yield fetch(`${axAuthManagementBaseUrl}`, {
|
|
11822
|
+
method: 'POST',
|
|
11823
|
+
cache: 'no-cache',
|
|
11824
|
+
redirect: 'follow',
|
|
11825
|
+
referrerPolicy: 'origin',
|
|
11826
|
+
headers: {
|
|
11827
|
+
'content-type': 'application/json',
|
|
11828
|
+
},
|
|
11829
|
+
body: stringifyGqlQuery(InitiateManagementUserPasswordResetDocument, variables),
|
|
11830
|
+
});
|
|
11831
|
+
if (passwordResetResponse.ok) {
|
|
11832
|
+
const responseBody = yield passwordResetResponse.json();
|
|
11833
|
+
if (responseBody.errors) {
|
|
11834
|
+
return {
|
|
11835
|
+
isSuccess: false,
|
|
11836
|
+
errorMessage: responseBody.errors[0].message,
|
|
11837
|
+
};
|
|
11838
|
+
}
|
|
11839
|
+
return { isSuccess: true };
|
|
11840
|
+
}
|
|
11841
|
+
const responseBody = yield passwordResetResponse.text();
|
|
11842
|
+
return {
|
|
11843
|
+
isSuccess: false,
|
|
11844
|
+
errorMessage: `Unknown error occurred while initiating password reset process. Original error: ${responseBody}`,
|
|
11845
|
+
};
|
|
11846
|
+
}
|
|
11847
|
+
catch (e) {
|
|
11848
|
+
const error = e;
|
|
11849
|
+
return {
|
|
11850
|
+
isSuccess: false,
|
|
11851
|
+
errorMessage: `Unknown error occurred while initiating password reset process. Original error: ${error.message}`,
|
|
11852
|
+
};
|
|
11853
|
+
}
|
|
11766
11854
|
});
|
|
11767
11855
|
},
|
|
11768
11856
|
completePasswordReset(resetOtp, newPassword, axAuthManagementBaseUrl) {
|