1import{a as C,r as c,b as s,j as e,aC as Y,aD as z,P as ce,aE as Ie,a0 as Ce,a1 as Me,V as ae,M as ie,aF as Ee,aG as De,D as Ue,G as ke,aH as we,l as Le,m as Pe,u as Re,aI as me,aJ as Fe,ax as E,O as he,d as X,aK as pe,F as Q,at as fe,aL as ue,aM as ye,aN as ge,aO as q,a4 as J,i as je,ab as P,au as j,av as W,L as We}from"./index-732e35d6.js";import{l as Oe}from"./lodash-1212d48b.js";import{I as ve}from"./IntegrationStep-8f78828b.js";import{f as qe,a as Ge,b as xe,c as ze,s as Ke,u as Ve,d as He}from"./service-9223542d.js";import{E as Be}from"./index-8539ce88.js";import{K as Z}from"./index-6eb98372.js";import{P as I}from"./index-0bfcfb2b.js";import{S as se}from"./useCopyToClipboard-e79d347d.js";import{S as be}from"./index-8e38e54a.js";import{C as Ne}from"./CheckoutTracking-24a718de.js";import{c as $e,a as K,f as Ye,b as Qe,u as Je,o as Ze,d as Xe,C as ee}from"./yup.module-27c7a410.js";import{L as et,q as tt,G as at,A as st,g as rt,y as it,d as nt,M as ot}from"./mapValues-96067ce5.js";import{a as lt}from"./commonCustomSelectStyle-2450057e.js";import{a as V}from"./processQueryParameters-56133217.js";import"./objectWithoutProperties-fc26ba5b.js";const Te="widget-integration-not-found",dt=C(Z)` 2 .Select__value-container { 3 padding: 5px 8px; 4 } 5`,ct=C.div` 6 width: 5%; 7`,mt=C.div` 8 .dot1 { 9 animation: visibility 3s linear infinite; 10 } 11 12 @keyframes visibility { 13 0% { 14 opacity: 1; 15 } 16 65% { 17 opacity: 1; 18 } 19 66% { 20 opacity: 0; 21 } 22 100% { 23 opacity: 0; 24 } 25 } 26 27 .dot2 { 28 animation: visibility2 3s linear infinite; 29 } 30 31 @keyframes visibility2 { 32 0% { 33 opacity: 0; 34 } 35 21% { 36 opacity: 0; 37 } 38 22% { 39 opacity: 1; 40 } 41 65% { 42 opacity: 1; 43 } 44 66% { 45 opacity: 0; 46 } 47 100% { 48 opacity: 0; 49 } 50 } 51 52 .dot3 { 53 animation: visibility3 3s linear infinite; 54 } 55 56 @keyframes visibility3 { 57 0% { 58 opacity: 0; 59 } 60 43% { 61 opacity: 0; 62 } 63 44% { 64 opacity: 1; 65 } 66 65% { 67 opacity: 1; 68 } 69 66% { 70 opacity: 0; 71 } 72 100% { 73 opacity: 0; 74 } 75 } 76`,ht=({manualIntegrate:n})=>s("div",{className:"pt-5",children:[s(Ce,{variant:"pqa-warning-variant",className:"d-flex align-items-center fs-7",children:[e(ct,{className:"d-flex align-items-center align-self-start justify-content-center me-2",children:e(Me,{className:"text-pqa-orange-light",size:15})}),s("div",{children:[e("div",{className:"text-black fw-bold pb-2",id:"cannotIntegrateWidget_txt",children:"Cannot integrate widget"}),e("span",{className:"fs-7 lh-sm",id:"manualStepsToIntegrate_txt",children:"It seems that the selected theme is not compatible with our Shopify app. You can still integrate the widget on this store by following manual steps."})]}),e("div",{className:"w-50 text-end",children:s(I,{className:"text-uppercase fw-md mt-0",variant:"primary-pqa",onClick:n,id:"widgets_create_manualIntegration",children:["Manual Integration",e(ae,{className:"ms-2 mb-1"})]})})]}),e("div",{className:"text-center pt-2 fs-7",id:"chooseAnotherTheme_txt",children:"Or, choose another theme to integrate."})]}),pt=({selectedThemeName:n,navigateToDasboard:a,showVerifyOnStoreModal:y,addThemeLoading:d})=>{const[h,x]=c.exports.useState(!1),[p,b]=c.exports.useState(!1);return c.exports.useEffect(()=>{d&&(x(!0),setTimeout(()=>{x(!1),b(!0)},3e3))},[d]),s(ie,{children:[!p&&(h?s("div",{className:"pb-4",children:[s(mt,{className:"fs-1 text-center text-pqa-secondary lh-sm",children:[e("span",{className:"dot dot1",children:"\xB7"}),e("span",{className:"dot dot2",children:"\xB7"}),e("span",{className:"dot dot3",children:"\xB7"})]}),e("div",{className:"text-center fs-7",id:"addingWidget_txt",children:"adding widget, please wait..."})]}):s("div",{className:"d-flex justify-content-center py-4",children:[e(Ee,{color:"#5cb85c",size:16}),e("div",{className:"text-center fs-7 ms-2",id:"widgetSuccessfullyAdded_txt",children:"Widget successfully added"})]})),p&&s(ie,{children:[s("div",{className:"text-center fs-5 fw-md py-4",id:"youAreNowLive_txt",children:["Awesome,",n&&s("span",{className:"mx-2",children:[e("span",{children:"Widget successfully added on the theme"}),e("span",{className:"fw-bold text-pqa-primary ms-2",children:n}),"."]}),"You are now live!",e("p",{className:"fs-7",children:'Preview your store with selected theme, and navigate to a product page. You should see "Live FAQs".'})]}),s("div",{className:"text-center py-4 gap-4 d-flex justify-content-center",children:[e(I,{
76className:"text-uppercase fw-md",variant:"primary-pqa",onClick:y,id:"widgets_create_verifyOnStore",children:"Verify on your store"}),s(I,{className:"text-uppercase fw-md",variant:"outline",onClick:a,id:"widgets_create_goToDashboard",children:["Go to Dashboard",e(ae,{className:"ms-2 mb-1"})]})]})]})]})},ft=C.div` 77 min-height: 275px; 78`,ut=({navigateToDasboard:n,showVerifyOnStoreModal:a,manualIntegrate:y,fromCreate:d=!1,widgetId:h,onClose:x})=>{const[p,b]=c.exports.useState(null),[M,f]=c.exports.useState(null),[k,o]=c.exports.useState(!1),[t,v]=c.exports.useState(!1),[O,w]=c.exports.useState(!1),[G,D]=c.exports.useState(!1),[U,R]=c.exports.useState(!1),[N,A]=c.exports.useState(""),[L,F]=c.exports.useState(),T=()=>{h&&(D(!0),qe(h).then(g=>{var i;const r=(i=g==null?void 0:g.data)==null?void 0:i.themes;F(r.map(l=>({label:`${l.name} - [${De[l.role]||l.role}]`,value:l.id}))||[])}).catch(g=>{var l,u;console.error(g);const r=g;let i="";Ue.isAxiosError(r)?i=((l=r.response)==null?void 0:l.status)===500?z:((u=r.response)==null?void 0:u.data.message)||z:i=r.message,A(i)}).finally(()=>{D(!1)}))};c.exports.useEffect(()=>{T()},[]);const m=g=>{A(""),v(!1),w(!1),o(!1),b(g.value),f(g.label)},H=async(g,r)=>{var i,l;try{R(!0),A(""),v(!1),w(!1),o(!1),await Ge(g,r),v(!0)}catch(u){const _=u;let S="";_!=null&&_.response?S=((i=_.response)==null?void 0:i.status)===500?Y[z]:((l=_.response)==null?void 0:l.data.message)||Y[z]:S=_.message,S==="theme-not-compatible"?o(!0):["block-already-installed","block-already-installed-disabled"].includes(S)?w(!0):S===Te?(A(Y[Te]),v(!1)):(A(Y[z]),v(!1))}finally{R(!1)}},B=g=>{g?H(h,g):A("Please select a theme to add widget.")},$=!p||G||O||U||t;return s("div",{className:"fs-6",children:[d?s("div",{className:"d-flex align-items-center gap-4 flex-1 w-100 mb-5",children:[e(se,{children:"3"}),e("div",{className:"fw-bold",id:"addWidgetToProductPage_txt",children:"Add widget to product page"})]}):e("h4",{className:"mb-4",id:"addWidgetToProductPage_txt",children:"Add widget to product page"}),N&&e("div",{children:N===Y[z]?s(ce,{id:"SelectShopifyTheme_addTheme_genericError",variant:"error-variant",className:"m-5",children:["There was an issue processing your request. Please",e(I,{variant:"link",onClick:Ie,className:"cursor-pointer text-klevu-primary p-0 mx-1 fs-6 btn-sm",children:"contact support"}),"."]}):e(ce,{id:"SelectShopifyTheme_addTheme_error",variant:"error-variant",className:"m-5",children:N})}),e("div",{children:e(ft,{className:"d-flex w-100 justify-content-center",children:s("div",{className:"pb-4 position-relative w-70",children:[!t&&s("div",{className:"pb-4 position-relative d-flex justify-content-center align-items-center",children:[e("label",{className:"text-black fs-6 w-30 fw-md",htmlFor:"shopifyTheme",id:"selectShopifyTheme_label",children:"Select Shopify Theme:"}),e("div",{className:"w-50",id:"widgets_create_selectTheme",children:e(dt,{name:"shopifyTheme",options:L,isMulti:!1,onChange:g=>{m(g)},menuPortalTarget:document.body})}),e(I,{disabled:$,className:"text-uppercase fw-md ms-2 mt-0",variant:"primary-pqa",onClick:()=>B(p!=null?p:""),id:"widgets_create_addNow",children:"Add Now"})]}),p&&t&&!k&&e(pt,{addThemeLoading:U,navigateToDasboard:n,showVerifyOnStoreModal:a,selectedThemeName:M}),p&&k&&e(ht,{manualIntegrate:y}),p&&O&&e("div",{className:"pt-5",children:s(Ce,{variant:"pqa-warning-variant",className:"d-flex align-items-center fs-7",children:[e("div",{className:"mx-2 d-flex align-items-center align-self-start justify-content-center",children:e(Me,{className:"text-pqa-orange-light",size:15})}),e("div",{className:"ms-2",id:"alreadyAddWidget_txt",children:"The widget is already added in the selected theme. From your Shopify admin, preview the store with the selected theme. If you still don't see the Asklo widget, ensure that it is not hidden."})]})})]})})}),!!N&&e("div",{className:"pt-5 d-flex justify-content-between align-items-center",children:e(I,{className:"text-uppercase fw-md",variant:"outline",onClick:x,id:"widgets_theme_cancel",children:"Cancel"})})]})},_e=C.div` 79 & img { 80 max-width: 100%; 81 height: auto; 82 } 83 @media only screen and (max-width: 1156px) { 84 flex-grow: 1; 85 & img { 86 height: auto; 87 } 88 } 89`,yt=C.div` 90 min-height: 275px; 91`,gt=C.div` 92 .menu { 93 height: 80px; 94 width: 100%; 95 padding: 20px; 96 display: flex; 97 align-items: center; 98 justify-content: space-around; 99 list-style: none; 100 padding: 0 100px; 101 } 102 103 .menu { 104 height: 60%; 105 position: relative; 106 display: flex; 107 align-items: center; 108 justify-content: center; 109 padding: 10px; 110 transition: all 300ms cubic-bezier(0.075, 0.82, 0.165, 1); 111 } 112 113 .menu::before, 114 .menu::after { 115 content: ''; 116 pointer-events: none; 117 position: absolute; 118 } 119 /* ---------------------- Style 1 -------------------------- */ 120 121 .menu1::before, 122 .menu1::after { 123 border: 0px solid transparent; 124 width: 0%; 125 height: 0%; 126 bottom: 0%; 127 right: 0%; 128 } 129 130 /* 'before' sudo element animates the bottom and left borders */ 131 .menu1::before { 132 border-bottom-width: 2px; 133 border-left-width: 2px; 134 } 135 136 /* 'after' sudo element animates the top and right borders */ 137 .menu1::after { 138 border-top-width: 2px; 139 border-right-width: 2px; 140 } 141 142 /* On Hover border color is changed from transparent to the #fff */ 143 /* Width and a height of the sudo elements are increased from zero to 100% */ 144 .menu1:hover::before, 145 .menu1:hover::after { 146 border-color: #666; 147 transition: border-color 0s, width 0.3s, height 0.3s; 148 width: 100%; 149 height: 100%; 150 } 151 152 /* Delay is added to the height animation of the 'before' sudo element */ 153 .menu1:hover::before { 154 transition-delay: 0s, 0s, 0.3s; 155 } 156 157 /* Delay is added to the width animation of the 'after' sudo element */ 158 .menu1:hover::after { 159 transition-delay: 0s, 0.3s, 0s; 160 } 161 :hover { 162 opacity: 0.9; 163 } 164`,Se=C.div` 165 width: 300px; 166`,vt=C.div` 167 top: -8px; 168 border-radius: 1rem; 169 text-transform: uppercase; 170 left: 30px; 171`,Ae=({onManualIntegrate:n,onAuthorizeShopify:a,moveToShopifyIntegrate:y,widget:d})=>{const h=ke(),[x,p]=c.exports.useState(!1),{widgetId:b=""}=we(),M="/widgets/integration-method/",[f,k]=c.exports.useState(!0);return c.exports.useEffect(()=>{var o,t;b&&h.pathname.includes(M)&&(p(!0),Oe.exports.isUndefined(d==null?void 0:d.integrationDetail
171s)?k(!0):!((o=d==null?void 0:d.integrationDetails)!=null&&o.expired)&&!!((t=d==null?void 0:d.integrationDetails)!=null&&t.shopName)?k(!1):k(!0),p(!1))},[b]),s("div",{className:"fs-6",children:[x&&e(Le,{children:e(Pe,{})}),s("div",{className:"d-flex align-items-center gap-4 flex-1 w-100 mb-5",children:[e(se,{children:"2"}),e("div",{className:"fw-bold",id:"widgetReady_txt",children:"Your widget is now ready for integration!"})]}),e("div",{children:e(yt,{className:"d-flex w-100 justify-content-center",children:s("div",{className:"row position-relative",children:[e("div",{className:"col-md-6",children:s(Se,{className:"border border-pqa-lavendar-blue bg-pqa-lavendar rounded-3 d-flex flex-column p-4",children:[e(vt,{className:"bg-pqa-secondary position-absolute text-black fs-8 px-3 py-1 fs-7 fw-md",id:"oneClickIntegration_txt",children:"1-Click Integration"}),e("div",{className:"text-black fw-bold fs-7 text-center py-3",id:"addWidgetToStore_txt",children:"Let's add the widget to your Shopify store"}),e(_e,{className:"d-flex justify-content-center p-5 rounded-2",children:e("img",{src:"/images/ShopifyAppIntegration.svg",alt:""})}),e("div",{className:"justify-content-center align-items-center d-flex flex-grow-1 pt-3 rounded-2",children:f?s(I,{className:"mt-0",variant:"primary-pqa",onClick:a,id:"widgets_authorize",children:[e(be,{width:16,height:16}),e("span",{className:"ms-2 fs-7",children:"Authorize shopify store"})]}):s("div",{children:[s("div",{className:"d-flex justify-content-center py-4",children:[e(Ee,{color:"#5cb85c",size:16}),e("div",{className:"text-center fs-7 ms-2",id:"shopifyStoreConnected_txt",children:"Shopify store connected"})]}),s(I,{className:"mt-0",variant:"primary-pqa",onClick:y,id:"widgets_oneClickIntegration",children:[e(be,{width:16,height:16}),e("span",{className:"ms-2 fs-7",id:"continueWithOneClickIntegration_txt",children:"Continue with 1-click integration"})]})]})})]})}),e("div",{className:"col-md-6",children:s(Se,{className:"bg-klevu-gray-disabled rounded-3 d-flex flex-column p-4 h-100",children:[e("div",{className:"text-black fw-bold fs-7 text-center py-3",id:"manualIntegration_txt",children:"Manual Integration"}),e(_e,{className:"d-flex justify-content-center p-5 rounded-2",children:e("img",{src:"/images/ManualIntegration.svg",alt:""})}),e("div",{className:"justify-content-center align-items-center d-flex flex-grow-1 pt-3 rounded-2",children:e(gt,{children:s("div",{role:"button",className:"menu menu1",onClick:n,id:"widgets_manualIntegration",children:[e("span",{className:"fs-7",id:"manuallyIntegrate_txt",children:"Manually Integrate"}),e(ae,{className:"ms-2 mb-1"})]})})})]})})]})})})]})};const xt=C.div` 172 display: flex; 173 align-items: stretch; 174 margin: 10px auto; 175 &button { 176 margin-top: 20px; 177 } 178`,bt=({steps:n,currentStepNumber:a})=>{const[y,d]=c.exports.useState(1);return c.exports.useEffect(()=>{d(a)},[a]),e(xt,{children:n.map(h=>s("div",{className:`p-4 pb-5 px-2 rounded-3 step m-2 border border-pqa-lavendar-blue ${y===h.id?"active bg-white":"bg-pqa-lavendar"}`,style:{flex:y===h.id?"1":"0 0 30px",marginLeft:y===h.id?"0":"-1%"},children:[y===h.id&&e("div",{className:"step-content",children:h.content}),y!==h.id&&e("div",{className:"step-number",children:e(se,{children:h.id})})]},h.id))})};var Nt=et,Tt=tt,_t=at,St=st,At=rt,It=it.exports,Ct=nt,Mt=ot,Et="[object Map]",kt="[object Set]",wt=Object.prototype,Lt=wt.hasOwnProperty;function Pt(n){if(n==null)return!0;if(At(n)&&(St(n)||typeof n=="string"||typeof n.splice=="function"||It(n)||Mt(n)||_t(n)))return!n.length;var a=Tt(n);if(a==Et||a==kt)return!n.size;if(Ct(n))return!Nt(n).length;for(var y in n)if(Lt.call(n,y))return!1;return!0}var Ot=Pt;const te=n=>({...lt(n),singleValue:a=>({...a,color:"#999",zIndex:1})}),Dt=C.div` 179 min-height: 76.6px; 180 .show-hide { 181 transition: opacity 0.5s, visibility 0.5s; 182 opacity: 0; 183 visibility: hidden; 184 } 185 186 .show-hide.show { 187 opacity: 1; 188 visibility: visible; 189 } 190`,re=({onSave:n,widget:a,onCancel:y})=>{var w,G,D,U,R,N,A,L,F;const{t:d}=Re(),h=c.exports.useMemo(()=>$e().shape({widgetName:K().trim().required(d("isMandatory",{FIELD_NAME:"Internal Widget Name"})),websiteLanguage:K().trim().required(d("isMandatory",{FIELD_NAME:"Store/Website Language"})),platform:K().trim().required(d("isMandatory",{FIELD_NAME:"eCommerce Platform"})),storeType:K().trim().required(d("isMandatory",{FIELD_NAME:"Store Type"})),industries:Ye().min(1,d("isMandatory",{FIELD_NAME:"industries"})),websiteUrl:K().when("platform",{is:m=>m===me,then:K().required(d("isMandatory",{FIELD_NAME:"URL"})).matches(Fe,d("pleaseEnterValidUrl"))}),agreeTerms:Qe().oneOf([!0])}),[]),x=Ot(a),{watch:p,resetField:b,register:M,control:f,handleSubmit:k,formState:{errors:o}}=Je({mode:"onChange",defaultValues:{widgetName:(w=a==null?void 0:a.widgetName)!=null?w:"",websiteUrl:(G=a==null?void 0:a.websiteUrl)!=null?G:"",websiteLanguage:(D=a==null?void 0:a.websiteLanguage)!=null?D:"",platform:(U=a==null?void 0:a.platform)!=null?U:"",storeType:(R=a==null?void 0:a.storeType)!=null?R:"",industries:(a==null?void 0:a.industries)||[],klevuApiKey:(N=a==null?void 0:a.klevuApiKey)!=null?N:"",agreeTerms:!x,integrationMode:(A=a==null?void 0:a.integrationMode)!=null?A:""},resolver:Ze(h)}),{isValid:t}=Xe({control:f}),v=p("platform");return c.exports.useEffect(()=>{v===E&&b("websiteUrl",{defaultValue:""})},[v]),s(ie,{children:[x?s("div",{className:"d-flex align-items-center gap-4 flex-1 w-100 mb-5",children:[e(se,{children:"1"}),e("div",{className:"fw-bold",id:"provideStoreDetails_txt",children:"Please provide your store details"})]}):e("h5",{className:"text-pqa-primary mb-5",id:"widgetDetails_txt",children:"Widget Details"}),e("form",{onSubmit:k(async T=>{n({...T,integrationMode:q})}),className:"",id:"widgets_form",children:s("div",{className:"",children:[s("div",{className:"row",children:[s("div",{className:"pb-4 position-relative col-md-6",children:[s("label",{className:"text-black fs-7",id:"internalWidget
190Name_label",children:["Internal Widget Name",e("span",{className:"text-klevu-red ms-1",children:"*"})," ",e(he,{trigger:["hover","focus"],placement:"right",overlay:e(X,{children:e(X.Body,{id:"internalUseOnly_txt",children:"Internal Use Only"})}),children:e("span",{children:e(pe,{className:"cursor-pointer ms-2 mb-2",color:"#999",size:"13"})})})]}),e(Q.Control,{...M("widgetName"),isInvalid:!!o.widgetName||!1,className:"pe-4",id:"widgets_widgetName"}),e(Q.Control.Feedback,{type:"invalid",id:"widgetName_error",children:(L=o.widgetName)==null?void 0:L.message})]}),s("div",{className:"pb-4 position-relative col-md-3",children:[s("label",{className:"text-black fs-7",id:"eCommercePlatform_label",htmlFor:"widgets_platform",children:[e("span",{children:"eCommerce Platform"}),e("span",{className:"text-klevu-red ms-1",children:"*"})]}),e(ee,{control:f,name:"platform",render:({field:{onChange:T}})=>e(Z,{options:fe,isMulti:!1,onChange:m=>{T(m==null?void 0:m.value)},isInvalid:!!o.platform,menuPortalTarget:document.body,defaultValue:fe.find(m=>m.value===(a==null?void 0:a.platform)),isDisabled:!x,styles:te(!1),id:"widgets_platform"})}),o.platform&&e("span",{className:"fs-7 text-danger",id:"platform_error",children:o.platform.message})]}),s("div",{className:"pb-4 position-relative col-md-3",children:[s("label",{className:"text-black fs-7",id:"domainOrIndustry_label",htmlFor:"widgets_domain",children:[e("span",{children:"Domain/Industry"}),e("span",{className:"text-klevu-red ms-1",children:"*"})]}),e(ee,{control:f,name:"industries",render:({field:{onChange:T}})=>e(Z,{options:ue,onChange:m=>{T(m.map(H=>H.value))},isInvalid:!!o.industries,menuPortalTarget:document.body,defaultValue:ue.filter(m=>a==null?void 0:a.industries.includes(m.value)),styles:te(!1),id:"widgets_domain"})}),o.industries&&e("span",{className:"fs-7 text-danger",id:"industries_error",children:o.industries.message})]})]}),s(Dt,{className:"row mt-3",children:[s("div",{className:"pb-4 position-relative col-md-3",id:"widgets_language",children:[s("label",{className:"text-black fs-7",id:"language_label",htmlFor:"widgets_language",children:[e("span",{children:"Store/Website Language"}),e("span",{className:"text-klevu-red ms-1",children:"*"})]}),e(ee,{control:f,name:"websiteLanguage",render:({field:{onChange:T}})=>e(Z,{options:ye,isMulti:!1,onChange:m=>{T(m==null?void 0:m.value)},isInvalid:!!o.websiteLanguage,menuPortalTarget:document.body,defaultValue:ye.find(m=>m.value===(a==null?void 0:a.websiteLanguage)),styles:te(!1),id:"widgets_language"})}),o.websiteLanguage&&e("span",{className:"fs-7 text-danger",id:"language_error",children:o.websiteLanguage.message})]}),s("div",{className:"pb-4 position-relative col-md-3",children:[s("label",{className:"text-black fs-7",id:"storeType_label",htmlFor:"widgets_storeType",children:[e("span",{children:"Store Type"}),e("span",{className:"text-klevu-red ms-1",children:"*"})]}),e(ee,{control:f,name:"storeType",render:({field:{onChange:T}})=>e(Z,{options:ge,isMulti:!1,onChange:m=>{T(m==null?void 0:m.value)},isInvalid:!!o.storeType,menuPortalTarget:document.body,defaultValue:ge.find(m=>m.value===(a==null?void 0:a.storeType)),styles:te(!1),id:"widgets_storeType"})}),o.storeType&&e("span",{className:"fs-7 text-danger",id:"storeType_error",children:o.storeType.message})]}),s("div",{className:`pb-4 position-relative col-md-6 show-hide ${v===me?"show":""}`,children:[s("label",{className:"text-black fs-7",id:"storeURL_label",htmlFor:"widgets_websiteUrl",children:["Store URL",e("span",{className:"text-klevu-red ms-1",children:"*"}),e(he,{trigger:["hover","focus"],placement:"right",overlay:e(X,{children:e(X.Body,{id:"internalUseStoreURL_txt",children:"Internal Use Only"})}),children:e("span",{children:e(pe,{className:"cursor-pointer ms-2 mb-2",color:"#999",size:"13"})})})]}),e(Q.Control,{...M("websiteUrl"),isInvalid:!!o.websiteUrl||!1,className:"pe-4",id:"widgets_websiteUrl"}),e(Q.Control.Feedback,{type:"invalid",id:"websiteUrl_error",children:(F=o.websiteUrl)==null?void 0:F.message})]})]}),x&&e("div",{className:"my-4 fs-6",children:e(Q.Check,{type:"checkbox",isInvalid:!!o.agreeTerms||!1,label:e("span",{className:"user-select-none fs-7 ms-1",id:"agreeTerms_label",children:"I understand that this tool uses Generative Al to answer questions. It may some times display inaccurate information."}),id:"agreeTerms",...M("agreeTerms")})}),s("div",{className:"pt-4 d-flex justify-content-between align-items-center",children:[e(I,{type:"button",className:"text-uppercase fw-md",variant:"outline",onClick:y,id:"widgets_cancel",children:d("cancel")}),x?s(I,{type:"submit",className:"text-uppercase fw-md mt-0",variant:"primary-pqa",disabled:!t,id:"widgets_next",children:[d("next"),e(ae,{className:"ms-2 mb-1"})]}):e(I,{variant:"primary-pqa",type:"submit",className:"text-uppercase fw-md mt-0",disabled:!t,id:"widgets_save",children:"Save"})]})]})})]})},Ut=C.div` 191 & img { 192 max-width: 100%; 193 height: auto; 194 } 195 @media only screen and (max-width: 1156px) { 196 flex-grow: 1; 197 & img { 198 height: auto; 199 } 200 } 201`,Rt=C(I)` 202 font-weight: normal !important; 203`,Ft=({show:n,goToList:a})=>s(J,{show:n,backdrop:"static",centered:!0,size:"lg",children:[e(J.Header,{className:"border-0 pb-0",children:e(J.Title,{className:"w-100 d-flex justify-content-between align-items-center pb-0",children:e("h4",{className:"fw-bold",id:"verifyOnStoreModal_title",children:"How to Verify on Store?"})})}),s(J.Body,{children:[s("div",{id:"verifyOnStoreModal_description",children:[e("span",{children:"Go to your webstore, open any product page, and find the"}),e("span",{className:"fw-bold text-pqa-primary mx-2",children:"Ask Product AI"}),e("span",{children:"button. Click on it to test the Asklo widget, as demonstrated in the GIF below."})]}),e(Ut,{className:"d-flex justify-content-center pt-5",children:e("img",{src:"/images/VerifyOnStore.gif",alt:"",id:"verifyOnStoreModal_demoImage"})})]}),s(J.Footer,{className:"border-0 justify-content-center gap-2 flex-column",children:[e(I,{
203className:"m-1 ms-4",variant:"primary-pqa",onClick:a,id:"verifyOnStoreModal_done",children:"Done"}),e(Rt,{variant:"link",id:"editWidget_customizations_widget_ui_customization_contactUs",className:"cursor-pointer text-pqa-primary p-0 me-1",onClick:Ie,children:"I need help with Integration"})]})]}),jt=()=>{const n=ke(),a={pathName:n.pathname,hash:n.hash},y=je(),{widgetId:d=""}=we(),h="/widgets/integration-method/",x=d&&n.pathname.includes(h)?2:1,[p,b]=c.exports.useState(x),[M,f]=c.exports.useState(!1),[k,o]=c.exports.useState(!1),[t,v]=c.exports.useState(null),[O,w]=c.exports.useState(!1),[G,D]=c.exports.useState(!1),[U,R]=c.exports.useState(!1),N=()=>{y("/widgets/list")},A=async r=>{f(!0);try{const{websiteUrl:i,...l}=r;let u={...l,status:"ENABLED"};i&&(u={...u,websiteUrls:[i]});const _=await Ke(u),S=_.data;v({..._.data}),V({journey_step:(S==null?void 0:S.platform)===E?P.AUTHORIZATION:P.MANUAL_INTEGRATION,platform:j[S.platform],store_type:W[S.storeType]},a),b(2)}catch{o(!0)}finally{f(!1)}},L=async()=>{try{(t==null?void 0:t.integrationMode)===q?(V({journey_step:P.MANUAL_INTEGRATION,platform:j[t.platform],store_type:W[t.storeType]},a),b(3),v(r=>{const i=r?{...r,integrationMode:q}:{integrationMode:q};return i==null||delete i.integrationDetails,{...i}})):(f(!0),o(!1),t&&(await Ve({...t,integrationMode:q}),V({journey_step:P.MANUAL_INTEGRATION,platform:j[t.platform],store_type:W[t.storeType]},a),b(3),v(r=>{const i=r?{...r,integrationMode:q}:{integrationMode:q};return delete i.integrationDetails,{...i}})))}catch(r){console.error(r),o(!0)}finally{f(!1)}},F=()=>{t&&V({journey_step:P.ADD_TO_THEME,platform:j[t.platform],store_type:W[t.storeType]},a),b(3)},T=r=>{const i=window.open(r,"newwindow","height=650, width=990,left=200,top=150,toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=no"),l=setInterval(()=>{i!=null&&i.closed&&(clearInterval(l),D(!0),w(!0))},500)},m=()=>{t!=null&&t.id&&(f(!0),He(t==null?void 0:t.id).then(r=>{var i;(i=r==null?void 0:r.data)!=null&&i.redirectUrl&&T(r.data.redirectUrl)}).catch(r=>{console.error(r),o(!0)}).finally(()=>{f(!1)}))};c.exports.useEffect(()=>{(t==null?void 0:t.id)&&(O||(t==null?void 0:t.platform)===E&&n.pathname.includes(h))&&H(t.id).then(r=>{var i,l;O&&(G&&!((i=r==null?void 0:r.integrationDetails)!=null&&i.expired)&&!!((l=r==null?void 0:r.integrationDetails)!=null&&l.shopName)?B({stepName:P.ADD_TO_THEME,platform:j[r.platform],storeType:W[r.storeType]}):o(!0),w(!1))})},[O,t==null?void 0:t.id]);const H=async r=>{var i;try{f(!0),o(!1);const{data:l}=await xe(r);if((l==null?void 0:l.platform)===E){const{data:u}=await ze(r);return v({...l,integrationDetails:u}),f(!1),{...l,integrationDetails:u}}return v({...l}),f(!1),{...l}}catch(l){const u=l;return(u==null?void 0:u.response)&&((i=u.response)==null?void 0:i.status)!==404?o(!0):o(!1),f(!1),w(!1),null}},B=r=>{const{stepName:i,platform:l,storeType:u}=r;V({journey_step:i,platform:l,store_type:u},a),b(_=>_+1)},$=()=>{t!=null&&t.widgetKey?y("/home",{state:{widgetId:t.widgetKey}}):y("/home")};c.exports.useEffect(()=>{d&&(f(!0),xe(d).then(r=>{v({...r.data,websiteUrl:r.data.websiteUrls[0]}),V({journey_step:d&&n.pathname.includes(h)?P.AUTHORIZATION:P.MANUAL_INTEGRATION,platform:j[r.data.platform],storeType:W[r.data.storeType]},a)}).catch(r=>{console.error(r),o(!0)}).finally(()=>{f(!1)}))},[]);const g=c.exports.useMemo(()=>{var i,l,u,_,S,ne,oe,le,de;if(M)return[];const r={platform:t!=null&&t.platform?j[t.platform]:"",storeType:t!=null&&t.storeType?W[t.storeType]:""};return(t==null?void 0:t.platform)!==E?[{id:1,content:e(re,{onSave:A,onCancel:N})},{id:2,content:e(ve,{step:p,widgetKey:(i=t==null?void 0:t.widgetKey)!=null?i:"",navigateToCheckoutTracking:B,onClose:N,fromCreate:!0,isPlatformShopify:(t==null?void 0:t.platform)===E,trackingQueryParam:r})},{id:3,content:e(Ne,{step:p,widgetKey:(l=t==null?void 0:t.widgetKey)!=null?l:"",navigateToDasboard:$,isPlatformShopify:(t==null?void 0:t.platform)===E})}]:(t==null?void 0:t.platform)===E&&(Oe.exports.isUndefined(t==null?void 0:t.integrationDetails)||((u=t==null?void 0:t.integrationDetails)==null?void 0:u.expired)||!((_=t==null?void 0:t.integrationDetail
203s)!=null&&_.shopName))?[{id:1,content:e(re,{onSave:A,onCancel:N})},{id:2,content:e(Ae,{onManualIntegrate:L,onAuthorizeShopify:m,moveToShopifyIntegrate:F,widget:t})},{id:3,content:e(ve,{step:p,widgetKey:(S=t==null?void 0:t.widgetKey)!=null?S:"",navigateToCheckoutTracking:B,onClose:N,fromCreate:!0,isPlatformShopify:(t==null?void 0:t.platform)===E,trackingQueryParam:r})},{id:4,content:e(Ne,{step:p,widgetKey:(ne=t==null?void 0:t.widgetKey)!=null?ne:"",navigateToDasboard:$,isPlatformShopify:(t==null?void 0:t.platform)===E})}]:(t==null?void 0:t.platform)===E&&!((oe=t==null?void 0:t.integrationDetails)!=null&&oe.expired)&&!!((le=t==null?void 0:t.integrationDetails)!=null&&le.shopName)?[{id:1,content:e(re,{onSave:A,onCancel:N})},{id:2,content:e(Ae,{onManualIntegrate:L,onAuthorizeShopify:m,moveToShopifyIntegrate:F,widget:t})},{id:3,content:e(ut,{navigateToDasboard:$,showVerifyOnStoreModal:()=>R(!0),manualIntegrate:L,fromCreate:!0,widgetId:(de=t==null?void 0:t.id)!=null?de:"",onClose:N})}]:[]},[p,M,JSON.stringify(t),JSON.stringify(t==null?void 0:t.integrationDetails)]);return s("div",{className:"",children:[k&&e("div",{className:"m-3",children:e(We,{})}),M&&e(Le,{children:e(Pe,{})}),e("div",{className:"d-flex mx-5 mt-5 gap-5",children:s("div",{className:"w-100 d-flex flex-column",children:[s("div",{className:"d-flex justify-content-between align-items-center mb-5",children:[e("div",{children:e("span",{className:"fs-4 fw-md",id:"newWidget_txt",children:t!=null&&t.widgetName?`Integrate: ${t.widgetName}`:"New Widget"})}),e(Be,{})]}),e("section",{className:"flex-grow-1",children:e("div",{children:e(bt,{steps:g,currentStepNumber:p})})})]})}),e(Ft,{show:U,goToList:()=>y("/widgets/list")})]})},ta=jt;export{ta as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.