@artisan-commerce/analytics-capacitor 0.1.0-canary.8 → 0.1.0-canary.9

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.
@@ -5,13 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var state = require('@artisan-commerce/state');
6
6
  var core = require('@capacitor/core');
7
7
  var firebaseAnalytics = require('@capacitor-community/firebase-analytics');
8
+ var snakeCase = require('snake-case');
8
9
  var facebookAnalyticsCapacitor = require('facebook-analytics-capacitor');
9
- var shoppingCart = require('@artisan-commerce/shopping-cart');
10
+ var shoppingCartCore = require('@artisan-commerce/shopping-cart-core');
10
11
  var products = require('@artisan-commerce/products');
11
12
 
12
13
  var name = "@artisan-commerce/analytics-capacitor";
13
14
  var description = "Artisn commerce analytics capacitor library";
14
- var version = "0.1.0-canary.7";
15
+ var version = "0.1.0-canary.8";
15
16
  var main = "./dist/bundle.cjs.js";
16
17
  var module$1 = "./dist/bundle.esm.js";
17
18
  var types = "./dist/bundle.d.ts";
@@ -44,8 +45,8 @@ var dependencies = {
44
45
  "snake-case": "^3.0.4"
45
46
  };
46
47
  var devDependencies = {
47
- "@artisan-commerce/products": "0.9.0-canary.48",
48
- "@artisan-commerce/shopping-cart": "0.12.0-canary.71",
48
+ "@artisan-commerce/shopping-cart-core": "^0.12.0-canary.70",
49
+ "@artisan-commerce/products": "0.9.0-canary.49",
49
50
  "@artisan-commerce/state": "0.3.0-canary.8",
50
51
  "@artisan-commerce/types": "0.14.0-canary.37",
51
52
  "@capacitor-community/firebase-analytics": "^1.0.1",
@@ -53,8 +54,8 @@ var devDependencies = {
53
54
  "facebook-analytics-capacitor": "^1.0.0"
54
55
  };
55
56
  var peerDependencies = {
57
+ "@artisan-commerce/shopping-cart-core": "*",
56
58
  "@artisan-commerce/products": "*",
57
- "@artisan-commerce/shopping-cart": "*",
58
59
  "@artisan-commerce/state": "*",
59
60
  "@capacitor-community/firebase-analytics": "*",
60
61
  "@capacitor/core": "^3.0.0",
@@ -626,82 +627,6 @@ const initAnalytics = (config) => {
626
627
  setState({ initialized: true });
627
628
  };
628
629
 
629
- /******************************************************************************
630
- Copyright (c) Microsoft Corporation.
631
-
632
- Permission to use, copy, modify, and/or distribute this software for any
633
- purpose with or without fee is hereby granted.
634
-
635
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
636
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
637
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
638
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
639
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
640
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
641
- PERFORMANCE OF THIS SOFTWARE.
642
- ***************************************************************************** */
643
-
644
- var __assign = function() {
645
- __assign = Object.assign || function __assign(t) {
646
- for (var s, i = 1, n = arguments.length; i < n; i++) {
647
- s = arguments[i];
648
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
649
- }
650
- return t;
651
- };
652
- return __assign.apply(this, arguments);
653
- };
654
-
655
- /**
656
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
657
- */
658
- /**
659
- * Lower case as a function.
660
- */
661
- function lowerCase(str) {
662
- return str.toLowerCase();
663
- }
664
-
665
- // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
666
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
667
- // Remove all non-word characters.
668
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
669
- /**
670
- * Normalize the string into something other libraries can manipulate easier.
671
- */
672
- function noCase(input, options) {
673
- if (options === void 0) { options = {}; }
674
- 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;
675
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
676
- var start = 0;
677
- var end = result.length;
678
- // Trim the delimiter from around the output string.
679
- while (result.charAt(start) === "\0")
680
- start++;
681
- while (result.charAt(end - 1) === "\0")
682
- end--;
683
- // Transform each token independently.
684
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
685
- }
686
- /**
687
- * Replace `re` in the input string with the replacement value.
688
- */
689
- function replace(input, re, value) {
690
- if (re instanceof RegExp)
691
- return input.replace(re, value);
692
- return re.reduce(function (input, re) { return input.replace(re, value); }, input);
693
- }
694
-
695
- function dotCase(input, options) {
696
- if (options === void 0) { options = {}; }
697
- return noCase(input, __assign({ delimiter: "." }, options));
698
- }
699
-
700
- function snakeCase(input, options) {
701
- if (options === void 0) { options = {}; }
702
- return dotCase(input, __assign({ delimiter: "_" }, options));
703
- }
704
-
705
630
  var __defProp$3X = Object.defineProperty;
706
631
  var __defProps$2s = Object.defineProperties;
707
632
  var __getOwnPropDescs$2s = Object.getOwnPropertyDescriptors;
@@ -724,7 +649,7 @@ var __spreadProps$2s = (a, b) => __defProps$2s(a, __getOwnPropDescs$2s(b));
724
649
  const eventParamsToSnakeCase = (params) => {
725
650
  return Object.entries(params).reduce((acc, params2) => {
726
651
  const [key, value] = params2;
727
- const newKey = snakeCase(key);
652
+ const newKey = snakeCase.snakeCase(key);
728
653
  return __spreadProps$2s(__spreadValues$3X({}, acc), {
729
654
  [newKey]: value
730
655
  });
@@ -982,20 +907,20 @@ const triageEventToProviders = (eventName, params, providersHandlers) => {
982
907
  }, []);
983
908
  eventSent(eventName, targetedProviders);
984
909
  };
985
- const getProductIdsFromShoppingCart = (shoppingCart$1) => {
986
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
910
+ const getProductIdsFromShoppingCart = (shoppingCart) => {
911
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
987
912
  return products.map((product) => product.productId);
988
913
  };
989
- const getProductContentFromShoppingCart = (shoppingCart$1) => {
990
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
914
+ const getProductContentFromShoppingCart = (shoppingCart) => {
915
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
991
916
  return products.map((product) => getProductContent(product));
992
917
  };
993
918
  const getProductContent = (product) => {
994
919
  const totals = products.getProductTotals(product);
995
920
  return `${product.name}:${totals.netPrice}`;
996
921
  };
997
- const mapProductsToGoogleItems = (shoppingCart$1, currency) => {
998
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
922
+ const mapProductsToGoogleItems = (shoppingCart, currency) => {
923
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
999
924
  return products.map((product) => mapProductToGoogleItem(product, currency));
1000
925
  };
1001
926
  const mapProductToGoogleItem = (product, currency) => {
@@ -3643,7 +3568,7 @@ var __objRest$32 = (source, exclude) => {
3643
3568
  const initiateCheckout$2 = (provider, params) => {
3644
3569
  const { trackingId, userId: providerUserId } = provider;
3645
3570
  const { currency: providerCurrency } = provider;
3646
- const _a = params, { callback, userId, shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3571
+ const _a = params, { callback, userId, shoppingCart, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3647
3572
  const selectedUserId = userId != null ? userId : providerUserId;
3648
3573
  const selectedCurrency = currency != null ? currency : providerCurrency;
3649
3574
  const enhancedParams = __spreadProps$1_(__spreadValues$33({}, rest), {
@@ -3653,12 +3578,12 @@ const initiateCheckout$2 = (provider, params) => {
3653
3578
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3654
3579
  const { meta } = getState();
3655
3580
  const transformedMeta = eventParamsToSnakeCase(meta);
3656
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3581
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3657
3582
  if (core.Capacitor.isNativePlatform()) {
3658
3583
  firebaseAnalytics.FirebaseAnalytics.logEvent({
3659
3584
  name: "begin_checkout",
3660
3585
  params: __spreadValues$33(__spreadValues$33({
3661
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
3586
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
3662
3587
  value: total,
3663
3588
  points: totalPoints != null ? totalPoints : 0
3664
3589
  }, transformedParams), transformedMeta)
@@ -3667,7 +3592,7 @@ const initiateCheckout$2 = (provider, params) => {
3667
3592
  gtag("event", "begin_checkout", __spreadValues$33(__spreadValues$33({
3668
3593
  send_to: trackingId,
3669
3594
  event_callback: callback,
3670
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
3595
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
3671
3596
  value: total,
3672
3597
  points: totalPoints != null ? totalPoints : 0
3673
3598
  }, transformedParams), transformedMeta));
@@ -3708,7 +3633,7 @@ var __objRest$31 = (source, exclude) => {
3708
3633
  const initiateCheckout$1 = (provider, params) => {
3709
3634
  const { trackingId } = provider;
3710
3635
  const { currency: providerCurrency } = provider;
3711
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3636
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3712
3637
  delete rest.userId;
3713
3638
  const selectedCurrency = currency != null ? currency : providerCurrency;
3714
3639
  const enhancedParams = __spreadProps$1Z(__spreadValues$32({}, rest), {
@@ -3717,9 +3642,9 @@ const initiateCheckout$1 = (provider, params) => {
3717
3642
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3718
3643
  const { meta } = getState();
3719
3644
  const transformedMeta = eventParamsToSnakeCase(meta);
3720
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
3721
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3722
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
3645
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
3646
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3647
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
3723
3648
  if (core.Capacitor.isNativePlatform()) {
3724
3649
  facebookAnalyticsCapacitor.FacebookAnalytics.logEvent({
3725
3650
  event: "fb_mobile_initiated_checkout",
@@ -3777,7 +3702,7 @@ var __objRest$30 = (source, exclude) => {
3777
3702
  };
3778
3703
  const initiateCheckout = (provider, params) => {
3779
3704
  const { currency: providerCurrency } = provider;
3780
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3705
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3781
3706
  delete rest.userId;
3782
3707
  const selectedCurrency = currency != null ? currency : providerCurrency;
3783
3708
  const enhancedParams = __spreadProps$1Y(__spreadValues$31({}, rest), {
@@ -3786,8 +3711,8 @@ const initiateCheckout = (provider, params) => {
3786
3711
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3787
3712
  const { meta } = getState();
3788
3713
  const transformedMeta = eventParamsToSnakeCase(meta);
3789
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
3790
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3714
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
3715
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3791
3716
  analytics.track("Initiate Checkout", __spreadValues$31(__spreadValues$31({
3792
3717
  total,
3793
3718
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -10123,7 +10048,7 @@ var __objRest$17 = (source, exclude) => {
10123
10048
  const purchaseAttempt$2 = (provider, params) => {
10124
10049
  const { trackingId, userId: providerUserId } = provider;
10125
10050
  const { currency: providerCurrency } = provider;
10126
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
10051
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
10127
10052
  const selectedUserId = userId != null ? userId : providerUserId;
10128
10053
  const selectedCurrency = currency != null ? currency : providerCurrency;
10129
10054
  const enhancedParams = __spreadProps$N(__spreadValues$18({}, rest), {
@@ -10133,8 +10058,8 @@ const purchaseAttempt$2 = (provider, params) => {
10133
10058
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10134
10059
  const { meta } = getState();
10135
10060
  const transformedMeta = eventParamsToSnakeCase(meta);
10136
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10137
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
10061
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10062
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
10138
10063
  if (core.Capacitor.isNativePlatform()) {
10139
10064
  firebaseAnalytics.FirebaseAnalytics.logEvent({
10140
10065
  name: "purchase_attempt",
@@ -10148,7 +10073,7 @@ const purchaseAttempt$2 = (provider, params) => {
10148
10073
  gtag("event", "purchase_attempt", __spreadValues$18(__spreadValues$18({
10149
10074
  send_to: trackingId,
10150
10075
  event_callback: callback,
10151
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
10076
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
10152
10077
  value: total,
10153
10078
  points: totalPoints != null ? totalPoints : 0
10154
10079
  }, transformedParams), transformedMeta));
@@ -10189,16 +10114,16 @@ var __objRest$16 = (source, exclude) => {
10189
10114
  const purchaseAttempt$1 = (provider, params) => {
10190
10115
  const { trackingId } = provider;
10191
10116
  const { currency: providerCurrency } = provider;
10192
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
10117
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
10193
10118
  delete rest.userId;
10194
10119
  const selectedCurrency = currency != null ? currency : providerCurrency;
10195
10120
  const enhancedParams = __spreadProps$M(__spreadValues$17({}, rest), { currency: selectedCurrency });
10196
10121
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10197
10122
  const { meta } = getState();
10198
10123
  const transformedMeta = eventParamsToSnakeCase(meta);
10199
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
10200
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10201
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
10124
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
10125
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10126
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
10202
10127
  if (core.Capacitor.isNativePlatform()) {
10203
10128
  facebookAnalyticsCapacitor.FacebookAnalytics.logEvent({
10204
10129
  event: "PurchaseAttempt",
@@ -10256,7 +10181,7 @@ var __objRest$15 = (source, exclude) => {
10256
10181
  };
10257
10182
  const purchaseAttempt = (provider, params) => {
10258
10183
  const { currency: providerCurrency } = provider;
10259
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
10184
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
10260
10185
  delete rest.userId;
10261
10186
  const selectedCurrency = currency != null ? currency : providerCurrency;
10262
10187
  const enhancedParams = __spreadProps$L(__spreadValues$16({}, rest), {
@@ -10265,8 +10190,8 @@ const purchaseAttempt = (provider, params) => {
10265
10190
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10266
10191
  const { meta } = getState();
10267
10192
  const transformedMeta = eventParamsToSnakeCase(meta);
10268
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
10269
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10193
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
10194
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10270
10195
  analytics.track("Purchase Attempt", __spreadValues$16(__spreadValues$16({
10271
10196
  total,
10272
10197
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -10319,7 +10244,7 @@ var __objRest$14 = (source, exclude) => {
10319
10244
  const purchaseFail$2 = (provider, params) => {
10320
10245
  const { trackingId, userId: providerUserId } = provider;
10321
10246
  const { currency: providerCurrency } = provider;
10322
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
10247
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
10323
10248
  const selectedUserId = userId != null ? userId : providerUserId;
10324
10249
  const selectedCurrency = currency != null ? currency : providerCurrency;
10325
10250
  const enhancedParams = __spreadProps$K(__spreadValues$15({}, rest), {
@@ -10329,8 +10254,8 @@ const purchaseFail$2 = (provider, params) => {
10329
10254
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10330
10255
  const { meta } = getState();
10331
10256
  const transformedMeta = eventParamsToSnakeCase(meta);
10332
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10333
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
10257
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10258
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
10334
10259
  if (core.Capacitor.isNativePlatform()) {
10335
10260
  firebaseAnalytics.FirebaseAnalytics.logEvent({
10336
10261
  name: "purchase_fail",
@@ -10344,7 +10269,7 @@ const purchaseFail$2 = (provider, params) => {
10344
10269
  gtag("event", "purchase_fail", __spreadValues$15(__spreadValues$15({
10345
10270
  send_to: trackingId,
10346
10271
  event_callback: callback,
10347
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
10272
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
10348
10273
  value: total,
10349
10274
  points: totalPoints != null ? totalPoints : 0
10350
10275
  }, transformedParams), transformedMeta));
@@ -10385,7 +10310,7 @@ var __objRest$13 = (source, exclude) => {
10385
10310
  const purchaseFail$1 = (provider, params) => {
10386
10311
  const { trackingId } = provider;
10387
10312
  const { currency: providerCurrency } = provider;
10388
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
10313
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
10389
10314
  delete rest.userId;
10390
10315
  const selectedCurrency = currency != null ? currency : providerCurrency;
10391
10316
  const enhancedParams = __spreadProps$J(__spreadValues$14({}, rest), {
@@ -10394,9 +10319,9 @@ const purchaseFail$1 = (provider, params) => {
10394
10319
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10395
10320
  const { meta } = getState();
10396
10321
  const transformedMeta = eventParamsToSnakeCase(meta);
10397
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
10398
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10399
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
10322
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
10323
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10324
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
10400
10325
  if (core.Capacitor.isNativePlatform()) {
10401
10326
  facebookAnalyticsCapacitor.FacebookAnalytics.logEvent({
10402
10327
  event: "PurchaseFail",
@@ -10454,7 +10379,7 @@ var __objRest$12 = (source, exclude) => {
10454
10379
  };
10455
10380
  const purchaseFail = (provider, params) => {
10456
10381
  const { currency: providerCurrency } = provider;
10457
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
10382
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
10458
10383
  delete rest.userId;
10459
10384
  const selectedCurrency = currency != null ? currency : providerCurrency;
10460
10385
  const enhancedParams = __spreadProps$I(__spreadValues$13({}, rest), {
@@ -10463,8 +10388,8 @@ const purchaseFail = (provider, params) => {
10463
10388
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10464
10389
  const { meta } = getState();
10465
10390
  const transformedMeta = eventParamsToSnakeCase(meta);
10466
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
10467
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10391
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
10392
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10468
10393
  analytics.track("Purchase Fail", __spreadValues$13(__spreadValues$13({
10469
10394
  total,
10470
10395
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -10517,14 +10442,14 @@ var __objRest$11 = (source, exclude) => {
10517
10442
  const purchaseSuccess$2 = (provider, params) => {
10518
10443
  const { trackingId, userId: providerUserId } = provider;
10519
10444
  const { currency: providerCurrency } = provider;
10520
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
10445
+ const _a = params, { callback, userId, currency, shoppingCart, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
10521
10446
  const selectedUserId = userId != null ? userId : providerUserId;
10522
10447
  const selectedCurrency = currency != null ? currency : providerCurrency;
10523
10448
  const enhancedParams = __spreadProps$H(__spreadValues$12({}, rest), {
10524
10449
  userId: selectedUserId,
10525
10450
  currency: selectedCurrency
10526
10451
  });
10527
- const { total, shippingCost, totalTaxes, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10452
+ const { total, shippingCost, totalTaxes, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10528
10453
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10529
10454
  const { meta } = getState();
10530
10455
  const transformedMeta = eventParamsToSnakeCase(meta);
@@ -10532,7 +10457,7 @@ const purchaseSuccess$2 = (provider, params) => {
10532
10457
  firebaseAnalytics.FirebaseAnalytics.logEvent({
10533
10458
  name: "purchase",
10534
10459
  params: __spreadValues$12(__spreadValues$12({
10535
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
10460
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
10536
10461
  value: total,
10537
10462
  points: totalPoints != null ? totalPoints : 0,
10538
10463
  transaction_id: orderId,
@@ -10544,7 +10469,7 @@ const purchaseSuccess$2 = (provider, params) => {
10544
10469
  gtag("event", "purchase", __spreadValues$12(__spreadValues$12({
10545
10470
  send_to: trackingId,
10546
10471
  event_callback: callback,
10547
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
10472
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
10548
10473
  value: total,
10549
10474
  points: totalPoints != null ? totalPoints : 0,
10550
10475
  transaction_id: orderId,
@@ -10588,7 +10513,7 @@ var __objRest$10 = (source, exclude) => {
10588
10513
  const purchaseSuccess$1 = (provider, params) => {
10589
10514
  const { trackingId } = provider;
10590
10515
  const { currency: providerCurrency } = provider;
10591
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
10516
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
10592
10517
  delete rest.userId;
10593
10518
  const selectedCurrency = currency != null ? currency : providerCurrency;
10594
10519
  const enhancedParams = __spreadProps$G(__spreadValues$11({}, rest), {
@@ -10597,9 +10522,9 @@ const purchaseSuccess$1 = (provider, params) => {
10597
10522
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10598
10523
  const { meta } = getState();
10599
10524
  const transformedMeta = eventParamsToSnakeCase(meta);
10600
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
10601
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10602
- const productContents = getProductContentFromShoppingCart(shoppingCart$1);
10525
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
10526
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10527
+ const productContents = getProductContentFromShoppingCart(shoppingCart);
10603
10528
  if (core.Capacitor.isNativePlatform()) {
10604
10529
  facebookAnalyticsCapacitor.FacebookAnalytics.logEvent({
10605
10530
  event: "Purchase",
@@ -10658,7 +10583,7 @@ var __objRest$$ = (source, exclude) => {
10658
10583
  };
10659
10584
  const purchaseSuccess = (provider, params) => {
10660
10585
  const { currency: providerCurrency } = provider;
10661
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
10586
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
10662
10587
  delete rest.userId;
10663
10588
  const selectedCurrency = currency != null ? currency : providerCurrency;
10664
10589
  const enhancedParams = __spreadProps$F(__spreadValues$10({}, rest), {
@@ -10667,8 +10592,8 @@ const purchaseSuccess = (provider, params) => {
10667
10592
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
10668
10593
  const { meta } = getState();
10669
10594
  const transformedMeta = eventParamsToSnakeCase(meta);
10670
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
10671
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
10595
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
10596
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
10672
10597
  analytics.track("Order Completed", __spreadValues$10(__spreadValues$10({
10673
10598
  total,
10674
10599
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),