@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.cjs.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var state = require('@artisan-commerce/state');
|
|
6
|
-
var
|
|
6
|
+
var snakeCase = require('snake-case');
|
|
7
|
+
var shoppingCartCore = require('@artisan-commerce/shopping-cart-core');
|
|
7
8
|
var products = require('@artisan-commerce/products');
|
|
8
9
|
|
|
9
10
|
var name = "@artisan-commerce/analytics-web";
|
|
10
11
|
var description = "Artisn commerce analytics web library";
|
|
11
|
-
var version = "0.2.0-canary.
|
|
12
|
+
var version = "0.2.0-canary.75";
|
|
12
13
|
var main = "./dist/bundle.cjs.js";
|
|
13
14
|
var module$1 = "./dist/bundle.esm.js";
|
|
14
15
|
var types = "./dist/bundle.d.ts";
|
|
@@ -41,14 +42,14 @@ var dependencies = {
|
|
|
41
42
|
"snake-case": "^3.0.4"
|
|
42
43
|
};
|
|
43
44
|
var devDependencies = {
|
|
44
|
-
"@artisan-commerce/
|
|
45
|
-
"@artisan-commerce/
|
|
45
|
+
"@artisan-commerce/shopping-cart-core": "^0.12.0-canary.70",
|
|
46
|
+
"@artisan-commerce/products": "0.9.0-canary.49",
|
|
46
47
|
"@artisan-commerce/state": "0.3.0-canary.8",
|
|
47
48
|
"@artisan-commerce/types": "0.14.0-canary.37"
|
|
48
49
|
};
|
|
49
50
|
var peerDependencies = {
|
|
51
|
+
"@artisan-commerce/shopping-cart-core": "*",
|
|
50
52
|
"@artisan-commerce/products": "*",
|
|
51
|
-
"@artisan-commerce/shopping-cart": "*",
|
|
52
53
|
"@artisan-commerce/state": "*"
|
|
53
54
|
};
|
|
54
55
|
var nx = {
|
|
@@ -617,82 +618,6 @@ const initAnalytics = (config) => {
|
|
|
617
618
|
setState({ initialized: true });
|
|
618
619
|
};
|
|
619
620
|
|
|
620
|
-
/******************************************************************************
|
|
621
|
-
Copyright (c) Microsoft Corporation.
|
|
622
|
-
|
|
623
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
624
|
-
purpose with or without fee is hereby granted.
|
|
625
|
-
|
|
626
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
627
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
628
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
629
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
630
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
631
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
632
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
633
|
-
***************************************************************************** */
|
|
634
|
-
|
|
635
|
-
var __assign = function() {
|
|
636
|
-
__assign = Object.assign || function __assign(t) {
|
|
637
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
638
|
-
s = arguments[i];
|
|
639
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
640
|
-
}
|
|
641
|
-
return t;
|
|
642
|
-
};
|
|
643
|
-
return __assign.apply(this, arguments);
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
|
|
648
|
-
*/
|
|
649
|
-
/**
|
|
650
|
-
* Lower case as a function.
|
|
651
|
-
*/
|
|
652
|
-
function lowerCase(str) {
|
|
653
|
-
return str.toLowerCase();
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
657
|
-
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
658
|
-
// Remove all non-word characters.
|
|
659
|
-
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
660
|
-
/**
|
|
661
|
-
* Normalize the string into something other libraries can manipulate easier.
|
|
662
|
-
*/
|
|
663
|
-
function noCase(input, options) {
|
|
664
|
-
if (options === void 0) { options = {}; }
|
|
665
|
-
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;
|
|
666
|
-
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
667
|
-
var start = 0;
|
|
668
|
-
var end = result.length;
|
|
669
|
-
// Trim the delimiter from around the output string.
|
|
670
|
-
while (result.charAt(start) === "\0")
|
|
671
|
-
start++;
|
|
672
|
-
while (result.charAt(end - 1) === "\0")
|
|
673
|
-
end--;
|
|
674
|
-
// Transform each token independently.
|
|
675
|
-
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Replace `re` in the input string with the replacement value.
|
|
679
|
-
*/
|
|
680
|
-
function replace(input, re, value) {
|
|
681
|
-
if (re instanceof RegExp)
|
|
682
|
-
return input.replace(re, value);
|
|
683
|
-
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
function dotCase(input, options) {
|
|
687
|
-
if (options === void 0) { options = {}; }
|
|
688
|
-
return noCase(input, __assign({ delimiter: "." }, options));
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function snakeCase(input, options) {
|
|
692
|
-
if (options === void 0) { options = {}; }
|
|
693
|
-
return dotCase(input, __assign({ delimiter: "_" }, options));
|
|
694
|
-
}
|
|
695
|
-
|
|
696
621
|
var __defProp$3X = Object.defineProperty;
|
|
697
622
|
var __defProps$2s = Object.defineProperties;
|
|
698
623
|
var __getOwnPropDescs$2s = Object.getOwnPropertyDescriptors;
|
|
@@ -715,7 +640,7 @@ var __spreadProps$2s = (a, b) => __defProps$2s(a, __getOwnPropDescs$2s(b));
|
|
|
715
640
|
const eventParamsToSnakeCase = (params) => {
|
|
716
641
|
return Object.entries(params).reduce((acc, params2) => {
|
|
717
642
|
const [key, value] = params2;
|
|
718
|
-
const newKey = snakeCase(key);
|
|
643
|
+
const newKey = snakeCase.snakeCase(key);
|
|
719
644
|
return __spreadProps$2s(__spreadValues$3X({}, acc), {
|
|
720
645
|
[newKey]: value
|
|
721
646
|
});
|
|
@@ -959,20 +884,20 @@ const triageEventToProviders = (eventName, params, providersHandlers) => {
|
|
|
959
884
|
}, []);
|
|
960
885
|
eventSent(eventName, targetedProviders);
|
|
961
886
|
};
|
|
962
|
-
const getProductIdsFromShoppingCart = (shoppingCart
|
|
963
|
-
const products =
|
|
887
|
+
const getProductIdsFromShoppingCart = (shoppingCart) => {
|
|
888
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
964
889
|
return products.map((product) => product.productId);
|
|
965
890
|
};
|
|
966
|
-
const getProductContentFromShoppingCart = (shoppingCart
|
|
967
|
-
const products =
|
|
891
|
+
const getProductContentFromShoppingCart = (shoppingCart) => {
|
|
892
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
968
893
|
return products.map((product) => getProductContent(product));
|
|
969
894
|
};
|
|
970
895
|
const getProductContent = (product) => {
|
|
971
896
|
const totals = products.getProductTotals(product);
|
|
972
897
|
return `${product.name}:${totals.netPrice}`;
|
|
973
898
|
};
|
|
974
|
-
const mapProductsToGoogleItems = (shoppingCart
|
|
975
|
-
const products =
|
|
899
|
+
const mapProductsToGoogleItems = (shoppingCart, currency) => {
|
|
900
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
976
901
|
return products.map((product) => mapProductToGoogleItem(product, currency));
|
|
977
902
|
};
|
|
978
903
|
const mapProductToGoogleItem = (product, currency) => {
|
|
@@ -3368,7 +3293,7 @@ var __objRest$32 = (source, exclude) => {
|
|
|
3368
3293
|
const initiateCheckout$2 = (provider, params) => {
|
|
3369
3294
|
const { trackingId, userId: providerUserId } = provider;
|
|
3370
3295
|
const { currency: providerCurrency } = provider;
|
|
3371
|
-
const _a = params, { callback, userId, shoppingCart
|
|
3296
|
+
const _a = params, { callback, userId, shoppingCart, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
|
|
3372
3297
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
3373
3298
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3374
3299
|
const enhancedParams = __spreadProps$1_(__spreadValues$33({}, rest), {
|
|
@@ -3378,11 +3303,11 @@ const initiateCheckout$2 = (provider, params) => {
|
|
|
3378
3303
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3379
3304
|
const { meta } = getState();
|
|
3380
3305
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3381
|
-
const { total, totalPoints } =
|
|
3306
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3382
3307
|
gtag("event", "begin_checkout", __spreadValues$33(__spreadValues$33({
|
|
3383
3308
|
send_to: trackingId,
|
|
3384
3309
|
event_callback: callback,
|
|
3385
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
3310
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
3386
3311
|
value: total,
|
|
3387
3312
|
points: totalPoints != null ? totalPoints : 0
|
|
3388
3313
|
}, transformedParams), transformedMeta));
|
|
@@ -3422,7 +3347,7 @@ var __objRest$31 = (source, exclude) => {
|
|
|
3422
3347
|
const initiateCheckout$1 = (provider, params) => {
|
|
3423
3348
|
const { trackingId } = provider;
|
|
3424
3349
|
const { currency: providerCurrency } = provider;
|
|
3425
|
-
const _a = params, { shoppingCart
|
|
3350
|
+
const _a = params, { shoppingCart, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
|
|
3426
3351
|
delete rest.userId;
|
|
3427
3352
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3428
3353
|
const enhancedParams = __spreadProps$1Z(__spreadValues$32({}, rest), {
|
|
@@ -3431,11 +3356,11 @@ const initiateCheckout$1 = (provider, params) => {
|
|
|
3431
3356
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3432
3357
|
const { meta } = getState();
|
|
3433
3358
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3434
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
3435
|
-
const { total, totalPoints } =
|
|
3359
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
3360
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3436
3361
|
fbq("trackSingle", trackingId, "InitiateCheckout", __spreadValues$32(__spreadValues$32({
|
|
3437
3362
|
content_ids: productsIds,
|
|
3438
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
3363
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
3439
3364
|
num_items: productsIds.length,
|
|
3440
3365
|
value: total,
|
|
3441
3366
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -3475,7 +3400,7 @@ var __objRest$30 = (source, exclude) => {
|
|
|
3475
3400
|
};
|
|
3476
3401
|
const initiateCheckout = (provider, params) => {
|
|
3477
3402
|
const { currency: providerCurrency } = provider;
|
|
3478
|
-
const _a = params, { shoppingCart
|
|
3403
|
+
const _a = params, { shoppingCart, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
|
|
3479
3404
|
delete rest.userId;
|
|
3480
3405
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3481
3406
|
const enhancedParams = __spreadProps$1Y(__spreadValues$31({}, rest), {
|
|
@@ -3484,8 +3409,8 @@ const initiateCheckout = (provider, params) => {
|
|
|
3484
3409
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
3485
3410
|
const { meta } = getState();
|
|
3486
3411
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3487
|
-
const products =
|
|
3488
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
3412
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
3413
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
3489
3414
|
analytics.track("Initiate Checkout", __spreadValues$31(__spreadValues$31({
|
|
3490
3415
|
total,
|
|
3491
3416
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9187,7 +9112,7 @@ var __objRest$17 = (source, exclude) => {
|
|
|
9187
9112
|
const purchaseAttempt$2 = (provider, params) => {
|
|
9188
9113
|
const { trackingId, userId: providerUserId } = provider;
|
|
9189
9114
|
const { currency: providerCurrency } = provider;
|
|
9190
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9115
|
+
const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
|
|
9191
9116
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9192
9117
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9193
9118
|
const enhancedParams = __spreadProps$N(__spreadValues$18({}, rest), {
|
|
@@ -9197,11 +9122,11 @@ const purchaseAttempt$2 = (provider, params) => {
|
|
|
9197
9122
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9198
9123
|
const { meta } = getState();
|
|
9199
9124
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9200
|
-
const { total, totalPoints } =
|
|
9125
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9201
9126
|
gtag("event", "purchase_attempt", __spreadValues$18(__spreadValues$18({
|
|
9202
9127
|
send_to: trackingId,
|
|
9203
9128
|
event_callback: callback,
|
|
9204
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9129
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9205
9130
|
value: total,
|
|
9206
9131
|
points: totalPoints != null ? totalPoints : 0
|
|
9207
9132
|
}, transformedParams), transformedMeta));
|
|
@@ -9241,7 +9166,7 @@ var __objRest$16 = (source, exclude) => {
|
|
|
9241
9166
|
const purchaseAttempt$1 = (provider, params) => {
|
|
9242
9167
|
const { trackingId } = provider;
|
|
9243
9168
|
const { currency: providerCurrency } = provider;
|
|
9244
|
-
const _a = params, { currency, shoppingCart
|
|
9169
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
|
|
9245
9170
|
delete rest.userId;
|
|
9246
9171
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9247
9172
|
const enhancedParams = __spreadProps$M(__spreadValues$17({}, rest), {
|
|
@@ -9250,11 +9175,11 @@ const purchaseAttempt$1 = (provider, params) => {
|
|
|
9250
9175
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9251
9176
|
const { meta } = getState();
|
|
9252
9177
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9253
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9254
|
-
const { total, totalPoints } =
|
|
9178
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9179
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9255
9180
|
fbq("trackSingleCustom", trackingId, "PurchaseAttempt", __spreadValues$17(__spreadValues$17({
|
|
9256
9181
|
content_ids: productsIds,
|
|
9257
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9182
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9258
9183
|
num_items: productsIds.length,
|
|
9259
9184
|
value: total,
|
|
9260
9185
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9294,7 +9219,7 @@ var __objRest$15 = (source, exclude) => {
|
|
|
9294
9219
|
};
|
|
9295
9220
|
const purchaseAttempt = (provider, params) => {
|
|
9296
9221
|
const { currency: providerCurrency } = provider;
|
|
9297
|
-
const _a = params, { currency, shoppingCart
|
|
9222
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
|
|
9298
9223
|
delete rest.userId;
|
|
9299
9224
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9300
9225
|
const enhancedParams = __spreadProps$L(__spreadValues$16({}, rest), {
|
|
@@ -9303,8 +9228,8 @@ const purchaseAttempt = (provider, params) => {
|
|
|
9303
9228
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9304
9229
|
const { meta } = getState();
|
|
9305
9230
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9306
|
-
const products =
|
|
9307
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9231
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9232
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9308
9233
|
analytics.track("Purchase Attempt", __spreadValues$16(__spreadValues$16({
|
|
9309
9234
|
total,
|
|
9310
9235
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9357,7 +9282,7 @@ var __objRest$14 = (source, exclude) => {
|
|
|
9357
9282
|
const purchaseFail$2 = (provider, params) => {
|
|
9358
9283
|
const { trackingId, userId: providerUserId } = provider;
|
|
9359
9284
|
const { currency: providerCurrency } = provider;
|
|
9360
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9285
|
+
const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
|
|
9361
9286
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9362
9287
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9363
9288
|
const enhancedParams = __spreadProps$K(__spreadValues$15({}, rest), {
|
|
@@ -9367,11 +9292,11 @@ const purchaseFail$2 = (provider, params) => {
|
|
|
9367
9292
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9368
9293
|
const { meta } = getState();
|
|
9369
9294
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9370
|
-
const { total, totalPoints } =
|
|
9295
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9371
9296
|
gtag("event", "purchase_fail", __spreadValues$15(__spreadValues$15({
|
|
9372
9297
|
send_to: trackingId,
|
|
9373
9298
|
event_callback: callback,
|
|
9374
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9299
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9375
9300
|
value: total,
|
|
9376
9301
|
points: totalPoints != null ? totalPoints : 0
|
|
9377
9302
|
}, transformedParams), transformedMeta));
|
|
@@ -9411,7 +9336,7 @@ var __objRest$13 = (source, exclude) => {
|
|
|
9411
9336
|
const purchaseFail$1 = (provider, params) => {
|
|
9412
9337
|
const { trackingId } = provider;
|
|
9413
9338
|
const { currency: providerCurrency } = provider;
|
|
9414
|
-
const _a = params, { currency, shoppingCart
|
|
9339
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
|
|
9415
9340
|
delete rest.userId;
|
|
9416
9341
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9417
9342
|
const enhancedParams = __spreadProps$J(__spreadValues$14({}, rest), {
|
|
@@ -9420,11 +9345,11 @@ const purchaseFail$1 = (provider, params) => {
|
|
|
9420
9345
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9421
9346
|
const { meta } = getState();
|
|
9422
9347
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9423
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9424
|
-
const { total, totalPoints } =
|
|
9348
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9349
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9425
9350
|
fbq("trackSingleCustom", trackingId, "PurchaseFail", __spreadValues$14(__spreadValues$14({
|
|
9426
9351
|
content_ids: productsIds,
|
|
9427
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9352
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9428
9353
|
num_items: productsIds.length,
|
|
9429
9354
|
value: total,
|
|
9430
9355
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9464,7 +9389,7 @@ var __objRest$12 = (source, exclude) => {
|
|
|
9464
9389
|
};
|
|
9465
9390
|
const purchaseFail = (provider, params) => {
|
|
9466
9391
|
const { currency: providerCurrency } = provider;
|
|
9467
|
-
const _a = params, { currency, shoppingCart
|
|
9392
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
|
|
9468
9393
|
delete rest.userId;
|
|
9469
9394
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9470
9395
|
const enhancedParams = __spreadProps$I(__spreadValues$13({}, rest), {
|
|
@@ -9473,8 +9398,8 @@ const purchaseFail = (provider, params) => {
|
|
|
9473
9398
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9474
9399
|
const { meta } = getState();
|
|
9475
9400
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9476
|
-
const products =
|
|
9477
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9401
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9402
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9478
9403
|
analytics.track("Purchase Fail", __spreadValues$13(__spreadValues$13({
|
|
9479
9404
|
total,
|
|
9480
9405
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|
|
@@ -9527,21 +9452,21 @@ var __objRest$11 = (source, exclude) => {
|
|
|
9527
9452
|
const purchaseSuccess$2 = (provider, params) => {
|
|
9528
9453
|
const { trackingId, userId: providerUserId } = provider;
|
|
9529
9454
|
const { currency: providerCurrency } = provider;
|
|
9530
|
-
const _a = params, { callback, userId, currency, shoppingCart
|
|
9455
|
+
const _a = params, { callback, userId, currency, shoppingCart, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
|
|
9531
9456
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
9532
9457
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9533
9458
|
const enhancedParams = __spreadProps$H(__spreadValues$12({}, rest), {
|
|
9534
9459
|
userId: selectedUserId,
|
|
9535
9460
|
currency: selectedCurrency
|
|
9536
9461
|
});
|
|
9537
|
-
const { total, shippingCost, totalTaxes, totalPoints } =
|
|
9462
|
+
const { total, shippingCost, totalTaxes, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9538
9463
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9539
9464
|
const { meta } = getState();
|
|
9540
9465
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9541
9466
|
gtag("event", "purchase", __spreadValues$12(__spreadValues$12({
|
|
9542
9467
|
send_to: trackingId,
|
|
9543
9468
|
event_callback: callback,
|
|
9544
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
9469
|
+
items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
|
|
9545
9470
|
value: total,
|
|
9546
9471
|
points: totalPoints != null ? totalPoints : 0,
|
|
9547
9472
|
transaction_id: orderId,
|
|
@@ -9584,7 +9509,7 @@ var __objRest$10 = (source, exclude) => {
|
|
|
9584
9509
|
const purchaseSuccess$1 = (provider, params) => {
|
|
9585
9510
|
const { trackingId } = provider;
|
|
9586
9511
|
const { currency: providerCurrency } = provider;
|
|
9587
|
-
const _a = params, { currency, shoppingCart
|
|
9512
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
|
|
9588
9513
|
delete rest.userId;
|
|
9589
9514
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9590
9515
|
const enhancedParams = __spreadProps$G(__spreadValues$11({}, rest), {
|
|
@@ -9593,11 +9518,11 @@ const purchaseSuccess$1 = (provider, params) => {
|
|
|
9593
9518
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9594
9519
|
const { meta } = getState();
|
|
9595
9520
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9596
|
-
const productsIds = getProductIdsFromShoppingCart(shoppingCart
|
|
9597
|
-
const { total, totalPoints } =
|
|
9521
|
+
const productsIds = getProductIdsFromShoppingCart(shoppingCart);
|
|
9522
|
+
const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9598
9523
|
fbq("trackSingle", trackingId, "Purchase", __spreadValues$11(__spreadValues$11({
|
|
9599
9524
|
content_ids: productsIds,
|
|
9600
|
-
contents: getProductContentFromShoppingCart(shoppingCart
|
|
9525
|
+
contents: getProductContentFromShoppingCart(shoppingCart),
|
|
9601
9526
|
num_items: productsIds.length,
|
|
9602
9527
|
value: total,
|
|
9603
9528
|
points: totalPoints != null ? totalPoints : 0
|
|
@@ -9637,7 +9562,7 @@ var __objRest$$ = (source, exclude) => {
|
|
|
9637
9562
|
};
|
|
9638
9563
|
const purchaseSuccess = (provider, params) => {
|
|
9639
9564
|
const { currency: providerCurrency } = provider;
|
|
9640
|
-
const _a = params, { currency, shoppingCart
|
|
9565
|
+
const _a = params, { currency, shoppingCart } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
|
|
9641
9566
|
delete rest.userId;
|
|
9642
9567
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
9643
9568
|
const enhancedParams = __spreadProps$F(__spreadValues$10({}, rest), {
|
|
@@ -9646,8 +9571,8 @@ const purchaseSuccess = (provider, params) => {
|
|
|
9646
9571
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
9647
9572
|
const { meta } = getState();
|
|
9648
9573
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
9649
|
-
const products =
|
|
9650
|
-
const { total, totalTaxes, shippingCost, totalPoints } =
|
|
9574
|
+
const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
|
|
9575
|
+
const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
|
|
9651
9576
|
analytics.track("Order Completed", __spreadValues$10(__spreadValues$10({
|
|
9652
9577
|
total,
|
|
9653
9578
|
revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
|