관리-도구
편집 파일: store-alerts.js
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[48],{153:function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},210:function(e,t,n){"use strict";var r=n(6),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,a=n(153),c=n(211),i=n(212),l="function"==typeof Symbol&&Symbol.iterator;function s(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return r[e]}))):t.toString(36);var n,r}function u(e,t,n,r){var a,i=typeof e;if("undefined"!==i&&"boolean"!==i||(e=null),null===e||"string"===i||"number"===i||"object"===i&&e.$$typeof===o)return n(r,e,""===t?"."+s(e,0):t),1;var m=0,p=""===t?".":t+":";if(Array.isArray(e))for(var f=0;f<e.length;f++)m+=u(a=e[f],p+s(a,f),n,r);else{var d=function(e){var t=e&&(l&&e[l]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(d){0;for(var b,h=d.call(e),v=0;!(b=h.next()).done;)m+=u(a=b.value,p+s(a,v++),n,r)}else if("object"===i){0;var y=""+e;c(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===y?"object with keys {"+Object.keys(e).join(", ")+"}":y,"")}}return m}var m=/\/+/g;function p(e){return(""+e).replace(m,"$&/")}var f,d,b=h,h=function(e){if(this.instancePool.length){var t=this.instancePool.pop();return this.call(t,e),t}return new this(e)},v=function(e){c(e instanceof this,"Trying to release an instance into a pool of a different type."),e.destructor(),this.instancePool.length<this.poolSize&&this.instancePool.push(e)};function y(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function O(e,t,n){var o,c,i=e.result,l=e.keyPrefix,s=e.func,u=e.context,m=s.call(u,t,e.count++);Array.isArray(m)?g(m,i,n,a.thatReturnsArgument):null!=m&&(r.isValidElement(m)&&(o=m,c=l+(!m.key||t&&t.key===m.key?"":p(m.key)+"/")+n,m=r.cloneElement(o,{key:c},void 0!==o.props?o.props.children:void 0)),i.push(m))}function g(e,t,n,r,o){var a="";null!=n&&(a=p(n)+"/");var c=y.getPooled(t,a,r,o);!function(e,t,n){null==e||u(e,"",t,n)}(e,O,c),y.release(c)}y.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},f=function(e,t,n,r){if(this.instancePool.length){var o=this.instancePool.pop();return this.call(o,e,t,n,r),o}return new this(e,t,n,r)},(d=y).instancePool=[],d.getPooled=f||b,d.poolSize||(d.poolSize=10),d.release=v;e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return i(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(r.isValidElement(e))return i(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;c(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)g(e[n],t,n,a.thatReturnsArgument);return t}},211:function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,a,c,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,a,c,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return s[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},212:function(e,t,n){"use strict";var r=n(153);e.exports=r},213:function(e,t,n){"use strict";function r(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(r)}},42:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=i(n(6)),a=i(n(210)),c=i(n(213));function i(e){return e&&e.__esModule?e:{default:e}}var l=void 0;function s(e,t){var n,c,i,u,m,p,f,d,b=[],h={};for(p=0;p<e.length;p++)if("string"!==(m=e[p]).type){if(!t.hasOwnProperty(m.value)||void 0===t[m.value])throw new Error("Invalid interpolation, missing component node: `"+m.value+"`");if("object"!==r(t[m.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+m.value+"`","\n> "+l);if("componentClose"===m.type)throw new Error("Missing opening component token: `"+m.value+"`");if("componentOpen"===m.type){n=t[m.value],i=p;break}b.push(t[m.value])}else b.push(m.value);return n&&(u=function(e,t){var n,r,o=t[e],a=0;for(r=e+1;r<t.length;r++)if((n=t[r]).value===o.value){if("componentOpen"===n.type){a++;continue}if("componentClose"===n.type){if(0===a)return r;a--}}throw new Error("Missing closing component token `"+o.value+"`")}(i,e),f=s(e.slice(i+1,u),t),c=o.default.cloneElement(n,{},f),b.push(c),u<e.length-1&&(d=s(e.slice(u+1),t),b=b.concat(d))),1===b.length?b[0]:(b.forEach((function(e,t){e&&(h["interpolation-child-"+t]=e)})),(0,a.default)(h))}t.default=function(e){var t=e.mixedString,n=e.components,o=e.throwErrors;if(l=t,!n)return t;if("object"!==(void 0===n?"undefined":r(n))){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var a=(0,c.default)(t);try{return s(a,n)}catch(e){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},439:function(e,t,n){"use strict";var r=n(8),o=n(12),a=n(4),c=n.n(a),i=n(0);function l(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}t.a=function(e){var t=e.as,n=void 0===t?"div":t,a=e.className,s=Object(o.a)(e,["as","className"]);return function(e){var t=e.as,n=void 0===t?"div":t,r=Object(o.a)(e,["as"]);return"function"==typeof r.children?r.children(r):Object(i.createElement)(n,r)}(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){Object(r.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({as:n,className:c()("components-visually-hidden",a)},s))}},767:function(e,t,n){"use strict";var r=n(0),o=n(4),a=n.n(o),c=n(439);function i(e){var t=e.id,n=e.label,o=e.hideLabelFromVision,l=e.help,s=e.className,u=e.children;return Object(r.createElement)("div",{className:a()("components-base-control",s)},Object(r.createElement)("div",{className:"components-base-control__field"},n&&t&&(o?Object(r.createElement)(c.a,{as:"label",htmlFor:t},n):Object(r.createElement)("label",{className:"components-base-control__label",htmlFor:t},n)),n&&!t&&(o?Object(r.createElement)(c.a,{as:"label"},n):Object(r.createElement)(i.VisualLabel,null,n)),u),!!l&&Object(r.createElement)("p",{id:t+"__help",className:"components-base-control__help"},l))}i.VisualLabel=function(e){var t=e.className,n=e.children;return t=a()("components-base-control__label",t),Object(r.createElement)("span",{className:t},n)},t.a=i},772:function(e,t,n){"use strict";var r=n(778),o=["a","b","em","i","strong","p","br"],a=["target","href","rel","name","download"];t.a=function(e){return{__html:Object(r.sanitize)(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:a})}}},799:function(e,t,n){},800:function(e,t,n){"use strict";var r=n(0),o=n(88),a=Object(r.createElement)(o.c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.b,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));t.a=a},853:function(e,t,n){"use strict";n.r(t);var r=n(17),o=n.n(r),a=n(15),c=n.n(a),i=n(11),l=n.n(i),s=n(18),u=n.n(s),m=n(19),p=n.n(m),f=n(9),d=n.n(f),b=n(0),h=n(3),v=n(72),y=n(851),O=n(126),g=n(4),j=n.n(g),_=n(42),w=n.n(_),E=n(277),N=n(20),x=n(16),A=n.n(x),S=n(570),k=n(88),R=Object(b.createElement)(k.c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(b.createElement)(k.b,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),P=n(800),M=n(77),T=n(36),L=n(35),z=n(64),D=n(772),I=n(1),C=n.n(I);function F(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var o=d()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p()(this,n)}}var V=function(e){u()(n,e);var t=F(n);function n(){return o()(this,n),t.apply(this,arguments)}return c()(n,[{key:"render",value:function(){var e=this.props.hasMultipleAlerts;return Object(b.createElement)("div",{className:"kkart-card kkart-store-alerts is-loading","aria-hidden":!0},Object(b.createElement)("div",{className:"kkart-card__header"},Object(b.createElement)("div",{className:"kkart-card__title kkart-card__header-item"},Object(b.createElement)("span",{className:"is-placeholder"})),e&&Object(b.createElement)("div",{className:"kkart-card__action kkart-card__header-item"},Object(b.createElement)("span",{className:"is-placeholder"}))),Object(b.createElement)("div",{className:"kkart-card__body"},Object(b.createElement)("div",{className:"kkart-store-alerts__message"},Object(b.createElement)("span",{className:"is-placeholder"}),Object(b.createElement)("span",{className:"is-placeholder"})),Object(b.createElement)("div",{className:"kkart-store-alerts__actions"},Object(b.createElement)("span",{className:"is-placeholder"}))))}}]),n}(b.Component),W=V;V.propTypes={hasMultipleAlerts:C.a.bool},V.defaultProps={hasMultipleAlerts:!1};n(799);function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var o=d()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p()(this,n)}}var B=function(e){u()(n,e);var t=$(n);function n(e){var r;o()(this,n);var a=(r=t.call(this,e)).props.alerts;return r.state={currentIndex:a?0:null},r.previousAlert=r.previousAlert.bind(l()(r)),r.nextAlert=r.nextAlert.bind(l()(r)),r}return c()(n,[{key:"previousAlert",value:function(e){e.stopPropagation();var t=this.state.currentIndex;t>0&&this.setState({currentIndex:t-1})}},{key:"nextAlert",value:function(e){e.stopPropagation();var t=this.props.alerts,n=this.state.currentIndex;n<t.length-1&&this.setState({currentIndex:n+1})}},{key:"renderActions",value:function(e){var t=this.props,n=t.triggerNoteAction,r=t.updateNote,o=e.actions.map((function(t){return Object(b.createElement)(v.a,{key:t.name,isPrimary:t.primary,isSecondary:!t.primary,href:t.url||void 0,onClick:function(){return n(e.id,t.id)}},t.label)})),a=[{value:A()().add(4,"hours").unix().toString(),label:Object(h.__)("Later Today",'kkart')},{value:A()().add(1,"day").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:Object(h.__)("Tomorrow",'kkart')},{value:A()().add(1,"week").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:Object(h.__)("Next Week",'kkart')},{value:A()().add(1,"month").hour(9).minute(0).second(0).millisecond(0).unix().toString(),label:Object(h.__)("Next Month",'kkart')}],c=e.is_snoozable&&Object(b.createElement)(y.a,{className:"kkart-store-alerts__snooze",options:[{label:Object(h.__)("Remind Me Later",'kkart'),value:"0"}].concat(a),onChange:function(t){if("0"!==t){var n=a.find((function(e){return e.value===t}));!function(t){r(e.id,{status:"snoozed",date_reminder:t.value});var n={alert_name:e.name,alert_title:e.title,snooze_duration:t.value,snooze_label:t.label};Object(z.recordEvent)("store_alert_snooze",n)}({value:t,label:n&&n.label})}}});if(o||c)return Object(b.createElement)("div",{className:"kkart-store-alerts__actions"},o,c)}},{key:"render",value:function(){var e=this.props.alerts||[],t=Object(T.g)("alertCount",0,(function(e){return parseInt(e,10)}));if(t>0&&this.props.isLoading)return Object(b.createElement)(W,{hasMultipleAlerts:t>1});if(0===e.length)return null;var n=this.state.currentIndex,r=e.length,o=e[n],a=o.type,c=j()("kkart-store-alerts","kkart-analytics__card",{"is-alert-error":"error"===a,"is-alert-update":"update"===a});return Object(b.createElement)(M.Card,{title:[o.icon&&Object(b.createElement)(O.a,{key:"icon",icon:o.icon}),Object(b.createElement)(b.Fragment,{key:"title"},o.title)],className:c,action:r>1&&Object(b.createElement)("div",{className:"kkart-store-alerts__pagination"},Object(b.createElement)(v.a,{onClick:this.previousAlert,disabled:0===n,label:Object(h.__)("Previous Alert",'kkart')},Object(b.createElement)(S.a,{icon:R})),Object(b.createElement)("span",{className:"kkart-store-alerts__pagination-label",role:"status","aria-live":"polite"},w()({mixedString:Object(h.__)("{{current /}} of {{total /}}",'kkart'),components:{current:Object(b.createElement)(b.Fragment,null,n+1),total:Object(b.createElement)(b.Fragment,null,r)}})),Object(b.createElement)(v.a,{onClick:this.nextAlert,disabled:r-1===n,label:Object(h.__)("Next Alert",'kkart')},Object(b.createElement)(S.a,{icon:P.a})))},Object(b.createElement)("div",{className:"kkart-store-alerts__message",dangerouslySetInnerHTML:Object(D.a)(o.content)}),this.renderActions(o))}}]),n}(b.Component);t.default=Object(E.a)(Object(N.withSelect)((function(e){var t=e(L.NOTES_STORE_NAME),n=t.getNotes,r=t.isResolving,o={page:1,per_page:L.QUERY_DEFAULTS.pageSize,type:"error,update",status:"unactioned"};return{alerts:n(o).filter((function(e){return"unactioned"===e.status})),isLoading:r("getNotes",[o])}})),Object(N.withDispatch)((function(e){var t=e(L.NOTES_STORE_NAME);return{triggerNoteAction:t.triggerNoteAction,updateNote:t.updateNote}})))(B)}}]);