From 4c3ba2a17e6df0b512f969a37cf539e8021d42bb Mon Sep 17 00:00:00 2001 From: tinect Date: Tue, 26 Apr 2022 14:37:24 +0200 Subject: [PATCH] fix: support shopware 6.4.10 --- composer.json | 2 +- src/Resources/public/administration/js/impersonation.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1e6c21b..cce6be1 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "shopware/core": "^6.3.0" + "shopware/core": "^6.4.5" }, "extra": { "shopware-plugin-class": "VienThuong\\Impersonation\\Impersonation", diff --git a/src/Resources/public/administration/js/impersonation.js b/src/Resources/public/administration/js/impersonation.js index 1f99df0..adbaba9 100644 --- a/src/Resources/public/administration/js/impersonation.js +++ b/src/Resources/public/administration/js/impersonation.js @@ -1 +1 @@ -(this.webpackJsonp=this.webpackJsonp||[]).push([["impersonation"],{"/3U3":function(e,t,i){"use strict";i.d(t,"a",(function(){return l})),i.d(t,"b",(function(){return f}));var n=i("lwsE"),r=i.n(n),o=i("W8MJ"),s=i.n(o),a=Shopware,c=a.Application,u=a.WorkerNotification,l=3e4,f=5e3,p=function(){function e(t){r()(this,e),this._context=t,this._isRunning=!1,this._isRequestRunning=!1,this._interval=l,this._isIntervalWatcherSetup=!1,this._timeoutId=null,this._applicationRoot=null,this._middlewareHelper=null}return s()(e,[{key:"start",value:function(){this._isRunning=!0,this._middlewareHelper=u.initialize(),this._timeoutId=setTimeout(this._checkQueue.bind(this),this._interval),this.setupIntervalWatcher()}},{key:"terminate",value:function(){this._isRunning=!1,null!==this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)}},{key:"setupIntervalWatcher",value:function(){this._isIntervalWatcherSetup||(Shopware.State.watch((function(e){return e.notification.workerProcessPollInterval}),this._onPollIntervalChanged.bind(this)),this._isIntervalWatcherSetup=!0)}},{key:"getMessageQueueStatsRepository",value:function(){return Shopware.Service().get("repositoryFactory").create("message_queue_stats")}},{key:"_checkQueue",value:function(){var e=this;this._isRequestRunning=!0,this.getMessageQueueStatsRepository().search(new Shopware.Data.Criteria(1,25),this._context).then((function(t){e._isRequestRunning=!1,e._timeoutId=null,e.runNotificationMiddleware(t),e._isRunning&&(e._interval=e._getApplicationRootReference().$store.state.notification.workerProcessPollInterval,e._timeoutId=setTimeout(e._checkQueue.bind(e),e._interval))}))}},{key:"_onPollIntervalChanged",value:function(e){this._interval=e,this._isRequestRunning||(null!==this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null),e!==f?this._timeoutId=setTimeout(this._checkQueue.bind(this),this._interval):this._checkQueue())}},{key:"runNotificationMiddleware",value:function(e){var t=this._getApplicationRootReference(),i={$root:t,notification:{create:function(e){return t.$store.dispatch("notification/createNotification",e)},update:function(e){return t.$store.dispatch("notification/updateNotification",e)}},queue:e};this._middlewareHelper.go(i)}},{key:"_getApplicationRootReference",value:function(){return this._applicationRoot||(this._applicationRoot=c.getApplicationRoot()),this._applicationRoot}}]),e}();t.c=p},JXUN:function(e,t){e.exports='{% block sw_page_top_bar_actions %}\n
\n {% block sw_page_leave_impersonation_button %}\n {{ $tc(\'impersonation.actions.leaveImpersonation\') }}\n {% endblock %}\n\n {% block sw_page_notification_center %}\n \n {% endblock %}\n
\n{% endblock %}\n'},Vx7a:function(e,t){e.exports='{% block sw_settings_user_list_actions_edit %}\n {% parent() %}\n\n {% block sw_settings_user_list_actions_impersonate %}\n \n {{ $tc(\'impersonation.actions.impersonate\') }}\n \n {% endblock %}\n{% endblock %}\n'},f1yM:function(e,t,i){"use strict";i.d(t,"b",(function(){return m}));var n=i("lSNA"),r=i.n(n),o=i("/3U3");function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function a(e){for(var t=1;t=0;o-=1){var s=n[o];r[s]=a(a({},i[s]),{},{timestamp:new Date(i[s].timestamp)})}return n.length>50&&g(r),r}function g(e){var t=v();if(t){var i={};Object.keys(e).forEach((function(t){!1===e[t].isLoading&&(i[t]=a(a({},e[t]),{},{timestamp:e[t].timestamp.toJSON()}))})),localStorage.setItem(t,JSON.stringify(i))}}t.a={namespaced:!0,state:{notifications:{},growlNotifications:{},threshold:5,workerProcessPollInterval:o.a,notificationDefaults:{visited:!1,metadata:{},isLoading:!1},growlNotificationDefaults:{system:!1,variant:"info",autoClose:!0,duration:5e3}},getters:{getNotifications:function(e){return Object.values(e.notifications).reverse()},getGrowlNotifications:function(e){return Object.values(e.growlNotifications)}},mutations:{setThreshold:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;e.threshold=t,e.growlNotifications.length>e.threshold&&e.growlNotifications.splice(t,e.growlNotifications.length-e.threshold)},setWorkerProcessPollInterval:function(e,t){e.workerProcessPollInterval=t},setNotificationsForCurrentUser:function(e){e.notifications=d()},clearNotificationsForCurrentUser:function(e){e.notifications={};var t=v();t&&localStorage.removeItem(t)},clearGrowlNotificationsForCurrentUser:function(e){e.growlNotifications={}},setNotifications:function(e,t){Object.keys(t).forEach((function(i){u.view.setReactive(e.notifications,t[i].uuid,t[i])}))},upsertNotification:function(e,t){var i=e.notifications[t.uuid];void 0===i?(u.view.setReactive(e.notifications,t.uuid,t),g(e.notifications)):Object.assign(i,t)},removeNotification:function(e,t){u.view.deleteReactive(e.notifications,t.uuid),g(e.notifications)},setAllNotificationsVisited:function(e){Object.keys(e.notifications).forEach((function(t){e.notifications[t].visited=!0})),g(e.notifications)},upsertGrowlNotification:function(e,t){var i=e.growlNotifications[t.uuid];if(void 0===i){u.view.setReactive(e.growlNotifications,t.uuid,t);var n=Object.keys(e.growlNotifications);n.length>e.threshold&&u.view.deleteReactive(e.growlNotifications,n[0])}else Object.assign(i,t)},removeGrowlNotification:function(e,t){u.view.deleteReactive(e.growlNotifications,t.uuid)}},actions:{createNotification:function(e,t){var i=e.state,n=e.commit,r=e.dispatch;if(!t.message)return f.warn("NotificationStore","A message must be specified",t),null;void 0!==t.growl&&!0!==t.growl||r("createGrowlNotification",t),delete t.growl;var o=Object.assign({},i.notificationDefaults,t,{uuid:p.createId(),timestamp:new Date});return"success"===o.variant?null:(n("upsertNotification",o),o.uuid)},createGrowlNotification:function(e,t){var i=e.state,n=e.commit,r=Object.assign({},i.growlNotificationDefaults,t,{uuid:p.createId(),timestamp:new Date});delete r.growl,n("upsertGrowlNotification",r),r.autoClose&&setTimeout((function(){n("removeGrowlNotification",r)}),r.duration)},updateNotification:function(e,t){var i=e.state,n=e.commit,r=e.dispatch;if(!t.uuid)return f.warn("NotificationStore","Update to an notification must contain the uuid",t),null;var o=function(e,t){var i=t.notifications[e];return void 0===i&&(i=Object.assign({},t.notificationDefaults,{uuid:e,timestamp:new Date})),i}(t.uuid,i),s=function(e,t){return Object.assign({},e,{visited:t.metadata?JSON.stringify(e.metadata)===JSON.stringify(t.metadata):e.visited},t)}(o,t);return n("upsertNotification",s),void 0!==t.growl&&!0===t.growl&&r("createGrowlNotification",s),o.uuid},setAllNotificationsVisited:function(e){(0,e.commit)("setAllNotificationsVisited")}}}},gKsz:function(e,t,i){},mUXG:function(e,t,i){"use strict";i.r(t);var n="impersonated-user-id",r=i("f1yM");function o(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},o=Object.keys(e);for(n=0;n=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function s(e,t,i,n,r,o,s){try{var a=e[o](s),c=a.value}catch(e){return void i(e)}a.done?t(c):Promise.resolve(c).then(n,r)}function a(e){return function(){var t=this,i=arguments;return new Promise((function(n,r){var o=e.apply(t,i);function a(e){s(o,n,r,a,c,"next",e)}function c(e){s(o,n,r,a,c,"throw",e)}a(void 0)}))}}function c(e,t){for(var i=0;i\n {{ $tc(\'impersonation.actions.impersonate\') }}\n \n {% endblock %}\n{% endblock %}\n'},KZ6D:function(e,t,n){},NUDy:function(e,t,n){"use strict";n.r(t);var r="impersonated-user-id",i=n("lSNA"),o=n.n(i),s=(n("lwsE"),n("W8MJ"),Shopware);s.Application,s.WorkerNotification;function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0;o-=1){var s=r[o];i[s]=c(c({},n[s]),{},{timestamp:new Date(n[s].timestamp)})}return r.length>50&&m(i),i}function m(e){var t=f();if(t){var n={};Object.keys(e).forEach((function(t){!1===e[t].isLoading&&(n[t]=c(c({},e[t]),{},{timestamp:e[t].timestamp.toJSON()}))})),localStorage.setItem(t,JSON.stringify(n))}}function v(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){g(o,r,i,s,a,"next",e)}function a(e){g(o,r,i,s,a,"throw",e)}s(void 0)}))}}function b(e,t){for(var n=0;nn.parts.length&&(r.parts.length=n.parts.length)}else{var s=[];for(i=0;i\n {% block sw_page_leave_impersonation_button %}\n {{ $tc(\'impersonation.actions.leaveImpersonation\') }}\n {% endblock %}\n\n {% block sw_page_notification_center %}\n \n {% endblock %}\n \n{% endblock %}\n'}});