5 lines
42 KiB
JavaScript
5 lines
42 KiB
JavaScript
|
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=295)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},11:function(e,t){e.exports=window.yoast.styledComponents},115:function(e,t,o){"use strict";o.d(t,"b",(function(){return u})),o.d(t,"a",(function(){return d}));var n=o(0),r=o(18),a=o(17),c=o(77);const l=[];let s=null;class i extends n.Component{constructor(e){super(e),this.state={registeredComponents:[]}}registerComponent(e,t){this.setState({registeredComponents:[...this.state.registeredComponents,{key:e,Component:t}]})}render(){return this.state.registeredComponents.map(e=>{let{Component:t,key:o}=e;return Object(n.createElement)(t,{key:o})})}}function u(e,t){const o=Object(a.a)();s=Object(n.createRef)();const u={isRtl:o.isRtl};Object(n.render)(Object(n.createElement)(c.a,{theme:u,location:"sidebar"},Object(n.createElement)(r.SlotFillProvider,null,Object(n.createElement)(n.Fragment,null,t,Object(n.createElement)(i,{ref:s})))),document.getElementById(e)),l.forEach(e=>{s.current.registerComponent(e.key,e.Component)})}function d(e,t){null===s||null===s.current?l.push({key:e,Component:t}):s.current.registerComponent(e,t)}},153:function(e,t,o){"use strict";o.d(t,"a",(function(){return u}));var n=o(0),r=o(2),a=o.n(r),c=o(1),l=o(5),s=o(8),i=o(9);function u(e){let{name:t,title:o,subtitle:r,usps:a,id:u,image:d,finishableSteps:p,finishedSteps:m,upsellLink:f,upsellText:h,workout:k,badges:w}=e;const{openWorkout:b,toggleWorkout:E}=Object(l.useDispatch)("yoast-seo/workouts"),g=Object(l.useSelect)(e=>e("yoast-seo/workouts").getActiveWorkout(),[]),[O,y]=Object(n.useState)(!1),z=k,S=d;Object(n.useEffect)(()=>{p&&m&&m.length===p.length?y(!0):y(!1)},[m,p]);const v=Object(n.useMemo)(()=>m&&0!==m.length?m.length<p.length?Object(c.__)("Continue workout!","wordpress-seo"):Object(c.__)("Do workout again","wordpress-seo"):Object(c.__)("Start workout!","wordpress-seo"),[m,p]),j=Object(n.useCallback)(()=>{b(t),O&&E(t)},[k,O,b,E]),x=Object(i.makeOutboundLink)(),M=h||Object(c.sprintf)(
|
||
|
/* translators: %s : Expands to the add-on name. */
|
||
|
Object(c.__)("Unlock with %s!","wordpress-seo"),"Premium"),B=k?"":" card-disabled";return Object(n.createElement)(n.Fragment,null,!g&&Object(n.createElement)("div",{id:u,className:"card card-small"+B},Object(n.createElement)("h2",null,o," ",w),Object(n.createElement)("h3",null,r),Object(n.createElement)("div",{className:"workout-card-content-flex"},Object(n.createElement)("ul",{id:u+"-usp-list",className:"yoast-list--usp"},a.map((e,t)=>Object(n.createElement)("li",{id:`${u}-usp-${t}`,key:`${u}-${t}`},e))),d&&Object(n.createElement)(S,null)),Object(n.createElement)("span",null,k&&Object(n.createElement)(s.NewButton,{id:u+"-action-button",className:"yoast-button yoast-button--"+(O?"secondary":"primary"),onClick:j},v),!k&&Object(n.createElement)(x,{id:u+"-upsell-button",href:f,className:"yoast-button yoast-button-upsell","data-action":"load-nfd-ctb","data-ctb-id":"f6a84663-465f-4cb5-8ba5-f7a6d72224b2"},M,Object(n.createElement)("span",{"aria-hidden":"true",className:"yoast-button-upsell__caret"})),p&&m&&Object(n.createElement)("div",{className:"workout-card-progress"},Object(n.createElement)(s.ProgressBar,{id:u+"-progress",max:p.length,value:m.length}),Object(n.createElement)("label",{htmlFor:u+"-progress"},Object(n.createElement)("i",null,Object(c.sprintf)(// translators: %1$s: number of finished steps, %2$s: number of finishable steps
|
||
|
Object(c.__)("%1$s/%2$s steps completed","wordpress-seo"),m.length,p.length)))))),k&&g===t&&Object(n.createElement)(z,null))}u.propTypes={name:a.a.string.isRequired,title:a.a.string.isRequired,subtitle:a.a.string.isRequired,usps:a.a.arrayOf(a.a.string).isRequired,id:a.a.string,finishableSteps:a.a.arrayOf(a.a.string),finishedSteps:a.a.arrayOf(a.a.string),image:a.a.func,upsellLink:a.a.string,upsellText:a.a.string,workout:a.a.func,badges:a.a.arrayOf(a.a.element)},u.defaultProps={id:"",finishableSteps:null,finishedSteps:null,image:null,upsellLink:null,upsellText:null,workout:null,badges:[]}},17:function(e,t,o){"use strict";o.d(t,"a",(function(){return r}));var n=o(4);function r(){return Object(n.get)(window,"wpseoScriptData.metabox",{intl:{},isRtl:!1})}},18:function(e,t){e.exports=window.wp.components},2:function(e,t){e.exports=window.yoast.propTypes},20:function(e,t){e.exports=window.wp.compose},210:function(e,t,o){"use strict";o.d(t,"a",(function(){return f}));var n,r=o(0),a=o(2),c=o.n(a),l=o(1),s=o(5),i=o(153),u=o(3);function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function p(e){return u.createElement("svg",d({viewBox:"0 0 296 317",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e),n||(n=u.createElement("g",{transform:"matrix(-1 0 0 1 295.274 .96)",fill:"none"},u.createElement("circle",{fill:"#F0ECF0",cx:131.18,cy:184.261,r:131.18}),u.createElement("g",{fill:"#EAB881"},u.createElement("path",{d:"M236.42 96.56c-.15-.43-.29-.87-.44-1.3.15.43.29.87.44 1.3zm-31.98 59.96a11 11 0 00-2.11.82c.67-.3 1.4-.56 2.11-.82zm-2.11.82a58.65 58.65 0 00-6 2.81c2.67-1.11 4.56-2.11 6-2.81z"}),u.createElement("path",{d:"M293.49 164.27c-8.58-10.51-1.05-27.75-34.52-86.31-3-5.22-5.26-14.52-12.85-17.58-9.11-3.67-12.77-9.16-21.89-12.83-6.85-2.76-4-1.36-3.21-.49 1.49 1.67-2-1.31-5.72 7.13-.38.85 2.86 1.63 4 5 .36 1.07.49 1.14 1.23 1.33 4.71 1.2 6.52 6.89 4.2 10.06-.7-1.43.18-6-4.68-6.36 2 1.44 4.06 3.42 4 5.88 9.4 16.64 17.56 14 20 15 12.43 4.92-17.28 64.57 23 86.13-7.34-1.94-14.31-5.46-23.92-1.33 7.28-5.53 2.46-7.57.86-10.89-2.17-2.92-2.29-11.71-2.6-22.62a103.2 103.2 0 001.09 20.32 54.8 54.8 0 00-38-.12c5.19-1.21 15.45 48.34 20.15 53.9 3.8-1.4 23-8.57 35.17-14.11 21.52-9.81 34.94-25.76 35.44-28.31.24-1.47-.85-2.71-1.75-3.8zm-41.62-99.13c.06.1 8.87 19.59.56 1.21-.2-.44-.38-.84-.56-1.21z"}),u.createElement("path",{d:"M215.17 56.04c.46.17 2 1.49-.23-.93-.88 2.39-.6 4.42 2 6.74 1.06-3 0-3.51-1.77-5.81zm-4.33 23.82c.28-.07.36.05-.35-.38l.35.38z"})),u.createElement("path",{d:"M203.74 73.77c0 .4-.33-.06 2.94 2.38l-2.94-2.38zm5.26 4.27c2.3 2 3.13 2.53 2.19 1.77L209 78.04zm6.17-22c.05.06 1.79 2.31 1.83 2.38-.49-1.27-.83-2.01-1.83-2.38zm-.52 11.73c1.38-.08.73 1.34 2.16-.5.52-.67 1.91-3.21.71-2.6.56-2.33-.09-6.71-.19-4.75-.13 2.46-3.7 10.77-8.67 9.87a7.6 7.6 0 003.25.22c2.74-.39 2.36-.97 2.74-2.24zm-5.99 2.02a6.27 6.27 0 01-1.42-.59c.42.309.906.51 1.42.59z",fill:"#D38053"}),u.createElement("path",{d:"M214.2 69.33a4.13 4.13 0 01-.85 3.73c3.38-1.27 3.66-3.51 2.48-4.78-1.18-1.27-1.34.03-1.63 1.05zm-32.31 1.85c.11.84 2.61 2.33 3.3 2.78a13.33 13.33 0 01-3.3-2.78zm10 4.39c-.21.13-.45.1.31 0-.28-.12-.13-.1-.31 0zm-6.51-1.53a29.79 29.79 0 004.51 2.28c2.54-1.52.8.82-4.51-2.28z",fill:"#D38053"}),u.createElement("path",{d:"M202.61 77.13c-.91.35-5.67.26-10.41-1.57-6.74 1-6.41 12.08-1 12.4 8.18.48 10.11 3 13.48 1.92 6.82-2.28 2.4-11.62-2.07-12.75z",fill:"#EAB881"}),u.createElement("path",{d:"M217.52 64.67a4.92 4.92 0 012.54-.48c4.87.36 4 5 4.68 6.36 2.31-3.16.52-8.86-4.2-10.06-2.25-.57.56-2.91-7.86-7.27a10.79 10.79 0 014.84 11.45zm15.23 112.51c-6.79 1.78-17.9 1.65-21-5.2 3.71 11.1 9 26.86 12.86 37.68 2.88-.89 7.41-1.86 8.89-3.4-3.52-4.16-8.67-10.41-8.74-15.89-.07-5.48 2.92-11.16 7.99-13.19zm-26.31-20.36c-.14.17-.15 0 .53 1.27-.18-.46-.35-.89-.53-1.27z",fill:"#D38053"}),u.createElement("path",{d:"M246.11 86.55c-2.26-3.64-4.21.58 2.23-3.3-10.49 4.56-18.5-2.9-24.34-13.21-.05 1.82-1.23 3.13-2.61 4.36-9.64 8.64-
|
||
|
Object(k.sprintf)(Object(k.__)("%1$sBack to all workouts","worpdress-seo"),"← ")),Object(a.createElement)("div",{className:t?"":"workflows__index"},u))}j.propTypes={activeWorkout:h.a.string.isRequired,clearActiveWorkout:h.a.func.isRequired,openWorkout:h.a.func.isRequired,workouts:h.a.object.isRequired,loading:h.a.bool.isRequired,initWorkouts:h.a.func.isRequired,saveWorkouts:h.a.func.isRequired};const x=function(e){const t=Object(m.cloneDeep)(e);return Object.keys(e).forEach((function(o){e[o].indexablesByStep&&Object.keys(e[o].indexablesByStep).forEach((function(e){t[o].indexablesByStep[e]=t[o].indexablesByStep[e].filter((function(e){return!e.purge}))}))})),t};async function M(e){try{const t=await d()({path:"yoast/v1/workouts",method:"POST",data:x(e)});return await t.json}catch(e){return console.error(e.message),!1}}var B=Object(p.compose)([Object(c.withSelect)(e=>{const t=e("yoast-seo/workouts").getWorkouts(),o=e("yoast-seo/workouts").getLoading(),n=e("yoast-seo/workouts").getActiveWorkout(),r=e("yoast-seo/workouts").getFinishedWorkouts(),a=e("yoast-seo/workouts").getIndexablesByStep;return{workouts:t,loading:o,activeWorkout:n,finishedWorkouts:r,isStepFinished:(e,o)=>t[e].finishedSteps.includes(o),getIndexablesByStep:a}}),Object(c.withDispatch)(e=>{const{finishSteps:t,toggleStep:o,toggleWorkout:n,initWorkouts:r,clearActiveWorkout:a,openWorkout:c,moveIndexables:l,clearIndexablesInSteps:s}=e("yoast-seo/workouts");return{finishSteps:t,toggleStep:o,toggleWorkout:n,initWorkouts:r,clearActiveWorkout:a,openWorkout:c,moveIndexables:l,clearIndexablesInSteps:s,saveWorkouts:M}})])(j);const _="REGISTER_WORKOUT",A="FINISH_STEPS",F="REVISE_STEP",T="TOGGLE_WORKOUT",C="SET_WORKOUTS",W="OPEN_WORKOUT",R="CLEAR_ACTIVE_WORKOUT",L="TOGGLE_STEP",D="MOVE_INDEXABLES",I="CLEAR_INDEXABLES",P="CLEAR_INDEXABLES_IN_STEPS",N=(e,t)=>({type:_,payload:{key:e,priority:t}}),q=(e,t)=>({type:A,workout:e,steps:t}),G=(e,t)=>({type:F,workout:e,step:t}),U=e=>({type:T,workout:e}),K=e=>({type:C,workouts:e}),$=e=>(window.location.hash=e,{type:W,workout:e}),V=()=>(window.location.hash="",{type:R}),X=(e,t)=>({type:L,workout:e,step:t}),H=(e,t,o,n)=>({type:D,workout:e,indexables:t,fromStep:o,toStep:n}),J=e=>({type:I,workout:e}),Q=(e,t)=>({type:P,workout:e,steps:t}),Y=e=>e.workouts,Z=(e,t)=>Object(m.get)(e,`workouts.${t}.finishedSteps`,[]),ee=(e,t,o)=>e.workouts[t].indexablesByStep[o],te=e=>{const t=[];return Object.keys(e.workouts).forEach((function(o){O.a[o]&&e.workouts[o].finishedSteps.length===O.a[o].length&&t.push(o)})),t},oe=e=>e.loading,ne=e=>e.activeWorkout,re={loading:!0,activeWorkout:"",workouts:{cornerstone:{priority:50,finishedSteps:[],indexablesByStep:{[O.b.cornerstone.addLinks]:[],[O.b.cornerstone.checkLinks]:[],[O.b.cornerstone.chooseCornerstones]:[],[O.b.orphaned.improved]:[],[O.b.orphaned.skipped]:[]}},orphaned:{priority:50,finishedSteps:[],indexablesByStep:{[O.b.orphaned.improveRemove]:Object(m.get)(window,"wpseoPremiumWorkoutsData.orphaned",[]),[O.b.orphaned.update]:[],[O.b.orphaned.addLinks]:[],[O.b.orphaned.removed]:[],[O.b.orphaned.noindexed]:[],[O.b.orphaned.improved]:[],[O.b.orphaned.skipped]:[]}}}};var ae=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re,o=arguments.length>1?arguments[1]:void 0;const n=Object(m.cloneDeep)(t);switch(o.type){case _:return n.workouts[o.payload.key]={finishedSteps:[],indexablesByStep:{},...n.workouts[o.payload.key],priority:o.payload.priority},n;case A:return n.workouts[o.workout].finishedSteps=Object(m.union)(t.workouts[o.workout].finishedSteps,o.steps),n;case F:return n.workouts[o.workout].finishedSteps=n.workouts[o.workout].finishedSteps.filter(e=>e!==o.step),n;case L:return t.workouts[o.workout].finishedSteps.includes(o.step)?(e=t.workouts[o.workout].finishedSteps.indexOf(o.step),e>-1&&(n.workouts[o.workout].finishedSteps=t.workouts[o.workout].finishedSteps.slice(),n.workouts[o.workout].finishedSteps.splice(e,1)),n):(n.workouts[o.workout].finishedSteps=Object(m.union)(t.workouts[o.workout].finishedSteps,[o.step]),n);case T:if(O.a[o.workout].length===t.workouts[o.workout].finishedSt
|