woocommerce-subscriptions/build/gifting-welcome-announcemen...

1 line
5.7 KiB
JavaScript

(()=>{"use strict";var e,o={20:(e,o,t)=>{var s=t(609),r=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),n=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={},l=null,m=null;for(s in void 0!==t&&(l=""+t),void 0!==o.key&&(l=""+o.key),void 0!==o.ref&&(m=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:r,type:e,key:l,ref:m,props:a,_owner:n.current}}o.jsx=a,o.jsxs=a},338:(e,o,t)=>{var s=t(795);o.H=s.createRoot,s.hydrateRoot},609:e=>{e.exports=window.React},736:(e,o,t)=>{var s=t(609),r=t(338);const i=window.wp.components,n=window.wp.element,c=window.wp.primitives,a=(0,n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(c.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"})),l=window.wp.i18n,m=window.wp.apiFetch;var d=t.n(m),u=t(848);const p=({imagesPath:e,redirectUrl:o,data:t,dismissOption:r})=>{const[n,c]=(0,s.useState)(!0),{headerImage:m,heading:p,description:w,primaryButton:_,secondaryButton:b}=t,g=e=>{var t;t=r,d()({path:`/wc/v3/subscriptions/settings/${t}`,method:"post",data:{value:true}}),"done-btn"!==e?c(!1):window.location.href=o};return n?(0,u.jsx)("div",{className:"woocommerce-subscriptions-announcement",children:(0,u.jsx)("div",{className:"woocommerce-subscriptions-announcement__container",children:(0,u.jsxs)(i.Card,{className:"woocommerce-tour-kit-step",elevation:2,children:[(0,u.jsx)(i.CardHeader,{isBorderless:!0,size:"small",className:"woocommerce-tour-kit-step__header",children:(0,u.jsx)(i.Flex,{className:"woocommerce-tour-kit-step-controls",justify:"flex-end",children:(0,u.jsx)(i.Button,{className:"woocommerce-tour-kit-step-controls__close-btn",label:(0,l.__)("Close","woocommerce-subscriptions"),icon:(0,u.jsx)(i.Icon,{icon:a,viewBox:"6 4 12 14"}),iconSize:16,onClick:()=>g("close-btn")})})}),m&&(0,u.jsx)(i.CardMedia,{className:"woocommerce-tour-kit-step__header-image",children:(0,u.jsx)("img",{src:e+"/"+m,alt:(0,l.__)("Step image","woocommerce-subscriptions")})}),(0,u.jsxs)(i.CardBody,{className:"woocommerce-tour-kit-step__body",size:"small",children:[(0,u.jsx)("h2",{className:"woocommerce-tour-kit-step__heading",children:p}),(0,u.jsx)("p",{className:"woocommerce-tour-kit-step__description",dangerouslySetInnerHTML:{__html:w}})]}),(0,u.jsx)(i.CardFooter,{isBorderless:!0,size:"small",children:(0,u.jsx)("div",{className:"woocommerce-tour-kit-step-navigation",children:(0,u.jsxs)("div",{children:[(0,u.jsx)(i.Button,{className:"woocommerce-tour-kit-step-navigation__back-btn",variant:"tertiary",onClick:()=>g("close-btn"),children:b.text||(0,l.__)("Close","woocommerce-subscriptions")}),(0,u.jsx)(i.Button,{className:"woocommerce-tour-kit-step-navigation__next-btn",variant:"primary",disabled:_.isDisabled,onClick:()=>g("done-btn"),children:_.text||(0,l.__)("Done","woocommerce-subscriptions")})]})})})]})})}):null},w=(0,r.H)(document.getElementById("wcs-gifting-welcome-announcement-root")),_=(e=>{const o=e?(0,l.__)("Gifting is now part of WooCommerce Subscriptions","woocommerce-subscriptions"):(0,l.__)("Introducing subscription gifting","woocommerce-subscriptions"),t=e?`${(0,l.__)("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,l.__)("The Gifting for WooCommerce Subscriptions extension can now be disabled via Plugins.","woocommerce-subscriptions")}`:(0,l.__)("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,l.__)("Go to plugins","woocommerce-subscriptions"):(0,l.__)("Set up gifting","woocommerce-subscriptions");return{name:"gifting-announcement",heading:o,headerImage:"gifting-modal-icon.svg",description:t,secondaryButton:{text:(0,l.__)("Maybe later","woocommerce-subscriptions")},primaryButton:{text:s}}})(window.wcsGiftingSettings.isStandaloneGiftingEnabled),{imagesPath:b,pluginsUrl:g,subscriptionsUrl:h,isStandaloneGiftingEnabled:f}=window.wcsGiftingSettings;w.render((0,u.jsx)(p,{imagesPath:b,data:_,dismissOption:"woocommerce_subscriptions_gifting_is_welcome_announcement_dismissed",redirectUrl:f?g:h}))},795:e=>{e.exports=window.ReactDOM},848:(e,o,t)=>{e.exports=t(20)}},t={};function s(e){var r=t[e];if(void 0!==r)return r.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,s),i.exports}s.m=o,e=[],s.O=(o,t,r,i)=>{if(!t){var n=1/0;for(m=0;m<e.length;m++){for(var[t,r,i]=e[m],c=!0,a=0;a<t.length;a++)(!1&i||n>=i)&&Object.keys(s.O).every((e=>s.O[e](t[a])))?t.splice(a--,1):(c=!1,i<n&&(n=i));if(c){e.splice(m--,1);var l=r();void 0!==l&&(o=l)}}return o}i=i||0;for(var m=e.length;m>0&&e[m-1][2]>i;m--)e[m]=e[m-1];e[m]=[t,r,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={716:0,601:0};s.O.j=o=>0===e[o];var o=(o,t)=>{var r,i,[n,c,a]=t,l=0;if(n.some((o=>0!==e[o]))){for(r in c)s.o(c,r)&&(s.m[r]=c[r]);if(a)var m=a(s)}for(o&&o(t);l<n.length;l++)i=n[l],s.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return s.O(m)},t=globalThis.webpackChunkwoocommerce_subscriptions=globalThis.webpackChunkwoocommerce_subscriptions||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})();var r=s.O(void 0,[601],(()=>s(736)));r=s.O(r)})();