Compare commits
3 Commits
8eec5b3455
...
32f11a56ef
Author | SHA1 | Date | |
---|---|---|---|
![]() |
32f11a56ef | ||
![]() |
086fa86bbe | ||
![]() |
aad1a4bfe2 |
1433
package-lock.json
generated
1433
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,8 @@ import UserStore from './sdk/UserStrore';
|
|||||||
import Iframe from './sdk/Iframe'
|
import Iframe from './sdk/Iframe'
|
||||||
import BlockchainViewer from './components/ProcessesViewer';
|
import BlockchainViewer from './components/ProcessesViewer';
|
||||||
import FolderModal from './components/FolderModal';
|
import FolderModal from './components/FolderModal';
|
||||||
import type { ProfileData } from './sdk/models/ProfileData'
|
import type { ProfileCreated, ProfileData } from './sdk/models/ProfileData'
|
||||||
import type { FolderData } from './sdk/models/FolderData'
|
import type { FolderCreated, FolderData } from './sdk/models/FolderData'
|
||||||
|
|
||||||
const iframeUrl = 'https://dev3.4nkweb.com'
|
const iframeUrl = 'https://dev3.4nkweb.com'
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ function App() {
|
|||||||
validator: '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0'
|
validator: '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0'
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageBus.getInstance(iframeUrl).createProfile(completeProfileData).then((_profileData: ProfileData) => {
|
MessageBus.getInstance(iframeUrl).createProfile(completeProfileData).then((_profileCreated: ProfileCreated) => {
|
||||||
MessageBus.getInstance(iframeUrl).getProcesses().then((processes: any) => {
|
MessageBus.getInstance(iframeUrl).getProcesses().then((processes: any) => {
|
||||||
setProcesses(processes);
|
setProcesses(processes);
|
||||||
});
|
});
|
||||||
@ -126,7 +126,7 @@ function App() {
|
|||||||
|
|
||||||
// Gestionnaire pour soumettre les données du dossier
|
// Gestionnaire pour soumettre les données du dossier
|
||||||
const handleFolderSubmit = useCallback((folderData: FolderData) => {
|
const handleFolderSubmit = useCallback((folderData: FolderData) => {
|
||||||
MessageBus.getInstance(iframeUrl).createFolder(folderData).then((_folderData: FolderData) => {
|
MessageBus.getInstance(iframeUrl).createFolder(folderData).then((_folderCreated: FolderCreated) => {
|
||||||
MessageBus.getInstance(iframeUrl).getProcesses().then((processes: any) => {
|
MessageBus.getInstance(iframeUrl).getProcesses().then((processes: any) => {
|
||||||
setProcesses(processes);
|
setProcesses(processes);
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import IframeReference from './IframeReference';
|
import IframeReference from './IframeReference';
|
||||||
import EventBus from './EventBus';
|
import EventBus from './EventBus';
|
||||||
import UserStore from './UserStrore';
|
import UserStore from './UserStrore';
|
||||||
import type { ProfileData } from './models/ProfileData';
|
import type { ProfileCreated, ProfileData } from './models/ProfileData';
|
||||||
import type { FolderData } from './models/FolderData';
|
import type { FolderCreated, FolderData } from './models/FolderData';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
export default class MessageBus {
|
export default class MessageBus {
|
||||||
@ -300,23 +300,22 @@ export default class MessageBus {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public createProfile(profileData: ProfileData): Promise<ProfileData> {
|
public createProfile(profileData: ProfileData): Promise<ProfileCreated> {
|
||||||
return new Promise<ProfileData>((resolve: (profileData: ProfileData) => void, reject: (error: string) => void) => {
|
return new Promise<ProfileCreated>((resolve: (profileCreated: ProfileCreated) => void, reject: (error: string) => void) => {
|
||||||
this.checkToken().then(() => {
|
this.checkToken().then(() => {
|
||||||
const userStore = UserStore.getInstance();
|
const userStore = UserStore.getInstance();
|
||||||
const accessToken = userStore.getAccessToken()!;
|
const accessToken = userStore.getAccessToken()!;
|
||||||
const refreshToken = userStore.getRefreshToken()!;
|
|
||||||
|
|
||||||
const correlationId = uuidv4();
|
const correlationId = uuidv4();
|
||||||
this.initMessageListener(correlationId);
|
this.initMessageListener(correlationId);
|
||||||
|
|
||||||
const unsubscribe = EventBus.getInstance().on('PROFILE_CREATED', (responseId: string, profileData: ProfileData) => {
|
const unsubscribe = EventBus.getInstance().on('PROFILE_CREATED', (responseId: string, profileCreated: ProfileCreated) => {
|
||||||
if (responseId !== correlationId) {
|
if (responseId !== correlationId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
this.destroyMessageListener();
|
this.destroyMessageListener();
|
||||||
resolve(profileData);
|
resolve(profileCreated);
|
||||||
});
|
});
|
||||||
|
|
||||||
const unsubscribeError = EventBus.getInstance().on('ERROR_PROFILE_CREATED', (responseId: string, error: string) => {
|
const unsubscribeError = EventBus.getInstance().on('ERROR_PROFILE_CREATED', (responseId: string, error: string) => {
|
||||||
@ -332,14 +331,13 @@ export default class MessageBus {
|
|||||||
type: 'CREATE_PROFILE',
|
type: 'CREATE_PROFILE',
|
||||||
profileData,
|
profileData,
|
||||||
accessToken,
|
accessToken,
|
||||||
refreshToken
|
|
||||||
});
|
});
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public createFolder(folderData: FolderData): Promise<FolderData> {
|
public createFolder(folderData: FolderData): Promise<FolderCreated> {
|
||||||
return new Promise<FolderData>((resolve: (folderData: FolderData) => void, reject: (error: string) => void) => {
|
return new Promise<FolderCreated>((resolve: (folderData: FolderCreated) => void, reject: (error: string) => void) => {
|
||||||
this.checkToken().then(() => {
|
this.checkToken().then(() => {
|
||||||
const userStore = UserStore.getInstance();
|
const userStore = UserStore.getInstance();
|
||||||
const accessToken = userStore.getAccessToken()!;
|
const accessToken = userStore.getAccessToken()!;
|
||||||
@ -347,13 +345,13 @@ export default class MessageBus {
|
|||||||
const correlationId = uuidv4();
|
const correlationId = uuidv4();
|
||||||
this.initMessageListener(correlationId);
|
this.initMessageListener(correlationId);
|
||||||
|
|
||||||
const unsubscribe = EventBus.getInstance().on('FOLDER_CREATED', (responseId: string, folderData: FolderData) => {
|
const unsubscribe = EventBus.getInstance().on('FOLDER_CREATED', (responseId: string, folderCreated: FolderCreated) => {
|
||||||
if (responseId !== correlationId) {
|
if (responseId !== correlationId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
this.destroyMessageListener();
|
this.destroyMessageListener();
|
||||||
resolve(folderData);
|
resolve(folderCreated);
|
||||||
});
|
});
|
||||||
|
|
||||||
const unsubscribeError = EventBus.getInstance().on('ERROR_FOLDER_CREATED', (responseId: string, error: string) => {
|
const unsubscribeError = EventBus.getInstance().on('ERROR_FOLDER_CREATED', (responseId: string, error: string) => {
|
||||||
@ -497,7 +495,7 @@ export default class MessageBus {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EventBus.getInstance().emit('MESSAGE_RECEIVED', message);
|
EventBus.getInstance().emit('MESSAGE_RECEIVED', message);
|
||||||
EventBus.getInstance().emit('PROFILE_CREATED', correlationId, message.profileData);
|
EventBus.getInstance().emit('PROFILE_CREATED', correlationId, message.profileCreated);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'FOLDER_CREATED': // CREATE_FOLDER
|
case 'FOLDER_CREATED': // CREATE_FOLDER
|
||||||
@ -508,6 +506,7 @@ export default class MessageBus {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EventBus.getInstance().emit('MESSAGE_RECEIVED', message);
|
EventBus.getInstance().emit('MESSAGE_RECEIVED', message);
|
||||||
|
EventBus.getInstance().emit('FOLDER_CREATED', message.folderCreated);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'DATA_RETRIEVED': // RETRIEVE_DATA
|
case 'DATA_RETRIEVED': // RETRIEVE_DATA
|
||||||
|
@ -12,3 +12,9 @@ export interface FolderData {
|
|||||||
motes: string[];
|
motes: string[];
|
||||||
stakeholders: string[];
|
stakeholders: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FolderCreated {
|
||||||
|
processId: string,
|
||||||
|
process: any, // Process
|
||||||
|
folderData: FolderData,
|
||||||
|
}
|
||||||
|
@ -9,3 +9,9 @@ export interface ProfileData {
|
|||||||
country: string;
|
country: string;
|
||||||
idDocument?: string;
|
idDocument?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProfileCreated {
|
||||||
|
processId: string,
|
||||||
|
process: any, // Actually Process
|
||||||
|
profileData: ProfileData,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user