@xuda.io/runtime-bundle 1.0.1406 → 1.0.1407
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/js/modules/xuda-project-loader-module.esm.js +2 -2
- package/js/modules/xuda-project-loader-module.esm.min.js +1 -1
- package/js/xuda-runtime-bundle.js +621 -352
- package/js/xuda-runtime-bundle.min.js +9 -9
- package/js/xuda-runtime-slim.js +621 -352
- package/js/xuda-runtime-slim.min.es.js +621 -352
- package/js/xuda-runtime-slim.min.js +9 -9
- package/js/xuda-server-bundle.min.mjs +68 -1
- package/js/xuda-server-bundle.mjs +537 -11
- package/js/xuda-worker-bundle.js +537 -11
- package/js/xuda-worker-bundle.min.js +68 -1
- package/js/xuda_common-bundle.js +537 -11
- package/js/xuda_common-bundle.min.js +68 -1
- package/package.json +1 -1
package/js/xuda_common-bundle.js
CHANGED
|
@@ -10,6 +10,10 @@ var func = {};
|
|
|
10
10
|
func.UI = {};
|
|
11
11
|
func.GLB = {};
|
|
12
12
|
func.mobile = {};
|
|
13
|
+
func.runtime = {};
|
|
14
|
+
func.runtime.session = {};
|
|
15
|
+
func.runtime.workers = {};
|
|
16
|
+
func.runtime.ui = {};
|
|
13
17
|
glb.IS_STUDIO = null;
|
|
14
18
|
|
|
15
19
|
var PROJECT_OBJ = {};
|
|
@@ -23,6 +27,537 @@ glb.PROTECTED_VARS = ['_NULL', '_THIS', '_FOR_KEY', '_FOR_VAL', '_ROWNO', '_ROWI
|
|
|
23
27
|
// glb.newRecord = 999999;
|
|
24
28
|
|
|
25
29
|
func.common = {};
|
|
30
|
+
func.runtime.platform = {
|
|
31
|
+
has_window: function () {
|
|
32
|
+
return typeof window !== 'undefined';
|
|
33
|
+
},
|
|
34
|
+
has_document: function () {
|
|
35
|
+
return typeof document !== 'undefined';
|
|
36
|
+
},
|
|
37
|
+
get_window: function () {
|
|
38
|
+
if (func.runtime.platform.has_window()) {
|
|
39
|
+
return window;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
},
|
|
43
|
+
get_document: function () {
|
|
44
|
+
if (func.runtime.platform.has_document()) {
|
|
45
|
+
return document;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
get_location: function () {
|
|
50
|
+
const win = func.runtime.platform.get_window();
|
|
51
|
+
return win?.location || null;
|
|
52
|
+
},
|
|
53
|
+
get_navigator: function () {
|
|
54
|
+
const win = func.runtime.platform.get_window();
|
|
55
|
+
if (win?.navigator) {
|
|
56
|
+
return win.navigator;
|
|
57
|
+
}
|
|
58
|
+
if (typeof navigator !== 'undefined') {
|
|
59
|
+
return navigator;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
},
|
|
63
|
+
is_html_element: function (value) {
|
|
64
|
+
if (typeof HTMLElement === 'undefined') {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return value instanceof HTMLElement;
|
|
68
|
+
},
|
|
69
|
+
get_storage: function (type) {
|
|
70
|
+
const win = func.runtime.platform.get_window();
|
|
71
|
+
try {
|
|
72
|
+
if (!win) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
if (type === 'session') {
|
|
76
|
+
return win.sessionStorage || null;
|
|
77
|
+
}
|
|
78
|
+
return win.localStorage || null;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
get_storage_item: function (key, type) {
|
|
84
|
+
const storage = func.runtime.platform.get_storage(type);
|
|
85
|
+
if (!storage) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
return storage.getItem(key);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
set_storage_item: function (key, value, type) {
|
|
95
|
+
const storage = func.runtime.platform.get_storage(type);
|
|
96
|
+
if (!storage) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
storage.setItem(key, value);
|
|
101
|
+
return true;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
get_url_href: function () {
|
|
107
|
+
return func.runtime.platform.get_location()?.href || '';
|
|
108
|
+
},
|
|
109
|
+
get_url_search: function () {
|
|
110
|
+
return func.runtime.platform.get_location()?.search || '';
|
|
111
|
+
},
|
|
112
|
+
get_url_hash: function () {
|
|
113
|
+
return func.runtime.platform.get_location()?.hash || '';
|
|
114
|
+
},
|
|
115
|
+
get_host: function () {
|
|
116
|
+
return func.runtime.platform.get_location()?.host || '';
|
|
117
|
+
},
|
|
118
|
+
get_hostname: function () {
|
|
119
|
+
return func.runtime.platform.get_location()?.hostname || '';
|
|
120
|
+
},
|
|
121
|
+
get_device_uuid: function () {
|
|
122
|
+
const win = func.runtime.platform.get_window();
|
|
123
|
+
return win?.device?.uuid || null;
|
|
124
|
+
},
|
|
125
|
+
get_device_name: function () {
|
|
126
|
+
const win = func.runtime.platform.get_window();
|
|
127
|
+
return win?.device?.name || null;
|
|
128
|
+
},
|
|
129
|
+
get_inner_size: function () {
|
|
130
|
+
const win = func.runtime.platform.get_window();
|
|
131
|
+
return {
|
|
132
|
+
width: win?.innerWidth || 0,
|
|
133
|
+
height: win?.innerHeight || 0,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
add_window_listener: function (name, handler) {
|
|
137
|
+
const win = func.runtime.platform.get_window();
|
|
138
|
+
if (!win?.addEventListener) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
win.addEventListener(name, handler);
|
|
142
|
+
return true;
|
|
143
|
+
},
|
|
144
|
+
dispatch_body_event: function (event) {
|
|
145
|
+
const doc = func.runtime.platform.get_document();
|
|
146
|
+
if (!doc?.body?.dispatchEvent) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
doc.body.dispatchEvent(event);
|
|
150
|
+
return true;
|
|
151
|
+
},
|
|
152
|
+
reload_top_window: function () {
|
|
153
|
+
const win = func.runtime.platform.get_window();
|
|
154
|
+
if (!win?.top?.location?.reload) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
win.top.location.reload();
|
|
158
|
+
return true;
|
|
159
|
+
},
|
|
160
|
+
get_service_worker: function () {
|
|
161
|
+
const nav = func.runtime.platform.get_navigator();
|
|
162
|
+
return nav?.serviceWorker || null;
|
|
163
|
+
},
|
|
164
|
+
has_service_worker: function () {
|
|
165
|
+
return !!func.runtime.platform.get_service_worker();
|
|
166
|
+
},
|
|
167
|
+
register_service_worker: function (script_url) {
|
|
168
|
+
const service_worker = func.runtime.platform.get_service_worker();
|
|
169
|
+
if (!service_worker?.register) {
|
|
170
|
+
return Promise.reject(new Error('serviceWorker is not available'));
|
|
171
|
+
}
|
|
172
|
+
return service_worker.register(script_url);
|
|
173
|
+
},
|
|
174
|
+
add_service_worker_listener: function (name, handler) {
|
|
175
|
+
const service_worker = func.runtime.platform.get_service_worker();
|
|
176
|
+
if (!service_worker?.addEventListener) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
service_worker.addEventListener(name, handler);
|
|
180
|
+
return true;
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
func.runtime.env = {
|
|
184
|
+
get_url_params: function () {
|
|
185
|
+
const search = func.runtime.platform.get_url_search();
|
|
186
|
+
return new URLSearchParams(search);
|
|
187
|
+
},
|
|
188
|
+
get_url_parameters_object: function () {
|
|
189
|
+
const search_params = func.runtime.env.get_url_params();
|
|
190
|
+
const parameters = {};
|
|
191
|
+
for (const [key, value] of search_params.entries()) {
|
|
192
|
+
parameters[key] = value;
|
|
193
|
+
}
|
|
194
|
+
return parameters;
|
|
195
|
+
},
|
|
196
|
+
get_default_session_value: function (key) {
|
|
197
|
+
switch (key) {
|
|
198
|
+
case 'domain':
|
|
199
|
+
return func.runtime.platform.get_host();
|
|
200
|
+
case 'engine_mode':
|
|
201
|
+
return 'miniapp';
|
|
202
|
+
case 'app_id':
|
|
203
|
+
return 'unknown';
|
|
204
|
+
default:
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
func.runtime.session.create_tab_id = function () {
|
|
210
|
+
const session_storage = func.runtime.platform.get_storage('session');
|
|
211
|
+
const local_storage = func.runtime.platform.get_storage('local');
|
|
212
|
+
var page_tab_id = session_storage?.getItem('tabID');
|
|
213
|
+
if (page_tab_id == null) {
|
|
214
|
+
var local_tab_id = local_storage?.getItem('tabID');
|
|
215
|
+
page_tab_id = local_tab_id == null ? 1 : Number(local_tab_id) + 1;
|
|
216
|
+
func.runtime.platform.set_storage_item('tabID', page_tab_id, 'local');
|
|
217
|
+
func.runtime.platform.set_storage_item('tabID', page_tab_id, 'session');
|
|
218
|
+
}
|
|
219
|
+
return page_tab_id;
|
|
220
|
+
};
|
|
221
|
+
func.runtime.session.get_fingerprint = function (components, instance_id) {
|
|
222
|
+
const device_uuid = func.runtime.platform.get_device_uuid();
|
|
223
|
+
if (func.utils.get_device() && device_uuid) {
|
|
224
|
+
if (instance_id) {
|
|
225
|
+
return instance_id + device_uuid;
|
|
226
|
+
}
|
|
227
|
+
return device_uuid;
|
|
228
|
+
}
|
|
229
|
+
const fingerprint_id = Fingerprint2.x64hash128(
|
|
230
|
+
components
|
|
231
|
+
.map(function (pair) {
|
|
232
|
+
return pair.value;
|
|
233
|
+
})
|
|
234
|
+
.join(),
|
|
235
|
+
31,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
if (instance_id) {
|
|
239
|
+
return instance_id + fingerprint_id + func.runtime.session.create_tab_id();
|
|
240
|
+
}
|
|
241
|
+
return fingerprint_id;
|
|
242
|
+
};
|
|
243
|
+
func.runtime.session.create_state = function (SESSION_ID, options) {
|
|
244
|
+
const runtime_host = func.runtime.platform.get_host();
|
|
245
|
+
SESSION_OBJ[SESSION_ID] = {
|
|
246
|
+
JOB_NO: 1000,
|
|
247
|
+
opt: options.opt,
|
|
248
|
+
root_element: options.root_element,
|
|
249
|
+
worker_type: options.worker_type,
|
|
250
|
+
api_callback: options.api_callback,
|
|
251
|
+
CODE_BUNDLE: options.code_bundle,
|
|
252
|
+
SLIM_BUNDLE: options.slim_bundle,
|
|
253
|
+
WORKER_OBJ: {
|
|
254
|
+
jobs: [],
|
|
255
|
+
num: 1000,
|
|
256
|
+
stat: null,
|
|
257
|
+
},
|
|
258
|
+
DS_GLB: {},
|
|
259
|
+
SYS_GLOBAL_OBJ_FIREBASE_AUTH_INFO: {
|
|
260
|
+
token: '',
|
|
261
|
+
first_name: '',
|
|
262
|
+
last_name: '',
|
|
263
|
+
email: '',
|
|
264
|
+
user_id: '',
|
|
265
|
+
picture: '',
|
|
266
|
+
verified_email: '',
|
|
267
|
+
locale: '',
|
|
268
|
+
error_code: '',
|
|
269
|
+
error_msg: '',
|
|
270
|
+
},
|
|
271
|
+
SYS_GLOBAL_OBJ_CLIENT_INFO: {
|
|
272
|
+
fingerprint: '',
|
|
273
|
+
device: '',
|
|
274
|
+
user_agent: '',
|
|
275
|
+
browser_version: '',
|
|
276
|
+
browser_name: '',
|
|
277
|
+
engine_version: '',
|
|
278
|
+
client_ip: '',
|
|
279
|
+
engine_name: '',
|
|
280
|
+
os_name: '',
|
|
281
|
+
os_version: '',
|
|
282
|
+
device_model: '',
|
|
283
|
+
device_vendor: '',
|
|
284
|
+
device_type: '',
|
|
285
|
+
screen_current_resolution_x: '',
|
|
286
|
+
screen_current_resolution_y: '',
|
|
287
|
+
screen_available_resolution_x: '',
|
|
288
|
+
screen_available_resolution_y: '',
|
|
289
|
+
language: '',
|
|
290
|
+
time_zone: '',
|
|
291
|
+
cpu_architecture: '',
|
|
292
|
+
uuid: '',
|
|
293
|
+
},
|
|
294
|
+
PUSH_NOTIFICATION_GRANTED: null,
|
|
295
|
+
FIREBASE_TOKEN_ID: null,
|
|
296
|
+
USR_OBJ: {},
|
|
297
|
+
debug_js: null,
|
|
298
|
+
DS_UI_EVENTS_GLB: {},
|
|
299
|
+
host: runtime_host,
|
|
300
|
+
req_id: 0,
|
|
301
|
+
build_info: {},
|
|
302
|
+
CACHE_REQ: {},
|
|
303
|
+
url_params: {
|
|
304
|
+
...func.common.getParametersFromUrl(),
|
|
305
|
+
...options.url_params,
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
func.runtime.workers.ensure_registry(SESSION_ID);
|
|
309
|
+
return SESSION_OBJ[SESSION_ID];
|
|
310
|
+
};
|
|
311
|
+
func.runtime.session.set_default_value = function (_session, key, value) {
|
|
312
|
+
_session[key] = value || func.runtime.env.get_default_session_value(key);
|
|
313
|
+
return _session[key];
|
|
314
|
+
};
|
|
315
|
+
func.runtime.session.populate_client_info = function (_session, components) {
|
|
316
|
+
const _client_info = _session.SYS_GLOBAL_OBJ_CLIENT_INFO;
|
|
317
|
+
const platform = func.runtime.platform;
|
|
318
|
+
const { engine_mode } = _session;
|
|
319
|
+
|
|
320
|
+
_client_info.fingerprint = func.runtime.session.get_fingerprint(components);
|
|
321
|
+
|
|
322
|
+
if (engine_mode === 'live_preview') {
|
|
323
|
+
const inner_size = platform.get_inner_size();
|
|
324
|
+
_client_info.screen_current_resolution_x = inner_size.width;
|
|
325
|
+
_client_info.screen_current_resolution_y = inner_size.height;
|
|
326
|
+
_client_info.screen_available_resolution_x = inner_size.width;
|
|
327
|
+
_client_info.screen_available_resolution_y = inner_size.height;
|
|
328
|
+
} else {
|
|
329
|
+
_client_info.screen_current_resolution_x = components[6].value[0];
|
|
330
|
+
_client_info.screen_current_resolution_y = components[6].value[1];
|
|
331
|
+
_client_info.screen_available_resolution_x = components[7].value[0];
|
|
332
|
+
_client_info.screen_available_resolution_y = components[7].value[1];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const client = new ClientJS();
|
|
336
|
+
_client_info.device = func.utils.get_device();
|
|
337
|
+
|
|
338
|
+
const browser_data = client.getBrowserData();
|
|
339
|
+
_client_info.user_agent = browser_data.ua;
|
|
340
|
+
_client_info.browser_version = browser_data.browser.name;
|
|
341
|
+
_client_info.browser_name = browser_data.browser.version;
|
|
342
|
+
_client_info.engine_version = browser_data.engine.name;
|
|
343
|
+
_client_info.engine_name = browser_data.engine.version;
|
|
344
|
+
_client_info.os_name = browser_data.os.name;
|
|
345
|
+
_client_info.os_version = browser_data.os.version;
|
|
346
|
+
_client_info.device_model = browser_data.device.name;
|
|
347
|
+
_client_info.device_vendor = browser_data.device.name;
|
|
348
|
+
_client_info.device_type = browser_data.device.name;
|
|
349
|
+
_client_info.language = client.getLanguage();
|
|
350
|
+
_client_info.time_zone = client.getTimeZone();
|
|
351
|
+
_client_info.cpu_architecture = browser_data.cpu.architecture;
|
|
352
|
+
|
|
353
|
+
if (['android', 'ios', 'windows', 'macos', 'linux', 'live_preview'].includes(engine_mode) && func.utils.get_device()) {
|
|
354
|
+
_client_info.uuid = platform.get_device_uuid();
|
|
355
|
+
const device_name = platform.get_device_name();
|
|
356
|
+
if (device_name) {
|
|
357
|
+
_client_info.device_name = device_name;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return _client_info;
|
|
361
|
+
};
|
|
362
|
+
func.runtime.workers.ensure_registry = function (SESSION_ID) {
|
|
363
|
+
if (!WEB_WORKER[SESSION_ID]) {
|
|
364
|
+
WEB_WORKER[SESSION_ID] = {};
|
|
365
|
+
}
|
|
366
|
+
return WEB_WORKER[SESSION_ID];
|
|
367
|
+
};
|
|
368
|
+
func.runtime.workers.get_registry_entry = function (SESSION_ID, worker_id) {
|
|
369
|
+
return func.runtime.workers.ensure_registry(SESSION_ID)?.[worker_id] || null;
|
|
370
|
+
};
|
|
371
|
+
func.runtime.workers.set_registry_entry = function (SESSION_ID, worker_id, entry) {
|
|
372
|
+
const worker_registry = func.runtime.workers.ensure_registry(SESSION_ID);
|
|
373
|
+
worker_registry[worker_id] = entry;
|
|
374
|
+
return worker_registry[worker_id];
|
|
375
|
+
};
|
|
376
|
+
func.runtime.workers.build_worker_name = function (glb_worker_type, session, prog_obj, worker_id, build_id) {
|
|
377
|
+
return (
|
|
378
|
+
`${typeof session.SLIM_BUNDLE === 'undefined' || !session.SLIM_BUNDLE ? '' : 'Slim '}${prog_obj.menuName} worker` +
|
|
379
|
+
' ' +
|
|
380
|
+
glb_worker_type +
|
|
381
|
+
': #' +
|
|
382
|
+
worker_id.toString() +
|
|
383
|
+
' ' +
|
|
384
|
+
(build_id || '') +
|
|
385
|
+
' ' +
|
|
386
|
+
session.domain
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
func.runtime.workers.is_server_transport = function (session) {
|
|
390
|
+
return !!(RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!session.opt.app_computing_mode || session.opt.app_computing_mode === 'server'));
|
|
391
|
+
};
|
|
392
|
+
func.runtime.workers.send_message = function (SESSION_ID, worker_id, session, msg, process_pid) {
|
|
393
|
+
const registry_entry = func.runtime.workers.get_registry_entry(SESSION_ID, worker_id);
|
|
394
|
+
if (!registry_entry?.worker) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (func.runtime.workers.is_server_transport(session)) {
|
|
399
|
+
if (process_pid) {
|
|
400
|
+
msg.process_pid = process_pid;
|
|
401
|
+
}
|
|
402
|
+
registry_entry.worker.emit('message', msg);
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
registry_entry.worker.postMessage(msg);
|
|
407
|
+
return true;
|
|
408
|
+
};
|
|
409
|
+
func.runtime.workers.set_promise = function (SESSION_ID, worker_id, promise_queue_id, value) {
|
|
410
|
+
const registry_entry = func.runtime.workers.get_registry_entry(SESSION_ID, worker_id);
|
|
411
|
+
if (!registry_entry) {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
registry_entry.promise_queue[promise_queue_id] = value;
|
|
415
|
+
return registry_entry.promise_queue[promise_queue_id];
|
|
416
|
+
};
|
|
417
|
+
func.runtime.workers.get_promise = function (SESSION_ID, worker_id, promise_queue_id) {
|
|
418
|
+
const registry_entry = func.runtime.workers.get_registry_entry(SESSION_ID, worker_id);
|
|
419
|
+
if (!registry_entry) {
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
return registry_entry.promise_queue[promise_queue_id];
|
|
423
|
+
};
|
|
424
|
+
func.runtime.workers.delete_promise = function (SESSION_ID, worker_id, promise_queue_id) {
|
|
425
|
+
const registry_entry = func.runtime.workers.get_registry_entry(SESSION_ID, worker_id);
|
|
426
|
+
if (!registry_entry?.promise_queue) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
delete registry_entry.promise_queue[promise_queue_id];
|
|
430
|
+
return true;
|
|
431
|
+
};
|
|
432
|
+
func.runtime.ui.get_root_element = function (SESSION_ID) {
|
|
433
|
+
return $(SESSION_OBJ[SESSION_ID].root_element);
|
|
434
|
+
};
|
|
435
|
+
func.runtime.ui.show_root_element = function (SESSION_ID) {
|
|
436
|
+
const $root_element = func.runtime.ui.get_root_element(SESSION_ID);
|
|
437
|
+
$root_element.show();
|
|
438
|
+
return $root_element;
|
|
439
|
+
};
|
|
440
|
+
func.runtime.ui.ensure_app_shell = function (SESSION_ID, domain) {
|
|
441
|
+
const $root_element = func.runtime.ui.get_root_element(SESSION_ID);
|
|
442
|
+
$root_element.css('position', 'relative');
|
|
443
|
+
|
|
444
|
+
if (!$root_element.find('.loader').length) {
|
|
445
|
+
$root_element.append(`
|
|
446
|
+
|
|
447
|
+
<style>
|
|
448
|
+
.loader {
|
|
449
|
+
position: absolute;
|
|
450
|
+
background: rgb(0 0 0 / 30%);
|
|
451
|
+
z-index: 10;
|
|
452
|
+
overflow-y: auto;
|
|
453
|
+
top: 0;
|
|
454
|
+
right: 0;
|
|
455
|
+
bottom: 0;
|
|
456
|
+
left: 0;
|
|
457
|
+
display: flex;
|
|
458
|
+
flex-direction: column;
|
|
459
|
+
justify-content: center;
|
|
460
|
+
align-items: center;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.loader .loader_logo {
|
|
464
|
+
|
|
465
|
+
width: 43px;
|
|
466
|
+
height: 43px;
|
|
467
|
+
border-radius: 50%;
|
|
468
|
+
background-size: cover;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.loader .loader_msg {
|
|
472
|
+
padding-top: 10px;
|
|
473
|
+
text-align: center;
|
|
474
|
+
min-height: 20px;
|
|
475
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.loader .loader_rotate {
|
|
479
|
+
padding: 20px;
|
|
480
|
+
border: 2px solid #fff;
|
|
481
|
+
border-right-color: #898989;
|
|
482
|
+
border-radius: 22px;
|
|
483
|
+
-webkit-animation: rotate 0.8s infinite linear;
|
|
484
|
+
position: absolute;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
@-webkit-keyframes rotate {
|
|
488
|
+
100% {
|
|
489
|
+
-webkit-transform: rotate(360deg);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
</style>
|
|
493
|
+
|
|
494
|
+
<div class="loader">
|
|
495
|
+
<div class="loader_logo">
|
|
496
|
+
<div class="loader_rotate"></div>
|
|
497
|
+
</div>
|
|
498
|
+
<div class="loader_msg"> </div>
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
<div class="progressLoader"></div>
|
|
503
|
+
|
|
504
|
+
`);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (!$root_element.find('#tailwind_toast_controller').length) {
|
|
508
|
+
$root_element.append(
|
|
509
|
+
`<div aria-live="assertive"
|
|
510
|
+
class="fixed inset-0 flex items-end px-4 py-6 pointer-events-none sm:p-6 sm:items-start z-[999]">
|
|
511
|
+
<div id="tailwind_toast_controller" class="w-full flex flex-col items-center space-y-4 sm:items-end">
|
|
512
|
+
|
|
513
|
+
</div>
|
|
514
|
+
</div>`,
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (!$root_element.find('#progressScreen2').length) {
|
|
519
|
+
$root_element.append(
|
|
520
|
+
`
|
|
521
|
+
<div id="progressScreen2" style="display: none">
|
|
522
|
+
<div id="progressScreen2_text"></div>
|
|
523
|
+
</div>`,
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const get_url = function (domain, method, path) {
|
|
528
|
+
return `https://${domain}/${method}${path ? '/' + path : '/'}`;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
func.utils.load_css_on_demand(get_url(domain, 'dist', 'runtime/css/mobile.css'));
|
|
532
|
+
return $root_element;
|
|
533
|
+
};
|
|
534
|
+
func.runtime.ui.ensure_embed_container = function (SESSION_ID) {
|
|
535
|
+
const $root_element = func.runtime.ui.get_root_element(SESSION_ID);
|
|
536
|
+
let $embed_container = $root_element.find(`#embed_${SESSION_ID}`);
|
|
537
|
+
|
|
538
|
+
if (!$embed_container.length) {
|
|
539
|
+
$embed_container = $('<div>')
|
|
540
|
+
.attr('id', 'embed_' + SESSION_ID)
|
|
541
|
+
.addClass('xu_embed_div')
|
|
542
|
+
.data({ xuData: {} })
|
|
543
|
+
.appendTo($root_element);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return $embed_container;
|
|
547
|
+
};
|
|
548
|
+
func.runtime.ui.get_embed_container = function (SESSION_ID) {
|
|
549
|
+
return func.runtime.ui.get_root_element(SESSION_ID).find(`#embed_${SESSION_ID}`);
|
|
550
|
+
};
|
|
551
|
+
func.runtime.ui.get_embed_screen_containers = function () {
|
|
552
|
+
return $('.xu_embed_container');
|
|
553
|
+
};
|
|
554
|
+
func.runtime.ui.append_to_body = function ($element) {
|
|
555
|
+
$element.appendTo('body');
|
|
556
|
+
return $element;
|
|
557
|
+
};
|
|
558
|
+
func.runtime.ui.find_in_root = function (SESSION_ID, selector) {
|
|
559
|
+
return func.runtime.ui.get_root_element(SESSION_ID).find(selector);
|
|
560
|
+
};
|
|
26
561
|
func.common.find_item_by_key = function (arr, key, val) {
|
|
27
562
|
return _.find(arr, function (e) {
|
|
28
563
|
return e.data[key] === val;
|
|
@@ -411,19 +946,10 @@ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSessio
|
|
|
411
946
|
};
|
|
412
947
|
|
|
413
948
|
func.common.getJsonFromUrl = function () {
|
|
414
|
-
|
|
415
|
-
const urlParams = new URLSearchParams(queryString);
|
|
416
|
-
return urlParams;
|
|
949
|
+
return func.runtime.env.get_url_params();
|
|
417
950
|
};
|
|
418
951
|
func.common.getParametersFromUrl = function () {
|
|
419
|
-
|
|
420
|
-
const parameters = {};
|
|
421
|
-
|
|
422
|
-
for (const [key, value] of searchParams.entries()) {
|
|
423
|
-
parameters[key] = value;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return parameters;
|
|
952
|
+
return func.runtime.env.get_url_parameters_object();
|
|
427
953
|
};
|
|
428
954
|
|
|
429
955
|
func.common.getObjectFromUrl = function (url, element_attributes_obj, embed_params_obj) {
|