vendor: 87 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ "./
4app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/cart.js": 5/*!*****************************************************************************************************!*\ 6 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/cart.js ***! 7 \*****************************************************************************************************/ 8/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 9 10"use strict"; 11 12 13var _require = __webpack_require__(/*! ../utils/commonHelper */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/utils/commonHelper.js"), 14 appendToUrl = _require.appendToUrl; 15 16// ã¨ã©ã¼ãã¤ã¢ãã°ã«å ¥åããã¨ã©ã¼ãªãã¸ã§ã¯ã 17var _error; 18// ã¢ã¼ãã«ã³ã³ãã³ã 19var $modalContent; 20function keydownHandler(e) { 21 if (e.keyCode == 13) { 22 $modalContent.find('.btn-submit').click(); 23 return false; 24 } else if (e.keyCode == 27) { 25 $modalContent.find('.btn-cancel').click(); 26 $modalContent.find('.btn-close').click(); 27 return false; 28 } 29} 30; 31 32/** 33 * update product list 34 * @param {hasBuyNow} hasBuyNow -hasBuyNow 35 * @param {hasPreOrder} hasPreOrder -hasPreOrder 36 * @param {hasPreOhasSinglePurchaserder} hasSinglePurchase -hasSinglePurchase 37 */ 38function updateProductList(hasBuyNow, hasPreOrder, hasSinglePurchase) { 39 var html = 'No items'; 40 if (!hasBuyNow) { 41 $('.buy_now-list').empty(); 42 $('.buy_now-list').append(html); 43 $('.buy_now-total').remove(); 44 } 45 if (!hasSinglePurchase) { 46 $('.single_purchase-list').empty(); 47 $('.single_purchase-list').append(html); 48 } 49 if (!hasPreOrder) { 50 $('.pre_order-list').empty(); 51 $('.pre_order-list').append(html); 52 } 53} 54 55/** 56 * update MiniCart 57 * @param {quantityTotal} quantityTotal -quantityTotal 58 */ 59function updateMiniCart(quantityTotal) { 60 if (quantityTotal <= 0) { 61 $('.cmn-header__main__menu__cart__number').hide(); 62 } else { 63 $('.cmn-header__main__menu__cart__number').show(); 64 if ($('.cmn-header__main__menu__cart__number').length) { 65 $('.cmn-header__main__menu__cart__number').empty(); 66 var html = ''; 67 if (quantityTotal < 100) { 68 html = quantityTotal; 69 } else { 70 html = '99+'; 71 } 72 $('.cmn-header__main__menu__cart__number').append(html); 73 } 74 } 75} 76 77/** 78 * change in stock total 79 * @param {target} this -this 80 * @param {subTotal} subTotal -subTotal 81 */ 82function changeSubTotal(target, subTotal) { 83 var subTotalContent = target.parents('.cart__product-list-article').find(".cart__product-list-article-total-price"); 84 if (subTotalContent.length) { 85 var html = ''; 86 subTotalContent.empty(); 87 html = subTotal; 88 subTotalContent.append(html); 89 } 90} 91 92/** 93 * change all in stock items subtotal 94 * @param data data -data 95 */ 96function changeAllSubTotal(data) { 97 for (var i = 0; i < data.items.length; i++) { 98 var targetSelector = '.cart__product-list-article-total-price-' + data.items[i].id; 99 if ($(targetSelector).length) { 100 $(targetSelector).empty().append(data.items[i].priceTotal.price); 101 } 102 } 103} 104 105/** 106 * change all discounts items total 107 * @param data data -data 108 */ 109function changeAllDiscounts(data) { 110 data.discountedProducts.forEach(function (product) { 111 var targetSelector = ".discount-amount.cart__product-list-article-discount-".concat(product.id); 112 var $discountElement = $(targetSelector); 113 if ($discountElement.length) { 114 var $parent = $discountElement.parent(); 115 var $currentPrice = $parent.find('span.current-price'); 116 var $priceBefore = $parent.find('s.price-before'); 117 118 // Update the sale price 119 $currentPrice.text(product.targetAjustedUnitAmount); 120 if (!product.hasDiscount) { 121 $discountElement.add($priceBefore).addClass('hidden'); 122 } else { 123 $discountElement.removeClass('hidden').find('span').text(product.targetDiscountedUnitAmount); 124 $priceBefore.removeClass('hidden'); 125 } 126 } 127 }); 128} 129 130/** 131 * change in stock total 132 * @param {buyNowItemsTotalPrice} buyNowItemsTotalPrice -buyNowItemsTotalPrice 133 */ 134function changeButNowTotal(buyNowItemsTotalPrice) { 135 if ($('.cart__total-price').length) { 136 var html = ''; 137 $('.cart__total-price').empty(); 138 html = 'Total: ' + buyNowItemsTotalPrice; 139 $('.cart__total-price').append(html); 140 } 141} 142 143/** 144 * displa popup of Error 145 * @param {Object} err - Error data 146 */ 147function createErrorNotification(errData) { 148 // è¦åã¡ãã»ã¼ã¸ãã¤ã¢ãã° 149 var dialog = '<div class="modal-base modal-paypal-wrapper jsModalContentOuter">'; 150 dialog += '<div class="modal-paypal__description">' + errData.responseJSON.errorMessage + '</div>'; 151 dialog += '<ul class="modal-paypal-buttons">'; 152 dialog += '<li><button type="button" class="button-gray btn-close">Close</button></li>'; 153 dialog += '</ul>'; 154 dialog += '</div>'; 155 $.magnificPopup.open({ 156 items: { 157 src: dialog, 158 type: 'inline' 159 }, 160 mainClass: 'mfp-fade', 161 removalDelay: 600, 162 closeOnBgClick: true, 163 callbacks: { 164 open: function open() { 165 $modalContent = $(this.content); 166 $modalContent.on('click', '.btn-close', function () { 167 $.magnificPopup.close(); 168 $(document).off('keydown', keydownHandler); 169 }); 170 $(document).on('keydown', keydownHandler); 171 } 172 } 173 }); 174} 175 176/** 177 * BillingAgreementIDã¾ãã¯ããã©ã«ãã¢ãã¬ã¹ããªã
177å ´åã®ãã¤ã¢ãã° 178 * @param {Object} errData - Error data 179 * @param {string} buttonText - submitãã¿ã³ã«è¡¨ç¤ºããã¡ãã»ã¼ã¸ 180 */ 181function noSettingDaialog(errData, buttonText) { 182 // è¦åã¡ãã»ã¼ã¸ãã¤ã¢ãã° 183 var dialog = '<div class="modal-base modal-paypal-wrapper jsModalContentOuter">'; 184 dialog += '<div class="modal-paypal__description">' + errData.responseJSON.errorMessage + '</div>'; 185 dialog += '<ul class="modal-paypal-buttons">'; 186 dialog += '<li><button type="button" class="button-basic btn-submit" onclick="location.href=\'' + errData.responseJSON.redirectUrl + '\'">' + buttonText + '</button></li>'; 187 dialog += '<li><button type="button" class="button-gray btn-close">CANCEL</button></li>'; 188 dialog += '</ul>'; 189 dialog += '</div>'; 190 $.magnificPopup.open({ 191 items: { 192 src: dialog, 193 type: 'inline' 194 }, 195 mainClass: 'mfp-fade', 196 removalDelay: 600, 197 closeOnBgClick: true, 198 callbacks: { 199 open: function open() { 200 $modalContent = $(this.content); 201 $modalContent.on('click', '.btn-close', function () { 202 $.magnificPopup.close(); 203 $(document).off('keydown', keydownHandler); 204 }); 205 $(document).on('keydown', keydownHandler); 206 } 207 } 208 }); 209} 210 211/** 212 * ãã§ãã¯ã¢ã¦ãäºåãã§ãã¯ã¨ã©ã¼ãã³ããªã³ã° 213 * @param {Object} err - Parameters to append 214 */ 215function checkoutBeforeCheckErrorHandle(err) { 216 // PreferredAddressããªãå ´å 217 if ('noPreferredAddress' in err.responseJSON && err.responseJSON.noPreferredAddress) { 218 noSettingDaialog(err, 'Address Book'); 219 return; 220 } 221 222 // BillingAgreementIDããªãå ´å 223 if ('noBillingAgreement' in err.responseJSON && err.responseJSON.noBillingAgreement) { 224 noSettingDaialog(err, 'SETUP'); 225 return; 226 } 227 if ('redirectUrl' in err.responseJSON && err.responseJSON.redirectUrl) { 228 // ãªãã¤ã¬ã¯ãURLãããã°ãªãã¤ã¬ã¯ã 229 window.location.href = err.responseJSON.redirectUrl; 230 } else { 231 // ã¨ã©ã¼ã¡ãã»ã¼ã¸è¡¨ç¤º 232 createErrorNotification(err); 233 } 234} 235 236/** 237 * ãã§ãã¯ã¢ã¦ãããã¨ã©ã¼ã§æ»ãããæã®ã¨ã©ã¼æã表示ãã 238 */ 239function showErrorDialog() { 240 var errorArray = JSON.parse($('#errorArray').val() || 'null'); 241 if (errorArray === null) { 242 // ã¨ã©ã¼æ å ±ããªãå ´åã¯ã¹ããããã 243 return; 244 } 245 var errorForPlaceOrder = errorArray[0]; 246 // å é¨å¦çã§ã®ã¨ã©ã¼ã®å ´å 247 var dialogContent = "<div class=\"modal-base modal-paypal-wrapper jsModalContentOuter\">\n <div class=\"modal-paypal__ttl\">Checkout Unavailable</div>\n <div class=\"modal-paypal__description\" style=\"text-align:center;padding-left:1em;padding-right:1em;\">\n ".concat(errorForPlaceOrder.message.split('|').join('<br>'), "\n </div>\n <ul class=\"modal-paypal-buttons\">\n <li><button type=\"button\" class=\"button-basic btn-close\" onclick=\"$.magnificPopup.close();\">Continue</button></li>\n </ul>\n </div>"); 248 $.magnificPopup.open({ 249 items: { 250 src: dialogContent, 251 type: 'inline' 252 }, 253 closeOnBgClick: false, 254 mainClass: 'mfp-fade', 255 removalDelay: 600, 256 enableEscapeKey: false, 257 showCloseBtn: false, 258 callbacks: { 259 open: function open() { 260 var $content = $(this.content); 261 $content.on('click', '.btn-close', function () { 262 $.magnificPopup.close(); 263 // eslint-disable-next-line no-use-before-define 264 $(document).off('keydown', keydownHandler); 265 }); 266 $(document).on('keydown', keydownHandler); 267 } 268 } 269 }); 270} 271module.exports = function () { 272 // åååé¤ 273 $('body').on('click', '.remove-product', function (e) { 274 e.preventDefault(); 275 var button = $(this); 276 var productID = $(this).data('pid'); 277 var url = $(this).data('action'); 278 var uuid = $(this).data('uuid'); 279 var urlParams = { 280 pid: productID, 281 uuid: uuid 282 }; 283 url = appendToUrl(url, urlParams); 284 285 // 確èªãã¤ã¢ãã° 286 var dialog = '<div class="modal-base modal-paypal-wrapper jsModalContentOuter">'; 287 dialog += '<div class="modal-paypal__description"> Are you sure you want to remove this item from your cart? </div>'; 288 dialog += '<ul class="modal-paypal-buttons">'; 289 dialog += '<li><button type="button" class="button-basic btn-submit">CONFIRM</button></li>'; 290 dialog += '<li><button type="button" class="button-gray btn-cancel">CANCEL</button></li>'; 291 dialog += '</ul>'; 292 dialog += '</div>'; 293 $.magnificPopup.open({ 294 items: { 295 src: dialog, 296 type: 'inline' 297 }, 298 mainClass: 'mfp-fade', 299 removalDelay: 600, 300 closeOnBgClick: true, 301 callbacks: { 302 open: function open() { 303 $modalContent = $(this.content); 304 $modalContent.on('click', '.btn-submit', function () { 305 $.spinner().start(); 306 $modalContent.spinner().start(); 307 $.ajax({ 308 url: url, 309 type: 'get', 310 dataType: 'json', 311 success: function success(data) { 312 // ååè¦ç´ åé¤ 313 button.parents('.cart__product-list-article').remove(); 314 // ååå°è¨ã®ä¿®æ£ 315 changeAllSubTotal(data.basket); 316 // disocuntã®ä¿®æ£ 317 changeAllDiscounts(data); 318 // BuyNowä¾¡æ ¼ä¿®æ£ 319 changeButNowTotal(data.buyNowItemsTotalPrice.formatted); 320 // ããã«ã¼ãã®æ´æ° 321 updateMiniCart(data.quantityTotal);
322 // ååããªããªã£ãå ´åã®å¶å¾¡ 323 updateProductList(data.hasBuyNow, data.hasPreOrder, data.hasSinglePurchase); 324 // GTMãã¼ã¿ããã·ã¥ 325 var ecommerce = data.gtmData; 326 window.dataLayer = window.dataLayer || []; 327 dataLayer.push({ 328 ecommerce: null 329 }); 330 dataLayer.push({ 331 event: 'remove_from_cart', 332 ecommerce: ecommerce 333 }); 334 $.magnificPopup.close(); 335 $.spinner().stop(); 336 }, 337 error: function error(err) { 338 _error = err; 339 if (err.responseJSON.redirectUrl) { 340 window.location.href = err.responseJSON.redirectUrl; 341 } else { 342 $.magnificPopup.close(); 343 } 344 } 345 }); 346 $(document).off('keydown', keydownHandler); 347 }); 348 $modalContent.on('click', '.btn-cancel', function () { 349 $.magnificPopup.close(); 350 $(document).off('keydown', keydownHandler); 351 }); 352 $(document).on('keydown', keydownHandler); 353 }, 354 afterClose: function afterClose() { 355 if (_error) { 356 createErrorNotification(_error); 357 _error = null; 358 } 359 $.spinner().stop(); 360 } 361 } 362 }); 363 }); 364 365 // 忰夿´ 366 $('body').on('change', '.quantity-form > .quantity', function () { 367 var preSelectQty = $(this).data('pre-select-qty'); 368 var quantity = $(this).val(); 369 var productID = $(this).data('pid'); 370 var url = $(this).data('action'); 371 var uuid = $(this).data('uuid'); 372 var urlParams = { 373 pid: productID, 374 quantity: quantity, 375 uuid: uuid 376 }; 377 url = appendToUrl(url, urlParams); 378 $.spinner().start(); 379 $.ajax({ 380 url: url, 381 type: 'get', 382 context: this, 383 dataType: 'json', 384 success: function success(data) { 385 // ååå°è¨ã®ä¿®æ£ 386 changeAllSubTotal(data); 387 // disocuntã®ä¿®æ£ 388 changeAllDiscounts(data); 389 // BuyNowä¾¡æ ¼ä¿®æ£ 390 changeButNowTotal(data.buyNowItemsTotalPrice.formatted); 391 // ããã«ã¼ãã®æ´æ° 392 updateMiniCart(data.quantityTotal); 393 $.spinner().stop(); 394 }, 395 error: function error(err) { 396 if (err.responseJSON.redirectUrl) { 397 window.location.href = err.responseJSON.redirectUrl; 398 } else { 399 createErrorNotification(err); 400 $(this).val(parseInt(preSelectQty, 10)); 401 $.spinner().stop(); 402 } 403 } 404 }); 405 }); 406 407 // åå¥ãã§ãã¯ã¢ã¦ãï¼äºåãã§ãã¯ï¼ 408 $('body').on('click', '.button-checkout', function (e) { 409 var productID = $(this).data('pid'); 410 var productStatus = $(this).data('pst'); 411 var url = $(this).data('action'); 412 var data = { 413 pid: productID, 414 pst: productStatus 415 }; 416 $.spinner().start(); 417 $.ajax({ 418 url: url, 419 type: 'post', 420 dataType: 'json', 421 data: data, 422 success: function success(data) { 423 // ãã§ãã¯ã¢ã¦ããã¼ã¸ã¸ãªãã¤ã¬ã¯ã 424 window.location.href = data.redirectUrl; 425 }, 426 error: function error(err) { 427 checkoutBeforeCheckErrorHandle(err); 428 $.spinner().stop(); 429 } 430 }); 431 }); 432 433 // BuyNowãã§ãã¯ã¢ã¦ãï¼äºåãã§ãã¯ï¼ 434 $('body').on('click', '.button-checkout-buynow', function (e) { 435 var productStatus = $(this).data('pst'); 436 var url = $(this).data('action'); 437 var data = { 438 pst: productStatus 439 }; 440 $.spinner().start(); 441 $.ajax({ 442 url: url, 443 type: 'post', 444 dataType: 'json', 445 data: data, 446 success: function success(data) { 447 // ãã§ãã¯ã¢ã¦ããã¼ã¸ã¸ãªãã¤ã¬ã¯ã 448 window.location.href = data.redirectUrl; 449 }, 450 error: function error(err) { 451 checkoutBeforeCheckErrorHandle(err); 452 $.spinner().stop(); 453 } 454 }); 455 }); 456 showErrorDialog(); 457}; 458 459/***/ }), 460
461/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/favorite.js": 462/*!*********************************************************************************************************!*\ 463 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/favorite.js ***! 464 \*********************************************************************************************************/ 465/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 466 467"use strict"; 468 469 470var errorNotificationDialog = __webpack_require__(/*! ../components/errorNotificationDialog */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/errorNotificationDialog.js"); 471var _require = __webpack_require__(/*! ../components/favoriteHandle */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/favoriteHandle.js"), 472 changeFavoriteButton = _require.changeFavoriteButton, 473 initializeFavoriteButton = _require.initializeFavoriteButton; 474var _require2 = __webpack_require__(/*! ../utils/commonHelper */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/utils/commonHelper.js"), 475 appendToUrl = _require2.appendToUrl; 476module.exports = function () { 477 // Initialize favorite button status via AJAX on Cart page load 478 $('.button-favorite').each(function () { 479 initializeFavoriteButton($(this)); 480 }); 481 $('.button-favorite').on('click', function (e) { 482 e.preventDefault(); 483 var button = $(this); 484 var productID = $(this).attr('data-pid'); 485 var uuid = $(this).attr('data-uuid'); 486 var url = $(this).attr('data-action-url'); 487 var action = $(this).attr('data-action'); 488 var optionId = $(this).closest('.product-detail').find('.product-option').attr('data-option-id'); 489 var optionVal = $(this).closest('.product-detail').find('.options-select option:selected').attr('data-value-id'); 490 optionId = optionId || null; 491 optionVal = optionVal || null; 492 var data = { 493 pid: productID, 494 uuid: uuid, 495 optionId: optionId, 496 optionVal: optionVal 497 }; 498 if (!url || !productID) { 499 return; 500 } 501 if (action == "Wishlist-AddProduct") { 502 $.spinner().start(); 503 button.attr('disabled', true); 504 $.ajax({ 505 url: url, 506 type: 'post', 507 dataType: 'json', 508 data: data, 509 success: function success(data) { 510 changeFavoriteButton(data, button); 511 $.spinner().stop(); 512 }, 513 error: function error(err) { 514 if (err.responseJSON.redirectUrl) { 515 window.location.href = err.responseJSON.redirectUrl; 516 } else { 517 errorNotificationDialog(err.responseJSON.errorMessage); 518 $.spinner().stop(); 519 } 520 } 521 }); 522 } else if (action == "Wishlist-RemoveProduct") { 523 url = appendToUrl(url, data); 524 $.spinner().start(); 525 button.attr('disabled', true); 526 $.ajax({ 527 url: url, 528 type: 'get', 529 dataType: 'json', 530 success: function success(data) { 531 changeFavoriteButton(data, button); 532 $.spinner().stop(); 533 }, 534 error: function error(err) { 535 if (err.responseJSON.redirectUrl) { 536 window.location.href = err.responseJSON.redirectUrl; 537 } else { 538 errorNotificationDialog(err.responseJSON.errorMessage); 539 $.spinner().stop(); 540 } 541 } 542 }); 543 } 544 }); 545}; 546 547/***/ }), 548
549/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/errorNotificationDialog.js": 550/*!******************************************************************************************************************************!*\ 551 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/errorNotificationDialog.js ***! 552 \******************************************************************************************************************************/ 553/***/ ((module) => { 554 555module.exports = function (message, title) { 556 // è¦åã¡ãã»ã¼ã¸ãã¤ã¢ãã° 557 var dialog = '<div class="modal-base modal-paypal-wrapper jsModalContentOuter">'; 558 if (title) { 559 dialog += '<div class="modal-paypal__ttl">' + title + '</div>'; 560 } 561 dialog += '<div class="modal-paypal__description">' + message + '</div>'; 562 dialog += '<ul class="modal-paypal-buttons">'; 563 dialog += '<li><button type="button" class="button-gray btn-close" onclick="$.magnificPopup.close();">Close</button></li>'; 564 dialog += '</ul>'; 565 dialog += '</div>'; 566 $.magnificPopup.open({ 567 items: { 568 src: dialog, 569 type: 'inline' 570 }, 571 settings: null, 572 closeOnBgClick: true, 573 mainClass: 'mfp-fade', 574 removalDelay: 600, 575 callbacks: { 576 open: function open() { 577 var $content = $(this.content); 578 $content.on('click', '.btn-close', function () { 579 $.magnificPopup.close(); 580 $(document).off('keydown', keydownHandler); 581 }); 582 var keydownHandler = function keydownHandler(e) { 583 if (e.keyCode == 27) { 584 $content.find('.btn-close').click(); 585 return false; 586 } 587 }; 588 $(document).on('keydown', keydownHandler); 589 } 590 } 591 }); 592}; 593 594/***/ }), 595
596/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/favoriteHandle.js": 597/*!*********************************************************************************************************************!*\ 598 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/components/favoriteHandle.js ***! 599 \*********************************************************************************************************************/ 600/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 601 602"use strict"; 603 604 605var _require = __webpack_require__(/*! ../utils/commonHelper */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/utils/commonHelper.js"), 606 convertStrToBool = _require.convertStrToBool; 607 608/** 609 * change favorite button 610 * @param {string} data - data returned from the server's ajax call 611 * @param {Object} button - button that was clicked to add a product to the wishlist 612 */ 613function changeFavoriteButton(data, button) { 614 $.spinner().stop(); 615 button.removeAttr('disabled'); 616 var url = button.data('action-url'); 617 if (data.success) { 618 var wasFavorite = convertStrToBool(button.attr('data-is-favorite')); 619 if (wasFavorite) { 620 // ç»é²æ©è½ã«å¤æ´ 621 url = url.replace('Wishlist-RemoveProduct', 'Wishlist-AddProduct'); 622 button.attr('data-action-url', url); 623 button.attr('data-action', 'Wishlist-AddProduct'); 624 } else { 625 // ç»é²è§£é¤æ©è½ã«å¤æ´ 626 url = url.replace('Wishlist-AddProduct', 'Wishlist-RemoveProduct'); 627 button.attr('data-action-url', url); 628 button.attr('data-action', 'Wishlist-RemoveProduct'); 629 } 630 button.attr('data-is-favorite', !wasFavorite); 631 button.toggleClass('is-active'); 632 } else { 633 // ã¨ã©ã¼ã¡ãã»ã¼ã¸ã®è¡¨ç¤º 634 button.removeAttr('disabled'); 635 } 636} 637 638/** 639 * Initialize favorite button status via AJAX 640 * @param {Object} button - button element to initialize 641 */ 642function initializeFavoriteButton(button) { 643 var pid = button.attr('data-pid'); 644 var url = button.data('action-url'); 645 var checkUrl = button.data('check-favorite-url'); 646 if (!pid || !url || !checkUrl) { 647 return; 648 } 649 $.ajax({ 650 url: checkUrl, 651 type: 'get', 652 data: { 653 pid: pid 654 }, 655 dataType: 'json', 656 success: function success(data) { 657 var isFavorite = data.isFavorite; 658 659 // Update button attributes based on server response 660 button.attr('data-is-favorite', isFavorite); 661 if (isFavorite) { 662 // Set to remove mode 663 url = url.replace('Wishlist-AddProduct', 'Wishlist-RemoveProduct'); 664 button.attr('data-action-url', url); 665 button.attr('data-action', 'Wishlist-RemoveProduct'); 666 button.addClass('is-active'); 667 } else { 668 // Set to add mode 669 url = url.replace('Wishlist-RemoveProduct', 'Wishlist-AddProduct'); 670 button.attr('data-action-url', url); 671 button.attr('data-action', 'Wishlist-AddProduct'); 672 button.removeClass('is-active'); 673 } 674 }, 675 error: function error(err) { 676 // If error occurs, keep the default state 677 } 678 }); 679} 680module.exports = { 681 changeFavoriteButton: changeFavoriteButton, 682 initializeFavoriteButton: initializeFavoriteButton 683}; 684 685/***/ }), 686
vendor: 4,654 bytes, lines 687-708
687/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/product/salesCounter.js": 688/*!****************************************************************************************************************!*\ 689 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/product/salesCounter.js ***! 690 \****************************************************************************************************************/ 691/***/ ((module) => { 692 693"use strict"; 694 695 696function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); } 697function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); } 698function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } 699function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } 700module.exports = { 701 countdown: function countdown() { 702 _countdown(); 703 } 704}; 705function _countdown() { 706 document.querySelectorAll('.product-counter').forEach(function (elem) { 707 var endDate = null; 708 var isPreOrderCountDown = false;
709 if (elem.querySelectorAll('#is-sales-term')[0].value === 'true') { 710 // ã»ã¼ã«æéãããå ´åã ãã«ã¦ã³ããã¦ã³ãããã 711 endDate = elem.querySelectorAll('#end-date')[0].value; 712 } else if (elem.querySelectorAll('#is-preorder-end-date')[0].value === 'true') { 713 endDate = elem.querySelectorAll('#pre-order-end-date')[0].value; 714 isPreOrderCountDown = true; 715 } 716 if (endDate) { 717 var now = new Date(); // ç¾å¨æå»ãåå¾ 718 var end = new Date(endDate); // ææ¥ã®0:00ãåå¾ 719 var diff = end.getTime() - now.getTime(); // æéã®å·®ãåå¾ï¼ããªç§ï¼ 720 721 // ããªç§ããåä½ãä¿®æ£ 722 var calcHour = Math.floor(diff / 1000 / 60 / 60); 723 var calcMin = Math.floor(diff / 1000 / 60) % 60; 724 var calcSec = Math.floor(diff / 1000) % 60; 725 726 // åå¾ããæéã表示 727 var dispDays = Math.floor(calcHour / 24); 728 var disHour = calcHour % 24; 729 elem.querySelectorAll('#day')[0].textContent = dispDays; 730 elem.querySelectorAll('#hour')[0].textContent = disHour < 10 ? '0' + disHour : disHour; 731 elem.querySelectorAll('#min')[0].textContent = calcMin < 10 ? '0' + calcMin : calcMin; 732 elem.querySelectorAll('#sec')[0].textContent = calcSec < 10 ? '0' + calcSec : calcSec; 733 734 // æéå·®ï¼diffï¼ã0以ä¸ï¼çµäºæéãéãã¦ããï¼å ´åã¯ãã¿ã¤ãã¼è¡¨ç¤ºãé表示ã«ãã 735 if (diff <= 0) { 736 $('.time-container').css('display', 'none'); 737 if (isPreOrderCountDown) { 738 window.location.reload(); 739 } 740 } 741 } 742 }); 743} 744$(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() { 745 var second, minute, hour, day, response, data, now, endDate, countDown, countInterval; 746 return _regenerator().w(function (_context) { 747 while (1) switch (_context.n) { 748 case 0: 749 _countdown(); 750 setInterval(_countdown, 1000); 751 if (!(document.getElementById("countdown-3") !== null)) { 752 _context.n = 3; 753 break; 754 } 755 second = 1000, minute = second * 60, hour = minute * 60, day = hour * 24; // Fetch current time 756 _context.n = 1; 757 return fetch('https://worldtimeapi.org/api/timezone/Asia/Tokyo'); 758 case 1: 759 response = _context.v; 760 _context.n = 2; 761 return response.json(); 762 case 2: 763 data = _context.v; 764 now = new Date(data.datetime).getTime(); 765 endDate = document.getElementById("end-date").value || null; 766 countDown = new Date(endDate).getTime(), countInterval = setInterval(function () { 767 now += 1000; // increment the "now" time by 1000 milliseconds 768 769 var distance = countDown - now; 770 document.getElementById("days-3").innerText = Math.floor(distance / day); 771 document.getElementById("hours-3").innerText = Math.floor(distance % day / hour); 772 document.getElementById("minutes-3").innerText = Math.floor(distance % hour / minute); 773 document.getElementById("seconds-3").innerText = Math.floor(distance % minute / second); 774 if (distance < 0) { 775 document.getElementById("countdown-3").style.display = "none"; 776 clearInterval(countInterval); 777 } 778 }, 1000); 779 case 3: 780 return _context.a(2); 781 } 782 }, _callee); 783}))); 784 785/***/ }), 786
787/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/util.js": 788/*!************************************************************************************************!*\ 789 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/util.js ***! 790 \************************************************************************************************/ 791/***/ ((module) => { 792 793function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 794module.exports = function (include) { 795 if (typeof include === 'function') { 796 include(); 797 } else if (_typeof(include) === 'object') { 798 Object.keys(include).forEach(function (key) { 799 if (typeof include[key] === 'function') { 800 include[key](); 801 } 802 }); 803 } 804}; 805 806/***/ }), 807
808/***/ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/utils/commonHelper.js": 809/*!**************************************************************************************************************!*\ 810 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/utils/commonHelper.js ***! 811 \**************************************************************************************************************/ 812/***/ ((module) => { 813 814"use strict"; 815 816 817/** 818 * appends params to a url 819 * @param {string} url - Original url 820 * @param {Object} params - Parameters to append 821 * @returns {string} result url with appended parameters 822 */ 823function appendToUrl(url, params) { 824 var newUrl = url; 825 newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) { 826 return key + '=' + encodeURIComponent(params[key]); 827 }).join('&'); 828 return newUrl; 829} 830 831/** 832 * Converts a string to boolean 833 * @param {*} str - The value to convert 834 * @returns {boolean} The boolean value 835 */ 836function convertStrToBool(str) { 837 if (typeof str !== 'string') { 838 return Boolean(str); 839 } 840 try { 841 var obj = JSON.parse(str.toLowerCase()); 842 return obj == true; 843 } catch (e) { 844 return str != ''; 845 } 846} 847module.exports = { 848 appendToUrl: appendToUrl, 849 convertStrToBool: convertStrToBool 850}; 851 852/***/ })
852 853 854/******/ }); 855/************************************************************************/ 856/******/ // The module cache 857/******/ var __webpack_module_cache__ = {}; 858/******/ 859/******/ // The require function 860/******/ function __webpack_require__(moduleId) { 861/******/ // Check if module is in cache 862/******/ var cachedModule = __webpack_module_cache__[moduleId]; 863/******/ if (cachedModule !== undefined) { 864/******/ return cachedModule.exports; 865/******/ } 866/******/ // Create a new module (and put it into the cache) 867/******/ var module = __webpack_module_cache__[moduleId] = { 868/******/ // no module.id needed 869/******/ // no module.loaded needed 870/******/ exports: {} 871/******/ }; 872/******/ 873/******/ // Execute the module function 874/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 875/******/ 876/******/ // Return the exports of the module 877/******/ return module.exports; 878/******/ } 879/******/ 880/************************************************************************/ 881var __webpack_exports__ = {}; 882// This entry need to be wrapped in an IIFE because it need to be in strict mode. 883(() => { 884"use strict"; 885/*!************************************************************************************************!*\ 886 !*** ./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart.js ***! 887 \************************************************************************************************/ 888 889 890var processInclude = __webpack_require__(/*! ./util */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/util.js"); 891$(document).ready(function () { 892 processInclude(__webpack_require__(/*! ./cart/cart */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/cart.js")); 893 processInclude(__webpack_require__(/*! ./cart/favorite */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/cart/favorite.js")); 894 processInclude(__webpack_require__(/*! ./product/salesCounter */ "./app_prime1studio_ec/cartridges/app_prime1studio_ec/cartridge/client/default/js/product/salesCounter.js")); 895}); 896})(); 897 898/******/ })() 899; 900//# sourceMappingURL=cart.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.