cbcore-ts 1.0.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/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/uicore.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/.jshintrc +4 -0
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/compiledScripts/CBCore.d.ts +54 -0
- package/compiledScripts/CBCore.js +182 -0
- package/compiledScripts/CBCore.js.map +7 -0
- package/compiledScripts/CBDataInterfaces.d.ts +156 -0
- package/compiledScripts/CBDataInterfaces.js +35 -0
- package/compiledScripts/CBDataInterfaces.js.map +7 -0
- package/compiledScripts/CBLanguageService.d.ts +43 -0
- package/compiledScripts/CBLanguageService.js +167 -0
- package/compiledScripts/CBLanguageService.js.map +7 -0
- package/compiledScripts/CBServerClient.d.ts +10 -0
- package/compiledScripts/CBServerClient.js +88 -0
- package/compiledScripts/CBServerClient.js.map +7 -0
- package/compiledScripts/CBSocketCallbackHolder.d.ts +65 -0
- package/compiledScripts/CBSocketCallbackHolder.js +343 -0
- package/compiledScripts/CBSocketCallbackHolder.js.map +7 -0
- package/compiledScripts/CBSocketClient.d.ts +70 -0
- package/compiledScripts/CBSocketClient.js +371 -0
- package/compiledScripts/CBSocketClient.js.map +7 -0
- package/compiledScripts/index.d.ts +6 -0
- package/compiledScripts/index.js +23 -0
- package/compiledScripts/index.js.map +7 -0
- package/etsc.config.mjs +23 -0
- package/package.json +51 -0
- package/rollup.config.js +49 -0
- package/scripts/CBCore.ts +381 -0
- package/scripts/CBDataInterfaces.ts +336 -0
- package/scripts/CBLanguageService.ts +371 -0
- package/scripts/CBServerClient.ts +147 -0
- package/scripts/CBSocketCallbackHolder.ts +872 -0
- package/scripts/CBSocketClient.ts +748 -0
- package/scripts/index.ts +18 -0
- package/tsconfig.json +69 -0
package/.idea/misc.xml
ADDED
package/.idea/uicore.iml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/.jshintrc
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 inimeseke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# UICore
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework that is used in IOS. In addition, UICore has tools to handle URL based routing, array sorting and filtering and adds a number of other utilities for convenience.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { UICore, UIObject, UIViewBroadcastEvent } from "../../uicore-ts";
|
|
2
|
+
import { CBLocalizedTextObject, CBUserProfile } from "./CBDataInterfaces";
|
|
3
|
+
import { CBServerClient } from "./CBServerClient";
|
|
4
|
+
import { CBSocketClient } from "./CBSocketClient";
|
|
5
|
+
declare interface CBDialogViewShower {
|
|
6
|
+
alert(text: string, dismissCallback?: Function): any;
|
|
7
|
+
localizedAlert(textObject: CBLocalizedTextObject, dismissCallback?: Function): any;
|
|
8
|
+
showActionIndicatorDialog(message: string, dismissCallback?: Function): any;
|
|
9
|
+
hideActionIndicatorDialog(): any;
|
|
10
|
+
}
|
|
11
|
+
export declare class CBCore extends UIObject {
|
|
12
|
+
private static _sharedInstance;
|
|
13
|
+
viewCores: UICore[];
|
|
14
|
+
_isUserLoggedIn: boolean;
|
|
15
|
+
_cachedMinimizedChatInquiryIDs: string[];
|
|
16
|
+
_socketClient: CBSocketClient;
|
|
17
|
+
_serverClient: CBServerClient;
|
|
18
|
+
_functionsToCallForEachSocketClient: (() => void)[];
|
|
19
|
+
_models: any[];
|
|
20
|
+
dialogViewShowerClass: CBDialogViewShower;
|
|
21
|
+
constructor();
|
|
22
|
+
static initIfNeededWithViewCore(viewCore: UICore): void;
|
|
23
|
+
static get sharedInstance(): CBCore;
|
|
24
|
+
static broadcastEventName: {
|
|
25
|
+
userDidLogIn: string;
|
|
26
|
+
userDidLogOut: string;
|
|
27
|
+
};
|
|
28
|
+
broadcastMessageInRootViewTree(message: UIViewBroadcastEvent): void;
|
|
29
|
+
get socketClient(): CBSocketClient;
|
|
30
|
+
get serverClient(): CBServerClient;
|
|
31
|
+
set isUserLoggedIn(isUserLoggedIn: boolean);
|
|
32
|
+
didSetIsUserLoggedIn(previousValue: boolean): void;
|
|
33
|
+
private updateLinkTargets;
|
|
34
|
+
get isUserLoggedIn(): boolean;
|
|
35
|
+
get userProfile(): CBUserProfile;
|
|
36
|
+
set userProfile(userProfile: CBUserProfile);
|
|
37
|
+
didSetUserProfile(): void;
|
|
38
|
+
set languageKey(languageKey: string);
|
|
39
|
+
get languageKey(): string;
|
|
40
|
+
didSetLanguageKey(): void;
|
|
41
|
+
get externalServiceIdentifier(): {
|
|
42
|
+
accessKey: string;
|
|
43
|
+
serviceID: string;
|
|
44
|
+
organizationID: string;
|
|
45
|
+
};
|
|
46
|
+
set externalServiceIdentifier(externalServiceIdentifier: {
|
|
47
|
+
accessKey: string;
|
|
48
|
+
serviceID: string;
|
|
49
|
+
organizationID: string;
|
|
50
|
+
});
|
|
51
|
+
reloadSocketConnection(): void;
|
|
52
|
+
callFunctionForEachSocketClient(functionToCall: () => void): void;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var CBCore_exports = {};
|
|
19
|
+
__export(CBCore_exports, {
|
|
20
|
+
CBCore: () => CBCore
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(CBCore_exports);
|
|
23
|
+
var import_uicore_ts = require("../../uicore-ts");
|
|
24
|
+
var import_CBLanguageService = require("./CBLanguageService");
|
|
25
|
+
var import_CBServerClient = require("./CBServerClient");
|
|
26
|
+
var import_CBSocketClient = require("./CBSocketClient");
|
|
27
|
+
const _CBCore = class extends import_uicore_ts.UIObject {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.viewCores = [];
|
|
31
|
+
this._isUserLoggedIn = import_uicore_ts.nil;
|
|
32
|
+
this._cachedMinimizedChatInquiryIDs = import_uicore_ts.nil;
|
|
33
|
+
this._socketClient = new import_CBSocketClient.CBSocketClient(this);
|
|
34
|
+
this._serverClient = new import_CBServerClient.CBServerClient(this);
|
|
35
|
+
this._functionsToCallForEachSocketClient = [];
|
|
36
|
+
this._models = [];
|
|
37
|
+
this.dialogViewShowerClass = import_uicore_ts.nil;
|
|
38
|
+
if (CBCoreInitializerObject) {
|
|
39
|
+
import_CBLanguageService.CBLanguageService.useStoredLanguageValues(CBCoreInitializerObject.languageValues);
|
|
40
|
+
}
|
|
41
|
+
window.addEventListener("storage", function(event) {
|
|
42
|
+
if (event.newValue == event.oldValue) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (event.key == "CBLanguageKey") {
|
|
46
|
+
this.didSetLanguageKey();
|
|
47
|
+
}
|
|
48
|
+
}.bind(this));
|
|
49
|
+
this.didSetLanguageKey();
|
|
50
|
+
}
|
|
51
|
+
static initIfNeededWithViewCore(viewCore) {
|
|
52
|
+
_CBCore.sharedInstance.viewCores.push(viewCore);
|
|
53
|
+
}
|
|
54
|
+
static get sharedInstance() {
|
|
55
|
+
if (!_CBCore._sharedInstance) {
|
|
56
|
+
_CBCore._sharedInstance = new _CBCore();
|
|
57
|
+
}
|
|
58
|
+
return _CBCore._sharedInstance;
|
|
59
|
+
}
|
|
60
|
+
broadcastMessageInRootViewTree(message) {
|
|
61
|
+
this.viewCores.everyElement.rootViewController.view.broadcastEventInSubtree(message);
|
|
62
|
+
}
|
|
63
|
+
get socketClient() {
|
|
64
|
+
return this._socketClient;
|
|
65
|
+
}
|
|
66
|
+
get serverClient() {
|
|
67
|
+
return this._serverClient;
|
|
68
|
+
}
|
|
69
|
+
set isUserLoggedIn(isUserLoggedIn) {
|
|
70
|
+
const previousValue = this.isUserLoggedIn;
|
|
71
|
+
localStorage.setItem("CBIsUserLoggedIn", "" + isUserLoggedIn);
|
|
72
|
+
this.didSetIsUserLoggedIn(previousValue);
|
|
73
|
+
}
|
|
74
|
+
didSetIsUserLoggedIn(previousValue) {
|
|
75
|
+
const isUserLoggedIn = this.isUserLoggedIn;
|
|
76
|
+
if (isUserLoggedIn && previousValue != isUserLoggedIn) {
|
|
77
|
+
this.broadcastMessageInRootViewTree({
|
|
78
|
+
name: _CBCore.broadcastEventName.userDidLogIn,
|
|
79
|
+
parameters: import_uicore_ts.nil
|
|
80
|
+
});
|
|
81
|
+
this.updateLinkTargets();
|
|
82
|
+
} else if (previousValue != isUserLoggedIn) {
|
|
83
|
+
this.performFunctionWithDelay(0.01, function() {
|
|
84
|
+
import_uicore_ts.UIRoute.currentRoute.routeByRemovingComponentsOtherThanOnesNamed([
|
|
85
|
+
"settings",
|
|
86
|
+
"inquiry"
|
|
87
|
+
]).apply();
|
|
88
|
+
this.broadcastMessageInRootViewTree({
|
|
89
|
+
name: _CBCore.broadcastEventName.userDidLogOut,
|
|
90
|
+
parameters: import_uicore_ts.nil
|
|
91
|
+
});
|
|
92
|
+
this.updateLinkTargets();
|
|
93
|
+
}.bind(this));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
updateLinkTargets() {
|
|
97
|
+
this.viewCores.everyElement.rootViewController.view.forEachViewInSubtree(function(view) {
|
|
98
|
+
if (view instanceof import_uicore_ts.UILink) {
|
|
99
|
+
view.updateTarget();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
get isUserLoggedIn() {
|
|
104
|
+
const result = localStorage.getItem("CBIsUserLoggedIn") == "true";
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
get userProfile() {
|
|
108
|
+
var result = import_uicore_ts.nil;
|
|
109
|
+
try {
|
|
110
|
+
result = JSON.parse(localStorage.getItem("CBUserProfile"));
|
|
111
|
+
} catch (error) {
|
|
112
|
+
}
|
|
113
|
+
return (0, import_uicore_ts.FIRST_OR_NIL)(result);
|
|
114
|
+
}
|
|
115
|
+
set userProfile(userProfile) {
|
|
116
|
+
if ((0, import_uicore_ts.IS_NOT)(userProfile)) {
|
|
117
|
+
localStorage.removeItem("CBUserProfile");
|
|
118
|
+
}
|
|
119
|
+
localStorage.setItem("CBUserProfile", JSON.stringify(userProfile));
|
|
120
|
+
this.didSetUserProfile();
|
|
121
|
+
}
|
|
122
|
+
didSetUserProfile() {
|
|
123
|
+
this.isUserLoggedIn = (0, import_uicore_ts.IS)(this.userProfile);
|
|
124
|
+
}
|
|
125
|
+
set languageKey(languageKey) {
|
|
126
|
+
if ((0, import_uicore_ts.IS_NOT)(languageKey)) {
|
|
127
|
+
localStorage.removeItem("CBLanguageKey");
|
|
128
|
+
}
|
|
129
|
+
localStorage.setItem("CBLanguageKey", JSON.stringify(languageKey));
|
|
130
|
+
this.didSetLanguageKey();
|
|
131
|
+
}
|
|
132
|
+
get languageKey() {
|
|
133
|
+
const result = (0, import_uicore_ts.FIRST)(localStorage.getItem("CBLanguageKey"), import_CBLanguageService.CBLanguageService.defaultLanguageKey).replace(
|
|
134
|
+
'"',
|
|
135
|
+
""
|
|
136
|
+
).replace('"', "");
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
didSetLanguageKey() {
|
|
140
|
+
import_uicore_ts.UIRoute.currentRoute.routeWithComponent(
|
|
141
|
+
"settings",
|
|
142
|
+
{ "language": this.languageKey },
|
|
143
|
+
import_uicore_ts.YES
|
|
144
|
+
).applyByReplacingCurrentRouteInHistory();
|
|
145
|
+
}
|
|
146
|
+
get externalServiceIdentifier() {
|
|
147
|
+
const result = JSON.parse(localStorage.getItem("CBExternalServiceIdentifier"));
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
set externalServiceIdentifier(externalServiceIdentifier) {
|
|
151
|
+
localStorage.setItem("CBExternalServiceIdentifier", JSON.stringify(externalServiceIdentifier));
|
|
152
|
+
}
|
|
153
|
+
reloadSocketConnection() {
|
|
154
|
+
this.socketClient.socket.disconnect();
|
|
155
|
+
const messagesToBeSent = this.socketClient._messagesToBeSent.filter(function(messageItem, index, array) {
|
|
156
|
+
return !messageItem.isBoundToUserWithID || messageItem.isBoundToUserWithID == _CBCore.sharedInstance.userProfile._id;
|
|
157
|
+
});
|
|
158
|
+
this._socketClient = new import_CBSocketClient.CBSocketClient(this);
|
|
159
|
+
this._socketClient._messagesToBeSent = messagesToBeSent;
|
|
160
|
+
const socketClient = this._socketClient;
|
|
161
|
+
this._models.forEach(function(model, index, array) {
|
|
162
|
+
model.setSocketClient(socketClient);
|
|
163
|
+
});
|
|
164
|
+
this._functionsToCallForEachSocketClient.forEach(function(functionToCall, index, array) {
|
|
165
|
+
functionToCall();
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
callFunctionForEachSocketClient(functionToCall) {
|
|
169
|
+
this._functionsToCallForEachSocketClient.push(functionToCall);
|
|
170
|
+
functionToCall();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
let CBCore = _CBCore;
|
|
174
|
+
CBCore.broadcastEventName = {
|
|
175
|
+
"userDidLogIn": "UserDidLogIn",
|
|
176
|
+
"userDidLogOut": "UserDidLogOut"
|
|
177
|
+
};
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
CBCore
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=CBCore.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../scripts/CBCore.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n FIRST,\n FIRST_OR_NIL,\n IS,\n IS_NOT,\n nil,\n UICore,\n UILink,\n UIObject,\n UIRoute,\n UIViewBroadcastEvent,\n YES\n} from \"../../uicore-ts\"\nimport { CBLanguageService } from \"./CBLanguageService\"\nimport { CBLocalizedTextObject, CBUserProfile } from \"./CBDataInterfaces\"\nimport { CBServerClient } from \"./CBServerClient\"\nimport { CBSocketClient } from \"./CBSocketClient\"\n\n\ndeclare interface CBDialogViewShower {\n \n alert(text: string, dismissCallback?: Function)\n localizedAlert(textObject: CBLocalizedTextObject, dismissCallback?: Function)\n \n showActionIndicatorDialog(message: string, dismissCallback?: Function)\n hideActionIndicatorDialog()\n \n}\n\ndeclare const CBCoreInitializerObject: any\n\n\nexport class CBCore extends UIObject {\n \n private static _sharedInstance: CBCore\n \n viewCores: UICore[] = []\n \n _isUserLoggedIn: boolean = nil\n _cachedMinimizedChatInquiryIDs: string[] = nil\n _socketClient: CBSocketClient = new CBSocketClient(this)\n _serverClient: CBServerClient = new CBServerClient(this)\n \n _functionsToCallForEachSocketClient: (() => void)[] = []\n \n _models: any[] = []\n \n dialogViewShowerClass: CBDialogViewShower = nil\n \n constructor() {\n \n super()\n \n if (CBCoreInitializerObject) {\n \n CBLanguageService.useStoredLanguageValues(CBCoreInitializerObject.languageValues)\n \n }\n \n \n window.addEventListener(\"storage\", function (this: CBCore, event: StorageEvent) {\n \n if (event.newValue == event.oldValue) {\n \n return\n \n }\n \n //console.log(\"\" + event.key + \" changed to \" + event.newValue + \" from \" + event.oldValue);\n \n \n \n if (event.key == \"CBLanguageKey\") {\n \n this.didSetLanguageKey()\n \n }\n \n }.bind(this))\n \n \n //this.checkIfUserIsAuthenticated();\n \n this.didSetLanguageKey()\n \n \n }\n \n \n static initIfNeededWithViewCore(viewCore: UICore) {\n \n CBCore.sharedInstance.viewCores.push(viewCore);\n \n }\n \n \n \n static get sharedInstance() {\n if (!CBCore._sharedInstance) {\n CBCore._sharedInstance = new CBCore()\n }\n return CBCore._sharedInstance\n }\n \n \n \n \n \n static broadcastEventName = {\n \n \"userDidLogIn\": \"UserDidLogIn\",\n \"userDidLogOut\": \"UserDidLogOut\"\n \n }\n \n broadcastMessageInRootViewTree(message: UIViewBroadcastEvent) {\n \n this.viewCores.everyElement.rootViewController.view.broadcastEventInSubtree(message)\n \n }\n \n \n \n \n \n get socketClient() {\n return this._socketClient\n }\n \n get serverClient() {\n return this._serverClient\n }\n \n \n \n \n \n set isUserLoggedIn(isUserLoggedIn: boolean) {\n \n const previousValue = this.isUserLoggedIn\n \n \n localStorage.setItem(\"CBIsUserLoggedIn\", \"\" + isUserLoggedIn)\n \n \n //this._isUserLoggedIn = isUserLoggedIn;\n \n this.didSetIsUserLoggedIn(previousValue)\n \n }\n \n didSetIsUserLoggedIn(previousValue: boolean) {\n \n const isUserLoggedIn = this.isUserLoggedIn\n \n if (isUserLoggedIn && previousValue != isUserLoggedIn) {\n \n // Send message to views\n \n this.broadcastMessageInRootViewTree({\n \n name: CBCore.broadcastEventName.userDidLogIn,\n parameters: nil\n \n })\n \n this.updateLinkTargets()\n \n \n }\n else if (previousValue != isUserLoggedIn) {\n \n \n this.performFunctionWithDelay(0.01, function (this: CBCore) {\n \n UIRoute.currentRoute.routeByRemovingComponentsOtherThanOnesNamed([\n \n \"settings\",\n \"inquiry\"\n \n ]).apply()\n \n this.broadcastMessageInRootViewTree({\n \n name: CBCore.broadcastEventName.userDidLogOut,\n parameters: nil\n \n })\n \n this.updateLinkTargets()\n \n \n }.bind(this))\n \n }\n \n \n }\n \n private updateLinkTargets() {\n \n this.viewCores.everyElement.rootViewController.view.forEachViewInSubtree(function (view) {\n if (view instanceof UILink) {\n view.updateTarget()\n }\n })\n \n }\n \n get isUserLoggedIn() {\n \n const result = (localStorage.getItem(\"CBIsUserLoggedIn\") == \"true\")\n \n return result\n \n }\n \n \n \n get userProfile() {\n \n var result = nil\n \n \n try {\n result = JSON.parse(localStorage.getItem(\"CBUserProfile\"))\n } catch (error) {\n \n }\n \n // if (IS_NOT(result)) {\n \n // // Get userID from inquiryAccessKey if possible\n // var inquiryKey = this.inquiryAccessKey;\n \n // if (IS(inquiryKey)) {\n \n // result = FIRST_OR_NIL(this.inquiriesModel.inquiriesByCurrentUser.firstElement).inquirer\n \n // }\n \n // }\n \n return FIRST_OR_NIL(result)\n \n }\n \n set userProfile(userProfile: CBUserProfile) {\n \n if (IS_NOT(userProfile)) {\n \n localStorage.removeItem(\"CBUserProfile\")\n \n }\n \n localStorage.setItem(\"CBUserProfile\", JSON.stringify(userProfile))\n \n this.didSetUserProfile()\n \n }\n \n didSetUserProfile() {\n \n this.isUserLoggedIn = IS(this.userProfile)\n \n }\n \n \n set languageKey(languageKey: string) {\n \n if (IS_NOT(languageKey)) {\n \n localStorage.removeItem(\"CBLanguageKey\")\n \n }\n \n localStorage.setItem(\"CBLanguageKey\", JSON.stringify(languageKey))\n \n this.didSetLanguageKey()\n \n }\n \n get languageKey() {\n \n const result = FIRST(localStorage.getItem(\"CBLanguageKey\"), CBLanguageService.defaultLanguageKey).replace(\n \"\\\"\",\n \"\"\n ).replace(\"\\\"\", \"\")\n \n \n return result\n \n }\n \n didSetLanguageKey() {\n \n UIRoute.currentRoute.routeWithComponent(\n \"settings\",\n { \"language\": this.languageKey },\n YES\n ).applyByReplacingCurrentRouteInHistory()\n \n }\n \n \n get externalServiceIdentifier(): { accessKey: string; serviceID: string; organizationID: string } {\n \n const result = JSON.parse(localStorage.getItem(\"CBExternalServiceIdentifier\"))\n \n return result\n \n }\n \n set externalServiceIdentifier(externalServiceIdentifier: { accessKey: string; serviceID: string; organizationID: string }) {\n \n localStorage.setItem(\"CBExternalServiceIdentifier\", JSON.stringify(externalServiceIdentifier))\n \n }\n \n \n reloadSocketConnection() {\n \n // @ts-ignore\n this.socketClient.socket.disconnect()\n \n const messagesToBeSent = this.socketClient._messagesToBeSent.filter(function (messageItem, index, array) {\n \n return (!messageItem.isBoundToUserWithID || messageItem.isBoundToUserWithID ==\n CBCore.sharedInstance.userProfile._id)\n \n })\n \n this._socketClient = new CBSocketClient(this)\n this._socketClient._messagesToBeSent = messagesToBeSent\n \n const socketClient = this._socketClient\n \n this._models.forEach(function (model, index, array) {\n \n model.setSocketClient(socketClient)\n \n })\n \n this._functionsToCallForEachSocketClient.forEach(function (functionToCall, index, array) {\n \n functionToCall()\n \n })\n \n \n \n }\n \n \n callFunctionForEachSocketClient(functionToCall: () => void) {\n this._functionsToCallForEachSocketClient.push(functionToCall)\n functionToCall()\n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export declare type CBReferenceID = string;
|
|
2
|
+
export interface CBLanguageItem {
|
|
3
|
+
value: string;
|
|
4
|
+
languageKey: string;
|
|
5
|
+
itemKey: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LanguagesData {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface CBFinancialAmount {
|
|
13
|
+
amount: number;
|
|
14
|
+
currency: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CBLocalizedTextObject {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CBDropdownData<T> {
|
|
20
|
+
_id: CBReferenceID;
|
|
21
|
+
name?: CBLocalizedTextObject;
|
|
22
|
+
dropdownCode: string;
|
|
23
|
+
data: CBDropdownDataItem<T>[];
|
|
24
|
+
}
|
|
25
|
+
export interface CBDropdownDataItem<T> {
|
|
26
|
+
_id: CBReferenceID;
|
|
27
|
+
title: CBLocalizedTextObject;
|
|
28
|
+
rowsData?: CBDropdownDataItem<T>[];
|
|
29
|
+
isADropdownDataSection: boolean;
|
|
30
|
+
isADropdownDataRow: boolean;
|
|
31
|
+
attachedObject: T;
|
|
32
|
+
itemCode: string;
|
|
33
|
+
dropdownCode: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CBFileAccessor {
|
|
36
|
+
fileData: CBFileData;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
}
|
|
39
|
+
export interface CBFileData {
|
|
40
|
+
_id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
dataURL: string;
|
|
43
|
+
type: string;
|
|
44
|
+
isLimitedAccess?: boolean;
|
|
45
|
+
accessibleToUsers?: CBUserProfilePublic[];
|
|
46
|
+
}
|
|
47
|
+
export declare enum CBAuthenticationSource {
|
|
48
|
+
google = 10,
|
|
49
|
+
facebook = 11,
|
|
50
|
+
emailAccessLink = 200,
|
|
51
|
+
password = 220,
|
|
52
|
+
inquiryAccessLink = 500
|
|
53
|
+
}
|
|
54
|
+
export interface CBCoreInitializer {
|
|
55
|
+
languageValues: LanguagesData;
|
|
56
|
+
defaultLanguageKey: string;
|
|
57
|
+
}
|
|
58
|
+
export interface CBLoginKey {
|
|
59
|
+
key: string;
|
|
60
|
+
accessToken: string;
|
|
61
|
+
storeAccessTokenInClient: boolean;
|
|
62
|
+
authenticationSource: CBAuthenticationSource;
|
|
63
|
+
userID: CBReferenceID;
|
|
64
|
+
isValid: boolean;
|
|
65
|
+
loginDate?: Date;
|
|
66
|
+
logoutDate?: Date;
|
|
67
|
+
createdAt: Date;
|
|
68
|
+
updatedAt: Date;
|
|
69
|
+
}
|
|
70
|
+
export interface CBUserPassword {
|
|
71
|
+
passwordHash: string;
|
|
72
|
+
userID: CBReferenceID;
|
|
73
|
+
isValid: boolean;
|
|
74
|
+
createdAt: Date;
|
|
75
|
+
updatedAt: Date;
|
|
76
|
+
}
|
|
77
|
+
export interface CBAdministratorRightsDescriptor {
|
|
78
|
+
userProfile: CBUserProfile;
|
|
79
|
+
}
|
|
80
|
+
export interface CBSubscription {
|
|
81
|
+
_id: CBReferenceID;
|
|
82
|
+
startDate: Date;
|
|
83
|
+
endDate?: Date;
|
|
84
|
+
isIndefinite: boolean;
|
|
85
|
+
subscriptionKind: number;
|
|
86
|
+
createdAt: Date;
|
|
87
|
+
updatedAt: Date;
|
|
88
|
+
}
|
|
89
|
+
export declare type CBUserProfilePublic = any;
|
|
90
|
+
export declare type CBUserProfile = any;
|
|
91
|
+
export interface SocketClientInterface {
|
|
92
|
+
[x: string]: SocketClientFunction<any, any>;
|
|
93
|
+
}
|
|
94
|
+
export interface SocketClientResult<ResultType> {
|
|
95
|
+
responseMessage: any;
|
|
96
|
+
result: ResultType;
|
|
97
|
+
errorResult: any;
|
|
98
|
+
respondWithMessage: CBSocketMessageSendResponseFunction;
|
|
99
|
+
}
|
|
100
|
+
export declare type SocketClientFunction<MessageType, ResultType> = (messageData: MessageType, completionPolicy?: string, isUserBound?: boolean) => Promise<SocketClientResult<ResultType>>;
|
|
101
|
+
export declare type SocketClientNoMessageFunction<ResultType> = (messageData?: null, completionPolicy?: string, isUserBound?: boolean) => Promise<SocketClientResult<ResultType>>;
|
|
102
|
+
export interface CBSocketMultipleMessageObject<MessageDataType = any> {
|
|
103
|
+
key: string;
|
|
104
|
+
message: CBSocketMessage<MessageDataType>;
|
|
105
|
+
}
|
|
106
|
+
export interface CBSocketMessage<MessageDataType = any> {
|
|
107
|
+
identifier: string;
|
|
108
|
+
inResponseToIdentifier?: string;
|
|
109
|
+
keepWaitingForResponses?: boolean;
|
|
110
|
+
messageData: MessageDataType;
|
|
111
|
+
storedResponseHash?: string;
|
|
112
|
+
messageDataHash?: string;
|
|
113
|
+
canBeStoredAsResponse?: boolean;
|
|
114
|
+
useStoredResponse?: boolean;
|
|
115
|
+
responseValidityDuration?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface CBSocketMultipleMessage extends CBSocketMessage<CBSocketMultipleMessageObject[]> {
|
|
118
|
+
shouldGroupResponses: boolean;
|
|
119
|
+
}
|
|
120
|
+
export declare type CBSocketMessageSendResponseFunctionBase<ResponseMessageType> = (responseMessage: ResponseMessageType, completion?: CBSocketMessageCompletionFunction) => Promise<string>;
|
|
121
|
+
export declare type CBSocketMessageCompletionFunction = (responseMessage: any, respondWithMessage: CBSocketMessageSendResponseFunction) => void;
|
|
122
|
+
export declare type CBSocketMessageHandlerFunction<ResponseMessageType = any> = (message: any, respondWithMessage: CBSocketMessageSendResponseFunction<ResponseMessageType>) => void;
|
|
123
|
+
export declare type CBSocketMultipleMessagecompletionFunction = (responseMessages: any[], callcompletionFunctions: () => void) => void;
|
|
124
|
+
export interface CBSocketMessageSendResponseFunction<ResponseMessageType = any> extends CBSocketMessageSendResponseFunctionBase<ResponseMessageType> {
|
|
125
|
+
respondingToMainResponse: boolean;
|
|
126
|
+
excludeMessageFromAutomaticConnectionEvents: () => void;
|
|
127
|
+
setResponseValidityDuration(duration: number): any;
|
|
128
|
+
useStoredResponseWithErrorResponse(): any;
|
|
129
|
+
sendErrorResponse(message?: any, completion?: CBSocketMessageCompletionFunction): any;
|
|
130
|
+
sendIntermediateResponse(updateMessage: any, completion?: CBSocketMessageCompletionFunction): any;
|
|
131
|
+
confirmStoredResponseHash(responseHash: string, completion?: CBSocketMessageCompletionFunction): boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface CBSocketHandshakeInitMessage {
|
|
134
|
+
accessToken?: string;
|
|
135
|
+
userID: CBReferenceID;
|
|
136
|
+
loginKey?: string;
|
|
137
|
+
inquiryAccessKey?: string;
|
|
138
|
+
instanceIdentifier: string;
|
|
139
|
+
}
|
|
140
|
+
export interface CBSocketHandshakeResponseMessage {
|
|
141
|
+
accepted: boolean;
|
|
142
|
+
userProfile?: CBUserProfile;
|
|
143
|
+
}
|
|
144
|
+
export declare type TypeWithoutKey<Type, Key> = Pick<Type, Exclude<keyof Type, Key>>;
|
|
145
|
+
export declare type TypeWithoutID<Type> = TypeWithoutKey<Type, "_id">;
|
|
146
|
+
export declare type Diff<T extends keyof any, U extends keyof any> = ({
|
|
147
|
+
[P in T]: P;
|
|
148
|
+
} & {
|
|
149
|
+
[P in U]: never;
|
|
150
|
+
} & {
|
|
151
|
+
[x: string]: never;
|
|
152
|
+
})[T];
|
|
153
|
+
export declare type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;
|
|
154
|
+
export declare type RecursivePartial<T> = {
|
|
155
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
156
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var CBDataInterfaces_exports = {};
|
|
19
|
+
__export(CBDataInterfaces_exports, {
|
|
20
|
+
CBAuthenticationSource: () => CBAuthenticationSource
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(CBDataInterfaces_exports);
|
|
23
|
+
var CBAuthenticationSource = /* @__PURE__ */ ((CBAuthenticationSource2) => {
|
|
24
|
+
CBAuthenticationSource2[CBAuthenticationSource2["google"] = 10] = "google";
|
|
25
|
+
CBAuthenticationSource2[CBAuthenticationSource2["facebook"] = 11] = "facebook";
|
|
26
|
+
CBAuthenticationSource2[CBAuthenticationSource2["emailAccessLink"] = 200] = "emailAccessLink";
|
|
27
|
+
CBAuthenticationSource2[CBAuthenticationSource2["password"] = 220] = "password";
|
|
28
|
+
CBAuthenticationSource2[CBAuthenticationSource2["inquiryAccessLink"] = 500] = "inquiryAccessLink";
|
|
29
|
+
return CBAuthenticationSource2;
|
|
30
|
+
})(CBAuthenticationSource || {});
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
CBAuthenticationSource
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=CBDataInterfaces.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../scripts/CBDataInterfaces.ts"],
|
|
4
|
+
"sourcesContent": ["\n\n\n\n\nexport type CBReferenceID = string;\n\n\nexport interface CBLanguageItem {\n \n value: string;\n languageKey: string;\n itemKey: string;\n \n}\n\n\nexport interface LanguagesData {\n [key: string]: {\n [key: string]: string;\n };\n}\n\n\n\n\n\nexport interface CBFinancialAmount {\n \n amount: number;\n currency: string;\n \n}\n\n\nexport interface CBLocalizedTextObject {\n \n [key: string]: string\n \n}\n\n\nexport interface CBDropdownData<T> {\n \n _id: CBReferenceID;\n name?: CBLocalizedTextObject;\n dropdownCode: string;\n data: CBDropdownDataItem<T>[];\n \n}\n\n\nexport interface CBDropdownDataItem<T> {\n \n _id: CBReferenceID;\n title: CBLocalizedTextObject;\n rowsData?: CBDropdownDataItem<T>[]\n isADropdownDataSection: boolean;\n isADropdownDataRow: boolean;\n \n attachedObject: T\n \n itemCode: string;\n dropdownCode: string;\n \n}\n\n\n\n\n\n\n\nexport interface CBFileAccessor {\n \n fileData: CBFileData;\n createdAt: number;\n \n}\n\n\nexport interface CBFileData {\n \n _id: string;\n \n name: string;\n dataURL: string;\n type: string;\n isLimitedAccess?: boolean;\n accessibleToUsers?: CBUserProfilePublic[];\n \n}\n\nexport enum CBAuthenticationSource {\n \n google = 10,\n facebook = 11,\n emailAccessLink = 200,\n password = 220,\n inquiryAccessLink = 500\n \n}\n\n// AsdAsd\n\nexport interface CBCoreInitializer {\n \n languageValues: LanguagesData;\n defaultLanguageKey: string;\n \n}\n\nexport interface CBLoginKey {\n \n key: string;\n \n accessToken: string;\n \n storeAccessTokenInClient: boolean;\n \n authenticationSource: CBAuthenticationSource;\n \n userID: CBReferenceID;\n \n isValid: boolean;\n \n loginDate?: Date;\n logoutDate?: Date;\n \n createdAt: Date;\n updatedAt: Date;\n \n}\n\nexport interface CBUserPassword {\n \n passwordHash: string;\n \n userID: CBReferenceID;\n \n isValid: boolean;\n \n createdAt: Date;\n updatedAt: Date;\n \n}\n\nexport interface CBAdministratorRightsDescriptor {\n \n userProfile: CBUserProfile;\n \n}\n\nexport interface CBSubscription {\n \n _id: CBReferenceID;\n startDate: Date;\n endDate?: Date;\n \n isIndefinite: boolean;\n \n subscriptionKind: number;// alternatiiv oleks string/objectId, mis viitaks t\u00FC\u00FCbi objektile eraldi tabelis\n createdAt: Date;\n updatedAt: Date;\n \n}\n\n//Asdasd\n\nexport type CBUserProfilePublic = any;\nexport type CBUserProfile = any;\n\n\nexport interface SocketClientInterface {\n \n [x: string]: SocketClientFunction<any, any>;\n \n}\n\n\nexport interface SocketClientResult<ResultType> {\n \n responseMessage: any;\n result: ResultType;\n errorResult: any;\n respondWithMessage: CBSocketMessageSendResponseFunction;\n \n}\n\n\nexport type SocketClientFunction<MessageType, ResultType> = (\n messageData: MessageType,\n completionPolicy?: string,\n isUserBound?: boolean\n) => Promise<SocketClientResult<ResultType>>;\n\nexport type SocketClientNoMessageFunction<ResultType> = (\n messageData?: null,\n completionPolicy?: string,\n isUserBound?: boolean\n) => Promise<SocketClientResult<ResultType>>;\n\n\n\n\n\nexport interface CBSocketMultipleMessageObject<MessageDataType = any> {\n \n key: string;\n message: CBSocketMessage<MessageDataType>;\n \n}\n\n\n// CBSocket communication messages\nexport interface CBSocketMessage<MessageDataType = any> {\n \n identifier: string;\n inResponseToIdentifier?: string;\n keepWaitingForResponses?: boolean;\n \n messageData: MessageDataType;\n \n // This is sent from client to server with requests\n storedResponseHash?: string;\n \n // This is always present on messages sent from the server side\n messageDataHash?: string;\n \n // This tells the client to store this message for future use\n canBeStoredAsResponse?: boolean;\n \n // This tells the client to use the previously stored response\n useStoredResponse?: boolean;\n \n // This tells the client that the response is valid for at least this long in ms\n responseValidityDuration?: number;\n \n}\n\n\nexport interface CBSocketMultipleMessage extends CBSocketMessage<CBSocketMultipleMessageObject[]> {\n \n shouldGroupResponses: boolean;\n \n}\n\n\nexport type CBSocketMessageSendResponseFunctionBase<ResponseMessageType> = (\n responseMessage: ResponseMessageType,\n completion?: CBSocketMessageCompletionFunction\n) => Promise<string>;\n\nexport type CBSocketMessageCompletionFunction = (\n responseMessage: any,\n respondWithMessage: CBSocketMessageSendResponseFunction\n) => void;\nexport type CBSocketMessageHandlerFunction<ResponseMessageType = any> = (\n message: any,\n respondWithMessage: CBSocketMessageSendResponseFunction<ResponseMessageType>\n) => void;\n\nexport type CBSocketMultipleMessagecompletionFunction = (\n responseMessages: any[],\n callcompletionFunctions: () => void\n) => void;\n\n\nexport interface CBSocketMessageSendResponseFunction<ResponseMessageType = any> extends CBSocketMessageSendResponseFunctionBase<ResponseMessageType> {\n respondingToMainResponse: boolean;\n \n excludeMessageFromAutomaticConnectionEvents: () => void;\n \n setResponseValidityDuration(duration: number);\n \n useStoredResponseWithErrorResponse();\n \n sendErrorResponse(message?: any, completion?: CBSocketMessageCompletionFunction);\n \n sendIntermediateResponse(updateMessage: any, completion?: CBSocketMessageCompletionFunction);\n \n // This tells the client to use the stored response if responseHash matches and also enables storing of responses\n // in the client in the first place. Returns true if the hash matched.\n confirmStoredResponseHash(responseHash: string, completion?: CBSocketMessageCompletionFunction): boolean;\n \n}\n\n\n\n// Socket handshake messages\nexport interface CBSocketHandshakeInitMessage {\n \n accessToken?: string;\n userID: CBReferenceID;\n \n loginKey?: string;\n inquiryAccessKey?: string;\n \n instanceIdentifier: string;\n \n}\n\n\nexport interface CBSocketHandshakeResponseMessage {\n \n accepted: boolean;\n \n userProfile?: CBUserProfile;\n \n}\n\n\n\n\n\nexport type TypeWithoutKey<Type, Key> = Pick<Type, Exclude<keyof Type, Key>>;\n\nexport type TypeWithoutID<Type> = TypeWithoutKey<Type, \"_id\">;\n\nexport type Diff<T extends keyof any, U extends keyof any> =\n ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];\n\nexport type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?:\n T[P] extends (infer U)[] ? RecursivePartial<U>[] :\n T[P] extends object ? RecursivePartial<T[P]> :\n T[P];\n};\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6FO,IAAK,yBAAL,kBAAKA,4BAAL;AAEH,EAAAA,gDAAA,YAAS,MAAT;AACA,EAAAA,gDAAA,cAAW,MAAX;AACA,EAAAA,gDAAA,qBAAkB,OAAlB;AACA,EAAAA,gDAAA,cAAW,OAAX;AACA,EAAAA,gDAAA,uBAAoB,OAApB;AANQ,SAAAA;AAAA,GAAA;",
|
|
6
|
+
"names": ["CBAuthenticationSource"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { UILanguageService, UILocalizedTextObject, UIRoute, UIView } from "uicore-ts";
|
|
2
|
+
import { CBLocalizedTextObject } from "./CBDataInterfaces";
|
|
3
|
+
export interface ParticularLanguageValues {
|
|
4
|
+
[x: string]: string;
|
|
5
|
+
topBarTitle: string;
|
|
6
|
+
selectLanguageTitle: string;
|
|
7
|
+
languageNameShort: string;
|
|
8
|
+
leftBarTitle: string;
|
|
9
|
+
languageName: string;
|
|
10
|
+
}
|
|
11
|
+
export interface LanguageValues {
|
|
12
|
+
[x: string]: ParticularLanguageValues;
|
|
13
|
+
en: ParticularLanguageValues;
|
|
14
|
+
est: ParticularLanguageValues;
|
|
15
|
+
}
|
|
16
|
+
export declare class CBLanguageService implements UILanguageService {
|
|
17
|
+
static _currentLanguageKey: string;
|
|
18
|
+
static languageValues: LanguageValues;
|
|
19
|
+
static languages: any;
|
|
20
|
+
static useStoredLanguageValues(values?: {}): void;
|
|
21
|
+
static broadcastLanguageChangeEvent(view?: UIView): void;
|
|
22
|
+
static get defaultLanguageKey(): any;
|
|
23
|
+
static get currentLanguageKey(): string;
|
|
24
|
+
updateCurrentLanguageKey(): void;
|
|
25
|
+
static updateCurrentLanguageKey(route?: UIRoute): void;
|
|
26
|
+
get currentLanguageKey(): string;
|
|
27
|
+
static stringForKey(key: string, languageKey: string, defaultString: string, parameters?: {
|
|
28
|
+
[x: string]: string | UILocalizedTextObject;
|
|
29
|
+
}): any;
|
|
30
|
+
stringForKey(key: string, languageKey: string, defaultString: string, parameters?: {
|
|
31
|
+
[x: string]: string | UILocalizedTextObject;
|
|
32
|
+
}): any;
|
|
33
|
+
static localizedTextObjectForKey(key: string, defaultString?: string, parameters?: {
|
|
34
|
+
[x: string]: string | UILocalizedTextObject;
|
|
35
|
+
}): {};
|
|
36
|
+
localizedTextObjectForKey(key: string, defaultString?: string, parameters?: {
|
|
37
|
+
[x: string]: string | UILocalizedTextObject;
|
|
38
|
+
}): {};
|
|
39
|
+
static localizedTextObjectForText(text: string): any;
|
|
40
|
+
localizedTextObjectForText(text: string): any;
|
|
41
|
+
static stringForCurrentLanguage(localizedTextObject: CBLocalizedTextObject | string): any;
|
|
42
|
+
stringForCurrentLanguage(localizedTextObject: CBLocalizedTextObject): any;
|
|
43
|
+
}
|