@infrab4a/connect-angular 4.17.0-beta.0 → 4.17.0-beta.10

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.
@@ -3,7 +3,7 @@ import { NgModule, InjectionToken, PLATFORM_ID, Injectable, Inject } from '@angu
3
3
  import * as i1$4 from '@angular/fire/app';
4
4
  import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
5
5
  import * as i2 from '@angular/fire/app-check';
6
- import { provideAppCheck, initializeAppCheck, ReCaptchaEnterpriseProvider } from '@angular/fire/app-check';
6
+ import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
7
7
  import * as i3 from '@angular/fire/storage';
8
8
  import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
9
9
  import * as i1$2 from '@infrab4a/connect';
@@ -60,7 +60,7 @@ const DEFAULT_SHOP = 'DEFAULT_SHOP';
60
60
 
61
61
  const FIREBASE_APP_NAME = new InjectionToken('firebaseAppName');
62
62
  const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
63
- const RECAPTCHA_SITE_KEY = new InjectionToken('recaptchaSiteKey');
63
+ const APP_CHECK_PROVIDER = new InjectionToken('appCheckProvider');
64
64
 
65
65
  const HASURA_OPTIONS = 'HASURA_OPTIONS';
66
66
 
@@ -2617,6 +2617,8 @@ class AngularConnectModule {
2617
2617
  return {
2618
2618
  ngModule: AngularConnectModule,
2619
2619
  providers: [
2620
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
2621
+ { provide: APP_CHECK_PROVIDER, useValue: options.appCheckProvider },
2620
2622
  {
2621
2623
  provide: CATEGORY_STRUCTURE,
2622
2624
  useClass: isNil(options?.oldCategoryStructure) || options?.oldCategoryStructure
@@ -2626,15 +2628,11 @@ class AngularConnectModule {
2626
2628
  { provide: PERSISTENCE_PROVIDER, useClass: options?.persistenceProvider || CookieDataPersistence },
2627
2629
  ...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
2628
2630
  ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
2629
- ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
2630
2631
  ...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
2631
2632
  ...(isNil(options?.vertexConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexConfig }]),
2632
2633
  ...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
2633
2634
  ...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
2634
2635
  ...(isNil(options?.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
2635
- ...(isNil(options?.recaptchaSiteKey)
2636
- ? []
2637
- : [{ provide: RECAPTCHA_SITE_KEY, useValue: options.recaptchaSiteKey }]),
2638
2636
  ],
2639
2637
  };
2640
2638
  }
@@ -2676,28 +2674,34 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
2676
2674
  useExisting: ProductsVertexSearch,
2677
2675
  },
2678
2676
  ], imports: [provideFirebaseApp((injector) => {
2679
- const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2677
+ const appName = injector.get(FIREBASE_APP_NAME);
2680
2678
  try {
2681
- return getApp(appName);
2679
+ return appName ? getApp(appName) : getApp();
2682
2680
  }
2683
2681
  catch (error) {
2682
+ console.warn('Firebase app not found, initializing new app');
2683
+ if (error instanceof Error) {
2684
+ console.error(error.message);
2685
+ }
2684
2686
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2685
2687
  }
2686
2688
  }),
2687
2689
  provideAppCheck((injector) => {
2688
2690
  const app = injector.get(FirebaseApp);
2691
+ console.log('Connect APP', app.name);
2689
2692
  try {
2690
- const siteKey = injector.get(RECAPTCHA_SITE_KEY);
2691
- if (siteKey && siteKey.trim() !== '')
2692
- return initializeAppCheck(app, {
2693
- provider: new ReCaptchaEnterpriseProvider(siteKey),
2694
- isTokenAutoRefreshEnabled: true,
2695
- });
2693
+ const provider = injector.get(APP_CHECK_PROVIDER);
2694
+ console.log('APP_CHECK_PROVIDER', provider);
2695
+ return initializeAppCheck(app, {
2696
+ provider,
2697
+ isTokenAutoRefreshEnabled: true,
2698
+ });
2696
2699
  }
2697
2700
  catch (error) {
2698
- console.warn('ReCAPTCHA site key not provided or invalid, App Check not initialized');
2701
+ if (error instanceof Error)
2702
+ console.error(error.message);
2703
+ return;
2699
2704
  }
2700
- return;
2701
2705
  }),
2702
2706
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2703
2707
  AngularElasticSeachModule,
@@ -2710,28 +2714,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
2710
2714
  args: [{
2711
2715
  imports: [
2712
2716
  provideFirebaseApp((injector) => {
2713
- const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2717
+ const appName = injector.get(FIREBASE_APP_NAME);
2714
2718
  try {
2715
- return getApp(appName);
2719
+ return appName ? getApp(appName) : getApp();
2716
2720
  }
2717
2721
  catch (error) {
2722
+ console.warn('Firebase app not found, initializing new app');
2723
+ if (error instanceof Error) {
2724
+ console.error(error.message);
2725
+ }
2718
2726
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2719
2727
  }
2720
2728
  }),
2721
2729
  provideAppCheck((injector) => {
2722
2730
  const app = injector.get(FirebaseApp);
2731
+ console.log('Connect APP', app.name);
2723
2732
  try {
2724
- const siteKey = injector.get(RECAPTCHA_SITE_KEY);
2725
- if (siteKey && siteKey.trim() !== '')
2726
- return initializeAppCheck(app, {
2727
- provider: new ReCaptchaEnterpriseProvider(siteKey),
2728
- isTokenAutoRefreshEnabled: true,
2729
- });
2733
+ const provider = injector.get(APP_CHECK_PROVIDER);
2734
+ console.log('APP_CHECK_PROVIDER', provider);
2735
+ return initializeAppCheck(app, {
2736
+ provider,
2737
+ isTokenAutoRefreshEnabled: true,
2738
+ });
2730
2739
  }
2731
2740
  catch (error) {
2732
- console.warn('ReCAPTCHA site key not provided or invalid, App Check not initialized');
2741
+ if (error instanceof Error)
2742
+ console.error(error.message);
2743
+ return;
2733
2744
  }
2734
- return;
2735
2745
  }),
2736
2746
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2737
2747
  AngularElasticSeachModule,