@artisan-commerce/analytics-web 0.2.0-canary.75 → 0.2.0-canary.77

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.
@@ -2,13 +2,48 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var state = require('@artisan-commerce/state');
6
- var shoppingCart = require('@artisan-commerce/shopping-cart');
5
+ var snakeCase = require('snake-case');
6
+ var shoppingCartCore = require('@artisan-commerce/shopping-cart-core');
7
7
  var products = require('@artisan-commerce/products');
8
8
 
9
+ var __defProp$41 = Object.defineProperty;
10
+ var __getOwnPropSymbols$41 = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp$41 = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum$41 = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp$41 = (obj, key, value) => key in obj ? __defProp$41(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues$41 = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp$41.call(b, prop))
17
+ __defNormalProp$41(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols$41)
19
+ for (var prop of __getOwnPropSymbols$41(b)) {
20
+ if (__propIsEnum$41.call(b, prop))
21
+ __defNormalProp$41(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ let state = null;
26
+ const initState = (initialState) => {
27
+ Object.freeze(initialState);
28
+ state = __spreadValues$41({}, initialState);
29
+ Object.seal(state);
30
+ };
31
+ const setState$1 = (overrides) => {
32
+ const tempState = state ? __spreadValues$41({}, state) : {};
33
+ state = null;
34
+ state = __spreadValues$41(__spreadValues$41({}, tempState), overrides);
35
+ Object.seal(state);
36
+ };
37
+ const getState$1 = () => {
38
+ if (state === null) {
39
+ throw new Error("The state has not been initialized, make sure to call initState beforehand");
40
+ }
41
+ return __spreadValues$41({}, state);
42
+ };
43
+
9
44
  var name = "@artisan-commerce/analytics-web";
10
45
  var description = "Artisn commerce analytics web library";
11
- var version = "0.2.0-canary.74";
46
+ var version = "0.2.0-canary.76";
12
47
  var main = "./dist/bundle.cjs.js";
13
48
  var module$1 = "./dist/bundle.esm.js";
14
49
  var types = "./dist/bundle.d.ts";
@@ -41,14 +76,14 @@ var dependencies = {
41
76
  "snake-case": "^3.0.4"
42
77
  };
43
78
  var devDependencies = {
44
- "@artisan-commerce/products": "0.9.0-canary.48",
45
- "@artisan-commerce/shopping-cart": "0.12.0-canary.71",
46
- "@artisan-commerce/state": "0.3.0-canary.8",
47
- "@artisan-commerce/types": "0.14.0-canary.37"
79
+ "@artisan-commerce/products": "0.9.0-canary.50",
80
+ "@artisan-commerce/shopping-cart-core": "0.12.0-canary.73",
81
+ "@artisan-commerce/state": "0.3.0-canary.9",
82
+ "@artisan-commerce/types": "0.14.0-canary.38"
48
83
  };
49
84
  var peerDependencies = {
50
85
  "@artisan-commerce/products": "*",
51
- "@artisan-commerce/shopping-cart": "*",
86
+ "@artisan-commerce/shopping-cart-core": "*",
52
87
  "@artisan-commerce/state": "*"
53
88
  };
54
89
  var nx = {
@@ -110,10 +145,10 @@ const initialState = {
110
145
  }
111
146
  };
112
147
  const setInitialState = () => {
113
- state.initState(initialState);
148
+ initState(initialState);
114
149
  };
115
- const getState = () => state.getState();
116
- const setState = (state$1) => state.setState(state$1);
150
+ const getState = () => getState$1();
151
+ const setState = (state) => setState$1(state);
117
152
 
118
153
  const CONSTANTS = {
119
154
  GLOBAL_TRACKING_ID: "G-JZ7R91ZNMB"
@@ -617,82 +652,6 @@ const initAnalytics = (config) => {
617
652
  setState({ initialized: true });
618
653
  };
619
654
 
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
655
  var __defProp$3X = Object.defineProperty;
697
656
  var __defProps$2s = Object.defineProperties;
698
657
  var __getOwnPropDescs$2s = Object.getOwnPropertyDescriptors;
@@ -715,7 +674,7 @@ var __spreadProps$2s = (a, b) => __defProps$2s(a, __getOwnPropDescs$2s(b));
715
674
  const eventParamsToSnakeCase = (params) => {
716
675
  return Object.entries(params).reduce((acc, params2) => {
717
676
  const [key, value] = params2;
718
- const newKey = snakeCase(key);
677
+ const newKey = snakeCase.snakeCase(key);
719
678
  return __spreadProps$2s(__spreadValues$3X({}, acc), {
720
679
  [newKey]: value
721
680
  });
@@ -959,20 +918,20 @@ const triageEventToProviders = (eventName, params, providersHandlers) => {
959
918
  }, []);
960
919
  eventSent(eventName, targetedProviders);
961
920
  };
962
- const getProductIdsFromShoppingCart = (shoppingCart$1) => {
963
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
921
+ const getProductIdsFromShoppingCart = (shoppingCart) => {
922
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
964
923
  return products.map((product) => product.productId);
965
924
  };
966
- const getProductContentFromShoppingCart = (shoppingCart$1) => {
967
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
925
+ const getProductContentFromShoppingCart = (shoppingCart) => {
926
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
968
927
  return products.map((product) => getProductContent(product));
969
928
  };
970
929
  const getProductContent = (product) => {
971
930
  const totals = products.getProductTotals(product);
972
931
  return `${product.name}:${totals.netPrice}`;
973
932
  };
974
- const mapProductsToGoogleItems = (shoppingCart$1, currency) => {
975
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
933
+ const mapProductsToGoogleItems = (shoppingCart, currency) => {
934
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
976
935
  return products.map((product) => mapProductToGoogleItem(product, currency));
977
936
  };
978
937
  const mapProductToGoogleItem = (product, currency) => {
@@ -3368,7 +3327,7 @@ var __objRest$32 = (source, exclude) => {
3368
3327
  const initiateCheckout$2 = (provider, params) => {
3369
3328
  const { trackingId, userId: providerUserId } = provider;
3370
3329
  const { currency: providerCurrency } = provider;
3371
- const _a = params, { callback, userId, shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3330
+ const _a = params, { callback, userId, shoppingCart, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3372
3331
  const selectedUserId = userId != null ? userId : providerUserId;
3373
3332
  const selectedCurrency = currency != null ? currency : providerCurrency;
3374
3333
  const enhancedParams = __spreadProps$1_(__spreadValues$33({}, rest), {
@@ -3378,11 +3337,11 @@ const initiateCheckout$2 = (provider, params) => {
3378
3337
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3379
3338
  const { meta } = getState();
3380
3339
  const transformedMeta = eventParamsToSnakeCase(meta);
3381
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3340
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3382
3341
  gtag("event", "begin_checkout", __spreadValues$33(__spreadValues$33({
3383
3342
  send_to: trackingId,
3384
3343
  event_callback: callback,
3385
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
3344
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
3386
3345
  value: total,
3387
3346
  points: totalPoints != null ? totalPoints : 0
3388
3347
  }, transformedParams), transformedMeta));
@@ -3422,7 +3381,7 @@ var __objRest$31 = (source, exclude) => {
3422
3381
  const initiateCheckout$1 = (provider, params) => {
3423
3382
  const { trackingId } = provider;
3424
3383
  const { currency: providerCurrency } = provider;
3425
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3384
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3426
3385
  delete rest.userId;
3427
3386
  const selectedCurrency = currency != null ? currency : providerCurrency;
3428
3387
  const enhancedParams = __spreadProps$1Z(__spreadValues$32({}, rest), {
@@ -3431,11 +3390,11 @@ const initiateCheckout$1 = (provider, params) => {
3431
3390
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3432
3391
  const { meta } = getState();
3433
3392
  const transformedMeta = eventParamsToSnakeCase(meta);
3434
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
3435
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3393
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
3394
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3436
3395
  fbq("trackSingle", trackingId, "InitiateCheckout", __spreadValues$32(__spreadValues$32({
3437
3396
  content_ids: productsIds,
3438
- contents: getProductContentFromShoppingCart(shoppingCart$1),
3397
+ contents: getProductContentFromShoppingCart(shoppingCart),
3439
3398
  num_items: productsIds.length,
3440
3399
  value: total,
3441
3400
  points: totalPoints != null ? totalPoints : 0
@@ -3475,7 +3434,7 @@ var __objRest$30 = (source, exclude) => {
3475
3434
  };
3476
3435
  const initiateCheckout = (provider, params) => {
3477
3436
  const { currency: providerCurrency } = provider;
3478
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3437
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3479
3438
  delete rest.userId;
3480
3439
  const selectedCurrency = currency != null ? currency : providerCurrency;
3481
3440
  const enhancedParams = __spreadProps$1Y(__spreadValues$31({}, rest), {
@@ -3484,8 +3443,8 @@ const initiateCheckout = (provider, params) => {
3484
3443
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3485
3444
  const { meta } = getState();
3486
3445
  const transformedMeta = eventParamsToSnakeCase(meta);
3487
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
3488
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3446
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
3447
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3489
3448
  analytics.track("Initiate Checkout", __spreadValues$31(__spreadValues$31({
3490
3449
  total,
3491
3450
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9187,7 +9146,7 @@ var __objRest$17 = (source, exclude) => {
9187
9146
  const purchaseAttempt$2 = (provider, params) => {
9188
9147
  const { trackingId, userId: providerUserId } = provider;
9189
9148
  const { currency: providerCurrency } = provider;
9190
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
9149
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
9191
9150
  const selectedUserId = userId != null ? userId : providerUserId;
9192
9151
  const selectedCurrency = currency != null ? currency : providerCurrency;
9193
9152
  const enhancedParams = __spreadProps$N(__spreadValues$18({}, rest), {
@@ -9197,11 +9156,11 @@ const purchaseAttempt$2 = (provider, params) => {
9197
9156
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9198
9157
  const { meta } = getState();
9199
9158
  const transformedMeta = eventParamsToSnakeCase(meta);
9200
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9159
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9201
9160
  gtag("event", "purchase_attempt", __spreadValues$18(__spreadValues$18({
9202
9161
  send_to: trackingId,
9203
9162
  event_callback: callback,
9204
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9163
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9205
9164
  value: total,
9206
9165
  points: totalPoints != null ? totalPoints : 0
9207
9166
  }, transformedParams), transformedMeta));
@@ -9241,7 +9200,7 @@ var __objRest$16 = (source, exclude) => {
9241
9200
  const purchaseAttempt$1 = (provider, params) => {
9242
9201
  const { trackingId } = provider;
9243
9202
  const { currency: providerCurrency } = provider;
9244
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
9203
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
9245
9204
  delete rest.userId;
9246
9205
  const selectedCurrency = currency != null ? currency : providerCurrency;
9247
9206
  const enhancedParams = __spreadProps$M(__spreadValues$17({}, rest), {
@@ -9250,11 +9209,11 @@ const purchaseAttempt$1 = (provider, params) => {
9250
9209
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9251
9210
  const { meta } = getState();
9252
9211
  const transformedMeta = eventParamsToSnakeCase(meta);
9253
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9254
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9212
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9213
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9255
9214
  fbq("trackSingleCustom", trackingId, "PurchaseAttempt", __spreadValues$17(__spreadValues$17({
9256
9215
  content_ids: productsIds,
9257
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9216
+ contents: getProductContentFromShoppingCart(shoppingCart),
9258
9217
  num_items: productsIds.length,
9259
9218
  value: total,
9260
9219
  points: totalPoints != null ? totalPoints : 0
@@ -9294,7 +9253,7 @@ var __objRest$15 = (source, exclude) => {
9294
9253
  };
9295
9254
  const purchaseAttempt = (provider, params) => {
9296
9255
  const { currency: providerCurrency } = provider;
9297
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
9256
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
9298
9257
  delete rest.userId;
9299
9258
  const selectedCurrency = currency != null ? currency : providerCurrency;
9300
9259
  const enhancedParams = __spreadProps$L(__spreadValues$16({}, rest), {
@@ -9303,8 +9262,8 @@ const purchaseAttempt = (provider, params) => {
9303
9262
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9304
9263
  const { meta } = getState();
9305
9264
  const transformedMeta = eventParamsToSnakeCase(meta);
9306
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9307
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9265
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9266
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9308
9267
  analytics.track("Purchase Attempt", __spreadValues$16(__spreadValues$16({
9309
9268
  total,
9310
9269
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9357,7 +9316,7 @@ var __objRest$14 = (source, exclude) => {
9357
9316
  const purchaseFail$2 = (provider, params) => {
9358
9317
  const { trackingId, userId: providerUserId } = provider;
9359
9318
  const { currency: providerCurrency } = provider;
9360
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
9319
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
9361
9320
  const selectedUserId = userId != null ? userId : providerUserId;
9362
9321
  const selectedCurrency = currency != null ? currency : providerCurrency;
9363
9322
  const enhancedParams = __spreadProps$K(__spreadValues$15({}, rest), {
@@ -9367,11 +9326,11 @@ const purchaseFail$2 = (provider, params) => {
9367
9326
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9368
9327
  const { meta } = getState();
9369
9328
  const transformedMeta = eventParamsToSnakeCase(meta);
9370
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9329
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9371
9330
  gtag("event", "purchase_fail", __spreadValues$15(__spreadValues$15({
9372
9331
  send_to: trackingId,
9373
9332
  event_callback: callback,
9374
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9333
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9375
9334
  value: total,
9376
9335
  points: totalPoints != null ? totalPoints : 0
9377
9336
  }, transformedParams), transformedMeta));
@@ -9411,7 +9370,7 @@ var __objRest$13 = (source, exclude) => {
9411
9370
  const purchaseFail$1 = (provider, params) => {
9412
9371
  const { trackingId } = provider;
9413
9372
  const { currency: providerCurrency } = provider;
9414
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
9373
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
9415
9374
  delete rest.userId;
9416
9375
  const selectedCurrency = currency != null ? currency : providerCurrency;
9417
9376
  const enhancedParams = __spreadProps$J(__spreadValues$14({}, rest), {
@@ -9420,11 +9379,11 @@ const purchaseFail$1 = (provider, params) => {
9420
9379
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9421
9380
  const { meta } = getState();
9422
9381
  const transformedMeta = eventParamsToSnakeCase(meta);
9423
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9424
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9382
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9383
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9425
9384
  fbq("trackSingleCustom", trackingId, "PurchaseFail", __spreadValues$14(__spreadValues$14({
9426
9385
  content_ids: productsIds,
9427
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9386
+ contents: getProductContentFromShoppingCart(shoppingCart),
9428
9387
  num_items: productsIds.length,
9429
9388
  value: total,
9430
9389
  points: totalPoints != null ? totalPoints : 0
@@ -9464,7 +9423,7 @@ var __objRest$12 = (source, exclude) => {
9464
9423
  };
9465
9424
  const purchaseFail = (provider, params) => {
9466
9425
  const { currency: providerCurrency } = provider;
9467
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
9426
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
9468
9427
  delete rest.userId;
9469
9428
  const selectedCurrency = currency != null ? currency : providerCurrency;
9470
9429
  const enhancedParams = __spreadProps$I(__spreadValues$13({}, rest), {
@@ -9473,8 +9432,8 @@ const purchaseFail = (provider, params) => {
9473
9432
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9474
9433
  const { meta } = getState();
9475
9434
  const transformedMeta = eventParamsToSnakeCase(meta);
9476
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9477
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9435
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9436
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9478
9437
  analytics.track("Purchase Fail", __spreadValues$13(__spreadValues$13({
9479
9438
  total,
9480
9439
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9527,21 +9486,21 @@ var __objRest$11 = (source, exclude) => {
9527
9486
  const purchaseSuccess$2 = (provider, params) => {
9528
9487
  const { trackingId, userId: providerUserId } = provider;
9529
9488
  const { currency: providerCurrency } = provider;
9530
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
9489
+ const _a = params, { callback, userId, currency, shoppingCart, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
9531
9490
  const selectedUserId = userId != null ? userId : providerUserId;
9532
9491
  const selectedCurrency = currency != null ? currency : providerCurrency;
9533
9492
  const enhancedParams = __spreadProps$H(__spreadValues$12({}, rest), {
9534
9493
  userId: selectedUserId,
9535
9494
  currency: selectedCurrency
9536
9495
  });
9537
- const { total, shippingCost, totalTaxes, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9496
+ const { total, shippingCost, totalTaxes, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9538
9497
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9539
9498
  const { meta } = getState();
9540
9499
  const transformedMeta = eventParamsToSnakeCase(meta);
9541
9500
  gtag("event", "purchase", __spreadValues$12(__spreadValues$12({
9542
9501
  send_to: trackingId,
9543
9502
  event_callback: callback,
9544
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9503
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9545
9504
  value: total,
9546
9505
  points: totalPoints != null ? totalPoints : 0,
9547
9506
  transaction_id: orderId,
@@ -9584,7 +9543,7 @@ var __objRest$10 = (source, exclude) => {
9584
9543
  const purchaseSuccess$1 = (provider, params) => {
9585
9544
  const { trackingId } = provider;
9586
9545
  const { currency: providerCurrency } = provider;
9587
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
9546
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
9588
9547
  delete rest.userId;
9589
9548
  const selectedCurrency = currency != null ? currency : providerCurrency;
9590
9549
  const enhancedParams = __spreadProps$G(__spreadValues$11({}, rest), {
@@ -9593,11 +9552,11 @@ const purchaseSuccess$1 = (provider, params) => {
9593
9552
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9594
9553
  const { meta } = getState();
9595
9554
  const transformedMeta = eventParamsToSnakeCase(meta);
9596
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9597
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9555
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9556
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9598
9557
  fbq("trackSingle", trackingId, "Purchase", __spreadValues$11(__spreadValues$11({
9599
9558
  content_ids: productsIds,
9600
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9559
+ contents: getProductContentFromShoppingCart(shoppingCart),
9601
9560
  num_items: productsIds.length,
9602
9561
  value: total,
9603
9562
  points: totalPoints != null ? totalPoints : 0
@@ -9637,7 +9596,7 @@ var __objRest$$ = (source, exclude) => {
9637
9596
  };
9638
9597
  const purchaseSuccess = (provider, params) => {
9639
9598
  const { currency: providerCurrency } = provider;
9640
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
9599
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
9641
9600
  delete rest.userId;
9642
9601
  const selectedCurrency = currency != null ? currency : providerCurrency;
9643
9602
  const enhancedParams = __spreadProps$F(__spreadValues$10({}, rest), {
@@ -9646,8 +9605,8 @@ const purchaseSuccess = (provider, params) => {
9646
9605
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9647
9606
  const { meta } = getState();
9648
9607
  const transformedMeta = eventParamsToSnakeCase(meta);
9649
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9650
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9608
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9609
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9651
9610
  analytics.track("Order Completed", __spreadValues$10(__spreadValues$10({
9652
9611
  total,
9653
9612
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),