@geexcode/geex-angular 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +133 -102
- package/dist/index.mjs +133 -102
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -105,7 +105,7 @@ interface UiModule extends GeexModule {
|
|
|
105
105
|
declare const ExtensionModule: Record<string, any> & {};
|
|
106
106
|
type ExtensionModule = typeof ExtensionModule;
|
|
107
107
|
type GeexModules<TExtensionModules extends ExtensionModule = ExtensionModule> = {
|
|
108
|
-
init
|
|
108
|
+
init: Promise<{
|
|
109
109
|
[K in keyof GeexModules<TExtensionModules>]: any;
|
|
110
110
|
}>;
|
|
111
111
|
tenant: TenantModule;
|
|
@@ -120,9 +120,10 @@ type GeexModule<TExtension = ExtensionModule> = {
|
|
|
120
120
|
* A module combines both reactive state (signals) and business logic methods.
|
|
121
121
|
* Concrete modules can extend this interface to expose their own signals & methods.
|
|
122
122
|
* This empty base exists mainly for typing convenience and future extension.
|
|
123
|
-
*
|
|
123
|
+
* The init property is a Promise that resolves when the module is initialized.
|
|
124
|
+
* Multiple awaits on the same init will share the same initialization process.
|
|
124
125
|
*/
|
|
125
|
-
init:
|
|
126
|
+
init: Promise<any>;
|
|
126
127
|
} & TExtension;
|
|
127
128
|
declare function createTenantModule(injector: Injector): TenantModule;
|
|
128
129
|
declare function createAuthModule(injector: Injector): AuthModule;
|
package/dist/index.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ interface UiModule extends GeexModule {
|
|
|
105
105
|
declare const ExtensionModule: Record<string, any> & {};
|
|
106
106
|
type ExtensionModule = typeof ExtensionModule;
|
|
107
107
|
type GeexModules<TExtensionModules extends ExtensionModule = ExtensionModule> = {
|
|
108
|
-
init
|
|
108
|
+
init: Promise<{
|
|
109
109
|
[K in keyof GeexModules<TExtensionModules>]: any;
|
|
110
110
|
}>;
|
|
111
111
|
tenant: TenantModule;
|
|
@@ -120,9 +120,10 @@ type GeexModule<TExtension = ExtensionModule> = {
|
|
|
120
120
|
* A module combines both reactive state (signals) and business logic methods.
|
|
121
121
|
* Concrete modules can extend this interface to expose their own signals & methods.
|
|
122
122
|
* This empty base exists mainly for typing convenience and future extension.
|
|
123
|
-
*
|
|
123
|
+
* The init property is a Promise that resolves when the module is initialized.
|
|
124
|
+
* Multiple awaits on the same init will share the same initialization process.
|
|
124
125
|
*/
|
|
125
|
-
init:
|
|
126
|
+
init: Promise<any>;
|
|
126
127
|
} & TExtension;
|
|
127
128
|
declare function createTenantModule(injector: Injector): TenantModule;
|
|
128
129
|
declare function createAuthModule(injector: Injector): AuthModule;
|
package/dist/index.js
CHANGED
|
@@ -148,21 +148,24 @@ function guardedSignal(innerSignal, isInitialized) {
|
|
|
148
148
|
function createTenantModule(injector) {
|
|
149
149
|
const _current = (0, import_core.signal)(null);
|
|
150
150
|
let _initialized = false;
|
|
151
|
+
let _initPromise = null;
|
|
151
152
|
const module2 = {
|
|
152
|
-
init
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
get init() {
|
|
154
|
+
if (!_initPromise) {
|
|
155
|
+
_initPromise = (async () => {
|
|
156
|
+
try {
|
|
157
|
+
const tenantCode = injector.get(import_util.CookieService).get("__tenant");
|
|
158
|
+
if (tenantCode) {
|
|
159
|
+
const tenantData = await module2.loadTenantData(tenantCode);
|
|
160
|
+
_current.set(tenantData ?? null);
|
|
161
|
+
}
|
|
162
|
+
_initialized = true;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
console.error(err);
|
|
165
|
+
}
|
|
166
|
+
})();
|
|
165
167
|
}
|
|
168
|
+
return _initPromise;
|
|
166
169
|
},
|
|
167
170
|
current: guardedSignal(_current, () => _initialized),
|
|
168
171
|
async loadTenantData(code) {
|
|
@@ -190,18 +193,21 @@ function createTenantModule(injector) {
|
|
|
190
193
|
function createAuthModule(injector) {
|
|
191
194
|
const _user = (0, import_core.signal)(null);
|
|
192
195
|
let _initialized = false;
|
|
196
|
+
let _initPromise = null;
|
|
193
197
|
const module2 = {
|
|
194
|
-
init
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
get init() {
|
|
199
|
+
if (!_initPromise) {
|
|
200
|
+
_initPromise = (async () => {
|
|
201
|
+
try {
|
|
202
|
+
const userData = await module2.loadUserData();
|
|
203
|
+
_user.set(userData ?? null);
|
|
204
|
+
_initialized = true;
|
|
205
|
+
} catch (err) {
|
|
206
|
+
console.error(err);
|
|
207
|
+
}
|
|
208
|
+
})();
|
|
204
209
|
}
|
|
210
|
+
return _initPromise;
|
|
205
211
|
},
|
|
206
212
|
user: guardedSignal(_user, () => _initialized),
|
|
207
213
|
async loadUserData() {
|
|
@@ -235,69 +241,75 @@ function createIdentityModule(injector) {
|
|
|
235
241
|
const _orgsSignal = (0, import_core.signal)([]);
|
|
236
242
|
const _userOwnedOrgsSignal = (0, import_core.signal)([]);
|
|
237
243
|
let _initialized = false;
|
|
244
|
+
let _initPromise = null;
|
|
238
245
|
const module2 = {
|
|
239
246
|
orgs: guardedSignal(_orgsSignal, () => _initialized),
|
|
240
247
|
userOwnedOrgs: guardedSignal(_userOwnedOrgsSignal, () => _initialized),
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
248
|
+
get init() {
|
|
249
|
+
if (!_initPromise) {
|
|
250
|
+
_initPromise = (async () => {
|
|
251
|
+
try {
|
|
252
|
+
await geex.tenant.init;
|
|
253
|
+
await geex.auth.init;
|
|
254
|
+
await new Promise((resolve, reject) => {
|
|
255
|
+
const orgs$ = injector.get(import_apollo_angular.Apollo).watchQuery({ query: GQL_ORGS_CACHE }).valueChanges.pipe((0, import_rxjs.map)((res) => (0, import_util.deepCopy)(res.data.orgs.items)));
|
|
256
|
+
orgs$.subscribe({
|
|
257
|
+
next: (orgs) => {
|
|
258
|
+
(0, import_core.runInInjectionContext)(injector, () => {
|
|
259
|
+
_orgsSignal.set(orgs);
|
|
260
|
+
const userData = geex.auth.user();
|
|
261
|
+
let allOwned = [];
|
|
262
|
+
if (orgs?.length && userData) {
|
|
263
|
+
if (userData.id === "000000000000000000000001") {
|
|
264
|
+
allOwned = (0, import_util.deepCopy)(orgs);
|
|
265
|
+
} else {
|
|
266
|
+
const ownedCodes = userData.orgs.map((x) => x.code);
|
|
267
|
+
allOwned = orgs.filter((o) => ownedCodes.some((code) => o.code.startsWith(code)));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
_userOwnedOrgsSignal.set(allOwned);
|
|
271
|
+
resolve();
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
error: (err) => {
|
|
275
|
+
console.error(err);
|
|
276
|
+
reject(err);
|
|
263
277
|
}
|
|
264
|
-
_userOwnedOrgsSignal.set(allOwned);
|
|
265
|
-
resolve();
|
|
266
278
|
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
_initialized = true;
|
|
275
|
-
} catch (error) {
|
|
276
|
-
console.error(error);
|
|
279
|
+
});
|
|
280
|
+
_initialized = true;
|
|
281
|
+
} catch (error) {
|
|
282
|
+
console.error(error);
|
|
283
|
+
}
|
|
284
|
+
})();
|
|
277
285
|
}
|
|
286
|
+
return _initPromise;
|
|
278
287
|
}
|
|
279
288
|
};
|
|
280
289
|
return module2;
|
|
281
290
|
}
|
|
282
291
|
function createMessagingModule(injector) {
|
|
283
292
|
let _initialized = false;
|
|
293
|
+
let _initPromise = null;
|
|
284
294
|
const module2 = {
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
get init() {
|
|
296
|
+
if (!_initPromise) {
|
|
297
|
+
_initPromise = (async () => {
|
|
298
|
+
try {
|
|
299
|
+
await geex.auth.init;
|
|
300
|
+
if (injector.get(import_angular_oauth2_oidc.OAuthService).hasValidAccessToken()) {
|
|
301
|
+
const subClient = injector.get(import_apollo_angular.Apollo).use("subscription");
|
|
302
|
+
subClient.subscribe({ query: GQL_ON_PUBLIC_NOTIFY }).pipe((0, import_rxjs.map)((res) => res?.data?.onPublicNotify)).subscribe((notify) => {
|
|
303
|
+
module2.onPublicNotify(notify);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
_initialized = true;
|
|
307
|
+
} catch (err) {
|
|
308
|
+
console.error(err);
|
|
309
|
+
}
|
|
310
|
+
})();
|
|
300
311
|
}
|
|
312
|
+
return _initPromise;
|
|
301
313
|
},
|
|
302
314
|
onPublicNotify(notify) {
|
|
303
315
|
console.log("Public notify", notify);
|
|
@@ -308,18 +320,25 @@ function createMessagingModule(injector) {
|
|
|
308
320
|
function createSettingsModule(injector) {
|
|
309
321
|
const _settingsSignal = (0, import_core.signal)([]);
|
|
310
322
|
let _initialized = false;
|
|
323
|
+
let _initPromise = null;
|
|
311
324
|
const module2 = {
|
|
312
325
|
settings: guardedSignal(_settingsSignal, () => _initialized),
|
|
313
|
-
|
|
314
|
-
if (
|
|
315
|
-
|
|
326
|
+
get init() {
|
|
327
|
+
if (!_initPromise) {
|
|
328
|
+
_initPromise = (async () => {
|
|
329
|
+
try {
|
|
330
|
+
const res = await (0, import_rxjs.firstValueFrom)(
|
|
331
|
+
injector.get(import_apollo_angular.Apollo).query({ query: GQL_INIT_SETTINGS })
|
|
332
|
+
);
|
|
333
|
+
const settings = res.data.initSettings;
|
|
334
|
+
_settingsSignal.set(settings);
|
|
335
|
+
_initialized = true;
|
|
336
|
+
} catch (err) {
|
|
337
|
+
console.error(err);
|
|
338
|
+
}
|
|
339
|
+
})();
|
|
316
340
|
}
|
|
317
|
-
|
|
318
|
-
injector.get(import_apollo_angular.Apollo).query({ query: GQL_INIT_SETTINGS })
|
|
319
|
-
);
|
|
320
|
-
const settings = res.data.initSettings;
|
|
321
|
-
_settingsSignal.set(settings);
|
|
322
|
-
_initialized = true;
|
|
341
|
+
return _initPromise;
|
|
323
342
|
}
|
|
324
343
|
};
|
|
325
344
|
return module2;
|
|
@@ -331,16 +350,18 @@ function createUiModule(injector) {
|
|
|
331
350
|
(0, import_operators.switchMap)(async () => window.innerHeight / window.innerWidth >= 1.5)
|
|
332
351
|
));
|
|
333
352
|
let _initialized = false;
|
|
353
|
+
let _initPromise = null;
|
|
334
354
|
const module2 = {
|
|
335
355
|
fullScreen: guardedSignal(_fullScreenSignal, () => _initialized),
|
|
336
356
|
isMobile: guardedSignal(_isMobile, () => _initialized),
|
|
337
357
|
activeRoutedComponent: void 0,
|
|
338
|
-
|
|
339
|
-
if (
|
|
340
|
-
|
|
358
|
+
get init() {
|
|
359
|
+
if (!_initPromise) {
|
|
360
|
+
_initPromise = (async () => {
|
|
361
|
+
_initialized = true;
|
|
362
|
+
})();
|
|
341
363
|
}
|
|
342
|
-
|
|
343
|
-
return;
|
|
364
|
+
return _initPromise;
|
|
344
365
|
}
|
|
345
366
|
};
|
|
346
367
|
return module2;
|
|
@@ -350,24 +371,34 @@ function createUiModule(injector) {
|
|
|
350
371
|
var geex;
|
|
351
372
|
var Geex = new import_core2.InjectionToken("Geex");
|
|
352
373
|
function configGeex(injector, overrides = {}) {
|
|
353
|
-
const modules = {
|
|
354
|
-
...overrides
|
|
355
|
-
};
|
|
356
374
|
(0, import_core2.runInInjectionContext)(injector, () => {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
375
|
+
const modules = {
|
|
376
|
+
...overrides
|
|
377
|
+
};
|
|
378
|
+
let _initPromise = null;
|
|
379
|
+
if (!modules.init) {
|
|
380
|
+
Object.defineProperty(modules, "init", {
|
|
381
|
+
get() {
|
|
382
|
+
if (!_initPromise) {
|
|
383
|
+
_initPromise = (async () => {
|
|
384
|
+
const entries = Object.entries(modules).filter(([key]) => key !== "init");
|
|
385
|
+
return Object.fromEntries(await Promise.all(
|
|
386
|
+
entries.map(async ([key, mod]) => {
|
|
387
|
+
const maybeInit = mod.init;
|
|
388
|
+
try {
|
|
389
|
+
return [key, await maybeInit];
|
|
390
|
+
} catch (err) {
|
|
391
|
+
console.error(err);
|
|
392
|
+
return [key, null];
|
|
393
|
+
}
|
|
394
|
+
})
|
|
395
|
+
));
|
|
396
|
+
})();
|
|
367
397
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
398
|
+
return _initPromise;
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
371
402
|
modules.tenant ?? (modules.tenant = createTenantModule(injector));
|
|
372
403
|
modules.auth ?? (modules.auth = createAuthModule(injector));
|
|
373
404
|
modules.identity ?? (modules.identity = createIdentityModule(injector));
|
package/dist/index.mjs
CHANGED
|
@@ -102,21 +102,24 @@ function guardedSignal(innerSignal, isInitialized) {
|
|
|
102
102
|
function createTenantModule(injector) {
|
|
103
103
|
const _current = signal(null);
|
|
104
104
|
let _initialized = false;
|
|
105
|
+
let _initPromise = null;
|
|
105
106
|
const module = {
|
|
106
|
-
init
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
get init() {
|
|
108
|
+
if (!_initPromise) {
|
|
109
|
+
_initPromise = (async () => {
|
|
110
|
+
try {
|
|
111
|
+
const tenantCode = injector.get(CookieService).get("__tenant");
|
|
112
|
+
if (tenantCode) {
|
|
113
|
+
const tenantData = await module.loadTenantData(tenantCode);
|
|
114
|
+
_current.set(tenantData ?? null);
|
|
115
|
+
}
|
|
116
|
+
_initialized = true;
|
|
117
|
+
} catch (err) {
|
|
118
|
+
console.error(err);
|
|
119
|
+
}
|
|
120
|
+
})();
|
|
119
121
|
}
|
|
122
|
+
return _initPromise;
|
|
120
123
|
},
|
|
121
124
|
current: guardedSignal(_current, () => _initialized),
|
|
122
125
|
async loadTenantData(code) {
|
|
@@ -144,18 +147,21 @@ function createTenantModule(injector) {
|
|
|
144
147
|
function createAuthModule(injector) {
|
|
145
148
|
const _user = signal(null);
|
|
146
149
|
let _initialized = false;
|
|
150
|
+
let _initPromise = null;
|
|
147
151
|
const module = {
|
|
148
|
-
init
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
get init() {
|
|
153
|
+
if (!_initPromise) {
|
|
154
|
+
_initPromise = (async () => {
|
|
155
|
+
try {
|
|
156
|
+
const userData = await module.loadUserData();
|
|
157
|
+
_user.set(userData ?? null);
|
|
158
|
+
_initialized = true;
|
|
159
|
+
} catch (err) {
|
|
160
|
+
console.error(err);
|
|
161
|
+
}
|
|
162
|
+
})();
|
|
158
163
|
}
|
|
164
|
+
return _initPromise;
|
|
159
165
|
},
|
|
160
166
|
user: guardedSignal(_user, () => _initialized),
|
|
161
167
|
async loadUserData() {
|
|
@@ -189,69 +195,75 @@ function createIdentityModule(injector) {
|
|
|
189
195
|
const _orgsSignal = signal([]);
|
|
190
196
|
const _userOwnedOrgsSignal = signal([]);
|
|
191
197
|
let _initialized = false;
|
|
198
|
+
let _initPromise = null;
|
|
192
199
|
const module = {
|
|
193
200
|
orgs: guardedSignal(_orgsSignal, () => _initialized),
|
|
194
201
|
userOwnedOrgs: guardedSignal(_userOwnedOrgsSignal, () => _initialized),
|
|
195
|
-
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
202
|
+
get init() {
|
|
203
|
+
if (!_initPromise) {
|
|
204
|
+
_initPromise = (async () => {
|
|
205
|
+
try {
|
|
206
|
+
await geex.tenant.init;
|
|
207
|
+
await geex.auth.init;
|
|
208
|
+
await new Promise((resolve, reject) => {
|
|
209
|
+
const orgs$ = injector.get(Apollo).watchQuery({ query: GQL_ORGS_CACHE }).valueChanges.pipe(map((res) => deepCopy(res.data.orgs.items)));
|
|
210
|
+
orgs$.subscribe({
|
|
211
|
+
next: (orgs) => {
|
|
212
|
+
runInInjectionContext(injector, () => {
|
|
213
|
+
_orgsSignal.set(orgs);
|
|
214
|
+
const userData = geex.auth.user();
|
|
215
|
+
let allOwned = [];
|
|
216
|
+
if (orgs?.length && userData) {
|
|
217
|
+
if (userData.id === "000000000000000000000001") {
|
|
218
|
+
allOwned = deepCopy(orgs);
|
|
219
|
+
} else {
|
|
220
|
+
const ownedCodes = userData.orgs.map((x) => x.code);
|
|
221
|
+
allOwned = orgs.filter((o) => ownedCodes.some((code) => o.code.startsWith(code)));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
_userOwnedOrgsSignal.set(allOwned);
|
|
225
|
+
resolve();
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
error: (err) => {
|
|
229
|
+
console.error(err);
|
|
230
|
+
reject(err);
|
|
217
231
|
}
|
|
218
|
-
_userOwnedOrgsSignal.set(allOwned);
|
|
219
|
-
resolve();
|
|
220
232
|
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
_initialized = true;
|
|
229
|
-
} catch (error) {
|
|
230
|
-
console.error(error);
|
|
233
|
+
});
|
|
234
|
+
_initialized = true;
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.error(error);
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
231
239
|
}
|
|
240
|
+
return _initPromise;
|
|
232
241
|
}
|
|
233
242
|
};
|
|
234
243
|
return module;
|
|
235
244
|
}
|
|
236
245
|
function createMessagingModule(injector) {
|
|
237
246
|
let _initialized = false;
|
|
247
|
+
let _initPromise = null;
|
|
238
248
|
const module = {
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
get init() {
|
|
250
|
+
if (!_initPromise) {
|
|
251
|
+
_initPromise = (async () => {
|
|
252
|
+
try {
|
|
253
|
+
await geex.auth.init;
|
|
254
|
+
if (injector.get(OAuthService).hasValidAccessToken()) {
|
|
255
|
+
const subClient = injector.get(Apollo).use("subscription");
|
|
256
|
+
subClient.subscribe({ query: GQL_ON_PUBLIC_NOTIFY }).pipe(map((res) => res?.data?.onPublicNotify)).subscribe((notify) => {
|
|
257
|
+
module.onPublicNotify(notify);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
_initialized = true;
|
|
261
|
+
} catch (err) {
|
|
262
|
+
console.error(err);
|
|
263
|
+
}
|
|
264
|
+
})();
|
|
254
265
|
}
|
|
266
|
+
return _initPromise;
|
|
255
267
|
},
|
|
256
268
|
onPublicNotify(notify) {
|
|
257
269
|
console.log("Public notify", notify);
|
|
@@ -262,18 +274,25 @@ function createMessagingModule(injector) {
|
|
|
262
274
|
function createSettingsModule(injector) {
|
|
263
275
|
const _settingsSignal = signal([]);
|
|
264
276
|
let _initialized = false;
|
|
277
|
+
let _initPromise = null;
|
|
265
278
|
const module = {
|
|
266
279
|
settings: guardedSignal(_settingsSignal, () => _initialized),
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
|
|
280
|
+
get init() {
|
|
281
|
+
if (!_initPromise) {
|
|
282
|
+
_initPromise = (async () => {
|
|
283
|
+
try {
|
|
284
|
+
const res = await firstValueFrom(
|
|
285
|
+
injector.get(Apollo).query({ query: GQL_INIT_SETTINGS })
|
|
286
|
+
);
|
|
287
|
+
const settings = res.data.initSettings;
|
|
288
|
+
_settingsSignal.set(settings);
|
|
289
|
+
_initialized = true;
|
|
290
|
+
} catch (err) {
|
|
291
|
+
console.error(err);
|
|
292
|
+
}
|
|
293
|
+
})();
|
|
270
294
|
}
|
|
271
|
-
|
|
272
|
-
injector.get(Apollo).query({ query: GQL_INIT_SETTINGS })
|
|
273
|
-
);
|
|
274
|
-
const settings = res.data.initSettings;
|
|
275
|
-
_settingsSignal.set(settings);
|
|
276
|
-
_initialized = true;
|
|
295
|
+
return _initPromise;
|
|
277
296
|
}
|
|
278
297
|
};
|
|
279
298
|
return module;
|
|
@@ -285,16 +304,18 @@ function createUiModule(injector) {
|
|
|
285
304
|
switchMap(async () => window.innerHeight / window.innerWidth >= 1.5)
|
|
286
305
|
));
|
|
287
306
|
let _initialized = false;
|
|
307
|
+
let _initPromise = null;
|
|
288
308
|
const module = {
|
|
289
309
|
fullScreen: guardedSignal(_fullScreenSignal, () => _initialized),
|
|
290
310
|
isMobile: guardedSignal(_isMobile, () => _initialized),
|
|
291
311
|
activeRoutedComponent: void 0,
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
|
|
312
|
+
get init() {
|
|
313
|
+
if (!_initPromise) {
|
|
314
|
+
_initPromise = (async () => {
|
|
315
|
+
_initialized = true;
|
|
316
|
+
})();
|
|
295
317
|
}
|
|
296
|
-
|
|
297
|
-
return;
|
|
318
|
+
return _initPromise;
|
|
298
319
|
}
|
|
299
320
|
};
|
|
300
321
|
return module;
|
|
@@ -304,24 +325,34 @@ function createUiModule(injector) {
|
|
|
304
325
|
var geex;
|
|
305
326
|
var Geex = new InjectionToken("Geex");
|
|
306
327
|
function configGeex(injector, overrides = {}) {
|
|
307
|
-
const modules = {
|
|
308
|
-
...overrides
|
|
309
|
-
};
|
|
310
328
|
runInInjectionContext2(injector, () => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
329
|
+
const modules = {
|
|
330
|
+
...overrides
|
|
331
|
+
};
|
|
332
|
+
let _initPromise = null;
|
|
333
|
+
if (!modules.init) {
|
|
334
|
+
Object.defineProperty(modules, "init", {
|
|
335
|
+
get() {
|
|
336
|
+
if (!_initPromise) {
|
|
337
|
+
_initPromise = (async () => {
|
|
338
|
+
const entries = Object.entries(modules).filter(([key]) => key !== "init");
|
|
339
|
+
return Object.fromEntries(await Promise.all(
|
|
340
|
+
entries.map(async ([key, mod]) => {
|
|
341
|
+
const maybeInit = mod.init;
|
|
342
|
+
try {
|
|
343
|
+
return [key, await maybeInit];
|
|
344
|
+
} catch (err) {
|
|
345
|
+
console.error(err);
|
|
346
|
+
return [key, null];
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
));
|
|
350
|
+
})();
|
|
321
351
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
352
|
+
return _initPromise;
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
325
356
|
modules.tenant ?? (modules.tenant = createTenantModule(injector));
|
|
326
357
|
modules.auth ?? (modules.auth = createAuthModule(injector));
|
|
327
358
|
modules.identity ?? (modules.identity = createIdentityModule(injector));
|