PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | assets/dist/js/elementor-init.js +423 -90 1.7.22.7.0 View file →
@@ -3,18 +3,81 @@
3 3
4 4 Object.defineProperty(exports, "__esModule", {
5 5 value: true
6 6 });
7 +exports["default"] = void 0;
8 +var CheckoutSettings = elementorModules.frontend.handlers.Base.extend({
9 + getDefaultSettings: function getDefaultSettings() {
10 + return {
11 + selectors: {
12 + sticky: '.sellkit-multistep-checkout-sidebar-sticky'
13 + }
14 + };
15 + },
16 + getDefaultElements: function getDefaultElements() {
17 + var selectors = this.getSettings('selectors');
18 + return {
19 + $stickyContainer: this.$element.find(selectors.sticky)
20 + };
21 + },
22 + onInit: function onInit() {
23 + elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments);
24 + this.setOffset();
25 + },
26 + setOffset: function setOffset() {
27 + if (this.getElementSettings('show_sticky_cart_details') !== 'yes') {
28 + return;
29 + }
30 +
31 + var offset = this.getElementSettings('sticky_cart_offset') || 0;
32 +
33 + if (offset === 0) {
34 + return;
35 + }
36 +
37 + var adminbar = document.getElementById('wpadminbar');
38 +
39 + if (!_.isNull(adminbar)) {
40 + offset += adminbar.offsetHeight;
41 + }
42 +
43 + this.elements.$stickyContainer.css('top', "".concat(offset, "px"));
44 + }
45 +});
46 +var _default = CheckoutSettings;
7 47 exports["default"] = _default;
8 48
49 +},{}],2:[function(require,module,exports){
50 +"use strict";
51 +
52 +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
53 +
54 +Object.defineProperty(exports, "__esModule", {
55 + value: true
56 +});
57 +exports["default"] = _default;
58 +
9 59 var _i18n = require("@wordpress/i18n");
10 60
61 +var _checkoutSettings = _interopRequireDefault(require("./checkout-settings"));
62 +
11 63 /* eslint no-undef: 0 */
12 64 // Temporary turned off no undefined variable for localStorage
13 65 var $ = jQuery;
14 66 var wcCountries = JSON.parse(wc_country_select_params.countries);
67 +/**
68 + * When batching "same as shipping" billing sync, skip duplicate sellkit address AJAX
69 + * (avoids racing update_checkout / fragment refresh against hidden country/state fields).
70 + *
71 + * @type {boolean}
72 + */
15 73
16 -function _default() {
74 +window.sellkitSuppressBillingAddressAjax = false;
75 +
76 +function _default($scope) {
77 + new _checkoutSettings["default"]({
78 + $element: $scope
79 + });
17 80 $('body').addClass('contains-sellkit-checkout'); // General class to handle compatibility with other themes.
18 81
19 82 var parent = $('#sellkit-checkout-multistep-inner-wrap');
20 83 var sidebar = $('.sellkit-checkout-right-column');
@@ -57,8 +120,11 @@
57 120 $('.multistep-headers').css('height', 'auto'); // Manage Breadcrumb.
58 121
59 122 breadcrumb.find('.information').removeClass('current').addClass('blue-line');
60 123 breadcrumb.find('.shipping').addClass('current').removeClass('inactive');
124 + $('html, body').animate({
125 + scrollTop: $('.sellkit-checkout-left-column').offset().top
126 + }, 500);
61 127 });
62 128 $('.go-to-first').on('click', function () {
63 129 first.show();
64 130 third.hide();
@@ -68,8 +134,11 @@
68 134 sidebar.css('background-color', 'transparent'); // Manage Breadcrumb.
69 135
70 136 breadcrumb.find('.information').removeClass('blue-line').addClass('current');
71 137 breadcrumb.find('.shipping, .payment').removeClass('current').removeClass('blue-line').addClass('inactive');
138 + $('html, body').animate({
139 + scrollTop: $('.sellkit-checkout-left-column').offset().top
140 + }, 500);
72 141 });
73 142 $('.go-to-payment').on('click', function () {
74 143 // Checks if required fields are filled.
75 144 var requiredFieldsError = checkRequiredFields();
@@ -90,8 +159,11 @@
90 159 $('.multistep-headers').css('height', 'auto'); // Manage Breadcrumb.
91 160
92 161 breadcrumb.find('.shipping').addClass('blue-line').removeClass('current');
93 162 breadcrumb.find('.payment').addClass('current').removeClass('inactive');
163 + $('html, body').animate({
164 + scrollTop: $('.sellkit-checkout-left-column').offset().top
165 + }, 500);
94 166 });
95 167 $('.go-to-second , .go-to-second-header').on('click', function () {
96 168 // Checks if required fields are filled.
97 169 var requiredFieldsError = checkRequiredFields();
@@ -115,8 +187,11 @@
115 187 $('.multistep-headers').css('height', 'auto'); // Manage Breadcrumb.
116 188
117 189 breadcrumb.find('.shipping').addClass('current').removeClass('blue-line');
118 190 breadcrumb.find('.payment').removeClass('current').addClass('inactive');
191 + $('html, body').animate({
192 + scrollTop: $('.sellkit-checkout-left-column').offset().top
193 + }, 500);
119 194 }); //Inject login wrapper & functionality.
120 195
121 196 emailProcess();
122 197 LoginProcess(); // Billing method toggle.
@@ -136,8 +211,9 @@
136 211 sellkitCheckoutUpdateCartItem();
137 212 applyCoupon();
138 213 couponToggle();
139 214 fixGatewayListUi();
215 + sellkitDetectShippingMethodChange();
140 216 }); // Fix the payment gateways divider issue.
141 217
142 218 fixGatewayListUi(); //Run when page loads.
143 219
@@ -160,16 +236,21 @@
160 236 sellkitCheckoutOrderBump(); // Sellkit after ajax call is completed.
161 237
162 238 sellkitAfterAjaxComplete(); // Load upsell steps with popup.
163 239
164 - sellkitLoadUpsellSteps(); // Run some functions on page load when WooCommerce doing early ajax.
240 + sellkitLoadUpsellSteps(); // send shipping method to backend after changed
165 241
242 + sellkitDetectShippingMethodChange(); // Run some functions on page load when WooCommerce doing early ajax.
243 +
166 244 window.sellkitCheckoutMakeSureJsWorks = function () {
167 245 sellkitCheckoutUpdateCartItem();
168 246 applyCoupon();
169 247 couponToggle();
170 248 fixGatewayListUi();
171 - };
249 + }; // Toggle order notes.
250 +
251 +
252 + orderNotesToggle();
172 253 }
173 254
174 255 var emailProcess = function emailProcess() {
175 256 var emailField = $('#billing_email');
@@ -182,14 +263,26 @@
182 263 var usernameField = usernameWrap.find('input');
183 264 var loginBtn = $('.login-wrapper');
184 265 var createBox = $('.create-desc');
185 266 var createCheck = $('#createaccount');
186 - emailField.on('keyup', function () {
187 - var _this = this;
267 + var emailCheckTimer = null;
268 + var usernameCheckTimer = null;
188 269
189 - setTimeout(function () {
190 - var emailAddress = $(_this).val();
270 + var getCurrentEmailValue = function getCurrentEmailValue() {
271 + return $('#billing_email').val();
272 + };
191 273
274 + var getCurrentUsernameValue = function getCurrentUsernameValue() {
275 + return $('.sellkit-checkout-widget-username-field').find('input').val();
276 + }; // Use input/change (not keyup): iOS Safari soft keyboard often omits or mishandles keyup.
277 +
278 +
279 + emailField.on('input change', function () {
280 + var inputEl = this;
281 + clearTimeout(emailCheckTimer);
282 + emailCheckTimer = setTimeout(function () {
283 + var emailAddress = $(inputEl).val();
284 +
192 285 if (_.isEmpty(emailAddress)) {
193 286 emptyError.show().css('display', 'inline-block');
194 287 errorText.hide();
195 288 createBox.css('display', 'none');
@@ -223,19 +316,27 @@
223 316 email: emailAddress,
224 317 dataType: 'json',
225 318 nonce: sellkit_elementor.nonce
226 319 }).done(function () {
320 + if (emailAddress !== getCurrentEmailValue()) {
321 + return;
322 + }
323 +
227 324 successResultEmailCheck();
228 325 }).fail(function () {
326 + if (emailAddress !== getCurrentEmailValue()) {
327 + return;
328 + }
329 +
229 330 errorResultEmailCheck();
230 331 });
231 332 }, 500);
232 333 });
233 - usernameField.on('keyup', function () {
234 - var _this2 = this;
235 -
236 - setTimeout(function () {
237 - var userValue = $(_this2).val();
334 + usernameField.on('input change', function () {
335 + var inputEl = this;
336 + clearTimeout(usernameCheckTimer);
337 + usernameCheckTimer = setTimeout(function () {
338 + var userValue = $(inputEl).val();
238 339 wp.ajax.post({
239 340 action: 'sellkit_checkout_ajax_handler',
240 341 sub_action: 'search_for_username',
241 342 user: userValue,
@@ -241,10 +342,18 @@
241 342 user: userValue,
242 343 dataType: 'json',
243 344 nonce: sellkit_elementor.nonce
244 345 }).done(function () {
346 + if (userValue !== getCurrentUsernameValue()) {
347 + return;
348 + }
349 +
245 350 $('.sellkit-checkout-widget-username-error').hide();
246 351 }).fail(function () {
352 + if (userValue !== getCurrentUsernameValue()) {
353 + return;
354 + }
355 +
247 356 $('.sellkit-checkout-widget-username-error').show();
248 357 });
249 358 }, 500);
250 359 }); // If user is going to create account show password and username fields if exists.
@@ -321,14 +430,14 @@
321 430
322 431 var secondStepHeader = function secondStepHeader() {
323 432 var email = $('#billing_email');
324 433 $('.multistep-headers > .info-a > div > .mail').text(email.val());
325 - var countryValue = $('#shipping_country option:selected').text();
326 - var state = $('#sellkit-shipping_state');
327 - var postcode = $('#shipping_postcode');
328 - var city = $('#shipping_city');
329 - var addressA = $('#shipping_address_1');
330 - var addressB = $('#shipping_address_2');
434 + var countryValue = $('#shipping_country option:selected').text() ? $('#shipping_country option:selected').text() : $('#billing_country option:selected').text();
435 + var state = $('#sellkit-shipping_state').val() ? $('#sellkit-shipping_state') : $('#sellkit-billing_state');
436 + var postcode = $('#shipping_postcode').val() ? $('#shipping_postcode') : $('#billing_postcode');
437 + var city = $('#shipping_city').val() ? $('#shipping_city') : $('#billing_city');
438 + var addressA = $('#shipping_address_1').val() ? $('#shipping_address_1') : $('#billing_address_1');
439 + var addressB = $('#shipping_address_2').val() ? $('#shipping_address_2') : $('#billing_address_2');
331 440 var finalAddress = postcode.val() ? ', ' + postcode.val() : '';
332 441 finalAddress += addressB.val() ? ', ' + addressB.val() : '';
333 442 finalAddress += addressA.val() ? ', ' + addressA.val() : '';
334 443 finalAddress += city.val() ? ', ' + city.val() : '';
@@ -345,34 +454,84 @@
345 454 $('.multistep-headers > .info-c > div > .method').text(methodTxt);
346 455 };
347 456
348 457 var manageBillingMethod = function manageBillingMethod() {
349 - var billingWrap = $('.sellkit-one-page-checkout-billing');
350 - var methodA = billingWrap.find('.method-a');
351 - var methodB = billingWrap.find('.method-b'); // Get shipping values.
458 + // Hide outer #wrapper-billing_* rows — not inner #billing_*_field <p> tags. Labels (.mini-title) sit
459 + // outside those <p> tags; hiding only the <p> left floating labels with no inputs.
460 + var mirroredSelectors = '#wrapper-billing_first_name, #wrapper-billing_last_name, #wrapper-billing_address_1, #wrapper-billing_address_2, #wrapper-billing_country, #wrapper-billing_state, #wrapper-billing_postcode, #wrapper-billing_city, #wrapper-billing_phone';
461 + /**
462 + * Always re-query the DOM. Checkout fragments replace nodes after update_checkout;
463 + * cached jQuery sets would point at detached elements and .hide() would not affect the live form.
464 + *
465 + * @param {boolean} shouldUseShippingAddress - Whether to use shipping address for billing
466 + *
467 + */
352 468
353 - var name = $('#shipping_first_name');
354 - var last = $('#shipping_last_name');
355 - var addressA = $('#shipping_address_1');
356 - var addressB = $('#shipping_address_2');
357 - var country = $('#shipping_country');
358 - var state = $('#sellkit-shipping_state');
359 - var postcode = $('#shipping_postcode');
360 - var city = $('#shipping_city');
361 - methodA.on('click', function () {
362 - billingWrap.find('.woocommerce-billing-fields__field-wrapper').hide();
363 - $('#billing_first_name').val(name.val());
364 - $('#billing_last_name').val(last.val());
365 - $('#billing_address_1').val(addressA.val());
366 - $('#billing_address_2').val(addressB.val());
367 - $('#billing_country').val(country.val()).trigger('change');
368 - $('#sellkit-billing_state').val(state.val()).trigger('change');
369 - $('#billing_postcode').val(postcode.val());
370 - $('#billing_city').val(city.val());
469 + var toggleBillingFields = function toggleBillingFields(shouldUseShippingAddress) {
470 + var billingWrap = $('.sellkit-one-page-checkout-billing');
471 +
472 + if (!billingWrap.length) {
473 + return;
474 + }
475 +
476 + var billingFieldWrapper = billingWrap.find('.woocommerce-billing-fields__field-wrapper');
477 + var mirroredBillingFields = billingFieldWrapper.find(mirroredSelectors);
478 + var billingOnlyFields = billingFieldWrapper.children().not(mirroredBillingFields);
479 +
480 + if (shouldUseShippingAddress) {
481 + mirroredBillingFields.hide();
482 +
483 + if (billingOnlyFields.length) {
484 + billingOnlyFields.show();
485 + billingFieldWrapper.show().css('display', 'inline-table');
486 + } else {
487 + billingFieldWrapper.hide();
488 + }
489 +
490 + return;
491 + }
492 +
493 + billingFieldWrapper.show().css('display', 'inline-table');
494 + mirroredBillingFields.show();
495 + billingOnlyFields.show();
496 + };
497 +
498 + var syncBillingFieldsFromShipping = function syncBillingFieldsFromShipping() {
499 + window.sellkitSuppressBillingAddressAjax = true;
500 + $('#billing_first_name').val($('#shipping_first_name').val());
501 + $('#billing_last_name').val($('#shipping_last_name').val());
502 + $('#billing_address_1').val($('#shipping_address_1').val());
503 + $('#billing_address_2').val($('#shipping_address_2').val());
504 + $('#billing_country').val($('#shipping_country').val()).trigger('change');
505 + $('#sellkit-billing_state').val($('#sellkit-shipping_state').val()).trigger('change');
506 + $('#billing_postcode').val($('#shipping_postcode').val());
507 + $('#billing_city').val($('#shipping_city').val());
508 +
509 + if ($('#billing_phone').length && $('#shipping_phone').length) {
510 + $('#billing_phone').val($('#shipping_phone').val());
511 + }
512 +
513 + window.sellkitSuppressBillingAddressAjax = false;
514 + }; // Delegated: billing markup can be replaced by WooCommerce checkout AJAX.
515 +
516 +
517 + $(document.body).off('click.sellkitBillMethod', '.sellkit-one-page-checkout-billing .method-a').on('click.sellkitBillMethod', '.sellkit-one-page-checkout-billing .method-a', function () {
518 + syncBillingFieldsFromShipping();
519 + toggleBillingFields(true);
520 + sellkitSetAddressDetails();
371 521 });
372 - methodB.on('click', function () {
522 + $(document.body).off('click.sellkitBillMethodDiff', '.sellkit-one-page-checkout-billing .method-b').on('click.sellkitBillMethodDiff', '.sellkit-one-page-checkout-billing .method-b', function () {
373 523 $('.inner_wrapper').css('height', 'auto');
374 - billingWrap.find('.woocommerce-billing-fields__field-wrapper').css('display', 'inline-table');
524 + toggleBillingFields(false);
525 + }); // After fragments refresh, re-apply hide/show — otherwise mirrored rows show again and layout breaks.
526 +
527 + $(document.body).off('updated_checkout.sellkitBillingVis').on('updated_checkout.sellkitBillingVis', function () {
528 + if (!$('.sellkit-one-page-checkout-billing').length) {
529 + return;
530 + }
531 +
532 + var useSame = $('.sellkit-one-page-checkout-billing input[name="billing-method"]:checked').val() === 'same';
533 + toggleBillingFields(useSame);
375 534 });
376 535 };
377 536
378 537 var mobileSummary = function mobileSummary() {
@@ -379,20 +538,22 @@
379 538 if ($(window).width() < 600) {
380 539 $('#order_review').addClass('sellkit-mobile-multistep-order-summary');
381 540 }
382 541
383 - var toggleBtn = $('.summary_toggle > .title, .summary_toggle > i, .summary_toggle > .icon');
542 + var toggleBtn = $('.summary_toggle > .summery_toggle_link_wrapper > .title, .summary_toggle > .summery_toggle_link_wrapper > .sellkit-checkout-summary-toggle-up, .summary_toggle > .summery_toggle_link_wrapper > .icon, .summary_toggle > .summery_toggle_link_wrapper > .sellkit-checkout-summary-toggle-down');
384 543 var wrap = $('.summary_toggle');
385 544 toggleBtn.on('click', function () {
386 545 $('#order_review').toggle();
387 546
388 - if ('Hide order summary' === toggleBtn.text()) {
547 + if ('Hide order summary' === wrap.find('.title').text()) {
389 548 wrap.find('.title').text((0, _i18n.__)('Show order summary', 'sellkit'));
390 - wrap.find('i').addClass('fa-chevron-down').removeClass('fa-chevron-up');
549 + wrap.find('.sellkit-checkout-summary-toggle-up').hide();
550 + wrap.find('.sellkit-checkout-summary-toggle-down').show();
391 551 wrap.css('border-bottom-width', '0px');
392 552 } else {
393 553 wrap.find('.title').text((0, _i18n.__)('Hide order summary', 'sellkit'));
394 - wrap.find('i').addClass('fa-chevron-up').removeClass('fa-chevron-down');
554 + wrap.find('.sellkit-checkout-summary-toggle-up').show();
555 + wrap.find('.sellkit-checkout-summary-toggle-down').hide();
395 556 wrap.css('border-bottom-width', '1px');
396 557 }
397 558
398 559 var parent = $('#sellkit-checkout-multistep-inner-wrap');
@@ -402,9 +563,9 @@
402 563
403 564 var fieldFocus = function fieldFocus() {
404 565 var $fields = $('.sellkit-checkout-local-fields').find('input, select, hidden, textarea, #sellkit-billing_state ,#sellkit-shipping_state, .validate-email');
405 566 $fields.each(function () {
406 - var _this3 = this;
567 + var _this = this;
407 568
408 569 var miniTitle = $(this).parent().parent().parent().find('.mini-title');
409 570 var $thisValue = $(this).val(); // On load.
410 571
@@ -416,34 +577,34 @@
416 577 } // On change/focusOut
417 578
418 579
419 580 $(this).on('change input focusout', function (e) {
420 - var changedValue = $(_this3).val();
581 + var changedValue = $(_this).val();
421 582
422 - if (changedValue || $(_this3).find('option').length) {
423 - $(_this3).addClass('filled');
424 - $(_this3).removeClass('empty');
425 - $(_this3).parents('.sellkit-widget-checkout-fields').find('.mini-title').css('display', 'flex');
583 + if (changedValue || $(_this).find('option').length) {
584 + $(_this).addClass('filled');
585 + $(_this).removeClass('empty');
586 + $(_this).parents('.sellkit-widget-checkout-fields').find('.mini-title').css('display', 'flex');
426 587 } else {
427 - $(_this3).addClass('empty');
428 - $(_this3).removeClass('filled');
429 - $(_this3).parents('.sellkit-widget-checkout-fields').find('.mini-title').hide();
588 + $(_this).addClass('empty');
589 + $(_this).removeClass('filled');
590 + $(_this).parents('.sellkit-widget-checkout-fields').find('.mini-title').hide();
430 591 } // On focusout validate fields.
431 592
432 593
433 594 if ('focusout' === e.type) {
434 - FieldsMiniTitles($(_this3), 'focusout');
435 - var parent = $(_this3).parent().parent().parent(); // Required validation. return if required field rule is not followed.
595 + FieldsMiniTitles($(_this), 'focusout');
596 + var parent = $(_this).parent().parent().parent(); // Required validation. return if required field rule is not followed.
436 597
437 598 if (parent.hasClass('validate-required')) {
438 - if ('INPUT' === _this3.nodeName && 'checkbox' === $(_this3).attr('type')) {
439 - if (!_this3.checked) {
599 + if ('INPUT' === _this.nodeName && 'checkbox' === $(_this).attr('type')) {
600 + if (!_this.checked) {
440 601 parent.find('.sellkit-required-validation').css('display', 'inline-flex');
441 602 return;
442 603 }
443 604 }
444 605
445 - if (_.isEmpty($(_this3).val())) {
606 + if (_.isEmpty($(_this).val())) {
446 607 parent.find('.sellkit-required-validation').css('display', 'inline-flex');
447 608 return;
448 609 }
449 610
@@ -451,9 +612,9 @@
451 612 } // Required validation of this field if exists, passed successfully. now postcode validation.
452 613
453 614
454 615 if (parent.hasClass('sellkit-checkout-fields-validation-postcode')) {
455 - var postcodeVal = $(_this3).val();
616 + var postcodeVal = $(_this).val();
456 617
457 618 if (_.isEmpty(postcodeVal)) {
458 619 return;
459 620 } // Check field type to get related country value. we can't validate without country code.
@@ -458,9 +619,9 @@
458 619 return;
459 620 } // Check field type to get related country value. we can't validate without country code.
460 621
461 622
462 - var postcodeName = $(_this3).attr('name');
623 + var postcodeName = $(_this).attr('name');
463 624 var postcodeCountry = $('#billing_country');
464 625
465 626 if (postcodeName.includes('shipping')) {
466 627 postcodeCountry = $('#shipping_country');
@@ -481,30 +642,30 @@
481 642 parent.find('.sellkit-checkout-field-global-errors').hide().text('');
482 643 }
483 644
484 645 parent.find('.sellkit-checkout-field-global-errors').hide().text('');
485 - postcodeValidation(postcodeVal, countryCode, $(_this3));
646 + postcodeValidation(postcodeVal, countryCode, $(_this));
486 647 } // Phone validation using woocommerce way.
487 648
488 649
489 650 if (parent.hasClass('sellkit-checkout-fields-validation-phone')) {
490 - var phone = $(_this3).val();
651 + var phone = $(_this).val();
491 652
492 653 if (_.isEmpty(phone)) {
493 654 return;
494 655 }
495 656
496 - phoneNumberValidation(phone, $(_this3));
657 + phoneNumberValidation(phone, $(_this));
497 658 }
498 659 }
499 660
500 - if ('change' === e.type && ('billing_country' === $(_this3).attr('id') || 'shipping_country' === $(_this3).attr('id'))) {
501 - var _countryCode = $(_this3).val();
661 + if ('change' === e.type && ('billing_country' === $(_this).attr('id') || 'shipping_country' === $(_this).attr('id'))) {
662 + var _countryCode = $(_this).val();
502 663
503 664 var states = wcCountries[_countryCode];
504 665 var state = 'sellkit-shipping_state';
505 666
506 - if ('billing_country' === $(_this3).attr('id')) {
667 + if ('billing_country' === $(_this).attr('id')) {
507 668 state = 'sellkit-billing_state';
508 669 }
509 670
510 671 var stateField = document.getElementById(state);
@@ -512,8 +673,12 @@
512 673 if (_.isNull(stateField)) {
513 674 return;
514 675 }
515 676
677 + if (!_.isObject(states)) {
678 + return;
679 + }
680 +
516 681 $(stateField).empty();
517 682
518 683 for (var keys in states) {
519 684 var option = document.createElement('option');
@@ -811,8 +976,30 @@
811 976 });
812 977 });
813 978 };
814 979 /**
980 + * Send shipping method id to backend
981 + *
982 + * The click event used because change event, send shipping method id on page load to backend and make an issue.
983 + *
984 + * @since 2.6.0
985 + */
986 +
987 +
988 +var sellkitDetectShippingMethodChange = function sellkitDetectShippingMethodChange() {
989 + $('input.shipping_method').off('click').on('click', function () {
990 + var selectedMethod = $(this).val();
991 + wp.ajax.post({
992 + action: 'shipping_method_selected',
993 + nonce: sellkit_elementor.nonce,
994 + shipping_method: selectedMethod
995 + }).fail(function (data) {
996 + // eslint-disable-next-line
997 + console.error(data);
998 + });
999 + });
1000 +};
1001 +/**
815 1002 * Toggle coupon form on click event.
816 1003 *
817 1004 * @since 1.2.5
818 1005 */
@@ -1061,8 +1248,12 @@
1061 1248 */
1062 1249
1063 1250
1064 1251 var sellkitSetAddressDetails = function sellkitSetAddressDetails() {
1252 + if (window.sellkitSuppressBillingAddressAjax) {
1253 + return;
1254 + }
1255 +
1065 1256 wp.ajax.post({
1066 1257 action: 'sellkit_checkout_ajax_handler',
1067 1258 sub_action: 'set_customer_details_ajax',
1068 1259 country: document.querySelector('#billing_country') ? document.getElementById('billing_country').value : '',
@@ -1388,8 +1579,9 @@
1388 1579 }).done(function (data) {
1389 1580 $(document.body).trigger('update_checkout');
1390 1581 parent.find('.sellkit-upsell-updating').removeClass('active');
1391 1582 parent.find('.sellkit-upsell-accepted').addClass('active');
1583 + updateSellkitPriceField(data.upsell_prices);
1392 1584 onSuccess(data);
1393 1585 }).fail(function (data) {
1394 1586 // eslint-disable-next-line no-console
1395 1587 console.error(data);
@@ -1433,9 +1625,101 @@
1433 1625 $('button[type=submit]').find('img').remove();
1434 1626 });
1435 1627 };
1436 1628
1437 -},{"@wordpress/i18n":15}],2:[function(require,module,exports){
1629 +var updateSellkitPriceField = function updateSellkitPriceField(data) {
1630 + if (data === 'null' || data === null) {
1631 + return;
1632 + }
1633 +
1634 + var current_val = $('input#sellkit_product_prices').val();
1635 +
1636 + if (!current_val || current_val === '0') {
1637 + $('input#sellkit_product_prices').val(data);
1638 + } else {
1639 + var oldVal = JSON.parse(current_val);
1640 + var newVal = JSON.parse(data);
1641 + var val = JSON.stringify(Object.assign({}, oldVal, newVal));
1642 + $('input#sellkit_product_prices').val(val);
1643 + }
1644 +};
1645 +/**
1646 + * Toggle order notes.
1647 + *
1648 + * @since 1.8.9
1649 + */
1650 +
1651 +
1652 +var orderNotesToggle = function orderNotesToggle() {
1653 + $('#sellkit-add-notes-to-order-box').on('change', function () {
1654 + $(this).parent().next().toggle();
1655 + });
1656 +}; // --- Sellkit: Sync custom state fields to standard WooCommerce fields for gateway compatibility ---
1657 +
1658 +
1659 +var ensureStandardWooFields = function ensureStandardWooFields() {
1660 + try {
1661 + var form = document.querySelector('form.checkout');
1662 +
1663 + if (!form) {
1664 + return;
1665 + } // Billing state
1666 +
1667 +
1668 + var sellkitBillingState = document.getElementById('sellkit-billing_state');
1669 +
1670 + if (sellkitBillingState) {
1671 + var billingState = document.getElementById('billing_state');
1672 +
1673 + if (!billingState) {
1674 + billingState = document.createElement('input');
1675 + billingState.type = 'hidden';
1676 + billingState.id = 'billing_state';
1677 + billingState.name = 'billing_state';
1678 + form.appendChild(billingState);
1679 + }
1680 +
1681 + billingState.value = sellkitBillingState.value;
1682 + } // Shipping state
1683 +
1684 +
1685 + var sellkitShippingState = document.getElementById('sellkit-shipping_state');
1686 +
1687 + if (sellkitShippingState) {
1688 + var shippingState = document.getElementById('shipping_state');
1689 +
1690 + if (!shippingState) {
1691 + shippingState = document.createElement('input');
1692 + shippingState.type = 'hidden';
1693 + shippingState.id = 'shipping_state';
1694 + shippingState.name = 'shipping_state';
1695 + form.appendChild(shippingState);
1696 + }
1697 +
1698 + shippingState.value = sellkitShippingState.value;
1699 + }
1700 + } catch (e) {
1701 + // eslint-disable-next-line no-console
1702 + console.error('[Sellkit] Error syncing state fields for gateway compatibility:', e);
1703 + }
1704 +}; // Attach to form submit and on state field change
1705 +
1706 +
1707 +jQuery(document).ready(function (_$) {
1708 + var form = _$('form.checkout');
1709 +
1710 + if (form.length) {
1711 + form.on('submit', function () {
1712 + ensureStandardWooFields();
1713 + }); // Also update on state field change
1714 +
1715 + _$('#sellkit-billing_state, #sellkit-shipping_state').on('change input', function () {
1716 + ensureStandardWooFields();
1717 + });
1718 + }
1719 +});
1720 +
1721 +},{"./checkout-settings":1,"@babel/runtime/helpers/interopRequireDefault":9,"@wordpress/i18n":16}],3:[function(require,module,exports){
1438 1722 "use strict";
1439 1723
1440 1724 (function ($) {
1441 1725 var SellkitFrontend = function SellkitFrontend() {
@@ -1460,9 +1744,9 @@
1460 1744
1461 1745 window.sellkitFrontend = new SellkitFrontend();
1462 1746 })(jQuery);
1463 1747
1464 -},{"./checkout":1,"./optin/optin":3,"./product-images":6}],3:[function(require,module,exports){
1748 +},{"./checkout":2,"./optin/optin":4,"./product-images":7}],4:[function(require,module,exports){
1465 1749 "use strict";
1466 1750
1467 1751 var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
1468 1752
@@ -1639,12 +1923,61 @@
1639 1923 return;
1640 1924 }
1641 1925
1642 1926 _.each(addressFields, function (input) {
1643 - new google.maps.places.Autocomplete(input, {
1927 + var autocomplete = new google.maps.places.Autocomplete(input, {
1644 1928 types: ['geocode'],
1645 1929 fields: ['address_components']
1646 1930 });
1931 + autocomplete.addListener('place_changed', function () {
1932 + var place = autocomplete.getPlace(); // Extract address components
1933 +
1934 + var address = {
1935 + street_number: '',
1936 + route: '',
1937 + locality: '',
1938 + administrative_area_level_1: '',
1939 + country: '',
1940 + postal_code: ''
1941 + }; // Map Google Maps address components to your address object
1942 +
1943 + place.address_components.forEach(function (component) {
1944 + var componentType = component.types[0];
1945 +
1946 + switch (componentType) {
1947 + case 'street_number':
1948 + address.street_number = component.long_name;
1949 + break;
1950 +
1951 + case 'route':
1952 + address.route = component.long_name;
1953 + break;
1954 +
1955 + case 'locality':
1956 + address.locality = component.long_name;
1957 + break;
1958 +
1959 + case 'administrative_area_level_1':
1960 + address.administrative_area_level_1 = component.long_name;
1961 + break;
1962 +
1963 + case 'country':
1964 + address.country = component.long_name;
1965 + break;
1966 +
1967 + case 'postal_code':
1968 + address.postal_code = component.long_name;
1969 + break;
1970 + }
1971 + }); // Combine street number and route for the full street address
1972 +
1973 + var addressString = JSON.stringify(address);
1974 + var addressHidenField = input.nextElementSibling;
1975 +
1976 + if (addressHidenField && addressHidenField.type === 'hidden') {
1977 + addressHidenField.value = addressString;
1978 + }
1979 + });
1647 1980 });
1648 1981 }
1649 1982 });
1650 1983
@@ -1653,9 +1986,9 @@
1653 1986 $element: $scope
1654 1987 });
1655 1988 }
1656 1989
1657 -},{"./submodules/field-validation":4,"./submodules/intelligent-tel":5,"@babel/runtime/helpers/interopRequireDefault":8,"@wordpress/i18n":15}],4:[function(require,module,exports){
1990 +},{"./submodules/field-validation":5,"./submodules/intelligent-tel":6,"@babel/runtime/helpers/interopRequireDefault":9,"@wordpress/i18n":16}],5:[function(require,module,exports){
1658 1991 "use strict";
1659 1992
1660 1993 Object.defineProperty(exports, "__esModule", {
1661 1994 value: true
@@ -1812,9 +2145,9 @@
1812 2145 }
1813 2146 };
1814 2147 exports["default"] = _default;
1815 2148
1816 -},{}],5:[function(require,module,exports){
2149 +},{}],6:[function(require,module,exports){
1817 2150 "use strict";
1818 2151
1819 2152 Object.defineProperty(exports, "__esModule", {
1820 2153 value: true
@@ -1894,9 +2227,9 @@
1894 2227 }
1895 2228 };
1896 2229 exports["default"] = _default;
1897 2230
1898 -},{"intl-tel-input":19}],6:[function(require,module,exports){
2231 +},{"intl-tel-input":20}],7:[function(require,module,exports){
1899 2232 "use strict";
1900 2233
1901 2234 Object.defineProperty(exports, "__esModule", {
1902 2235 value: true
@@ -1946,9 +2279,9 @@
1946 2279 $element: $scope
1947 2280 });
1948 2281 }
1949 2282
1950 -},{}],7:[function(require,module,exports){
2283 +},{}],8:[function(require,module,exports){
1951 2284 function _defineProperty(obj, key, value) {
1952 2285 if (key in obj) {
1953 2286 Object.defineProperty(obj, key, {
1954 2287 value: value,
@@ -1963,9 +2296,9 @@
1963 2296 return obj;
1964 2297 }
1965 2298
1966 2299 module.exports = _defineProperty;
1967 -},{}],8:[function(require,module,exports){
2300 +},{}],9:[function(require,module,exports){
1968 2301 function _interopRequireDefault(obj) {
1969 2302 return obj && obj.__esModule ? obj : {
1970 2303 "default": obj
1971 2304 };
@@ -1971,9 +2304,9 @@
1971 2304 };
1972 2305 }
1973 2306
1974 2307 module.exports = _interopRequireDefault;
1975 -},{}],9:[function(require,module,exports){
2308 +},{}],10:[function(require,module,exports){
1976 2309 'use strict';
1977 2310
1978 2311 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
1979 2312
@@ -2008,9 +2341,9 @@
2008 2341 }
2009 2342
2010 2343 module.exports = compile;
2011 2344
2012 -},{"@tannin/evaluate":10,"@tannin/postfix":12}],10:[function(require,module,exports){
2345 +},{"@tannin/evaluate":11,"@tannin/postfix":13}],11:[function(require,module,exports){
2013 2346 'use strict';
2014 2347
2015 2348 /**
2016 2349 * Operator callback functions.
@@ -2124,9 +2457,9 @@
2124 2457 }
2125 2458
2126 2459 module.exports = evaluate;
2127 2460
2128 -},{}],11:[function(require,module,exports){
2461 +},{}],12:[function(require,module,exports){
2129 2462 'use strict';
2130 2463
2131 2464 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2132 2465
@@ -2150,9 +2483,9 @@
2150 2483 }
2151 2484
2152 2485 module.exports = pluralForms;
2153 2486
2154 -},{"@tannin/compile":9}],12:[function(require,module,exports){
2487 +},{"@tannin/compile":10}],13:[function(require,module,exports){
2155 2488 'use strict';
2156 2489
2157 2490 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
2158 2491
@@ -2280,9 +2613,9 @@
2280 2613 }
2281 2614
2282 2615 module.exports = postfix;
2283 2616
2284 -},{}],13:[function(require,module,exports){
2617 +},{}],14:[function(require,module,exports){
2285 2618 "use strict";
2286 2619
2287 2620 var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2288 2621
@@ -2495,9 +2828,9 @@
2495 2828 };
2496 2829
2497 2830 exports.createI18n = createI18n;
2498 2831
2499 -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":8,"tannin":22}],14:[function(require,module,exports){
2832 +},{"@babel/runtime/helpers/defineProperty":8,"@babel/runtime/helpers/interopRequireDefault":9,"tannin":23}],15:[function(require,module,exports){
2500 2833 "use strict";
2501 2834
2502 2835 Object.defineProperty(exports, "__esModule", {
2503 2836 value: true
@@ -2614,9 +2947,9 @@
2614 2947 exports._nx = _nx;
2615 2948 var isRTL = i18n.isRTL.bind(i18n);
2616 2949 exports.isRTL = isRTL;
2617 2950
2618 -},{"./create-i18n":13}],15:[function(require,module,exports){
2951 +},{"./create-i18n":14}],16:[function(require,module,exports){
2619 2952 "use strict";
2620 2953
2621 2954 Object.defineProperty(exports, "__esModule", {
2622 2955 value: true
@@ -2689,9 +3022,9 @@
2689 3022 });
2690 3023
2691 3024 var _defaultI18n = require("./default-i18n");
2692 3025
2693 -},{"./create-i18n":13,"./default-i18n":14,"./sprintf":16}],16:[function(require,module,exports){
3026 +},{"./create-i18n":14,"./default-i18n":15,"./sprintf":17}],17:[function(require,module,exports){
2694 3027 "use strict";
2695 3028
2696 3029 var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2697 3030
@@ -2741,9 +3074,9 @@
2741 3074 return format;
2742 3075 }
2743 3076 }
2744 3077
2745 -},{"@babel/runtime/helpers/interopRequireDefault":8,"memize":20,"sprintf-js":17}],17:[function(require,module,exports){
3078 +},{"@babel/runtime/helpers/interopRequireDefault":9,"memize":21,"sprintf-js":18}],18:[function(require,module,exports){
2746 3079 /* global window, exports, define */
2747 3080
2748 3081 !function() {
2749 3082 'use strict'
@@ -2974,9 +3307,9 @@
2974 3307 }
2975 3308 /* eslint-enable quote-props */
2976 3309 }(); // eslint-disable-line
2977 3310
2978 -},{}],18:[function(require,module,exports){
3311 +},{}],19:[function(require,module,exports){
2979 3312 /*
2980 3313 * International Telephone Input v17.0.16
2981 3314 * https://github.com/jackocnr/intl-tel-input.git
2982 3315 * Licensed under the MIT license
@@ -4328,15 +4661,15 @@
4328 4661 return iti;
4329 4662 };
4330 4663 }();
4331 4664 });
4332 -},{}],19:[function(require,module,exports){
4665 +},{}],20:[function(require,module,exports){
4333 4666 /**
4334 4667 * Exposing intl-tel-input as a component
4335 4668 */
4336 4669 module.exports = require("./build/js/intlTelInput");
4337 4670
4338 -},{"./build/js/intlTelInput":18}],20:[function(require,module,exports){
4671 +},{"./build/js/intlTelInput":19}],21:[function(require,module,exports){
4339 4672 (function (process){
4340 4673 /**
4341 4674 * Memize options object.
4342 4675 *
@@ -4505,9 +4838,9 @@
4505 4838
4506 4839 module.exports = memize;
4507 4840
4508 4841 }).call(this,require('_process'))
4509 -},{"_process":21}],21:[function(require,module,exports){
4842 +},{"_process":22}],22:[function(require,module,exports){
4510 4843 // shim for using process in browser
4511 4844 var process = module.exports = {};
4512 4845
4513 4846 // cached from whatever global is present so that test runners that stub it
@@ -4691,9 +5024,9 @@
4691 5024 throw new Error('process.chdir is not supported');
4692 5025 };
4693 5026 process.umask = function() { return 0; };
4694 5027
4695 -},{}],22:[function(require,module,exports){
5028 +},{}],23:[function(require,module,exports){
4696 5029 'use strict';
4697 5030
4698 5031 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4699 5032
@@ -4912,5 +5245,5 @@
4912 5245 };
4913 5246
4914 5247 module.exports = Tannin;
4915 5248
4916 -},{"@tannin/plural-forms":11}]},{},[2]);
5249 +},{"@tannin/plural-forms":12}]},{},[3]);