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.
- package/README.md +6 -0
- package/bundles/ng-easycommerce.umd.js +28 -13
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/services/parameters.service.js +11 -10
- package/esm2015/lib/utils/analytics/facebook-pixel.service.js +19 -5
- package/esm5/lib/services/parameters.service.js +11 -10
- package/esm5/lib/utils/analytics/facebook-pixel.service.js +19 -5
- package/fesm2015/ng-easycommerce.js +28 -13
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +28 -13
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/services/parameters.service.d.ts +1 -0
- package/lib/utils/analytics/facebook-pixel.service.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# Version 0.0.691
|
|
2
|
+
- Facebook Pixel: las llamadas directas a `fbq` se ejecutan fuera de Angular Zone mediante `runFacebookCall()`, manteniendo guards, `try/catch` e idempotencia.
|
|
3
|
+
- Facebook Pixel: el `Pixel ID` se serializa como string en el script dinámico para evitar una interpolación inválida.
|
|
4
|
+
- Analytics: `ParametersService` inicializa automáticamente Facebook, Google, GTM y el resto de integraciones al recibir `/parameters`.
|
|
5
|
+
- Analytics: `insertAnalitycs()` mantiene compatibilidad legacy y comparte `initializeAnalyticsIfNeeded()` para evitar inicializaciones duplicadas.
|
|
6
|
+
|
|
1
7
|
# Version 0.0.690
|
|
2
8
|
- Mobbex redirect: al volver desde la pasarela con estado `success` o `pending`, el checkout compacto finaliza la compra automáticamente con `checkoutService.complete()`.
|
|
3
9
|
- Mobbex redirect: se alinea el método con otros pagos externos que completan el pedido al regresar al sitio, evitando que el usuario pierda el estado si recarga o cierra la pestaña antes de terminar manualmente.
|
|
@@ -2565,14 +2565,16 @@
|
|
|
2565
2565
|
var new_analityc_script = _this.renderer.createElement('script');
|
|
2566
2566
|
new_analityc_script.id = 'facebook_pixel';
|
|
2567
2567
|
new_analityc_script.type = 'text/javascript';
|
|
2568
|
-
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 + ");";
|
|
2568
|
+
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) + ");";
|
|
2569
2569
|
_this.renderer.appendChild(_this.document.body, new_analityc_script);
|
|
2570
2570
|
}
|
|
2571
2571
|
else {
|
|
2572
2572
|
if (typeof fbq !== 'function') {
|
|
2573
2573
|
return;
|
|
2574
2574
|
}
|
|
2575
|
-
|
|
2575
|
+
_this.runFacebookCall(function () {
|
|
2576
|
+
fbq('init', normalizedPixelId);
|
|
2577
|
+
});
|
|
2576
2578
|
}
|
|
2577
2579
|
_this.enabled = true;
|
|
2578
2580
|
_this.initializedPixelId = normalizedPixelId;
|
|
@@ -2601,7 +2603,10 @@
|
|
|
2601
2603
|
return false;
|
|
2602
2604
|
}
|
|
2603
2605
|
try {
|
|
2604
|
-
|
|
2606
|
+
var payload_1 = _this.evalEvent(event_name, data);
|
|
2607
|
+
_this.runFacebookCall(function () {
|
|
2608
|
+
fbq('track', event, payload_1);
|
|
2609
|
+
});
|
|
2605
2610
|
if (event_name === 'initialize') {
|
|
2606
2611
|
_this.pageViewTracked = true;
|
|
2607
2612
|
}
|
|
@@ -2639,7 +2644,9 @@
|
|
|
2639
2644
|
return false;
|
|
2640
2645
|
}
|
|
2641
2646
|
try {
|
|
2642
|
-
|
|
2647
|
+
_this.runFacebookCall(function () {
|
|
2648
|
+
fbq('trackCustom', event_name, data);
|
|
2649
|
+
});
|
|
2643
2650
|
return true;
|
|
2644
2651
|
}
|
|
2645
2652
|
catch (error) {
|
|
@@ -2666,6 +2673,13 @@
|
|
|
2666
2673
|
}
|
|
2667
2674
|
callback();
|
|
2668
2675
|
};
|
|
2676
|
+
this.runFacebookCall = function (callback) {
|
|
2677
|
+
if (_this.ngZone && typeof _this.ngZone.runOutsideAngular === 'function') {
|
|
2678
|
+
_this.ngZone.runOutsideAngular(callback);
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
callback();
|
|
2682
|
+
};
|
|
2669
2683
|
this.toViewContent = function (data) {
|
|
2670
2684
|
var _a, _b, _c, _d;
|
|
2671
2685
|
var lastProduct = ((_a = data) === null || _a === void 0 ? void 0 : _a.name) || 'not-product';
|
|
@@ -7333,16 +7347,16 @@
|
|
|
7333
7347
|
this.ready$ = this.readyParamsSubject.asObservable();
|
|
7334
7348
|
this.getAllParametersAPI = function () { return 'shop-api/' + (_this.constants.getMasterChannel() || _this.constants.getChannel()) + '/parameters'; };
|
|
7335
7349
|
this.insertAnalitycs = function () {
|
|
7336
|
-
var initializeAnalyticsIfNeeded = function (params) {
|
|
7337
|
-
if (_this.analyticsInitializationRequested) {
|
|
7338
|
-
return;
|
|
7339
|
-
}
|
|
7340
|
-
_this.analyticsInitializationRequested = true;
|
|
7341
|
-
_this.initializeAnalytics(params);
|
|
7342
|
-
};
|
|
7343
7350
|
_this.parametersSubject.value
|
|
7344
|
-
? _this.constants.onlyIfProduction(initializeAnalyticsIfNeeded, _this.parametersSubject.value)
|
|
7345
|
-
: _this.waitUntilData(function (params) { return _this.constants.onlyIfProduction(initializeAnalyticsIfNeeded, params); });
|
|
7351
|
+
? _this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, _this.parametersSubject.value)
|
|
7352
|
+
: _this.waitUntilData(function (params) { return _this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, params); });
|
|
7353
|
+
};
|
|
7354
|
+
this.initializeAnalyticsIfNeeded = function (params) {
|
|
7355
|
+
if (_this.analyticsInitializationRequested) {
|
|
7356
|
+
return;
|
|
7357
|
+
}
|
|
7358
|
+
_this.analyticsInitializationRequested = true;
|
|
7359
|
+
_this.initializeAnalytics(params);
|
|
7346
7360
|
};
|
|
7347
7361
|
this.initializeAnalytics = function (params) {
|
|
7348
7362
|
var facebook = params.find(function (param) { return param.code.includes("_" + _this.constants.getChannel() + "_") && param.code.includes('facebook') && param.code.includes('id'); });
|
|
@@ -7372,6 +7386,7 @@
|
|
|
7372
7386
|
this.connection.get(this.getAllParametersAPI()).toPromise().then(function (res) {
|
|
7373
7387
|
_this.parametersSubject.next(res);
|
|
7374
7388
|
_this.readyParamsSubject.next(true);
|
|
7389
|
+
_this.constants.onlyIfProduction(_this.initializeAnalyticsIfNeeded, res);
|
|
7375
7390
|
});
|
|
7376
7391
|
}
|
|
7377
7392
|
ParametersService$1.ctorParameters = function () { return [
|