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