@sneat/app 0.2.0
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/environments/environment.base.d.ts +4 -0
- package/environments/environment.local.d.ts +2 -0
- package/environments/environment.prod.d.ts +3 -0
- package/environments/index.d.ts +1 -0
- package/esm2022/environments/environment.base.js +42 -0
- package/esm2022/environments/environment.base.js.map +1 -0
- package/esm2022/environments/environment.local.js +13 -0
- package/esm2022/environments/environment.local.js.map +1 -0
- package/esm2022/environments/environment.prod.js +16 -0
- package/esm2022/environments/environment.prod.js.map +1 -0
- package/esm2022/environments/index.js +2 -0
- package/esm2022/environments/index.js.map +1 -0
- package/esm2022/index.js +14 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/app-component.service.js +42 -0
- package/esm2022/lib/app-component.service.js.map +1 -0
- package/esm2022/lib/app-specific-providers.js +15 -0
- package/esm2022/lib/app-specific-providers.js.map +1 -0
- package/esm2022/lib/base-app.component.js +42 -0
- package/esm2022/lib/base-app.component.js.map +1 -0
- package/esm2022/lib/capacitator-http.service.js +47 -0
- package/esm2022/lib/capacitator-http.service.js.map +1 -0
- package/esm2022/lib/contact-extensions.js +3 -0
- package/esm2022/lib/contact-extensions.js.map +1 -0
- package/esm2022/lib/get-standard-sneat-imports.js +15 -0
- package/esm2022/lib/get-standard-sneat-imports.js.map +1 -0
- package/esm2022/lib/get-standard-sneat-providers.js +56 -0
- package/esm2022/lib/get-standard-sneat-providers.js.map +1 -0
- package/esm2022/lib/init-firebase.js +67 -0
- package/esm2022/lib/init-firebase.js.map +1 -0
- package/esm2022/lib/init-helpers.js +34 -0
- package/esm2022/lib/init-helpers.js.map +1 -0
- package/esm2022/lib/register-posthog.js +11 -0
- package/esm2022/lib/register-posthog.js.map +1 -0
- package/esm2022/lib/sneat-base-app.js +6 -0
- package/esm2022/lib/sneat-base-app.js.map +1 -0
- package/esm2022/sneat-app.js +5 -0
- package/esm2022/sneat-app.js.map +1 -0
- package/index.d.ts +13 -0
- package/lib/app-component.service.d.ts +14 -0
- package/lib/app-specific-providers.d.ts +5 -0
- package/lib/base-app.component.d.ts +10 -0
- package/lib/capacitator-http.service.d.ts +9 -0
- package/lib/contact-extensions.d.ts +16 -0
- package/lib/get-standard-sneat-imports.d.ts +2 -0
- package/lib/get-standard-sneat-providers.d.ts +3 -0
- package/lib/init-firebase.d.ts +4 -0
- package/lib/init-helpers.d.ts +3 -0
- package/lib/register-posthog.d.ts +2 -0
- package/lib/sneat-base-app.d.ts +5 -0
- package/package.json +26 -0
- package/sneat-app.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IEnvironmentConfig, IFirebaseEmulatorConfig } from '@sneat/core';
|
|
2
|
+
export declare const firebaseEmulatorConfig: IFirebaseEmulatorConfig;
|
|
3
|
+
export declare const notNeededForEmulator = "not-needed-for-emulator";
|
|
4
|
+
export declare const baseEnvironmentConfig: IEnvironmentConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { baseEnvironmentConfig } from './environment.base';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For easier debugging in development mode, you can import the following file
|
|
3
|
+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
4
|
+
*
|
|
5
|
+
* This import should be commented out in production mode because it will have a negative impact
|
|
6
|
+
* on performance if an error is thrown.
|
|
7
|
+
*/
|
|
8
|
+
// import 'zone.js/dist/zone-error';
|
|
9
|
+
const useNgrok = window.location.hostname.includes('.ngrok.');
|
|
10
|
+
const useSSL = useNgrok || window.location.hostname == 'local-app.sneat.ws';
|
|
11
|
+
// const nonSecureEmulatorHost = '127.0.0.1'; // 'localhost';
|
|
12
|
+
const nonSecureEmulatorHost = '127.0.0.1'; // 'localhost';
|
|
13
|
+
export const firebaseEmulatorConfig = {
|
|
14
|
+
authPort: useSSL ? 443 : 9099,
|
|
15
|
+
authHost: useNgrok
|
|
16
|
+
? window.location.hostname
|
|
17
|
+
: useSSL
|
|
18
|
+
? 'local-fb-auth.sneat.ws'
|
|
19
|
+
: nonSecureEmulatorHost,
|
|
20
|
+
firestorePort: useSSL ? 443 : 8080,
|
|
21
|
+
firestoreHost: useNgrok
|
|
22
|
+
? window.location.hostname
|
|
23
|
+
: useSSL
|
|
24
|
+
? 'local-firestore.sneat.ws'
|
|
25
|
+
: nonSecureEmulatorHost,
|
|
26
|
+
};
|
|
27
|
+
export const notNeededForEmulator = 'not-needed-for-emulator';
|
|
28
|
+
const firebaseConfig = {
|
|
29
|
+
emulator: firebaseEmulatorConfig,
|
|
30
|
+
apiKey: notNeededForEmulator,
|
|
31
|
+
authDomain: 'sneat.app',
|
|
32
|
+
projectId: 'local-sneat-app', // The 'demo-' prefix is added if useEmulators is true
|
|
33
|
+
appId: notNeededForEmulator,
|
|
34
|
+
measurementId: 'G-PROVIDE_IF_NEEDED',
|
|
35
|
+
};
|
|
36
|
+
export const baseEnvironmentConfig = {
|
|
37
|
+
production: false,
|
|
38
|
+
useNgrok,
|
|
39
|
+
agents: {},
|
|
40
|
+
firebaseConfig,
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=environment.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.base.js","sourceRoot":"","sources":["../../../../../libs/app/src/environments/environment.base.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,oCAAoC;AAEpC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,oBAAoB,CAAC;AAE5E,6DAA6D;AAC7D,MAAM,qBAAqB,GAAG,WAAW,CAAC,CAAC,eAAe;AAE1D,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;IAC7B,QAAQ,EAAE,QAAQ;QAChB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ;QAC1B,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,wBAAwB;YAC1B,CAAC,CAAC,qBAAqB;IAC3B,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;IAClC,aAAa,EAAE,QAAQ;QACrB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ;QAC1B,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,qBAAqB;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAE9D,MAAM,cAAc,GAAoB;IACtC,QAAQ,EAAE,sBAAsB;IAChC,MAAM,EAAE,oBAAoB;IAC5B,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,iBAAiB,EAAE,sDAAsD;IACpF,KAAK,EAAE,oBAAoB;IAC3B,aAAa,EAAE,qBAAqB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAuB;IACvD,UAAU,EAAE,KAAK;IACjB,QAAQ;IACR,MAAM,EAAE,EAAE;IACV,cAAc;CACf,CAAC","sourcesContent":["import {\n IEnvironmentConfig,\n IFirebaseConfig,\n IFirebaseEmulatorConfig,\n} from '@sneat/core';\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error';\n\nconst useNgrok = window.location.hostname.includes('.ngrok.');\nconst useSSL = useNgrok || window.location.hostname == 'local-app.sneat.ws';\n\n// const nonSecureEmulatorHost = '127.0.0.1'; // 'localhost';\nconst nonSecureEmulatorHost = '127.0.0.1'; // 'localhost';\n\nexport const firebaseEmulatorConfig: IFirebaseEmulatorConfig = {\n authPort: useSSL ? 443 : 9099,\n authHost: useNgrok\n ? window.location.hostname\n : useSSL\n ? 'local-fb-auth.sneat.ws'\n : nonSecureEmulatorHost,\n firestorePort: useSSL ? 443 : 8080,\n firestoreHost: useNgrok\n ? window.location.hostname\n : useSSL\n ? 'local-firestore.sneat.ws'\n : nonSecureEmulatorHost,\n};\n\nexport const notNeededForEmulator = 'not-needed-for-emulator';\n\nconst firebaseConfig: IFirebaseConfig = {\n emulator: firebaseEmulatorConfig,\n apiKey: notNeededForEmulator,\n authDomain: 'sneat.app',\n projectId: 'local-sneat-app', // The 'demo-' prefix is added if useEmulators is true\n appId: notNeededForEmulator,\n measurementId: 'G-PROVIDE_IF_NEEDED',\n};\n\nexport const baseEnvironmentConfig: IEnvironmentConfig = {\n production: false,\n useNgrok,\n agents: {},\n firebaseConfig,\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { baseEnvironmentConfig } from './environment.base';
|
|
2
|
+
/*
|
|
3
|
+
* For easier debugging in development mode, you can import the following file
|
|
4
|
+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
5
|
+
*
|
|
6
|
+
* This import should be commented out in production mode because it will have a negative impact
|
|
7
|
+
* on performance if an error is thrown.
|
|
8
|
+
*/
|
|
9
|
+
// import 'zone.js/dist/zone-error';
|
|
10
|
+
export const environmentConfig = {
|
|
11
|
+
...baseEnvironmentConfig,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=environment.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.local.js","sourceRoot":"","sources":["../../../../../libs/app/src/environments/environment.local.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D;;;;;;GAMG;AACH,oCAAoC;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,GAAG,qBAAqB;CACzB,CAAC","sourcesContent":["import { IEnvironmentConfig } from '@sneat/core';\nimport { baseEnvironmentConfig } from './environment.base';\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/dist/zone-error';\n\nexport const environmentConfig: IEnvironmentConfig = {\n ...baseEnvironmentConfig,\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// import { firebaseEmulatorConfig } from './environment.base';
|
|
2
|
+
export const firebaseConfigForSneatApp = {
|
|
3
|
+
// emulator: firebaseEmulatorConfig,
|
|
4
|
+
projectId: 'sneat-eur3-1',
|
|
5
|
+
appId: '1:588648831063:web:303af7e0c5f8a7b10d6b12',
|
|
6
|
+
apiKey: 'AIzaSyCeQu1WC182yD0VHrRm4nHUxVf27fY-MLQ',
|
|
7
|
+
authDomain: 'sneat.app',
|
|
8
|
+
messagingSenderId: '588648831063',
|
|
9
|
+
measurementId: 'G-TYBDTV738R',
|
|
10
|
+
};
|
|
11
|
+
export const prodEnvironmentConfig = {
|
|
12
|
+
production: true,
|
|
13
|
+
agents: {},
|
|
14
|
+
firebaseConfig: firebaseConfigForSneatApp,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=environment.prod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.prod.js","sourceRoot":"","sources":["../../../../../libs/app/src/environments/environment.prod.ts"],"names":[],"mappings":"AACA,+DAA+D;AAE/D,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,oCAAoC;IACpC,SAAS,EAAE,cAAc;IACzB,KAAK,EAAE,2CAA2C;IAClD,MAAM,EAAE,yCAAyC;IACjD,UAAU,EAAE,WAAW;IACvB,iBAAiB,EAAE,cAAc;IACjC,aAAa,EAAE,cAAc;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAuB;IACvD,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,EAAE;IACV,cAAc,EAAE,yBAAyB;CAC1C,CAAC","sourcesContent":["import { IEnvironmentConfig, IFirebaseConfig } from '@sneat/core';\n// import { firebaseEmulatorConfig } from './environment.base';\n\nexport const firebaseConfigForSneatApp: IFirebaseConfig = {\n // emulator: firebaseEmulatorConfig,\n projectId: 'sneat-eur3-1',\n appId: '1:588648831063:web:303af7e0c5f8a7b10d6b12',\n apiKey: 'AIzaSyCeQu1WC182yD0VHrRm4nHUxVf27fY-MLQ',\n authDomain: 'sneat.app',\n messagingSenderId: '588648831063',\n measurementId: 'G-TYBDTV738R',\n};\n\nexport const prodEnvironmentConfig: IEnvironmentConfig = {\n production: true,\n agents: {},\n firebaseConfig: firebaseConfigForSneatApp,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/app/src/environments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { baseEnvironmentConfig } from './environment.base';\n"]}
|
package/esm2022/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './environments';
|
|
2
|
+
export * from './lib/base-app.component';
|
|
3
|
+
export * from './lib/sneat-base-app';
|
|
4
|
+
export * from './lib/get-standard-sneat-imports';
|
|
5
|
+
export * from './lib/app-component.service';
|
|
6
|
+
export * from './environments/environment.local';
|
|
7
|
+
export * from './environments/environment.prod';
|
|
8
|
+
export * from './lib/init-firebase';
|
|
9
|
+
export * from './lib/init-helpers';
|
|
10
|
+
export * from './lib/contact-extensions';
|
|
11
|
+
export * from './lib/get-standard-sneat-providers';
|
|
12
|
+
export * from './lib/app-specific-providers';
|
|
13
|
+
export * from './lib/capacitator-http.service';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/app/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './environments';\nexport * from './lib/base-app.component';\nexport * from './lib/sneat-base-app';\nexport * from './lib/get-standard-sneat-imports';\nexport * from './lib/app-component.service';\nexport * from './environments/environment.local';\nexport * from './environments/environment.prod';\nexport * from './lib/init-firebase';\nexport * from './lib/init-helpers';\nexport * from './lib/contact-extensions';\nexport * from './lib/get-standard-sneat-providers';\nexport * from './lib/app-specific-providers';\nexport * from './lib/capacitator-http.service';\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Injectable, inject, InjectionToken } from '@angular/core';
|
|
2
|
+
import { Platform } from '@ionic/angular/standalone';
|
|
3
|
+
// import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
4
|
+
// import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
5
|
+
import { ErrorLogger } from '@sneat/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export const SplashScreen = new InjectionToken('SplashScreen');
|
|
8
|
+
export const StatusBar = new InjectionToken('StatusBar');
|
|
9
|
+
// TODO: check if it's used and probably remove
|
|
10
|
+
export class AppComponentService {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.platform = inject(Platform);
|
|
13
|
+
this.errorLogger = inject(ErrorLogger);
|
|
14
|
+
this.splashScreen = inject(SplashScreen, { optional: true });
|
|
15
|
+
this.statusBar = inject(StatusBar, { optional: true });
|
|
16
|
+
}
|
|
17
|
+
initializeApp() {
|
|
18
|
+
this.platform
|
|
19
|
+
.ready()
|
|
20
|
+
.then(() => {
|
|
21
|
+
try {
|
|
22
|
+
if (this.statusBar) {
|
|
23
|
+
this.statusBar.styleDefault();
|
|
24
|
+
}
|
|
25
|
+
if (this.splashScreen) {
|
|
26
|
+
this.splashScreen.hide();
|
|
27
|
+
}
|
|
28
|
+
// this.analyticsService.logEvent('platform_ready');
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
this.errorLogger.logError(e, 'failed to handle "platform_ready" event');
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.catch(this.errorLogger.logErrorHandler('Failed to initialize Platform@ionic/angular'));
|
|
35
|
+
}
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AppComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
37
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AppComponentService }); }
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AppComponentService, decorators: [{
|
|
40
|
+
type: Injectable
|
|
41
|
+
}], ctorParameters: () => [] });
|
|
42
|
+
//# sourceMappingURL=app-component.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-component.service.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/app-component.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,kEAAkE;AAClE,4DAA4D;AAC5D,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,cAAc,CAAU,cAAc,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,cAAc,CAAU,WAAW,CAAC,CAAC;AAGlE,+CAA+C;AAC/C,MAAM,OAAO,mBAAmB;IAM9B;QACE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAEM,aAAa;QAClB,IAAI,CAAC,QAAQ;aACV,KAAK,EAAE;aACP,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC;gBACH,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBAClB,IAAI,CAAC,SAA0C,CAAC,YAAY,EAAE,CAAC;gBAClE,CAAC;gBACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;oBACrB,IAAI,CAAC,YAAqC,CAAC,IAAI,EAAE,CAAC;gBACrD,CAAC;gBACD,oDAAoD;YACtD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,WAAW,CAAC,QAAQ,CACvB,CAAC,EACD,yCAAyC,CAC1C,CAAC;YACJ,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,6CAA6C,CAC9C,CACF,CAAC;IACN,CAAC;8GArCU,mBAAmB;kHAAnB,mBAAmB;;2FAAnB,mBAAmB;kBAF/B,UAAU","sourcesContent":["import { Injectable, inject, InjectionToken } from '@angular/core';\nimport { Platform } from '@ionic/angular/standalone';\n// import { SplashScreen } from '@ionic-native/splash-screen/ngx';\n// import { StatusBar } from '@ionic-native/status-bar/ngx';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\n\nexport const SplashScreen = new InjectionToken<unknown>('SplashScreen');\nexport const StatusBar = new InjectionToken<unknown>('StatusBar');\n\n@Injectable()\n// TODO: check if it's used and probably remove\nexport class AppComponentService {\n private readonly platform: Platform;\n private readonly errorLogger: IErrorLogger;\n private readonly splashScreen?: unknown;\n private readonly statusBar?: unknown;\n\n constructor() {\n this.platform = inject(Platform);\n this.errorLogger = inject<IErrorLogger>(ErrorLogger);\n this.splashScreen = inject(SplashScreen, { optional: true });\n this.statusBar = inject(StatusBar, { optional: true });\n }\n\n public initializeApp() {\n this.platform\n .ready()\n .then(() => {\n try {\n if (this.statusBar) {\n (this.statusBar as { styleDefault: () => void }).styleDefault();\n }\n if (this.splashScreen) {\n (this.splashScreen as { hide: () => void }).hide();\n }\n // this.analyticsService.logEvent('platform_ready');\n } catch (e) {\n this.errorLogger.logError(\n e,\n 'failed to handle \"platform_ready\" event',\n );\n }\n })\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to initialize Platform@ionic/angular',\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CONTACT_ROLES_BY_TYPE, } from './contact-extensions';
|
|
2
|
+
import { APP_INFO } from '@sneat/core';
|
|
3
|
+
export function provideAppInfo(appInfo) {
|
|
4
|
+
return {
|
|
5
|
+
provide: APP_INFO,
|
|
6
|
+
useValue: appInfo,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function provideRolesByType(contactRolesByType) {
|
|
10
|
+
return {
|
|
11
|
+
provide: CONTACT_ROLES_BY_TYPE, // at the moment this is supplied by Logistus app only
|
|
12
|
+
useValue: contactRolesByType,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=app-specific-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-specific-providers.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/app-specific-providers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAY,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,cAAc,CAAC,OAAiB;IAC9C,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,OAAO;KAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,kBAAkD;IAElD,OAAO;QACL,OAAO,EAAE,qBAAqB,EAAE,sDAAsD;QACtF,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["import { Provider } from '@angular/core';\nimport {\n CONTACT_ROLES_BY_TYPE,\n ContactRolesByType,\n} from './contact-extensions';\nimport { APP_INFO, IAppInfo } from '@sneat/core';\n\nexport function provideAppInfo(appInfo: IAppInfo): Provider {\n return {\n provide: APP_INFO,\n useValue: appInfo,\n };\n}\n\nexport function provideRolesByType(\n contactRolesByType: ContactRolesByType | undefined,\n): Provider {\n return {\n provide: CONTACT_ROLES_BY_TYPE, // at the moment this is supplied by Logistus app only\n useValue: contactRolesByType,\n };\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { inject } from '@angular/core';
|
|
2
|
+
import { Title } from '@angular/platform-browser';
|
|
3
|
+
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
4
|
+
import { TelegramAuthService } from '@sneat/auth-core';
|
|
5
|
+
import { AnalyticsService, TopMenuService } from '@sneat/core';
|
|
6
|
+
import { filter } from 'rxjs';
|
|
7
|
+
export class BaseAppComponent {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.telegramAuthService = inject(TelegramAuthService);
|
|
10
|
+
this.router = inject(Router);
|
|
11
|
+
this.activatedRoute = inject(ActivatedRoute);
|
|
12
|
+
this.analyticsService = inject(AnalyticsService);
|
|
13
|
+
this.titleService = inject(Title);
|
|
14
|
+
this.topMenuService = inject(TopMenuService); // used in templates
|
|
15
|
+
this.telegramAuthService.authenticateIfTelegramWebApp();
|
|
16
|
+
this.router.events
|
|
17
|
+
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
18
|
+
.subscribe((event) => {
|
|
19
|
+
let route = this.activatedRoute.firstChild;
|
|
20
|
+
while (route?.firstChild) {
|
|
21
|
+
route = route.firstChild;
|
|
22
|
+
}
|
|
23
|
+
let title = route?.snapshot.data['title'];
|
|
24
|
+
if (title) {
|
|
25
|
+
const spaceType = route?.snapshot?.paramMap?.get('spaceType');
|
|
26
|
+
if (spaceType) {
|
|
27
|
+
title = `${capitalizeFirstLetter(spaceType)} ${title}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this.analyticsService.logEvent('$pageview', {
|
|
31
|
+
page_path: event.urlAfterRedirects,
|
|
32
|
+
title,
|
|
33
|
+
});
|
|
34
|
+
title = title ? `${title} @ Sneat.App` : 'Sneat.App'; // Default title
|
|
35
|
+
this.titleService.setTitle(title);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function capitalizeFirstLetter(text) {
|
|
40
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=base-app.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-app.component.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/base-app.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC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;aACN,CAAC,CAAC;YACH,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,gBAAgB;YACtE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { inject } from '@angular/core';\nimport { Title } from '@angular/platform-browser';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport { TelegramAuthService } from '@sneat/auth-core';\nimport { AnalyticsService, TopMenuService } from '@sneat/core';\nimport { filter } from 'rxjs';\n\nexport class BaseAppComponent {\n private readonly telegramAuthService = inject(TelegramAuthService);\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n private readonly analyticsService = inject(AnalyticsService);\n private readonly titleService = inject(Title);\n protected readonly topMenuService = inject(TopMenuService); // used in templates\n\n constructor() {\n this.telegramAuthService.authenticateIfTelegramWebApp();\n this.router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe((event: NavigationEnd) => {\n let route = this.activatedRoute.firstChild;\n while (route?.firstChild) {\n route = route.firstChild;\n }\n let title = route?.snapshot.data['title'];\n if (title) {\n const spaceType = route?.snapshot?.paramMap?.get('spaceType');\n if (spaceType) {\n title = `${capitalizeFirstLetter(spaceType)} ${title}`;\n }\n }\n this.analyticsService.logEvent('$pageview', {\n page_path: event.urlAfterRedirects,\n title,\n });\n title = title ? `${title} @ Sneat.App` : 'Sneat.App'; // Default title\n this.titleService.setTitle(title);\n });\n }\n}\n\nfunction capitalizeFirstLetter(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpResponse, HttpErrorResponse, } from '@angular/common/http';
|
|
3
|
+
import { from, throwError } from 'rxjs';
|
|
4
|
+
import { catchError, map } from 'rxjs/operators';
|
|
5
|
+
import { Capacitor, CapacitorHttp } from '@capacitor/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export class CapacitorHttpInterceptor {
|
|
8
|
+
intercept(req, next) {
|
|
9
|
+
if (Capacitor.isNativePlatform()) {
|
|
10
|
+
// Use Capacitor HTTP only for native iOS/Android, not for web
|
|
11
|
+
return this.handleByCapacitorHttp(req);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
// Use standard Angular HTTP for web
|
|
15
|
+
return next.handle(req);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
handleByCapacitorHttp(req) {
|
|
19
|
+
const request = {
|
|
20
|
+
method: req.method,
|
|
21
|
+
url: req.url,
|
|
22
|
+
headers: req.headers
|
|
23
|
+
.keys()
|
|
24
|
+
.reduce((acc, key) => ({ ...acc, [key]: req.headers.get(key) || '' }), {}),
|
|
25
|
+
params: req.params
|
|
26
|
+
.keys()
|
|
27
|
+
.reduce((acc, key) => ({ ...acc, [key]: req.params.get(key) || '' }), {}),
|
|
28
|
+
data: req.body,
|
|
29
|
+
};
|
|
30
|
+
// Use Capacitor HTTP plugin for requests
|
|
31
|
+
const capacitorRequest = from(CapacitorHttp.request({ ...request }));
|
|
32
|
+
return capacitorRequest.pipe(map((response) => new HttpResponse({
|
|
33
|
+
status: response.status,
|
|
34
|
+
body: response.data,
|
|
35
|
+
})), catchError((error) => throwError(() => new HttpErrorResponse({
|
|
36
|
+
status: error.status,
|
|
37
|
+
statusText: error.error,
|
|
38
|
+
url: req.url,
|
|
39
|
+
}))));
|
|
40
|
+
}
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CapacitorHttpInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
42
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CapacitorHttpInterceptor }); }
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: CapacitorHttpInterceptor, decorators: [{
|
|
45
|
+
type: Injectable
|
|
46
|
+
}] });
|
|
47
|
+
//# sourceMappingURL=capacitator-http.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacitator-http.service.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/capacitator-http.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAKL,YAAY,EACZ,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;AAG3D,MAAM,OAAO,wBAAwB;IAC5B,SAAS,CACd,GAAyB,EACzB,IAAiB;QAEjB,IAAI,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;YACjC,8DAA8D;YAC9D,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,oCAAoC;YACpC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAEO,qBAAqB,CAC3B,GAAyB;QAEzB,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,OAAO,EAAE,GAAG,CAA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\n HttpResponse,\n HttpErrorResponse,\n} from '@angular/common/http';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { Capacitor, CapacitorHttp } from '@capacitor/core';\n\n@Injectable()\nexport class CapacitorHttpInterceptor implements HttpInterceptor {\n public intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler,\n ): Observable<HttpEvent<unknown>> {\n if (Capacitor.isNativePlatform()) {\n // Use Capacitor HTTP only for native iOS/Android, not for web\n return this.handleByCapacitorHttp(req);\n } else {\n // Use standard Angular HTTP for web\n return next.handle(req);\n }\n }\n\n private handleByCapacitorHttp(\n req: HttpRequest<unknown>,\n ): Observable<HttpEvent<unknown>> {\n const request = {\n method: req.method,\n url: req.url,\n headers: req.headers\n .keys()\n .reduce(\n (acc, key) => ({ ...acc, [key]: req.headers.get(key) || '' }),\n {},\n ),\n params: req.params\n .keys()\n .reduce(\n (acc, key) => ({ ...acc, [key]: req.params.get(key) || '' }),\n {},\n ),\n data: req.body,\n };\n\n // Use Capacitor HTTP plugin for requests\n const capacitorRequest = from(CapacitorHttp.request({ ...request }));\n return capacitorRequest.pipe(\n map(\n (response) =>\n new HttpResponse({\n status: response.status,\n body: response.data,\n }),\n ),\n catchError((error) =>\n throwError(\n () =>\n new HttpErrorResponse({\n status: error.status,\n statusText: error.error,\n url: req.url,\n }),\n ),\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-extensions.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/contact-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAoB/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,cAAc,CACrD,uBAAuB,CACxB,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { ContactRole, ContactType } from '@sneat/contactus-core';\n\nexport interface IContactRole {\n id: ContactRole;\n title: string;\n iconName?: string;\n // canBeRoles?: ContactRole[];\n canBeImpersonatedByRoles?: ContactRole[];\n childForRoles?: ContactRole[];\n}\n\nexport interface IContactType {\n id: ContactType;\n title: string;\n icon?: string;\n}\n\nexport type ContactRolesByType = Partial<Record<ContactType, IContactRole[]>>;\n\nexport const CONTACT_ROLES_BY_TYPE = new InjectionToken<ContactRolesByType>(\n 'CONTACT_ROLES_BY_TYPE',\n);\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
2
|
+
import { SneatLoggingModule } from '@sneat/logging';
|
|
3
|
+
// import { RandomModule } from '@sneat/random';
|
|
4
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
5
|
+
// import { SpaceServiceModule } from '@sneat/space-services';
|
|
6
|
+
export function getStandardSneatImports() {
|
|
7
|
+
return [
|
|
8
|
+
BrowserModule,
|
|
9
|
+
BrowserAnimationsModule, // TODO: Move to specific modules?
|
|
10
|
+
SneatLoggingModule,
|
|
11
|
+
// SpaceServiceModule, // Move to specific modules?
|
|
12
|
+
// RandomModule, // Move to specific modules?
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=get-standard-sneat-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-standard-sneat-imports.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/get-standard-sneat-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,gDAAgD;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,8DAA8D;AAE9D,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,aAAa;QACb,uBAAuB,EAAE,kCAAkC;QAC3D,kBAAkB;QAClB,mDAAmD;QACnD,6CAA6C;KAC9C,CAAC;AACJ,CAAC","sourcesContent":["import { BrowserModule } from '@angular/platform-browser';\nimport { SneatLoggingModule } from '@sneat/logging';\n\n// import { RandomModule } from '@sneat/random';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\n\n// import { SpaceServiceModule } from '@sneat/space-services';\n\nexport function getStandardSneatImports() {\n return [\n BrowserModule,\n BrowserAnimationsModule, // TODO: Move to specific modules?\n SneatLoggingModule,\n // SpaceServiceModule, // Move to specific modules?\n // RandomModule, // Move to specific modules?\n ];\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
2
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
3
|
+
import { RouteReuseStrategy } from '@angular/router';
|
|
4
|
+
import { IonicRouteStrategy } from '@ionic/angular/standalone';
|
|
5
|
+
import { provideIonicAngular } from '@ionic/angular/standalone';
|
|
6
|
+
import { DefaultSneatAppApiBaseUrl, SneatApiBaseUrl } from '@sneat/api';
|
|
7
|
+
import { TelegramAuthService } from '@sneat/auth-core';
|
|
8
|
+
import { LOGGER_FACTORY, loggerFactory, TopMenuService } from '@sneat/core';
|
|
9
|
+
import { provideErrorLogger, provideSentryAppInitializer, provideSneatAnalytics, } from '@sneat/logging';
|
|
10
|
+
import { RANDOM_ID_OPTIONS } from '@sneat/random';
|
|
11
|
+
import { AppComponentService } from './app-component.service';
|
|
12
|
+
import { getAngularFireProviders } from './init-firebase';
|
|
13
|
+
// import { getAngularFireImports } from './init-firebase';
|
|
14
|
+
import { registerPosthog } from './register-posthog';
|
|
15
|
+
export function getStandardSneatProviders(environmentConfig) {
|
|
16
|
+
// console.log(
|
|
17
|
+
// 'getStandardSneatProviders(), environmentConfig:' +
|
|
18
|
+
// JSON.stringify(environmentConfig, undefined, '\t'),
|
|
19
|
+
// );
|
|
20
|
+
if (environmentConfig.posthog) {
|
|
21
|
+
registerPosthog(environmentConfig.posthog);
|
|
22
|
+
}
|
|
23
|
+
const providers = [
|
|
24
|
+
provideHttpClient(),
|
|
25
|
+
provideErrorLogger(),
|
|
26
|
+
provideIonicAngular(),
|
|
27
|
+
provideAnimationsAsync(),
|
|
28
|
+
{ provide: LOGGER_FACTORY, useValue: loggerFactory },
|
|
29
|
+
{
|
|
30
|
+
provide: RouteReuseStrategy,
|
|
31
|
+
useClass: IonicRouteStrategy,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
provide: SneatApiBaseUrl,
|
|
35
|
+
useValue: environmentConfig.useNgrok
|
|
36
|
+
? `//${location.host}/v0/`
|
|
37
|
+
: environmentConfig.firebaseConfig.emulator
|
|
38
|
+
? 'https://local-api.sneat.ws/v0/' // 'http://localhost:4300/v0/'
|
|
39
|
+
: DefaultSneatAppApiBaseUrl,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
provide: RANDOM_ID_OPTIONS,
|
|
43
|
+
useValue: { len: 9 },
|
|
44
|
+
},
|
|
45
|
+
getAngularFireProviders(environmentConfig.firebaseConfig),
|
|
46
|
+
provideSneatAnalytics(environmentConfig),
|
|
47
|
+
AppComponentService, // TODO: check if it's used and probably remove
|
|
48
|
+
TopMenuService,
|
|
49
|
+
TelegramAuthService,
|
|
50
|
+
];
|
|
51
|
+
if (environmentConfig.sentry) {
|
|
52
|
+
providers.push(provideSentryAppInitializer(environmentConfig.sentry));
|
|
53
|
+
}
|
|
54
|
+
return providers;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=get-standard-sneat-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-standard-sneat-providers.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/get-standard-sneat-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,kBAAkB,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,CAAC,CAAC,yBAAyB;SAChC;QACD;YACE,OAAO,EAAE,iBAAiB;YAC1B,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;SACrB;QACD,uBAAuB,CAAC,iBAAiB,CAAC,cAAc,CAAC;QACzD,qBAAqB,CAAC,iBAAiB,CAAC;QACxC,mBAAmB,EAAE,+CAA+C;QACpE,cAAc;QACd,mBAAmB;KACpB,CAAC;IACF,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { provideHttpClient } from '@angular/common/http';\nimport { EnvironmentProviders, Provider } from '@angular/core';\nimport { provideAnimationsAsync } from '@angular/platform-browser/animations/async';\nimport { RouteReuseStrategy } from '@angular/router';\nimport { IonicRouteStrategy } from '@ionic/angular/standalone';\nimport { provideIonicAngular } from '@ionic/angular/standalone';\nimport { DefaultSneatAppApiBaseUrl, SneatApiBaseUrl } from '@sneat/api';\nimport { TelegramAuthService } from '@sneat/auth-core';\nimport { LOGGER_FACTORY, loggerFactory, TopMenuService } from '@sneat/core';\nimport {\n provideErrorLogger,\n provideSentryAppInitializer,\n provideSneatAnalytics,\n} from '@sneat/logging';\nimport { RANDOM_ID_OPTIONS } from '@sneat/random';\nimport { AppComponentService } from './app-component.service';\nimport { IEnvironmentConfig } from '@sneat/core';\nimport { getAngularFireProviders } from './init-firebase';\n\n// import { getAngularFireImports } from './init-firebase';\n\nimport { registerPosthog } from './register-posthog';\n\nexport function getStandardSneatProviders(\n environmentConfig: IEnvironmentConfig,\n): readonly (Provider | EnvironmentProviders)[] {\n // console.log(\n // \t'getStandardSneatProviders(), environmentConfig:' +\n // \t\tJSON.stringify(environmentConfig, undefined, '\\t'),\n // );\n if (environmentConfig.posthog) {\n registerPosthog(environmentConfig.posthog);\n }\n\n const providers = [\n provideHttpClient(),\n provideErrorLogger(),\n provideIonicAngular(),\n provideAnimationsAsync(),\n { provide: LOGGER_FACTORY, useValue: loggerFactory },\n {\n provide: RouteReuseStrategy,\n useClass: IonicRouteStrategy,\n },\n {\n provide: SneatApiBaseUrl,\n useValue: environmentConfig.useNgrok\n ? `//${location.host}/v0/`\n : environmentConfig.firebaseConfig.emulator\n ? 'https://local-api.sneat.ws/v0/' // 'http://localhost:4300/v0/'\n : DefaultSneatAppApiBaseUrl,\n },\n {\n provide: RANDOM_ID_OPTIONS,\n useValue: { len: 9 },\n },\n getAngularFireProviders(environmentConfig.firebaseConfig),\n provideSneatAnalytics(environmentConfig),\n AppComponentService, // TODO: check if it's used and probably remove\n TopMenuService,\n TelegramAuthService,\n ];\n if (environmentConfig.sentry) {\n providers.push(provideSentryAppInitializer(environmentConfig.sentry));\n }\n return providers;\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getAnalytics, provideAnalytics } from '@angular/fire/analytics';
|
|
2
|
+
import { connectAuthEmulator, indexedDBLocalPersistence, initializeAuth, provideAuth, } from '@angular/fire/auth';
|
|
3
|
+
import { connectFirestoreEmulator } from '@angular/fire/firestore';
|
|
4
|
+
import { Capacitor } from '@capacitor/core';
|
|
5
|
+
import { provideFirebaseApp, initializeApp, FirebaseApp, } from '@angular/fire/app';
|
|
6
|
+
import { getAuth } from 'firebase/auth';
|
|
7
|
+
import { getFirestore, provideFirestore } from '@angular/fire/firestore';
|
|
8
|
+
export function provideFireApp(firebaseConfig) {
|
|
9
|
+
return provideFirebaseApp(() => initFirebase(firebaseConfig));
|
|
10
|
+
}
|
|
11
|
+
export function getAngularFireProviders(firebaseConfig) {
|
|
12
|
+
const providers = [
|
|
13
|
+
provideFirebaseApp(() => initFirebase(firebaseConfig)),
|
|
14
|
+
provideFirestore((injector) => {
|
|
15
|
+
// console.log('AngularFire: provideFirestore');
|
|
16
|
+
const fbApp = injector.get(FirebaseApp);
|
|
17
|
+
const firestore = getFirestore(fbApp);
|
|
18
|
+
const { emulator } = firebaseConfig;
|
|
19
|
+
if (emulator) {
|
|
20
|
+
connectFirestoreEmulator(firestore, emulator.firestoreHost || '127.0.0.1', emulator.firestorePort);
|
|
21
|
+
if (emulator.firestorePort === 443) {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-expect-error
|
|
24
|
+
firestore['_settings']['ssl'] = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return firestore;
|
|
28
|
+
}),
|
|
29
|
+
provideAuth((injector) => {
|
|
30
|
+
// console.log('AngularFire: provideAuth');
|
|
31
|
+
const fbApp = injector.get(FirebaseApp);
|
|
32
|
+
let auth;
|
|
33
|
+
if (Capacitor.isNativePlatform()) {
|
|
34
|
+
auth = initializeAuth(fbApp, {
|
|
35
|
+
persistence: indexedDBLocalPersistence,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
auth = getAuth(fbApp);
|
|
40
|
+
}
|
|
41
|
+
const { emulator } = firebaseConfig;
|
|
42
|
+
if (emulator?.authPort) {
|
|
43
|
+
// alert('Using firebase auth emulator');
|
|
44
|
+
const authUrl = `${emulator.authPort === 443 ? 'https' : 'http'}://${emulator.authHost || '127.0.0.1'}:${emulator.authPort}`;
|
|
45
|
+
// console.log('authUrl: ', authUrl);
|
|
46
|
+
// noinspection HttpUrlsUsage
|
|
47
|
+
connectAuthEmulator(auth, authUrl);
|
|
48
|
+
}
|
|
49
|
+
return auth;
|
|
50
|
+
}),
|
|
51
|
+
];
|
|
52
|
+
if (firebaseConfig?.measurementId !== 'G-PROVIDE_IF_NEEDED') {
|
|
53
|
+
providers.push(provideAnalytics(() => {
|
|
54
|
+
// const fbApp = injector.get<FirebaseApp>(
|
|
55
|
+
// FirebaseApp as Type<FirebaseApp>,
|
|
56
|
+
// );
|
|
57
|
+
// const fbAnalytics = getAnalytics(fbApp);
|
|
58
|
+
const fbAnalytics = getAnalytics();
|
|
59
|
+
return fbAnalytics;
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
return providers;
|
|
63
|
+
}
|
|
64
|
+
function initFirebase(firebaseConfig) {
|
|
65
|
+
return initializeApp(firebaseConfig);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=init-firebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-firebase.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/init-firebase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAEL,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,EACd,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,MAAM,UAAU,cAAc,CAAC,cAA+B;IAC5D,OAAO,kBAAkB,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,cAA+B;IAE/B,MAAM,SAAS,GAAG;QAChB,kBAAkB,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QACtD,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC5B,gDAAgD;YAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACxC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,E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aAAa,KAAK,qBAAqB,EAAE,CAAC;QAC5D,SAAS,CAAC,IAAI,CACZ,gBAAgB,CAAC,GAAG,EAAE;YACpB,2CAA2C;YAC3C,qCAAqC;YACrC,KAAK;YACL,2CAA2C;YAC3C,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;YACnC,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,YAAY,CAAC,cAA+B;IACnD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { EnvironmentProviders, Type } from '@angular/core';\nimport { getAnalytics, provideAnalytics } from '@angular/fire/analytics';\nimport {\n Auth,\n connectAuthEmulator,\n indexedDBLocalPersistence,\n initializeAuth,\n provideAuth,\n} from '@angular/fire/auth';\nimport { connectFirestoreEmulator } from '@angular/fire/firestore';\nimport { Capacitor } from '@capacitor/core';\nimport { IFirebaseConfig } from '@sneat/core';\nimport {\n provideFirebaseApp,\n initializeApp,\n FirebaseApp,\n} from '@angular/fire/app';\nimport { getAuth } from 'firebase/auth';\nimport { getFirestore, provideFirestore } from '@angular/fire/firestore';\n\nexport function provideFireApp(firebaseConfig: IFirebaseConfig) {\n return provideFirebaseApp(() => initFirebase(firebaseConfig));\n}\n\nexport function getAngularFireProviders(\n firebaseConfig: IFirebaseConfig,\n): EnvironmentProviders[] {\n const providers = [\n provideFirebaseApp(() => initFirebase(firebaseConfig)),\n provideFirestore((injector) => {\n // console.log('AngularFire: provideFirestore');\n const fbApp = injector.get(FirebaseApp);\n const firestore = getFirestore(fbApp);\n const { emulator } = firebaseConfig;\n if (emulator) {\n connectFirestoreEmulator(\n firestore,\n emulator.firestoreHost || '127.0.0.1',\n emulator.firestorePort,\n );\n if (emulator.firestorePort === 443) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n firestore['_settings']['ssl'] = true;\n }\n }\n return firestore;\n }),\n provideAuth((injector) => {\n // console.log('AngularFire: provideAuth');\n const fbApp = injector.get<FirebaseApp>(FirebaseApp as Type<FirebaseApp>);\n let auth: Auth;\n if (Capacitor.isNativePlatform()) {\n auth = initializeAuth(fbApp, {\n persistence: indexedDBLocalPersistence,\n });\n } else {\n auth = getAuth(fbApp);\n }\n const { emulator } = firebaseConfig;\n if (emulator?.authPort) {\n // alert('Using firebase auth emulator');\n const authUrl = `${emulator.authPort === 443 ? 'https' : 'http'}://${emulator.authHost || '127.0.0.1'}:${emulator.authPort}`;\n // console.log('authUrl: ', authUrl);\n // noinspection HttpUrlsUsage\n connectAuthEmulator(auth, authUrl);\n }\n return auth;\n }),\n ];\n if (firebaseConfig?.measurementId !== 'G-PROVIDE_IF_NEEDED') {\n providers.push(\n provideAnalytics(() => {\n // const fbApp = injector.get<FirebaseApp>(\n // \tFirebaseApp as Type<FirebaseApp>,\n // );\n // const fbAnalytics = getAnalytics(fbApp);\n const fbAnalytics = getAnalytics();\n return fbAnalytics;\n }),\n );\n }\n return providers;\n}\n\nfunction initFirebase(firebaseConfig: IFirebaseConfig): FirebaseApp {\n return initializeApp(firebaseConfig);\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function firebaseApiKey(useEmulators, apiKey) {
|
|
2
|
+
return useEmulators ? 'emulator-does-not-need-api-key' : apiKey;
|
|
3
|
+
}
|
|
4
|
+
export function firebaseProjectId(useEmulators, projectId) {
|
|
5
|
+
return useEmulators ? 'demo-' + projectId : projectId;
|
|
6
|
+
}
|
|
7
|
+
// function firebaseDatabaseURL(useEmulators: boolean, projectId: string): string | undefined{
|
|
8
|
+
// // noinspection SpellCheckingInspection
|
|
9
|
+
// return useEmulators
|
|
10
|
+
// ? undefined :
|
|
11
|
+
// `https://${projectId}.firebaseio.com`;
|
|
12
|
+
// }
|
|
13
|
+
// TODO: document why needed
|
|
14
|
+
export function appSpecificConfig(envConfig) {
|
|
15
|
+
let config = {
|
|
16
|
+
...envConfig,
|
|
17
|
+
firebaseConfig: {
|
|
18
|
+
...envConfig.firebaseConfig,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const { firebaseConfig } = config;
|
|
22
|
+
const useEmulator = !!config.firebaseConfig.emulator;
|
|
23
|
+
const projectId = firebaseProjectId(useEmulator, firebaseConfig.projectId);
|
|
24
|
+
config = {
|
|
25
|
+
...config,
|
|
26
|
+
firebaseConfig: {
|
|
27
|
+
...firebaseConfig,
|
|
28
|
+
apiKey: firebaseApiKey(useEmulator, firebaseConfig.apiKey),
|
|
29
|
+
projectId: projectId,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=init-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-helpers.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/init-helpers.ts"],"names":[],"mappings":"AAEA,SAAS,cAAc,CAAC,YAAqB,EAAE,MAAc;IAC3D,OAAO,YAAY,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,MAAM,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,YAAqB,EACrB,SAAiB;IAEjB,OAAO,YAAY,CAAC,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED,8FAA8F;AAC9F,2CAA2C;AAC3C,uBAAuB;AACvB,kBAAkB;AAClB,2CAA2C;AAC3C,IAAI;AAEJ,4BAA4B;AAC5B,MAAM,UAAU,iBAAiB,CAC/B,SAA6B;IAG7B,IAAI,MAAM,GAAuB;QAC/B,GAAG,SAAS;QACZ,cAAc,EAAE;YACd,GAAG,SAAS,CAAC,cAAc;SAC5B;KACF,CAAC;IACF,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;IACrD,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAC3E,MAAM,GAAG;QACP,GAAG,MAAM;QACT,cAAc,EAAE;YACd,GAAG,cAAc;YACjB,MAAM,EAAE,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC;YAC1D,SAAS,EAAE,SAAS;SACrB;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { IEnvironmentConfig } from '@sneat/core';\n\nfunction firebaseApiKey(useEmulators: boolean, apiKey: string): string {\n return useEmulators ? 'emulator-does-not-need-api-key' : apiKey;\n}\n\nexport function firebaseProjectId(\n useEmulators: boolean,\n projectId: string,\n): string {\n return useEmulators ? 'demo-' + projectId : projectId;\n}\n\n// function firebaseDatabaseURL(useEmulators: boolean, projectId: string): string | undefined{\n// \t// noinspection SpellCheckingInspection\n// \treturn useEmulators\n// \t\t? undefined :\n// \t\t`https://${projectId}.firebaseio.com`;\n// }\n\n// TODO: document why needed\nexport function appSpecificConfig(\n envConfig: IEnvironmentConfig,\n // appConfig: IAppSpecificConfig,\n): IEnvironmentConfig {\n let config: IEnvironmentConfig = {\n ...envConfig,\n firebaseConfig: {\n ...envConfig.firebaseConfig,\n },\n };\n const { firebaseConfig } = config;\n const useEmulator = !!config.firebaseConfig.emulator;\n const projectId = firebaseProjectId(useEmulator, firebaseConfig.projectId);\n config = {\n ...config,\n firebaseConfig: {\n ...firebaseConfig,\n apiKey: firebaseApiKey(useEmulator, firebaseConfig.apiKey),\n projectId: projectId,\n },\n };\n return config;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import posthog from 'posthog-js';
|
|
2
|
+
export function registerPosthog(settings) {
|
|
3
|
+
// Under NodeNext + ESM, TS can sometimes treat the import as a module namespace.
|
|
4
|
+
// Cast to the declared PostHog interface to access instance methods like init().
|
|
5
|
+
// (posthog as unknown as PostHog)
|
|
6
|
+
posthog.init(settings.token, {
|
|
7
|
+
...settings.config,
|
|
8
|
+
capture_pageview: false,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=register-posthog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-posthog.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/register-posthog.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,MAAM,UAAU,eAAe,CAAC,QAA0B;IACxD,iFAAiF;IACjF,iFAAiF;IACjF,kCAAkC;IAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;QAC3B,GAAG,QAAQ,CAAC,MAAM;QAClB,gBAAgB,EAAE,KAAK;KACxB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { IPosthogSettings } from '@sneat/core';\nimport posthog from 'posthog-js';\n\nexport function registerPosthog(settings: IPosthogSettings): void {\n // Under NodeNext + ESM, TS can sometimes treat the import as a module namespace.\n // Cast to the declared PostHog interface to access instance methods like init().\n // (posthog as unknown as PostHog)\n posthog.init(settings.token, {\n ...settings.config,\n capture_pageview: false,\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sneat-base-app.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/sneat-base-app.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAIhC,YAAY,cAA8B;QACxC,IAAI,CAAC,iBAAiB,GAAG,cAAc,CAAC,iBAAiB,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import { TopMenuService } from '@sneat/core';\n\nexport class SneatBaseAppComponent {\n // Sets `ion-split-pane[ionSplitPaneVisible]`\n public readonly visibilityChanged: (event: Event) => void;\n\n constructor(topMenuService: TopMenuService) {\n this.visibilityChanged = topMenuService.visibilityChanged;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sneat-app.js","sourceRoot":"","sources":["../../../../libs/app/src/sneat-app.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './environments';
|
|
2
|
+
export * from './lib/base-app.component';
|
|
3
|
+
export * from './lib/sneat-base-app';
|
|
4
|
+
export * from './lib/get-standard-sneat-imports';
|
|
5
|
+
export * from './lib/app-component.service';
|
|
6
|
+
export * from './environments/environment.local';
|
|
7
|
+
export * from './environments/environment.prod';
|
|
8
|
+
export * from './lib/init-firebase';
|
|
9
|
+
export * from './lib/init-helpers';
|
|
10
|
+
export * from './lib/contact-extensions';
|
|
11
|
+
export * from './lib/get-standard-sneat-providers';
|
|
12
|
+
export * from './lib/app-specific-providers';
|
|
13
|
+
export * from './lib/capacitator-http.service';
|