Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/contact-center/store/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class Store implements IStore {
this.isAddressBookEnabled = Boolean(response.addressBookId);
this.allowConsultToQueue = response.allowConsultToQueue;
this.agentProfile.agentName = response.agentName;
this.agentProfile.isTimeoutDesktopInactivityEnabled = response.isTimeoutDesktopInactivityEnabled;
this.agentProfile.timeoutDesktopInactivityMins = response.timeoutDesktopInactivityMins;
this.dataCenter = (response as {environment?: string}).environment || '';
})
.catch((error) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/contact-center/store/src/store.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ type AgentLoginProfile = {
social: number;
telephony: number;
};
isTimeoutDesktopInactivityEnabled?: boolean;
timeoutDesktopInactivityMins?: number;
};

// Generic pagination params for list-fetching APIs
Expand Down
2 changes: 2 additions & 0 deletions packages/contact-center/store/src/storeEventsWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ class StoreWrapper implements IStoreWrapper {
orgId: profile.orgId || undefined,
roles: profile.roles || undefined,
deviceType: profile.deviceType || undefined,
isTimeoutDesktopInactivityEnabled: profile.isTimeoutDesktopInactivityEnabled,
timeoutDesktopInactivityMins: profile.timeoutDesktopInactivityMins,
Comment on lines +421 to +422

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve timeout config when login payload omits it

When AGENT_STATION_LOGIN_SUCCESS or relogin payloads omit these optional fields (the existing station-login success fixture in packages/contact-center/station-login/tests/helper.ts has no timeout fields), setAgentProfile is invoked after registerCC and these assignments overwrite the timeout values that were just loaded from the registration Profile with undefined. Consumers reading store.agentProfile after login will lose isTimeoutDesktopInactivityEnabled/timeoutDesktopInactivityMins; only replace these keys when the payload actually includes them, or fall back to the existing values.

Useful? React with 👍 / 👎.

};
});
};
Expand Down
8 changes: 7 additions & 1 deletion packages/contact-center/store/tests/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ describe('Store', () => {
lastStateChangeTimestamp: date,
agentName: mockAgentName,
environment: 'produs1',
isTimeoutDesktopInactivityEnabled: true,
timeoutDesktopInactivityMins: 15,
};
mockWebex.cc.register.mockResolvedValue(mockResponse);

Expand All @@ -104,7 +106,11 @@ describe('Store', () => {
expect(storeInstance.deviceType).toEqual(mockResponse.deviceType);
expect(storeInstance.currentState).toEqual(mockResponse.lastStateAuxCodeId);
expect(storeInstance.lastStateChangeTimestamp).toEqual(date);
expect(storeInstance.agentProfile).toEqual({agentName: mockAgentName});
expect(storeInstance.agentProfile).toEqual({
agentName: mockAgentName,
isTimeoutDesktopInactivityEnabled: true,
timeoutDesktopInactivityMins: 15,
});
expect(storeInstance.dataCenter).toEqual(mockResponse.environment);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/contact-center/store/tests/storeEventsWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ const mockAgentProfile = {
roles: ['agent'],
orgId: 'mockOrgId',
profileType: 'BLENDED',
isTimeoutDesktopInactivityEnabled: true,
timeoutDesktopInactivityMins: 30,
};

const mockAgentProfilePayload = {
Expand Down