1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ // The require scope 4/******/ const __webpack_require__ = {}; 5/******/ 6/************************************************************************/ 7/******/ /* webpack/runtime/compat get default export */ 8/******/ (() => { 9/******/ // getDefaultExport function for compatibility with non-harmony modules 10/******/ __webpack_require__.n = (module) => { 11/******/ const getter = module && module.__esModule ? 12/******/ () => (module['default']) : 13/******/ () => (module); 14/******/ __webpack_require__.d(getter, { a: getter }); 15/******/ return getter; 16/******/ }; 17/******/ })(); 18/******/ 19/******/ /* webpack/runtime/define property getters */ 20/******/ (() => { 21/******/ // define getter/value functions for harmony exports 22/******/ __webpack_require__.d = (exports, definition) => { 23/******/ if(Array.isArray(definition)) { 24/******/ var i = 0; 25/******/ while(i < definition.length) { 26/******/ var key = definition[i++]; 27/******/ var binding = definition[i++]; 28/******/ if(!__webpack_require__.o(exports, key)) { 29/******/ if(binding === 0) { 30/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); 31/******/ } else { 32/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); 33/******/ } 34/******/ } else if(binding === 0) { i++; } 35/******/ } 36/******/ } else { 37/******/ for(var key in definition) { 38/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 39/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 40/******/ } 41/******/ } 42/******/ } 43/******/ }; 44/******/ })(); 45/******/ 46/******/ /* webpack/runtime/hasOwnProperty shorthand */ 47/******/ (() => { 48/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) 49/******/ })(); 50/******/ 51/************************************************************************/ 52 53;// external "jQuery" 54const external_jQuery_namespaceObject = window["jQuery"]; 55var external_jQuery_default = /*#__PURE__*/__webpack_require__.n(external_jQuery_namespaceObject); 56;// ./src/js/user-my-account.js 57 58external_jQuery_default()(document).ready(function ($) { 59 const localTimezone = moment.tz.guess(); 60 let shouldDisplayNotices = false; 61 const cancelConfirmation = function () { 62 // eslint-disable-next-line no-alert 63 return window.confirm(wc_bookings_user_my_account_params.cancel_confirmation); 64 }; 65 66 // Confirm booking cancellation. 67 $('.booking-cancel').on('click', 'a.cancel', cancelConfirmation); 68 69 // Also do the confirmation for keydown enter or space keys for accessibility. 70 $('.booking-cancel').on('keydown', 'a.cancel', function (e) { 71 const key = e.key || e.keyCode; 72 if (key === 'Enter' || key === 13 || key === ' ' || key === 32) { 73 e.preventDefault(); 74 if (cancelConfirmation()) { 75 window.location.href = $(this).attr('href'); 76 return false; 77 } 78 } 79 }); 80 81 /** 82 * Callback that checks if we should convert or add timezone string to the booking time. 83 * 84 * Since admin does not know what timezone the user is in, it is not possible to set a proper 85 * local timezone for the booking manually create by admin. If timezone conversion is enabled 86 * and the user timezone is different then admin timezone the user will see wrong start and end times. 87 * 88 * Because the booking start and end time are filterable, it's possible for those times to use different 89 * format. We validate the time and only convert times that use the same format as Bookings is using. 90 * 91 * Reference: https://github.com/woocommerce/woocommerce-bookings/issues/2650 92 * 93 * @param {number} index Element index. 94 * @param {Object} element jQuery element. 95 */ 96 const maybeConvertDateTime = function (index, element) { 97 if ($(element).data('allDay') === 'yes') { 98 // Don't adjust for day availability type events. 99 return; 100 } 101 const elementTimezone = $(element).data('timezone'); 102 if (elementTimezone === localTimezone) { 103 return; 104 } 105 const elementTime = $(element).text().trim(); 106 107 // If the format is changed, only add timezone string. 108 if (!moment(elementTime, wc_bookings_user_my_account_params.datetime_format, true).isValid()) { 109 $(element).text(elementTime + ' ' + elementTimezone); 110 shouldDisplayNotices = true; 111 return; 112 } 113 const formattedDate = moment.tz(elementTime, wc_bookings_user_my_account_params.datetime_format, elementTimezone).tz(localTimezone).format(wc_bookings_user_my_account_params.datetime_format); 114 $(element).text(formattedDate); 115 }; 116 if (!wc_bookings_user_my_account_params.timezone_conversion) { 117 // No conversion necessary, don't adjust the time display. 118 return; 119 } 120 if (!localTimezone) { 121 // Local timezone not found. We can't compare the bookings timezone to local - abort! 122 return; 123 } 124 $('.my_account_bookings').find('tbody .booking-start-date').each(maybeConvertDateTime); 125 $('.my_account_bookings').find('tbody .booking-end-date').each(maybeConvertDateTime); 126 $('.woocommerce-order-details').find('.wc-booking-summary-list .booking-start-date').each(maybeConvertDateTime); 127 $('.woocommerce-order-details').find('.wc-booking-summary-list .booking-end-date').each(maybeConvertDateTime); 128 129 // Inform user about the display of timezones for some of the items. 130 if (shouldDisplayNotices) { 131 $('.bookings-my-account-notice').text(wc_bookings_user_my_account_params.timezone_notice + ' ' + localTimezone + '.').show(); 132 } 133}); 134/******/ })() 135; 136//# sourceMappingURL=user-my-account.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.