whoami7 - Manager
:
/
home
/
ezdajrnh
/
www
/
wp-content
/
plugins
/
woocommerce
/
assets
/
client
/
admin
/
chunks
/
Upload File:
files >> //home/ezdajrnh/www/wp-content/plugins/woocommerce/assets/client/admin/chunks/store-alerts.js
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[1438],{46445:(e,s,o)=>{o.d(s,{A:()=>a});var t=o(5573),r=o(39793);const a=(0,r.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(t.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})})},45260:(e,s,o)=>{o.d(s,{A:()=>a});var t=o(5573),r=o(39793);const a=(0,r.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(t.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})})},10837:(e,s,o)=>{o.d(s,{B:()=>t});const t=(e,s,o)=>{const t=!o||window.wcAdminFeatures.analytics;return"two_columns"===(e||s)&&t}},46189:(e,s,o)=>{o.r(s),o.d(s,{StoreAlerts:()=>B,default:()=>k});var t=o(27723),r=o(86087),a=o(56427),n=o(4921),l=o(36849),c=o(47143),i=o(76154),d=o.n(i),m=o(24148),u=o(46445),h=o(45260),_=o(47804),p=o(40314),w=o(83306),g=o(96476),x=o(12974),j=o(39793);class v extends r.Component{render(){const{hasMultipleAlerts:e,className:s}=this.props;return(0,j.jsxs)(a.Card,{className:(0,n.A)("woocommerce-store-alerts is-loading",s),"aria-hidden":!0,size:null,children:[(0,j.jsxs)(a.CardHeader,{isBorderless:!0,children:[(0,j.jsx)("span",{className:"is-placeholder"}),e&&(0,j.jsx)("span",{className:"is-placeholder"})]}),(0,j.jsx)(a.CardBody,{children:(0,j.jsxs)("div",{className:"woocommerce-store-alerts__message",children:[(0,j.jsx)("span",{className:"is-placeholder"}),(0,j.jsx)("span",{className:"is-placeholder"})]})}),(0,j.jsx)(a.CardFooter,{isBorderless:!0,children:(0,j.jsx)("span",{className:"is-placeholder"})})]})}}const N=v;v.defaultProps={hasMultipleAlerts:!1};var A=o(56109),b=o(24060),f=o(10837),C=o(99915);const S={page:1,per_page:p.QUERY_DEFAULTS.pageSize,type:"error,update",status:"unactioned"};function y(e){return(e||[]).filter((e=>"unactioned"===e.status&&!0!==e.is_deleted))}const B=()=>{const[e,s]=(0,r.useState)(0),{alerts:o=[],isLoading:i,defaultHomescreenLayout:v}=(0,c.useSelect)((e=>{const{getNotes:s,hasFinishedResolution:o}=e(p.notesStore),{getOption:t}=e(p.optionsStore);return{alerts:y(s(S)),isLoading:!o("getNotes",[S]),defaultHomescreenLayout:t("woocommerce_default_homepage_layout")||"single_column"}})),{triggerNoteAction:B,updateNote:k,removeNote:M}=(0,c.useDispatch)(p.notesStore),{createNotice:z}=(0,c.useDispatch)("core/notices"),L=(0,p.useUserPreferences)();function T(o){o?.stopPropagation(),e>0&&s(e-1)}const F=(0,A.Qk)("alertCount",0,(e=>parseInt(e,10))),P=(0,g.isWCAdmin)(),H=P&&"homescreen"===(0,g.getScreenFromPath)(),E=(0,f.B)(L.homepage_layout,v,(0,C.EM)("setup"));if(F>0&&i)return(0,j.jsx)(N,{className:(0,n.A)({"is-wc-admin-page":P,"is-homescreen":H,"two-columns":E&&H}),hasMultipleAlerts:F>1});if(0===o.length)return null;const D=o.length,U=o[e],R=U.type,$=(0,n.A)("woocommerce-store-alerts",{"is-alert-error":"error"===R,"is-alert-update":"update"===R,"is-wc-admin-page":P,"is-homescreen":H,"two-columns":E&&H});return(0,j.jsxs)(a.Card,{className:$,size:null,children:[(0,j.jsxs)(a.CardHeader,{className:"woocommerce-store-alerts__header",isBorderless:!0,children:[(0,j.jsx)("span",{className:"woocommerce-store-alerts__title",children:U.title}),D>1&&(0,j.jsxs)("div",{className:"woocommerce-store-alerts__pagination",children:[(0,j.jsx)("span",{className:"woocommerce-store-alerts__pagination-label",role:"status","aria-live":"polite",children:(0,l.A)({mixedString:(0,t.__)("{{current /}} of {{total /}}","woocommerce"),components:{current:(0,j.jsx)(r.Fragment,{children:e+1}),total:(0,j.jsx)(r.Fragment,{children:D})}})}),(0,j.jsx)(a.Button,{onClick:T,disabled:0===e,label:(0,t.__)("Previous Alert","woocommerce"),children:(0,j.jsx)(m.A,{icon:u.A,className:"arrow-left-icon"})}),(0,j.jsx)(a.Button,{onClick:function(t){t.stopPropagation(),e<o.length-1&&s(e+1)},disabled:D-1===e,label:(0,t.__)("Next Alert","woocommerce"),children:(0,j.jsx)(m.A,{icon:h.A,className:"arrow-right-icon"})})]}),(0,j.jsx)(a.Button,{className:"woocommerce-store-alerts__close",onClick:()=>(async e=>{const s=(0,b.s9)();(0,w.recordEvent)("inbox_action_dismiss",{note_name:e.name,note_title:e.title,note_name_dismiss_all:!1,note_name_dismiss_confirmation:!0,screen:s});const o=e.id;try{await M(o),z("success",(0,t.__)("Message dismissed","woocommerce"))}catch(e){z("error",(0,t._n)("Message could not be dismissed","Messages could not be dismissed",1,"woocommerce"))}})(U),children:(0,j.jsx)(m.A,{width:"18",height:"18",icon:_.A})})]}),(0,j.jsx)(a.CardBody,{children:(0,j.jsx)("div",{className:"woocommerce-store-alerts__message",dangerouslySetInnerHTML:(0,x.A)(U.content)})}),(0,j.jsx)(a.CardFooter,{isBorderless:!0,children:function(e){const s=e.actions.map(((s,o)=>{const r=0===o?"secondary":"tertiary";return(0,j.jsx)(a.Button,{variant:r,href:s.url||void 0,onClick:async o=>{const r=o.currentTarget.getAttribute("href");o.preventDefault(),T();try{await B(e.id,s.id),r&&"#"!==r&&(0,g.parseAdminUrl)(r).href!==window.location.href&&(0,g.navigateTo)({url:r})}catch(e){throw z("error",(0,t.__)("Something went wrong while triggering this note's action.","woocommerce")),e}},children:s.label},`${e.id}-${s.label}-${s.name}`)})),o=[{value:d()().add(4,"hours").unix().toString(),label:(0,t.__)("Later Today","woocommerce")},{value:d()().add(1,"day").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:(0,t.__)("Tomorrow","woocommerce")},{value:d()().add(1,"week").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:(0,t.__)("Next Week","woocommerce")},{value:d()().add(1,"month").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:(0,t.__)("Next Month","woocommerce")}],r=e.is_snoozable&&(0,j.jsx)(a.SelectControl,{className:"woocommerce-store-alerts__snooze",options:[{label:(0,t.__)("Remind Me Later","woocommerce"),value:"0"},...o],onChange:s=>{if("0"===s)return;const t=o.find((e=>e.value===s));(s=>{k(e.id,{status:"snoozed",date_reminder:s.value});const o={alert_name:e.name,alert_title:e.title,snooze_duration:s.value,snooze_label:s.label};(0,w.recordEvent)("store_alert_snooze",o)})({value:s,label:t&&t.label})}});if(s||r)return(0,j.jsxs)("div",{className:"woocommerce-store-alerts__actions",children:[s,r]})}(U)})]})},k=B},12974:(e,s,o)=>{o.d(s,{A:()=>r});var t=o(42435);const r=e=>({__html:(0,t.sanitizeHTML)(e)})}}]);
Copyright ©2021 || Defacer Indonesia