{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./cartridges/app_custom_core/cartridge/client/default/js/cart/cartIsGift.js","webpack:///./cartridges/app_custom_core/cartridge/client/default/js/cartIsGift.js","webpack:///./cartridges/app_custom_core/cartridge/client/default/js/common/handleADA.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;ACZa;;AAEb,gBAAgB,mBAAO,CAAC,yGAAqB;;AAE7C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qDAAqD,kCAAkC;AACvF;;AAEA;AACA,aAAa;AACb;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;;;;;;;;;;;;;ACrHa;;AAEb,qBAAqB,mBAAO,CAAC,0HAAW;;AAExC;AACA,mBAAmB,mBAAO,CAAC,sGAAmB;AAC9C,CAAC;;;;;;;;;;;;;ACNY;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"default/js/cartIsGift.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_custom_core/cartridge/client/default/js/cartIsGift.js\");\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","'use strict';\n\nvar handleADA = require('../common/handleADA');\n\nfunction updateTotals(data) {\n $('.shipping-cost').empty().append(data.totals.totalShippingCost);\n $('.tax-total').empty().append(data.totals.totalTax);\n if ($('.grand-total-sum').length > 0) {\n $('.grand-total-sum').empty().append(data.totals.grandTotal);\n } else {\n $('.grand-total').empty().append(data.totals.grandTotal);\n }\n $('.sub-total').empty().append(data.totals.subTotal);\n if (data.totals.orderLevelDiscountTotal.value > 0) {\n $('.order-discount').removeClass('hide-order-discount');\n $('.order-discount-total').empty()\n .append('- ' + data.totals.orderLevelDiscountTotal.formatted);\n } else {\n $('.order-discount').addClass('hide-order-discount');\n }\n\n if (data.totals.shippingLevelDiscountTotal.value > 0) {\n $('.shipping-discount').removeClass('hide-shipping-discount');\n $('.shipping-discount-total').empty().append('- ' +\n data.totals.shippingLevelDiscountTotal.formatted);\n } else {\n $('.shipping-discount').addClass('hide-shipping-discount');\n }\n}\n\nmodule.exports = {\n changeGiftMessage: function () {\n $('#giftMessage').on('change', function (e) {\n e.preventDefault();\n var giftMessage = $('#giftMessage').val();\n var url = $('#giftMessage').data('change-message-method-url');\n var action;\n var checked = $('.gift')[0].checked;\n if (checked) {\n action = 'Insert';\n } else {\n action = 'Delete';\n }\n\n $.spinner().start();\n // Call --> CheckoutShippingServices-ChangeGiftMessage\n $.ajax({\n url : url,\n type : 'post',\n dataType : 'json',\n data : {\n action : action,\n isGift : checked,\n giftMessage : giftMessage\n }\n }).done(function () {\n $('.gift-message-summary').text(giftMessage);\n $.spinner().stop();\n }).fail(function () {\n $.spinner().stop();\n });\n });\n },\n\n changeGift: function () {\n $('.gift').on('change', function (e) {\n e.preventDefault();\n var url = $('.gift').data('select-gift-method-url');\n var action;\n if (this.checked) {\n action = 'Insert';\n } else {\n action = 'Delete';\n }\n\n $.spinner().start();\n // Call --> CheckoutShippingServices-ChangeGiftCheckBox\n $.ajax({\n url : url,\n type : 'post',\n dataType : 'json',\n data : {\n action : action,\n isGift : this.checked,\n giftMessage : $('#giftMessage').val()\n }\n }).done(function (data) {\n if (data && data.order && data.order.shipping && data.order.shipping.length > 0) {\n data.order.shipping[0].isGift = $('.gift').prop('checked');\n }\n var totalGrossPrice = data.totalGrossPrice;\n data = data.order;\n updateTotals(data);\n\n if (action === 'Insert') {\n $('.giftLine, .gift-textarea').removeClass('d-none');\n $('.gift-message-block').removeClass('active');\n } else {\n $('.giftLine, .gift-textarea').addClass('d-none');\n $('.gift-message-block').addClass('active');\n\n $('#giftMessage').val('');\n }\n if ($('klarna-placement').length > 0) {\n document.querySelector('klarna-placement').dataset.purchaseAmount = (totalGrossPrice * 100).toFixed(0);\n window.KlarnaOnsiteService = window.KlarnaOnsiteService || [];\n window.KlarnaOnsiteService.push({ eventName: 'refresh-placements' });\n }\n\n $.spinner().stop();\n }).fail(function () {\n $.spinner().stop();\n });\n });\n },\n\n ADAgift: handleADA.pressEnterItem('#labelIsGift')\n};\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./cart/cartIsGift'));\n});\n","'use strict';\n\nfunction pressEnterItem(actionItem, itemForClick) {\n $(actionItem).keypress(function (e) {\n if (e.which === 13) {\n if (itemForClick) {\n $(itemForClick).click();\n } else {\n $(actionItem).click();\n }\n }\n });\n}\n\nfunction pressEnterToClickInsideElement(container, itemForEnter, itemForNavigate) {\n $(container).on('keydown', itemForEnter, function (e) {\n if (e.which === 13) {\n if (itemForEnter === itemForNavigate) {\n $(e.target).click();\n } else if ($(e.target).find(itemForNavigate)[0]) {\n $(e.target).find(itemForNavigate)[0].click();\n } else {\n $(e.target).find(itemForNavigate).click();\n }\n }\n });\n}\n\nfunction pressEnterToNavigateUsingAInsideElement(container, itemForEnter, itemForNavigate) {\n $(container).on('keydown', itemForEnter, function (e) {\n if (e.which === 13) {\n $(location).attr('href', $(e.target).find(itemForNavigate)[0].href);\n }\n });\n}\n\nfunction focusNextElementOutsidefromSortOrderContainerWhenPressTab() {\n $('#sort-order-by-button').keydown(function (e) {\n if (e.which === 9 && !$('#sort-by-container').hasClass('show')) {\n $('.refinement-tipo > .card-header > button').focus();\n }\n });\n}\n\nfunction focusNextElementOutsidefromContainerWhenPressTab(container, flagClass, nextElement) {\n $(container).keydown(function (e) {\n if (e.which === 9 && !$(container).hasClass(flagClass)) {\n e.preventDefault();\n $(nextElement).focus();\n }\n });\n}\n\nfunction pressEnterInHeaderActionsItems(actionItem) {\n $('.header-action-item').has(actionItem).keypress(function (e) {\n if (e.which === 13) {\n $(actionItem).click();\n }\n });\n}\n\nfunction tabParagraphCollapsible(currentElement, nextElement) {\n $(currentElement).on('blur', function (event) {\n if (event.which === 0 && $(this).attr('aria-expanded') === 'false') {\n $(nextElement).trigger('focus');\n }\n });\n}\n\nfunction shippingMethod() {\n $('[id^=\"labelshippingMethod\"]').keypress(function (e) {\n var id = $(this).prop('id');\n id = id.slice(5);\n if (e.which === 13) {\n $('#' + id).trigger('click');\n }\n });\n}\n\nmodule.exports = {\n pressEnterItem : pressEnterItem,\n focusNextElementOutsidefromSortOrderContainerWhenPressTab : focusNextElementOutsidefromSortOrderContainerWhenPressTab,\n pressEnterInHeaderActionsItems : pressEnterInHeaderActionsItems,\n tabParagraphCollapsible : tabParagraphCollapsible,\n shippingMethod : shippingMethod,\n pressEnterToNavigateUsingAInsideElement : pressEnterToNavigateUsingAInsideElement,\n pressEnterToClickInsideElement : pressEnterToClickInsideElement,\n focusNextElementOutsidefromContainerWhenPressTab : focusNextElementOutsidefromContainerWhenPressTab\n};\n"],"sourceRoot":""}