@artisan-commerce/analytics-web 0.2.0-canary.75 → 0.2.0-canary.76
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/dist/bundle.cjs.js +53 -128
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.d.ts +2 -2
- package/dist/bundle.esm.js +6 -81
- package/dist/bundle.esm.js.map +1 -1
- package/dist/bundle.umd.js +55 -131
- package/dist/bundle.umd.js.map +1 -1
- package/package.json +7 -7
package/dist/bundle.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@artisan-commerce/state'), require('@artisan-commerce/shopping-cart'), require('@artisan-commerce/products')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@artisan-commerce/state', '@artisan-commerce/shopping-cart', '@artisan-commerce/products'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ArtisnAnalytics = {}, global.state, global.
|
|
5
|
-
})(this, (function (exports, state,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@artisan-commerce/state'), require('snake-case'), require('@artisan-commerce/shopping-cart-core'), require('@artisan-commerce/products')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@artisan-commerce/state', 'snake-case', '@artisan-commerce/shopping-cart-core', '@artisan-commerce/products'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ArtisnAnalytics = {}, global.state, global.snakeCase, global.shoppingCartCore, global.products));
|
|
5
|
+
})(this, (function (exports, state, snakeCase, shoppingCartCore, products) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var name = "@artisan-commerce/analytics-web";
|
|
8
8
|
var description = "Artisn commerce analytics web library";
|
|
9
|
-
var version = "0.2.0-canary.
|
|
9
|
+
var version = "0.2.0-canary.75";
|
|
10
10
|
var main = "./dist/bundle.cjs.js";
|
|
11
11
|
var module = "./dist/bundle.esm.js";
|
|
12
12
|
var types = "./dist/bundle.d.ts";
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"snake-case": "^3.0.4"
|
|
40
40
|
};
|
|
41
41
|
var devDependencies = {
|
|
42
|
-
"@artisan-commerce/
|
|
43
|
-
"@artisan-commerce/
|
|
42
|
+
"@artisan-commerce/shopping-cart-core": "^0.12.0-canary.70",
|
|
43
|
+
"@artisan-commerce/products": "0.9.0-canary.49",
|
|
44
44
|
"@artisan-commerce/state": "0.3.0-canary.8",
|
|
45
45
|
"@artisan-commerce/types": "0.14.0-canary.37"
|
|
46
46
|
};
|
|
47
47
|
var peerDependencies = {
|
|
48
|
+
"@artisan-commerce/shopping-cart-core": "*",
|
|
48
49
|
"@artisan-commerce/products": "*",
|
|
49
|
-
"@artisan-commerce/shopping-cart": "*",
|
|
50
50
|
"@artisan-commerce/state": "*"
|
|
51
51
|
};
|
|
52
52
|
var nx = {
|
|
@@ -615,82 +615,6 @@ ${key}: ${value}`;
|
|
|
615
615
|
setState({ initialized: true });
|
|
616
616
|
};
|
|
617
617
|
|
|
618
|
-
/******************************************************************************
|
|
619
|
-
Copyright (c) Microsoft Corporation.
|
|
620
|
-
|
|
621
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
622
|
-
purpose with or without fee is hereby granted.
|
|
623
|
-
|
|
624
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
625
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
626
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
627
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
628
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
629
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
630
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
631
|
-
***************************************************************************** */
|
|
632
|
-
|
|
633
|
-
var __assign = function() {
|
|
634
|
-
__assign = Object.assign || function __assign(t) {
|
|
635
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
636
|
-
s = arguments[i];
|
|
637
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
638
|
-
}
|
|
639
|
-
return t;
|
|
640
|
-
};
|
|
641
|
-
return __assign.apply(this, arguments);
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
|
|
646
|
-
*/
|
|
647
|
-
/**
|
|
648
|
-
* Lower case as a function.
|
|
649
|
-
*/
|
|
650
|
-
function lowerCase(str) {
|
|
651
|
-
return str.toLowerCase();
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
655
|
-
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
656
|
-
// Remove all non-word characters.
|
|
657
|
-
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
658
|
-
/**
|
|
659
|
-
* Normalize the string into something other libraries can manipulate easier.
|
|
660
|
-
*/
|
|
661
|
-
function noCase(input, options) {
|
|
662
|
-
if (options === void 0) { options = {}; }
|
|
663
|
-
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
|
|
664
|
-
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
665
|
-
var start = 0;
|
|
666
|
-
var end = result.length;
|
|
667
|
-
// Trim the delimiter from around the output string.
|
|
668
|
-
while (result.charAt(start) === "\0")
|
|
669
|
-
start++;
|
|
670
|
-
while (result.charAt(end - 1) === "\0")
|
|
671
|
-
end--;
|
|
672
|
-
// Transform each token independently.
|
|
673
|
-
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Replace `re` in the input string with the replacement value.
|
|
677
|
-
*/
|
|
678
|
-
function replace(input, re, value) {
|
|
679
|
-
if (re instanceof RegExp)
|
|
680
|
-
return input.replace(re, value);
|
|
681
|
-
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
function dotCase(input, options) {
|
|
685
|
-
if (options === void 0) { options = {}; }
|
|
686
|
-
return noCase(input, __assign({ delimiter: "." }, options));
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
function snakeCase(input, options) {
|
|
690
|
-
if (options === void 0) { options = {}; }
|
|
691
|
-
return dotCase(input, __assign({ delimiter: "_" }, options));
|
|
692
|
-
}
|
|
693
|
-
|
|
694
618
|
var __defProp$3X = Object.defineProperty;
|
|
695
619
|
var __defProps$2s = Object.defineProperties;
|
|
696
620
|
var __getOwnPropDescs$2s = Object.getOwnPropertyDescriptors;
|
|
@@ -713,7 +637,7 @@ ${key}: ${value}`;
|
|
|
713
637
|
const eventParamsToSnakeCase = (params) => {
|
|
714
638
|
return Object.entries(params).reduce((acc, params2) => {
|
|
715
639
|
const [key, value] = params2;
|
|
716
|
-
const newKey = snakeCase(key);
|
|
640
|
+
const newKey = snakeCase.snakeCase(key);
|
|
717
641
|
return __spreadProps$2s(__spreadValues$3X({}, acc), {
|
|
718
642
|
[newKey]: value
|
|
719
643
|
});
|
|
@@ -957,20 +881,20 @@ ${key}: ${value}`;
|
|
|
957
881
|
}, []);
|
|
958
882
|
eventSent(eventName, targetedProviders);
|
|
959
883
|
};
|
|
960
|
-
const getProductIdsFromShoppingCart = (shoppingCart
|
|
961
|
-
const products =
|
|
884
|
+
const getProductIdsFromShoppingCart = (shoppingCart) => {
|
|
885
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
962
886
|
return products.map((product) => product.productId);
|
|
963
887
|
};
|
|
964
|
-
const getProductContentFromShoppingCart = (shoppingCart
|
|
965
|
-
const products =
|
|
888
|
+
const getProductContentFromShoppingCart = (shoppingCart) => {
|
|
889
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
966
890
|
return products.map((product) => getProductContent(product));
|
|
967
891
|
};
|
|
968
892
|
const getProductContent = (product) => {
|
|
969
893
|
const totals = products.getProductTotals(product);
|
|
970
894
|
return `${product.name}:${totals.netPrice}`;
|
|
971
895
|
};
|
|
972
|
-
const mapProductsToGoogleItems = (shoppingCart
|
|
973
|
-
const products =
|
|
896
|
+
const mapProductsToGoogleItems = (shoppingCart, currency) => {
|
|
897
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
974
898
|
return products.map((product) => mapProductToGoogleItem(product, currency));
|
|
975
899
|
};
|
|
976
900
|
const mapProductToGoogleItem = (product, currency) => {
|
|
@@ -3366,7 +3290,7 @@ ${key}: ${value}`;
|
|
|
3366
3290
|
const initiateCheckout$2 = (provider, params) => {
|
|
3367
3291
|
const { trackingId, userId: providerUserId } = provider;
|
|
3368
3292
|
const { currency: providerCurrency } = provider;
|
|
3369
|
-
const _a = params, { callback, userId, shoppingCart
|
|
3293
|
+
const _a = params, { callback, userId, shoppingCart, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
|
|
3370
3294
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
3371
3295
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3372
3296
|
const enhancedParams = __spreadProps$1_(__spreadValues$33({}, rest), {
|
|
@@ -3376,11 +3300,11 @@ ${key}: ${value}`;
|
|
|
3376
3300
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3377
3301
|
const { meta } = getState();
|
|
3378
3302
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3379
|
-
const { total, totalPoints } =
|
|
3303
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3380
3304
|
gtag("event", "begin_checkout", __spreadValues$33(__spreadValues$33({
|
|
3381
3305
|
send_to: trackingId,
|
|
3382
3306
|
event_callback: callback,
|
|
3383
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
3307
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
3384
3308
|
value: total,
|
|
3385
3309
|
points: totalPoints != null ? totalPoints : 0
|
|
3386
3310
|
}, transformedParams), transformedMeta));
|
|
@@ -3420,7 +3344,7 @@ ${key}: ${value}`;
|
|
|
3420
3344
|
const initiateCheckout$1 = (provider, params) => {
|
|
3421
3345
|
const { trackingId } = provider;
|
|
3422
3346
|
const { currency: providerCurrency } = provider;
|
|
3423
|
-
const _a = params, { shoppingCart
|
|
3347
|
+
const _a = params, { shoppingCart, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
|
|
3424
3348
|
delete rest.userId;
|
|
3425
3349
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3426
3350
|
const enhancedParams = __spreadProps$1Z(__spreadValues$32({}, rest), {
|
|
@@ -3429,11 +3353,11 @@ ${key}: ${value}`;
|
|
|
3429
3353
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3430
3354
|
const { meta } = getState();
|
|
3431
3355
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3432
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
3433
|
-
const { total, totalPoints } =
|
|
3356
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
3357
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3434
3358
|
fbq("trackSingle", trackingId, "InitiateCheckout", __spreadValues$32(__spreadValues$32({
|
|
3435
3359
|
content_ids: productsIds,
|
|
3436
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
3360
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
3437
3361
|
num_items: productsIds.length,
|
|
3438
3362
|
value: total,
|
|
3439
3363
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -3473,7 +3397,7 @@ ${key}: ${value}`;
|
|
|
3473
3397
|
};
|
|
3474
3398
|
const initiateCheckout = (provider, params) => {
|
|
3475
3399
|
const { currency: providerCurrency } = provider;
|
|
3476
|
-
const _a = params, { shoppingCart
|
|
3400
|
+
const _a = params, { shoppingCart, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
|
|
3477
3401
|
delete rest.userId;
|
|
3478
3402
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3479
3403
|
const enhancedParams = __spreadProps$1Y(__spreadValues$31({}, rest), {
|
|
@@ -3482,8 +3406,8 @@ ${key}: ${value}`;
|
|
|
3482
3406
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3483
3407
|
const { meta } = getState();
|
|
3484
3408
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3485
|
-
const products =
|
|
3486
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
3409
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
3410
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3487
3411
|
analytics.track("Initiate Checkout", __spreadValues$31(__spreadValues$31({
|
|
3488
3412
|
total,
|
|
3489
3413
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9185,7 +9109,7 @@ ${key}: ${value}`;
|
|
|
9185
9109
|
const purchaseAttempt$2 = (provider, params) => {
|
|
9186
9110
|
const { trackingId, userId: providerUserId } = provider;
|
|
9187
9111
|
const { currency: providerCurrency } = provider;
|
|
9188
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9112
|
+
const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
|
|
9189
9113
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9190
9114
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9191
9115
|
const enhancedParams = __spreadProps$N(__spreadValues$18({}, rest), {
|
|
@@ -9195,11 +9119,11 @@ ${key}: ${value}`;
|
|
|
9195
9119
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9196
9120
|
const { meta } = getState();
|
|
9197
9121
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9198
|
-
const { total, totalPoints } =
|
|
9122
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9199
9123
|
gtag("event", "purchase_attempt", __spreadValues$18(__spreadValues$18({
|
|
9200
9124
|
send_to: trackingId,
|
|
9201
9125
|
event_callback: callback,
|
|
9202
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9126
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9203
9127
|
value: total,
|
|
9204
9128
|
points: totalPoints != null ? totalPoints : 0
|
|
9205
9129
|
}, transformedParams), transformedMeta));
|
|
@@ -9239,7 +9163,7 @@ ${key}: ${value}`;
|
|
|
9239
9163
|
const purchaseAttempt$1 = (provider, params) => {
|
|
9240
9164
|
const { trackingId } = provider;
|
|
9241
9165
|
const { currency: providerCurrency } = provider;
|
|
9242
|
-
const _a = params, { currency, shoppingCart
|
|
9166
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
|
|
9243
9167
|
delete rest.userId;
|
|
9244
9168
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9245
9169
|
const enhancedParams = __spreadProps$M(__spreadValues$17({}, rest), {
|
|
@@ -9248,11 +9172,11 @@ ${key}: ${value}`;
|
|
|
9248
9172
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9249
9173
|
const { meta } = getState();
|
|
9250
9174
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9251
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9252
|
-
const { total, totalPoints } =
|
|
9175
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9176
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9253
9177
|
fbq("trackSingleCustom", trackingId, "PurchaseAttempt", __spreadValues$17(__spreadValues$17({
|
|
9254
9178
|
content_ids: productsIds,
|
|
9255
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9179
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9256
9180
|
num_items: productsIds.length,
|
|
9257
9181
|
value: total,
|
|
9258
9182
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9292,7 +9216,7 @@ ${key}: ${value}`;
|
|
|
9292
9216
|
};
|
|
9293
9217
|
const purchaseAttempt = (provider, params) => {
|
|
9294
9218
|
const { currency: providerCurrency } = provider;
|
|
9295
|
-
const _a = params, { currency, shoppingCart
|
|
9219
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
|
|
9296
9220
|
delete rest.userId;
|
|
9297
9221
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9298
9222
|
const enhancedParams = __spreadProps$L(__spreadValues$16({}, rest), {
|
|
@@ -9301,8 +9225,8 @@ ${key}: ${value}`;
|
|
|
9301
9225
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9302
9226
|
const { meta } = getState();
|
|
9303
9227
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9304
|
-
const products =
|
|
9305
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9228
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9229
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9306
9230
|
analytics.track("Purchase Attempt", __spreadValues$16(__spreadValues$16({
|
|
9307
9231
|
total,
|
|
9308
9232
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9355,7 +9279,7 @@ ${key}: ${value}`;
|
|
|
9355
9279
|
const purchaseFail$2 = (provider, params) => {
|
|
9356
9280
|
const { trackingId, userId: providerUserId } = provider;
|
|
9357
9281
|
const { currency: providerCurrency } = provider;
|
|
9358
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9282
|
+
const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
|
|
9359
9283
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9360
9284
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9361
9285
|
const enhancedParams = __spreadProps$K(__spreadValues$15({}, rest), {
|
|
@@ -9365,11 +9289,11 @@ ${key}: ${value}`;
|
|
|
9365
9289
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9366
9290
|
const { meta } = getState();
|
|
9367
9291
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9368
|
-
const { total, totalPoints } =
|
|
9292
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9369
9293
|
gtag("event", "purchase_fail", __spreadValues$15(__spreadValues$15({
|
|
9370
9294
|
send_to: trackingId,
|
|
9371
9295
|
event_callback: callback,
|
|
9372
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9296
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9373
9297
|
value: total,
|
|
9374
9298
|
points: totalPoints != null ? totalPoints : 0
|
|
9375
9299
|
}, transformedParams), transformedMeta));
|
|
@@ -9409,7 +9333,7 @@ ${key}: ${value}`;
|
|
|
9409
9333
|
const purchaseFail$1 = (provider, params) => {
|
|
9410
9334
|
const { trackingId } = provider;
|
|
9411
9335
|
const { currency: providerCurrency } = provider;
|
|
9412
|
-
const _a = params, { currency, shoppingCart
|
|
9336
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
|
|
9413
9337
|
delete rest.userId;
|
|
9414
9338
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9415
9339
|
const enhancedParams = __spreadProps$J(__spreadValues$14({}, rest), {
|
|
@@ -9418,11 +9342,11 @@ ${key}: ${value}`;
|
|
|
9418
9342
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9419
9343
|
const { meta } = getState();
|
|
9420
9344
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9421
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9422
|
-
const { total, totalPoints } =
|
|
9345
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9346
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9423
9347
|
fbq("trackSingleCustom", trackingId, "PurchaseFail", __spreadValues$14(__spreadValues$14({
|
|
9424
9348
|
content_ids: productsIds,
|
|
9425
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9349
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9426
9350
|
num_items: productsIds.length,
|
|
9427
9351
|
value: total,
|
|
9428
9352
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9462,7 +9386,7 @@ ${key}: ${value}`;
|
|
|
9462
9386
|
};
|
|
9463
9387
|
const purchaseFail = (provider, params) => {
|
|
9464
9388
|
const { currency: providerCurrency } = provider;
|
|
9465
|
-
const _a = params, { currency, shoppingCart
|
|
9389
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
|
|
9466
9390
|
delete rest.userId;
|
|
9467
9391
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9468
9392
|
const enhancedParams = __spreadProps$I(__spreadValues$13({}, rest), {
|
|
@@ -9471,8 +9395,8 @@ ${key}: ${value}`;
|
|
|
9471
9395
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9472
9396
|
const { meta } = getState();
|
|
9473
9397
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9474
|
-
const products =
|
|
9475
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9398
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9399
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9476
9400
|
analytics.track("Purchase Fail", __spreadValues$13(__spreadValues$13({
|
|
9477
9401
|
total,
|
|
9478
9402
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9525,21 +9449,21 @@ ${key}: ${value}`;
|
|
|
9525
9449
|
const purchaseSuccess$2 = (provider, params) => {
|
|
9526
9450
|
const { trackingId, userId: providerUserId } = provider;
|
|
9527
9451
|
const { currency: providerCurrency } = provider;
|
|
9528
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9452
|
+
const _a = params, { callback, userId, currency, shoppingCart, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
|
|
9529
9453
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9530
9454
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9531
9455
|
const enhancedParams = __spreadProps$H(__spreadValues$12({}, rest), {
|
|
9532
9456
|
userId: selectedUserId,
|
|
9533
9457
|
currency: selectedCurrency
|
|
9534
9458
|
});
|
|
9535
|
-
const { total, shippingCost, totalTaxes, totalPoints } =
|
|
9459
|
+
const { total, shippingCost, totalTaxes, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9536
9460
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9537
9461
|
const { meta } = getState();
|
|
9538
9462
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9539
9463
|
gtag("event", "purchase", __spreadValues$12(__spreadValues$12({
|
|
9540
9464
|
send_to: trackingId,
|
|
9541
9465
|
event_callback: callback,
|
|
9542
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9466
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9543
9467
|
value: total,
|
|
9544
9468
|
points: totalPoints != null ? totalPoints : 0,
|
|
9545
9469
|
transaction_id: orderId,
|
|
@@ -9582,7 +9506,7 @@ ${key}: ${value}`;
|
|
|
9582
9506
|
const purchaseSuccess$1 = (provider, params) => {
|
|
9583
9507
|
const { trackingId } = provider;
|
|
9584
9508
|
const { currency: providerCurrency } = provider;
|
|
9585
|
-
const _a = params, { currency, shoppingCart
|
|
9509
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
|
|
9586
9510
|
delete rest.userId;
|
|
9587
9511
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9588
9512
|
const enhancedParams = __spreadProps$G(__spreadValues$11({}, rest), {
|
|
@@ -9591,11 +9515,11 @@ ${key}: ${value}`;
|
|
|
9591
9515
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9592
9516
|
const { meta } = getState();
|
|
9593
9517
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9594
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9595
|
-
const { total, totalPoints } =
|
|
9518
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9519
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9596
9520
|
fbq("trackSingle", trackingId, "Purchase", __spreadValues$11(__spreadValues$11({
|
|
9597
9521
|
content_ids: productsIds,
|
|
9598
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9522
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9599
9523
|
num_items: productsIds.length,
|
|
9600
9524
|
value: total,
|
|
9601
9525
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9635,7 +9559,7 @@ ${key}: ${value}`;
|
|
|
9635
9559
|
};
|
|
9636
9560
|
const purchaseSuccess = (provider, params) => {
|
|
9637
9561
|
const { currency: providerCurrency } = provider;
|
|
9638
|
-
const _a = params, { currency, shoppingCart
|
|
9562
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
|
|
9639
9563
|
delete rest.userId;
|
|
9640
9564
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9641
9565
|
const enhancedParams = __spreadProps$F(__spreadValues$10({}, rest), {
|
|
@@ -9644,8 +9568,8 @@ ${key}: ${value}`;
|
|
|
9644
9568
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9645
9569
|
const { meta } = getState();
|
|
9646
9570
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9647
|
-
const products =
|
|
9648
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9571
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9572
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9649
9573
|
analytics.track("Order Completed", __spreadValues$10(__spreadValues$10({
|
|
9650
9574
|
total,
|
|
9651
9575
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|