@progressive-development/pd-spa-helper 0.3.44 → 0.3.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/PdSpaHelper.js +0 -1
- package/dist/src/PdSpaHelper.js.map +1 -1
- package/dist/src/service-provider/firebase/messagingFirebaseClient.d.ts +2 -6
- package/dist/src/service-provider/firebase/messagingFirebaseClient.js +31 -37
- package/dist/src/service-provider/firebase/messagingFirebaseClient.js.map +1 -1
- package/dist/src/service-provider/service-provider-impl.js +3 -3
- package/dist/src/service-provider/service-provider-impl.js.map +1 -1
- package/dist/src/store/mini-rx.store.js +2 -1
- package/dist/src/store/mini-rx.store.js.map +1 -1
- package/dist/src/store/spa-app-actions.d.ts +29 -0
- package/dist/src/store/spa-app-actions.js +3 -0
- package/dist/src/store/spa-app-actions.js.map +1 -1
- package/dist/src/store/spa-app-effects.d.ts +7 -0
- package/dist/src/store/spa-app-effects.js +7 -1
- package/dist/src/store/spa-app-effects.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/PdSpaHelper.ts +0 -3
- package/src/service-provider/firebase/messagingFirebaseClient.ts +31 -46
- package/src/service-provider/service-provider-impl.ts +4 -3
- package/src/store/mini-rx.store.ts +3 -2
- package/src/store/spa-app-actions.ts +10 -1
- package/src/store/spa-app-effects.ts +13 -1
package/dist/src/PdSpaHelper.js
CHANGED
|
@@ -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;AAM7C,OAAO,6CAA6C,CAAC;AACrD,O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;kDACL;AAMnC;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;AAmZjC,qEAAqE;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CE","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 { initializeStore, pdStore } from './store/mini-rx.store.js';\n\nimport { authStateChangedImpl, initAppImpl, isAuthenticatedImpl, setServiceProvider } from './service-provider/service-provider-impl.js';\nimport { AppConfiguration, Footer, 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, nologin } 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 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 } else {\n pdStore().dispatch(nologin());\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.map(ls => html`<pd-loading-state .loadingState=\"${ls}\"></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 ${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 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}\n\n // Refactor: deactivate functions controller unwanted with new loader\n /* \n protected functionsController = new ServiceCallController(this);\n \n // from render\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 * 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 */"]}
|
|
1
|
+
{"version":3,"file":"PdSpaHelper.js","sourceRoot":"","sources":["../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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;kDACL;AAMnC;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;AAmZjC,qEAAqE;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CE","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 '@progressive-development/pd-page/pd-menu.js';\nimport '@progressive-development/pd-page/pd-footer.js';\n\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, 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, nologin } 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 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 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 } else {\n pdStore().dispatch(nologin());\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.map(ls => html`<pd-loading-state .loadingState=\"${ls}\"></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 ${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 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}\n\n // Refactor: deactivate functions controller unwanted with new loader\n /* \n protected functionsController = new ServiceCallController(this);\n \n // from render\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 * 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 */"]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { FirebaseApp } from "firebase/app";
|
|
2
2
|
import { MessagingConfig } from "../service-provider-model.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* @param {*} app - initialized app.
|
|
7
|
-
*/
|
|
8
|
-
export declare const initFirebaseMessaging: (app: FirebaseApp, messageConfig: MessagingConfig) => void;
|
|
3
|
+
export declare const NOTIFICATION_TOKEN = "pd.spa.helper.notification.token";
|
|
4
|
+
export declare function registerDevice(app: FirebaseApp, messageConfig: MessagingConfig): Promise<void>;
|
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
import { getMessaging, getToken
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { getMessaging, getToken } from "firebase/messaging";
|
|
2
|
+
import { pdStore } from "../../store/mini-rx.store.js";
|
|
3
|
+
import { updateNewNotificationToken } from "../../store/spa-app-actions.js";
|
|
4
|
+
export const NOTIFICATION_TOKEN = "pd.spa.helper.notification.token";
|
|
5
|
+
// Funktion zur Anfrage der Berechtigung
|
|
6
|
+
async function ensureNotificationPermission() {
|
|
7
|
+
if (Notification.permission === "default") {
|
|
8
|
+
return Notification.requestPermission();
|
|
9
|
+
}
|
|
10
|
+
return Notification.permission;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
export async function registerDevice(app, messageConfig) {
|
|
13
|
+
try {
|
|
14
|
+
const messaging = getMessaging(app);
|
|
15
|
+
const permission = await ensureNotificationPermission();
|
|
16
|
+
if (permission === "granted") {
|
|
17
|
+
const currentToken = await getToken(messaging, { vapidKey: messageConfig.apidKey });
|
|
18
|
+
const storedToken = localStorage.getItem(NOTIFICATION_TOKEN);
|
|
19
|
+
if (currentToken && storedToken !== currentToken) {
|
|
20
|
+
pdStore().dispatch(updateNewNotificationToken({
|
|
21
|
+
messagingToken: currentToken
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.warn("No token received - no new token was generated.");
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
else {
|
|
28
|
-
|
|
29
|
-
console.log('No registration token available. Request permission to generate one.');
|
|
30
|
-
requestPermission();
|
|
29
|
+
console.warn("Notifications were either not allowed or permanently denied.");
|
|
31
30
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onMessage(messagingRef, (payload) => {
|
|
38
|
-
console.log('Message received. ', payload);
|
|
39
|
-
// ...
|
|
40
|
-
});
|
|
41
|
-
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error("Error during device registration:", error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
42
36
|
//# sourceMappingURL=messagingFirebaseClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messagingFirebaseClient.js","sourceRoot":"","sources":["../../../../src/service-provider/firebase/messagingFirebaseClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"messagingFirebaseClient.js","sourceRoot":"","sources":["../../../../src/service-provider/firebase/messagingFirebaseClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI5D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AAErE,wCAAwC;AACxC,KAAK,UAAU,4BAA4B;IACzC,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;QACzC,OAAO,YAAY,CAAC,iBAAiB,EAAE,CAAC;KACzC;IACD,OAAO,YAAY,CAAC,UAAU,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAgB,EAChB,aAA8B;IAE9B,IAAI;QACF,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,MAAM,4BAA4B,EAAE,CAAC;QACxD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YACpF,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;YAC7D,IAAI,YAAY,IAAI,WAAW,KAAK,YAAY,EAAE;gBAChD,OAAO,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;oBAC5C,cAAc,EAAE,YAAY;iBAC7B,CAAC,CAAC,CAAC;aACL;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;aACjE;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;SAC9E;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;KAC3D;AACH,CAAC","sourcesContent":["import { FirebaseApp } from \"firebase/app\";\nimport { getMessaging, getToken } from \"firebase/messaging\";\n\nimport { MessagingConfig } from \"../service-provider-model.js\";\n\nimport { pdStore } from \"../../store/mini-rx.store.js\";\nimport { updateNewNotificationToken } from \"../../store/spa-app-actions.js\";\n\nexport const NOTIFICATION_TOKEN = \"pd.spa.helper.notification.token\";\n\n// Funktion zur Anfrage der Berechtigung\nasync function ensureNotificationPermission(): Promise<\"default\" | \"denied\" | \"granted\"> {\n if (Notification.permission === \"default\") {\n return Notification.requestPermission();\n }\n return Notification.permission;\n}\n\nexport async function registerDevice(\n app: FirebaseApp,\n messageConfig: MessagingConfig\n) {\n try {\n const messaging = getMessaging(app);\n const permission = await ensureNotificationPermission();\n if (permission === \"granted\") {\n const currentToken = await getToken(messaging, { vapidKey: messageConfig.apidKey });\n const storedToken = localStorage.getItem(NOTIFICATION_TOKEN);\n if (currentToken && storedToken !== currentToken) {\n pdStore().dispatch(updateNewNotificationToken({\n messagingToken: currentToken\n }));\n } else {\n console.warn(\"No token received - no new token was generated.\");\n }\n } else {\n console.warn(\"Notifications were either not allowed or permanently denied.\");\n }\n } catch (error) {\n console.error(\"Error during device registration:\", error);\n }\n}"]}
|
|
@@ -6,7 +6,7 @@ import { getFirebaseCollectionListener, initFirestore } from "./firebase/firesto
|
|
|
6
6
|
import { callFunctionMock, initMockResponse } from "./mock/function-client.js";
|
|
7
7
|
import { deleteFirestorageDocument, downloadFileFirestorage, getFirestorageFile, getFirestorageFileList, initFirestorage, uploadFirestorageFile } from "./firebase/firestorage-client.js";
|
|
8
8
|
import { downloadFileMock, getMockFileList, initStorageMock, uploadStorageFileMock } from "./mock/storage-client.js";
|
|
9
|
-
import {
|
|
9
|
+
import { registerDevice } from "./firebase/messagingFirebaseClient.js";
|
|
10
10
|
let provider;
|
|
11
11
|
let controller;
|
|
12
12
|
const throwUndefinedProviderError = () => {
|
|
@@ -35,8 +35,8 @@ const initFirebaseApplicationServices = (firebaseApp, config) => {
|
|
|
35
35
|
console.debug("Init provider storage");
|
|
36
36
|
}
|
|
37
37
|
if (config.messagingConfig) {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
registerDevice(firebaseApp, config.messagingConfig)
|
|
39
|
+
.then(() => console.debug(`complet registerDevice, right is ${Notification.permission}`));
|
|
40
40
|
}
|
|
41
41
|
console.debug("Firebase initialized");
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-provider-impl.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKnH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC1L,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACrH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,IAAI,QAAkD,CAAC;AACvD,IAAI,UAAiC,CAAC;AAEtC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IACvC,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;AAChH,CAAC,CAAA;AAED;;2BAE2B;AAE3B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAA4C,EAAE,EAAE;IACjF,QAAQ,GAAG,aAAa,CAAC;AAC3B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,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAqB,EAAoB,EAAE;IACpE,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;KACxC;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAA;AAED;;+CAE+C;AAC/C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,QAAkB,EAAE,GAAW,EAAE,WAAkC,EACnE,EAAE;IACF,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,6BAA6B,CAAC,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;KAClE;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO,EAAE,CAAC;KACX;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC,CAAC","sourcesContent":["import { FirebaseApp, 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 { \n AppConfiguration, CollectionContraint, FunctionDefinition, FunctionResult, \n ServiceProviderConfiguration, StorageDocument, UploadFile \n} from \"./service-provider-model.js\";\nimport { callFunction, initFunctions } from \"./firebase/functions-client.js\";\nimport { getFirebaseCollectionListener, initFirestore } from \"./firebase/firestore-client.js\";\nimport { callFunctionMock, initMockResponse } from \"./mock/function-client.js\";\nimport { ServiceCallController } from \"../service-call-controller2.js\";\nimport { deleteFirestorageDocument, downloadFileFirestorage, getFirestorageFile, getFirestorageFileList, initFirestorage, uploadFirestorageFile } from \"./firebase/firestorage-client.js\";\nimport { downloadFileMock, getMockFileList, initStorageMock, uploadStorageFileMock } from \"./mock/storage-client.js\";\nimport { initFirebaseMessaging } from \"./firebase/messagingFirebaseClient.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 config: AppConfiguration\n) => {\n \n // ToDo: Init only of needed\n initAuth(firebaseApp);\n initFirestore(firebaseApp);\n\n if (config.functionsConfig) {\n initFunctions(firebaseApp, config.functionsConfig);\n console.debug(\"Init provider functions\");\n }\n\n if (config.firebaseConfig?.storageBucket && config.storageConfig) {\n initFirestorage(\n firebaseApp, \n config.firebaseConfig?.storageBucket, \n config.storageConfig\n );\n console.debug(\"Init provider storage\");\n }\n\n if (config.messagingConfig) {\n initFirebaseMessaging(firebaseApp, config.messagingConfig);\n console.debug(\"Init provider messaging\");\n }\n\n console.debug(\"Firebase initialized\"); \n}\n\nexport const initAppImpl = (config: AppConfiguration) => {\n\n if (provider === \"firebase\" && config.firebaseConfig) {\n const app:FirebaseApp = initializeApp(config.firebaseConfig); \n // init application services (functions, store) \n initFirebaseApplicationServices(\n app, \n config\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(callback);\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}\n\nexport const getStorageFile = ( \n storageName: string, \n refKey:string,\n storageURI: string,\n includeMetaData: boolean,\n): Promise<StorageDocument> => { \n if (provider === \"firebase\") {\n return getFirestorageFile(\n storageName, refKey, storageURI, includeMetaData \n );\n }\n return throwUndefinedProviderError(); \n}\n\nexport const downloadFile = (file: StorageDocument): Promise<unknown> => { \n if (provider === \"firebase\") {\n return downloadFileFirestorage(file);\n } \n if (provider === \"mock\") {\n return downloadFileMock(file)\n }\n return throwUndefinedProviderError(); \n}\n\nexport const deleteFile = (file: StorageDocument): Promise<unknown> => { \n if (provider === \"firebase\") {\n return deleteFirestorageDocument(file);\n }\n return throwUndefinedProviderError(); \n}\n\n/* #########################################\n * Remote Database Implementation\n * ######################################### */\nexport const activateCollectionListener = (\n callback: Function, col: string, constraints?:CollectionContraint[]\n) => { \n if (provider === \"firebase\") {\n return getFirebaseCollectionListener(callback, col, constraints);\n } \n if (provider === \"mock\") {\n console.log(\"getCollectionListener not implemented for MOCK, do noting\");\n return \"\";\n }\n return throwUndefinedProviderError();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"service-provider-impl.js","sourceRoot":"","sources":["../../../src/service-provider/service-provider-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKnH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,kB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initAuth, isAuthenticated, login, logout } from \"./firebase/auth.js\";\nimport { authStateChangedMock, getAuthUserMock, isAuthenticatedMock, loginMock, logoutMock } from \"./mock/auth.js\";\nimport { \n AppConfiguration, CollectionContraint, FunctionDefinition, FunctionResult, \n ServiceProviderConfiguration, StorageDocument, UploadFile \n} from \"./service-provider-model.js\";\nimport { callFunction, initFunctions } from \"./firebase/functions-client.js\";\nimport { getFirebaseCollectionListener, initFirestore } from \"./firebase/firestore-client.js\";\nimport { callFunctionMock, initMockResponse } from \"./mock/function-client.js\";\nimport { ServiceCallController } from \"../service-call-controller2.js\";\nimport { deleteFirestorageDocument, downloadFileFirestorage, getFirestorageFile, getFirestorageFileList, initFirestorage, uploadFirestorageFile } from \"./firebase/firestorage-client.js\";\nimport { downloadFileMock, getMockFileList, initStorageMock, uploadStorageFileMock } from \"./mock/storage-client.js\";\nimport { registerDevice } from \"./firebase/messagingFirebaseClient.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 config: AppConfiguration\n) => {\n \n // ToDo: Init only of needed\n initAuth(firebaseApp);\n initFirestore(firebaseApp);\n\n if (config.functionsConfig) {\n initFunctions(firebaseApp, config.functionsConfig);\n console.debug(\"Init provider functions\");\n }\n\n if (config.firebaseConfig?.storageBucket && config.storageConfig) {\n initFirestorage(\n firebaseApp, \n config.firebaseConfig?.storageBucket, \n config.storageConfig\n );\n console.debug(\"Init provider storage\");\n }\n\n if (config.messagingConfig) {\n registerDevice(firebaseApp, config.messagingConfig)\n .then(() => console.debug(`complet registerDevice, right is ${Notification.permission}`));\n \n }\n\n console.debug(\"Firebase initialized\"); \n}\n\nexport const initAppImpl = (config: AppConfiguration) => {\n\n if (provider === \"firebase\" && config.firebaseConfig) {\n const app:FirebaseApp = initializeApp(config.firebaseConfig); \n // init application services (functions, store) \n initFirebaseApplicationServices(\n app, \n config\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(callback);\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}\n\nexport const getStorageFile = ( \n storageName: string, \n refKey:string,\n storageURI: string,\n includeMetaData: boolean,\n): Promise<StorageDocument> => { \n if (provider === \"firebase\") {\n return getFirestorageFile(\n storageName, refKey, storageURI, includeMetaData \n );\n }\n return throwUndefinedProviderError(); \n}\n\nexport const downloadFile = (file: StorageDocument): Promise<unknown> => { \n if (provider === \"firebase\") {\n return downloadFileFirestorage(file);\n } \n if (provider === \"mock\") {\n return downloadFileMock(file)\n }\n return throwUndefinedProviderError(); \n}\n\nexport const deleteFile = (file: StorageDocument): Promise<unknown> => { \n if (provider === \"firebase\") {\n return deleteFirestorageDocument(file);\n }\n return throwUndefinedProviderError(); \n}\n\n/* #########################################\n * Remote Database Implementation\n * ######################################### */\nexport const activateCollectionListener = (\n callback: Function, col: string, constraints?:CollectionContraint[]\n) => { \n if (provider === \"firebase\") {\n return getFirebaseCollectionListener(callback, col, constraints);\n } \n if (provider === \"mock\") {\n console.log(\"getCollectionListener not implemented for MOCK, do noting\");\n return \"\";\n }\n return throwUndefinedProviderError();\n};\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { configureStore, LoggerExtension, ReduxDevtoolsExtension, ImmutableStateExtension } from 'mini-rx-store';
|
|
2
2
|
import { spaAppReducer } from '../store/spa-app-reducer.js';
|
|
3
|
-
import { appRouteEffect } from '../store/spa-app-effects.js';
|
|
3
|
+
import { appRouteEffect, registerNotificationTokenSuccessEffect } from '../store/spa-app-effects.js';
|
|
4
4
|
let store;
|
|
5
5
|
const registerEffects = (effects) => {
|
|
6
6
|
if (store) {
|
|
7
7
|
// Register default app route effect
|
|
8
8
|
store.effect(appRouteEffect);
|
|
9
|
+
store.effect(registerNotificationTokenSuccessEffect);
|
|
9
10
|
// Register configured effects
|
|
10
11
|
effects.forEach(effect => store.effect(effect));
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mini-rx.store.js","sourceRoot":"","sources":["../../../src/store/mini-rx.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAS,eAAe,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"mini-rx.store.js","sourceRoot":"","sources":["../../../src/store/mini-rx.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAS,eAAe,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAErG,IAAI,KAAY,CAAC;AAEjB,MAAM,eAAe,GAAG,CAAC,OAAc,EAAE,EAAE;IACzC,IAAI,KAAK,EAAE;QACT,oCAAoC;QACpC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC7B,KAAK,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC;QAErD,8BAA8B;QAC9B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KACjD;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACrE;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAkB,EAAE,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAExC,eAAe;IACf,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,cAAc,CAAC;YACrB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;gBACxB,MAAM,EAAE,aAAa;gBACrB,GAAG,KAAK,CAAC,OAAO;aACjB,CAAC,CAAC,CAAC;gBACF,MAAM,EAAE,aAAa;aACtB;YACD,UAAU,EAAE;gBACV,IAAI,eAAe,EAAE;gBACrB,IAAI,sBAAsB,CAAC;oBACzB,IAAI,EAAE,KAAK,CAAC,OAAO;iBACpB,CAAC;gBACF,IAAI,uBAAuB,EAAE;aAC9B;SACF,CAAC,CAAC;QAEH,sDAAsD;QACtD,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAChC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,GAAU,EAAE,CAAC,KAAK,CAAC","sourcesContent":["import { configureStore, Store, LoggerExtension, ReduxDevtoolsExtension, ImmutableStateExtension } from 'mini-rx-store';\nimport { StoreConfig } from '../service-provider/service-provider-model.js';\nimport { spaAppReducer } from '../store/spa-app-reducer.js';\nimport { appRouteEffect, registerNotificationTokenSuccessEffect } from '../store/spa-app-effects.js';\n\nlet store: Store;\n\nconst registerEffects = (effects: any[]) => {\n if (store) {\n // Register default app route effect\n store.effect(appRouteEffect);\n store.effect(registerNotificationTokenSuccessEffect);\n \n // Register configured effects\n effects.forEach(effect => store.effect(effect));\n } else {\n console.error(\"Store is not initialized. Cannot register effects.\");\n }\n};\n\nexport const initializeStore = (param: StoreConfig) => {\n console.log(\"Initialize Store:\", param);\n\n // create store\n if (!store) {\n store = configureStore({ \n reducers: param.reducer ? {\n spaApp: spaAppReducer,\n ...param.reducer\n } : {\n spaApp: spaAppReducer \n },\n extensions: [\n new LoggerExtension(),\n new ReduxDevtoolsExtension({\n name: param.appName\n }),\n new ImmutableStateExtension()\n ],\n });\n\n // register default effects after store is initialized\n registerEffects(param.effects);\n }\n};\n\nexport const pdStore = (): Store => store;\n"]}
|
|
@@ -55,3 +55,32 @@ export declare const removeLoadingState: ((payload: string) => {
|
|
|
55
55
|
}) & {
|
|
56
56
|
type: "SPA_APP_REMOVE_LOADING";
|
|
57
57
|
};
|
|
58
|
+
export declare const updateNewNotificationToken: ((payload: {
|
|
59
|
+
messagingToken: string;
|
|
60
|
+
}) => {
|
|
61
|
+
payload: {
|
|
62
|
+
messagingToken: string;
|
|
63
|
+
};
|
|
64
|
+
} & {
|
|
65
|
+
type: "UPDATE_NOTIFICATION_TOKEN";
|
|
66
|
+
}) & {
|
|
67
|
+
type: "UPDATE_NOTIFICATION_TOKEN";
|
|
68
|
+
};
|
|
69
|
+
export declare const updateNewNotificationTokenSuccess: ((payload: {
|
|
70
|
+
messagingToken: string;
|
|
71
|
+
}) => {
|
|
72
|
+
payload: {
|
|
73
|
+
messagingToken: string;
|
|
74
|
+
};
|
|
75
|
+
} & {
|
|
76
|
+
type: "UPDATE_NOTIFICATION_TOKEN_SUCCESS";
|
|
77
|
+
}) & {
|
|
78
|
+
type: "UPDATE_NOTIFICATION_TOKEN_SUCCESS";
|
|
79
|
+
};
|
|
80
|
+
export declare const updateNewNotificationTokenFail: ((payload: Error) => {
|
|
81
|
+
payload: Error;
|
|
82
|
+
} & {
|
|
83
|
+
type: "UPDATE_NOTIFICATION_TOKEN_FAIL";
|
|
84
|
+
}) & {
|
|
85
|
+
type: "UPDATE_NOTIFICATION_TOKEN_FAIL";
|
|
86
|
+
};
|
|
@@ -7,4 +7,7 @@ export const updateInternetOffline = action('SPA_APP_UPDATE_INTERNET_OFFLINE', p
|
|
|
7
7
|
export const addLoadingState = action('SPA_APP_ADD_LOADING', payload());
|
|
8
8
|
export const changeSubTask = action('SPA_APP_CHANGE_SUB_LOADING', payload());
|
|
9
9
|
export const removeLoadingState = action('SPA_APP_REMOVE_LOADING', payload());
|
|
10
|
+
export const updateNewNotificationToken = action('UPDATE_NOTIFICATION_TOKEN', payload());
|
|
11
|
+
export const updateNewNotificationTokenSuccess = action('UPDATE_NOTIFICATION_TOKEN_SUCCESS', payload());
|
|
12
|
+
export const updateNewNotificationTokenFail = action('UPDATE_NOTIFICATION_TOKEN_FAIL', payload());
|
|
10
13
|
//# sourceMappingURL=spa-app-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-app-actions.js","sourceRoot":"","sources":["../../../src/store/spa-app-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,EAAE,OAAO,EAAU,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,iCAAiC,EAAE,OAAO,EAAW,CAAC,CAAC;AAEnG,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,OAAO,EAAgB,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,4BAA4B,EAAE,OAAO,EAGrE,CAAC,CAAC;AACN,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,wBAAwB,EAAE,OAAO,EAAU,CAAC,CAAC","sourcesContent":["import { action, payload } from 'ts-action';\nimport { LoadingState, LoadingSubTask } from '../model/spa-model.js';\n\nexport const initIndexDBSucess = action('SPA_INIT_INDEX_DB_SUCCESS');\nexport const loginSucess = action('SPA_LOGIN_SUCCESS');\nexport const nologin = action('SPA_NO_LOGIN');\n\nexport const routeAction = action('SPA_APP_ROUTE', payload<string>());\n\nexport const updateInternetOffline = action('SPA_APP_UPDATE_INTERNET_OFFLINE', payload<boolean>());\n\nexport const addLoadingState = action('SPA_APP_ADD_LOADING', payload<LoadingState>());\nexport const changeSubTask = action('SPA_APP_CHANGE_SUB_LOADING', payload<{\n loadingActionId: string,\n newTaskState: LoadingSubTask\n}>());\nexport const removeLoadingState = action('SPA_APP_REMOVE_LOADING', payload<string>())
|
|
1
|
+
{"version":3,"file":"spa-app-actions.js","sourceRoot":"","sources":["../../../src/store/spa-app-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,EAAE,OAAO,EAAU,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,iCAAiC,EAAE,OAAO,EAAW,CAAC,CAAC;AAEnG,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,qBAAqB,EAAE,OAAO,EAAgB,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,4BAA4B,EAAE,OAAO,EAGrE,CAAC,CAAC;AACN,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,wBAAwB,EAAE,OAAO,EAAU,CAAC,CAAC;AAGtF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,2BAA2B,EAAE,OAAO,EAEjF,CAAC,CAAC;AACN,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,mCAAmC,EAAE,OAAO,EAEhG,CAAC,CAAC;AACN,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,gCAAgC,EAAE,OAAO,EAAS,CAAC,CAAC","sourcesContent":["import { action, payload } from 'ts-action';\nimport { LoadingState, LoadingSubTask } from '../model/spa-model.js';\n\nexport const initIndexDBSucess = action('SPA_INIT_INDEX_DB_SUCCESS');\nexport const loginSucess = action('SPA_LOGIN_SUCCESS');\nexport const nologin = action('SPA_NO_LOGIN');\n\nexport const routeAction = action('SPA_APP_ROUTE', payload<string>());\n\nexport const updateInternetOffline = action('SPA_APP_UPDATE_INTERNET_OFFLINE', payload<boolean>());\n\nexport const addLoadingState = action('SPA_APP_ADD_LOADING', payload<LoadingState>());\nexport const changeSubTask = action('SPA_APP_CHANGE_SUB_LOADING', payload<{\n loadingActionId: string,\n newTaskState: LoadingSubTask\n}>());\nexport const removeLoadingState = action('SPA_APP_REMOVE_LOADING', payload<string>());\n\n\nexport const updateNewNotificationToken = action('UPDATE_NOTIFICATION_TOKEN', payload<{\n messagingToken: string\n}>());\nexport const updateNewNotificationTokenSuccess = action('UPDATE_NOTIFICATION_TOKEN_SUCCESS', payload<{\n messagingToken: string\n}>());\nexport const updateNewNotificationTokenFail = action('UPDATE_NOTIFICATION_TOKEN_FAIL', payload<Error>());\n"]}
|
|
@@ -4,3 +4,10 @@ export declare const appRouteEffect: import("rxjs").Observable<{
|
|
|
4
4
|
} & {
|
|
5
5
|
type: "SPA_APP_ROUTE";
|
|
6
6
|
}> & import("mini-rx-store/lib/models.js").HasEffectMetadata;
|
|
7
|
+
export declare const registerNotificationTokenSuccessEffect: import("rxjs").Observable<{
|
|
8
|
+
payload: {
|
|
9
|
+
messagingToken: string;
|
|
10
|
+
};
|
|
11
|
+
} & {
|
|
12
|
+
type: "UPDATE_NOTIFICATION_TOKEN_SUCCESS";
|
|
13
|
+
}> & import("mini-rx-store/lib/models.js").HasEffectMetadata;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { actions$, createEffect } from 'mini-rx-store';
|
|
2
2
|
import { tap } from 'rxjs/operators';
|
|
3
3
|
import { ofType } from 'ts-action-operators';
|
|
4
|
-
import { routeAction } from './spa-app-actions.js';
|
|
4
|
+
import { routeAction, updateNewNotificationTokenSuccess } from './spa-app-actions.js';
|
|
5
|
+
import { NOTIFICATION_TOKEN } from '../service-provider/firebase/messagingFirebaseClient.js';
|
|
5
6
|
let routeElement;
|
|
6
7
|
export const setRouteElement = (param) => {
|
|
7
8
|
routeElement = param;
|
|
@@ -21,4 +22,9 @@ export const appRouteEffect = createEffect(actions$.pipe(ofType(routeAction), ta
|
|
|
21
22
|
})), {
|
|
22
23
|
dispatch: false
|
|
23
24
|
});
|
|
25
|
+
export const registerNotificationTokenSuccessEffect = createEffect(actions$.pipe(ofType(updateNewNotificationTokenSuccess), tap((action) => {
|
|
26
|
+
localStorage.setItem(NOTIFICATION_TOKEN, action.payload.messagingToken);
|
|
27
|
+
})), {
|
|
28
|
+
dispatch: false
|
|
29
|
+
});
|
|
24
30
|
//# sourceMappingURL=spa-app-effects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spa-app-effects.js","sourceRoot":"","sources":["../../../src/store/spa-app-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EA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AM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AAC1E,CAAC,CAAC,CACH,EAAE;IACD,QAAQ,EAAE,KAAK;CAChB,CACF,CAAC","sourcesContent":["import { actions$, createEffect } from 'mini-rx-store';\n\nimport { tap } from 'rxjs/operators';\n\nimport { ofType } from 'ts-action-operators';\n\nimport { routeAction, updateNewNotificationTokenSuccess } from './spa-app-actions.js';\nimport { NOTIFICATION_TOKEN } from '../service-provider/firebase/messagingFirebaseClient.js';\n\n\nlet routeElement: HTMLElement;\n\nexport const setRouteElement = (param: HTMLElement) => {\n routeElement = param;\n}\n\n// remove loading task if all sub tasks done\n\n\nexport const appRouteEffect = createEffect(\n actions$.pipe(\n ofType(routeAction),\n tap((action) => {\n if (!routeElement) {\n console.error(\"No route element set for appRouteEffect\");\n } else { \n routeElement.dispatchEvent(new CustomEvent('route-event', {\n detail: {route: action.payload},\n bubbles: true,\n composed: true\n })); \n }\n })\n ), {\n dispatch: false\n }\n);\n\nexport const registerNotificationTokenSuccessEffect = createEffect(\n actions$.pipe(\n ofType(updateNewNotificationTokenSuccess),\n tap((action) => {\n localStorage.setItem(NOTIFICATION_TOKEN, action.payload.messagingToken);\n })\n ), {\n dispatch: false\n }\n);\n"]}
|