@progressive-development/pd-spa-helper 0.1.91 → 0.1.92
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/src/PdSpaHelper.d.ts +2 -56
- package/dist/src/PdSpaHelper.js +5 -17
- package/dist/src/PdSpaHelper.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/service-call-controller2.d.ts +1 -1
- package/dist/src/service-call-controller2.js +1 -1
- package/dist/src/service-call-controller2.js.map +1 -1
- package/dist/src/service-provider/firebase/functions-client.d.ts +1 -26
- package/dist/src/service-provider/firebase/functions-client.js +1 -11
- package/dist/src/service-provider/firebase/functions-client.js.map +1 -1
- package/dist/src/service-provider/mock/auth.d.ts +1 -1
- package/dist/src/service-provider/mock/auth.js +1 -1
- package/dist/src/service-provider/mock/auth.js.map +1 -1
- package/dist/src/service-provider/mock/function-client.d.ts +2 -0
- package/dist/src/service-provider/mock/function-client.js +8 -0
- package/dist/src/service-provider/mock/function-client.js.map +1 -0
- package/dist/src/service-provider/service-provider-impl.d.ts +5 -1
- package/dist/src/service-provider/service-provider-impl.js +56 -1
- package/dist/src/service-provider/service-provider-impl.js.map +1 -1
- package/dist/src/service-provider/service-provider-model.d.ts +85 -0
- package/dist/src/service-provider/service-provider-model.js +2 -0
- package/dist/src/service-provider/service-provider-model.js.map +1 -0
- package/dist/src/store/mini-rx.store.d.ts +1 -1
- package/dist/src/store/mini-rx.store.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/PdSpaHelper.ts +7 -84
- package/src/index.ts +6 -18
- package/src/service-call-controller2.ts +2 -1
- package/src/service-provider/firebase/functions-client.ts +4 -42
- package/src/service-provider/mock/auth.ts +1 -1
- package/src/service-provider/mock/function-client.ts +11 -0
- package/src/service-provider/service-provider-impl.ts +69 -4
- package/src/service-provider/service-provider-model.ts +106 -0
- package/src/store/mini-rx.store.ts +1 -1
- package/src/InitApplicationData.ts +0 -9
package/src/PdSpaHelper.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { FirebaseApp, FirebaseOptions, initializeApp } from 'firebase/app';
|
|
2
|
-
// TODO: Add SDKs for Firebase products that you want to use
|
|
3
|
-
// https://firebase.google.com/docs/web/setup#available-libraries
|
|
4
|
-
|
|
5
|
-
|
|
6
1
|
import { html, LitElement, css, CSSResultGroup, TemplateResult } from 'lit';
|
|
7
2
|
import { router, navigator } from 'lit-element-router';
|
|
8
3
|
import { property } from 'lit/decorators.js';
|
|
@@ -10,25 +5,22 @@ import { property } from 'lit/decorators.js';
|
|
|
10
5
|
import '@progressive-development/pd-page/pd-menu.js';
|
|
11
6
|
import '@progressive-development/pd-page/pd-footer.js';
|
|
12
7
|
|
|
13
|
-
import { initApplicationServices } from './InitApplicationData.js';
|
|
14
|
-
|
|
15
|
-
// Refactor: move function definitions to general place (no firebase specific imports here)
|
|
16
|
-
import { FunctionDefinition, FunctionResult, FunctionsConfig } from './service-provider/firebase/functions-client.js';
|
|
17
|
-
|
|
18
8
|
import { ServiceCallController } from './service-call-controller2.js';
|
|
19
9
|
import { initializeStore } from './store/mini-rx.store.js';
|
|
20
10
|
|
|
11
|
+
import { authStateChangedImpl, initAppImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';
|
|
12
|
+
import { AppConfiguration, Footer, FunctionResult, MenuElement, NavigationConfig, NavigationPage } from './service-provider/service-provider-model.js';
|
|
13
|
+
|
|
21
14
|
import './router/AppMain.js';
|
|
22
15
|
import './defaultpage/default-login.js';
|
|
23
16
|
import './tmpown/pd-panel-viewer.js';
|
|
24
17
|
import './tmpown/pd-panel.js';
|
|
18
|
+
// eslint-disable-next-line import/no-duplicates
|
|
19
|
+
import './tmpown/pd-toast.js';
|
|
25
20
|
|
|
26
21
|
// TODO: How to solve this import problem?
|
|
27
22
|
// eslint-disable-next-line import/no-duplicates
|
|
28
23
|
import { PdToast } from './tmpown/pd-toast.js';
|
|
29
|
-
// eslint-disable-next-line import/no-duplicates
|
|
30
|
-
import './tmpown/pd-toast.js';
|
|
31
|
-
import { authStateChangedImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';
|
|
32
24
|
|
|
33
25
|
|
|
34
26
|
// Footer Text
|
|
@@ -39,74 +31,12 @@ const MADE_BY = {
|
|
|
39
31
|
// Visible time for time-limited toast
|
|
40
32
|
const TOAST_DURATION = 6000;
|
|
41
33
|
|
|
42
|
-
/**
|
|
43
|
-
* Data models.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
export interface MenuElement {
|
|
47
|
-
key: string,
|
|
48
|
-
name: string,
|
|
49
|
-
sec?: string,
|
|
50
|
-
route?: string,
|
|
51
|
-
action?: Function,
|
|
52
|
-
topItem?: boolean,
|
|
53
|
-
ref?: any,
|
|
54
|
-
icon?: string,
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface NavigationPage {
|
|
58
|
-
name: string,
|
|
59
|
-
mainClass?: string,
|
|
60
|
-
pattern: Array<string>,
|
|
61
|
-
auth: boolean,
|
|
62
|
-
menu?: Array<MenuElement>,
|
|
63
|
-
topMenu?: Array<MenuElement>,
|
|
64
|
-
withTeaser?: boolean,
|
|
65
|
-
withFooter?: boolean
|
|
66
|
-
hideMenu?: boolean
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export type ServiceProviderFirebase = "firebase";
|
|
70
|
-
export type ServiceProviderMock = "mock";
|
|
71
|
-
export type ServiceProviderConfiguration = ServiceProviderFirebase | ServiceProviderMock;
|
|
72
|
-
|
|
73
|
-
export interface NavigationConfig {
|
|
74
|
-
pages: Array<NavigationPage>,
|
|
75
|
-
includeLogin: boolean
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface LinkObj {
|
|
79
|
-
name: string,
|
|
80
|
-
key: string,
|
|
81
|
-
link?: string,
|
|
82
|
-
action?: Function
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface Footer {
|
|
86
|
-
version: string,
|
|
87
|
-
links: Array<LinkObj>
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface StoreConfig {
|
|
91
|
-
appName: string,
|
|
92
|
-
reducer: any,
|
|
93
|
-
effects: Array<any>
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface AppConfiguration {
|
|
97
|
-
serviceProvider?: ServiceProviderConfiguration,
|
|
98
|
-
navigationConfigParam: NavigationConfig;
|
|
99
|
-
storeConfigParam?: StoreConfig;
|
|
100
|
-
firebaseConfig?: FirebaseOptions;
|
|
101
|
-
functionsConfig?: FunctionsConfig;
|
|
102
|
-
}
|
|
103
34
|
|
|
104
35
|
/**
|
|
105
36
|
* Transformed routes, generated during startInit.
|
|
106
37
|
*/
|
|
107
38
|
let transformedRoutes:Array<any>;
|
|
108
39
|
let navigationConfig:NavigationConfig;
|
|
109
|
-
let postLoginFunc:FunctionDefinition | undefined;
|
|
110
40
|
|
|
111
41
|
/**
|
|
112
42
|
* Internal helper functions to generate route elemets for lit-router.
|
|
@@ -162,15 +92,8 @@ export const startInit = (config: AppConfiguration) => {
|
|
|
162
92
|
initializeStore(config.storeConfigParam);
|
|
163
93
|
}
|
|
164
94
|
|
|
165
|
-
// init
|
|
166
|
-
|
|
167
|
-
const app:FirebaseApp = initializeApp(config.firebaseConfig);
|
|
168
|
-
if (config.functionsConfig) {
|
|
169
|
-
// init application services (functions, store)
|
|
170
|
-
initApplicationServices(app, config.functionsConfig);
|
|
171
|
-
postLoginFunc = config.functionsConfig.postLoginFunc;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
95
|
+
// init app
|
|
96
|
+
initAppImpl(config);
|
|
174
97
|
|
|
175
98
|
if (config.navigationConfigParam.includeLogin) {
|
|
176
99
|
config.navigationConfigParam.pages.push({
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
export {
|
|
2
|
-
PdSpaHelper,
|
|
3
|
-
|
|
4
|
-
startInit,
|
|
5
|
-
NavigationConfig,
|
|
6
|
-
StoreConfig,
|
|
7
|
-
NavigationPage,
|
|
8
|
-
MenuElement,
|
|
9
|
-
LinkObj,
|
|
10
|
-
Footer
|
|
2
|
+
PdSpaHelper,
|
|
3
|
+
startInit,
|
|
11
4
|
} from './PdSpaHelper.js';
|
|
12
5
|
|
|
6
|
+
export * as pdSpaModel from './service-provider/service-provider-model.js'
|
|
7
|
+
|
|
13
8
|
export {isBlank, isEmpty} from './helper/helper-utils.js';
|
|
14
9
|
|
|
15
10
|
export {DefaultViewPage} from './defaultpage/default-view-page.js';
|
|
@@ -28,14 +23,6 @@ export {DefaultStepAddress} from './defaultpage/default-step-address.js';
|
|
|
28
23
|
|
|
29
24
|
export {DefaultStepSummary, OrderStep} from './defaultpage/default-step-summary.js';
|
|
30
25
|
|
|
31
|
-
export {
|
|
32
|
-
FunctionDefinition,
|
|
33
|
-
FunctionResult,
|
|
34
|
-
FunctionParam,
|
|
35
|
-
FunctionsConfig,
|
|
36
|
-
callFunction
|
|
37
|
-
} from './service-provider/firebase/functions-client.js'
|
|
38
|
-
|
|
39
26
|
export {
|
|
40
27
|
getDB,
|
|
41
28
|
} from './service-provider/firebase/firestore-client.js'
|
|
@@ -43,7 +30,8 @@ export {
|
|
|
43
30
|
export {
|
|
44
31
|
loginImpl,
|
|
45
32
|
logoutImpl,
|
|
46
|
-
isAuthenticatedImpl
|
|
33
|
+
isAuthenticatedImpl,
|
|
34
|
+
callFunctionImpl
|
|
47
35
|
} from './service-provider/service-provider-impl.js'
|
|
48
36
|
|
|
49
37
|
export { pdStore } from './store/mini-rx.store.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ReactiveControllerHost} from 'lit';
|
|
2
2
|
import {initialState, Task} from '@lit-labs/task';
|
|
3
3
|
|
|
4
|
-
import { FunctionDefinition, FunctionResult
|
|
4
|
+
import { FunctionDefinition, FunctionResult } from './service-provider/service-provider-model.js';
|
|
5
|
+
import { initController } from './service-provider/service-provider-impl.js';
|
|
5
6
|
|
|
6
7
|
export interface ServiceControllerInput {
|
|
7
8
|
promise: Promise<FunctionResult>,
|
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
import { FirebaseApp } from "firebase/app";
|
|
2
2
|
import { getFunctions, HttpsCallable, httpsCallable } from "firebase/functions";
|
|
3
|
-
import {
|
|
4
|
-
import { ServiceCallController } from "../../service-call-controller2.js";
|
|
5
|
-
|
|
6
|
-
export interface FunctionDefinition {
|
|
7
|
-
name: string,
|
|
8
|
-
successCodes: Array<Number>,
|
|
9
|
-
// Fade window during function call (true) or show only background infos (false).
|
|
10
|
-
fadeWindow: boolean,
|
|
11
|
-
successTxt: TemplateResult,
|
|
12
|
-
pendingTxt: TemplateResult,
|
|
13
|
-
param?: any,
|
|
14
|
-
redirect?: string,
|
|
15
|
-
logoutOnFail?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface FunctionParam {
|
|
19
|
-
func: FunctionDefinition,
|
|
20
|
-
inputData: any,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface FunctionResult {
|
|
24
|
-
resultData: unknown,
|
|
25
|
-
statusCode: number,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface FunctionsConfig {
|
|
29
|
-
region: string, // 'europe-west3'
|
|
30
|
-
functions: Array<FunctionDefinition>,
|
|
31
|
-
postLoginFunc?: FunctionDefinition,
|
|
32
|
-
}
|
|
3
|
+
import { FunctionDefinition, FunctionResult, FunctionsConfig } from "../service-provider-model.js";
|
|
33
4
|
|
|
34
5
|
const functionMap = new Map<FunctionDefinition, HttpsCallable>;
|
|
35
|
-
let controller: ServiceCallController;
|
|
36
6
|
|
|
37
7
|
/**
|
|
38
8
|
* During start/load application, initialize functions.
|
|
@@ -54,10 +24,6 @@ export const initFunctions = (app: FirebaseApp, functionsConfig: FunctionsConfig
|
|
|
54
24
|
}
|
|
55
25
|
}
|
|
56
26
|
|
|
57
|
-
export const initController = (controllerParam: ServiceCallController) => {
|
|
58
|
-
controller = controllerParam
|
|
59
|
-
}
|
|
60
|
-
|
|
61
27
|
const internalCallFunction = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {
|
|
62
28
|
const funcRef = functionMap.get(def);
|
|
63
29
|
if (funcRef) {
|
|
@@ -97,10 +63,6 @@ const internalCallFunction = async (def: FunctionDefinition, functionInput: any)
|
|
|
97
63
|
throw new Error("Illegal state, no data with right state available");
|
|
98
64
|
}
|
|
99
65
|
|
|
100
|
-
export const callFunction = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
controller.callDataPromise = {func: def, promise};
|
|
104
|
-
}
|
|
105
|
-
return promise;
|
|
106
|
-
}
|
|
66
|
+
export const callFunction = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> =>
|
|
67
|
+
internalCallFunction(def, functionInput);
|
|
68
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionDefinition, FunctionResult } from "../service-provider-model.js";
|
|
2
|
+
|
|
3
|
+
export const callFunctionMock = (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {
|
|
4
|
+
console.log("Mock function call", def, functionInput);
|
|
5
|
+
return Promise.resolve(
|
|
6
|
+
def.mockResult || {
|
|
7
|
+
statusCode: 404,
|
|
8
|
+
resultData: undefined
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -1,27 +1,92 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FirebaseApp, initializeApp } from "firebase/app";
|
|
2
2
|
|
|
3
3
|
import { authStateChanged, isAuthenticated, login, logout } from "./firebase/auth.js";
|
|
4
4
|
import { authStateChangedMock, isAuthenticatedMock, loginMock, logoutMock } from "./mock/auth.js";
|
|
5
|
-
|
|
5
|
+
import { AppConfiguration, FunctionDefinition, FunctionResult, FunctionsConfig, ServiceProviderConfiguration } from "./service-provider-model.js";
|
|
6
|
+
import { callFunction, initFunctions } from "./firebase/functions-client.js";
|
|
7
|
+
import { initFirestore } from "./firebase/firestore-client.js";
|
|
8
|
+
import { callFunctionMock } from "./mock/function-client.js";
|
|
9
|
+
import { ServiceCallController } from "../service-call-controller2.js";
|
|
6
10
|
|
|
7
11
|
let provider: ServiceProviderConfiguration | undefined;
|
|
8
|
-
|
|
12
|
+
let controller: ServiceCallController;
|
|
9
13
|
|
|
10
14
|
const throwUndefinedProviderError = () => {
|
|
11
15
|
throw new Error("Undefined service provider, please check configuration. 'firebase' or 'mock' allowed here.");
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
/* #####################
|
|
19
|
+
* Init Implementation
|
|
20
|
+
* ##################### */
|
|
21
|
+
|
|
14
22
|
export const setServiceProvider = (providerParam?: ServiceProviderConfiguration) => {
|
|
15
23
|
provider = providerParam;
|
|
16
24
|
}
|
|
17
25
|
|
|
26
|
+
export const initController = (controllerParam: ServiceCallController) => {
|
|
27
|
+
controller = controllerParam
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const initFirebaseApplicationServices = (firebaseApp: FirebaseApp, functionsConfig: FunctionsConfig) => {
|
|
31
|
+
// do something with the app, init db, firestore and functions
|
|
32
|
+
initFunctions(firebaseApp, functionsConfig);
|
|
33
|
+
initFirestore(firebaseApp);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const initAppImpl = (config: AppConfiguration) => {
|
|
37
|
+
|
|
38
|
+
if (provider === "firebase" && config.firebaseConfig) {
|
|
39
|
+
const app:FirebaseApp = initializeApp(config.firebaseConfig);
|
|
40
|
+
if (config.functionsConfig) {
|
|
41
|
+
// init application services (functions, store)
|
|
42
|
+
initFirebaseApplicationServices(app, config.functionsConfig);
|
|
43
|
+
}
|
|
44
|
+
} else if (provider === "mock") {
|
|
45
|
+
// no init needed
|
|
46
|
+
} else {
|
|
47
|
+
throwUndefinedProviderError();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* #####################
|
|
52
|
+
* Functions Implementation
|
|
53
|
+
* ##################### */
|
|
54
|
+
export const callFunctionImpl = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {
|
|
55
|
+
|
|
56
|
+
const callController = (promise: Promise<any>) => {
|
|
57
|
+
if (controller) {
|
|
58
|
+
controller.callDataPromise = {func: def, promise};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (provider === "firebase") {
|
|
63
|
+
const promise = callFunction(def, functionInput)
|
|
64
|
+
callController(promise);
|
|
65
|
+
return promise;
|
|
66
|
+
}
|
|
67
|
+
if (provider === "mock") {
|
|
68
|
+
const promise = callFunctionMock(def, functionInput)
|
|
69
|
+
callController(promise);
|
|
70
|
+
return promise;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return throwUndefinedProviderError();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/* #####################
|
|
79
|
+
* Auth Implementation
|
|
80
|
+
* ##################### */
|
|
81
|
+
|
|
82
|
+
|
|
18
83
|
export const authStateChangedImpl = (
|
|
19
84
|
callback: Function
|
|
20
85
|
) => {
|
|
21
86
|
if (provider === "firebase") {
|
|
22
87
|
authStateChanged(callback);
|
|
23
88
|
} else if (provider === "mock") {
|
|
24
|
-
authStateChangedMock(
|
|
89
|
+
authStateChangedMock();
|
|
25
90
|
} else {
|
|
26
91
|
throwUndefinedProviderError();
|
|
27
92
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { FirebaseOptions } from "firebase/app";
|
|
2
|
+
import { TemplateResult } from "lit";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Implemeted service provider
|
|
7
|
+
*/
|
|
8
|
+
export type ServiceProviderFirebase = "firebase";
|
|
9
|
+
export type ServiceProviderMock = "mock";
|
|
10
|
+
export type ServiceProviderConfiguration = ServiceProviderFirebase | ServiceProviderMock;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface FunctionResult {
|
|
14
|
+
resultData: unknown,
|
|
15
|
+
statusCode: number,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Function model.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export interface FunctionDefinition {
|
|
23
|
+
name: string,
|
|
24
|
+
successCodes: Array<Number>,
|
|
25
|
+
// Fade window during function call (true) or show only background infos (false).
|
|
26
|
+
fadeWindow: boolean,
|
|
27
|
+
successTxt: string | TemplateResult,
|
|
28
|
+
pendingTxt: string | TemplateResult,
|
|
29
|
+
param?: any,
|
|
30
|
+
redirect?: string,
|
|
31
|
+
logoutOnFail?: boolean,
|
|
32
|
+
mockResult?: FunctionResult
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface FunctionParam {
|
|
36
|
+
func: FunctionDefinition,
|
|
37
|
+
inputData: any,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface FunctionsConfig {
|
|
41
|
+
region: string, // 'europe-west3'
|
|
42
|
+
functions: Array<FunctionDefinition>,
|
|
43
|
+
postLoginFunc?: FunctionDefinition,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* App data models.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export interface MenuElement {
|
|
52
|
+
key: string,
|
|
53
|
+
name: string,
|
|
54
|
+
sec?: string,
|
|
55
|
+
route?: string,
|
|
56
|
+
action?: Function,
|
|
57
|
+
topItem?: boolean,
|
|
58
|
+
ref?: any,
|
|
59
|
+
icon?: string,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface NavigationPage {
|
|
63
|
+
name: string,
|
|
64
|
+
mainClass?: string,
|
|
65
|
+
pattern: Array<string>,
|
|
66
|
+
auth: boolean,
|
|
67
|
+
menu?: Array<MenuElement>,
|
|
68
|
+
topMenu?: Array<MenuElement>,
|
|
69
|
+
withTeaser?: boolean,
|
|
70
|
+
withFooter?: boolean
|
|
71
|
+
hideMenu?: boolean
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface NavigationConfig {
|
|
75
|
+
pages: Array<NavigationPage>,
|
|
76
|
+
includeLogin: boolean
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface LinkObj {
|
|
80
|
+
name: string,
|
|
81
|
+
key: string,
|
|
82
|
+
link?: string,
|
|
83
|
+
action?: Function
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface Footer {
|
|
87
|
+
version: string,
|
|
88
|
+
links: Array<LinkObj>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export interface StoreConfig {
|
|
93
|
+
appName: string,
|
|
94
|
+
reducer: any,
|
|
95
|
+
effects: Array<any>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface AppConfiguration {
|
|
99
|
+
serviceProvider?: ServiceProviderConfiguration,
|
|
100
|
+
navigationConfigParam: NavigationConfig;
|
|
101
|
+
storeConfigParam?: StoreConfig;
|
|
102
|
+
firebaseConfig?: FirebaseOptions;
|
|
103
|
+
functionsConfig?: FunctionsConfig;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FirebaseApp } from "firebase/app";
|
|
2
|
-
import { initFirestore } from "./service-provider/firebase/firestore-client.js";
|
|
3
|
-
import { FunctionsConfig, initFunctions } from "./service-provider/firebase/functions-client.js";
|
|
4
|
-
|
|
5
|
-
export const initApplicationServices = (firebaseApp: FirebaseApp, functionsConfig: FunctionsConfig) => {
|
|
6
|
-
// do something with the app, init db, firestore and functions
|
|
7
|
-
initFunctions(firebaseApp, functionsConfig);
|
|
8
|
-
initFirestore(firebaseApp);
|
|
9
|
-
}
|