ng-easycommerce 0.0.690 → 0.0.691

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.
@@ -2580,14 +2580,16 @@ var FacebookPixelService = /** @class */ (function () {
2580
2580
  var new_analityc_script = _this.renderer.createElement('script');
2581
2581
  new_analityc_script.id = 'facebook_pixel';
2582
2582
  new_analityc_script.type = 'text/javascript';
2583
- new_analityc_script.text = "!function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', " + normalizedPixelId + ");";
2583
+ new_analityc_script.text = "!function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', " + JSON.stringify(normalizedPixelId) + ");";
2584
2584
  _this.renderer.appendChild(_this.document.body, new_analityc_script);
2585
2585
  }
2586
2586
  else {
2587
2587
  if (typeof fbq !== 'function') {
2588
2588
  return;
2589
2589
  }
2590
- fbq('init', normalizedPixelId);
2590
+ _this.runFacebookCall(function () {
2591
+ fbq('init', normalizedPixelId);
2592
+ });
2591
2593
  }
2592
2594
  _this.enabled = true;
2593
2595
  _this.initializedPixelId = normalizedPixelId;
@@ -2616,7 +2618,10 @@ var FacebookPixelService = /** @class */ (function () {
2616
2618
  return false;
2617
2619
  }
2618
2620
  try {
2619
- fbq('track', event, _this.evalEvent(event_name, data));
2621
+ var payload_1 = _this.evalEvent(event_name, data);
2622
+ _this.runFacebookCall(function () {
2623
+ fbq('track', event, payload_1);
2624
+ });
2620
2625
  if (event_name === 'initialize') {
2621
2626
  _this.pageViewTracked = true;
2622
2627
  }
@@ -2654,7 +2659,9 @@ var FacebookPixelService = /** @class */ (function () {
2654
2659
  return false;
2655
2660
  }
2656
2661
  try {
2657
- fbq('trackCustom', event_name, data);
2662
+ _this.runFacebookCall(function () {
2663
+ fbq('trackCustom', event_name, data);
2664
+ });
2658
2665
  return true;
2659
2666
  }
2660
2667
  catch (error) {
@@ -2681,6 +2688,13 @@ var FacebookPixelService = /** @class */ (function () {
2681
2688
  }
2682
2689
  callback();
2683
2690
  };
2691
+ this.runFacebookCall = function (callback) {
2692
+ if (_this.ngZone && typeof _this.ngZone.runOutsideAngular === 'function') {
2693
+ _this.ngZone.runOutsideAngular(callback);
2694
+ return;
2695
+ }
2696
+ callback();
2697
+ };
2684
2698
  this.toViewContent = function (data) {
2685
2699
  var _a, _b, _c, _d;
2686
2700
  var lastProduct = ((_a = data) === null || _a === void 0 ? void 0 : _a.name) || 'not-product';
@@ -7348,16 +7362,16 @@ var ParametersService = /** @class */ (function () {
7348
7362
  this.ready$ = this.readyParamsSubject.asObservable();
7349
7363
  this.getAllParametersAPI = function () { return 'shop-api/' + (_this.constants.getMasterChannel() || _this.constants.getChannel()) + '/parameters'; };
7350
7364
  this.insertAnalitycs = function () {
7351
- var initializeAnalyticsIfNeeded = function (params) {
7352
- if (_this.analyticsInitializationRequested) {
7353
- return;
7354
- }
7355
- _this.analyticsInitializationRequested = true;
7356
- _this.initializeAnalytics(params);
7357
- };
7358
7365
  _this.parametersSubject.value
7359
- ? _this.constants.onlyIfProduction(initializeAnalyticsIfNeeded, _this.parametersSubject.value)
7360
- : _this.waitUntilData(function (params) { return _this.constants.onlyIfProduction(initializeAnalyticsIfNeeded, params); });
7366
+ ? _this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, _this.parametersSubject.value)
7367
+ : _this.waitUntilData(function (params) { return _this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, params); });
7368
+ };
7369
+ this.initializeAnalyticsIfNeeded = function (params) {
7370
+ if (_this.analyticsInitializationRequested) {
7371
+ return;
7372
+ }
7373
+ _this.analyticsInitializationRequested = true;
7374
+ _this.initializeAnalytics(params);
7361
7375
  };
7362
7376
  this.initializeAnalytics = function (params) {
7363
7377
  var facebook = params.find(function (param) { return param.code.includes("_" + _this.constants.getChannel() + "_") && param.code.includes('facebook') && param.code.includes('id'); });
@@ -7387,6 +7401,7 @@ var ParametersService = /** @class */ (function () {
7387
7401
  this.connection.get(this.getAllParametersAPI()).toPromise().then(function (res) {
7388
7402
  _this.parametersSubject.next(res);
7389
7403
  _this.readyParamsSubject.next(true);
7404
+ _this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, res);
7390
7405
  });
7391
7406
  }
7392
7407
  ParametersService$1.ctorParameters = function () { return [