@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.
@@ -1,12 +1,47 @@
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.shoppingCart, global.products));
5
- })(this, (function (exports, state, shoppingCart, products) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('snake-case'), require('@artisan-commerce/shopping-cart-core'), require('@artisan-commerce/products')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'snake-case', '@artisan-commerce/shopping-cart-core', '@artisan-commerce/products'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ArtisnAnalytics = {}, global.snakeCase, global.shoppingCartCore, global.products));
5
+ })(this, (function (exports, snakeCase, shoppingCartCore, products) { 'use strict';
6
+
7
+ var __defProp$41 = Object.defineProperty;
8
+ var __getOwnPropSymbols$41 = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp$41 = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum$41 = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp$41 = (obj, key, value) => key in obj ? __defProp$41(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues$41 = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp$41.call(b, prop))
15
+ __defNormalProp$41(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols$41)
17
+ for (var prop of __getOwnPropSymbols$41(b)) {
18
+ if (__propIsEnum$41.call(b, prop))
19
+ __defNormalProp$41(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ let state = null;
24
+ const initState = (initialState) => {
25
+ Object.freeze(initialState);
26
+ state = __spreadValues$41({}, initialState);
27
+ Object.seal(state);
28
+ };
29
+ const setState$1 = (overrides) => {
30
+ const tempState = state ? __spreadValues$41({}, state) : {};
31
+ state = null;
32
+ state = __spreadValues$41(__spreadValues$41({}, tempState), overrides);
33
+ Object.seal(state);
34
+ };
35
+ const getState$1 = () => {
36
+ if (state === null) {
37
+ throw new Error("The state has not been initialized, make sure to call initState beforehand");
38
+ }
39
+ return __spreadValues$41({}, state);
40
+ };
6
41
 
7
42
  var name = "@artisan-commerce/analytics-web";
8
43
  var description = "Artisn commerce analytics web library";
9
- var version = "0.2.0-canary.74";
44
+ var version = "0.2.0-canary.76";
10
45
  var main = "./dist/bundle.cjs.js";
11
46
  var module = "./dist/bundle.esm.js";
12
47
  var types = "./dist/bundle.d.ts";
@@ -39,14 +74,14 @@
39
74
  "snake-case": "^3.0.4"
40
75
  };
41
76
  var devDependencies = {
42
- "@artisan-commerce/products": "0.9.0-canary.48",
43
- "@artisan-commerce/shopping-cart": "0.12.0-canary.71",
44
- "@artisan-commerce/state": "0.3.0-canary.8",
45
- "@artisan-commerce/types": "0.14.0-canary.37"
77
+ "@artisan-commerce/products": "0.9.0-canary.50",
78
+ "@artisan-commerce/shopping-cart-core": "0.12.0-canary.73",
79
+ "@artisan-commerce/state": "0.3.0-canary.9",
80
+ "@artisan-commerce/types": "0.14.0-canary.38"
46
81
  };
47
82
  var peerDependencies = {
48
83
  "@artisan-commerce/products": "*",
49
- "@artisan-commerce/shopping-cart": "*",
84
+ "@artisan-commerce/shopping-cart-core": "*",
50
85
  "@artisan-commerce/state": "*"
51
86
  };
52
87
  var nx = {
@@ -108,10 +143,10 @@
108
143
  }
109
144
  };
110
145
  const setInitialState = () => {
111
- state.initState(initialState);
146
+ initState(initialState);
112
147
  };
113
- const getState = () => state.getState();
114
- const setState = (state$1) => state.setState(state$1);
148
+ const getState = () => getState$1();
149
+ const setState = (state) => setState$1(state);
115
150
 
116
151
  const CONSTANTS = {
117
152
  GLOBAL_TRACKING_ID: "G-JZ7R91ZNMB"
@@ -615,82 +650,6 @@ ${key}: ${value}`;
615
650
  setState({ initialized: true });
616
651
  };
617
652
 
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
653
  var __defProp$3X = Object.defineProperty;
695
654
  var __defProps$2s = Object.defineProperties;
696
655
  var __getOwnPropDescs$2s = Object.getOwnPropertyDescriptors;
@@ -713,7 +672,7 @@ ${key}: ${value}`;
713
672
  const eventParamsToSnakeCase = (params) => {
714
673
  return Object.entries(params).reduce((acc, params2) => {
715
674
  const [key, value] = params2;
716
- const newKey = snakeCase(key);
675
+ const newKey = snakeCase.snakeCase(key);
717
676
  return __spreadProps$2s(__spreadValues$3X({}, acc), {
718
677
  [newKey]: value
719
678
  });
@@ -957,20 +916,20 @@ ${key}: ${value}`;
957
916
  }, []);
958
917
  eventSent(eventName, targetedProviders);
959
918
  };
960
- const getProductIdsFromShoppingCart = (shoppingCart$1) => {
961
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
919
+ const getProductIdsFromShoppingCart = (shoppingCart) => {
920
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
962
921
  return products.map((product) => product.productId);
963
922
  };
964
- const getProductContentFromShoppingCart = (shoppingCart$1) => {
965
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
923
+ const getProductContentFromShoppingCart = (shoppingCart) => {
924
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
966
925
  return products.map((product) => getProductContent(product));
967
926
  };
968
927
  const getProductContent = (product) => {
969
928
  const totals = products.getProductTotals(product);
970
929
  return `${product.name}:${totals.netPrice}`;
971
930
  };
972
- const mapProductsToGoogleItems = (shoppingCart$1, currency) => {
973
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
931
+ const mapProductsToGoogleItems = (shoppingCart, currency) => {
932
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
974
933
  return products.map((product) => mapProductToGoogleItem(product, currency));
975
934
  };
976
935
  const mapProductToGoogleItem = (product, currency) => {
@@ -3366,7 +3325,7 @@ ${key}: ${value}`;
3366
3325
  const initiateCheckout$2 = (provider, params) => {
3367
3326
  const { trackingId, userId: providerUserId } = provider;
3368
3327
  const { currency: providerCurrency } = provider;
3369
- const _a = params, { callback, userId, shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3328
+ const _a = params, { callback, userId, shoppingCart, currency } = _a, rest = __objRest$32(_a, ["callback", "userId", "shoppingCart", "currency"]);
3370
3329
  const selectedUserId = userId != null ? userId : providerUserId;
3371
3330
  const selectedCurrency = currency != null ? currency : providerCurrency;
3372
3331
  const enhancedParams = __spreadProps$1_(__spreadValues$33({}, rest), {
@@ -3376,11 +3335,11 @@ ${key}: ${value}`;
3376
3335
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3377
3336
  const { meta } = getState();
3378
3337
  const transformedMeta = eventParamsToSnakeCase(meta);
3379
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3338
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3380
3339
  gtag("event", "begin_checkout", __spreadValues$33(__spreadValues$33({
3381
3340
  send_to: trackingId,
3382
3341
  event_callback: callback,
3383
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
3342
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
3384
3343
  value: total,
3385
3344
  points: totalPoints != null ? totalPoints : 0
3386
3345
  }, transformedParams), transformedMeta));
@@ -3420,7 +3379,7 @@ ${key}: ${value}`;
3420
3379
  const initiateCheckout$1 = (provider, params) => {
3421
3380
  const { trackingId } = provider;
3422
3381
  const { currency: providerCurrency } = provider;
3423
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3382
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$31(_a, ["shoppingCart", "currency"]);
3424
3383
  delete rest.userId;
3425
3384
  const selectedCurrency = currency != null ? currency : providerCurrency;
3426
3385
  const enhancedParams = __spreadProps$1Z(__spreadValues$32({}, rest), {
@@ -3429,11 +3388,11 @@ ${key}: ${value}`;
3429
3388
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3430
3389
  const { meta } = getState();
3431
3390
  const transformedMeta = eventParamsToSnakeCase(meta);
3432
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
3433
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3391
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
3392
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3434
3393
  fbq("trackSingle", trackingId, "InitiateCheckout", __spreadValues$32(__spreadValues$32({
3435
3394
  content_ids: productsIds,
3436
- contents: getProductContentFromShoppingCart(shoppingCart$1),
3395
+ contents: getProductContentFromShoppingCart(shoppingCart),
3437
3396
  num_items: productsIds.length,
3438
3397
  value: total,
3439
3398
  points: totalPoints != null ? totalPoints : 0
@@ -3473,7 +3432,7 @@ ${key}: ${value}`;
3473
3432
  };
3474
3433
  const initiateCheckout = (provider, params) => {
3475
3434
  const { currency: providerCurrency } = provider;
3476
- const _a = params, { shoppingCart: shoppingCart$1, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3435
+ const _a = params, { shoppingCart, currency } = _a, rest = __objRest$30(_a, ["shoppingCart", "currency"]);
3477
3436
  delete rest.userId;
3478
3437
  const selectedCurrency = currency != null ? currency : providerCurrency;
3479
3438
  const enhancedParams = __spreadProps$1Y(__spreadValues$31({}, rest), {
@@ -3482,8 +3441,8 @@ ${key}: ${value}`;
3482
3441
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
3483
3442
  const { meta } = getState();
3484
3443
  const transformedMeta = eventParamsToSnakeCase(meta);
3485
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
3486
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
3444
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
3445
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3487
3446
  analytics.track("Initiate Checkout", __spreadValues$31(__spreadValues$31({
3488
3447
  total,
3489
3448
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9185,7 +9144,7 @@ ${key}: ${value}`;
9185
9144
  const purchaseAttempt$2 = (provider, params) => {
9186
9145
  const { trackingId, userId: providerUserId } = provider;
9187
9146
  const { currency: providerCurrency } = provider;
9188
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
9147
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$17(_a, ["callback", "userId", "currency", "shoppingCart"]);
9189
9148
  const selectedUserId = userId != null ? userId : providerUserId;
9190
9149
  const selectedCurrency = currency != null ? currency : providerCurrency;
9191
9150
  const enhancedParams = __spreadProps$N(__spreadValues$18({}, rest), {
@@ -9195,11 +9154,11 @@ ${key}: ${value}`;
9195
9154
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9196
9155
  const { meta } = getState();
9197
9156
  const transformedMeta = eventParamsToSnakeCase(meta);
9198
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9157
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9199
9158
  gtag("event", "purchase_attempt", __spreadValues$18(__spreadValues$18({
9200
9159
  send_to: trackingId,
9201
9160
  event_callback: callback,
9202
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9161
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9203
9162
  value: total,
9204
9163
  points: totalPoints != null ? totalPoints : 0
9205
9164
  }, transformedParams), transformedMeta));
@@ -9239,7 +9198,7 @@ ${key}: ${value}`;
9239
9198
  const purchaseAttempt$1 = (provider, params) => {
9240
9199
  const { trackingId } = provider;
9241
9200
  const { currency: providerCurrency } = provider;
9242
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
9201
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$16(_a, ["currency", "shoppingCart"]);
9243
9202
  delete rest.userId;
9244
9203
  const selectedCurrency = currency != null ? currency : providerCurrency;
9245
9204
  const enhancedParams = __spreadProps$M(__spreadValues$17({}, rest), {
@@ -9248,11 +9207,11 @@ ${key}: ${value}`;
9248
9207
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9249
9208
  const { meta } = getState();
9250
9209
  const transformedMeta = eventParamsToSnakeCase(meta);
9251
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9252
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9210
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9211
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9253
9212
  fbq("trackSingleCustom", trackingId, "PurchaseAttempt", __spreadValues$17(__spreadValues$17({
9254
9213
  content_ids: productsIds,
9255
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9214
+ contents: getProductContentFromShoppingCart(shoppingCart),
9256
9215
  num_items: productsIds.length,
9257
9216
  value: total,
9258
9217
  points: totalPoints != null ? totalPoints : 0
@@ -9292,7 +9251,7 @@ ${key}: ${value}`;
9292
9251
  };
9293
9252
  const purchaseAttempt = (provider, params) => {
9294
9253
  const { currency: providerCurrency } = provider;
9295
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
9254
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$15(_a, ["currency", "shoppingCart"]);
9296
9255
  delete rest.userId;
9297
9256
  const selectedCurrency = currency != null ? currency : providerCurrency;
9298
9257
  const enhancedParams = __spreadProps$L(__spreadValues$16({}, rest), {
@@ -9301,8 +9260,8 @@ ${key}: ${value}`;
9301
9260
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9302
9261
  const { meta } = getState();
9303
9262
  const transformedMeta = eventParamsToSnakeCase(meta);
9304
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9305
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9263
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9264
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9306
9265
  analytics.track("Purchase Attempt", __spreadValues$16(__spreadValues$16({
9307
9266
  total,
9308
9267
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9355,7 +9314,7 @@ ${key}: ${value}`;
9355
9314
  const purchaseFail$2 = (provider, params) => {
9356
9315
  const { trackingId, userId: providerUserId } = provider;
9357
9316
  const { currency: providerCurrency } = provider;
9358
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
9317
+ const _a = params, { callback, userId, currency, shoppingCart } = _a, rest = __objRest$14(_a, ["callback", "userId", "currency", "shoppingCart"]);
9359
9318
  const selectedUserId = userId != null ? userId : providerUserId;
9360
9319
  const selectedCurrency = currency != null ? currency : providerCurrency;
9361
9320
  const enhancedParams = __spreadProps$K(__spreadValues$15({}, rest), {
@@ -9365,11 +9324,11 @@ ${key}: ${value}`;
9365
9324
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9366
9325
  const { meta } = getState();
9367
9326
  const transformedMeta = eventParamsToSnakeCase(meta);
9368
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9327
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9369
9328
  gtag("event", "purchase_fail", __spreadValues$15(__spreadValues$15({
9370
9329
  send_to: trackingId,
9371
9330
  event_callback: callback,
9372
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9331
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9373
9332
  value: total,
9374
9333
  points: totalPoints != null ? totalPoints : 0
9375
9334
  }, transformedParams), transformedMeta));
@@ -9409,7 +9368,7 @@ ${key}: ${value}`;
9409
9368
  const purchaseFail$1 = (provider, params) => {
9410
9369
  const { trackingId } = provider;
9411
9370
  const { currency: providerCurrency } = provider;
9412
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
9371
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$13(_a, ["currency", "shoppingCart"]);
9413
9372
  delete rest.userId;
9414
9373
  const selectedCurrency = currency != null ? currency : providerCurrency;
9415
9374
  const enhancedParams = __spreadProps$J(__spreadValues$14({}, rest), {
@@ -9418,11 +9377,11 @@ ${key}: ${value}`;
9418
9377
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9419
9378
  const { meta } = getState();
9420
9379
  const transformedMeta = eventParamsToSnakeCase(meta);
9421
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9422
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9380
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9381
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9423
9382
  fbq("trackSingleCustom", trackingId, "PurchaseFail", __spreadValues$14(__spreadValues$14({
9424
9383
  content_ids: productsIds,
9425
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9384
+ contents: getProductContentFromShoppingCart(shoppingCart),
9426
9385
  num_items: productsIds.length,
9427
9386
  value: total,
9428
9387
  points: totalPoints != null ? totalPoints : 0
@@ -9462,7 +9421,7 @@ ${key}: ${value}`;
9462
9421
  };
9463
9422
  const purchaseFail = (provider, params) => {
9464
9423
  const { currency: providerCurrency } = provider;
9465
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
9424
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$12(_a, ["currency", "shoppingCart"]);
9466
9425
  delete rest.userId;
9467
9426
  const selectedCurrency = currency != null ? currency : providerCurrency;
9468
9427
  const enhancedParams = __spreadProps$I(__spreadValues$13({}, rest), {
@@ -9471,8 +9430,8 @@ ${key}: ${value}`;
9471
9430
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9472
9431
  const { meta } = getState();
9473
9432
  const transformedMeta = eventParamsToSnakeCase(meta);
9474
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9475
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9433
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9434
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9476
9435
  analytics.track("Purchase Fail", __spreadValues$13(__spreadValues$13({
9477
9436
  total,
9478
9437
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),
@@ -9525,21 +9484,21 @@ ${key}: ${value}`;
9525
9484
  const purchaseSuccess$2 = (provider, params) => {
9526
9485
  const { trackingId, userId: providerUserId } = provider;
9527
9486
  const { currency: providerCurrency } = provider;
9528
- const _a = params, { callback, userId, currency, shoppingCart: shoppingCart$1, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
9487
+ const _a = params, { callback, userId, currency, shoppingCart, orderId } = _a, rest = __objRest$11(_a, ["callback", "userId", "currency", "shoppingCart", "orderId"]);
9529
9488
  const selectedUserId = userId != null ? userId : providerUserId;
9530
9489
  const selectedCurrency = currency != null ? currency : providerCurrency;
9531
9490
  const enhancedParams = __spreadProps$H(__spreadValues$12({}, rest), {
9532
9491
  userId: selectedUserId,
9533
9492
  currency: selectedCurrency
9534
9493
  });
9535
- const { total, shippingCost, totalTaxes, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9494
+ const { total, shippingCost, totalTaxes, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9536
9495
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9537
9496
  const { meta } = getState();
9538
9497
  const transformedMeta = eventParamsToSnakeCase(meta);
9539
9498
  gtag("event", "purchase", __spreadValues$12(__spreadValues$12({
9540
9499
  send_to: trackingId,
9541
9500
  event_callback: callback,
9542
- items: mapProductsToGoogleItems(shoppingCart$1, selectedCurrency),
9501
+ items: mapProductsToGoogleItems(shoppingCart, selectedCurrency),
9543
9502
  value: total,
9544
9503
  points: totalPoints != null ? totalPoints : 0,
9545
9504
  transaction_id: orderId,
@@ -9582,7 +9541,7 @@ ${key}: ${value}`;
9582
9541
  const purchaseSuccess$1 = (provider, params) => {
9583
9542
  const { trackingId } = provider;
9584
9543
  const { currency: providerCurrency } = provider;
9585
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
9544
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$10(_a, ["currency", "shoppingCart"]);
9586
9545
  delete rest.userId;
9587
9546
  const selectedCurrency = currency != null ? currency : providerCurrency;
9588
9547
  const enhancedParams = __spreadProps$G(__spreadValues$11({}, rest), {
@@ -9591,11 +9550,11 @@ ${key}: ${value}`;
9591
9550
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9592
9551
  const { meta } = getState();
9593
9552
  const transformedMeta = eventParamsToSnakeCase(meta);
9594
- const productsIds = getProductIdsFromShoppingCart(shoppingCart$1);
9595
- const { total, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9553
+ const productsIds = getProductIdsFromShoppingCart(shoppingCart);
9554
+ const { total, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9596
9555
  fbq("trackSingle", trackingId, "Purchase", __spreadValues$11(__spreadValues$11({
9597
9556
  content_ids: productsIds,
9598
- contents: getProductContentFromShoppingCart(shoppingCart$1),
9557
+ contents: getProductContentFromShoppingCart(shoppingCart),
9599
9558
  num_items: productsIds.length,
9600
9559
  value: total,
9601
9560
  points: totalPoints != null ? totalPoints : 0
@@ -9635,7 +9594,7 @@ ${key}: ${value}`;
9635
9594
  };
9636
9595
  const purchaseSuccess = (provider, params) => {
9637
9596
  const { currency: providerCurrency } = provider;
9638
- const _a = params, { currency, shoppingCart: shoppingCart$1 } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
9597
+ const _a = params, { currency, shoppingCart } = _a, rest = __objRest$$(_a, ["currency", "shoppingCart"]);
9639
9598
  delete rest.userId;
9640
9599
  const selectedCurrency = currency != null ? currency : providerCurrency;
9641
9600
  const enhancedParams = __spreadProps$F(__spreadValues$10({}, rest), {
@@ -9644,8 +9603,8 @@ ${key}: ${value}`;
9644
9603
  const transformedParams = eventParamsToSnakeCase(enhancedParams);
9645
9604
  const { meta } = getState();
9646
9605
  const transformedMeta = eventParamsToSnakeCase(meta);
9647
- const products = shoppingCart.getShoppingCartProducts(shoppingCart$1);
9648
- const { total, totalTaxes, shippingCost, totalPoints } = shoppingCart.getShoppingCartTotal(shoppingCart$1);
9606
+ const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
9607
+ const { total, totalTaxes, shippingCost, totalPoints } = shoppingCartCore.getShoppingCartTotal(shoppingCart);
9649
9608
  analytics.track("Order Completed", __spreadValues$10(__spreadValues$10({
9650
9609
  total,
9651
9610
  revenue: total - (totalTaxes != null ? totalTaxes : 0) - (shippingCost != null ? shippingCost : 0),