1 line
7.7 KiB
JavaScript
1 line
7.7 KiB
JavaScript
(()=>{"use strict";var e,o={20:(e,o,t)=>{var s=t(609),n=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),r=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function a(e,o,t){var s,a={},d=null,l=null;for(s in void 0!==t&&(d=""+t),void 0!==o.key&&(d=""+o.key),void 0!==o.ref&&(l=o.ref),o)i.call(o,s)&&!c.hasOwnProperty(s)&&(a[s]=o[s]);if(e&&e.defaultProps)for(s in o=e.defaultProps)void 0===a[s]&&(a[s]=o[s]);return{$$typeof:n,type:e,key:d,ref:l,props:a,_owner:r.current}}o.jsx=a,o.jsxs=a},175:(e,o,t)=>{var s=t(609),n=t(338);const i=window.wp.components,r=window.wp.primitives;var c=t(848);const a=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})}),d=window.wp.i18n,l=window.wp.apiFetch;var m=t.n(l);const u=({imagesPath:e,redirectUrl:o,data:t,dismissOption:n,isSubscriptionsListing:r})=>{const[l,u]=(0,s.useState)(r),p=(0,s.useRef)(!1),{headerImage:w,heading:b,description:_,primaryButton:g,secondaryButton:h}=t,f=()=>{if(p.current)return;const e="?page=wc-admin"===window.location.search;u(e)};(0,s.useEffect)(()=>{if(r)return;const{pushState:e,replaceState:o}=window.history;window.history.pushState=function(...o){e.apply(window.history,o),window.dispatchEvent(new Event("pushState"))},window.history.replaceState=function(...e){o.apply(window.history,e),window.dispatchEvent(new Event("replaceState"))},window.addEventListener("popstate",f),window.addEventListener("replaceState",f),window.addEventListener("pushState",f),f()},[]);const v=e=>{var t;t=n,m()({path:`/wc/v3/subscriptions/settings/${t}`,method:"post",data:{value:true}}),p.current=!0,"done-btn"!==e?(u(!1),window.removeEventListener("popstate",f),window.removeEventListener("replaceState",f),window.removeEventListener("pushState",f)):window.location.href=o};return l?(0,c.jsx)("div",{className:"woocommerce-subscriptions-announcement",children:(0,c.jsx)("div",{className:"woocommerce-subscriptions-announcement__container",children:(0,c.jsxs)(i.Card,{className:"woocommerce-tour-kit-step",elevation:2,children:[(0,c.jsx)(i.CardHeader,{isBorderless:!0,size:"small",className:"woocommerce-tour-kit-step__header",children:(0,c.jsx)(i.Flex,{className:"woocommerce-tour-kit-step-controls",justify:"flex-end",children:(0,c.jsx)(i.Button,{className:"woocommerce-tour-kit-step-controls__close-btn",label:(0,d.__)("Close","woocommerce-subscriptions"),icon:(0,c.jsx)(i.Icon,{icon:a,viewBox:"6 4 12 14"}),iconSize:16,onClick:()=>v("close-btn")})})}),w&&(0,c.jsx)(i.CardMedia,{className:"woocommerce-tour-kit-step__header-image",children:(0,c.jsx)("img",{src:e+"/"+w,alt:(0,d.__)("Step image","woocommerce-subscriptions")})}),(0,c.jsxs)(i.CardBody,{className:"woocommerce-tour-kit-step__body",size:"small",children:[(0,c.jsx)("h2",{className:"woocommerce-tour-kit-step__heading",children:b}),(0,c.jsx)("p",{className:"woocommerce-tour-kit-step__description",dangerouslySetInnerHTML:{__html:_}})]}),(0,c.jsx)(i.CardFooter,{isBorderless:!0,size:"small",children:(0,c.jsx)("div",{className:"woocommerce-tour-kit-step-navigation",children:(0,c.jsxs)("div",{children:[(0,c.jsx)(i.Button,{className:"woocommerce-tour-kit-step-navigation__back-btn",variant:"tertiary",onClick:()=>v("close-btn"),children:h.text||(0,d.__)("Close","woocommerce-subscriptions")}),(0,c.jsx)(i.Button,{className:"woocommerce-tour-kit-step-navigation__next-btn",variant:"primary",disabled:g.isDisabled,onClick:()=>v("done-btn"),children:g.text||(0,d.__)("Done","woocommerce-subscriptions")})]})})})]})})}):null};if(window?.wcsDownloadsSettings?.isStandaloneDownloadsEnabled){const{imagesPath:e,pluginsUrl:o,isSubscriptionsListing:t,isStandaloneDownloadsEnabled:s}=window.wcsDownloadsSettings,i=(0,n.H)(document.getElementById("wcs-downloads-welcome-announcement-root")),r=(()=>{const e=(0,d.__)("WooCommerce Subscription Downloads is now part of WooCommerce Subscriptions","woocommerce-subscriptions"),o=`${(0,d.__)("No separate extension required! WooCommerce Subscriptions now allows you to include simple and variable products with your subscriptions. And to make it easier, you can now configure which simple and variable products to include when creating a subscription product.","woocommerce-subscriptions")}\n\t\t<br /><br />\n\t\t${(0,d.__)("The WooCommerce Subscription Downloads extension can now be disabled via Plugins.","woocommerce-subscriptions")}`,t=(0,d.__)("Go to plugins","woocommerce-subscriptions");return{name:"gifting-announcement",heading:e,headerImage:"gifting-modal-icon.svg",description:o,secondaryButton:{text:(0,d.__)("Maybe later","woocommerce-subscriptions")},primaryButton:{text:t}}})();i.render((0,c.jsx)(u,{imagesPath:e,data:r,dismissOption:"woocommerce_subscriptions_downloads_is_welcome_announcement_dismissed",redirectUrl:o,isSubscriptionsListing:!!t}))}const p=(0,n.H)(document.getElementById("wcs-gifting-welcome-announcement-root")),w=(e=>{const o=e?(0,d.__)("Gifting is now part of WooCommerce Subscriptions","woocommerce-subscriptions"):(0,d.__)("Introducing subscription gifting","woocommerce-subscriptions"),t=e?`${(0,d.__)("No separate extension needed! The built-in gifting feature is fully compatible with product, cart and checkout blocks, plus you can now choose which subscription products can be gifted.","woocommerce-subscriptions")}\n\t\t\t<br /><br />\n\t\t\t${(0,d.__)("The Gifting for WooCommerce Subscriptions extension can now be disabled via Plugins.","woocommerce-subscriptions")}`:(0,d.__)("Let your shoppers purchase subscriptions as gifts using the new built-in gifting feature in WooCommerce Subscriptions. It works seamlessly with product, cart and checkout blocks, and can be enabled storewide or managed per product.","woocommerce-subscriptions"),s=e?(0,d.__)("Go to plugins","woocommerce-subscriptions"):(0,d.__)("Set up gifting","woocommerce-subscriptions");return{name:"gifting-announcement",heading:o,headerImage:"gifting-modal-icon.svg",description:t,secondaryButton:{text:(0,d.__)("Maybe later","woocommerce-subscriptions")},primaryButton:{text:s}}})(window.wcsGiftingSettings.isStandaloneGiftingEnabled),{imagesPath:b,pluginsUrl:_,subscriptionsUrl:g,isStandaloneGiftingEnabled:h,isSubscriptionsListing:f}=window.wcsGiftingSettings;p.render((0,c.jsx)(u,{imagesPath:b,data:w,dismissOption:"woocommerce_subscriptions_gifting_is_welcome_announcement_dismissed",redirectUrl:h?_:g,isSubscriptionsListing:!!f}))},338:(e,o,t)=>{var s=t(795);o.H=s.createRoot,s.hydrateRoot},609:e=>{e.exports=window.React},795:e=>{e.exports=window.ReactDOM},848:(e,o,t)=>{e.exports=t(20)}},t={};function s(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,s),i.exports}s.m=o,e=[],s.O=(o,t,n,i)=>{if(!t){var r=1/0;for(l=0;l<e.length;l++){for(var[t,n,i]=e[l],c=!0,a=0;a<t.length;a++)(!1&i||r>=i)&&Object.keys(s.O).every(e=>s.O[e](t[a]))?t.splice(a--,1):(c=!1,i<r&&(r=i));if(c){e.splice(l--,1);var d=n();void 0!==d&&(o=d)}}return o}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[t,n,i]},s.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return s.d(o,{a:o}),o},s.d=(e,o)=>{for(var t in o)s.o(o,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},s.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={884:0,15:0};s.O.j=o=>0===e[o];var o=(o,t)=>{var n,i,[r,c,a]=t,d=0;if(r.some(o=>0!==e[o])){for(n in c)s.o(c,n)&&(s.m[n]=c[n]);if(a)var l=a(s)}for(o&&o(t);d<r.length;d++)i=r[d],s.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return s.O(l)},t=globalThis.webpackChunkwoocommerce_subscriptions=globalThis.webpackChunkwoocommerce_subscriptions||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})();var n=s.O(void 0,[15],()=>s(175));n=s.O(n)})(); |