@infrab4a/connect-angular 4.17.0-beta.1 → 4.17.0-beta.11

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,27 +2674,37 @@ 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
+ const app = appName ? getApp(appName) : getApp();
2680
+ console.log('Connect initializeApp', app.name);
2681
+ return app;
2682
2682
  }
2683
2683
  catch (error) {
2684
+ console.warn('Firebase app not found, initializing new app');
2685
+ if (error instanceof Error) {
2686
+ console.error(error.message);
2687
+ }
2684
2688
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2685
2689
  }
2686
2690
  }),
2687
2691
  provideAppCheck((injector) => {
2688
2692
  const app = injector.get(FirebaseApp);
2693
+ console.log('Connect APP', app.name);
2694
+ console.log('Connect APP', JSON.stringify(app.options));
2689
2695
  try {
2690
- const siteKey = injector.get(RECAPTCHA_SITE_KEY);
2696
+ const provider = injector.get(APP_CHECK_PROVIDER);
2697
+ console.log('APP_CHECK_PROVIDER', provider);
2691
2698
  return initializeAppCheck(app, {
2692
- provider: isEmpty(siteKey) ? undefined : new ReCaptchaEnterpriseProvider(siteKey),
2699
+ provider,
2693
2700
  isTokenAutoRefreshEnabled: true,
2694
2701
  });
2695
2702
  }
2696
2703
  catch (error) {
2697
- console.warn('ReCAPTCHA site key not provided or invalid, App Check not initialized');
2704
+ if (error instanceof Error)
2705
+ console.error(error.message);
2706
+ return;
2698
2707
  }
2699
- return;
2700
2708
  }),
2701
2709
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2702
2710
  AngularElasticSeachModule,
@@ -2709,27 +2717,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
2709
2717
  args: [{
2710
2718
  imports: [
2711
2719
  provideFirebaseApp((injector) => {
2712
- const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2720
+ const appName = injector.get(FIREBASE_APP_NAME);
2713
2721
  try {
2714
- return getApp(appName);
2722
+ const app = appName ? getApp(appName) : getApp();
2723
+ console.log('Connect initializeApp', app.name);
2724
+ return app;
2715
2725
  }
2716
2726
  catch (error) {
2727
+ console.warn('Firebase app not found, initializing new app');
2728
+ if (error instanceof Error) {
2729
+ console.error(error.message);
2730
+ }
2717
2731
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2718
2732
  }
2719
2733
  }),
2720
2734
  provideAppCheck((injector) => {
2721
2735
  const app = injector.get(FirebaseApp);
2736
+ console.log('Connect APP', app.name);
2737
+ console.log('Connect APP', JSON.stringify(app.options));
2722
2738
  try {
2723
- const siteKey = injector.get(RECAPTCHA_SITE_KEY);
2739
+ const provider = injector.get(APP_CHECK_PROVIDER);
2740
+ console.log('APP_CHECK_PROVIDER', provider);
2724
2741
  return initializeAppCheck(app, {
2725
- provider: isEmpty(siteKey) ? undefined : new ReCaptchaEnterpriseProvider(siteKey),
2742
+ provider,
2726
2743
  isTokenAutoRefreshEnabled: true,
2727
2744
  });
2728
2745
  }
2729
2746
  catch (error) {
2730
- console.warn('ReCAPTCHA site key not provided or invalid, App Check not initialized');
2747
+ if (error instanceof Error)
2748
+ console.error(error.message);
2749
+ return;
2731
2750
  }
2732
- return;
2733
2751
  }),
2734
2752
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2735
2753
  AngularElasticSeachModule,