@unblu/floating-js-api 7.37.2
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/LICENSE.md +184 -0
- package/README.md +26 -0
- package/dist/lib/index.d.ts +93 -0
- package/dist/lib/index.js +49 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/internal/internal-api.d.ts +18 -0
- package/dist/lib/internal/internal-api.js +20 -0
- package/dist/lib/internal/internal-api.js.map +1 -0
- package/dist/lib/internal/module/general-lazy-module.d.ts +17 -0
- package/dist/lib/internal/module/general-lazy-module.js +16 -0
- package/dist/lib/internal/module/general-lazy-module.js.map +1 -0
- package/dist/lib/internal/module/general-module.d.ts +31 -0
- package/dist/lib/internal/module/general-module.js +37 -0
- package/dist/lib/internal/module/general-module.js.map +1 -0
- package/dist/lib/internal/module/meta-module.d.ts +17 -0
- package/dist/lib/internal/module/meta-module.js +19 -0
- package/dist/lib/internal/module/meta-module.js.map +1 -0
- package/dist/lib/model/individualui_component.d.ts +29 -0
- package/dist/lib/model/individualui_component.js +2 -0
- package/dist/lib/model/individualui_component.js.map +1 -0
- package/dist/lib/model/individualui_state.d.ts +14 -0
- package/dist/lib/model/individualui_state.js +2 -0
- package/dist/lib/model/individualui_state.js.map +1 -0
- package/dist/lib/shared/api-state.d.ts +8 -0
- package/dist/lib/shared/api-state.js +10 -0
- package/dist/lib/shared/api-state.js.map +1 -0
- package/dist/lib/shared/conversation.d.ts +320 -0
- package/dist/lib/shared/conversation.js +384 -0
- package/dist/lib/shared/conversation.js.map +1 -0
- package/dist/lib/shared/internal/api-bridge.d.ts +36 -0
- package/dist/lib/shared/internal/api-bridge.js +97 -0
- package/dist/lib/shared/internal/api-bridge.js.map +1 -0
- package/dist/lib/shared/internal/event.d.ts +6 -0
- package/dist/lib/shared/internal/event.js +2 -0
- package/dist/lib/shared/internal/event.js.map +1 -0
- package/dist/lib/shared/internal/initialized-unblu-api.d.ts +6 -0
- package/dist/lib/shared/internal/initialized-unblu-api.js +2 -0
- package/dist/lib/shared/internal/initialized-unblu-api.js.map +1 -0
- package/dist/lib/shared/internal/initialized-unblu-element.d.ts +6 -0
- package/dist/lib/shared/internal/initialized-unblu-element.js +2 -0
- package/dist/lib/shared/internal/initialized-unblu-element.js.map +1 -0
- package/dist/lib/shared/internal/java-error-codes.d.ts +5 -0
- package/dist/lib/shared/internal/java-error-codes.js +6 -0
- package/dist/lib/shared/internal/java-error-codes.js.map +1 -0
- package/dist/lib/shared/internal/module/agent-availability-module.d.ts +14 -0
- package/dist/lib/shared/internal/module/agent-availability-module.js +13 -0
- package/dist/lib/shared/internal/module/agent-availability-module.js.map +1 -0
- package/dist/lib/shared/internal/module/base-general-module.d.ts +31 -0
- package/dist/lib/shared/internal/module/base-general-module.js +46 -0
- package/dist/lib/shared/internal/module/base-general-module.js.map +1 -0
- package/dist/lib/shared/internal/module/conversation-module.d.ts +57 -0
- package/dist/lib/shared/internal/module/conversation-module.js +49 -0
- package/dist/lib/shared/internal/module/conversation-module.js.map +1 -0
- package/dist/lib/shared/internal/module/module.d.ts +10 -0
- package/dist/lib/shared/internal/module/module.js +16 -0
- package/dist/lib/shared/internal/module/module.js.map +1 -0
- package/dist/lib/shared/internal/unblu-api-factory.d.ts +9 -0
- package/dist/lib/shared/internal/unblu-api-factory.js +2 -0
- package/dist/lib/shared/internal/unblu-api-factory.js.map +1 -0
- package/dist/lib/shared/internal/unblu-util.d.ts +63 -0
- package/dist/lib/shared/internal/unblu-util.js +220 -0
- package/dist/lib/shared/internal/unblu-util.js.map +1 -0
- package/dist/lib/shared/internal/util/event-emitter.d.ts +44 -0
- package/dist/lib/shared/internal/util/event-emitter.js +85 -0
- package/dist/lib/shared/internal/util/event-emitter.js.map +1 -0
- package/dist/lib/shared/model/agent-availability-state.d.ts +18 -0
- package/dist/lib/shared/model/agent-availability-state.js +20 -0
- package/dist/lib/shared/model/agent-availability-state.js.map +1 -0
- package/dist/lib/shared/model/call-state.d.ts +26 -0
- package/dist/lib/shared/model/call-state.js +28 -0
- package/dist/lib/shared/model/call-state.js.map +1 -0
- package/dist/lib/shared/model/configuration.d.ts +46 -0
- package/dist/lib/shared/model/configuration.js +2 -0
- package/dist/lib/shared/model/configuration.js.map +1 -0
- package/dist/lib/shared/model/connection-state.d.ts +27 -0
- package/dist/lib/shared/model/connection-state.js +29 -0
- package/dist/lib/shared/model/connection-state.js.map +1 -0
- package/dist/lib/shared/model/conversation-info.d.ts +34 -0
- package/dist/lib/shared/model/conversation-info.js +2 -0
- package/dist/lib/shared/model/conversation-info.js.map +1 -0
- package/dist/lib/shared/model/conversation-message-info.d.ts +14 -0
- package/dist/lib/shared/model/conversation-message-info.js +2 -0
- package/dist/lib/shared/model/conversation-message-info.js.map +1 -0
- package/dist/lib/shared/model/conversation-recipient-type.d.ts +10 -0
- package/dist/lib/shared/model/conversation-recipient-type.js +12 -0
- package/dist/lib/shared/model/conversation-recipient-type.js.map +1 -0
- package/dist/lib/shared/model/conversation-recipient.d.ts +14 -0
- package/dist/lib/shared/model/conversation-recipient.js +2 -0
- package/dist/lib/shared/model/conversation-recipient.js.map +1 -0
- package/dist/lib/shared/model/conversation-state.d.ts +37 -0
- package/dist/lib/shared/model/conversation-state.js +39 -0
- package/dist/lib/shared/model/conversation-state.js.map +1 -0
- package/dist/lib/shared/model/conversation-type.d.ts +43 -0
- package/dist/lib/shared/model/conversation-type.js +45 -0
- package/dist/lib/shared/model/conversation-type.js.map +1 -0
- package/dist/lib/shared/model/customaction/custom-action-invocation.d.ts +27 -0
- package/dist/lib/shared/model/customaction/custom-action-invocation.js +2 -0
- package/dist/lib/shared/model/customaction/custom-action-invocation.js.map +1 -0
- package/dist/lib/shared/model/customaction/custom-conversation-action-invocation.d.ts +6 -0
- package/dist/lib/shared/model/customaction/custom-conversation-action-invocation.js +2 -0
- package/dist/lib/shared/model/customaction/custom-conversation-action-invocation.js.map +1 -0
- package/dist/lib/shared/model/customaction/custom-message-action-invocation.d.ts +16 -0
- package/dist/lib/shared/model/customaction/custom-message-action-invocation.js +2 -0
- package/dist/lib/shared/model/customaction/custom-message-action-invocation.js.map +1 -0
- package/dist/lib/shared/model/customaction/custom-person-action-invocation.d.ts +11 -0
- package/dist/lib/shared/model/customaction/custom-person-action-invocation.js +2 -0
- package/dist/lib/shared/model/customaction/custom-person-action-invocation.js.map +1 -0
- package/dist/lib/shared/model/invitation-status.d.ts +14 -0
- package/dist/lib/shared/model/invitation-status.js +16 -0
- package/dist/lib/shared/model/invitation-status.js.map +1 -0
- package/dist/lib/shared/model/invitation.d.ts +24 -0
- package/dist/lib/shared/model/invitation.js +2 -0
- package/dist/lib/shared/model/invitation.js.map +1 -0
- package/dist/lib/shared/model/new-conversation-interceptor-result.d.ts +14 -0
- package/dist/lib/shared/model/new-conversation-interceptor-result.js +2 -0
- package/dist/lib/shared/model/new-conversation-interceptor-result.js.map +1 -0
- package/dist/lib/shared/model/person-info.d.ts +4 -0
- package/dist/lib/shared/model/person-info.js +2 -0
- package/dist/lib/shared/model/person-info.js.map +1 -0
- package/dist/lib/shared/new-conversation-interceptor.d.ts +24 -0
- package/dist/lib/shared/new-conversation-interceptor.js +2 -0
- package/dist/lib/shared/new-conversation-interceptor.js.map +1 -0
- package/dist/lib/shared/unblu-api-error.d.ts +117 -0
- package/dist/lib/shared/unblu-api-error.js +122 -0
- package/dist/lib/shared/unblu-api-error.js.map +1 -0
- package/dist/lib/unblu-api-ui.d.ts +137 -0
- package/dist/lib/unblu-api-ui.js +199 -0
- package/dist/lib/unblu-api-ui.js.map +1 -0
- package/dist/lib/unblu-api.d.ts +363 -0
- package/dist/lib/unblu-api.js +433 -0
- package/dist/lib/unblu-api.js.map +1 -0
- package/dist/lib/unblu-static-api.d.ts +237 -0
- package/dist/lib/unblu-static-api.js +318 -0
- package/dist/lib/unblu-static-api.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { UnbluApi } from './unblu-api';
|
|
2
|
+
import { Listener } from './shared/internal/util/event-emitter';
|
|
3
|
+
import { ApiState } from "./shared/api-state";
|
|
4
|
+
import { Configuration } from "./shared/model/configuration";
|
|
5
|
+
import { UnbluApiFactory } from "./shared/internal/unblu-api-factory";
|
|
6
|
+
export { Configuration };
|
|
7
|
+
export type ReadyListener = (api: UnbluApi) => void;
|
|
8
|
+
export type ErrorListener = (e: Error) => void;
|
|
9
|
+
export type DeinitializingListener = () => void;
|
|
10
|
+
export type DeinitializedListener = () => void;
|
|
11
|
+
export type StateListener = (state: ApiState) => void;
|
|
12
|
+
/**
|
|
13
|
+
* #### The central entry point that allows to configure an initialize the Unblu Visitor JS API.
|
|
14
|
+
* The static Unblu API works without actually loading the rest of Unblu.
|
|
15
|
+
* It can do some general checks and load Unblu or connect the API to a loaded version of Unblu.
|
|
16
|
+
* The JS API is an optional add-on to the Unblu visitor site integration.
|
|
17
|
+
*
|
|
18
|
+
* Depending on how Unblu is integrated into the local website the API has to be initialized differently.
|
|
19
|
+
*
|
|
20
|
+
* **a.) API-only integration**
|
|
21
|
+
* If no unblu-snippet is loaded into the page, Unblu can be fully initialized with the API.
|
|
22
|
+
* In this case, both the `configure` and the `initialize` methods have to be called.
|
|
23
|
+
* Example:
|
|
24
|
+
* ```ts
|
|
25
|
+
* const api = await unblu.api
|
|
26
|
+
* // configure the unblu server
|
|
27
|
+
* .configure({
|
|
28
|
+
* apiKey: "<your-api-key>",
|
|
29
|
+
* serverUrl: "<unblu-server-url>"
|
|
30
|
+
* })
|
|
31
|
+
* // initialize the api.
|
|
32
|
+
* .initialize();
|
|
33
|
+
* ```
|
|
34
|
+
* This implementation will load the Unblu snippet and initialize both Unblu and the JS API.
|
|
35
|
+
*
|
|
36
|
+
* **b.) Snippet and JS API integration**
|
|
37
|
+
* If the Unblu snippet is already present in the local website, Unblu doesn't have to be loaded
|
|
38
|
+
* and only the API has to be initialized.
|
|
39
|
+
* Example:
|
|
40
|
+
* ```ts
|
|
41
|
+
* // directly initialize the api without configuring.
|
|
42
|
+
* const api = await unblu.api.initialize();
|
|
43
|
+
*
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class UnbluStaticApi implements UnbluApiFactory {
|
|
47
|
+
private state;
|
|
48
|
+
private error;
|
|
49
|
+
private eventEmitter;
|
|
50
|
+
private configuration;
|
|
51
|
+
private initializedApi;
|
|
52
|
+
/**
|
|
53
|
+
* Event emitted as soon as the API is initialized.
|
|
54
|
+
*
|
|
55
|
+
* It usually makes sense to use this event if there is some general action that has to be triggered when the API is initialized,
|
|
56
|
+
* but there are several places in the integration code that may trigger the initialization.
|
|
57
|
+
*
|
|
58
|
+
* In most cases however, it is better to use
|
|
59
|
+
* ```ts
|
|
60
|
+
* unblu.api.initialize().then(api => { //use api here });
|
|
61
|
+
* ```
|
|
62
|
+
* or
|
|
63
|
+
* ```ts
|
|
64
|
+
* let api = await unblu.api.initialize();
|
|
65
|
+
* // use api here
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Note: that this event will be triggered again after each initialization.
|
|
69
|
+
*
|
|
70
|
+
* @event ready
|
|
71
|
+
* @see {@link on} for listener registration
|
|
72
|
+
*/
|
|
73
|
+
static readonly READY: 'ready';
|
|
74
|
+
/**
|
|
75
|
+
* Event emitted if the API initialization fails.
|
|
76
|
+
*
|
|
77
|
+
* It usually makes sense to use this event if there is some general action that has to be triggered when the API initialization fails,
|
|
78
|
+
* but there are several places in the integration code that may trigger the initialization.
|
|
79
|
+
*
|
|
80
|
+
* In most cases however, it is better to use
|
|
81
|
+
* ```ts
|
|
82
|
+
* unblu.api.initialize().catch(error=> { //handle error here });
|
|
83
|
+
* ```
|
|
84
|
+
* or
|
|
85
|
+
* ```ts
|
|
86
|
+
* try{
|
|
87
|
+
* let api = await unblu.api.initialize();
|
|
88
|
+
* }catch(e){
|
|
89
|
+
* // handle error here
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @event error
|
|
95
|
+
* @see {@link on} for listener registration
|
|
96
|
+
*/
|
|
97
|
+
static readonly ERROR: 'error';
|
|
98
|
+
/**
|
|
99
|
+
* Event emitted as soon as the API is going to get de-initialized.
|
|
100
|
+
*
|
|
101
|
+
* It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.
|
|
102
|
+
*
|
|
103
|
+
* @event deinitializing
|
|
104
|
+
* @see {@link on} for listener registration
|
|
105
|
+
*/
|
|
106
|
+
static readonly DEINITIALIZING: 'deinitializing';
|
|
107
|
+
/**
|
|
108
|
+
* Event emitted as soon as the API is completely de-initialized.
|
|
109
|
+
*
|
|
110
|
+
* It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.
|
|
111
|
+
*
|
|
112
|
+
* @event deinitialized
|
|
113
|
+
* @see {@link on} for listener registration
|
|
114
|
+
*/
|
|
115
|
+
static readonly DEINITIALIZED: 'deinitialized';
|
|
116
|
+
/**
|
|
117
|
+
* Event emitted whenever the API state changes
|
|
118
|
+
*
|
|
119
|
+
* @event state
|
|
120
|
+
* @see {@link on} for listener registration
|
|
121
|
+
*/
|
|
122
|
+
static readonly STATE: 'state';
|
|
123
|
+
/**
|
|
124
|
+
* @hidden
|
|
125
|
+
*/
|
|
126
|
+
constructor();
|
|
127
|
+
/**
|
|
128
|
+
* Registers an event listener for the given event.
|
|
129
|
+
*
|
|
130
|
+
* **Note** If the API is already initialized, this listener will be called directly.
|
|
131
|
+
* @param event The ready event
|
|
132
|
+
* @param listener The listener to be called.
|
|
133
|
+
* @see {@link READY}
|
|
134
|
+
*/
|
|
135
|
+
on(event: typeof UnbluStaticApi.READY, listener: ReadyListener): void;
|
|
136
|
+
/**
|
|
137
|
+
* Registers an event listener for the given event.
|
|
138
|
+
*
|
|
139
|
+
* **Note** If the API has already failed, this listener will be called directly.
|
|
140
|
+
* @param event The error event
|
|
141
|
+
* @param listener The listener to be called.
|
|
142
|
+
* @see {@link ERROR}
|
|
143
|
+
*/
|
|
144
|
+
on(event: typeof UnbluStaticApi.ERROR, listener: ErrorListener): void;
|
|
145
|
+
/**
|
|
146
|
+
* Registers an event listener for the given event.
|
|
147
|
+
*
|
|
148
|
+
* **Note** If the API is already deinitializing, this listener will be called directly.
|
|
149
|
+
* @param event The deinitializing event
|
|
150
|
+
* @param listener The listener to be called.
|
|
151
|
+
* @see {@link DEINITIALIZING}
|
|
152
|
+
*/
|
|
153
|
+
on(event: typeof UnbluStaticApi.DEINITIALIZING, listener: DeinitializingListener): void;
|
|
154
|
+
/**
|
|
155
|
+
* Registers an event listener for the given event.
|
|
156
|
+
*
|
|
157
|
+
* **Note** If the API is already deinitialized, this listener will be called directly.
|
|
158
|
+
* @param event The deinitialized event
|
|
159
|
+
* @param listener The listener to be called.
|
|
160
|
+
* @see {@link DEINITIALIZED}
|
|
161
|
+
*/
|
|
162
|
+
on(event: typeof UnbluStaticApi.DEINITIALIZED, listener: DeinitializedListener): void;
|
|
163
|
+
/**
|
|
164
|
+
* Registers an event listener for the given event.
|
|
165
|
+
*
|
|
166
|
+
* @param event The state event
|
|
167
|
+
* @param listener The listener to be called.
|
|
168
|
+
* @see {@link STATE}
|
|
169
|
+
*/
|
|
170
|
+
on(event: typeof UnbluStaticApi.STATE, listener: StateListener): void;
|
|
171
|
+
/**
|
|
172
|
+
* Removes a previously registered listener.
|
|
173
|
+
* @param event The event unregister.
|
|
174
|
+
* @param listener The listener to be removed.
|
|
175
|
+
* @return `true` if the listener was removed, `false` otherwise.
|
|
176
|
+
*/
|
|
177
|
+
off(event: string, listener: Listener): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Checks whether the API has to be configured or not.
|
|
180
|
+
*
|
|
181
|
+
* - If no snippet is present and the API state is still [INITIAL]{@link ApiState.INITIAL} a configuration is necessary.
|
|
182
|
+
* - If a snippet is present or the API is already loaded, configuration is not necessary.
|
|
183
|
+
* - If the API state is in [DEINITIALIZED]{@link ApiState.DEINITIALIZED}
|
|
184
|
+
*
|
|
185
|
+
* @return `true` if a configuration is needed to initialize the API, `false` otherwise.
|
|
186
|
+
* @see {@link configure} to configure the API
|
|
187
|
+
* @see {@link initialize} to initialize the API
|
|
188
|
+
*/
|
|
189
|
+
isConfigurationNeeded(): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Returns the current state of the API
|
|
192
|
+
* @return the current API state.
|
|
193
|
+
* @see {@link isInitialized} for a simpler check
|
|
194
|
+
*/
|
|
195
|
+
getApiState(): ApiState;
|
|
196
|
+
/**
|
|
197
|
+
* Checks whether the API is initialized or not.
|
|
198
|
+
* @return `true` if the API is initialized, `false` for any other state.
|
|
199
|
+
* @see {@link getApiState} for the full state
|
|
200
|
+
*/
|
|
201
|
+
isInitialized(): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Configures the way that Unblu should be initialized.
|
|
204
|
+
*
|
|
205
|
+
* The configuration of the Unblu API is needed when, and only when no Unblu snippet is already present in the website.
|
|
206
|
+
*
|
|
207
|
+
* **Note:**
|
|
208
|
+
* - Calling this method when there's already an Unblu snippet will result in an {@link UnbluApiError}.
|
|
209
|
+
* - This method must be called BEFORE {@link initialize}.
|
|
210
|
+
* If it is called afterwards an {@link UnbluApiError} will be thrown.
|
|
211
|
+
*
|
|
212
|
+
* @param config The configuration to be set.
|
|
213
|
+
* @return an instance of `this` allowing chaining like `unblu.api.configure({...}).initialize();`
|
|
214
|
+
* @see {@link isConfigurationNeeded} to check if configuration is needed or not.
|
|
215
|
+
*/
|
|
216
|
+
configure(config: Configuration): UnbluStaticApi;
|
|
217
|
+
/**
|
|
218
|
+
* Initializes the API and resolves to the fully initialized API.
|
|
219
|
+
*
|
|
220
|
+
* If the API has already been initialized or is already in the initializing process, the existing API will be returned.
|
|
221
|
+
* There is only ever one instance of the API which will be returned by any call of this method which makes it safe to call this multiple times.
|
|
222
|
+
*
|
|
223
|
+
* *The initialization may fail with a {@link UnbluApiError} for the following reasons*
|
|
224
|
+
* - A configuration is needed but none was provided: [CONFIGURATION_MISSING]{@link UnbluErrorType.CONFIGURATION_MISSING}
|
|
225
|
+
* - Loading Unblu encounters a problem: [ERROR_LOADING_UNBLU]{@link UnbluErrorType.ERROR_LOADING_UNBLU}
|
|
226
|
+
* - The initialization timed out: [INITIALIZATION_TIMEOUT]{@link UnbluErrorType.INITIALIZATION_TIMEOUT}
|
|
227
|
+
* - The Unblu API is incompatible with the Unblu server: [INCOMPATIBLE_UNBLU_VERSION]{@link UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION}
|
|
228
|
+
* - The browser is unsupported: [UNSUPPORTED_BROWSER]{@link UnbluErrorType.UNSUPPORTED_BROWSER}
|
|
229
|
+
* - The provided access token is invalid: [AUTHENTICATION_FAILED]{@link UnbluErrorType.AUTHENTICATION_FAILED}
|
|
230
|
+
*/
|
|
231
|
+
initialize(): Promise<UnbluApi>;
|
|
232
|
+
private initializeApi;
|
|
233
|
+
private static injectUnblu;
|
|
234
|
+
private handleError;
|
|
235
|
+
private onDeinitializing;
|
|
236
|
+
private onDeinitialized;
|
|
237
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { UnbluApi } from './unblu-api';
|
|
2
|
+
import { EventEmitter } from './shared/internal/util/event-emitter';
|
|
3
|
+
import { IntegrationType, UnbluUtil } from './shared/internal/unblu-util';
|
|
4
|
+
import { UnbluApiError, UnbluErrorType } from './shared/unblu-api-error';
|
|
5
|
+
import { ApiBridge } from './shared/internal/api-bridge';
|
|
6
|
+
import { InternalApi } from './internal/internal-api';
|
|
7
|
+
import { ApiState } from "./shared/api-state";
|
|
8
|
+
/**
|
|
9
|
+
* #### The central entry point that allows to configure an initialize the Unblu Visitor JS API.
|
|
10
|
+
* The static Unblu API works without actually loading the rest of Unblu.
|
|
11
|
+
* It can do some general checks and load Unblu or connect the API to a loaded version of Unblu.
|
|
12
|
+
* The JS API is an optional add-on to the Unblu visitor site integration.
|
|
13
|
+
*
|
|
14
|
+
* Depending on how Unblu is integrated into the local website the API has to be initialized differently.
|
|
15
|
+
*
|
|
16
|
+
* **a.) API-only integration**
|
|
17
|
+
* If no unblu-snippet is loaded into the page, Unblu can be fully initialized with the API.
|
|
18
|
+
* In this case, both the `configure` and the `initialize` methods have to be called.
|
|
19
|
+
* Example:
|
|
20
|
+
* ```ts
|
|
21
|
+
* const api = await unblu.api
|
|
22
|
+
* // configure the unblu server
|
|
23
|
+
* .configure({
|
|
24
|
+
* apiKey: "<your-api-key>",
|
|
25
|
+
* serverUrl: "<unblu-server-url>"
|
|
26
|
+
* })
|
|
27
|
+
* // initialize the api.
|
|
28
|
+
* .initialize();
|
|
29
|
+
* ```
|
|
30
|
+
* This implementation will load the Unblu snippet and initialize both Unblu and the JS API.
|
|
31
|
+
*
|
|
32
|
+
* **b.) Snippet and JS API integration**
|
|
33
|
+
* If the Unblu snippet is already present in the local website, Unblu doesn't have to be loaded
|
|
34
|
+
* and only the API has to be initialized.
|
|
35
|
+
* Example:
|
|
36
|
+
* ```ts
|
|
37
|
+
* // directly initialize the api without configuring.
|
|
38
|
+
* const api = await unblu.api.initialize();
|
|
39
|
+
*
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export class UnbluStaticApi {
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
constructor() {
|
|
47
|
+
this.state = ApiState.INITIAL;
|
|
48
|
+
this.eventEmitter = new EventEmitter();
|
|
49
|
+
// store the error
|
|
50
|
+
this.eventEmitter.on(UnbluStaticApi.ERROR, e => this.error = e);
|
|
51
|
+
// install globally if needed so the embedded API as a reference it can use to de-init
|
|
52
|
+
const unblu = UnbluUtil.getUnbluObject();
|
|
53
|
+
if (unblu.api) {
|
|
54
|
+
this.handleError(new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Unblu API has already been loaded.'));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
unblu.api = this;
|
|
58
|
+
}
|
|
59
|
+
if (UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {
|
|
60
|
+
// Auto init if snippet is already loaded.
|
|
61
|
+
this.initializeApi().catch(e => console.warn('Error during auto initialization', e));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
on(event, listener) {
|
|
65
|
+
if (event == UnbluStaticApi.READY && this.state == ApiState.INITIALIZED)
|
|
66
|
+
listener(this.initializedApi);
|
|
67
|
+
else if (event == UnbluStaticApi.ERROR && this.state == ApiState.ERROR)
|
|
68
|
+
listener(this.error);
|
|
69
|
+
else if (event == UnbluStaticApi.DEINITIALIZING && this.state == ApiState.DEINITIALIZING)
|
|
70
|
+
listener();
|
|
71
|
+
else if (event == UnbluStaticApi.DEINITIALIZED && this.state == ApiState.DEINITIALIZED)
|
|
72
|
+
listener();
|
|
73
|
+
this.eventEmitter.on(event, listener);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Removes a previously registered listener.
|
|
77
|
+
* @param event The event unregister.
|
|
78
|
+
* @param listener The listener to be removed.
|
|
79
|
+
* @return `true` if the listener was removed, `false` otherwise.
|
|
80
|
+
*/
|
|
81
|
+
off(event, listener) {
|
|
82
|
+
return this.eventEmitter.off(event, listener);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Checks whether the API has to be configured or not.
|
|
86
|
+
*
|
|
87
|
+
* - If no snippet is present and the API state is still [INITIAL]{@link ApiState.INITIAL} a configuration is necessary.
|
|
88
|
+
* - If a snippet is present or the API is already loaded, configuration is not necessary.
|
|
89
|
+
* - If the API state is in [DEINITIALIZED]{@link ApiState.DEINITIALIZED}
|
|
90
|
+
*
|
|
91
|
+
* @return `true` if a configuration is needed to initialize the API, `false` otherwise.
|
|
92
|
+
* @see {@link configure} to configure the API
|
|
93
|
+
* @see {@link initialize} to initialize the API
|
|
94
|
+
*/
|
|
95
|
+
isConfigurationNeeded() {
|
|
96
|
+
return (this.state === ApiState.INITIAL || this.state === ApiState.DEINITIALIZED) && !UnbluUtil.isUnbluLoaded(IntegrationType.floating);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns the current state of the API
|
|
100
|
+
* @return the current API state.
|
|
101
|
+
* @see {@link isInitialized} for a simpler check
|
|
102
|
+
*/
|
|
103
|
+
getApiState() {
|
|
104
|
+
return this.state;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Checks whether the API is initialized or not.
|
|
108
|
+
* @return `true` if the API is initialized, `false` for any other state.
|
|
109
|
+
* @see {@link getApiState} for the full state
|
|
110
|
+
*/
|
|
111
|
+
isInitialized() {
|
|
112
|
+
return this.state === ApiState.INITIALIZED;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Configures the way that Unblu should be initialized.
|
|
116
|
+
*
|
|
117
|
+
* The configuration of the Unblu API is needed when, and only when no Unblu snippet is already present in the website.
|
|
118
|
+
*
|
|
119
|
+
* **Note:**
|
|
120
|
+
* - Calling this method when there's already an Unblu snippet will result in an {@link UnbluApiError}.
|
|
121
|
+
* - This method must be called BEFORE {@link initialize}.
|
|
122
|
+
* If it is called afterwards an {@link UnbluApiError} will be thrown.
|
|
123
|
+
*
|
|
124
|
+
* @param config The configuration to be set.
|
|
125
|
+
* @return an instance of `this` allowing chaining like `unblu.api.configure({...}).initialize();`
|
|
126
|
+
* @see {@link isConfigurationNeeded} to check if configuration is needed or not.
|
|
127
|
+
*/
|
|
128
|
+
configure(config) {
|
|
129
|
+
if (UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {
|
|
130
|
+
throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Configure called when Unblu was already loaded.');
|
|
131
|
+
}
|
|
132
|
+
else if (this.state !== ApiState.INITIAL && this.state !== ApiState.DEINITIALIZED) {
|
|
133
|
+
throw new UnbluApiError(UnbluErrorType.ILLEGAL_STATE, 'Error configure called after API was already initialized or is not fully deinitialized yet.');
|
|
134
|
+
}
|
|
135
|
+
this.configuration = Object.assign({}, config);
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Initializes the API and resolves to the fully initialized API.
|
|
140
|
+
*
|
|
141
|
+
* If the API has already been initialized or is already in the initializing process, the existing API will be returned.
|
|
142
|
+
* There is only ever one instance of the API which will be returned by any call of this method which makes it safe to call this multiple times.
|
|
143
|
+
*
|
|
144
|
+
* *The initialization may fail with a {@link UnbluApiError} for the following reasons*
|
|
145
|
+
* - A configuration is needed but none was provided: [CONFIGURATION_MISSING]{@link UnbluErrorType.CONFIGURATION_MISSING}
|
|
146
|
+
* - Loading Unblu encounters a problem: [ERROR_LOADING_UNBLU]{@link UnbluErrorType.ERROR_LOADING_UNBLU}
|
|
147
|
+
* - The initialization timed out: [INITIALIZATION_TIMEOUT]{@link UnbluErrorType.INITIALIZATION_TIMEOUT}
|
|
148
|
+
* - The Unblu API is incompatible with the Unblu server: [INCOMPATIBLE_UNBLU_VERSION]{@link UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION}
|
|
149
|
+
* - The browser is unsupported: [UNSUPPORTED_BROWSER]{@link UnbluErrorType.UNSUPPORTED_BROWSER}
|
|
150
|
+
* - The provided access token is invalid: [AUTHENTICATION_FAILED]{@link UnbluErrorType.AUTHENTICATION_FAILED}
|
|
151
|
+
*/
|
|
152
|
+
async initialize() {
|
|
153
|
+
if (this.state === ApiState.INITIALIZED) {
|
|
154
|
+
return this.initializedApi;
|
|
155
|
+
}
|
|
156
|
+
else if (this.state === ApiState.INITIALIZING) {
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
this.on(UnbluStaticApi.READY, resolve);
|
|
159
|
+
this.on(UnbluStaticApi.ERROR, reject);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
else if (this.state === ApiState.DEINITIALIZING) {
|
|
163
|
+
return Promise.reject('Cannot initialize while de-initializing is ongoing! Please wait for the deinitialized event');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return this.initializeApi();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async initializeApi() {
|
|
170
|
+
this.state = ApiState.INITIALIZING;
|
|
171
|
+
await UnbluUtil.deinitializeEmbeddedIfNeeded();
|
|
172
|
+
try {
|
|
173
|
+
if (!UnbluUtil.isUnbluLoaded(IntegrationType.floating)) {
|
|
174
|
+
if (!this.configuration) {
|
|
175
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
176
|
+
throw new UnbluApiError(UnbluErrorType.CONFIGURATION_MISSING, 'No Unblu snippet present and no configuration provided. Use configure if you want to initialize Unblu without having the Unblu snippet loaded.');
|
|
177
|
+
}
|
|
178
|
+
if (this.configuration.namedArea) {
|
|
179
|
+
UnbluUtil.setNamedArea(this.configuration.namedArea);
|
|
180
|
+
}
|
|
181
|
+
if (this.configuration.locale) {
|
|
182
|
+
UnbluUtil.setLocale(this.configuration.locale);
|
|
183
|
+
}
|
|
184
|
+
if (this.configuration.accessToken) {
|
|
185
|
+
await UnbluUtil.loginWithSecureToken(this.configuration.serverUrl || '', this.configuration.apiKey, this.configuration.entryPath || '/unblu', this.configuration.accessToken);
|
|
186
|
+
}
|
|
187
|
+
await UnbluStaticApi.injectUnblu(this.configuration);
|
|
188
|
+
}
|
|
189
|
+
else if (!this.configuration) {
|
|
190
|
+
//Unblu already loaded (potentially via snippet) with no explicit configuration of the API. Generated configuration based on the loaded instance
|
|
191
|
+
this.configuration = UnbluUtil.generateConfigurationFromLoadedUnblu();
|
|
192
|
+
}
|
|
193
|
+
let apiBridge = new ApiBridge(UnbluUtil.getUnbluObject(), 'internal');
|
|
194
|
+
await apiBridge.waitUntilLoaded(this.configuration.initTimeout || 30000);
|
|
195
|
+
let internalApi = new InternalApi(apiBridge, this.configuration);
|
|
196
|
+
internalApi.checkCompatibility();
|
|
197
|
+
// Check internalApi waitUntilInitialized
|
|
198
|
+
await internalApi.meta.waitUntilInitialized();
|
|
199
|
+
this.initializedApi = new UnbluApi(internalApi);
|
|
200
|
+
this.initializedApi.on(UnbluApi.DEINITIALIZING, () => this.onDeinitializing());
|
|
201
|
+
this.initializedApi.on(UnbluApi.DEINITIALIZED, () => this.onDeinitialized());
|
|
202
|
+
this.state = ApiState.INITIALIZED;
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
this.handleError(e);
|
|
206
|
+
}
|
|
207
|
+
this.eventEmitter.emit(UnbluStaticApi.READY, this.initializedApi);
|
|
208
|
+
this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);
|
|
209
|
+
return this.initializedApi;
|
|
210
|
+
}
|
|
211
|
+
static async injectUnblu(config) {
|
|
212
|
+
const serverUrl = config.serverUrl || '';
|
|
213
|
+
const apiKey = config.apiKey || '';
|
|
214
|
+
const unbluPath = config.entryPath || '/unblu';
|
|
215
|
+
let unbluUrl = `${serverUrl}${unbluPath}/visitor.js?x-unblu-apikey=${apiKey}`;
|
|
216
|
+
try {
|
|
217
|
+
await UnbluUtil.loadScript(unbluUrl, config.initTimeout);
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
throw new UnbluApiError(UnbluErrorType.ERROR_LOADING_UNBLU, 'Error loading unblu snippet: ' + e + ' check the configuration: ' + config);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
handleError(error) {
|
|
224
|
+
this.state = ApiState.ERROR;
|
|
225
|
+
this.eventEmitter.emit(UnbluStaticApi.ERROR, error);
|
|
226
|
+
this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);
|
|
227
|
+
if (UnbluErrorType.UNSUPPORTED_BROWSER != error.type) {
|
|
228
|
+
console.error(error);
|
|
229
|
+
}
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
onDeinitializing() {
|
|
233
|
+
this.initializedApi = null;
|
|
234
|
+
this.state = ApiState.DEINITIALIZING;
|
|
235
|
+
this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZING);
|
|
236
|
+
this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);
|
|
237
|
+
}
|
|
238
|
+
onDeinitialized() {
|
|
239
|
+
this.state = ApiState.DEINITIALIZED;
|
|
240
|
+
this.eventEmitter.emit(UnbluStaticApi.DEINITIALIZED);
|
|
241
|
+
this.eventEmitter.emit(UnbluStaticApi.STATE, this.state);
|
|
242
|
+
if (this.configuration.namedArea) {
|
|
243
|
+
UnbluUtil.removeNamedArea();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Event emitted as soon as the API is initialized.
|
|
249
|
+
*
|
|
250
|
+
* It usually makes sense to use this event if there is some general action that has to be triggered when the API is initialized,
|
|
251
|
+
* but there are several places in the integration code that may trigger the initialization.
|
|
252
|
+
*
|
|
253
|
+
* In most cases however, it is better to use
|
|
254
|
+
* ```ts
|
|
255
|
+
* unblu.api.initialize().then(api => { //use api here });
|
|
256
|
+
* ```
|
|
257
|
+
* or
|
|
258
|
+
* ```ts
|
|
259
|
+
* let api = await unblu.api.initialize();
|
|
260
|
+
* // use api here
|
|
261
|
+
* ```
|
|
262
|
+
*
|
|
263
|
+
* Note: that this event will be triggered again after each initialization.
|
|
264
|
+
*
|
|
265
|
+
* @event ready
|
|
266
|
+
* @see {@link on} for listener registration
|
|
267
|
+
*/
|
|
268
|
+
UnbluStaticApi.READY = 'ready';
|
|
269
|
+
/**
|
|
270
|
+
* Event emitted if the API initialization fails.
|
|
271
|
+
*
|
|
272
|
+
* It usually makes sense to use this event if there is some general action that has to be triggered when the API initialization fails,
|
|
273
|
+
* but there are several places in the integration code that may trigger the initialization.
|
|
274
|
+
*
|
|
275
|
+
* In most cases however, it is better to use
|
|
276
|
+
* ```ts
|
|
277
|
+
* unblu.api.initialize().catch(error=> { //handle error here });
|
|
278
|
+
* ```
|
|
279
|
+
* or
|
|
280
|
+
* ```ts
|
|
281
|
+
* try{
|
|
282
|
+
* let api = await unblu.api.initialize();
|
|
283
|
+
* }catch(e){
|
|
284
|
+
* // handle error here
|
|
285
|
+
* }
|
|
286
|
+
*
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* @event error
|
|
290
|
+
* @see {@link on} for listener registration
|
|
291
|
+
*/
|
|
292
|
+
UnbluStaticApi.ERROR = 'error';
|
|
293
|
+
/**
|
|
294
|
+
* Event emitted as soon as the API is going to get de-initialized.
|
|
295
|
+
*
|
|
296
|
+
* It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.
|
|
297
|
+
*
|
|
298
|
+
* @event deinitializing
|
|
299
|
+
* @see {@link on} for listener registration
|
|
300
|
+
*/
|
|
301
|
+
UnbluStaticApi.DEINITIALIZING = 'deinitializing';
|
|
302
|
+
/**
|
|
303
|
+
* Event emitted as soon as the API is completely de-initialized.
|
|
304
|
+
*
|
|
305
|
+
* It usually makes sense to use this event to clean up resources and/or unregistering of listeners to no try to use the API again until it is initialized again.
|
|
306
|
+
*
|
|
307
|
+
* @event deinitialized
|
|
308
|
+
* @see {@link on} for listener registration
|
|
309
|
+
*/
|
|
310
|
+
UnbluStaticApi.DEINITIALIZED = 'deinitialized';
|
|
311
|
+
/**
|
|
312
|
+
* Event emitted whenever the API state changes
|
|
313
|
+
*
|
|
314
|
+
* @event state
|
|
315
|
+
* @see {@link on} for listener registration
|
|
316
|
+
*/
|
|
317
|
+
UnbluStaticApi.STATE = 'state';
|
|
318
|
+
//# sourceMappingURL=unblu-static-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unblu-static-api.js","sourceRoot":"","sources":["../../src/unblu-static-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,YAAY,EAAW,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACp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",
|
|
3
|
+
"version": "7.37.2",
|
|
4
|
+
"description": "Unblu Floating JavaScript API allowing to control the Unblu Floating UI",
|
|
5
|
+
"homepage": "https://www.unblu.com/en/docs/latest/reference/unblu-floating-js-api/",
|
|
6
|
+
"author": "David Eberlein",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"David Eberlein",
|
|
9
|
+
"Denis Trueby"
|
|
10
|
+
],
|
|
11
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
|
+
"main": "dist/lib/index.js",
|
|
13
|
+
"types": "dist/lib/index.d.ts",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"unblu",
|
|
16
|
+
"js-api",
|
|
17
|
+
"javascript",
|
|
18
|
+
"api"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/lib"
|
|
22
|
+
]
|
|
23
|
+
}
|