@progressive-development/pd-spa-helper 0.1.171 → 0.1.173

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.
Files changed (54) hide show
  1. package/dist/src/PdSpaHelper.d.ts +8 -6
  2. package/dist/src/PdSpaHelper.js +30 -1
  3. package/dist/src/PdSpaHelper.js.map +1 -1
  4. package/dist/src/model/spa-model.d.ts +7 -0
  5. package/dist/src/model/spa-model.js +2 -0
  6. package/dist/src/model/spa-model.js.map +1 -0
  7. package/dist/src/service-provider/firebase/auth.d.ts +1 -0
  8. package/dist/src/service-provider/firebase/auth.js +6 -0
  9. package/dist/src/service-provider/firebase/auth.js.map +1 -1
  10. package/dist/src/service-provider/firebase/firestorage-client.js +19 -9
  11. package/dist/src/service-provider/firebase/firestorage-client.js.map +1 -1
  12. package/dist/src/service-provider/mock/auth.d.ts +1 -0
  13. package/dist/src/service-provider/mock/auth.js +4 -0
  14. package/dist/src/service-provider/mock/auth.js.map +1 -1
  15. package/dist/src/service-provider/service-provider-impl.d.ts +1 -0
  16. package/dist/src/service-provider/service-provider-impl.js +12 -2
  17. package/dist/src/service-provider/service-provider-impl.js.map +1 -1
  18. package/dist/src/service-provider/service-provider-model.d.ts +3 -1
  19. package/dist/src/service-provider/service-provider-model.js.map +1 -1
  20. package/dist/src/store/indexDB.d.ts +1 -1
  21. package/dist/src/store/indexDB.js +4 -2
  22. package/dist/src/store/indexDB.js.map +1 -1
  23. package/dist/src/store/mini-rx.store.js +11 -2
  24. package/dist/src/store/mini-rx.store.js.map +1 -1
  25. package/dist/src/store/spa-app-actions.d.ts +32 -0
  26. package/dist/src/store/spa-app-actions.js +7 -0
  27. package/dist/src/store/spa-app-actions.js.map +1 -0
  28. package/dist/src/store/spa-app-effects.d.ts +6 -0
  29. package/dist/src/store/spa-app-effects.js +23 -0
  30. package/dist/src/store/spa-app-effects.js.map +1 -0
  31. package/dist/src/store/spa-app-reducer.d.ts +9 -0
  32. package/dist/src/store/spa-app-reducer.js +28 -0
  33. package/dist/src/store/spa-app-reducer.js.map +1 -0
  34. package/dist/src/store/spa-app-selector.d.ts +6 -0
  35. package/dist/src/store/spa-app-selector.js +9 -0
  36. package/dist/src/store/spa-app-selector.js.map +1 -0
  37. package/dist/src/tmpown/pd-loading-state.d.ts +2 -6
  38. package/dist/src/tmpown/pd-loading-state.js.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +1 -1
  41. package/src/PdSpaHelper.ts +43 -9
  42. package/src/model/spa-model.ts +8 -0
  43. package/src/service-provider/firebase/auth.ts +6 -0
  44. package/src/service-provider/firebase/firestorage-client.ts +13 -6
  45. package/src/service-provider/mock/auth.ts +6 -0
  46. package/src/service-provider/service-provider-impl.ts +13 -2
  47. package/src/service-provider/service-provider-model.ts +4 -2
  48. package/src/store/indexDB.ts +5 -4
  49. package/src/store/mini-rx.store.ts +13 -2
  50. package/src/store/spa-app-actions.ts +11 -0
  51. package/src/store/spa-app-effects.ts +33 -0
  52. package/src/store/spa-app-reducer.ts +64 -0
  53. package/src/store/spa-app-selector.ts +23 -0
  54. package/src/tmpown/pd-loading-state.ts +3 -6
@@ -1,8 +1,10 @@
1
1
  import { LitElement, CSSResultGroup, TemplateResult } from 'lit';
2
+ import { Subscription } from 'rxjs';
2
3
  import '@progressive-development/pd-page/pd-menu.js';
3
4
  import '@progressive-development/pd-page/pd-footer.js';
4
5
  import { ServiceCallController } from './service-call-controller2.js';
5
6
  import { AppConfiguration, Footer, FunctionResult, NavigationPage } from './service-provider/service-provider-model.js';
7
+ import { LoadingState } from './model/spa-model.js';
6
8
  import './router/AppMain.js';
7
9
  import './defaultpage/default-login.js';
8
10
  import './tmpown/pd-panel-viewer.js';
@@ -24,18 +26,14 @@ declare const PdSpaHelper_base: import("lit-element-router").Constructor<import(
24
26
  */
25
27
  export declare abstract class PdSpaHelper extends PdSpaHelper_base {
26
28
  protected functionsController: ServiceCallController;
29
+ protected abstract _appConfiguration: any;
27
30
  title: string;
28
31
  /**
29
32
  * Properties needed for login/profile data.
30
33
  */
31
34
  _user: unknown | undefined;
32
35
  _profile: any | undefined;
33
- _loadingState?: {
34
- isLoading: boolean;
35
- smallBackground?: boolean;
36
- modal?: boolean;
37
- loadingTxt?: string;
38
- };
36
+ _loadingState?: LoadingState;
39
37
  /**
40
38
  * Properties needed for the router.
41
39
  */
@@ -49,8 +47,12 @@ export declare abstract class PdSpaHelper extends PdSpaHelper_base {
49
47
  abstract _selectedLocale: string;
50
48
  abstract _availableLocales: string[];
51
49
  protected _singleLocaleMenu: boolean;
50
+ _subscription?: Subscription;
52
51
  static styles: CSSResultGroup;
53
52
  constructor();
53
+ connectedCallback(): void;
54
+ disconnectedCallback(): void;
55
+ _setConfInDetail(event: Event): void;
54
56
  /**
55
57
  * Non reactive private property for the index db class.
56
58
  */
@@ -5,8 +5,12 @@ import { property } from 'lit/decorators.js';
5
5
  import '@progressive-development/pd-page/pd-menu.js';
6
6
  import '@progressive-development/pd-page/pd-footer.js';
7
7
  import { ServiceCallController } from './service-call-controller2.js';
8
- import { initializeStore } from './store/mini-rx.store.js';
8
+ import { initializeStore, pdStore } from './store/mini-rx.store.js';
9
9
  import { authStateChangedImpl, initAppImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';
10
+ import { getLoadingSelector } from './store/spa-app-selector.js';
11
+ import { setRouteElement } from './store/spa-app-effects.js';
12
+ import { APP_CONF_EVENT } from './model/spa-model.js';
13
+ import { loginSucess } from './store/spa-app-actions.js';
10
14
  import './router/AppMain.js';
11
15
  import './defaultpage/default-login.js';
12
16
  import './tmpown/pd-panel-viewer.js';
@@ -116,6 +120,7 @@ export class PdSpaHelper extends router(navigator(LitElement)) {
116
120
  */
117
121
  this._teaserClosed = false;
118
122
  this._singleLocaleMenu = false;
123
+ setRouteElement(this);
119
124
  const doSomething = (scrollPos) => {
120
125
  if (scrollPos <= 50) {
121
126
  this._teaserClosed = false;
@@ -147,6 +152,29 @@ export class PdSpaHelper extends router(navigator(LitElement)) {
147
152
  this.addEventListener("toast-event", this._createTemporaryToast);
148
153
  this.addEventListener("route-event", this._handleMenuRouteEvent);
149
154
  }
155
+ connectedCallback() {
156
+ super.connectedCallback();
157
+ this.addEventListener(APP_CONF_EVENT, this._setConfInDetail);
158
+ this._subscription = pdStore().select(getLoadingSelector)
159
+ .subscribe((loadingState) => {
160
+ console.log("Loading State: ", loadingState);
161
+ this._loadingState = loadingState;
162
+ });
163
+ }
164
+ disconnectedCallback() {
165
+ var _a;
166
+ this.removeEventListener(APP_CONF_EVENT, this._setConfInDetail);
167
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
168
+ super.disconnectedCallback();
169
+ }
170
+ _setConfInDetail(event) {
171
+ const { detail } = event;
172
+ if (detail) {
173
+ detail.appConf = {
174
+ ...this._appConfiguration
175
+ };
176
+ }
177
+ }
150
178
  /**
151
179
  * Non reactive private property for the index db class.
152
180
  */
@@ -177,6 +205,7 @@ export class PdSpaHelper extends router(navigator(LitElement)) {
177
205
  console.log("My callback user:", user);
178
206
  this._user = user;
179
207
  if (this._user) {
208
+ pdStore().dispatch(loginSucess());
180
209
  this._loginSuccess(new CustomEvent("login-success"));
181
210
  }
182
211
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PdSpaHelper.js","sourceRoot":"","sources":["../../src/PdSpaHelper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAkC,SAAS,EAAE,MAAM,KAAK,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,6CAA6C,CAAC;AACrD,OAAO,+CAA+C,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,O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E,MAAM,EAAE,CAAC;0CAChB;AAMX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDACN;AAItB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;oDACP","sourcesContent":["import { html, LitElement, css, CSSResultGroup, TemplateResult, unsafeCSS } from 'lit';\nimport { router, navigator } from 'lit-element-router';\nimport { property } from 'lit/decorators.js';\n\nimport { FirebaseApp } from 'firebase/app';\n\nimport '@progressive-development/pd-page/pd-menu.js';\nimport '@progressive-development/pd-page/pd-footer.js';\n\nimport { ServiceCallController } from './service-call-controller2.js';\nimport { initializeStore } from './store/mini-rx.store.js';\n\nimport { authStateChangedImpl, initAppImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';\nimport { AppConfiguration, Footer, FunctionResult, MenuElement, NavigationConfig, NavigationPage } from './service-provider/service-provider-model.js';\n\nimport './router/AppMain.js';\nimport './defaultpage/default-login.js';\nimport './tmpown/pd-panel-viewer.js';\nimport './tmpown/pd-panel.js';\n// eslint-disable-next-line import/no-duplicates\nimport './tmpown/pd-toast.js';\nimport './tmpown/pd-loading-state.js';\n\n// TODO: How to solve this import problem?\n// eslint-disable-next-line import/no-duplicates\nimport { PdToast } from './tmpown/pd-toast.js';\n\n\n// Footer Text\nconst MADE_BY = {\n txt: \"made by PD Progressive Development\",\n email: \"info@progressive-development.com\"};\n\n// Visible time for time-limited toast\nconst TOAST_DURATION = 6000;\n\n\n/**\n * Transformed routes, generated during startInit.\n */\nlet app:FirebaseApp | undefined;\nlet transformedRoutes:Array<any>;\nlet navigationConfig:NavigationConfig;\n\n/**\n * Internal helper functions to generate route elemets for lit-router. \n */\nconst transformRoutes = () => {\n\n const transformAuthConfig = (withAuth:boolean) => \n withAuth ? \n {\n unauthenticated: {\n name: 'login',\n },\n authenticate: () => new Promise((resolve, reject) => {\n resolve(isAuthenticatedImpl());\n }),\n } : undefined;\n\n let generatedRoutes:Array<any> = [];\n navigationConfig.pages.forEach(cfEntry => {\n const addAraay = cfEntry.pattern.map(routeMapPattern => (\n {\n name: cfEntry.name,\n pattern: routeMapPattern,\n authentication: transformAuthConfig(cfEntry.auth),\n }\n )); \n generatedRoutes = generatedRoutes.concat(addAraay);\n });\n \n // add not-found route\n generatedRoutes.push({\n name: 'not-found',\n pattern: '*',\n });\n\n return generatedRoutes;\n}\n\n\n/**\n * Init the firebase app and application services like\n * functions and firestore. Generate routes from navigationConfig.\n * \n * @param navigationConfig\n * @param firebaseConfig\n * @param functionsConfig\n */\nexport const startInit = (config: AppConfiguration) => {\n\n console.log(\"Start init for config: \", config);\n\n // set service provider\n setServiceProvider(config.serviceProvider);\n \n // init mini-rx store\n if (config.storeConfigParam) {\n initializeStore(config.storeConfigParam);\n }\n\n // init app\n initAppImpl(config);\n\n // add login route if set in config\n if (config.navigationConfigParam.includeLogin) {\n config.navigationConfigParam.pages.push({\n name: \"login\",\n menu: [\n {key: \"login\", name: \"Login\"}\n ],\n pattern: [\"login\"],\n auth: false\n });\n }\n\n // generate routes from navigation config\n navigationConfig = config.navigationConfigParam;\n transformedRoutes = transformRoutes(); \n\n // init ready, trigger by even (if getAuth is called before, error is thrown) \n document.dispatchEvent(new CustomEvent(\"init-app-event\"));\n console.log(\"Init done, Event created\");\n\n};\n\nconst TOP_MENU_HEIGHT = 50;\n\n/**\n * Abstract class for SPAs. Extend within the app main class.\n */\nexport abstract class PdSpaHelper extends router(navigator(LitElement)) {\n\n protected functionsController = new ServiceCallController(this);\n\n // not used at the moment\n @property({ type: String }) \n title = 'Hey there';\n\n /**\n * Properties needed for login/profile data.\n */\n @property({ type: Object, state: true }) \n _user: unknown | undefined;\n\n @property({ type: Object, state: true }) \n _profile: any | undefined;\n\n @property({ type: Object, state: true }) \n _loadingState?: {\n isLoading: boolean,\n smallBackground?: boolean,\n modal?: boolean,\n loadingTxt?: string\n };\n \n /**\n * Properties needed for the router.\n */\n @property({ type: String, reflect: true }) \n route = \"\";\n\n @property({ type: Object }) \n params = {};\n\n @property({ type: Object }) \n query = {};\n\n /**\n * Indicates if the teaser should closed (depends on scroll position).\n */\n @property({ type: Boolean })\n _teaserClosed = false; \n\n\n @property({ type: String, state: true })\n abstract _selectedLocale: string;\n\n abstract _availableLocales: string[];\n\n protected _singleLocaleMenu: boolean = false;\n \n\n static styles = \n // Ref: Additional use classmap to add custom classes in concrete impl\n css`\n\n :host {\n display: flex;\n flex-flow: column;\n height: 100%;\n }\n\n header {\n flex-grow: 0;\n }\n\n main {\n flex-grow: 1;\n flex-basis: max-content;\n }\n\n footer {\n flex-grow: 0;\n }\n\n .default-header {\n width: 100%;\n position: fixed;\n top: 0;\n display: block;\n z-index: 99;\n }\n\n .default-teaser {\n --pd-panel-overflow: hidden;\n --pd-panel-height: var(--pd-teaser-height, 380px);\n --pd-panel-width: 100%; \n --pd-panel-border-radius: 0;\n --pd-panel-bg: var(--pd-default-col);\n --pd-panel-viewer-bg-col: var(--pd-default-col);\n }\n\n .default-menu { \n transition: background-color 2s;\n }\n\n .default-menu-withteaser { \n --pd-menu-bg-col: var(--pd-spa-menu-change-col, #AFC1D2);\n --pd-menu-font-col: var(--pd-spa-menu-change-font-col, #0A3A48);\n transition: background-color 2s;\n }\n\n .default-top-menu, .default-top-menu-withteaser { \n --pd-menu-height: ${unsafeCSS(TOP_MENU_HEIGHT)}px;\n --pd-menu-font-size: 0.8em; \n --pd-menu-shadow: 0;\n }\n\n .default-top-menu-withteaser { \n --pd-menu-bg-col: var(--pd-teaser-bg-col);\n }\n\n /* needed for pd-spa-padding-top, only for pages with teaser, check if refactor possible... */\n .default-main-padding {\n padding-top: calc(var(--pd-menu-height) + var(--pd-spa-padding-top, 120px)) ;\n transition: padding-top 2s;\n }\n\n .default-main {\n padding-top: calc(var(--pd-menu-height));\n transition: padding-top 2s;\n } \n\n .default-main-withteaser {\n padding-top: calc(var(--pd-menu-height) + var(--pd-teaser-height, 380px));\n transition: padding-top 2s;\n }\n\n ` as CSSResultGroup; \n\n constructor() {\n\n super(); \n\n const doSomething = (scrollPos:number) => {\n if (scrollPos <= 50) {\n this._teaserClosed = false;\n } else {\n this._teaserClosed = true;\n }\n };\n\n let ticking = false;\n document.addEventListener('scroll', () => {\n const lastKnownScrollPosition = window.scrollY;\n if (!ticking) {\n window.requestAnimationFrame(() => {\n doSomething(lastKnownScrollPosition);\n ticking = false;\n });\n ticking = true;\n }\n });\n\n // add login handler after init => else error is thrown\n // document.addEventListener(\"init-app-event\", this.activateLoginHandler.bind(this));\n document.addEventListener(\"init-app-event\", () => {\n console.log(\"Init event catched\");\n });\n if (navigationConfig.includeLogin) {\n this.activateLoginHandler();\n }\n\n // For common toast messages (not for callfunction toasts => handelt by own controller)\n this.addEventListener(\"toast-event\", this._createTemporaryToast);\n this.addEventListener(\"route-event\", this._handleMenuRouteEvent); \n }\n\n /**\n * Non reactive private property for the index db class.\n */\n // private _indexDBClient?: YoIndexDBClient|null; \n\n /**\n * Needed for the router.\n * Return all configured routes.\n */\n static get routes() {\n return transformedRoutes; \n }\n\n /**\n * Needed for the router.\n * Set route params to internal members.\n */\n router(route:string, params:Object, query:Object) {\n this.route = route;\n this.params = params;\n this.query = query;\n } \n\n\n /**\n * Call to activate onAuthState change with profile request callbacks.\n * Only implemented for firebase provider.\n */\n activateLoginHandler() {\n console.log(\"Activate Login Handler\"); \n const callback = (user: unknown) => {\n console.log(\"My callback user:\", user);\n this._user = user;\n if (this._user) {\n this._loginSuccess(new CustomEvent(\"login-success\"));\n }\n };\n authStateChangedImpl(callback);\n }\n\n render() { \n const pageConf = navigationConfig.pages.filter(p => p.name === this.route)[0];\n const hideTeaser = this._teaserClosed || !pageConf?.withTeaser;\n return html`\n <header id=\"headerElementId\" class=\"default-header\">\n ${pageConf?.hideTopMenu ? '' : this._renderTopMenu(pageConf, hideTeaser)}\n ${hideTeaser ? '' : this._renderTeaser()}\n ${pageConf?.hideMenu ? '' : this._renderMenu(pageConf, hideTeaser)}\n </header> \n\n <main class=\"${this._getMainClass(hideTeaser, pageConf)}\">\n\n ${this._loadingState ? html`<pd-loading-state .loadingState=\"${this._loadingState}\"></pd-loading-state>` : ''}\n\n <app-main active-route=${this.route}\n @init-menu-sections=\"${this._initMenuSections}\"\n @login-success=\"${this._loginSuccess}\">\n ${this._renderRoutePages()}\n ${navigationConfig.includeLogin ? html`\n <default-login ?active=\"${this.route === \"login\"}\" route=\"login\"></default-login>` : ''}\n </app-main>\n </main>\n\n ${this.functionsController.render({\n complete: (result: FunctionResult) => this._renderSuccessResultInfo(result),\n initial: () => '',\n pending: () => this._renderPendingInfo(),\n error: (e: any) => this._renderErrorInfo(e),\n })}\n\n ${pageConf?.withFooter ? html`\n <footer class=\"default-footer\">\n ${this._renderFooter()}\n </footer>` : ''}\n `;\n } \n\n // eslint-disable-next-line class-methods-use-this\n private _getMainClass(hideTeaser: boolean, pageConf: NavigationPage): string {\n if (hideTeaser) { \n if (!pageConf) {\n return \"default-main\";\n }\n // eslint-disable-next-line no-nested-ternary\n return pageConf.mainClass ? pageConf.mainClass : (pageConf.withTeaser ? \"default-main-padding\" : \"default-main\");\n }\n return \"default-main-withteaser\";\n }\n\n _renderMenu(pageConfig:NavigationPage, hideTeaser:boolean) {\n const menuForPage = pageConfig ? (pageConfig.menu || []) : [];\n return menuForPage ? html`\n <pd-menu\n id=\"pdHelperMenuId\"\n class=\"${hideTeaser ? \"default-menu\" : \"default-menu-withteaser\"}\"\n @locale-change=\"${this._localeChange}\"\n selectedLocale=\"${this._selectedLocale}\"\n .locales=${this._singleLocaleMenu ? this._availableLocales : []}\n .menuItems=${menuForPage}\n .topMenuItems=${[]}\n activeRoute=\"${this.route}\"\n headerSize=\"${this._getHeaderSize(hideTeaser) + TOP_MENU_HEIGHT}\"\n >\n ${hideTeaser ? this._getAppLogo() : ''}\n </pd-menu>\n ` : '';\n } \n\n _renderTopMenu(pageConfig:NavigationPage, hideTeaser:boolean) {\n const topMenuForPage = pageConfig ? pageConfig.topMenuItems : undefined;\n return topMenuForPage ? html`\n <pd-menu \n id=\"pdHelperTopMenuId\"\n noBurgerMenu\n @locale-change=\"${this._localeChange}\"\n class=\"${hideTeaser ? \"default-top-menu\" : \"default-top-menu-withteaser\"}\" \n .locales=${this._availableLocales}\n selectedLocale=\"${this._selectedLocale}\"\n .topMenuItems=${topMenuForPage}\n activeRoute=\"${this.route}\"\n >\n </pd-menu>\n ` : '';\n }\n\n // eslint-disable-next-line class-methods-use-this\n _renderTeaser(): TemplateResult | string {\n const teaserContent = this._getTeaserContent();\n if (!teaserContent || teaserContent.length <= 0) {\n return '';\n }\n return html`\n <pd-panel-viewer class=\"default-teaser\" id=\"teaserPanelViewerId\" deltaCalc=\"4\">\n ${teaserContent.map(content => html`\n <pd-panel>\n ${content}\n </pd-panel>\n `)}\n </pd-panel-viewer>\n `;\n }\n\n _renderFooter() {\n const footer = this._getFooter();\n return html`\n <pd-footer \n class=\"default-footer\"\n .footerLinks=\"${footer.links}\"\n version=\"${footer.version}\" \n copyright=\"PD Progressive Developent UG\" \n .madeBy=\"${MADE_BY}\" \n @footer-link=\"${this._handleFooterRouteEvent}\">\n </pd-footer>\n `;\n }\n\n /**\n * Called when (any) cloud function call was finished. \n */\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n _renderSuccessResultInfo(result: FunctionResult) {\n return html`\n <pd-toast isSuccess duration=\"${TOAST_DURATION}\">\n ${this.functionsController.callDataPromise?.func.successTxt}\n </pd-toast>`;\n }\n\n /**\n * Called when (any) cloud function is currently running. \n */\n _renderPendingInfo() {\n return this.functionsController.callDataPromise?.func.fadeWindow ? html`\n <p>Überblende und lade ${this.functionsController.callDataPromise?.func.name}...</p>` \n : html`\n <pd-toast duration=\"-1\">\n ${this.functionsController.callDataPromise?.func.pendingTxt}\n </pd-toast>`; \n }\n\n /**\n * Called when (any) cloud function stopped with errors.\n */\n // eslint-disable-next-line class-methods-use-this\n _renderErrorInfo(error:any) {\n return html`\n <pd-toast isError duration=\"-1\">\n ${error}\n </pd-toast>`;\n }\n\n protected abstract _getTeaserContent(): Array<TemplateResult>;\n\n protected abstract _getFooter(): Footer;\n\n protected abstract _getAppLogo(): TemplateResult;\n\n protected abstract _renderRoutePages(): any; \n\n protected abstract _loginSuccess(e: CustomEvent): void;\n\n protected abstract _setLocale(locale:string): void;\n\n protected abstract _getHeaderSize(hideTeaser: boolean): number;\n\n _localeChange(e: CustomEvent): void {\n this._setLocale(e.detail)\n this._selectedLocale = e.detail; \n } \n \n // eslint-disable-next-line class-methods-use-this\n _handleMenuRouteEvent(e:any) {\n // test with el, to handel jumps also here, not used at the moment, same postion link problems...\n if (e.detail.el) {\n this._scrollToContent(e.detail.el);\n } else {\n PdSpaHelper._scrollToTop();\n this.navigate(e.detail.route);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n _handleFooterRouteEvent(e: CustomEvent) { \n const {linkObj} = e.detail; \n if (linkObj.link) {\n PdSpaHelper._scrollToTop();\n this.navigate(linkObj.link); \n }\n if (linkObj.action ) { \n linkObj.action();\n }\n }\n \n // eslint-disable-next-line class-methods-use-this\n _initMenuSections(e:any) {\n // add link to configuration object\n const menRefConf = navigationConfig.pages.filter(p => p.name === e.detail.name)[0];\n if (menRefConf) { \n menRefConf.menu = menRefConf.menu?.map((menuElement:MenuElement, index:number) => ({\n ...menuElement,\n ref: e.detail.menuRefs[index]\n }));\n }\n }\n\n _createTemporaryToast(e: any) {\n \n // hide existing call function toast (old one still is visible for directly incoming errors)\n this.functionsController.clear();\n \n const tmpToast = new PdToast(); \n tmpToast.isError = e.detail.isError;\n tmpToast.isSuccess = e.detail.isSuccess;\n const slotContent = document.createTextNode(e.detail.txt);\n tmpToast.appendChild(slotContent) \n\n this.shadowRoot?.appendChild(tmpToast);\n tmpToast.duration = TOAST_DURATION;\n\n // set timeout to remove toast (one second later)\n setTimeout(() => {\n this.shadowRoot?.removeChild(tmpToast);\n }, TOAST_DURATION + 1000);\n }\n\n static _scrollToTop() {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n }\n\n // Test, not used at the moment, jump/menu problem...\n // eslint-disable-next-line class-methods-use-this\n _scrollToContent(el:HTMLElement) {\n if (el) {\n const rect = el.getBoundingClientRect();\n console.log(\"Rect: \", rect);\n console.log(\"Offset Top/Height: \", el.offsetTop, el.offsetHeight);\n window.scrollBy({\n top: rect.top - (this._teaserClosed ? 80 : 450),\n left: 0,\n behavior: 'smooth',\n });\n }\n }\n\n}"]}
1
+ {"version":3,"file":"PdSpaHelper.js","sourceRoot":"","sources":["../../src/PdSpaHelper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAkC,SAAS,EAAE,MAAM,KAAK,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,OAAO,6CAA6C,CAAC;AACrD,OAAO,+CAA+C,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAGzI,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,6BAA6B,CAAC;AACrC,OAAO,sBAAsB,CAAC;AAC9B,gDAAgD;AAChD,OAAO,sBAAsB,CAAC;AAC9B,OAAO,8BAA8B,CAAC;AA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S,CAAC,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GAyB/B,CAAC;AAvHpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACP;AAMpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;0CACb;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;6CACd;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;kDACX;AAM7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAC/B;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAChB;AAMX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDACN;AAItB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;oDACP","sourcesContent":["import { html, LitElement, css, CSSResultGroup, TemplateResult, unsafeCSS } from 'lit';\nimport { router, navigator } from 'lit-element-router';\nimport { property } from 'lit/decorators.js';\n\nimport { Subscription } from 'rxjs';\n\nimport { FirebaseApp } from 'firebase/app';\n\nimport '@progressive-development/pd-page/pd-menu.js';\nimport '@progressive-development/pd-page/pd-footer.js';\n\nimport { ServiceCallController } from './service-call-controller2.js';\nimport { initializeStore, pdStore } from './store/mini-rx.store.js';\n\nimport { authStateChangedImpl, initAppImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';\nimport { AppConfiguration, Footer, FunctionResult, MenuElement, NavigationConfig, NavigationPage } from './service-provider/service-provider-model.js';\n\nimport { getLoadingSelector } from './store/spa-app-selector.js';\nimport { setRouteElement } from './store/spa-app-effects.js';\nimport { APP_CONF_EVENT, LoadingState } from './model/spa-model.js';\nimport { loginSucess } from './store/spa-app-actions.js';\n\nimport './router/AppMain.js';\nimport './defaultpage/default-login.js';\nimport './tmpown/pd-panel-viewer.js';\nimport './tmpown/pd-panel.js';\n// eslint-disable-next-line import/no-duplicates\nimport './tmpown/pd-toast.js';\nimport './tmpown/pd-loading-state.js';\n\n// TODO: How to solve this import problem?\n// eslint-disable-next-line import/no-duplicates\nimport { PdToast } from './tmpown/pd-toast.js';\n\n\n// Footer Text\nconst MADE_BY = {\n txt: \"made by PD Progressive Development\",\n email: \"info@progressive-development.com\"};\n\n// Visible time for time-limited toast\nconst TOAST_DURATION = 6000;\n\n\n/**\n * Transformed routes, generated during startInit.\n */\nlet app:FirebaseApp | undefined;\nlet transformedRoutes:Array<any>;\nlet navigationConfig:NavigationConfig;\n\n/**\n * Internal helper functions to generate route elemets for lit-router. \n */\nconst transformRoutes = () => {\n\n const transformAuthConfig = (withAuth:boolean) => \n withAuth ? \n {\n unauthenticated: {\n name: 'login',\n },\n authenticate: () => new Promise((resolve, reject) => {\n resolve(isAuthenticatedImpl());\n }),\n } : undefined;\n\n let generatedRoutes:Array<any> = [];\n navigationConfig.pages.forEach(cfEntry => {\n const addAraay = cfEntry.pattern.map(routeMapPattern => (\n {\n name: cfEntry.name,\n pattern: routeMapPattern,\n authentication: transformAuthConfig(cfEntry.auth),\n }\n )); \n generatedRoutes = generatedRoutes.concat(addAraay);\n });\n \n // add not-found route\n generatedRoutes.push({\n name: 'not-found',\n pattern: '*',\n });\n\n return generatedRoutes;\n}\n\n\n/**\n * Init the firebase app and application services like\n * functions and firestore. Generate routes from navigationConfig.\n * \n * @param navigationConfig\n * @param firebaseConfig\n * @param functionsConfig\n */\nexport const startInit = (config: AppConfiguration) => {\n\n console.log(\"Start init for config: \", config);\n\n // set service provider\n setServiceProvider(config.serviceProvider);\n \n // init mini-rx store\n if (config.storeConfigParam) {\n initializeStore(config.storeConfigParam);\n }\n\n // init app\n initAppImpl(config);\n\n // add login route if set in config\n if (config.navigationConfigParam.includeLogin) {\n config.navigationConfigParam.pages.push({\n name: \"login\",\n menu: [\n {key: \"login\", name: \"Login\"}\n ],\n pattern: [\"login\"],\n auth: false\n });\n }\n\n // generate routes from navigation config\n navigationConfig = config.navigationConfigParam;\n transformedRoutes = transformRoutes(); \n\n // init ready, trigger by even (if getAuth is called before, error is thrown) \n document.dispatchEvent(new CustomEvent(\"init-app-event\"));\n console.log(\"Init done, Event created\");\n\n};\n\nconst TOP_MENU_HEIGHT = 50;\n\n/**\n * Abstract class for SPAs. Extend within the app main class.\n */\nexport abstract class PdSpaHelper extends router(navigator(LitElement)) {\n\n protected functionsController = new ServiceCallController(this);\n\n protected abstract _appConfiguration: any;\n\n // not used at the moment\n @property({ type: String }) \n title = 'Hey there';\n\n /**\n * Properties needed for login/profile data.\n */\n @property({ type: Object, state: true }) \n _user: unknown | undefined;\n\n @property({ type: Object, state: true }) \n _profile: any | undefined;\n\n @property({ type: Object, state: true }) \n _loadingState?: LoadingState;\n \n /**\n * Properties needed for the router.\n */\n @property({ type: String, reflect: true }) \n route = \"\";\n\n @property({ type: Object }) \n params = {};\n\n @property({ type: Object }) \n query = {};\n\n /**\n * Indicates if the teaser should closed (depends on scroll position).\n */\n @property({ type: Boolean })\n _teaserClosed = false; \n\n\n @property({ type: String, state: true })\n abstract _selectedLocale: string;\n\n abstract _availableLocales: string[];\n\n protected _singleLocaleMenu: boolean = false;\n\n // subscription for loading-state selector\n _subscription?: Subscription; \n\n static styles = \n // Ref: Additional use classmap to add custom classes in concrete impl\n css`\n\n :host {\n display: flex;\n flex-flow: column;\n height: 100%;\n }\n\n header {\n flex-grow: 0;\n }\n\n main {\n flex-grow: 1;\n flex-basis: max-content;\n }\n\n footer {\n flex-grow: 0;\n }\n\n .default-header {\n width: 100%;\n position: fixed;\n top: 0;\n display: block;\n z-index: 99;\n }\n\n .default-teaser {\n --pd-panel-overflow: hidden;\n --pd-panel-height: var(--pd-teaser-height, 380px);\n --pd-panel-width: 100%; \n --pd-panel-border-radius: 0;\n --pd-panel-bg: var(--pd-default-col);\n --pd-panel-viewer-bg-col: var(--pd-default-col);\n }\n\n .default-menu { \n transition: background-color 2s;\n }\n\n .default-menu-withteaser { \n --pd-menu-bg-col: var(--pd-spa-menu-change-col, #AFC1D2);\n --pd-menu-font-col: var(--pd-spa-menu-change-font-col, #0A3A48);\n transition: background-color 2s;\n }\n\n .default-top-menu, .default-top-menu-withteaser { \n --pd-menu-height: ${unsafeCSS(TOP_MENU_HEIGHT)}px;\n --pd-menu-font-size: 0.8em; \n --pd-menu-shadow: 0;\n }\n\n .default-top-menu-withteaser { \n --pd-menu-bg-col: var(--pd-teaser-bg-col);\n }\n\n /* needed for pd-spa-padding-top, only for pages with teaser, check if refactor possible... */\n .default-main-padding {\n padding-top: calc(var(--pd-menu-height) + var(--pd-spa-padding-top, 120px)) ;\n transition: padding-top 2s;\n }\n\n .default-main {\n padding-top: calc(var(--pd-menu-height));\n transition: padding-top 2s;\n } \n\n .default-main-withteaser {\n padding-top: calc(var(--pd-menu-height) + var(--pd-teaser-height, 380px));\n transition: padding-top 2s;\n }\n\n ` as CSSResultGroup; \n\n constructor() {\n\n super(); \n\n setRouteElement(this);\n\n const doSomething = (scrollPos:number) => {\n if (scrollPos <= 50) {\n this._teaserClosed = false;\n } else {\n this._teaserClosed = true;\n }\n };\n\n let ticking = false;\n document.addEventListener('scroll', () => {\n const lastKnownScrollPosition = window.scrollY;\n if (!ticking) {\n window.requestAnimationFrame(() => {\n doSomething(lastKnownScrollPosition);\n ticking = false;\n });\n ticking = true;\n }\n });\n\n // add login handler after init => else error is thrown\n // document.addEventListener(\"init-app-event\", this.activateLoginHandler.bind(this));\n document.addEventListener(\"init-app-event\", () => {\n console.log(\"Init event catched\");\n });\n if (navigationConfig.includeLogin) {\n this.activateLoginHandler();\n }\n\n // For common toast messages (not for callfunction toasts => handelt by own controller)\n this.addEventListener(\"toast-event\", this._createTemporaryToast);\n this.addEventListener(\"route-event\", this._handleMenuRouteEvent);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(APP_CONF_EVENT, this._setConfInDetail);\n this._subscription = pdStore().select(getLoadingSelector)\n .subscribe((loadingState) => {\n console.log(\"Loading State: \", loadingState);\n this._loadingState = loadingState;\n });\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(APP_CONF_EVENT, this._setConfInDetail);\n this._subscription?.unsubscribe();\n super.disconnectedCallback();\n }\n\n _setConfInDetail(event: Event) {\n const {detail} = event as CustomEvent;\n if (detail) {\n detail.appConf = {\n ...this._appConfiguration\n };\n } \n }\n\n /**\n * Non reactive private property for the index db class.\n */\n // private _indexDBClient?: YoIndexDBClient|null; \n\n /**\n * Needed for the router.\n * Return all configured routes.\n */\n static get routes() {\n return transformedRoutes; \n }\n\n /**\n * Needed for the router.\n * Set route params to internal members.\n */\n router(route:string, params:Object, query:Object) {\n this.route = route;\n this.params = params;\n this.query = query;\n } \n\n\n /**\n * Call to activate onAuthState change with profile request callbacks.\n * Only implemented for firebase provider.\n */\n activateLoginHandler() {\n console.log(\"Activate Login Handler\"); \n const callback = (user: unknown) => {\n console.log(\"My callback user:\", user);\n this._user = user;\n if (this._user) {\n pdStore().dispatch(loginSucess());\n this._loginSuccess(new CustomEvent(\"login-success\"));\n }\n };\n authStateChangedImpl(callback);\n }\n\n render() { \n const pageConf = navigationConfig.pages.filter(p => p.name === this.route)[0];\n const hideTeaser = this._teaserClosed || !pageConf?.withTeaser;\n return html`\n <header id=\"headerElementId\" class=\"default-header\">\n ${pageConf?.hideTopMenu ? '' : this._renderTopMenu(pageConf, hideTeaser)}\n ${hideTeaser ? '' : this._renderTeaser()}\n ${pageConf?.hideMenu ? '' : this._renderMenu(pageConf, hideTeaser)}\n </header> \n\n <main class=\"${this._getMainClass(hideTeaser, pageConf)}\">\n\n ${this._loadingState ? html`<pd-loading-state .loadingState=\"${this._loadingState}\"></pd-loading-state>` : ''}\n\n <app-main active-route=${this.route}\n @init-menu-sections=\"${this._initMenuSections}\"\n @login-success=\"${this._loginSuccess}\">\n ${this._renderRoutePages()}\n ${navigationConfig.includeLogin ? html`\n <default-login ?active=\"${this.route === \"login\"}\" route=\"login\"></default-login>` : ''}\n </app-main>\n </main>\n\n ${this.functionsController.render({\n complete: (result: FunctionResult) => this._renderSuccessResultInfo(result),\n initial: () => '',\n pending: () => this._renderPendingInfo(),\n error: (e: any) => this._renderErrorInfo(e),\n })}\n\n ${pageConf?.withFooter ? html`\n <footer class=\"default-footer\">\n ${this._renderFooter()}\n </footer>` : ''}\n `;\n } \n\n // eslint-disable-next-line class-methods-use-this\n private _getMainClass(hideTeaser: boolean, pageConf: NavigationPage): string {\n if (hideTeaser) { \n if (!pageConf) {\n return \"default-main\";\n }\n // eslint-disable-next-line no-nested-ternary\n return pageConf.mainClass ? pageConf.mainClass : (pageConf.withTeaser ? \"default-main-padding\" : \"default-main\");\n }\n return \"default-main-withteaser\";\n }\n\n _renderMenu(pageConfig:NavigationPage, hideTeaser:boolean) {\n const menuForPage = pageConfig ? (pageConfig.menu || []) : [];\n return menuForPage ? html`\n <pd-menu\n id=\"pdHelperMenuId\"\n class=\"${hideTeaser ? \"default-menu\" : \"default-menu-withteaser\"}\"\n @locale-change=\"${this._localeChange}\"\n selectedLocale=\"${this._selectedLocale}\"\n .locales=${this._singleLocaleMenu ? this._availableLocales : []}\n .menuItems=${menuForPage}\n .topMenuItems=${[]}\n activeRoute=\"${this.route}\"\n headerSize=\"${this._getHeaderSize(hideTeaser) + TOP_MENU_HEIGHT}\"\n >\n ${hideTeaser ? this._getAppLogo() : ''}\n </pd-menu>\n ` : '';\n } \n\n _renderTopMenu(pageConfig:NavigationPage, hideTeaser:boolean) {\n const topMenuForPage = pageConfig ? pageConfig.topMenuItems : undefined;\n return topMenuForPage ? html`\n <pd-menu \n id=\"pdHelperTopMenuId\"\n noBurgerMenu\n @locale-change=\"${this._localeChange}\"\n class=\"${hideTeaser ? \"default-top-menu\" : \"default-top-menu-withteaser\"}\" \n .locales=${this._availableLocales}\n selectedLocale=\"${this._selectedLocale}\"\n .topMenuItems=${topMenuForPage}\n activeRoute=\"${this.route}\"\n >\n </pd-menu>\n ` : '';\n }\n\n // eslint-disable-next-line class-methods-use-this\n _renderTeaser(): TemplateResult | string {\n const teaserContent = this._getTeaserContent();\n if (!teaserContent || teaserContent.length <= 0) {\n return '';\n }\n return html`\n <pd-panel-viewer class=\"default-teaser\" id=\"teaserPanelViewerId\" deltaCalc=\"4\">\n ${teaserContent.map(content => html`\n <pd-panel>\n ${content}\n </pd-panel>\n `)}\n </pd-panel-viewer>\n `;\n }\n\n _renderFooter() {\n const footer = this._getFooter();\n return html`\n <pd-footer \n class=\"default-footer\"\n .footerLinks=\"${footer.links}\"\n version=\"${footer.version}\" \n copyright=\"PD Progressive Developent UG\" \n .madeBy=\"${MADE_BY}\" \n @footer-link=\"${this._handleFooterRouteEvent}\">\n </pd-footer>\n `;\n }\n\n /**\n * Called when (any) cloud function call was finished. \n */\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n _renderSuccessResultInfo(result: FunctionResult) {\n return html`\n <pd-toast isSuccess duration=\"${TOAST_DURATION}\">\n ${this.functionsController.callDataPromise?.func.successTxt}\n </pd-toast>`;\n }\n\n /**\n * Called when (any) cloud function is currently running. \n */\n _renderPendingInfo() {\n return this.functionsController.callDataPromise?.func.fadeWindow ? html`\n <p>Überblende und lade ${this.functionsController.callDataPromise?.func.name}...</p>` \n : html`\n <pd-toast duration=\"-1\">\n ${this.functionsController.callDataPromise?.func.pendingTxt}\n </pd-toast>`; \n }\n\n /**\n * Called when (any) cloud function stopped with errors.\n */\n // eslint-disable-next-line class-methods-use-this\n _renderErrorInfo(error:any) {\n return html`\n <pd-toast isError duration=\"-1\">\n ${error}\n </pd-toast>`;\n }\n\n protected abstract _getTeaserContent(): Array<TemplateResult>;\n\n protected abstract _getFooter(): Footer;\n\n protected abstract _getAppLogo(): TemplateResult;\n\n protected abstract _renderRoutePages(): any; \n\n protected abstract _loginSuccess(e: CustomEvent): void;\n\n protected abstract _setLocale(locale:string): void;\n\n protected abstract _getHeaderSize(hideTeaser: boolean): number;\n\n _localeChange(e: CustomEvent): void {\n this._setLocale(e.detail)\n this._selectedLocale = e.detail; \n } \n \n // eslint-disable-next-line class-methods-use-this\n _handleMenuRouteEvent(e:any) {\n // test with el, to handel jumps also here, not used at the moment, same postion link problems...\n if (e.detail.el) {\n this._scrollToContent(e.detail.el);\n } else {\n PdSpaHelper._scrollToTop();\n this.navigate(e.detail.route);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n _handleFooterRouteEvent(e: CustomEvent) { \n const {linkObj} = e.detail; \n if (linkObj.link) {\n PdSpaHelper._scrollToTop();\n this.navigate(linkObj.link); \n }\n if (linkObj.action ) { \n linkObj.action();\n }\n }\n \n // eslint-disable-next-line class-methods-use-this\n _initMenuSections(e:any) {\n // add link to configuration object\n const menRefConf = navigationConfig.pages.filter(p => p.name === e.detail.name)[0];\n if (menRefConf) { \n menRefConf.menu = menRefConf.menu?.map((menuElement:MenuElement, index:number) => ({\n ...menuElement,\n ref: e.detail.menuRefs[index]\n }));\n }\n }\n\n _createTemporaryToast(e: any) {\n \n // hide existing call function toast (old one still is visible for directly incoming errors)\n this.functionsController.clear();\n \n const tmpToast = new PdToast(); \n tmpToast.isError = e.detail.isError;\n tmpToast.isSuccess = e.detail.isSuccess;\n const slotContent = document.createTextNode(e.detail.txt);\n tmpToast.appendChild(slotContent) \n\n this.shadowRoot?.appendChild(tmpToast);\n tmpToast.duration = TOAST_DURATION;\n\n // set timeout to remove toast (one second later)\n setTimeout(() => {\n this.shadowRoot?.removeChild(tmpToast);\n }, TOAST_DURATION + 1000);\n }\n\n static _scrollToTop() {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n }\n\n // Test, not used at the moment, jump/menu problem...\n // eslint-disable-next-line class-methods-use-this\n _scrollToContent(el:HTMLElement) {\n if (el) {\n const rect = el.getBoundingClientRect();\n console.log(\"Rect: \", rect);\n console.log(\"Offset Top/Height: \", el.offsetTop, el.offsetHeight);\n window.scrollBy({\n top: rect.top - (this._teaserClosed ? 80 : 450),\n left: 0,\n behavior: 'smooth',\n });\n }\n }\n\n}"]}
@@ -0,0 +1,7 @@
1
+ export declare const APP_CONF_EVENT = "get-app-conf";
2
+ export interface LoadingState {
3
+ isLoading: boolean;
4
+ modal?: boolean;
5
+ smallBackground?: boolean;
6
+ loadingTxt?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ export const APP_CONF_EVENT = "get-app-conf";
2
+ //# sourceMappingURL=spa-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spa-model.js","sourceRoot":"","sources":["../../../src/model/spa-model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC","sourcesContent":["export const APP_CONF_EVENT = \"get-app-conf\";\n\nexport interface LoadingState {\n isLoading: boolean,\n modal?: boolean,\n smallBackground?: boolean,\n loadingTxt?: string\n}"]}
@@ -8,5 +8,6 @@ import { User } from 'firebase/auth';
8
8
  export declare const initAuth: (appParam: FirebaseApp) => void;
9
9
  export declare const logout: () => Promise<boolean>;
10
10
  export declare const isAuthenticated: () => boolean;
11
+ export declare const getAuthUser: () => unknown;
11
12
  export declare const authStateChanged: (callback: Function) => void;
12
13
  export declare const login: (user: string, sec: string) => Promise<User>;
@@ -29,6 +29,12 @@ export const isAuthenticated = () => {
29
29
  console.log("Check auth: ", authCheck);
30
30
  return authCheck;
31
31
  };
32
+ export const getAuthUser = () => {
33
+ if (!auth) {
34
+ throw new Error("isAuthenticated: Auth was not initialized");
35
+ }
36
+ return auth.currentUser;
37
+ };
32
38
  export const authStateChanged = (callback) => {
33
39
  if (!auth) {
34
40
  throw new Error("authStateChanged: Auth was not initialized");
@@ -1 +1 @@
1
- {"version":3,"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;;;;;;;;;;;;;;;;;;;;;;;;MA0BE;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,IAAW,EAAE,GAAU,EAAiB,EAAE;IACpE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IACD,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACtE,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC,CAAA","sourcesContent":["import { FirebaseApp } from 'firebase/app';\nimport { Auth, getAuth, onAuthStateChanged, signInWithEmailAndPassword, signOut, User } from 'firebase/auth';\n\nlet auth: Auth;\n\n/**\n * During start/load application, initialize functions. \n * \n * @param {*} app - initialized app. \n */\nexport const initAuth = (appParam: FirebaseApp) => {\n auth = getAuth(appParam);\n console.log(\"App for auth is set: \", auth);\n}\n\nexport const logout = async (): Promise<boolean> => {\n if (!auth) {\n throw new Error(\"logout: Auth was not initialized\");\n }\n try {\n await signOut(auth);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nexport const isAuthenticated = (): boolean => {\n if (!auth) {\n throw new Error(\"isAuthenticated: Auth was not initialized\");\n }\n const authCheck = auth.currentUser !== null;\n console.log(\"Check auth: \", authCheck);\n return authCheck;\n};\n\n\nexport const authStateChanged = (callback: Function) => { \n if (!auth) {\n throw new Error(\"authStateChanged: Auth was not initialized\");\n }\n onAuthStateChanged(auth, (user) => callback(user)); \n /* Alter code aus init in pd-spa-helper, hier falsch, noch refactorieren \n if (user) {\n this._user = user;\n if (postLoginFunc) { \n callFunction(postLoginFunc, postLoginFunc.param)\n .then((result:FunctionResult) => {\n this._profile = result.resultData;\n // redirect if login in the meantime is available \n // => else stay on the login page after reload/url navigation\n if (this.route === \"login\" && postLoginFunc?.redirect) { \n this.navigate(postLoginFunc.redirect);\n }\n // new event, could/should replace redirect\n document.dispatchEvent(new CustomEvent(\"user-login-event\"));\n }).catch(() => {\n if (postLoginFunc?.logoutOnFail) {\n logout();\n this._user = undefined;\n this._profile = undefined;\n }\n }); \n } else {\n this._user = undefined;\n this._profile = undefined;\n }\n }\n */\n}\n\nexport const login = async (user:string, sec:string): Promise<User> => {\n if (!auth) {\n throw new Error(\"login: Auth was not initialized\");\n }\n const credentials = await signInWithEmailAndPassword(auth, user, sec);\n return credentials.user;\n}\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/service-provider/firebase/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAC;AAE7G,IAAI,IAAU,CAAC;AAEf;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAqB,EAAE,EAAE;IAChD,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzB,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,IAAsB,EAAE;IACjD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACrD;IACD,IAAI;QACF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE;IAC3C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAY,EAAE;IACvC,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC,WAAW,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,EAAE;IACrD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IACD,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD;;;;;;;;;;;;;;;;;;;;;;;;;;MA0BE;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,IAAW,EAAE,GAAU,EAAiB,EAAE;IACpE,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IACD,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACtE,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC,CAAA","sourcesContent":["import { FirebaseApp } from 'firebase/app';\nimport { Auth, getAuth, onAuthStateChanged, signInWithEmailAndPassword, signOut, User } from 'firebase/auth';\n\nlet auth: Auth;\n\n/**\n * During start/load application, initialize functions. \n * \n * @param {*} app - initialized app. \n */\nexport const initAuth = (appParam: FirebaseApp) => {\n auth = getAuth(appParam);\n console.log(\"App for auth is set: \", auth);\n}\n\nexport const logout = async (): Promise<boolean> => {\n if (!auth) {\n throw new Error(\"logout: Auth was not initialized\");\n }\n try {\n await signOut(auth);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nexport const isAuthenticated = (): boolean => {\n if (!auth) {\n throw new Error(\"isAuthenticated: Auth was not initialized\");\n }\n const authCheck = auth.currentUser !== null;\n console.log(\"Check auth: \", authCheck);\n return authCheck;\n};\n\nexport const getAuthUser = (): unknown => {\n if (!auth) {\n throw new Error(\"isAuthenticated: Auth was not initialized\");\n } \n return auth.currentUser;\n};\n\nexport const authStateChanged = (callback: Function) => { \n if (!auth) {\n throw new Error(\"authStateChanged: Auth was not initialized\");\n }\n onAuthStateChanged(auth, (user) => callback(user)); \n /* Alter code aus init in pd-spa-helper, hier falsch, noch refactorieren \n if (user) {\n this._user = user;\n if (postLoginFunc) { \n callFunction(postLoginFunc, postLoginFunc.param)\n .then((result:FunctionResult) => {\n this._profile = result.resultData;\n // redirect if login in the meantime is available \n // => else stay on the login page after reload/url navigation\n if (this.route === \"login\" && postLoginFunc?.redirect) { \n this.navigate(postLoginFunc.redirect);\n }\n // new event, could/should replace redirect\n document.dispatchEvent(new CustomEvent(\"user-login-event\"));\n }).catch(() => {\n if (postLoginFunc?.logoutOnFail) {\n logout();\n this._user = undefined;\n this._profile = undefined;\n }\n }); \n } else {\n this._user = undefined;\n this._profile = undefined;\n }\n }\n */\n}\n\nexport const login = async (user:string, sec:string): Promise<User> => {\n if (!auth) {\n throw new Error(\"login: Auth was not initialized\");\n }\n const credentials = await signInWithEmailAndPassword(auth, user, sec);\n return credentials.user;\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { getMetadata, getStorage, listAll, ref, uploadString } from "firebase/storage";
2
+ import { getUser } from '../service-provider-impl.js';
2
3
  const DEFAULT_STORAGE = "default_storage";
3
4
  const storageMap = new Map();
4
5
  /**
@@ -38,6 +39,7 @@ export const initFirestorage = (app, defaultStorage, storageConfig) => {
38
39
  }
39
40
  };
40
41
  export const uploadFirestorageFile = (file) => {
42
+ var _a;
41
43
  if (!storageMap || storageMap.size === 0) {
42
44
  throw new Error("No storage is configured");
43
45
  }
@@ -57,10 +59,13 @@ export const uploadFirestorageFile = (file) => {
57
59
  }
58
60
  // create file reference and upload
59
61
  const fileRef = ref(uploadRefConf.storageRef, subFolderName ? `${subFolderName}/${fileName}` : fileName);
60
- // Meta data with description
62
+ // default usefull metadata: contentType, size, timeCreated, updated
63
+ // additional custom metadata
61
64
  const metadata = {
62
65
  customMetadata: {
66
+ 'creator': (_a = getUser()) === null || _a === void 0 ? void 0 : _a.displayName,
63
67
  'comment': file.description,
68
+ 'name': file.descriptionName,
64
69
  }
65
70
  };
66
71
  return uploadString(fileRef, file.base64DataURL, 'data_url', metadata);
@@ -92,10 +97,6 @@ export const getFirestorageFileList = (storageName, refKey, subFolder, includeMe
92
97
  itemRefs.push({
93
98
  fileName: itemRef.name,
94
99
  filePath: itemRef.fullPath,
95
- documentType: "ToDo",
96
- // description: "ToDo Some Description",
97
- // creator: "ToDo",
98
- // creation: new Date(),
99
100
  });
100
101
  // MetaData for each item with own promise
101
102
  if (includeMetaData) {
@@ -104,10 +105,19 @@ export const getFirestorageFileList = (storageName, refKey, subFolder, includeMe
104
105
  });
105
106
  if (includeMetaData) {
106
107
  return Promise.all(metaPromises)
107
- .then(metaResults => itemRefs.map((item, index) => ({
108
- ...item,
109
- metaData: metaResults[index]
110
- })));
108
+ .then(metaResults => itemRefs.map((item, index) => {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
110
+ return ({
111
+ ...item,
112
+ creation: new Date((_a = metaResults[index]) === null || _a === void 0 ? void 0 : _a.timeCreated),
113
+ documentType: (_b = metaResults[index]) === null || _b === void 0 ? void 0 : _b.contentType,
114
+ creator: (_d = (_c = metaResults[index]) === null || _c === void 0 ? void 0 : _c.customMetadata) === null || _d === void 0 ? void 0 : _d.creator,
115
+ descriptionName: (_f = (_e = metaResults[index]) === null || _e === void 0 ? void 0 : _e.customMetadata) === null || _f === void 0 ? void 0 : _f.name,
116
+ description: (_h = (_g = metaResults[index]) === null || _g === void 0 ? void 0 : _g.customMetadata) === null || _h === void 0 ? void 0 : _h.comment,
117
+ size: (_j = metaResults[index]) === null || _j === void 0 ? void 0 : _j.size,
118
+ metaData: metaResults[index]
119
+ });
120
+ }));
111
121
  }
112
122
  return itemRefs;
113
123
  }).catch((error) => {
@@ -1 +1 @@
1
- {"version":3,"file":"firestorage-client.js","sourceRoot":"","sources":["../../../../src/service-provider/firebase/firestorage-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAItJ,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,MAAM,UAAU,GAMX,IAAI,GAAG,EAAE,CAAC;AAEf;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAgB,EAAE,cAAuB,EAAE,aAAiC,EAAE,EAAE;IAC9G,IAAI;QAEF,sBAAsB;QACtB,IAAI,cAAc,EAAE;YAClB,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE;gBAC9B,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC;aACzB,CAAC,CAAC;SACJ;QAED,wBAAwB;QACxB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAE3C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;YAEpC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE;gBAC/B,OAAO;gBACP,UAAU,EAAE;oBACV;wBACE,GAAG,EAAE,MAAM;wBACX,UAAU,EAAE,cAAc;qBAC3B;oBACD,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;wBAChD,GAAG,EAAE,eAAe;wBACpB,UAAU,EAAE,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC;qBACjD,CAAC,CAAC;iBACJ;aACF,CAAC,CAAC;QACL,CAAC,CA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orage, FullMetadata, StorageReference, UploadResult, getMetadata, getStorage, listAll, ref, uploadString } from \"firebase/storage\";\n\nimport { FileStorageConfig, StorageDocument, UploadFile } from '../service-provider-model.js';\n\nconst DEFAULT_STORAGE = \"default_storage\";\n\nconst storageMap:Map<string, { \n storage: FirebaseStorage,\n references?: {\n key: string,\n storageRef: StorageReference\n }[],\n}> = new Map();\n\n/**\n * During start/load application, initialize functions.\n *\n * @param {*} app - initialized app.\n */\nexport const initFirestorage = (app: FirebaseApp, defaultStorage?: string, storageConfig?: FileStorageConfig) => {\n try {\n\n // add default storage\n if (defaultStorage) {\n storageMap.set(DEFAULT_STORAGE, {\n storage: getStorage(app)\n });\n } \n \n // add specific storages\n storageConfig?.storage.forEach(storeConfig => {\n\n const storage = getStorage(app, storeConfig.name);\n const storageRootRef = ref(storage);\n\n storageMap.set(storeConfig.name, {\n storage,\n references: [\n {\n key: \"ROOT\",\n storageRef: storageRootRef\n },\n ...storeConfig.references.map(refConfigString => ({\n key: refConfigString,\n storageRef: ref(storageRootRef, refConfigString)\n }))\n ]\n });\n }); \n\n } catch (error) {\n console.error(error);\n }\n};\n\nexport const uploadFirestorageFile = (file: UploadFile):Promise<UploadResult> => { \n\n if (!storageMap || storageMap.size === 0) {\n throw new Error(\"No storage is configured\");\n } \n\n // get storage\n const {storageName, referenceKey, subFolderName, fileName} = file;\n const storageConf = storageMap.get(storageName || DEFAULT_STORAGE);\n if (!storageConf ) {\n throw new Error(`Invalid storage name: ${storageName || DEFAULT_STORAGE}`);\n } \n if (!storageConf.references || storageConf.references.length === 0) {\n throw new Error(`No references configured for storage: ${storageName || DEFAULT_STORAGE}`);\n }\n\n // get reference to path\n const uploadRefConf = referenceKey ? (storageConf.references.filter(filterRef => filterRef.key === referenceKey)[0]) : storageConf.references[0];\n if (!uploadRefConf || !uploadRefConf.storageRef) {\n throw new Error(`No valid reference for key: ${referenceKey}`);\n }\n\n // create file reference and upload\n const fileRef = ref(uploadRefConf.storageRef, subFolderName ? `${subFolderName}/${fileName}` : fileName);\n\n // Meta data with description\n const metadata = {\n customMetadata: {\n 'comment': file.description,\n }\n };\n \n return uploadString(fileRef, file.base64DataURL, 'data_url', metadata);\n};\n\nexport const getFirestorageFileList = (\n storageName: string, \n refKey: string, \n subFolder?: string,\n includeMetaData?: boolean\n):Promise<StorageDocument[]> => { \n\n if (!storageMap || storageMap.size === 0) {\n throw new Error(\"No storage is configured\");\n } \n\n // get storage \n const storageConf = storageMap.get(storageName);\n if (!storageConf ) {\n throw new Error(`Invalid storage name: ${storageName}`);\n } \n if (!storageConf.references || storageConf.references.length === 0) {\n throw new Error(`No references configured for storage: ${storageName || DEFAULT_STORAGE}`);\n }\n\n // get refrence\n const storageRef = storageConf.references.filter(refIt => refIt.key === refKey)[0];\n if (!storageRef) {\n throw new Error(`No reference available for storage: ${storageName || DEFAULT_STORAGE} and ref: ${refKey}`);\n }\n\n const usedRef = subFolder ? ref(storageRef.storageRef, subFolder) : storageRef.storageRef; \n const itemRefs: StorageDocument[] = [];\n return listAll(usedRef)\n .then((res) => {\n \n const metaPromises:Promise<FullMetadata>[] = [];\n res.items.forEach((itemRef) => { \n // All the items under listRef .\n itemRefs.push({\n fileName: itemRef.name,\n filePath: itemRef.fullPath,\n documentType: \"ToDo\",\n // description: \"ToDo Some Description\",\n // creator: \"ToDo\",\n // creation: new Date(),\n });\n\n // MetaData for each item with own promise\n if (includeMetaData) {\n metaPromises.push(getMetadata(itemRef)); \n }\n });\n\n if (includeMetaData) {\n return Promise.all(metaPromises)\n .then(metaResults => itemRefs.map((item: StorageDocument, index: number) => (\n {\n ...item,\n metaData: metaResults[index]\n }\n )));\n }\n return itemRefs;\n }).catch((error) => {\n // TODO: add error handling\n console.log(\"Error during file list\", error);\n throw error;\n });\n\n};\n\n\n/* Firestorage Error List: https://firebase.google.com/docs/storage/web/handle-errors */\n/* \nstorage/unknown\tAn unknown error occurred.\nstorage/object-not-found\tNo object exists at the desired reference.\nstorage/bucket-not-found\tNo bucket is configured for Cloud Storage\nstorage/project-not-found\tNo project is configured for Cloud Storage\nstorage/quota-exceeded\tQuota on your Cloud Storage bucket has been exceeded. If you're on the no-cost tier, upgrade to a paid plan. If you're on a paid plan, reach out to Firebase support.\nstorage/unauthenticated\tUser is unauthenticated, please authenticate and try again.\nstorage/unauthorized\tUser is not authorized to perform the desired action, check your security rules to ensure they are correct.\nstorage/retry-limit-exceeded\tThe maximum time limit on an operation (upload, download, delete, etc.) has been excceded. Try uploading again.\nstorage/invalid-checksum\tFile on the client does not match the checksum of the file received by the server. Try uploading again.\nstorage/canceled\tUser canceled the operation.\nstorage/invalid-event-name\tInvalid event name provided. Must be one of [`running`, `progress`, `pause`]\nstorage/invalid-url\tInvalid URL provided to refFromURL(). Must be of the form: gs://bucket/object or https://firebasestorage.googleapis.com/v0/b/bucket/o/object?token=<TOKEN>\nstorage/invalid-argument\tThe argument passed to put() must be `File`, `Blob`, or `UInt8` Array. The argument passed to putString() must be a raw, `Base64`, or `Base64URL` string.\nstorage/no-default-bucket\tNo bucket has been set in your config's storageBucket property.\nstorage/cannot-slice-blob\tCommonly occurs when the local file has changed (deleted, saved again, etc.). Try uploading again after verifying that the file hasn't changed.\nstorage/server-file-wrong-size\n*/"]}
1
+ {"version":3,"file":"firestorage-client.js","sourceRoot":"","sources":["../../../../src/service-provider/firebase/firestorage-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGtJ,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,MAAM,UAAU,GAMX,IAAI,GAAG,EAAE,CAAC;AAEf;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAgB,EAAE,cAAuB,EAAE,aAAiC,EAAE,EAAE;IAC9G,IAAI;QAEF,sBAAsB;QACtB,IAAI,cAA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orage, FullMetadata, StorageReference, UploadResult, getMetadata, getStorage, listAll, ref, uploadString } from \"firebase/storage\";\n\nimport { FileStorageConfig, StorageDocument, UploadFile } from '../service-provider-model.js';\nimport { getUser } from '../service-provider-impl.js';\n\nconst DEFAULT_STORAGE = \"default_storage\";\n\nconst storageMap:Map<string, { \n storage: FirebaseStorage,\n references?: {\n key: string,\n storageRef: StorageReference\n }[],\n}> = new Map();\n\n/**\n * During start/load application, initialize functions.\n *\n * @param {*} app - initialized app.\n */\nexport const initFirestorage = (app: FirebaseApp, defaultStorage?: string, storageConfig?: FileStorageConfig) => {\n try {\n\n // add default storage\n if (defaultStorage) {\n storageMap.set(DEFAULT_STORAGE, {\n storage: getStorage(app)\n });\n } \n \n // add specific storages\n storageConfig?.storage.forEach(storeConfig => {\n\n const storage = getStorage(app, storeConfig.name);\n const storageRootRef = ref(storage);\n\n storageMap.set(storeConfig.name, {\n storage,\n references: [\n {\n key: \"ROOT\",\n storageRef: storageRootRef\n },\n ...storeConfig.references.map(refConfigString => ({\n key: refConfigString,\n storageRef: ref(storageRootRef, refConfigString)\n }))\n ]\n });\n }); \n\n } catch (error) {\n console.error(error);\n }\n};\n\nexport const uploadFirestorageFile = (file: UploadFile):Promise<UploadResult> => { \n\n if (!storageMap || storageMap.size === 0) {\n throw new Error(\"No storage is configured\");\n } \n\n // get storage\n const {storageName, referenceKey, subFolderName, fileName} = file;\n const storageConf = storageMap.get(storageName || DEFAULT_STORAGE);\n if (!storageConf ) {\n throw new Error(`Invalid storage name: ${storageName || DEFAULT_STORAGE}`);\n } \n if (!storageConf.references || storageConf.references.length === 0) {\n throw new Error(`No references configured for storage: ${storageName || DEFAULT_STORAGE}`);\n }\n\n // get reference to path\n const uploadRefConf = referenceKey ? (storageConf.references.filter(filterRef => filterRef.key === referenceKey)[0]) : storageConf.references[0];\n if (!uploadRefConf || !uploadRefConf.storageRef) {\n throw new Error(`No valid reference for key: ${referenceKey}`);\n }\n\n // create file reference and upload\n const fileRef = ref(uploadRefConf.storageRef, subFolderName ? `${subFolderName}/${fileName}` : fileName);\n\n // default usefull metadata: contentType, size, timeCreated, updated\n\n // additional custom metadata\n const metadata = {\n customMetadata: {\n 'creator': (getUser() as any)?.displayName,\n 'comment': file.description,\n 'name': file.descriptionName,\n }\n };\n \n return uploadString(fileRef, file.base64DataURL, 'data_url', metadata);\n};\n\nexport const getFirestorageFileList = (\n storageName: string, \n refKey: string, \n subFolder?: string,\n includeMetaData?: boolean\n):Promise<StorageDocument[]> => { \n\n if (!storageMap || storageMap.size === 0) {\n throw new Error(\"No storage is configured\");\n }\n\n // get storage \n const storageConf = storageMap.get(storageName);\n if (!storageConf ) {\n throw new Error(`Invalid storage name: ${storageName}`);\n } \n if (!storageConf.references || storageConf.references.length === 0) {\n throw new Error(`No references configured for storage: ${storageName || DEFAULT_STORAGE}`);\n }\n\n // get refrence\n const storageRef = storageConf.references.filter(refIt => refIt.key === refKey)[0];\n if (!storageRef) {\n throw new Error(`No reference available for storage: ${storageName || DEFAULT_STORAGE} and ref: ${refKey}`);\n }\n\n const usedRef = subFolder ? ref(storageRef.storageRef, subFolder) : storageRef.storageRef; \n const itemRefs: StorageDocument[] = [];\n return listAll(usedRef)\n .then((res) => {\n \n const metaPromises:Promise<FullMetadata>[] = [];\n res.items.forEach((itemRef) => { \n // All the items under listRef .\n itemRefs.push({\n fileName: itemRef.name,\n filePath: itemRef.fullPath,\n });\n\n // MetaData for each item with own promise\n if (includeMetaData) {\n metaPromises.push(getMetadata(itemRef)); \n }\n });\n\n if (includeMetaData) {\n return Promise.all(metaPromises)\n .then(metaResults => itemRefs.map((item: StorageDocument, index: number) => (\n {\n ...item,\n creation: new Date(metaResults[index]?.timeCreated),\n documentType: metaResults[index]?.contentType, \n creator: metaResults[index]?.customMetadata?.creator,\n descriptionName: metaResults[index]?.customMetadata?.name,\n description: metaResults[index]?.customMetadata?.comment,\n size: metaResults[index]?.size,\n metaData: metaResults[index]\n }\n )));\n }\n return itemRefs;\n }).catch((error) => {\n // TODO: add error handling\n console.log(\"Error during file list\", error);\n throw error;\n });\n\n};\n\n\n/* Firestorage Error List: https://firebase.google.com/docs/storage/web/handle-errors */\n/* \nstorage/unknown\tAn unknown error occurred.\nstorage/object-not-found\tNo object exists at the desired reference.\nstorage/bucket-not-found\tNo bucket is configured for Cloud Storage\nstorage/project-not-found\tNo project is configured for Cloud Storage\nstorage/quota-exceeded\tQuota on your Cloud Storage bucket has been exceeded. If you're on the no-cost tier, upgrade to a paid plan. If you're on a paid plan, reach out to Firebase support.\nstorage/unauthenticated\tUser is unauthenticated, please authenticate and try again.\nstorage/unauthorized\tUser is not authorized to perform the desired action, check your security rules to ensure they are correct.\nstorage/retry-limit-exceeded\tThe maximum time limit on an operation (upload, download, delete, etc.) has been excceded. Try uploading again.\nstorage/invalid-checksum\tFile on the client does not match the checksum of the file received by the server. Try uploading again.\nstorage/canceled\tUser canceled the operation.\nstorage/invalid-event-name\tInvalid event name provided. Must be one of [`running`, `progress`, `pause`]\nstorage/invalid-url\tInvalid URL provided to refFromURL(). Must be of the form: gs://bucket/object or https://firebasestorage.googleapis.com/v0/b/bucket/o/object?token=<TOKEN>\nstorage/invalid-argument\tThe argument passed to put() must be `File`, `Blob`, or `UInt8` Array. The argument passed to putString() must be a raw, `Base64`, or `Base64URL` string.\nstorage/no-default-bucket\tNo bucket has been set in your config's storageBucket property.\nstorage/cannot-slice-blob\tCommonly occurs when the local file has changed (deleted, saved again, etc.). Try uploading again after verifying that the file hasn't changed.\nstorage/server-file-wrong-size\n*/"]}
@@ -1,4 +1,5 @@
1
1
  export declare const logoutMock: () => Promise<boolean>;
2
2
  export declare const isAuthenticatedMock: () => boolean;
3
+ export declare const getAuthUserMock: () => unknown;
3
4
  export declare const authStateChangedMock: () => void;
4
5
  export declare const loginMock: (user: string, sec: string) => Promise<unknown>;
@@ -27,6 +27,10 @@ export const isAuthenticatedMock = () => {
27
27
  }
28
28
  return loginAvailable;
29
29
  };
30
+ export const getAuthUserMock = () => isAuthenticatedMock() ? {
31
+ uid: "34234234",
32
+ displayName: "userMockName"
33
+ } : undefined;
30
34
  export const authStateChangedMock = () => {
31
35
  console.log("Not implemented for MOCK");
32
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/service-provider/mock/auth.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,aAAa,GAAG,MAAM,CAAC;AAI7B,IAAI,cAAmC,CAAC;AAGxC,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAI,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5D,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B,CAAC,CAAA;AAGD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAsB,EAAE;IACrD,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,cAAc,GAAG,SAAS,CAAC;IAC3B,IAAI,gBAAgB,EAAE;QAClB,YAAY,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;KAChD;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAY,EAAE;IAC/C,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC1C,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;KAC/D;IACD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAA;AAGD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAC1C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAW,EAAE,GAAU,EAAoB,EAAE;IAE3E,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;IACxD,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,IAAI,KAAK,cAAc,IAAI,GAAG,KAAK,aAAa,EAAE;QAClD,IAAI,gBAAgB,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;SACrD;QACD,KAAK,GAAG,IAAI,CAAC;QACb,cAAc,GAAG,IAAI,CAAC;KACzB;IAED,IAAI,KAAK,EAAE;QACT,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;KACJ;IAED,MAAM,GAAG,GAAI,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACxC,MAAM,KAAK,GAAQ,GAAG,CAAC;IACvB,KAAK,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACnC,MAAM,KAAK,CAAC;AACd,CAAC,CAAA","sourcesContent":["\n/*\n * Only for temporary development:\n * Set to true/false if the user should hold only in session (login after each reload)\n * or in the localstore (login until the local store entry is invalid or not available).\n */\nconst LOCALSTORE_ACTIV = true;\nconst LOCALSTORE_ITEM_KEY = 'pdUserLogin';\nconst HARDCODED_USER = 'mock@pd-spa-helper.com';\nconst HARDCODED_PWD = 'mock';\n\n\n\nlet loginAvailable: boolean | undefined;\n\n\nconst checkLocalStore = () => {\n const userItem = localStorage.getItem(LOCALSTORE_ITEM_KEY);\n return userItem === 'true';\n}\n\n\nexport const logoutMock = async (): Promise<boolean> => {\n console.log(\"Do MOCK logout\");\n loginAvailable = undefined;\n if (LOCALSTORE_ACTIV) {\n localStorage.removeItem(LOCALSTORE_ITEM_KEY);\n }\n return Promise.resolve(true);\n};\n\nexport const isAuthenticatedMock = (): boolean => {\n if (loginAvailable === undefined) {\n console.log('MOCK: check authentication');\n loginAvailable = LOCALSTORE_ACTIV ? checkLocalStore() : false;\n }\n return loginAvailable;\n} \n\n\nexport const authStateChangedMock = () => {\n console.log(\"Not implemented for MOCK\");\n}\n\nexport const loginMock = async (user:string, sec:string): Promise<unknown> => { \n\n console.log('MOCK: do authentication for user: ', user);\n let valid = false;\n if (user === HARDCODED_USER && sec === HARDCODED_PWD) {\n if (LOCALSTORE_ACTIV) {\n localStorage.setItem(LOCALSTORE_ITEM_KEY, 'true');\n }\n valid = true;\n loginAvailable = true;\n }\n\n if (valid) {\n return Promise.resolve({\n uid: \"123124\"\n }); \n }\n\n const err = new Error(\"Invalid login\");\n const error: any = err;\n error.code = \"auth/wrong-password\";\n throw error;\n}\n\n\n\n\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/service-provider/mock/auth.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,aAAa,GAAG,MAAM,CAAC;AAI7B,IAAI,cAAmC,CAAC;AAGxC,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAI,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5D,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B,CAAC,CAAA;AAGD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAsB,EAAE;IACrD,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,cAAc,GAAG,SAAS,CAAC;IAC3B,IAAI,gBAAgB,EAAE;QAClB,YAAY,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;KAChD;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAA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cesContent":["\n/*\n * Only for temporary development:\n * Set to true/false if the user should hold only in session (login after each reload)\n * or in the localstore (login until the local store entry is invalid or not available).\n */\nconst LOCALSTORE_ACTIV = true;\nconst LOCALSTORE_ITEM_KEY = 'pdUserLogin';\nconst HARDCODED_USER = 'mock@pd-spa-helper.com';\nconst HARDCODED_PWD = 'mock';\n\n\n\nlet loginAvailable: boolean | undefined;\n\n\nconst checkLocalStore = () => {\n const userItem = localStorage.getItem(LOCALSTORE_ITEM_KEY);\n return userItem === 'true';\n}\n\n\nexport const logoutMock = async (): Promise<boolean> => {\n console.log(\"Do MOCK logout\");\n loginAvailable = undefined;\n if (LOCALSTORE_ACTIV) {\n localStorage.removeItem(LOCALSTORE_ITEM_KEY);\n }\n return Promise.resolve(true);\n};\n\nexport const isAuthenticatedMock = (): boolean => {\n if (loginAvailable === undefined) {\n console.log('MOCK: check authentication');\n loginAvailable = LOCALSTORE_ACTIV ? checkLocalStore() : false;\n }\n return loginAvailable;\n} \n\nexport const getAuthUserMock = (): unknown => \n isAuthenticatedMock() ? {\n uid: \"34234234\",\n displayName: \"userMockName\"\n } : undefined;\n\n\nexport const authStateChangedMock = () => {\n console.log(\"Not implemented for MOCK\");\n}\n\nexport const loginMock = async (user:string, sec:string): Promise<unknown> => { \n\n console.log('MOCK: do authentication for user: ', user);\n let valid = false;\n if (user === HARDCODED_USER && sec === HARDCODED_PWD) {\n if (LOCALSTORE_ACTIV) {\n localStorage.setItem(LOCALSTORE_ITEM_KEY, 'true');\n }\n valid = true;\n loginAvailable = true;\n }\n\n if (valid) {\n return Promise.resolve({\n uid: \"123124\"\n }); \n }\n\n const err = new Error(\"Invalid login\");\n const error: any = err;\n error.code = \"auth/wrong-password\";\n throw error;\n}\n\n\n\n\n"]}
@@ -8,5 +8,6 @@ export declare const authStateChangedImpl: (callback: Function) => void;
8
8
  export declare const isAuthenticatedImpl: () => boolean;
9
9
  export declare const loginImpl: (user: string, sec: string) => Promise<unknown>;
10
10
  export declare const logoutImpl: () => Promise<boolean>;
11
+ export declare const getUser: () => unknown;
11
12
  export declare const uploadFile: (file: UploadFile) => Promise<unknown>;
12
13
  export declare const getStorageFileList: (storageName: string, keyRef: string, subFolder?: string, includeMetadata?: boolean) => Promise<StorageDocument[]>;
@@ -1,6 +1,6 @@
1
1
  import { initializeApp } from "firebase/app";
2
- import { authStateChanged, initAuth, isAuthenticated, login, logout } from "./firebase/auth.js";
3
- import { authStateChangedMock, isAuthenticatedMock, loginMock, logoutMock } from "./mock/auth.js";
2
+ import { authStateChanged, getAuthUser, initAuth, isAuthenticated, login, logout } from "./firebase/auth.js";
3
+ import { authStateChangedMock, getAuthUserMock, isAuthenticatedMock, loginMock, logoutMock } from "./mock/auth.js";
4
4
  import { callFunction, initFunctions } from "./firebase/functions-client.js";
5
5
  import { initFirestore } from "./firebase/firestore-client.js";
6
6
  import { callFunctionMock, initMockResponse } from "./mock/function-client.js";
@@ -114,6 +114,16 @@ export const logoutImpl = () => {
114
114
  }
115
115
  return throwUndefinedProviderError();
116
116
  };
117
+ // Refactor: Return defined USer Object
118
+ export const getUser = () => {
119
+ if (provider === "firebase") {
120
+ return getAuthUser();
121
+ }
122
+ if (provider === "mock") {
123
+ return getAuthUserMock();
124
+ }
125
+ return throwUndefinedProviderError();
126
+ };
117
127
  /* #####################
118
128
  * Storage Implementation
119
129
  * ##################### */
@@ -1 +1 @@
1
- {"version":3,"file":"service-provider-impl.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAA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AACvC,CAAC,CAAA;AAED;;2BAE2B;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAoB,EAAE;IAC/D,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;KACpC;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAA;KACnC;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAmB,EACnB,MAAc,EACd,SAAkB,EAClB,eAAwB,EACI,EAAE;IAC9B,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;KAChF;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;KACzE;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA","sourcesContent":["import { FirebaseApp, FirebaseOptions, initializeApp } from \"firebase/app\";\n\nimport { authStateChanged, initAuth, isAuthenticated, login, logout } from \"./firebase/auth.js\";\nimport { authStateChangedMock, isAuthenticatedMock, loginMock, logoutMock } from \"./mock/auth.js\";\nimport { AppConfiguration, FileStorageConfig, FunctionDefinition, FunctionResult, FunctionsConfig, ServiceProviderConfiguration, StorageDocument, UploadFile } from \"./service-provider-model.js\";\nimport { callFunction, initFunctions } from \"./firebase/functions-client.js\";\nimport { initFirestore } from \"./firebase/firestore-client.js\";\nimport { callFunctionMock, initMockResponse } from \"./mock/function-client.js\";\nimport { ServiceCallController } from \"../service-call-controller2.js\";\nimport { getFirestorageFileList, initFirestorage, uploadFirestorageFile } from \"./firebase/firestorage-client.js\";\nimport { getMockFileList, initStorageMock, uploadStorageFileMock } from \"./mock/storage-client.js\";\n\nlet provider: ServiceProviderConfiguration | undefined;\nlet controller: ServiceCallController;\n\nconst throwUndefinedProviderError = () => {\n throw new Error(\"Undefined service provider, please check configuration. 'firebase' or 'mock' allowed here.\");\n}\n\n/* #####################\n * Init Implementation\n * ##################### */\n\nexport const setServiceProvider = (providerParam?: ServiceProviderConfiguration) => {\n provider = providerParam;\n}\n\nexport const initController = (controllerParam: ServiceCallController) => {\n controller = controllerParam\n}\n\nconst initFirebaseApplicationServices = (\n firebaseApp: FirebaseApp, \n functionsConfig: FunctionsConfig, \n firebaseConfig: FirebaseOptions,\n storageConfig?: FileStorageConfig, \n) => {\n // do something with the app, init db, firestore and functions \n initAuth(firebaseApp);\n initFunctions(firebaseApp, functionsConfig);\n initFirestore(firebaseApp); \n initFirestorage(firebaseApp, firebaseConfig.storageBucket, storageConfig);\n\n console.log(\"Firebase App with functions, firestore and firestorage initialized\"); \n}\n\nexport const initAppImpl = (config: AppConfiguration) => {\n\n if (provider === \"firebase\" && config.firebaseConfig) {\n const app:FirebaseApp = initializeApp(config.firebaseConfig);\n if (config.functionsConfig) { // TODO: invalid if only storage config exists\n // init application services (functions, store) \n initFirebaseApplicationServices(app, config.functionsConfig, config.firebaseConfig, config.storageConfig);\n }\n } else if (provider === \"mock\") {\n initMockResponse(config.mock);\n initStorageMock(\"default\", config.storageConfig);\n } else {\n throwUndefinedProviderError();\n }\n}\n\n/* #####################\n * Functions Implementation\n * ##################### */\nexport const callFunctionImpl = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {\n \n const callController = (promise: Promise<any>) => {\n if (controller) {\n controller.callDataPromise = {func: def, promise};\n }\n }\n \n if (provider === \"firebase\") {\n const promise = callFunction(def, functionInput)\n callController(promise);\n return promise;\n } \n if (provider === \"mock\") {\n const promise = callFunctionMock(def, functionInput)\n callController(promise);\n return promise;\n }\n\n return throwUndefinedProviderError(); \n}\n\n\n\n/* #####################\n * Auth Implementation\n * ##################### */\n\n\nexport const authStateChangedImpl = (\n callback: Function\n) => {\n if (provider === \"firebase\") {\n authStateChanged(callback);\n } else if (provider === \"mock\") {\n authStateChangedMock();\n } else {\n throwUndefinedProviderError();\n }\n}\n\nexport const isAuthenticatedImpl = () => {\n if (provider === \"firebase\") {\n return isAuthenticated();\n } \n if (provider === \"mock\") {\n return isAuthenticatedMock();\n } \n return throwUndefinedProviderError(); \n}\n\nexport const loginImpl = (user: string, sec: string) => {\n\n if (!user) { \n const returnError = new Error(\"empty user\");\n return Promise.reject(returnError);\n }\n if (!sec) {\n const returnError = new Error(\"empty password\");\n return Promise.reject(returnError);\n }\n\n if (provider === \"firebase\") {\n return login(user, sec);\n } \n if (provider === \"mock\") {\n return loginMock(user, sec);\n } \n return throwUndefinedProviderError(); \n}\n\nexport const logoutImpl = () => {\n if (provider === \"firebase\") {\n return logout();\n } \n if (provider === \"mock\") {\n return logoutMock();\n } \n return throwUndefinedProviderError(); \n}\n\n/* #####################\n * Storage Implementation\n * ##################### */\nexport const uploadFile = (file: UploadFile): Promise<unknown> => { \n if (provider === \"firebase\") {\n return uploadFirestorageFile(file); \n } \n if (provider === \"mock\") {\n return uploadStorageFileMock(file)\n }\n return throwUndefinedProviderError(); \n}\n\nexport const getStorageFileList = (\n storageName: string, \n keyRef: string, \n subFolder?: string, \n includeMetadata?:boolean\n): Promise<StorageDocument[]> => { \n if (provider === \"firebase\") {\n return getFirestorageFileList(storageName, keyRef, subFolder, includeMetadata);\n }\n if (provider === \"mock\") {\n return getMockFileList(storageName, keyRef, subFolder, includeMetadata);\n }\n return throwUndefinedProviderError(); \n}"]}
1
+ {"version":3,"file":"service-provider-impl.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC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,KAAK,UAAU,EAAE;QAC3B,OAAO,MAAM,EAAE,CAAC;KACjB;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,UAAU,EAAE,CAAC;KACrB;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IAC1B,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,WAAW,EAAE,CAAC;KACtB;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,eAAe,EAAE,CAAC;KAC1B;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA;AAED;;2BAE2B;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAoB,EAAE;IAC/D,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;KACpC;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAA;KACnC;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAmB,EACnB,MAAc,EACd,SAAkB,EAClB,eAAwB,EACI,EAAE;IAC9B,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;KAChF;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;KACzE;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA","sourcesContent":["import { FirebaseApp, FirebaseOptions, initializeApp } from \"firebase/app\";\n\nimport { authStateChanged, getAuthUser, initAuth, isAuthenticated, login, logout } from \"./firebase/auth.js\";\nimport { authStateChangedMock, getAuthUserMock, isAuthenticatedMock, loginMock, logoutMock } from \"./mock/auth.js\";\nimport { AppConfiguration, FileStorageConfig, FunctionDefinition, FunctionResult, FunctionsConfig, ServiceProviderConfiguration, StorageDocument, UploadFile } from \"./service-provider-model.js\";\nimport { callFunction, initFunctions } from \"./firebase/functions-client.js\";\nimport { initFirestore } from \"./firebase/firestore-client.js\";\nimport { callFunctionMock, initMockResponse } from \"./mock/function-client.js\";\nimport { ServiceCallController } from \"../service-call-controller2.js\";\nimport { getFirestorageFileList, initFirestorage, uploadFirestorageFile } from \"./firebase/firestorage-client.js\";\nimport { getMockFileList, initStorageMock, uploadStorageFileMock } from \"./mock/storage-client.js\";\n\nlet provider: ServiceProviderConfiguration | undefined;\nlet controller: ServiceCallController;\n\nconst throwUndefinedProviderError = () => {\n throw new Error(\"Undefined service provider, please check configuration. 'firebase' or 'mock' allowed here.\");\n}\n\n/* #####################\n * Init Implementation\n * ##################### */\n\nexport const setServiceProvider = (providerParam?: ServiceProviderConfiguration) => {\n provider = providerParam;\n}\n\nexport const initController = (controllerParam: ServiceCallController) => {\n controller = controllerParam\n}\n\nconst initFirebaseApplicationServices = (\n firebaseApp: FirebaseApp, \n functionsConfig: FunctionsConfig, \n firebaseConfig: FirebaseOptions,\n storageConfig?: FileStorageConfig, \n) => {\n // do something with the app, init db, firestore and functions \n initAuth(firebaseApp);\n initFunctions(firebaseApp, functionsConfig);\n initFirestore(firebaseApp); \n initFirestorage(firebaseApp, firebaseConfig.storageBucket, storageConfig);\n\n console.log(\"Firebase App with functions, firestore and firestorage initialized\"); \n}\n\nexport const initAppImpl = (config: AppConfiguration) => {\n\n if (provider === \"firebase\" && config.firebaseConfig) {\n const app:FirebaseApp = initializeApp(config.firebaseConfig);\n if (config.functionsConfig) { // TODO: invalid if only storage config exists\n // init application services (functions, store) \n initFirebaseApplicationServices(app, config.functionsConfig, config.firebaseConfig, config.storageConfig);\n }\n } else if (provider === \"mock\") {\n initMockResponse(config.mock);\n initStorageMock(\"default\", config.storageConfig);\n } else {\n throwUndefinedProviderError();\n }\n}\n\n/* #####################\n * Functions Implementation\n * ##################### */\nexport const callFunctionImpl = async (def: FunctionDefinition, functionInput: any): Promise<FunctionResult> => {\n \n const callController = (promise: Promise<any>) => {\n if (controller) {\n controller.callDataPromise = {func: def, promise};\n }\n }\n \n if (provider === \"firebase\") {\n const promise = callFunction(def, functionInput)\n callController(promise);\n return promise;\n } \n if (provider === \"mock\") {\n const promise = callFunctionMock(def, functionInput)\n callController(promise);\n return promise;\n }\n\n return throwUndefinedProviderError(); \n}\n\n\n\n/* #####################\n * Auth Implementation\n * ##################### */\n\n\nexport const authStateChangedImpl = (\n callback: Function\n) => {\n if (provider === \"firebase\") {\n authStateChanged(callback);\n } else if (provider === \"mock\") {\n authStateChangedMock();\n } else {\n throwUndefinedProviderError();\n }\n}\n\nexport const isAuthenticatedImpl = () => {\n if (provider === \"firebase\") {\n return isAuthenticated();\n } \n if (provider === \"mock\") {\n return isAuthenticatedMock();\n } \n return throwUndefinedProviderError(); \n}\n\nexport const loginImpl = (user: string, sec: string) => {\n\n if (!user) { \n const returnError = new Error(\"empty user\");\n return Promise.reject(returnError);\n }\n if (!sec) {\n const returnError = new Error(\"empty password\");\n return Promise.reject(returnError);\n }\n\n if (provider === \"firebase\") {\n return login(user, sec);\n } \n if (provider === \"mock\") {\n return loginMock(user, sec);\n } \n return throwUndefinedProviderError(); \n}\n\nexport const logoutImpl = () => {\n if (provider === \"firebase\") {\n return logout();\n } \n if (provider === \"mock\") {\n return logoutMock();\n } \n return throwUndefinedProviderError(); \n};\n\n// Refactor: Return defined USer Object\nexport const getUser = () => {\n if (provider === \"firebase\") {\n return getAuthUser();\n } \n if (provider === \"mock\") {\n return getAuthUserMock();\n } \n return throwUndefinedProviderError(); \n}\n\n/* #####################\n * Storage Implementation\n * ##################### */\nexport const uploadFile = (file: UploadFile): Promise<unknown> => { \n if (provider === \"firebase\") {\n return uploadFirestorageFile(file); \n } \n if (provider === \"mock\") {\n return uploadStorageFileMock(file)\n }\n return throwUndefinedProviderError(); \n}\n\nexport const getStorageFileList = (\n storageName: string, \n keyRef: string, \n subFolder?: string, \n includeMetadata?:boolean\n): Promise<StorageDocument[]> => { \n if (provider === \"firebase\") {\n return getFirestorageFileList(storageName, keyRef, subFolder, includeMetadata);\n }\n if (provider === \"mock\") {\n return getMockFileList(storageName, keyRef, subFolder, includeMetadata);\n }\n return throwUndefinedProviderError(); \n}"]}
@@ -109,10 +109,12 @@ export interface StorageMetadata {
109
109
  }
110
110
  export interface StorageDocument {
111
111
  fileName: string;
112
- documentType: string;
113
112
  filePath: string;
113
+ documentType?: string;
114
114
  description?: string;
115
+ descriptionName?: string;
115
116
  creation?: Date;
116
117
  creator?: string;
118
+ size?: number;
117
119
  metaData?: StorageMetadata;
118
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"service-provider-model.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-model.ts"],"names":[],"mappings":"","sourcesContent":["import { FirebaseOptions } from \"firebase/app\";\nimport { TemplateResult } from \"lit\";\n\n\n/**\n * Implemeted service provider\n */\nexport type ServiceProviderFirebase = \"firebase\";\nexport type ServiceProviderMock = \"mock\";\nexport type ServiceProviderConfiguration = ServiceProviderFirebase | ServiceProviderMock;\n\n\nexport interface FunctionResult {\n resultData: unknown,\n statusCode: number,\n}\n\n/**\n * Function model.\n */\n\nexport interface FunctionDefinition {\n name: string,\n successCodes: Array<Number>, \n // Fade window during function call (true) or show only background infos (false).\n fadeWindow: boolean,\n successTxt: string | TemplateResult,\n pendingTxt: string | TemplateResult,\n param?: any,\n redirect?: string,\n logoutOnFail?: boolean,\n}\n\nexport interface FunctionParam {\n func: FunctionDefinition,\n inputData: any,\n}\n\nexport interface FunctionsConfig {\n region: string, // 'europe-west3'\n functions: Array<FunctionDefinition>,\n postLoginFunc?: FunctionDefinition,\n}\n\n\n/**\n * App data models.\n */\n\nexport interface MenuElement {\n key: string,\n name: string,\n sec?: string,\n route?: string,\n action?: Function,\n topItem?: boolean,\n ref?: any,\n icon?: string,\n}\n\nexport interface NavigationPage {\n name: string,\n mainClass?: string,\n pattern: Array<string>, \n auth: boolean,\n menu?: Array<MenuElement>,\n topMenu?: Array<MenuElement>,\n withTeaser?: boolean,\n withFooter?: boolean\n hideMenu?: boolean\n hideTopMenu?: boolean\n topMenuItems?: Array<MenuElement>,\n}\n\nexport interface NavigationConfig {\n pages: Array<NavigationPage>,\n includeLogin: boolean\n}\n\nexport interface LinkObj {\n name: string,\n key: string,\n link?: string,\n action?: Function\n}\n\nexport interface Footer {\n version: string,\n links: Array<LinkObj>\n}\n\n\nexport interface StoreConfig {\n appName: string,\n reducer: any,\n effects: Array<any>\n}\n\nexport interface FileStorage {\n name: string,\n references: string[] \n}\n\nexport interface FileStorageConfig {\n storage: FileStorage[],\n}\n\nexport interface AppConfiguration { \n serviceProvider?: ServiceProviderConfiguration,\n mock?: {\n mockResponse?: Map<string, Function>,\n mockWaitTime?: number,\n }\n navigationConfigParam: NavigationConfig;\n storeConfigParam?: StoreConfig;\n firebaseConfig?: FirebaseOptions;\n storageConfig?: FileStorageConfig;\n functionsConfig?: FunctionsConfig;\n}\n\nexport interface UploadFile { \n fileName: string, \n base64DataURL:string,\n descriptionName:string,\n description:string,\n storageName: string\n referenceKey: string\n subFolderName?: string,\n}\n\nexport interface StorageMetadata {\n\n}\n\nexport interface StorageDocument {\n fileName: string,\n documentType: string,\n filePath: string,\n description?:string, \n creation?:Date,\n creator?:string,\n metaData?: StorageMetadata\n}"]}
1
+ {"version":3,"file":"service-provider-model.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-model.ts"],"names":[],"mappings":"","sourcesContent":["import { FirebaseOptions } from \"firebase/app\";\nimport { TemplateResult } from \"lit\";\n\n\n/**\n * Implemeted service provider\n */\nexport type ServiceProviderFirebase = \"firebase\";\nexport type ServiceProviderMock = \"mock\";\nexport type ServiceProviderConfiguration = ServiceProviderFirebase | ServiceProviderMock;\n\n\nexport interface FunctionResult {\n resultData: unknown,\n statusCode: number,\n}\n\n/**\n * Function model.\n */\n\nexport interface FunctionDefinition {\n name: string,\n successCodes: Array<Number>, \n // Fade window during function call (true) or show only background infos (false).\n fadeWindow: boolean,\n successTxt: string | TemplateResult,\n pendingTxt: string | TemplateResult,\n param?: any,\n redirect?: string,\n logoutOnFail?: boolean,\n}\n\nexport interface FunctionParam {\n func: FunctionDefinition,\n inputData: any,\n}\n\nexport interface FunctionsConfig {\n region: string, // 'europe-west3'\n functions: Array<FunctionDefinition>,\n postLoginFunc?: FunctionDefinition,\n}\n\n\n/**\n * App data models.\n */\n\nexport interface MenuElement {\n key: string,\n name: string,\n sec?: string,\n route?: string,\n action?: Function,\n topItem?: boolean,\n ref?: any,\n icon?: string,\n}\n\nexport interface NavigationPage {\n name: string,\n mainClass?: string,\n pattern: Array<string>, \n auth: boolean,\n menu?: Array<MenuElement>,\n topMenu?: Array<MenuElement>,\n withTeaser?: boolean,\n withFooter?: boolean\n hideMenu?: boolean\n hideTopMenu?: boolean\n topMenuItems?: Array<MenuElement>,\n}\n\nexport interface NavigationConfig {\n pages: Array<NavigationPage>,\n includeLogin: boolean\n}\n\nexport interface LinkObj {\n name: string,\n key: string,\n link?: string,\n action?: Function\n}\n\nexport interface Footer {\n version: string,\n links: Array<LinkObj>\n}\n\n\nexport interface StoreConfig {\n appName: string,\n reducer: any,\n effects: Array<any>\n}\n\nexport interface FileStorage {\n name: string,\n references: string[] \n}\n\nexport interface FileStorageConfig {\n storage: FileStorage[],\n}\n\nexport interface AppConfiguration { \n serviceProvider?: ServiceProviderConfiguration,\n mock?: {\n mockResponse?: Map<string, Function>,\n mockWaitTime?: number,\n }\n navigationConfigParam: NavigationConfig;\n storeConfigParam?: StoreConfig;\n firebaseConfig?: FirebaseOptions;\n storageConfig?: FileStorageConfig;\n functionsConfig?: FunctionsConfig;\n}\n\nexport interface UploadFile { \n fileName: string, \n base64DataURL:string,\n descriptionName:string,\n description:string,\n storageName: string\n referenceKey: string\n subFolderName?: string,\n}\n\nexport interface StorageMetadata {\n\n}\n\nexport interface StorageDocument {\n fileName: string, \n filePath: string,\n documentType?: string, \n description?:string, \n descriptionName?: string,\n creation?:Date,\n creator?:string,\n size?: number,\n metaData?: StorageMetadata\n}"]}
@@ -21,4 +21,4 @@ export declare const initDB: (config: {
21
21
  keyPath?: string;
22
22
  };
23
23
  }[];
24
- }, successCallback: Function) => void;
24
+ }) => void;