@infrab4a/connect-angular 4.17.0-beta.1 → 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,27 +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);
2693
+ const provider = injector.get(APP_CHECK_PROVIDER);
2694
+ console.log('APP_CHECK_PROVIDER', provider);
2691
2695
  return initializeAppCheck(app, {
2692
- provider: isEmpty(siteKey) ? undefined : new ReCaptchaEnterpriseProvider(siteKey),
2696
+ provider,
2693
2697
  isTokenAutoRefreshEnabled: true,
2694
2698
  });
2695
2699
  }
2696
2700
  catch (error) {
2697
- 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;
2698
2704
  }
2699
- return;
2700
2705
  }),
2701
2706
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2702
2707
  AngularElasticSeachModule,
@@ -2709,27 +2714,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
2709
2714
  args: [{
2710
2715
  imports: [
2711
2716
  provideFirebaseApp((injector) => {
2712
- const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2717
+ const appName = injector.get(FIREBASE_APP_NAME);
2713
2718
  try {
2714
- return getApp(appName);
2719
+ return appName ? getApp(appName) : getApp();
2715
2720
  }
2716
2721
  catch (error) {
2722
+ console.warn('Firebase app not found, initializing new app');
2723
+ if (error instanceof Error) {
2724
+ console.error(error.message);
2725
+ }
2717
2726
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2718
2727
  }
2719
2728
  }),
2720
2729
  provideAppCheck((injector) => {
2721
2730
  const app = injector.get(FirebaseApp);
2731
+ console.log('Connect APP', app.name);
2722
2732
  try {
2723
- const siteKey = injector.get(RECAPTCHA_SITE_KEY);
2733
+ const provider = injector.get(APP_CHECK_PROVIDER);
2734
+ console.log('APP_CHECK_PROVIDER', provider);
2724
2735
  return initializeAppCheck(app, {
2725
- provider: isEmpty(siteKey) ? undefined : new ReCaptchaEnterpriseProvider(siteKey),
2736
+ provider,
2726
2737
  isTokenAutoRefreshEnabled: true,
2727
2738
  });
2728
2739
  }
2729
2740
  catch (error) {
2730
- 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;
2731
2744
  }
2732
- return;
2733
2745
  }),
2734
2746
  provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2735
2747
  AngularElasticSeachModule,