Files
wyczarujprezent.pl/modules/inpostizi/views/js/admin/admin.js
Jacek Pyziak 4066f6fa31 Add InPost Pay integration to admin templates
- Created a new template for the cart rule form with custom label, switch, and choice widgets.
- Implemented the InPost Pay block in the order details template for displaying delivery method, APM, and VAT invoice request.
- Added legacy support for the order details template to maintain compatibility with older PrestaShop versions.
2025-09-14 14:38:09 +02:00

49 lines
9.6 KiB
JavaScript

(()=>{(()=>{"use strict";var E={104:u=>{var l=typeof Reflect=="object"?Reflect:null,h=l&&typeof l.apply=="function"?l.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},L;l&&typeof l.ownKeys=="function"?L=l.ownKeys:Object.getOwnPropertySymbols?L=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:L=function(e){return Object.getOwnPropertyNames(e)};function m(n){console&&console.warn&&console.warn(n)}var y=Number.isNaN||function(e){return e!==e};function i(){i.init.call(this)}u.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var _=10;function f(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return _},set:function(n){if(typeof n!="number"||n<0||y(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");_=n}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||y(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function c(n){return n._maxListeners===void 0?i.defaultMaxListeners:n._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s=e==="error",a=this._events;if(a!==void 0)s=s&&a.error===void 0;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var p=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw p.context=o,p}var b=a[e];if(b===void 0)return!1;if(typeof b=="function")h(b,this,t);else for(var j=b.length,M=I(b,j),r=0;r<j;++r)h(M[r],this,t);return!0};function d(n,e,t,r){var s,a,o;if(f(t),a=n._events,a===void 0?(a=n._events=Object.create(null),n._eventsCount=0):(a.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),a=n._events),o=a[e]),o===void 0)o=a[e]=t,++n._eventsCount;else if(typeof o=="function"?o=a[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),s=c(n),s>0&&o.length>s&&!o.warned){o.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=n,p.type=e,p.count=o.length,m(p)}return n}i.prototype.addListener=function(e,t){return d(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function g(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function w(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=g.bind(r);return s.listener=t,r.wrapFn=s,s}i.prototype.once=function(e,t){return f(t),this.on(e,w(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return f(t),this.prependListener(e,w(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,s,a,o,p;if(f(t),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(a=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){p=r[o].listener,a=o;break}if(a<0)return this;a===0?r.shift():C(r,a),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,p||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var a=Object.keys(r),o;for(s=0;s<a.length;++s)o=a[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this};function O(n,e,t){var r=n._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?k(s):I(s,s.length)}i.prototype.listeners=function(e){return O(this,e,!0)},i.prototype.rawListeners=function(e){return O(this,e,!1)},i.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):S.call(n,e)},i.prototype.listenerCount=S;function S(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?L(this._events):[]};function I(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function C(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function k(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}}},x={};function v(u){var l=x[u];if(l!==void 0)return l.exports;var h=x[u]={exports:{}};return E[u](h,h.exports,v),h.exports}v.n=u=>{var l=u&&u.__esModule?()=>u.default:()=>u;return v.d(l,{a:l}),l},v.d=(u,l)=>{for(var h in l)v.o(l,h)&&!v.o(u,h)&&Object.defineProperty(u,h,{enumerable:!0,get:l[h]})},v.o=(u,l)=>Object.prototype.hasOwnProperty.call(u,l);var N={};(()=>{var u=v(104),l=v.n(u);/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/const h=new(l()),L=null;/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/const{$:m}=window;class y{constructor(f){const c=f||{};return this.localeItemSelector=c.localeItemSelector||".js-locale-item",this.localeButtonSelector=c.localeButtonSelector||".js-locale-btn",this.localeInputSelector=c.localeInputSelector||".js-locale-input",this.selectedLocale=m(this.localeItemSelector).data("locale"),m("body").on("click",this.localeItemSelector,this.toggleLanguage.bind(this)),h.on("languageSelected",this.toggleInputs.bind(this)),{localeItemSelector:this.localeItemSelector,localeButtonSelector:this.localeButtonSelector,localeInputSelector:this.localeInputSelector,refreshFormInputs:d=>{this.refreshInputs(d)},getSelectedLocale:()=>this.selectedLocale}}refreshInputs(f){this.selectedLocale&&h.emit("languageSelected",{selectedLocale:this.selectedLocale,form:f})}toggleLanguage(f){const c=m(f.target),d=c.closest("form");this.selectedLocale=c.data("locale"),this.refreshInputs(d)}toggleInputs(f){const{form:c}=f;this.selectedLocale=f.selectedLocale;const d=c.find(this.localeButtonSelector),g=d.data("change-language-url");d.text(this.selectedLocale),c.find(this.localeInputSelector).addClass("d-none"),c.find(`${this.localeInputSelector}.js-locale-${this.selectedLocale}`).removeClass("d-none"),g&&this.saveSelectedLanguage(g,this.selectedLocale)}saveSelectedLanguage(f,c){m.post({url:f,data:{language_iso_code:c}})}}const i=y;$(document).ready(()=>{new i;const _=c=>{const d=$(c.currentTarget),g=d.data("target");$(`input[name="${g}"]`).prop("checked",d.prop("checked"))},f=c=>{if(!c.clickEvent)return!0;if($(c.clickEvent.target).closest(".dropdown-menu").length)return!1};$(".js-inpostizi-accept-all-options-checkbox").on("change",_),$('[data-prevent-close-on-inside-click="true"]').on("hide.bs.dropdown",f)})})()})();})();
//# sourceMappingURL=admin.js.map