/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./js/event-providers/woocommerce.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "../node_modules/webpack/buildin/global.js":
/*!*************************************************!*\
  !*** ../node_modules/webpack/buildin/global.js ***!
  \*************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports) {

eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi4vbm9kZV9tb2R1bGVzL3dlYnBhY2svYnVpbGRpbi9nbG9iYWwuanMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi4vbm9kZV9tb2R1bGVzL3dlYnBhY2svYnVpbGRpbi9nbG9iYWwuanM/YTQyYiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZztcblxuLy8gVGhpcyB3b3JrcyBpbiBub24tc3RyaWN0IG1vZGVcbmcgPSAoZnVuY3Rpb24oKSB7XG5cdHJldHVybiB0aGlzO1xufSkoKTtcblxudHJ5IHtcblx0Ly8gVGhpcyB3b3JrcyBpZiBldmFsIGlzIGFsbG93ZWQgKHNlZSBDU1ApXG5cdGcgPSBnIHx8IG5ldyBGdW5jdGlvbihcInJldHVybiB0aGlzXCIpKCk7XG59IGNhdGNoIChlKSB7XG5cdC8vIFRoaXMgd29ya3MgaWYgdGhlIHdpbmRvdyByZWZlcmVuY2UgaXMgYXZhaWxhYmxlXG5cdGlmICh0eXBlb2Ygd2luZG93ID09PSBcIm9iamVjdFwiKSBnID0gd2luZG93O1xufVxuXG4vLyBnIGNhbiBzdGlsbCBiZSB1bmRlZmluZWQsIGJ1dCBub3RoaW5nIHRvIGRvIGFib3V0IGl0Li4uXG4vLyBXZSByZXR1cm4gdW5kZWZpbmVkLCBpbnN0ZWFkIG9mIG5vdGhpbmcgaGVyZSwgc28gaXQnc1xuLy8gZWFzaWVyIHRvIGhhbmRsZSB0aGlzIGNhc2UuIGlmKCFnbG9iYWwpIHsgLi4ufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGc7XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///../node_modules/webpack/buildin/global.js\n");

/***/ }),

/***/ "./js/event-providers/woocommerce.js":
/*!*******************************************!*\
  !*** ./js/event-providers/woocommerce.js ***!
  \*******************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {

eval("/* WEBPACK VAR INJECTION */(function(global) {/**\n * Site Kit by Google, Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n((jQuery, _global$_googlesiteki) => {\n  if (!jQuery) {\n    return;\n  }\n  const {\n    currency: globalCurrency,\n    products: globalProducts,\n    purchase,\n    add_to_cart: addToCart,\n    eventsToTrack\n  } = ((_global$_googlesiteki = global._googlesitekit) === null || _global$_googlesiteki === void 0 ? void 0 : _global$_googlesiteki.wcdata) || {};\n  const canTrackAddToCart = eventsToTrack === null || eventsToTrack === void 0 ? void 0 : eventsToTrack.includes('add_to_cart');\n  const canTrackPurchase = eventsToTrack === null || eventsToTrack === void 0 ? void 0 : eventsToTrack.includes('purchase');\n  if (addToCart && canTrackAddToCart) {\n    var _global$_googlesiteki2, _global$_googlesiteki3;\n    const {\n      price\n    } = addToCart;\n    const eventData = formatEventData(price, globalCurrency, addToCart);\n    (_global$_googlesiteki2 = global._googlesitekit) === null || _global$_googlesiteki2 === void 0 ? void 0 : (_global$_googlesiteki3 = _global$_googlesiteki2.gtagEvent) === null || _global$_googlesiteki3 === void 0 ? void 0 : _global$_googlesiteki3.call(_global$_googlesiteki2, 'add_to_cart', eventData);\n  }\n  if (purchase && canTrackPurchase) {\n    var _global$_googlesiteki4, _global$_googlesiteki5, _global$_googlesiteki6;\n    const {\n      id,\n      totals,\n      items,\n      user_data: userData\n    } = purchase;\n    const eventData = formatEventData(totals.total_price, totals.currency_code, items, id, totals.shipping_total, totals.tax_total);\n\n    // User data is already normalized from WooCommerce.php.\n    if (((_global$_googlesiteki4 = global._googlesitekit) === null || _global$_googlesiteki4 === void 0 ? void 0 : _global$_googlesiteki4.gtagUserData) && userData) {\n      eventData.user_data = userData;\n    }\n    (_global$_googlesiteki5 = global._googlesitekit) === null || _global$_googlesiteki5 === void 0 ? void 0 : (_global$_googlesiteki6 = _global$_googlesiteki5.gtagEvent) === null || _global$_googlesiteki6 === void 0 ? void 0 : _global$_googlesiteki6.call(_global$_googlesiteki5, 'purchase', eventData);\n  }\n  const $body = jQuery('body');\n  if (canTrackAddToCart) {\n    $body.on('added_to_cart', (event, fragments, cartHash, $button) => {\n      var _global$_googlesiteki7, _global$_googlesiteki8;\n      const productID = parseInt($button.data('product_id'), 10);\n      if (!productID) {\n        return;\n      }\n      const productData = (globalProducts === null || globalProducts === void 0 ? void 0 : globalProducts.find(product => (product === null || product === void 0 ? void 0 : product.id) === productID)) || {};\n      const {\n        price\n      } = productData;\n      const eventData = formatEventData(price, globalCurrency, productData);\n      (_global$_googlesiteki7 = global._googlesitekit) === null || _global$_googlesiteki7 === void 0 ? void 0 : (_global$_googlesiteki8 = _global$_googlesiteki7.gtagEvent) === null || _global$_googlesiteki8 === void 0 ? void 0 : _global$_googlesiteki8.call(_global$_googlesiteki7, 'add_to_cart', eventData);\n    });\n    jQuery('.products-block-post-template .product, .wc-block-product-template .product').each(function () {\n      const $productCard = jQuery(this);\n      const productID = parseInt($productCard.find('[data-product_id]').attr('data-product_id'), 10);\n      if (!productID) {\n        return;\n      }\n      $productCard.on('click', event => {\n        var _global$_googlesiteki9, _global$_googlesiteki10;\n        const $target = jQuery(event.target);\n        const $button = $target.closest('.wc-block-components-product-button [data-product_id]');\n        const isAddToCartButton = $button.length && $button.hasClass('add_to_cart_button') && !$button.hasClass('product_type_variable');\n        if (!isAddToCartButton) {\n          return;\n        }\n        const productData = (globalProducts === null || globalProducts === void 0 ? void 0 : globalProducts.find(product => (product === null || product === void 0 ? void 0 : product.id) === productID)) || {};\n        const {\n          price\n        } = productData;\n        const eventData = formatEventData(price, globalCurrency, productData);\n        (_global$_googlesiteki9 = global._googlesitekit) === null || _global$_googlesiteki9 === void 0 ? void 0 : (_global$_googlesiteki10 = _global$_googlesiteki9.gtagEvent) === null || _global$_googlesiteki10 === void 0 ? void 0 : _global$_googlesiteki10.call(_global$_googlesiteki9, 'add_to_cart', eventData);\n      });\n    });\n  }\n  function formatEventData(value, currency, products, transactionID = null, shipping = null, tax = null) {\n    const formattedData = {\n      value: formatPrice(value),\n      currency,\n      items: []\n    };\n    if (transactionID) {\n      formattedData.transaction_id = transactionID;\n    }\n\n    // Shipping can be 0, if only check if shipping is not empty value\n    // this will be omitted.\n    if (typeof shipping === 'number') {\n      formattedData.shipping = shipping;\n    }\n\n    // Tax can be 0, if only check if shipping is not empty value\n    // this will be omitted.\n    if (typeof tax === 'number') {\n      formattedData.tax = tax;\n    }\n    if (products && products.length) {\n      for (const product of products) {\n        formattedData.items.push(formatProductData(product));\n      }\n    } else if (products && products.id) {\n      formattedData.items = [formatProductData(products)];\n    }\n    return formattedData;\n  }\n  function formatProductData(product) {\n    const {\n      id,\n      name,\n      price,\n      variation,\n      quantity,\n      categories\n    } = product;\n    const mappedItem = {\n      item_id: id,\n      item_name: name,\n      price: formatPrice(price)\n    };\n    if (quantity) {\n      mappedItem.quantity = quantity;\n    }\n    if (variation) {\n      mappedItem.item_variant = variation;\n    }\n    if (categories && (categories === null || categories === void 0 ? void 0 : categories.length)) {\n      let categoryIndex = 1;\n      for (const category of categories) {\n        mappedItem[categoryIndex > 1 ? `item_category${categoryIndex}` : 'item_category'] = category.name;\n        categoryIndex++;\n      }\n    }\n    return mappedItem;\n  }\n\n  /**\n   * Returns the price of a product formatted with decimal places if necessary.\n   *\n   * @since 1.158.0\n   *\n   * @param {string} price                 The price to parse.\n   * @param {number} [currencyMinorUnit=2] The number decimals to show in the currency.\n   * @return {number} The price of the product with decimals.\n   */\n  function formatPrice(price, currencyMinorUnit = 2) {\n    return parseInt(price, 10) / 10 ** currencyMinorUnit;\n  }\n})(global.jQuery);\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ \"../node_modules/webpack/buildin/global.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64, \n//# sourceURL=webpack-internal:///./js/event-providers/woocommerce.js\n");

/***/ })

/******/ });