diff --git a/build/2.3.0/377.js b/build/2.3.0/377.js index 38d677d03..f708a6ce2 100644 --- a/build/2.3.0/377.js +++ b/build/2.3.0/377.js @@ -1 +1 @@ -(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[377],{5706:(e,t)=>{(()=>{var e={537:(e,t)=>{!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{NewfoldRuntime:function(){return a}});var o=window.wp.url;const a={hasCapability:e=>!0===window.NewfoldRuntime?.capabilities[e],adminUrl:e=>window.NewfoldRuntime?.admin_url+e,createApiUrl:(e,t={})=>(0,o.addQueryArgs)(window.NewfoldRuntime?.base_url,{rest_route:e,...t}),get siteDetails(){return window.NewfoldRuntime?.site},get sdk(){return window.NewfoldRuntime?.sdk},get isWoo(){return window.NewfoldRuntime?.isWoocommerceActive},get ecommerce(){return window.NewfoldRuntime?.ecommerce},get plugin(){return window.NewfoldRuntime?.plugin},get wpversion(){return window.NewfoldRuntime?.wpversion},get siteTitle(){return window.NewfoldRuntime?.siteTitle}};var r=t;for(var i in n)r[i]=n[i];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})}()},967:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function a(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";o.r(a),o.d(a,{FacebookConnectButton:()=>p,FacebookConnectPluginView:()=>f,facebookConnectHelper:()=>m,getFacebookUserProfileDetails:()=>l});const e=window.React,t=window.wp.components,n=window.wp.apiFetch;var r=o.n(n),i=o(537);const c={facebook_module:{base_url:"https://graph.facebook.com/v18.0",debug_token:"/debug_token",token_phrase:"secret_token_phrase"},wordpress:{access:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/hiive"),fb_token:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/fb_token"),facebook_details:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/details"),facebook_logout:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/logout")},cf_worker:{login_screen:"https://hiive.cloud/workers/facebook-connect/",get_token:"https://hiive.cloud/workers/facebook-connect/get/token?hiive_token=",delete_token:"https://hiive.cloud/workers/facebook-connect/delete/token?hiive_token="}},l=()=>r()({url:c.wordpress.facebook_details}).then((e=>{if(e?.details?.error)throw{message:"failed to load the data",error:e?.details?.error};return e?.details})).catch((e=>{throw{message:"failed to load the data",errorMsg:e}})),s=window.wp.i18n;var d=o(967),u=o.n(d);const p=({className:n,children:o,showData:a,onConnect:i,onDisconnect:d,onFailure:p,onClick:f})=>{const[m,w]=(0,e.useState)(""),[b,g]=(0,e.useState)(!1),[_,h]=(0,e.useState)([]),[k,v]=(0,e.useState)(!1);function y(e){var t;e.origin.search("https://hiive.cloud")<0||(v(!0),window.removeEventListener("message",y),(t=e.data,r()({url:`${c.wordpress.fb_token}`,data:t,method:"POST"})).then((e=>{E()})).catch((()=>v(!1))))}const E=()=>{l().then((e=>{"token not found!"!==e&&(g(!0),h(e),v(!1),"function"==typeof i&&i(e))})).catch((()=>r()({url:c.wordpress.access}).then((e=>{l().then((e=>{"token not found!"!==e&&(g(!0),h(e),"function"==typeof i&&i(e)),v(!1)})).catch((e=>{v(!1),"function"==typeof p&&p(e),console.error(e)})),w(e.token)})).catch((e=>{v(!1),"function"==typeof p&&p(e),console.error(e)}))))};return(0,e.useEffect)((()=>{!m&&r()({url:c.wordpress.access}).then((e=>{e.token&&w(e.token)})),E()}),[]),(0,e.createElement)("div",null,b?(0,e.createElement)("div",null,(0,e.createElement)(t.Button,{className:u()("nfd-facebook-button--connected",`${n}--connected`)},(0,s.__)("Connected","wp-module-facebook")),a&&(0,e.createElement)("div",null,_?.map((t=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ul",{style:{paddingTop:"20px"}},(0,e.createElement)("li",null,(0,e.createElement)("p",null,"Facebook ID: ",t?.User?.profile?.id)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"User Name: ",t?.User?.profile?.name)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"User Email: ",t?.User?.profile?.email)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"Profile pic:",t?.User?.profile?.picture?.data?.url))),(0,e.createElement)("img",{src:`https://graph.facebook.com/${t?.id}/picture?type=small`,height:t?.picture?.height,width:t?.picture?.width})))))):(0,e.createElement)(t.Button,{type:"submit",disabled:k,className:u()("nfd-facebook-button--connect",`${n}--connect`),onClick:()=>(window.open(`${c.cf_worker.login_screen}?token_hiive=${m}&redirect=${window.location.href}`,"ModalPopUp",`toolbar=no,scrollbars=no,location=no,width=${window.innerWidth/2+200},height=${window.innerHeight/2+200},top=200,left=200`),window.addEventListener("message",y,!1),void("function"==typeof f&&f()))},o,(0,s.__)("Connect Facebook","wp-module-facebook"),k&&(0,e.createElement)(t.Spinner,null)))},f=({fbLogin:n,loginInfo:o,getFbDetails:a})=>{const[i,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>l(!1)),[]),n&&(0,e.createElement)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:"20px"}},(0,e.createElement)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"30px",width:"30px",fill:"#405795",viewBox:"0 0 24 24",style:{marginRight:"10px"}},(0,e.createElement)("path",{d:"M22.675 0h-21.35c-.732 0-1.325.593-1.325 1.325v21.351c0 .731.593 1.324 1.325 1.324h11.495v-9.294h-3.128v-3.622h3.128v-2.671c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.795.143v3.24l-1.918.001c-1.504 0-1.795.715-1.795 1.763v2.313h3.587l-.467 3.622h-3.12v9.293h6.116c.73 0 1.323-.593 1.323-1.325v-21.35c0-.732-.593-1.325-1.325-1.325z"})),(0,e.createElement)("p",{style:{fontSize:"0.9rem",fontWeight:"600",paddingLeft:"15px"}},"Facebook -",(0,e.createElement)("span",{style:{fontWeight:"normal"}},o?.user?.profile?.email))),i?(0,e.createElement)(t.Spinner,null):(0,e.createElement)("button",{style:{color:"#286BDE"},onClick:()=>(async()=>{l(!0),await r()({url:c.wordpress.facebook_logout}).then((e=>e)).catch((e=>{throw{message:"failed to load the data",errorMsg:e}})).then((()=>{a()})),l(!1)})()},"Disconnect"))},m=async e=>{let t="",n=null,o=[];const a=()=>r()({url:c.wordpress.access}).then((e=>{r()({url:`${c.wordpress.fb_token}`,headers:{method:"GET","content-type":"application/json","Accept-Encoding":"gzip, deflate, br","Access-Control-Allow-Origin":"*"}}).then((e=>{var t;e.token&&(t=e.token,r()({url:c.wordpress.settings,method:"post",data:{fb_token:t}}).then((e=>e)).catch((e=>{console.error(e)})),n=e.token)})).catch((e=>{console.error(e)})),t=e.token})).catch((e=>{console.error(e)}));await a(),await r()({url:c.wordpress.fb_token}).then((async r=>{if(r?.fb_token)await l().then((e=>(n=r.fb_token,o=[e],o)));else{const n=window.open(`${c.cf_worker.login_screen}?token_hiive=${t}&redirect=${window.location.href}`,"ModalPopUp",`toolbar=no,scrollbars=no,location=no,width=${window.innerWidth/2+200},height=${window.innerHeight/2+200},top=200,left=200`),o=setInterval((async function(){n?.closed&&(clearInterval(o),await a(),e())}),1e3)}}))}})();var r=t;for(var i in a)r[i]=a[i];a.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})()},6999:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var o=n(1609),a=n(6942),r=n.n(a),i=n(148),c=n(7143),l=n(6427),s=n(7677),d=n(6655),u=n(7675);const p=({text:e,className:t,callback:n=null,disabled:a=!1,showChevronRight:p=!0})=>{const f=(0,i.Zp)(),{nextStep:m}=(0,c.useSelect)((e=>({nextStep:e(u.M).getNextStep()})));return(0,o.createElement)(l.Button,{className:r()("nfd-onboarding-button--site-gen-next",{"nfd-onboarding-button--site-gen-next--disabled":a},t),onClick:()=>{a||(n&&"function"==typeof n&&n(),m&&f(m.path))}},(0,o.createElement)("p",{className:"nfd-onboarding-button--site-gen-next--text"},e),p&&(0,o.createElement)(s.A,{className:"nfd-onboarding-button--site-gen-next--icon",icon:d.A}))}},513:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(1609),a=n(8468),r=n(7673);const i=(0,a.memo)((({title:e})=>(0,o.createElement)("div",{className:"ai-heading"},(0,o.createElement)(r.A,{height:"40px"}),(0,o.createElement)("div",{className:"ai-heading--title"},e))))},2607:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var o=n(1609),a=n(7723),r=n(8468),i=n(6427),c=n(7143),l=n(148),s=n(4371),d=n(6079),u=n(7675),p=n(2014),f=n(8969),m=n(2202),w=n(6942),b=n.n(w);const g=(0,r.memo)((({callback:e=!1,className:t,text:n})=>{const r=(0,l.Zp)(),w=(0,l.zy)(),{nextStep:g,currentData:_,socialData:h}=(0,c.useSelect)((e=>({nextStep:e(u.M).getNextStep(),currentData:e(u.M).getCurrentOnboardingData(),socialData:e(u.M).getOnboardingSocialData()})),[]),k=null===g||!1===g,{setOnboardingSocialData:v}=(0,c.useDispatch)(u.M);return(0,o.createElement)(i.Button,{className:b()("skip-button",t),onClick:k?()=>async function(e){if(_){if(_.isComplete=(new Date).getTime(),e?.includes("basic-info")){const e=await async function(){const e=await(0,p.mt)(),t=await(0,p.oc)(h);return null!==t?.error?e?.body:t?.body}();e&&v(e),await s.y.dispatchEvents(m.XJ)}(0,d.V1)(_)}window.location.replace(f.R0)}(w.pathname):()=>("function"==typeof e&&e(),void r(g.path))},n||(0,a.__)("Skip this Step","wp-module-onboarding"))}))},5377:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>k});var o=n(1609),a=n(7143),r=n(8468),i=n(9491),c=n(148),l=n(5706),s=n(7723);var d=n(1056),u=n(3988),p=n(513),f=n(6999),m=n(2607),w=n(1032),b=n(7675),g=n(8969),_=n(2202),h=n(8744);const k=(0,r.memo)((()=>{const[e,t]=(0,r.useState)(!1),[n,k]=(0,r.useState)(!1),v=(0,i.useViewportMatch)("small"),y=(0,c.Zp)(),{nextStep:E}=(0,a.useSelect)((e=>({nextStep:e(b.M).getNextStep()}))),{setIsHeaderEnabled:S,setSidebarActiveView:x,setHeaderActiveView:N,setDrawerActiveView:A,setIsFooterNavAllowed:C,updateSiteGenErrorStatus:D,setIsHeaderNavigationEnabled:M}=(0,a.useDispatch)(b.M);(0,r.useEffect)((()=>{S(!0),x(!1),N(g.Ix),A(!1),M(!0)})),(0,r.useEffect)((()=>{C(e),n&&e&&y(E.path)}),[n,e]);const O={heading:(0,s.__)("Do you want to include any content from Facebook?","wp-module-onboarding"),facebookTitle:(0,s.__)("Connect a Facebook Account","wp-module-onboarding"),facebookDesc:(0,s.__)("By connecting a Facebook profile, we can fetch relevant data to increase the accuracy of your AI generated site.","wp-module-onboarding"),facebookButton:(0,s.__)("Connect Facebook","wp-module-onboarding"),buttons:{skip:(0,s.__)("Skip for now","wp-module-onboarding"),next:(0,s.__)("Next","wp-module-onboarding")}};return(0,o.createElement)(w.tR,null,(0,o.createElement)(u.A,{isCentered:!0,className:"nfd-onboarding-step--site-gen__social-media"},(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__container"},(0,o.createElement)(p.A,{title:O.heading}),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain "},(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain__containleft "},(0,o.createElement)("span",null,O.facebookTitle),(0,o.createElement)("p",null,O.facebookDesc)),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain__containright "},(0,o.createElement)(l.FacebookConnectButton,{className:"nfd-onboarding-step--site-gen__social-media__contain__containright__button",onConnect:()=>{(0,d.v)(new d.iC(_.$2,"facebook",{source:h.d0})),t(!0)},onClick:()=>k(!0),onFailure:()=>{D(!0)}},(0,o.createElement)("i",{className:"nfd-onboarding-step--site-gen__social-media__contain__containright__button__icon"})))),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__container__buttons"},(0,o.createElement)(m.A,{callback:()=>{(0,d.v)(new d.iC(_.$x,void 0,{source:h.d0}))},className:"nfd-onboarding-step--site-gen__social-media__container__buttons__skip",text:O.buttons.skip}),v&&(0,o.createElement)(f.A,{text:O.buttons.next,disabled:!e})))))}))}}]); \ No newline at end of file +(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[377],{5706:(e,t)=>{(()=>{var e={537:(e,t)=>{!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{NewfoldRuntime:function(){return a}});var o=window.wp.url;const a={hasCapability:e=>!0===window.NewfoldRuntime?.capabilities[e],adminUrl:e=>window.NewfoldRuntime?.admin_url+e,createApiUrl:(e,t={})=>(0,o.addQueryArgs)(window.NewfoldRuntime?.base_url,{rest_route:e,...t}),get siteDetails(){return window.NewfoldRuntime?.site},get sdk(){return window.NewfoldRuntime?.sdk},get isWoo(){return window.NewfoldRuntime?.isWoocommerceActive},get ecommerce(){return window.NewfoldRuntime?.ecommerce},get plugin(){return window.NewfoldRuntime?.plugin},get wpversion(){return window.NewfoldRuntime?.wpversion},get siteTitle(){return window.NewfoldRuntime?.siteTitle}};var r=t;for(var i in n)r[i]=n[i];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})}()},967:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function a(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";o.r(a),o.d(a,{FacebookConnectButton:()=>p,FacebookConnectPluginView:()=>f,facebookConnectHelper:()=>m,getFacebookUserProfileDetails:()=>l});const e=window.React,t=window.wp.components,n=window.wp.apiFetch;var r=o.n(n),i=o(537);const c={facebook_module:{base_url:"https://graph.facebook.com/v18.0",debug_token:"/debug_token",token_phrase:"secret_token_phrase"},wordpress:{access:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/hiive"),fb_token:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/get-token"),post_token:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/post-token"),facebook_details:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/details"),facebook_logout:i.NewfoldRuntime.createApiUrl("/newfold-facebook/v1/facebook/logout")},cf_worker:{login_screen:"https://hiive.cloud/workers/facebook-connect/",get_token:"https://hiive.cloud/workers/facebook-connect/get/token?hiive_token=",delete_token:"https://hiive.cloud/workers/facebook-connect/delete/token?hiive_token="}},l=()=>r()({url:c.wordpress.facebook_details}).then((e=>{if(e?.details?.error)throw{message:"failed to load the data",error:e?.details?.error};return e?.details})).catch((e=>{throw{message:"failed to load the data",errorMsg:e}})),s=window.wp.i18n;var d=o(967),u=o.n(d);const p=({className:n,children:o,showData:a,onConnect:i,onDisconnect:d,onFailure:p,onClick:f})=>{const[m,w]=(0,e.useState)(""),[b,g]=(0,e.useState)(!1),[_,h]=(0,e.useState)([]),[k,v]=(0,e.useState)(!1);function y(e){var t;e.origin.search("https://hiive.cloud")<0||(v(!0),window.removeEventListener("message",y),(t=e.data,r()({url:`${c.wordpress.fb_token}`,data:t,method:"POST"})).then((e=>{E()})).catch((()=>v(!1))))}const E=()=>{l().then((e=>{"token not found!"!==e&&(g(!0),h(e),v(!1),"function"==typeof i&&i(e))})).catch((()=>r()({url:c.wordpress.access}).then((e=>{l().then((e=>{"token not found!"!==e&&(g(!0),h(e),"function"==typeof i&&i(e)),v(!1)})).catch((e=>{v(!1),"function"==typeof p&&p(e),console.error(e)})),w(e.token)})).catch((e=>{v(!1),"function"==typeof p&&p(e),console.error(e)}))))};return(0,e.useEffect)((()=>{!m&&r()({url:c.wordpress.access}).then((e=>{e.token&&w(e.token)})),E()}),[]),(0,e.createElement)("div",null,b?(0,e.createElement)("div",null,(0,e.createElement)(t.Button,{className:u()("nfd-facebook-button--connected",`${n}--connected`)},(0,s.__)("Connected","wp-module-facebook")),a&&(0,e.createElement)("div",null,_?.map((t=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ul",{style:{paddingTop:"20px"}},(0,e.createElement)("li",null,(0,e.createElement)("p",null,"Facebook ID: ",t?.User?.profile?.id)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"User Name: ",t?.User?.profile?.name)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"User Email: ",t?.User?.profile?.email)),(0,e.createElement)("li",null,(0,e.createElement)("p",null,"Profile pic:",t?.User?.profile?.picture?.data?.url))),(0,e.createElement)("img",{src:`https://graph.facebook.com/${t?.id}/picture?type=small`,height:t?.picture?.height,width:t?.picture?.width})))))):(0,e.createElement)(t.Button,{type:"submit",disabled:k,className:u()("nfd-facebook-button--connect",`${n}--connect`),onClick:()=>(window.open(`${c.cf_worker.login_screen}?token_hiive=${m}&redirect=${window.location.href}`,"ModalPopUp",`toolbar=no,scrollbars=no,location=no,width=${window.innerWidth/2+200},height=${window.innerHeight/2+200},top=200,left=200`),window.addEventListener("message",y,!1),void("function"==typeof f&&f()))},o,(0,s.__)("Connect Facebook","wp-module-facebook"),k&&(0,e.createElement)(t.Spinner,null)))},f=({fbLogin:n,loginInfo:o,getFbDetails:a})=>{const[i,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>l(!1)),[]),n&&(0,e.createElement)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:"20px"}},(0,e.createElement)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"30px",width:"30px",fill:"#405795",viewBox:"0 0 24 24",style:{marginRight:"10px"}},(0,e.createElement)("path",{d:"M22.675 0h-21.35c-.732 0-1.325.593-1.325 1.325v21.351c0 .731.593 1.324 1.325 1.324h11.495v-9.294h-3.128v-3.622h3.128v-2.671c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.795.143v3.24l-1.918.001c-1.504 0-1.795.715-1.795 1.763v2.313h3.587l-.467 3.622h-3.12v9.293h6.116c.73 0 1.323-.593 1.323-1.325v-21.35c0-.732-.593-1.325-1.325-1.325z"})),(0,e.createElement)("p",{style:{fontSize:"0.9rem",fontWeight:"600",paddingLeft:"15px"}},"Facebook -",(0,e.createElement)("span",{style:{fontWeight:"normal"}},o?.user?.profile?.email))),i?(0,e.createElement)(t.Spinner,null):(0,e.createElement)("button",{style:{color:"#286BDE"},onClick:()=>(async()=>{l(!0),await r()({url:c.wordpress.facebook_logout}).then((e=>e)).catch((e=>{throw{message:"failed to load the data",errorMsg:e}})).then((()=>{a()})),l(!1)})()},"Disconnect"))},m=async e=>{let t="",n=null,o=[];const a=()=>r()({url:c.wordpress.access}).then((e=>{r()({url:`${c.wordpress.fb_token}`,headers:{method:"GET","content-type":"application/json","Accept-Encoding":"gzip, deflate, br","Access-Control-Allow-Origin":"*"}}).then((e=>{var t;e.token&&(t=e.token,r()({url:c.wordpress.settings,method:"post",data:{fb_token:t}}).then((e=>e)).catch((e=>{console.error(e)})),n=e.token)})).catch((e=>{console.error(e)})),t=e.token})).catch((e=>{console.error(e)}));await a(),await r()({url:c.wordpress.fb_token}).then((async r=>{if(r?.fb_token)await l().then((e=>(n=r.fb_token,o=[e],o)));else{const n=window.open(`${c.cf_worker.login_screen}?token_hiive=${t}&redirect=${window.location.href}`,"ModalPopUp",`toolbar=no,scrollbars=no,location=no,width=${window.innerWidth/2+200},height=${window.innerHeight/2+200},top=200,left=200`),o=setInterval((async function(){n?.closed&&(clearInterval(o),await a(),e())}),1e3)}}))}})();var r=t;for(var i in a)r[i]=a[i];a.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})()},6999:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var o=n(1609),a=n(6942),r=n.n(a),i=n(148),c=n(7143),l=n(6427),s=n(7677),d=n(6655),u=n(7675);const p=({text:e,className:t,callback:n=null,disabled:a=!1,showChevronRight:p=!0})=>{const f=(0,i.Zp)(),{nextStep:m}=(0,c.useSelect)((e=>({nextStep:e(u.M).getNextStep()})));return(0,o.createElement)(l.Button,{className:r()("nfd-onboarding-button--site-gen-next",{"nfd-onboarding-button--site-gen-next--disabled":a},t),onClick:()=>{a||(n&&"function"==typeof n&&n(),m&&f(m.path))}},(0,o.createElement)("p",{className:"nfd-onboarding-button--site-gen-next--text"},e),p&&(0,o.createElement)(s.A,{className:"nfd-onboarding-button--site-gen-next--icon",icon:d.A}))}},513:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(1609),a=n(8468),r=n(7673);const i=(0,a.memo)((({title:e})=>(0,o.createElement)("div",{className:"ai-heading"},(0,o.createElement)(r.A,{height:"40px"}),(0,o.createElement)("div",{className:"ai-heading--title"},e))))},2607:(e,t,n)=>{"use strict";n.d(t,{A:()=>g});var o=n(1609),a=n(7723),r=n(8468),i=n(6427),c=n(7143),l=n(148),s=n(4371),d=n(6079),u=n(7675),p=n(2014),f=n(8969),m=n(2202),w=n(6942),b=n.n(w);const g=(0,r.memo)((({callback:e=!1,className:t,text:n})=>{const r=(0,l.Zp)(),w=(0,l.zy)(),{nextStep:g,currentData:_,socialData:h}=(0,c.useSelect)((e=>({nextStep:e(u.M).getNextStep(),currentData:e(u.M).getCurrentOnboardingData(),socialData:e(u.M).getOnboardingSocialData()})),[]),k=null===g||!1===g,{setOnboardingSocialData:v}=(0,c.useDispatch)(u.M);return(0,o.createElement)(i.Button,{className:b()("skip-button",t),onClick:k?()=>async function(e){if(_){if(_.isComplete=(new Date).getTime(),e?.includes("basic-info")){const e=await async function(){const e=await(0,p.mt)(),t=await(0,p.oc)(h);return null!==t?.error?e?.body:t?.body}();e&&v(e),await s.y.dispatchEvents(m.XJ)}(0,d.V1)(_)}window.location.replace(f.R0)}(w.pathname):()=>("function"==typeof e&&e(),void r(g.path))},n||(0,a.__)("Skip this Step","wp-module-onboarding"))}))},5377:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>k});var o=n(1609),a=n(7143),r=n(8468),i=n(9491),c=n(148),l=n(5706),s=n(7723);var d=n(1056),u=n(3988),p=n(513),f=n(6999),m=n(2607),w=n(1032),b=n(7675),g=n(8969),_=n(2202),h=n(8744);const k=(0,r.memo)((()=>{const[e,t]=(0,r.useState)(!1),[n,k]=(0,r.useState)(!1),v=(0,i.useViewportMatch)("small"),y=(0,c.Zp)(),{nextStep:E}=(0,a.useSelect)((e=>({nextStep:e(b.M).getNextStep()}))),{setIsHeaderEnabled:S,setSidebarActiveView:x,setHeaderActiveView:N,setDrawerActiveView:A,setIsFooterNavAllowed:C,updateSiteGenErrorStatus:D,setIsHeaderNavigationEnabled:M}=(0,a.useDispatch)(b.M);(0,r.useEffect)((()=>{S(!0),x(!1),N(g.Ix),A(!1),M(!0)})),(0,r.useEffect)((()=>{C(e),n&&e&&y(E.path)}),[n,e]);const O={heading:(0,s.__)("Do you want to include any content from Facebook?","wp-module-onboarding"),facebookTitle:(0,s.__)("Connect a Facebook Account","wp-module-onboarding"),facebookDesc:(0,s.__)("By connecting a Facebook profile, we can fetch relevant data to increase the accuracy of your AI generated site.","wp-module-onboarding"),facebookButton:(0,s.__)("Connect Facebook","wp-module-onboarding"),buttons:{skip:(0,s.__)("Skip for now","wp-module-onboarding"),next:(0,s.__)("Next","wp-module-onboarding")}};return(0,o.createElement)(w.tR,null,(0,o.createElement)(u.A,{isCentered:!0,className:"nfd-onboarding-step--site-gen__social-media"},(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__container"},(0,o.createElement)(p.A,{title:O.heading}),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain "},(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain__containleft "},(0,o.createElement)("span",null,O.facebookTitle),(0,o.createElement)("p",null,O.facebookDesc)),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__contain__containright "},(0,o.createElement)(l.FacebookConnectButton,{className:"nfd-onboarding-step--site-gen__social-media__contain__containright__button",onConnect:()=>{(0,d.v)(new d.iC(_.$2,"facebook",{source:h.d0})),t(!0)},onClick:()=>k(!0),onFailure:()=>{D(!0)}},(0,o.createElement)("i",{className:"nfd-onboarding-step--site-gen__social-media__contain__containright__button__icon"})))),(0,o.createElement)("div",{className:"nfd-onboarding-step--site-gen__social-media__container__buttons"},(0,o.createElement)(m.A,{callback:()=>{(0,d.v)(new d.iC(_.$x,void 0,{source:h.d0}))},className:"nfd-onboarding-step--site-gen__social-media__container__buttons__skip",text:O.buttons.skip}),v&&(0,o.createElement)(f.A,{text:O.buttons.next,disabled:!e})))))}))}}]); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 673af8a9b..a3beac805 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "GPL-2.0-or-later", "dependencies": { "@newfold-labs/js-utility-ui-analytics": "1.2.0", - "@newfold-labs/wp-module-facebook": "^1.0.6", + "@newfold-labs/wp-module-facebook": "^1.0.7", "@wordpress/interface": "^5.25.0", "@wordpress/style-engine": "^0.11.0", "bytes": "^3.1.2", @@ -3135,9 +3135,9 @@ } }, "node_modules/@newfold-labs/wp-module-facebook": { - "version": "1.0.6", - "resolved": "https://npm.pkg.github.com/download/@newfold-labs/wp-module-facebook/1.0.6/22d06109595116a31e7cf2c95fcd24070a9da59b", - "integrity": "sha512-EARrubjcZodXaEZ9NpqNRZFoEAD/8+fbQVamQcEBjLVee+/Euy0HViWeujkxunMUSCcgHslOsv9fV7MUBH5G5g==", + "version": "1.0.7", + "resolved": "https://npm.pkg.github.com/download/@newfold-labs/wp-module-facebook/1.0.7/47dab055e53ab8134c19943d7a60b677b9c940b6", + "integrity": "sha512-XILcb7QA8VkKcPDbMRQs/Q/SwIU/pt9u+br8F1E+CmSYZg51GkO0zL+D496hz1NcFULlVgwslXnDYBZzQd+Jyg==", "license": "GPL-2.0-or-later", "dependencies": { "@newfold-labs/wp-module-runtime": "^1.0.0", @@ -24413,9 +24413,9 @@ } }, "@newfold-labs/wp-module-facebook": { - "version": "1.0.6", - "resolved": "https://npm.pkg.github.com/download/@newfold-labs/wp-module-facebook/1.0.6/22d06109595116a31e7cf2c95fcd24070a9da59b", - "integrity": "sha512-EARrubjcZodXaEZ9NpqNRZFoEAD/8+fbQVamQcEBjLVee+/Euy0HViWeujkxunMUSCcgHslOsv9fV7MUBH5G5g==", + "version": "1.0.7", + "resolved": "https://npm.pkg.github.com/download/@newfold-labs/wp-module-facebook/1.0.7/47dab055e53ab8134c19943d7a60b677b9c940b6", + "integrity": "sha512-XILcb7QA8VkKcPDbMRQs/Q/SwIU/pt9u+br8F1E+CmSYZg51GkO0zL+D496hz1NcFULlVgwslXnDYBZzQd+Jyg==", "requires": { "@newfold-labs/wp-module-runtime": "^1.0.0", "@wordpress/api-fetch": "^6.42.0", diff --git a/package.json b/package.json index 6d2f83df1..bd2126a16 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ }, "dependencies": { "@newfold-labs/js-utility-ui-analytics": "1.2.0", - "@newfold-labs/wp-module-facebook": "^1.0.6", + "@newfold-labs/wp-module-facebook": "^1.0.7", "@wordpress/interface": "^5.25.0", "@wordpress/style-engine": "^0.11.0", "bytes": "^3.1.2",