kollapsminoriteten/wp-content/plugins/jetpack/_inc/build/newsletter-widget.js

10 lines
362 KiB
JavaScript
Raw Permalink Normal View History

2025-06-09 09:58:01 +02:00
/*! For license information please see newsletter-widget.js.LICENSE.txt */
2026-03-31 11:30:59 +02:00
(()=>{var e={28288(e,t,n){"use strict";n.d(t,{A:()=>m});var r=n(51609),i=n.n(r),o=n(5868),a=n.n(o),u=n(27350),s=n(68228),c=n(61562),l=n(26547),f=n(80399),d=n(97796),h=n(97935),p=n(14739),g=n(23716),y=["children","axisClassName","hideAxisLine","hideTicks","hideZero","innerRef","left","numTicks","orientation","rangePadding","scale","tickFormat","tickLength","tickValues","top"];function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(this,arguments)}function m(e){var t=e.children,n=void 0===t?l.A:t,r=e.axisClassName,o=e.hideAxisLine,m=void 0!==o&&o,b=e.hideTicks,_=void 0!==b&&b,w=e.hideZero,x=void 0!==w&&w,M=e.innerRef,A=e.left,O=void 0===A?0:A,k=e.numTicks,j=void 0===k?10:k,P=e.orientation,T=void 0===P?p.A.bottom:P,S=e.rangePadding,C=void 0===S?0:S,N=e.scale,E=e.tickFormat,D=e.tickLength,R=void 0===D?8:D,F=e.tickValues,U=e.top,I=void 0===U?0:U,L=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,y),z=null!=E?E:(0,d.A)(N),$=T===p.A.left,W=T===p.A.top,H=W||T===p.A.bottom,q=(0,f.A)(N),Y=$||W?-1:1,B=N.range(),G=(0,g.A)(C),J=(0,h.A)({x:Number(B[0])+.5-G.start,y:0},H),V=(0,h.A)({x:Number(B[B.length-1])+.5+G.end,y:0},H),X=(null!=F?F:(0,c.A)(N,j)).filter(function(e){return!x||0!==e&&"0"!==e}).map(function(e,t){return{value:e,index:t}}),Z=X.map(function(e){var t=e.value,n=e.index,r=(0,s.A)(q(t));return{value:t,index:n,from:(0,h.A)({x:r,y:0},H),to:(0,h.A)({x:r,y:R*Y},H),formattedValue:z(t,n,X)}});return i().createElement(u.A,{className:a()("visx-axis",r),innerRef:M,top:I,left:O},n(v({},L,{axisFromPoint:J,axisToPoint:V,hideAxisLine:m,hideTicks:_,hideZero:x,horizontal:H,numTicks:j,orientation:T,rangePadding:C,scale:N,tickFormat:z,tickLength:R,tickPosition:q,tickSign:Y,ticks:Z})))}},26547(e,t,n){"use strict";n.d(t,{A:()=>p});var r=n(51609),i=n.n(r),o=n(5868),a=n.n(o),u=n(75058),s=n(54302),c=n(54271),l=n(14739),f=n(83615);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(this,arguments)}var h={textAnchor:"middle",fontFamily:"Arial",fontSize:10,fill:"#222"};function p(e){var t=e.axisFromPoint,n=e.axisLineClassName,r=e.axisToPoint,o=e.hideAxisLine,p=e.hideTicks,g=e.horizontal,y=e.label,v=void 0===y?"":y,m=e.labelClassName,b=e.labelOffset,_=void 0===b?14:b,w=e.labelProps,x=e.orientation,M=void 0===x?l.A.bottom:x,A=e.scale,O=e.stroke,k=void 0===O?"#222":O,j=e.strokeDasharray,P=e.strokeWidth,T=void 0===P?1:P,S=e.tickClassName,C=e.tickComponent,N=e.tickLineProps,E=e.tickLabelProps,D=e.tickLength,R=void 0===D?8:D,F=e.tickStroke,U=void 0===F?"#222":F,I=e.tickTransform,L=e.ticks,z=e.ticksComponent,$=void 0===z?f.A:z,W=d({},h,w),H=d({},h,"object"==typeof E?E:null),q=L.map(function(e){var t=e.value,n=e.index;return"function"==typeof E?E(t,n,L):H}),Y=Math.max.apply(Math,[10].concat(q.map(function(e){return"number"==typeof e.fontSize?e.fontSize:0})));return i().createElement(i().Fragment,null,$({hideTicks:p,horizontal:g,orientation:M,scale:A,tickClassName:S,tickComponent:C,tickLabelProps:q,tickStroke:U,tickTransform:I,ticks:L,strokeWidth:T,tickLineProps:N}),!o&&i().createElement(u.A,{className:a()("visx-axis-line",n),from:t,to:r,stroke:k,strokeWidth:T,strokeDasharray:j}),v&&i().createElement(s.A,d({className:a()("visx-axis-label",m)},(0,c.A)({labelOffset:_,labelProps:W,orientation:M,range:A.range(),tickLabelFontSize:Y,tickLength:R}),W),v))}},83615(e,t,n){"use strict";n.d(t,{A:()=>d});var r=n(51609),i=n.n(r),o=n(5868),a=n.n(o),u=n(75058),s=n(27350),c=n(54302),l=n(14739);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function d(e){var t=e.hideTicks,n=e.horizontal,r=e.orientation,
2025-06-09 09:58:01 +02:00
//translators: %1$s is the total number of subscribers, %2$s is the number of email subscribers
2026-03-31 11:30:59 +02:00
_n("%1$s subscriber (%2$s via email)","%1$s subscribers (%2$s via email)",m,"jetpack"),(0,f.ZV)(m),(0,f.ZV)(y)),A=(0,u.sprintf)(
2025-06-09 09:58:01 +02:00
//translators: %s is the number of paid subscribers
2026-03-31 11:30:59 +02:00
_n("%s paid subscriber","%s paid subscribers",v,"jetpack"),(0,f.ZV)(v));return(0,p.jsxs)("div",{className:"newsletter-widget",children:[_&&(0,p.jsx)("div",{className:"newsletter-widget__header",children:(0,p.jsxs)("div",{className:"newsletter-widget__stats",children:[(0,p.jsxs)("span",{className:"newsletter-widget__stat-item",children:[(0,p.jsx)("span",{className:"newsletter-widget__icon",children:(0,p.jsx)(o.Icon,{icon:s.A,size:24})}),(0,p.jsx)("span",{className:"newsletter-widget__stat-content",children:(0,p.jsx)("span",{className:"newsletter-widget__stat-label",children:(0,d.j)(!0,(0,f.R8)(e,t),"all_subscribers_click",M)})})]}),(0,p.jsxs)("span",{className:"newsletter-widget__stat-item",children:[(0,p.jsx)("span",{className:"newsletter-widget__icon",children:(0,p.jsx)(o.Icon,{icon:c.A,size:24})}),(0,p.jsx)("span",{className:"newsletter-widget__stat-content",children:(0,p.jsx)("span",{className:"newsletter-widget__stat-label",children:(0,d.j)(!0,(0,f.R8)(e,t),"paid_subscribers_click",A)})})]})]})}),w&&(0,p.jsxs)("div",{className:"newsletter-widget__chart",children:[(0,p.jsx)("h3",{className:"newsletter-widget__heading",children:__("Total Subscribers","jetpack")}),(0,p.jsx)(h.w,{subscriberTotalsByDate:b})]}),(0,p.jsxs)("div",{className:"newsletter-widget__footer",children:[(0,p.jsx)("p",{className:"newsletter-widget__footer-msg",children:(0,a.createInterpolateElement)(__("Effortlessly turn posts into emails with our Newsletter feature. Expand your reach, engage readers, and monetize your writing. No coding required. <link>Learn more</link>","jetpack"),{link:(0,d.j)(n,n?"https://wordpress.com/learn/courses/newsletters-101/wordpress-com-newsletter":"https://jetpack.com/support/newsletter","learn_more_click")})}),(0,p.jsxs)("div",{children:[(0,p.jsx)("h3",{className:"newsletter-widget__heading",children:__("Quick Links","jetpack")}),(0,p.jsxs)("ul",{className:"newsletter-widget__footer-list",children:[(0,p.jsx)("li",{children:(0,p.jsx)("a",{href:`${t}post-new.php`,onClick:(0,f.R)(x,"publish_post_click"),children:__("Publish your next post","jetpack")})}),g&&(0,p.jsx)("li",{children:(0,d.j)(!0,(0,f.R8)(e,t),"view_stats_click",__("View subscriber stats","jetpack"))}),(0,p.jsx)("li",{children:(0,d.j)(n,(0,r.A)((0,f.Qj)(`subscribers/${e}`,n),{anchor:"add-subscribers"}),"import_subscribers_click",__("Import subscribers","jetpack"))}),(0,p.jsx)("li",{children:(0,d.j)(n,(0,r.A)((0,f.Qj)(`subscribers/${e}`,n)),"manage_subscribers_click",__("Manage subscribers","jetpack"))}),(0,p.jsx)("li",{children:(0,d.j)(n,(0,r.A)((0,f.Qj)(`${n?"earn":"monetize"}/${e}`,n)),"monetize_click",__("Monetize","jetpack"))}),(0,p.jsx)("li",{children:(0,d.j)(!0,(0,f.iP)(e,n,t),"newsletter_settings_click",__("Newsletter settings","jetpack"))})]})]})]})]})}},51984(e,t,n){"use strict";n.d(t,{w:()=>P});var r=n(85985),i=n(22994),o=n(53207),a=n(37372),u=n(6699),s=n(62643),c=n(7401),l=n(76883),f=n(27917),d=n(65573),h=n(94648),p=n(86087),g=n(27723),y=n(51720),v=n(54060),m=n(10790);const __=g.__,b=(0,u.A)({domain:["all","paid"],range:[y.hg.all,y.hg.paid]}),_=(0,h.A)({backgroundColor:"white",colors:[y.hg.all,y.hg.paid],gridColor:"#e0e0e0",gridColorDark:"#e0e0e0",tickLength:0,gridStyles:{strokeWidth:1},svgLabelSmall:{fill:"#1e1e1e",fontSize:13,fontWeight:400}}),w=e=>e.date,x=e=>e.all,M=e=>e.paid,A=e=>y.hg[e],O=e=>y.aH[e],k=({key:e,color:t,x:n,y:r})=>{const i=y.hg[e]||t;return(0,m.jsx)("circle",{cx:n,cy:r,r:4,fill:i,stroke:"white",strokeWidth:2},`glyph-${e}`)},j=({tooltipData:e})=>{if(!e?.nearestDatum)return null;const t=e.nearestDatum.datum,n=w(t);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"subscribers-chart__tooltip-date",children:(0,v.Yq)(n,"full")}),(0,m.jsxs)("div",{className:"subscribers-chart__tooltip-stats",children:[(0,m.jsxs)("div",{className:"subscribers-chart__tooltip-stat",children:[(0,m.jsx)("div",{style:{backgroundColor:y.hg.all},className:"subscribers-chart__tooltip-indicator"}),(0,m.jsx)("span",{children:(0,g.sprintf)(
2025-06-09 09:58:01 +02:00
// translators: %s is the total number of subscribers.
2026-03-31 11:30:59 +02:00
__("All: %s","jetpack"),(0,v.ZV)(x(t)))})]}),(0,m.jsxs)("div",{className:"subscribers-chart__tooltip-stat",children:[(0,m.jsx)("div",{style:{backgroundColor:y.hg.paid},className:"subscribers-chart__tooltip-indicator"}),(0,m.jsx)("span",{children:(0,g.sprintf)(
2025-06-09 09:58:01 +02:00
// translators: %s is the number of paid subscribers.
2026-03-31 11:30:59 +02:00
__("Paid: %s","jetpack"),(0,v.ZV)(M(t)))})]})]})]})},P=({subscriberTotalsByDate:e})=>{const{tracks:t}=(0,r.st)();if((0,p.useEffect)(()=>{t.recordEvent(`${y.xe}chart_view`)},[t]),0===Object.keys(e).length)return(0,m.jsx)("div",{children:__("No data available","jetpack")});const n=(0,v.tX)(e);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"subscribers-chart",children:(0,m.jsx)(a.A,{children:({width:e,height:t})=>e&&t?(0,m.jsxs)(f.A,{height:t,width:e,xScale:{type:"time"},yScale:{type:"linear",nice:!0},theme:_,margin:{top:10,right:30,bottom:30,left:(0,v.oO)(n)},children:[(0,m.jsx)(c.A,{columns:!1,numTicks:5}),(0,m.jsx)(d.A,{dataKey:"all",data:n,xAccessor:w,yAccessor:x,colorAccessor:A,strokeWidth:2,curve:i.G}),(0,m.jsx)(d.A,{dataKey:"paid",data:n,xAccessor:w,yAccessor:M,colorAccessor:A,strokeWidth:2,curve:i.G}),(0,m.jsx)(s.A,{orientation:"left",hideAxisLine:!0,hideTicks:!0,hideZero:!0,numTicks:5}),(0,m.jsx)(s.A,{orientation:"bottom",tickFormat:v.Ac,hideAxisLine:!0,hideTicks:!0,numTicks:5,tickValues:(0,v.NL)(n)}),(0,m.jsx)(l.A,{showVerticalCrosshair:!0,showSeriesGlyphs:!0,className:"subscribers-chart__tooltip",renderTooltip:j,renderGlyph:k})]}):null})}),(0,m.jsx)(o.A,{scale:b,direction:"row",labelFormat:O,shape:"circle",shapeWidth:10,shapeHeight:10,itemMargin:5,className:"subscribers-chart__legend"})]})}},51720(e,t,n){"use strict";n.d(t,{aH:()=>o,hg:()=>i,xe:()=>a});var r=n(27723);const __=r.__,i={all:"#3057dc",paid:"#e68b28"},o={all:__("All","jetpack"),paid:__("Paid","jetpack")},a="jetpack_newsletter_widget_"},54060(e,t,n){"use strict";n.d(t,{Ac:()=>f,NL:()=>d,Qj:()=>a,R:()=>o,R8:()=>u,Yq:()=>l,ZV:()=>c,iP:()=>s,oO:()=>p,tX:()=>h});var r=n(3924),i=n(38443);const o=(e,t,n={})=>()=>{e.recordEvent(`jetpack_newsletter_widget_${t}`,n)},a=(e,t=!0)=>`https://${t?"wordpress.com":"cloud.jetpack.com"}/${e}`,u=(e,t)=>`${t}admin.php?page=stats#!/stats/subscribers/${e}`,s=(e,t,n)=>t?(0,r.A)(a("settings/newsletter/"+e)):`${n}admin.php?page=jetpack#newsletter`,c=e=>e.toLocaleString(),l=(e,t="short")=>"short"===t?(0,i.dateI18n)("M j",e):(0,i.dateI18n)("M j, Y",e),f=e=>l(e,"short"),d=e=>{if(e.length<2)return e.map(e=>e.date);const t=e[0].date,n=e[e.length-1].date,r=n.getTime()-t.getTime();return[t,new Date(t.getTime()+.25*r),new Date(t.getTime()+.5*r),new Date(t.getTime()+.75*r),n]},h=e=>Object.entries(e).map(([e,t])=>{const n=new Date(e);return isNaN(n.getTime())?null:{date:n,all:t?.all??0,paid:t?.paid??0}}).filter(Boolean).sort((e,t)=>e.date.getTime()-t.date.getTime()),p=e=>{if(0===e.length)return 30;const t=Math.max(...e.map(e=>Math.max(e.all||0,e.paid||0))).toString().length;return Math.max(30,8*t+10)}},10067(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{r