Files
medicalalert-web-reloaded/wp/wp-content/plugins/wordpress-seo-premium/assets/js/dist/manage-ai-consent-button-2290.min.js
2024-09-25 09:25:31 -04:00

6 lines
15 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{var e={951:(e,t)=>{var s;!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var n=typeof s;if("string"===n||"number"===n)e.push(s);else if(Array.isArray(s)){if(s.length){var i=r.apply(null,s);i&&e.push(i)}}else if("object"===n){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){e.push(s.toString());continue}for(var o in s)a.call(s,o)&&s[o]&&e.push(o)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(s=function(){return r}.apply(t,[]))||(e.exports=s)}()}},t={};function s(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,s),n.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React,t=window.wp.data,a=window.wp.domReady;var r=s.n(a);const n=window.wp.element,i=window.yoast.uiLibrary;var o=s(951),l=s.n(o);const c=window.lodash,m=window.yoast.reduxJsToolkit,u="adminUrl",d=(0,m.createSlice)({name:u,initialState:"",reducers:{setAdminUrl:(e,{payload:t})=>t}}),y=(d.getInitialState,{selectAdminUrl:e=>(0,c.get)(e,u,"")});y.selectAdminLink=(0,m.createSelector)([y.selectAdminUrl,(e,t)=>t],((e,t)=>{try{return new URL(t,e).href}catch(t){return e}})),d.actions,d.reducer;const p=window.wp.apiFetch;var w=s.n(p);const g="hasConsent",v=`${g}/storeConsent`,h=(0,m.createSlice)({name:g,initialState:!1,reducers:{giveAiGeneratorConsent:(e,{payload:t})=>t}}),f=h.getInitialState,E={selectHasAiGeneratorConsent:e=>(0,c.get)(e,g,!1)},b={...h.actions,storeAiGeneratorConsent:function*(e){try{yield{type:v,payload:e}}catch(e){return!1}return yield{type:`${g}/giveAiGeneratorConsent`,payload:e},!0}},x={[v]:({payload:e})=>w()({path:"yoast/v1/ai_generator/consent",method:"POST",data:{consent:e},parse:!1})},k=h.reducer,S="pluginUrl",C=(0,m.createSlice)({name:S,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),N=C.getInitialState,P={selectPluginUrl:e=>(0,c.get)(e,S,"")};P.selectImageLink=(0,m.createSelector)([P.selectPluginUrl,(e,t,s="assets/images")=>s,(e,t)=>t],((e,t,s)=>[(0,c.trimEnd)(e,"/"),(0,c.trim)(t,"/"),(0,c.trimStart)(s,"/")].join("/")));const _=C.actions,R=C.reducer,L=window.wp.url,A="linkParams",$=(0,m.createSlice)({name:A,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),I=$.getInitialState,q={selectLinkParam:(e,t,s={})=>(0,c.get)(e,`${A}.${t}`,s),selectLinkParams:e=>(0,c.get)(e,A,{})};q.selectLink=(0,m.createSelector)([q.selectLinkParams,(e,t)=>t],((e,t)=>(0,L.addQueryArgs)(t,e)));const B=$.actions,M=$.reducer,O="request",G="success",T="error",j="idle",W="loading",U="showPlay",F="askPermission",D="isPlaying",Y="wistiaEmbedPermission",z=(0,m.createSlice)({name:Y,initialState:{value:!1,status:j,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${Y}/${O}`,(e=>{e.status=W})),e.addCase(`${Y}/${G}`,((e,{payload:t})=>{e.status="success",e.value=Boolean(t&&t.value)})),e.addCase(`${Y}/${T}`,((e,{payload:t})=>{e.status="error",e.value=Boolean(t&&t.value),e.error={code:(0,c.get)(t,"error.code",500),message:(0,c.get)(t,"error.message","Unknown")}}))}}),H=z.getInitialState,V={selectWistiaEmbedPermission:e=>(0,c.get)(e,Y,{value:!1,status:j}),selectWistiaEmbedPermissionValue:e=>(0,c.get)(e,[Y,"value"],!1),selectWistiaEmbedPermissionStatus:e=>(0,c.get)(e,[Y,"status"],j),selectWistiaEmbedPermissionError:e=>(0,c.get)(e,[Y,"error"],{})},J={...z.actions,setWistiaEmbedPermission:function*(e){yield{type:`${Y}/${O}`};try{return yield{type:Y,payload:e},{type:`${Y}/${G}`,payload:{value:e}}}catch(t){return{type:`${Y}/${T}`,payload:{error:t,value:e}}}}},Q={[Y]:async({payload:e})=>w()({path:"/yoast/v1/wistia_embed_permission",method:"POST",data:{value:Boolean(e)}})},K=z.reducer,X=window.yoast.propTypes;var Z=s.n(X);const ee=e.forwardRef((function(t,s){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},t),e.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))})),te=window.wp.i18n,se=({onGiveConsent:t,learnMoreLink:s,privacyPolicyLink:a,termsOfServiceLink:r,thumbnail:o,wistiaEmbedPermission:l})=>{const{onClose:c,initialFocus:m}=(0,i.useModalContext)(),[u,d]=(0,i.useToggleState)(!1),y=(0,n.useCallback)((()=>{c(),t(!0)}),[t,c]),p=(0,n.createInterpolateElement)((0,te.sprintf)(/* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */ /* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */
(0,te.__)("I approve the %1$sTerms of Service%2$s & %3$sPrivacy Policy%4$s of the Yoast AI service. This includes consenting to the collection and use of data to improve user experience.","wordpress-seo-premium"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,e.createElement)(ae,{href:r}),a2:(0,e.createElement)(ae,{href:a})});return(0,e.createElement)("div",{className:"yst-flex yst-flex-col yst-items-center yst-p-10"},(0,e.createElement)("div",{className:"yst-relative yst-w-full"},(0,e.createElement)(ne,{videoId:"vmrahpfjxp",thumbnail:o,wistiaEmbedPermission:l}),(0,e.createElement)(i.Badge,{className:"yst-absolute yst-top-0 yst-right-2 yst-mt-2 yst-ml-2",variant:"info"},"Beta")),(0,e.createElement)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium"},(0,e.createElement)("span",{className:"yst-introduction-modal-uppercase"},(0,te.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */
(0,te.__)("New to %1$s","wordpress-seo-premium"),"Yoast SEO Premium"))," ",(0,e.createElement)("span",{className:"yst-uppercase yst-text-slate-700"},"21.0")),(0,e.createElement)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center"},(0,e.createElement)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium"},(0,te.__)("Generate titles & descriptions with Yoast AI!","wordpress-seo-premium")),(0,e.createElement)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm"},(0,n.createInterpolateElement)((0,te.sprintf)(/* translators: %1$s and %2$s are anchor tag; %3$s is the arrow icon. */ /* translators: %1$s and %2$s are anchor tag; %3$s is the arrow icon. */
(0,te.__)("Speed up your workflow with generative AI. Get high-quality title and description suggestions for your search and social appearance. %1$sLearn more%2$s%3$s","wordpress-seo-premium"),"<a>","<ArrowNarrowRightIcon />","</a>"),{a:(0,e.createElement)(ae,{href:s,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,e.createElement)(ee,{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})}))),(0,e.createElement)("div",{className:"yst-flex yst-w-full yst-mt-6"},(0,e.createElement)("hr",{className:"yst-w-full yst-text-gray-200"})),(0,e.createElement)("div",{className:"yst-flex yst-items-start yst-mt-4"},(0,e.createElement)("input",{type:"checkbox",id:"yst-ai-consent-checkbox",name:"yst-ai-consent-checkbox",checked:u,value:u?"true":"false",onChange:d,className:"yst-checkbox__input",ref:m}),(0,e.createElement)("label",{htmlFor:"yst-ai-consent-checkbox",className:"yst-label yst-checkbox__label yst-text-xs yst-font-normal yst-text-slate-500"},p)),(0,e.createElement)("div",{className:"yst-w-full yst-flex yst-mt-4"},(0,e.createElement)(i.Button,{as:"button",className:"yst-grow",size:"large",disabled:!u,onClick:y},(0,te.__)("Start generating","wordpress-seo-premium"))),(0,e.createElement)(i.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:c},(0,te.__)("Close","wordpress-seo-premium")))};se.propTypes={onGiveConsent:Z().func.isRequired,learnMoreLink:Z().string.isRequired,privacyPolicyLink:Z().string.isRequired,termsOfServiceLink:Z().string.isRequired,thumbnail:Z().shape({src:Z().string.isRequired,width:Z().string,height:Z().string}).isRequired,wistiaEmbedPermission:Z().shape({value:Z().bool.isRequired,status:Z().string.isRequired,set:Z().func.isRequired}).isRequired};const ae=({href:t,children:s,...a})=>(0,e.createElement)(i.Link,{target:"_blank",rel:"noopener noreferrer",...a,href:t},s,(0,e.createElement)("span",{className:"yst-sr-only"},/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
(0,te.__)("(Opens in a new browser tab)","wordpress-seo-premium")));ae.propTypes={href:Z().string.isRequired,children:Z().node},ae.defaultProps={children:null};const re=window.yoast.reactHelmet,ne=({videoId:t,thumbnail:s,wistiaEmbedPermission:a})=>{const[r,o]=(0,n.useState)(a.value?D:U),l=(0,n.useCallback)((()=>o(D)),[o]),c=(0,n.useCallback)((()=>{a.value?l():o(F)}),[a.value,l,o]),m=(0,n.useCallback)((()=>o(U)),[o]),u=(0,n.useCallback)((()=>{a.set(!0),l()}),[a.set,l]);return(0,e.createElement)(n.Fragment,null,a.value&&(0,e.createElement)(re.Helmet,null,(0,e.createElement)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})),(0,e.createElement)("div",{className:"yst-relative yst-w-full yst-h-0 yst-pt-[56.25%] yst-overflow-hidden yst-rounded-md yst-drop-shadow-md yst-bg-white"},r===U&&(0,e.createElement)("button",{className:"yst-absolute yst-inset-0 yst-button yst-p-0 yst-border-none yst-bg-white yst-transition-opacity yst-duration-1000 yst-opacity-100",onClick:c},(0,e.createElement)("img",{className:"yst-w-full yst-h-auto",alt:"",loading:"lazy",decoding:"async",...s})),r===F&&(0,e.createElement)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white"},(0,e.createElement)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center"},a.status===W&&(0,e.createElement)(i.Spinner,null),a.status!==W&&(0,te.sprintf)(/* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */ /* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */
(0,te.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo-premium"),"Yoast SEO","Wistia")),(0,e.createElement)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4"},(0,e.createElement)(i.Button,{type:"button",variant:"secondary",onClick:m,disabled:a.status===W},(0,te.__)("Deny","wordpress-seo-premium")),(0,e.createElement)(i.Button,{type:"button",variant:"primary",onClick:u,disabled:a.status===W},(0,te.__)("Allow","wordpress-seo-premium")))),a.value&&r===D&&(0,e.createElement)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-left-0"},null===t&&(0,e.createElement)(i.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==t&&(0,e.createElement)("div",{className:`wistia_embed wistia_async_${t} videoFoam=true`}))))};ne.propTypes={videoId:Z().string.isRequired,thumbnail:Z().shape({src:Z().string.isRequired,width:Z().string,height:Z().string}).isRequired,wistiaEmbedPermission:Z().shape({value:Z().bool.isRequired,status:Z().string.isRequired,set:Z().func.isRequired}).isRequired};const ie="yoast-seo-premium/manage-ai-consent-button",oe=({onStartGenerating:s})=>{const a=(0,t.useSelect)((e=>e(ie).selectLink("https://yoa.st/ai-generator-terms-of-service")),[]),r=(0,t.useSelect)((e=>e(ie).selectLink("https://yoa.st/ai-generator-privacy-policy")),[]),i=(0,t.useSelect)((e=>e(ie).selectLink("https://yoa.st/ai-generator-learn-more")),[]),o=(0,t.useSelect)((e=>e(ie).selectImageLink("ai-generator-preview.png","images")),[]),l=(0,n.useMemo)((()=>({src:o,width:"432",height:"244"})),[o]),c=(0,t.useSelect)((e=>e(ie).selectWistiaEmbedPermissionValue()),[]),m=(0,t.useSelect)((e=>e(ie).selectWistiaEmbedPermissionStatus()),[]),{setWistiaEmbedPermission:u}=(0,t.useDispatch)(ie),d=(0,n.useMemo)((()=>({value:c,status:m,set:u})),[c,m,u]),{storeAiGeneratorConsent:y}=(0,t.useDispatch)(ie),p=(0,n.useCallback)((()=>{y(!0),s()}),[y,s]);return(0,e.createElement)(se,{imageLink:o,onGiveConsent:p,learnMoreLink:i,termsOfServiceLink:a,privacyPolicyLink:r,thumbnail:l,wistiaEmbedPermission:d})};oe.propTypes={onStartGenerating:Z().func.isRequired};const le=e.forwardRef((function(t,s){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},t),e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))})),ce=({onClose:s})=>{const{storeAiGeneratorConsent:a}=(0,t.useDispatch)(ie),[r,o]=(0,n.useState)(!1),[l,c]=(0,n.useState)(!1),m=(0,n.useCallback)((async()=>{if(c(!1),o(!0),!1===await a(!1))return c(!0),void o(!1);s(),o(!1)}),[a,o,s]);return(0,e.createElement)("div",{className:"yst-flex yst-flex-row"},(0,e.createElement)("span",{className:"yst-shrink-0 yst-h-12 yst-w-12 yst-rounded-full yst-flex yst-justify-center yst-items-center yst-mb-3 yst-mr-5 yst-bg-red-100"},(0,e.createElement)(le,{className:"yst-w-6 yst-h-6 yst-align-center yst-text-red-600"})),(0,e.createElement)("div",null,(0,e.createElement)(i.Modal.Title,{className:"yst-font-semibold",as:"h3",size:"4"},(0,te.__)("Revoke AI consent","wordpress-seo-premium")),l&&(0,e.createElement)(i.Alert,{className:"yst-mt-2",variant:"error"},(0,te.__)("Something went wrong, please try again later.","wordpress-seo-premium")),(0,e.createElement)("p",{className:"yst-mt-2 yst-text-slate-600"},(0,te.__)("By revoking your consent, you will no longer have access to Yoast AI features. Are you sure you want to revoke your consent?","wordpress-seo-premium")),(0,e.createElement)("footer",{className:"yst-mt-6 sm:yst-flex sm:yst-flex-row-reverse"},(0,e.createElement)(i.Button,{variant:"error",isLoading:r,className:"yst-w-full sm:yst-w-auto yst-revoke-button",onClick:m},(0,te.__)("Yes, revoke consent","wordpress-seo-premium")),(0,e.createElement)(i.Button,{variant:"secondary",className:"yst-w-full sm:yst-w-auto yst-mr-3",onClick:s},(0,te.__)("Close","wordpress-seo-premium")))))};ce.propTypes={onClose:Z().func.isRequired};const me=(e={})=>{(0,t.register)((e=>(0,t.createReduxStore)(ie,{actions:{...b,..._,...B,...J},selectors:{...E,...P,...q,...V},initialState:(0,c.merge)({},{[g]:f(),[S]:N(),[A]:I(),[Y]:H()},e),reducer:(0,t.combineReducers)({[g]:k,[S]:R,[A]:M,[Y]:K}),controls:{...x,...Q}}))(e))};r()((()=>{const s=(0,c.get)(window,"yoast.editorModules.sharedAdmin.store.WISTIA_EMBED_PERMISSION_NAME","wistiaEmbedPermission");me({[g]:"1"===(0,c.get)(window,"wpseoPremiumManageAiConsentButton.hasConsent",!1),[S]:(0,c.get)(window,"wpseoPremiumManageAiConsentButton.pluginUrl",""),[s]:{value:"1"===(0,c.get)(window,"wpseoPremiumManageAiConsentButton.wistiaEmbedPermission",!1)}});const a=document.getElementById("ai-generator-consent");a&&(0,n.render)((0,e.createElement)((()=>{const s=(0,t.useSelect)((e=>e(ie).selectHasAiGeneratorConsent()),[]),[a,,,r,o]=(0,i.useToggleState)(!1),c=(0,n.useRef)(null),m=(0,n.useCallback)((e=>{e.preventDefault(),r()}),[r]);return(0,e.createElement)(n.Fragment,null,(0,e.createElement)(i.Modal,{className:"yst-introduction-modal",isOpen:a,onClose:o,initialFocus:c},(0,e.createElement)(i.Modal.Panel,{className:l()(!s&&"yst-p-0 yst-introduction-modal-panel yst-max-w-lg yst-rounded-3xl",s&&"yst-max-w-xl yst-rounded-lg")},!s&&(0,e.createElement)(oe,{onStartGenerating:o,focusElementRef:c}),s&&(0,e.createElement)(ce,{onClose:o}))),(0,e.createElement)("button",{className:"button",id:"ai-generator-consent-button",onClick:m},(s?"Revoke":"Grant")+" consent"))}),null),a)}))})()})();