@unblu/embedded-app-component 8.19.1 → 8.21.0
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/lib/index.d.ts +39 -0
- package/dist/lib/internal/internal-embedded-api.d.ts +16 -0
- package/dist/lib/internal/module/embedded-meta-module.d.ts +17 -0
- package/dist/lib/internal/module/general-module.d.ts +16 -0
- package/dist/lib/shared/api-state.d.ts +8 -0
- package/dist/lib/shared/conversation.d.ts +313 -0
- package/dist/lib/shared/internal/api-bridge.d.ts +36 -0
- package/dist/lib/shared/internal/event.d.ts +6 -0
- package/dist/lib/shared/internal/initialized-unblu-api.d.ts +10 -0
- package/dist/lib/shared/internal/initialized-unblu-element.d.ts +10 -0
- package/dist/lib/shared/internal/java-error-codes.d.ts +5 -0
- package/dist/lib/shared/internal/model/destroy-mode.d.ts +4 -0
- package/dist/lib/shared/internal/model/destroy-options.d.ts +4 -0
- package/dist/lib/shared/internal/module/agent-availability-module.d.ts +14 -0
- package/dist/lib/shared/internal/module/base-general-module.d.ts +35 -0
- package/dist/lib/shared/internal/module/conversation-module.d.ts +64 -0
- package/dist/lib/shared/internal/module/module.d.ts +10 -0
- package/dist/lib/shared/internal/unblu-floating-api.d.ts +15 -0
- package/dist/lib/shared/internal/unblu-util.d.ts +76 -0
- package/dist/lib/shared/internal/util/event-emitter.d.ts +44 -0
- package/dist/lib/shared/model/agent-availability-state.d.ts +18 -0
- package/dist/lib/shared/model/branchclient/language.d.ts +14 -0
- package/dist/lib/shared/model/branchclient/named-area-agent-availability.d.ts +19 -0
- package/dist/lib/shared/model/call-connection-state.d.ts +18 -0
- package/dist/lib/shared/model/call-state.d.ts +30 -0
- package/dist/lib/shared/model/configuration.d.ts +53 -0
- package/dist/lib/shared/model/connection-state.d.ts +27 -0
- package/dist/lib/shared/model/conversation-info.d.ts +42 -0
- package/dist/lib/shared/model/conversation-message-info.d.ts +14 -0
- package/dist/lib/shared/model/conversation-participant.d.ts +15 -0
- package/dist/lib/shared/model/conversation-participation-type.d.ts +18 -0
- package/dist/lib/shared/model/conversation-recipient-type.d.ts +18 -0
- package/dist/lib/shared/model/conversation-recipient.d.ts +18 -0
- package/dist/lib/shared/model/conversation-state.d.ts +37 -0
- package/dist/lib/shared/model/conversation-type.d.ts +47 -0
- package/dist/lib/shared/model/customaction/custom-action-invocation.d.ts +27 -0
- package/dist/lib/shared/model/customaction/custom-conversation-action-invocation.d.ts +6 -0
- package/dist/lib/shared/model/customaction/custom-message-action-invocation.d.ts +16 -0
- package/dist/lib/shared/model/customaction/custom-person-action-invocation.d.ts +11 -0
- package/dist/lib/shared/model/new-conversation-interceptor-result.d.ts +14 -0
- package/dist/lib/shared/model/new-conversation-recipient-type.d.ts +10 -0
- package/dist/lib/shared/model/new-conversation-recipient.d.ts +14 -0
- package/dist/lib/shared/model/person-info.d.ts +5 -0
- package/dist/lib/shared/new-conversation-interceptor.d.ts +24 -0
- package/dist/lib/shared/unblu-api-error.d.ts +117 -0
- package/dist/lib/unblu-embedded-api.d.ts +554 -0
- package/dist/lib/unblu-embedded-api.js +1 -3
- package/dist/lib/unblu-embedded-api.js.map +1 -1
- package/dist/lib/unblu-embedded-app-element.d.ts +708 -0
- package/dist/lib/unblu-embedded-app-element.js +1 -3
- package/dist/lib/unblu-embedded-app-element.js.map +1 -1
- package/dist/lib/view-mode.d.ts +5 -0
- package/dist/lib/web-types.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ApiState } from "./shared/api-state";
|
|
2
|
+
import { CallState } from "./shared/model/call-state";
|
|
3
|
+
import { ConnectionState } from './shared/model/connection-state';
|
|
4
|
+
import { ConversationType } from './shared/model/conversation-type';
|
|
5
|
+
import { ConversationRecipientType } from "./shared/model/conversation-recipient-type";
|
|
6
|
+
import { NewConversationRecipientType } from "./shared/model/new-conversation-recipient-type";
|
|
7
|
+
import { ConversationParticipationType } from "./shared/model/conversation-participation-type";
|
|
8
|
+
import { AgentAvailabilityState } from "./shared/model/agent-availability-state";
|
|
9
|
+
import { ViewMode } from "./view-mode";
|
|
10
|
+
import { UnbluApiError, UnbluErrorType } from "./shared/unblu-api-error";
|
|
11
|
+
import { ConversationState } from "./shared/model/conversation-state";
|
|
12
|
+
import { ConversationEventType } from "./shared/internal/module/conversation-module";
|
|
13
|
+
import { CallStateListener, ConnectionStateListener, ConversationStateListener, CustomActionInvocationListener } from "./shared/conversation";
|
|
14
|
+
export { UnbluEmbeddedAppElement, StateChangeEvent, ReadyEvent, ErrorEvent, DeinitializationStartedEvent, DeinitializationFinishedEvent, ActiveConversationChangeEvent, FullscreenChangeEvent, ViewModeChangeEvent } from "./unblu-embedded-app-element";
|
|
15
|
+
export { UnbluEmbeddedApi, ActiveConversationChangeListener, AgentAvailabilityChangeListener, AgentAvailableChangeListener, ConversationsChangeListener, DeinitializationListener, NotificationCountChangeListener, PersonChangeListener, PersonActivityListener, FullscreenChangeListener, ViewModeChangeListener } from "./unblu-embedded-api";
|
|
16
|
+
export { PersonInfo } from "./shared/model/person-info";
|
|
17
|
+
export { Conversation } from "./shared/conversation";
|
|
18
|
+
export { ConversationInfo } from "./shared/model/conversation-info";
|
|
19
|
+
export { NewConversationInterceptor } from "./shared/new-conversation-interceptor";
|
|
20
|
+
export { NewConversationInterceptorResult } from "./shared/model/new-conversation-interceptor-result";
|
|
21
|
+
export { ConversationRecipient } from "./shared/model/conversation-recipient";
|
|
22
|
+
export { NewConversationRecipient } from "./shared/model/new-conversation-recipient";
|
|
23
|
+
export { ConversationParticipant } from "./shared/model/conversation-participant";
|
|
24
|
+
export { CustomActionInvocation } from "./shared/model/customaction/custom-action-invocation";
|
|
25
|
+
export { ApiState, CallState, ConnectionState, ConversationType, ConversationState, ConversationEventType, ConversationRecipientType, NewConversationRecipientType, ConversationParticipationType, AgentAvailabilityState, ViewMode, UnbluErrorType, UnbluApiError, ConnectionStateListener, ConversationStateListener, CallStateListener, CustomActionInvocationListener, };
|
|
26
|
+
declare const _default: {
|
|
27
|
+
ApiState: typeof ApiState;
|
|
28
|
+
CallState: typeof CallState;
|
|
29
|
+
ConnectionState: typeof ConnectionState;
|
|
30
|
+
ConversationState: typeof ConversationState;
|
|
31
|
+
ConversationType: typeof ConversationType;
|
|
32
|
+
ConversationRecipientType: typeof ConversationRecipientType;
|
|
33
|
+
NewConversationRecipientType: typeof NewConversationRecipientType;
|
|
34
|
+
ConversationParticipationType: typeof ConversationParticipationType;
|
|
35
|
+
AgentAvailabilityState: typeof AgentAvailabilityState;
|
|
36
|
+
ViewMode: typeof ViewMode;
|
|
37
|
+
UnbluErrorType: typeof UnbluErrorType;
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiBridge } from '../shared/internal/api-bridge';
|
|
2
|
+
import { EmbeddedMetaModule } from './module/embedded-meta-module';
|
|
3
|
+
import { ConversationModule } from '../shared/internal/module/conversation-module';
|
|
4
|
+
import { AgentAvailabilityModule } from '../shared/internal/module/agent-availability-module';
|
|
5
|
+
import { GeneralModule } from "./module/general-module";
|
|
6
|
+
import { Configuration } from "../shared/model/configuration";
|
|
7
|
+
export declare class InternalEmbeddedApi {
|
|
8
|
+
private readonly bridge;
|
|
9
|
+
readonly configuration: Configuration;
|
|
10
|
+
readonly meta: EmbeddedMetaModule;
|
|
11
|
+
readonly general: GeneralModule;
|
|
12
|
+
readonly conversation: ConversationModule;
|
|
13
|
+
readonly agentAvailability: AgentAvailabilityModule;
|
|
14
|
+
constructor(bridge: ApiBridge, configuration: Configuration);
|
|
15
|
+
checkCompatibility(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InternalModule } from '../../shared/internal/module/module';
|
|
2
|
+
import { ApiBridge } from '../../shared/internal/api-bridge';
|
|
3
|
+
import { UnbluEmbeddedAppElement } from "../../unblu-embedded-app-element";
|
|
4
|
+
import { DestroyOptions } from "../../shared/internal/model/destroy-options";
|
|
5
|
+
export type EmbeddedMetaEventType = 'deinitializing' | 'deinitialized';
|
|
6
|
+
declare const enum EmbeddedMetaFunction {
|
|
7
|
+
setUnbluEmbeddedAppElement = "setUnbluEmbeddedAppElement",
|
|
8
|
+
waitUntilInitialized = "waitUntilInitialized",
|
|
9
|
+
deinitialize = "deinitialize"
|
|
10
|
+
}
|
|
11
|
+
export declare class EmbeddedMetaModule extends InternalModule<EmbeddedMetaFunction, EmbeddedMetaEventType> {
|
|
12
|
+
constructor(bridge: ApiBridge);
|
|
13
|
+
setUnbluEmbeddedAppElement(appElement: UnbluEmbeddedAppElement): Promise<void>;
|
|
14
|
+
waitUntilInitialized(): Promise<void>;
|
|
15
|
+
deinitialize(destroyOptions?: DestroyOptions): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseGeneralEventType, BaseGeneralModule } from "../../shared/internal/module/base-general-module";
|
|
2
|
+
import { ViewMode } from "../../view-mode";
|
|
3
|
+
export type GeneralEventType = BaseGeneralEventType | 'fullscreenChange' | 'viewModeChange';
|
|
4
|
+
declare const enum GeneralFunction {
|
|
5
|
+
isFullscreen = "isFullscreen",
|
|
6
|
+
setFullscreen = "setFullscreen",
|
|
7
|
+
getViewMode = "getViewMode",
|
|
8
|
+
setViewMode = "setViewMode"
|
|
9
|
+
}
|
|
10
|
+
export declare class GeneralModule extends BaseGeneralModule<GeneralFunction, GeneralEventType> {
|
|
11
|
+
isFullscreen(): Promise<boolean>;
|
|
12
|
+
setFullscreen(enable: boolean): Promise<void>;
|
|
13
|
+
getViewMode(): Promise<ViewMode>;
|
|
14
|
+
setViewMode(mode: ViewMode): Promise<any>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { CallState } from './model/call-state';
|
|
2
|
+
import { ConversationEventType, ConversationModule, ConversationQueueStatus } from './internal/module/conversation-module';
|
|
3
|
+
import { Listener } from './internal/util/event-emitter';
|
|
4
|
+
import { ConversationState } from './model/conversation-state';
|
|
5
|
+
import { ConnectionState } from './model/connection-state';
|
|
6
|
+
import { CustomActionInvocation } from './model/customaction/custom-action-invocation';
|
|
7
|
+
import { CallConnectionState } from "./model/call-connection-state";
|
|
8
|
+
export type ConnectionStateListener = (connectionState: ConnectionState) => void;
|
|
9
|
+
export type ConversationStateListener = (conversationState: ConversationState) => void;
|
|
10
|
+
export type CallStateListener = (callState: CallState) => void;
|
|
11
|
+
export type QueueStatusChangeListener = (conversationQueueStatus: ConversationQueueStatus) => void;
|
|
12
|
+
export type CallConnectionStateChangeListener = (callConnectionState: CallConnectionState) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Listener called whenever a custom action invocation triggers an API event for the client
|
|
15
|
+
* @param customActionInvocation The details of the custom action invocation
|
|
16
|
+
*/
|
|
17
|
+
export type CustomActionInvocationListener = (customActionInvocation: CustomActionInvocation) => void;
|
|
18
|
+
/**
|
|
19
|
+
* #### This class gives API access to the currently active conversation.
|
|
20
|
+
*
|
|
21
|
+
* As long as a conversation is active one can register and receive the events provided by this class and call the methods.
|
|
22
|
+
* Once the conversation is closed this API object will be destroyed and no more event callbacks will be called.
|
|
23
|
+
* Any subsequent calls will fail.
|
|
24
|
+
*
|
|
25
|
+
* Use the {@link CLOSE} event to de-init any code connected to this conversation.
|
|
26
|
+
*/
|
|
27
|
+
export declare class Conversation {
|
|
28
|
+
private conversationModule;
|
|
29
|
+
private conversationId;
|
|
30
|
+
/**
|
|
31
|
+
* Event emitted when the {@link ConnectionState} of this conversation changes.
|
|
32
|
+
* @event connectionStateChange
|
|
33
|
+
* @see {@link on} for listener registration
|
|
34
|
+
*/
|
|
35
|
+
static readonly CONNECTION_STATE_CHANGE: 'connectionStateChange';
|
|
36
|
+
/**
|
|
37
|
+
* Event emitted when the {@link ConversationState} of this conversation changes.
|
|
38
|
+
* @event conversationStateChange
|
|
39
|
+
* @see {@link on} for listener registration
|
|
40
|
+
*/
|
|
41
|
+
static readonly CONVERSATION_STATE_CHANGE: 'conversationStateChange';
|
|
42
|
+
/**
|
|
43
|
+
* Event emitted when the {@link CallState} of this conversation changes.
|
|
44
|
+
* @event callStateChange
|
|
45
|
+
* @see {@link on} for listener registration
|
|
46
|
+
*/
|
|
47
|
+
static readonly CALL_STATE_CHANGE: 'callStateChange';
|
|
48
|
+
/**
|
|
49
|
+
* Event emitted when the queue status of this conversation changes.
|
|
50
|
+
* @event queueStatusChange
|
|
51
|
+
* @see {@link on} for listener registration
|
|
52
|
+
*/
|
|
53
|
+
static readonly QUEUE_STATUS_CHANGE: 'queueStatusChange';
|
|
54
|
+
/**
|
|
55
|
+
* Event emitted when the {@link CallConnectionState} of the conversation changes
|
|
56
|
+
* @event callConnectionStateChange
|
|
57
|
+
* @see {@link on} for listener registration
|
|
58
|
+
*/
|
|
59
|
+
static readonly CALL_CONNECTION_STATE_CHANGE: 'callConnectionStateChange';
|
|
60
|
+
/**
|
|
61
|
+
* Event emitted when the conversation ends.
|
|
62
|
+
* @deprecated The end event is not always available, depending on the configuration. Use the {@link CONVERSATION_STATE_CHANGE} event instead.
|
|
63
|
+
* @event end
|
|
64
|
+
* @see {@link on} for listener registration
|
|
65
|
+
*/
|
|
66
|
+
static readonly END: 'end';
|
|
67
|
+
/**
|
|
68
|
+
* Event emitted when the conversation is closed.
|
|
69
|
+
*
|
|
70
|
+
* This may happen due to a UI-navigation or an API-call.
|
|
71
|
+
*
|
|
72
|
+
* @event close
|
|
73
|
+
* @see {@link on} for listener registration
|
|
74
|
+
*/
|
|
75
|
+
static readonly CLOSE: 'close';
|
|
76
|
+
/**
|
|
77
|
+
* Event emitted every time a custom action is configured to trigger a JS API event for the current client when a custom action is invoked
|
|
78
|
+
*
|
|
79
|
+
* @event customActionInvocation
|
|
80
|
+
* @see {@link CustomActionInvocationListener}
|
|
81
|
+
* @see {@link on} for listener registration
|
|
82
|
+
*/
|
|
83
|
+
static readonly CUSTOM_ACTION_INVOCATION: 'customActionInvocation';
|
|
84
|
+
private eventEmitter;
|
|
85
|
+
private internalListeners;
|
|
86
|
+
private destroyed;
|
|
87
|
+
/**
|
|
88
|
+
* @hidden
|
|
89
|
+
*/
|
|
90
|
+
constructor(conversationModule: ConversationModule, conversationId: string);
|
|
91
|
+
/**
|
|
92
|
+
* Registers an event listener for the given event.
|
|
93
|
+
* @param event The call state change event.
|
|
94
|
+
* @param listener The listener to be called.
|
|
95
|
+
* @see {@link CONNECTION_STATE_CHANGE}
|
|
96
|
+
*/
|
|
97
|
+
on(event: typeof Conversation.CONNECTION_STATE_CHANGE, listener: ConnectionStateListener): void;
|
|
98
|
+
/**
|
|
99
|
+
* Registers an event listener for the given event.
|
|
100
|
+
* @param event The conversation state change event.
|
|
101
|
+
* @param listener The listener to be called.
|
|
102
|
+
* @see {@link CONVERSATION_STATE_CHANGE}
|
|
103
|
+
*/
|
|
104
|
+
on(event: typeof Conversation.CONVERSATION_STATE_CHANGE, listener: ConversationStateListener): void;
|
|
105
|
+
/**
|
|
106
|
+
* Registers an event listener for the given event.
|
|
107
|
+
* @param event The call state change event.
|
|
108
|
+
* @param listener The listener to be called.
|
|
109
|
+
* @see {@link CALL_STATE_CHANGE}
|
|
110
|
+
*/
|
|
111
|
+
on(event: typeof Conversation.CALL_STATE_CHANGE, listener: CallStateListener): void;
|
|
112
|
+
/**
|
|
113
|
+
* Registers an event listener for the given event
|
|
114
|
+
* @param event The call state change event
|
|
115
|
+
* @param listener The listener to be called
|
|
116
|
+
* @see {@link QUEUE_STATUS_CHANGE}
|
|
117
|
+
*/
|
|
118
|
+
on(event: typeof Conversation.QUEUE_STATUS_CHANGE, listener: QueueStatusChangeListener): void;
|
|
119
|
+
/**
|
|
120
|
+
* Registers an event listener for the given event
|
|
121
|
+
* @param event The call connection state change event
|
|
122
|
+
* @param listener The listener to be called
|
|
123
|
+
* @see {@link CALL_CONNECTION_STATE_CHANGE}
|
|
124
|
+
*/
|
|
125
|
+
on(event: typeof Conversation.CALL_CONNECTION_STATE_CHANGE, listener: CallConnectionStateChangeListener): void;
|
|
126
|
+
/**
|
|
127
|
+
* Registers an event listener for the given event.
|
|
128
|
+
* @deprecated The end event is not always available, depending on the configuration. Use instead {@link CONVERSATION_STATE_CHANGE} event.
|
|
129
|
+
* @param event The end event.
|
|
130
|
+
* @param listener The listener to be called.
|
|
131
|
+
* @see {@link END}
|
|
132
|
+
*/
|
|
133
|
+
on(event: typeof Conversation.END, listener: () => void): void;
|
|
134
|
+
/**
|
|
135
|
+
* Registers an event listener for the given event.
|
|
136
|
+
* @param event The close event.
|
|
137
|
+
* @param listener The listener to be called.
|
|
138
|
+
* @see {@link CLOSE}
|
|
139
|
+
*/
|
|
140
|
+
on(event: typeof Conversation.CLOSE, listener: () => void): void;
|
|
141
|
+
/**
|
|
142
|
+
* Registers an event listener for the given event.
|
|
143
|
+
* @param event The customActionInvocation event.
|
|
144
|
+
* @param listener The listener to be called.
|
|
145
|
+
* @see {@link CUSTOM_ACTION_INVOCATION}
|
|
146
|
+
*/
|
|
147
|
+
on(event: typeof Conversation.CUSTOM_ACTION_INVOCATION, listener: CustomActionInvocationListener): void;
|
|
148
|
+
/**
|
|
149
|
+
* Removes a previously registered listener.
|
|
150
|
+
* @param event The event to unregister from.
|
|
151
|
+
* @param listener The listener to remove.
|
|
152
|
+
*/
|
|
153
|
+
off(event: ConversationEventType, listener: Listener): boolean;
|
|
154
|
+
private onInternal;
|
|
155
|
+
private offInternal;
|
|
156
|
+
/**
|
|
157
|
+
* Returns the ID of this conversation.
|
|
158
|
+
*/
|
|
159
|
+
getConversationId(): string;
|
|
160
|
+
/**
|
|
161
|
+
* Returns the current connection state the conversation is in.
|
|
162
|
+
*
|
|
163
|
+
* If the connection is lost, the conversation will automatically try to reconnect using an exponential back-off strategy.
|
|
164
|
+
* If a fatal error is detected, the state will change to {@link ConnectionState.ERROR}.
|
|
165
|
+
*
|
|
166
|
+
* If this happens, the conversation is in it's terminal state. A dialog or other UI will be displayed to the user with details on the failure.
|
|
167
|
+
* The conversation is not automatically closed in this case.
|
|
168
|
+
* It may either be closed through a manual action by the visitor (confirming the error) or via the API.
|
|
169
|
+
*
|
|
170
|
+
* @see {@link CONNECTION_STATE_CHANGE} if you need to listen to changes.
|
|
171
|
+
* @return A promise that resolves to the current connection state of the conversation
|
|
172
|
+
* or is rejected with a {@link UnbluApiError} if the call fails.
|
|
173
|
+
*/
|
|
174
|
+
getConnectionState(): Promise<ConnectionState>;
|
|
175
|
+
/**
|
|
176
|
+
* Returns the current state the conversation is in.
|
|
177
|
+
* @return A promise that resolves to the current state of the conversation
|
|
178
|
+
* or is rejected with a {@link UnbluApiError} if the call fails.
|
|
179
|
+
*/
|
|
180
|
+
getConversationState(): Promise<ConversationState>;
|
|
181
|
+
/**
|
|
182
|
+
* Gets the conversation's call state the local participant has, check {@link CallState}
|
|
183
|
+
* for possible states.
|
|
184
|
+
* @see {@link CALL_STATE_CHANGE} if you need to listen to changes
|
|
185
|
+
* @return A promise that resolves to the current call state of the local participant
|
|
186
|
+
*/
|
|
187
|
+
getCallState(): Promise<CallState>;
|
|
188
|
+
/**
|
|
189
|
+
* Gets the conversation's queue status. The position and/or averageWaitingTime
|
|
190
|
+
* of the return value can be null, if the
|
|
191
|
+
* feature is disabled for them in the {@link https://www.unblu.com/en/docs/latest/reference/configuration-properties.html#com-unblu-conversation-queuestatus-queuestatusdisplaymode configuration}.
|
|
192
|
+
* @see {@link QUEUE_STATUS_CHANGE} if you need to listen to changes.
|
|
193
|
+
* @return A promise that either resolves to the current queue status of the conversation
|
|
194
|
+
* or resolves empty if the conversation isn't queued.
|
|
195
|
+
* The promise is rejected with a {@link UnbluApiError} if the call fails.
|
|
196
|
+
*/
|
|
197
|
+
getQueueStatus(): Promise<ConversationQueueStatus>;
|
|
198
|
+
/**
|
|
199
|
+
* Gets the call connection state for the current active call of the local participant.
|
|
200
|
+
* Check {@link CallConnectionState} for possible states.
|
|
201
|
+
* @see {@link CALL_CONNECTION_STATE_CHANGE} if you need to listen to changes.
|
|
202
|
+
* @return A promise that resolves to the current call connection state of the conversation
|
|
203
|
+
* or is rejected with a {@link UnbluApiError} if the call fails. The promise resolves to
|
|
204
|
+
* {@link CallConnectionState.DISCONNECTED} if there's no active call.
|
|
205
|
+
*/
|
|
206
|
+
getCallConnectionState(): Promise<CallConnectionState>;
|
|
207
|
+
/**
|
|
208
|
+
* Set custom visitor data on the conversation. Don't use for confidential information. Security-related
|
|
209
|
+
* data should be stored in the conversation metadata.
|
|
210
|
+
*
|
|
211
|
+
* @param visitorData Custom data for the visitor in any format.
|
|
212
|
+
*/
|
|
213
|
+
setVisitorData(visitorData: String): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Get the custom visitor data from the conversation.
|
|
216
|
+
*
|
|
217
|
+
* @return The custom visitor data in the conversation
|
|
218
|
+
*/
|
|
219
|
+
getVisitorData(): Promise<String>;
|
|
220
|
+
/**
|
|
221
|
+
* Starts a voice call in this conversation.
|
|
222
|
+
*
|
|
223
|
+
* - If a call is already active, this call will be ignored.
|
|
224
|
+
* - If the local person doesn't have the right to start a voice call,
|
|
225
|
+
* the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.
|
|
226
|
+
* @see {@link CALL_STATE_CHANGE} If you need to listen to changes.
|
|
227
|
+
* @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.
|
|
228
|
+
*/
|
|
229
|
+
startAudioCall(): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Starts a video call in this conversation.
|
|
232
|
+
*
|
|
233
|
+
* - If a call is already active, this call will be ignored.
|
|
234
|
+
* - If the local person doesn't have the right to start a video call,
|
|
235
|
+
* the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.
|
|
236
|
+
* @see {@link CALL_STATE_CHANGE} If you need to listen to changes.
|
|
237
|
+
* @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.
|
|
238
|
+
*/
|
|
239
|
+
startVideoCall(): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Ends and closes this conversation.
|
|
242
|
+
*
|
|
243
|
+
* If the local person doesn't have the right to end the conversation,
|
|
244
|
+
* the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.
|
|
245
|
+
* @see {@link END} fired after this call.
|
|
246
|
+
* @see {@link closeConversation} for details on closing a conversation.
|
|
247
|
+
* @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.
|
|
248
|
+
*/
|
|
249
|
+
endConversation(): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Leaves and closes this conversation.
|
|
252
|
+
*
|
|
253
|
+
* By leaving, the visitor is removed from the active participant list of the conversation.
|
|
254
|
+
* Once a conversation is left, the visitor can not re-open it. It will not be visible in the conversation history either.
|
|
255
|
+
*
|
|
256
|
+
* If the local person doesn't have the right to leave the conversation,
|
|
257
|
+
* the returned promise will be rejected with the unblu error type {@link UnbluErrorType.ACTION_NOT_GRANTED}.
|
|
258
|
+
* @see {@link CLOSE} fired after this call.
|
|
259
|
+
* @see {@link closeConversation} for details on closing a conversation without leaving.
|
|
260
|
+
* @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.
|
|
261
|
+
*/
|
|
262
|
+
leaveConversation(): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Closes this conversation locally.
|
|
265
|
+
*
|
|
266
|
+
* When called, the connection to this conversation is closed and the overview is displayed.
|
|
267
|
+
*
|
|
268
|
+
* **Note that:**
|
|
269
|
+
* - Closing does NOT end the conversation.
|
|
270
|
+
* - The person does NOT leave the conversation.
|
|
271
|
+
* - All Conversation api instances for this conversation will be destroyed.
|
|
272
|
+
*
|
|
273
|
+
* The conversation can be joined again either via the UI or using {@link UnbluApi.openConversation}.
|
|
274
|
+
* @see {@link CLOSE} fired after this call.
|
|
275
|
+
* @see {@link endConversation} for details on ending a conversation.
|
|
276
|
+
* @see {@link leaveConversation} for details on leaving a conversation.
|
|
277
|
+
* @see {@link destroy} for details on destroying a conversation.
|
|
278
|
+
* @return A Promise that resolves to null or is rejected with a {@link UnbluApiError} if the call fails.
|
|
279
|
+
*/
|
|
280
|
+
closeConversation(): Promise<void>;
|
|
281
|
+
private checkNotDestroyed;
|
|
282
|
+
/**
|
|
283
|
+
* Returns weather this conversation is destroyed or not.
|
|
284
|
+
*
|
|
285
|
+
* Conversations are destroyed if {@link destroy} is called or the conversation is closed.
|
|
286
|
+
* This usually happens when the user navigates back to an overview or into an other conversation.
|
|
287
|
+
* @see {@link destroy}
|
|
288
|
+
* @see {@link CLOSE}
|
|
289
|
+
* @return Weather this conversation is destroyed or not.
|
|
290
|
+
*/
|
|
291
|
+
isDestroyed(): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Destroys this conversation API instance.
|
|
294
|
+
*
|
|
295
|
+
* Calling destroy will unregister all event listeners and prohibit any further calls to this object.
|
|
296
|
+
* Once the conversation is destroyed, any subsequent calls will reject the returned promise with {@link UnbluErrorType.ILLEGAL_STATE} as the reason.
|
|
297
|
+
*
|
|
298
|
+
* **Note that:**
|
|
299
|
+
* - Destroying does NOT close the conversation .
|
|
300
|
+
* - Destroying does NOT end the conversation.
|
|
301
|
+
* - Destroying does NOT leave the conversation.
|
|
302
|
+
* - Other instances of the same Conversation will NOT be destroyed.
|
|
303
|
+
*
|
|
304
|
+
* This call simply destroys this local API instance to the conversation.
|
|
305
|
+
*
|
|
306
|
+
* A destroyed but still open conversation can be accessed again using {@link UnbluApi.getActiveConversation}.
|
|
307
|
+
*
|
|
308
|
+
* @see {@link isDestroyed}
|
|
309
|
+
* @see {@link closeConversation} for details on how to close a conversation
|
|
310
|
+
* @see {@link endConversation} for details on how to end a conversation
|
|
311
|
+
*/
|
|
312
|
+
destroy(): void;
|
|
313
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EventCallback } from './event';
|
|
2
|
+
export declare class ApiBridge {
|
|
3
|
+
private mountPoint;
|
|
4
|
+
private mountName;
|
|
5
|
+
private internal;
|
|
6
|
+
private readonly eventHandler;
|
|
7
|
+
/**
|
|
8
|
+
* instantiates the bridge that links the UNBLU internal API provided by the collaboration server with the UNBLU JS-API
|
|
9
|
+
* @param mountPoint the global unblu object under which the internal API is registered.
|
|
10
|
+
*/
|
|
11
|
+
constructor(mountPoint: any, mountName: string);
|
|
12
|
+
waitUntilLoaded(timeout: number, promise?: Promise<void>): Promise<void>;
|
|
13
|
+
private checkLoaded;
|
|
14
|
+
checkCompatibility(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Calls an API function of the internal unblu collaboration server API.
|
|
17
|
+
* @param moduleName The module to which the function belongs.
|
|
18
|
+
* @param functionName The function to call.
|
|
19
|
+
* @param args The arguments to pass to the function.
|
|
20
|
+
*/
|
|
21
|
+
callApiFunction(moduleName: string, functionName: string, args: any[]): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Registers a callback for an event emitted by the internal unblu collaboration server API.
|
|
24
|
+
* @param module The module that emits the event.
|
|
25
|
+
* @param event The event name.
|
|
26
|
+
* @param callback The callback which will be called every time the event is emitted.
|
|
27
|
+
*/
|
|
28
|
+
on(module: string, event: string, callback: EventCallback): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Unregisters a callback for an event emitted by the internal unblu collaboration server API.
|
|
31
|
+
* @param module The module that emits the event.
|
|
32
|
+
* @param event The event name.
|
|
33
|
+
* @param callback Optionally callback which will be removed, if none is provided all listeners of the event will be removed.
|
|
34
|
+
*/
|
|
35
|
+
off(module: string, event: string, callback?: EventCallback): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CATEGORY_INVALID_FUNCTION_CALL = 1;
|
|
2
|
+
export declare const CATEGORY_INVALID_FUNCTION_ARGUMENTS = 2;
|
|
3
|
+
export declare const CATEGORY_EXECUTION_EXCEPTION = 3;
|
|
4
|
+
export declare const CATEGORY_ACTION_NOT_GRANTED = 4;
|
|
5
|
+
export declare const CATEGORY_TIMEOUT = 5;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InternalModule } from './module';
|
|
2
|
+
import { ApiBridge } from '../api-bridge';
|
|
3
|
+
import { AgentAvailabilityState } from '../../model/agent-availability-state';
|
|
4
|
+
export type AgentAvailabilityEventType = 'availableChange' | 'availabilityChange';
|
|
5
|
+
declare const enum AgentAvailabilityFunction {
|
|
6
|
+
isAgentAvailable = "isAgentAvailable",
|
|
7
|
+
getAgentAvailabilityState = "getAgentAvailabilityState"
|
|
8
|
+
}
|
|
9
|
+
export declare class AgentAvailabilityModule extends InternalModule<AgentAvailabilityFunction, AgentAvailabilityEventType> {
|
|
10
|
+
constructor(bridge: ApiBridge);
|
|
11
|
+
isAgentAvailable(): Promise<boolean>;
|
|
12
|
+
getAgentAvailabilityState(): Promise<AgentAvailabilityState>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ApiBridge } from "../api-bridge";
|
|
2
|
+
import { InternalModule } from "./module";
|
|
3
|
+
import { NewConversationInterceptor } from "../../new-conversation-interceptor";
|
|
4
|
+
import { ConversationType } from "../../model/conversation-type";
|
|
5
|
+
import { PersonInfo } from "../../model/person-info";
|
|
6
|
+
import { ConversationInfo } from "../../model/conversation-info";
|
|
7
|
+
import { NewConversationRecipient } from "../../model/new-conversation-recipient";
|
|
8
|
+
export type BaseGeneralEventType = 'activeConversationChange' | 'conversationsChange' | 'notificationCountChange' | 'personChange' | 'personActivity';
|
|
9
|
+
export declare enum BaseGeneralFunction {
|
|
10
|
+
startConversation = "startConversation",
|
|
11
|
+
setNewConversationInterceptor = "setNewConversationInterceptor",
|
|
12
|
+
joinConversation = "joinConversation",
|
|
13
|
+
openConversation = "openConversation",
|
|
14
|
+
getActiveConversation = "getActiveConversation",
|
|
15
|
+
getConversations = "getConversations",
|
|
16
|
+
getNotificationCount = "getNotificationCount",
|
|
17
|
+
getPersonInfo = "getPersonInfo",
|
|
18
|
+
setPersonNickname = "setPersonNickname",
|
|
19
|
+
addPersonLabel = "addPersonLabel",
|
|
20
|
+
removePersonLabel = "removePersonLabel"
|
|
21
|
+
}
|
|
22
|
+
export declare class BaseGeneralModule<T extends string | BaseGeneralFunction, E extends BaseGeneralEventType | string> extends InternalModule<BaseGeneralFunction | T, E> {
|
|
23
|
+
constructor(bridge: ApiBridge);
|
|
24
|
+
startConversation(type: ConversationType, visitorName?: string, visitorData?: string, recipient?: NewConversationRecipient, languageTag?: string): Promise<string>;
|
|
25
|
+
setNewConversationInterceptor(callback: NewConversationInterceptor): Promise<void>;
|
|
26
|
+
joinConversation(pin: string, visitorName?: string): Promise<string>;
|
|
27
|
+
openConversation(conversationId: string): Promise<void>;
|
|
28
|
+
getActiveConversation(): Promise<string | null>;
|
|
29
|
+
getConversations(): Promise<ConversationInfo[]>;
|
|
30
|
+
getNotificationCount(): Promise<number>;
|
|
31
|
+
getPersonInfo(): Promise<PersonInfo>;
|
|
32
|
+
setPersonNickname(nickname: string): Promise<void>;
|
|
33
|
+
addPersonLabel(labelName: string): Promise<void>;
|
|
34
|
+
removePersonLabel(labelName: string): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { InternalModule } from './module';
|
|
2
|
+
import { ApiBridge } from '../api-bridge';
|
|
3
|
+
import { CallState } from '../../model/call-state';
|
|
4
|
+
import { ConversationState } from '../../model/conversation-state';
|
|
5
|
+
import { ConnectionState } from '../../model/connection-state';
|
|
6
|
+
import { CallConnectionState } from "../../model/call-connection-state";
|
|
7
|
+
export interface ConversationCallState {
|
|
8
|
+
conversationId: string;
|
|
9
|
+
callState: CallState;
|
|
10
|
+
}
|
|
11
|
+
export interface ConversationConnectionState {
|
|
12
|
+
conversationId: string;
|
|
13
|
+
connectionState: ConnectionState;
|
|
14
|
+
}
|
|
15
|
+
export interface ConversationWithState {
|
|
16
|
+
conversationId: string;
|
|
17
|
+
conversationState: ConversationState;
|
|
18
|
+
}
|
|
19
|
+
export interface ConversationQueueStatus {
|
|
20
|
+
conversationId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Current position in the queue, can be null or left out if feature is disabled
|
|
23
|
+
*/
|
|
24
|
+
position?: number | null;
|
|
25
|
+
/**
|
|
26
|
+
* Calculated waiting time in milliseconds, can be null or left out if feature is disabled
|
|
27
|
+
*/
|
|
28
|
+
averageWaitingTime?: number | null;
|
|
29
|
+
}
|
|
30
|
+
export interface ConversationCallConnectionState {
|
|
31
|
+
conversationId: string;
|
|
32
|
+
callConnectionState: ConversationState;
|
|
33
|
+
}
|
|
34
|
+
export type ConversationEventType = 'connectionStateChange' | 'conversationStateChange' | 'end' | 'close' | 'personChange' | 'callStateChange' | 'invitationsChange' | 'customActionInvocation' | 'queueStatusChange' | 'callConnectionStateChange';
|
|
35
|
+
declare const enum ConversationFunction {
|
|
36
|
+
getConnectionState = "getConnectionState",
|
|
37
|
+
getConversationState = "getConversationState",
|
|
38
|
+
getCallState = "getCallState",
|
|
39
|
+
startAudioCall = "startAudioCall",
|
|
40
|
+
startVideoCall = "startVideoCall",
|
|
41
|
+
endConversation = "endConversation",
|
|
42
|
+
leaveConversation = "leaveConversation",
|
|
43
|
+
closeConversation = "closeConversation",
|
|
44
|
+
setVisitorData = "setVisitorData",
|
|
45
|
+
getVisitorData = "getVisitorData",
|
|
46
|
+
getQueueStatus = "getQueueStatus",
|
|
47
|
+
getCallConnectionState = "getCallConnectionState"
|
|
48
|
+
}
|
|
49
|
+
export declare class ConversationModule extends InternalModule<ConversationFunction, ConversationEventType> {
|
|
50
|
+
constructor(bridge: ApiBridge);
|
|
51
|
+
getConnectionState(conversationId: string): Promise<ConnectionState>;
|
|
52
|
+
getConversationState(conversationId: string): Promise<ConversationState>;
|
|
53
|
+
getCallState(conversationId: string): Promise<CallState>;
|
|
54
|
+
startAudioCall(conversationId: string): Promise<void>;
|
|
55
|
+
startVideoCall(conversationId: string): Promise<void>;
|
|
56
|
+
endConversation(conversationId: string): Promise<void>;
|
|
57
|
+
leaveConversation(conversationId: string): Promise<void>;
|
|
58
|
+
closeConversation(conversationId: string): Promise<void>;
|
|
59
|
+
setVisitorData(visitorData: String): Promise<void>;
|
|
60
|
+
getVisitorData(): Promise<String>;
|
|
61
|
+
getQueueStatus(conversationId: string): Promise<ConversationQueueStatus>;
|
|
62
|
+
getCallConnectionState(conversationId: string): Promise<CallConnectionState>;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiBridge } from '../api-bridge';
|
|
2
|
+
import { EventCallback } from '../event';
|
|
3
|
+
export declare class InternalModule<T extends string, E extends string> {
|
|
4
|
+
private bridge;
|
|
5
|
+
moduleName: string;
|
|
6
|
+
constructor(bridge: ApiBridge, moduleName: string);
|
|
7
|
+
protected callApiFunction(functionName: T, args: any[]): Promise<any>;
|
|
8
|
+
on(eventName: E, listener: EventCallback): Promise<void>;
|
|
9
|
+
off(eventName: E, listener: EventCallback): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiState } from "../api-state";
|
|
2
|
+
import { InitializedUnbluApi } from "./initialized-unblu-api";
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export declare interface UnbluFloatingApi {
|
|
7
|
+
api: UnbluFloatingApiFactory;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare interface UnbluFloatingApiFactory {
|
|
13
|
+
initialize(): Promise<InitializedUnbluApi>;
|
|
14
|
+
getApiState(): ApiState;
|
|
15
|
+
}
|