oro-sdk 3.17.0 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/dist/oro-sdk.cjs.development.js +55 -28
- package/dist/oro-sdk.cjs.development.js.map +1 -1
- package/dist/oro-sdk.cjs.production.min.js +1 -1
- package/dist/oro-sdk.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk.esm.js +55 -28
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +2 -0
- package/src/helpers/patient-registration.ts +9 -3
package/package.json
CHANGED
package/src/client.ts
CHANGED
@@ -702,6 +702,8 @@ export class OroClient {
|
|
702
702
|
|
703
703
|
// We're using the account role to determine the way a grant is accessed
|
704
704
|
let currentAccountRole = await this.getAccountRole()
|
705
|
+
if (currentAccountRole.length === 1 && currentAccountRole[0] === OtherRoleType.User)
|
706
|
+
return []
|
705
707
|
|
706
708
|
if ([OtherRoleType.Patient, OtherRoleType.User].every(requiredRole => currentAccountRole.includes(requiredRole))) {
|
707
709
|
let encryptedGrants
|
@@ -269,13 +269,19 @@ async function getOrCreatePatientLockbox(oroClient: OroClient): Promise<Uuid> {
|
|
269
269
|
if (grants.length > 0) {
|
270
270
|
console.log('The grant has already been created, skipping lockbox create step')
|
271
271
|
return grants[0].lockboxUuid!
|
272
|
-
} else
|
273
|
-
|
272
|
+
} else {
|
273
|
+
let lockboxResponse =
|
274
274
|
await oroClient.vaultClient.lockboxCreate().catch((err) => {
|
275
275
|
console.error('Error while creating lockbox', err)
|
276
276
|
throw err
|
277
277
|
})
|
278
|
-
|
278
|
+
// Since the creation of a lockbox will change the scope of a user, we will force refresh the tokens
|
279
|
+
let tokens = await oroClient.guardClient.authRefresh()
|
280
|
+
await oroClient.guardClient.setTokens({ accessToken: tokens.accessToken, refreshToken: tokens.refreshToken })
|
281
|
+
await oroClient.guardClient.whoAmI(true)
|
282
|
+
|
283
|
+
return lockboxResponse.lockboxUuid
|
284
|
+
}
|
279
285
|
}
|
280
286
|
|
281
287
|
/**
|