Files
wyczarujprezent.pl/modules/inpostizi/views/js/admin/consents.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
13 KiB
JavaScript

(()=>{(()=>{"use strict";var V={104:p=>{var f=typeof Reflect=="object"?Reflect:null,y=f&&typeof f.apply=="function"?f.apply:function(e,n,i){return Function.prototype.apply.call(e,n,i)},b;f&&typeof f.ownKeys=="function"?b=f.ownKeys:Object.getOwnPropertySymbols?b=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:b=function(e){return Object.getOwnPropertyNames(e)};function u(s){console&&console.warn&&console.warn(s)}var _=Number.isNaN||function(e){return e!==e};function c(){c.init.call(this)}p.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var I=10;function d(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(s){if(typeof s!="number"||s<0||_(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");I=s}}),c.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},c.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||_(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 g(s){return s._maxListeners===void 0?c.defaultMaxListeners:s._maxListeners}c.prototype.getMaxListeners=function(){return g(this)},c.prototype.emit=function(e){for(var n=[],i=1;i<arguments.length;i++)n.push(arguments[i]);var a=e==="error",h=this._events;if(h!==void 0)a=a&&h.error===void 0;else if(!a)return!1;if(a){var l;if(n.length>0&&(l=n[0]),l instanceof Error)throw l;var v=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw v.context=l,v}var C=h[e];if(C===void 0)return!1;if(typeof C=="function")y(C,this,n);else for(var x=C.length,k=W(C,x),i=0;i<x;++i)y(k[i],this,n);return!0};function w(s,e,n,i){var a,h,l;if(d(n),h=s._events,h===void 0?(h=s._events=Object.create(null),s._eventsCount=0):(h.newListener!==void 0&&(s.emit("newListener",e,n.listener?n.listener:n),h=s._events),l=h[e]),l===void 0)l=h[e]=n,++s._eventsCount;else if(typeof l=="function"?l=h[e]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),a=g(s),a>0&&l.length>a&&!l.warned){l.warned=!0;var v=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");v.name="MaxListenersExceededWarning",v.emitter=s,v.type=e,v.count=l.length,u(v)}return s}c.prototype.addListener=function(e,n){return w(this,e,n,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,n){return w(this,e,n,!0)};function O(){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 L(s,e,n){var i={fired:!1,wrapFn:void 0,target:s,type:e,listener:n},a=O.bind(i);return a.listener=n,i.wrapFn=a,a}c.prototype.once=function(e,n){return d(n),this.on(e,L(this,e,n)),this},c.prototype.prependOnceListener=function(e,n){return d(n),this.prependListener(e,L(this,e,n)),this},c.prototype.removeListener=function(e,n){var i,a,h,l,v;if(d(n),a=this._events,a===void 0)return this;if(i=a[e],i===void 0)return this;if(i===n||i.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete a[e],a.removeListener&&this.emit("removeListener",e,i.listener||n));else if(typeof i!="function"){for(h=-1,l=i.length-1;l>=0;l--)if(i[l]===n||i[l].listener===n){v=i[l].listener,h=l;break}if(h<0)return this;h===0?i.shift():B(i,h),i.length===1&&(a[e]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",e,v||n)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(e){var n,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var h=Object.keys(i),l;for(a=0;a<h.length;++a)l=h[a],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=i[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(a=n.length-1;a>=0;a--)this.removeListener(e,n[a]);return this};function M(s,e,n){var i=s._events;if(i===void 0)return[];var a=i[e];return a===void 0?[]:typeof a=="function"?n?[a.listener||a]:[a]:n?N(a):W(a,a.length)}c.prototype.listeners=function(e){return M(this,e,!0)},c.prototype.rawListeners=function(e){return M(this,e,!1)},c.listenerCount=function(s,e){return typeof s.listenerCount=="function"?s.listenerCount(e):E.call(s,e)},c.prototype.listenerCount=E;function E(s){var e=this._events;if(e!==void 0){var n=e[s];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}c.prototype.eventNames=function(){return this._eventsCount>0?b(this._events):[]};function W(s,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=s[i];return n}function B(s,e){for(;e+1<s.length;e++)s[e]=s[e+1];s.pop()}function N(s){for(var e=new Array(s.length),n=0;n<e.length;++n)e[n]=s[n].listener||s[n];return e}}},H={};function S(p){var f=H[p];if(f!==void 0)return f.exports;var y=H[p]={exports:{}};return V[p](y,y.exports,S),y.exports}S.n=p=>{var f=p&&p.__esModule?()=>p.default:()=>p;return S.d(f,{a:f}),f},S.d=(p,f)=>{for(var y in f)S.o(f,y)&&!S.o(p,y)&&Object.defineProperty(p,y,{enumerable:!0,get:f[y]})},S.o=(p,f)=>Object.prototype.hasOwnProperty.call(p,f);var re={};(()=>{var p=Object.defineProperty,f=(r,t,o)=>t in r?p(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,y=(r,t,o)=>(f(r,typeof t!="symbol"?t+"":t,o),o),b=(r,t,o)=>{if(!t.has(r))throw TypeError("Cannot "+o)},u=(r,t,o)=>(b(r,t,"read from private field"),o?o.call(r):t.get(r)),_=(r,t,o)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,o)},c=(r,t,o,m)=>(b(r,t,"write to private field"),m?m.call(r,o):t.set(r,o),o),I=(r,t,o,m)=>({set _(j){c(r,t,j,o)},get _(){return u(r,t,m)}}),d=(r,t,o)=>(b(r,t,"access private method"),o),g,w,O,L,M,E,W,B,N,s,e,n,i,a,h,l,v,C,x,k;const z="js-collection-entry",A=class{constructor(t){_(this,W),_(this,N),_(this,e),_(this,i),_(this,h),_(this,v),_(this,x),_(this,g,{entries:".js-collection-entries-container",entry:`.${z}`,addEntry:".js-add-collection-entry",removeEntry:".js-remove-collection-entry",maxCountMessage:".js-max-collection-count-message"}),_(this,w,void 0),_(this,O,void 0),_(this,L,void 0),_(this,M,void 0),_(this,E,null),this.wrapper=t,c(this,O,d(this,x,k).call(this,u(this,g).entries)),c(this,L,d(this,v,C).call(this,u(this,g).entry,u(this,O)).length),c(this,w,"maxCount"in this.wrapper.dataset?Number(this.wrapper.dataset.maxCount):null),c(this,M,u(this,L)),c(this,E,d(this,x,k).call(this,u(this,g).addEntry)),d(this,W,B).call(this)}hasMaxEntries(){return u(this,w)!==null&&u(this,L)>=u(this,w)}};g=new WeakMap,w=new WeakMap,O=new WeakMap,L=new WeakMap,M=new WeakMap,E=new WeakMap,W=new WeakSet,B=function(){u(this,E)!==null&&u(this,E).addEventListener("click",()=>d(this,N,s).call(this)),d(this,v,C).call(this,u(this,g).removeEntry).forEach(r=>d(this,e,n).call(this,r)),d(this,h,l).call(this)},N=new WeakSet,s=function(){if(u(this,w)!==null&&u(this,L)>=u(this,w))throw new Error("Cannot add a new collection entry.");const r=document.createElement("div");r.classList.add(z),r.innerHTML=this.wrapper.dataset.prototype.replace(/__name__/g,I(this,M)._++),u(this,O).append(r),++I(this,L)._;const t=r.querySelector(u(this,g).removeEntry);t!==null&&d(this,e,n).call(this,t),d(this,h,l).call(this),this.wrapper.dispatchEvent(new CustomEvent(A.events.entryAdded,{detail:r,bubbles:!0}))},e=new WeakSet,n=function(r){r.addEventListener("click",t=>{d(this,i,a).call(this,t.target)})},i=new WeakSet,a=function(r){const t=r.closest(u(this,g).entry);t.remove(),--I(this,L)._,d(this,h,l).call(this),this.wrapper.dispatchEvent(new CustomEvent(A.events.entryRemoved,{detail:t}))},h=new WeakSet,l=function(){if(u(this,E)===null||u(this,w)===null)return;const r=d(this,x,k).call(this,u(this,g).maxCountMessage);u(this,E).disabled=u(this,L)>=u(this,w),r!==null&&r.classList.toggle("d-none",!u(this,E).disabled)},v=new WeakSet,C=function(r,t=this.wrapper){const o=t.querySelectorAll(r);return Array.from(o).filter(m=>m.closest(A.selector)===this.wrapper)},x=new WeakSet,k=function(r,t=this.wrapper){var o;return(o=d(this,v,C).call(this,r,t).at(0))!=null?o:null},y(A,"selector",".js-collection-form"),y(A,"events",{entryAdded:"collectionEntryAdded",entryRemoved:"collectionEntryRemoved"});let R=A;var D=(r,t,o)=>{if(!t.has(r))throw TypeError("Cannot "+o)},T=(r,t,o)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,o)},X=(r,t,o,m)=>(D(r,t,"write to private field"),m?m.call(r,o):t.set(r,o),o),q=(r,t,o)=>(D(r,t,"access private method"),o),K,U,J,F,G;class Y{constructor(t){T(this,U),T(this,F),T(this,K,void 0),this.wrapper=t,X(this,K,new R(this.wrapper)),q(this,U,J).call(this)}}K=new WeakMap,U=new WeakSet,J=function(){this.wrapper.querySelectorAll(R.selector).forEach(q(this,F,G)),this.wrapper.addEventListener(R.events.entryAdded,r=>{const t=r.detail.querySelector(R.selector);q(this,F,G).call(this,t)})},F=new WeakSet,G=function(r){new R(r)};var Z=S(104),ee=S.n(Z);/**
* 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 Q=new(ee()),se=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{$:P}=window;class te{constructor(t){const o=t||{};return this.localeItemSelector=o.localeItemSelector||".js-locale-item",this.localeButtonSelector=o.localeButtonSelector||".js-locale-btn",this.localeInputSelector=o.localeInputSelector||".js-locale-input",this.selectedLocale=P(this.localeItemSelector).data("locale"),P("body").on("click",this.localeItemSelector,this.toggleLanguage.bind(this)),Q.on("languageSelected",this.toggleInputs.bind(this)),{localeItemSelector:this.localeItemSelector,localeButtonSelector:this.localeButtonSelector,localeInputSelector:this.localeInputSelector,refreshFormInputs:m=>{this.refreshInputs(m)},getSelectedLocale:()=>this.selectedLocale}}refreshInputs(t){this.selectedLocale&&Q.emit("languageSelected",{selectedLocale:this.selectedLocale,form:t})}toggleLanguage(t){const o=P(t.target),m=o.closest("form");this.selectedLocale=o.data("locale"),this.refreshInputs(m)}toggleInputs(t){const{form:o}=t;this.selectedLocale=t.selectedLocale;const m=o.find(this.localeButtonSelector),j=m.data("change-language-url");m.text(this.selectedLocale),o.find(this.localeInputSelector).addClass("d-none"),o.find(`${this.localeInputSelector}.js-locale-${this.selectedLocale}`).removeClass("d-none"),j&&this.saveSelectedLanguage(j,this.selectedLocale)}saveSelectedLanguage(t,o){P.post({url:t,data:{language_iso_code:o}})}}const ne=te;$(document).ready(()=>{const r=document.getElementById("consents_configuration_consents");new Y(r),r.addEventListener(R.events.entryAdded,t=>{$(t.detail).find('[data-toggle="popover"]').popover()}),new ne})})()})();})();
//# sourceMappingURL=consents.js.map