1import{r as l,j as t}from"./jsx-runtime-kF-aRxYe.js";import st from"./DiscardModal-tSo1iWCv.js";/* empty css */import{u as it,c as nt}from"./components-Bg6F3iAF.js";import{B as d,T as S,b as x,I as F,f as N,g as I,P as lt,a as rt}from"./Page-RCHDyLd1.js";import{I as B}from"./Modal-DoQWO5ot.js";import{L as _}from"./Layout-BAcNQvwh.js";import{C as w}from"./Card-S6K8GLCp.js";import{C as b}from"./Checkbox-BPrTdIr3.js";import{S as g}from"./Select-DTjWQsDb.js";import{S as P}from"./AlertCircleIcon.svg-cjzVM8rg.js";import{F as z,T as ct}from"./Toast-BSkyrb3p.js";import{C as dt}from"./ContextualSaveBar-Ca7SqGnH.js";import"./context-ClUtXUi6.js";import"./context-DqE-dl7J.js";import"./XIcon.svg-BFgNHS0e.js";import"./set-root-property-BPOnANDm.js";function Bt(){const{data:T,defaultSettings:E,currentLanguage:p,translations:h,storeName:ut}=it(),[y,q]=l.useState(T.app_status),[U,C]=l.useState(null),[a,v]=l.useState({...E,...T}),V=nt(),[D,f]=l.useState(!1),[G,A]=l.useState(""),[O,ft]=l.useState(T),[Q,k]=l.useState(""),[W,j]=l.useState(!1),[H,R]=l.useState(!1),J=l.useCallback(()=>j(e=>!e),[]),o=(e,r)=>{if(!h||!p)return r;const u=e.split(".");if(h[p]){let i=h[p];for(const c of u)if(i&&i[c])i=i[c];else break;if(i&&typeof i=="string")return i}if(p!=="fr"&&h.fr){let i=h.fr;for(const c of u)if(i&&i[c])i=i[c];else break;if(i&&typeof i=="string")return i}if(p!=="en"&&h.en){let i=h.en;for(const c of u)if(i&&i[c])i=i[c];else break;if(i&&typeof i=="string")return i}return r},m=l.useCallback((e,r)=>{console.log("ð DEBUG: Color change - fieldName:",r,"value:",e.target.value),v(u=>{const i={...u,[r]:e.target.value};return console.log("ð DEBUG: Color change - new formData:",i),i})},[]),n=(e,r)=>{v(u=>({...u,[r]:e}))},s=e=>{C(e)},L=l.useCallback(()=>R(e=>!e),[]),K=W?t.jsx(z,{children:t.jsx(ct,{content:Q,onDismiss:J,error:G})}):null,$=async()=>{f(!0),(await(await fetch("/api/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({actionType:"save",data:a,currentLanguage:p})})).json()).success?(j(!0),C(!1),f(!1),k(o("common.settingsUpdated","Settings Updated"))):(f(!1),j(!0),C(!1),A(!0),k(o("common.updateError","There is some error while update")))},M=()=>{v(O),C(!1),L()},X=async()=>{f(!0);const e={...a,app_status:!a.app_status},r=a.app_status?"Deactivate":"Activate",u={actionType:r,data:e,currentLanguage:p};try{const c=await(await fetch("/api/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).json();c.success?(f(!1),v(e),q(e.app_status),k(o("common.appStatusUpdated",`${r}d App successfully`))):(A(!0),f(!1),k(o("common.toggleError","There is some error")),console.error("API request failed:",c.message))}catch(i){A(!0),f(!1),k(o("common.toggleError","There is some error")),console.error("API request failed:",i)}finally{f(!1),j(!0)}},Y=[{label:o("StickyCart.positionTop","Top"),value:"Top"},{label:o("StickyCart.positionBottom","Bottom"),value:"Bottom"}],Z=[{label:o("StickyCart.heightSmall","Small"),value:"Small"},{label:o("StickyCart.heightMedium","Medium"),value:"Medium"},{label:o("StickyCart.heightLarge","Large"),value:"Large"}],tt=[{label:o("StickyCart.buttonSizeSmall","Small"),value:"Small"},{label:o("StickyCart.buttonSizeMedium","Medium"),value:"Medium"},{label:o("StickyCart.buttonSizeLarge","Large"),value:"Large"}],et=[{label:o("StickyCart.positionTop","Top"),value:"Top"},{label:o("StickyCart.positionBottom","Bottom"),value:"Bottom"}],ot=t.jsx("div",{className:"Sticky_cart_page_GeneralSettingsTab_container",children:t.jsxs(d,{gap:"400",children:[t.jsxs(B,{columns:["oneThird","twoThirds"],children:[t.jsx(S,{variant:"headingMd",as:"h6",children:o("StickyCart.newtext","New Text")}),t.jsx(_,{children:t.jsx(_.Section,{children:t.jsx(w,{roundedAbove:"sm",children:t.jsx(d,{gap:"400",children:t.jsx("div",{className:"checkbox_section",children:t.jsxs(d,{gap:"300",children:[t.jsx(b,{label:o("StickyCart.desktop.showDesktop","Show on Desktop"),onFocus:()=>s("field1"),onChange:e=>n(e,"show_on_desktop"),checked:a.show_on_desktop},"show_on_desktop"),t.jsx(g,{name:"desktop_position",label:o("StickyCart.desktop.desktopLabel","Desktop Position"),options:Y,onFocus:()=>s("field2"),onChange:e=>n(e,"desktop_position"),value:a.desktop_position},"desktop_position"),t.jsx(g,{name:"show_sticky_cart",label:o("StickyCart.desktop.showStickyCart","Show Sticky Cart"),options:[{label:o("StickyCart.desktop.whenScrollPast","When user scrolls past the Add to cart button"),value:"When user scrolls past the Add to cart button"},{label:o("StickyCart.desktop.always","Always"),value:"Always"}],onFocus:()=>s("field3"),onChange:e=>n(e,"show_sticky_cart"),value:a.show_sticky_cart},"show_sticky_cart"),t.jsx(b,{label:o("StickyCart.desktop.displayQuantity","Display Quantity"),onFocus:()=>s("field4"),checked:a.show_quantity,onChange:e=>n(e,"show_quantity")},"show_quantity"),t.jsx(b,{label:o("StickyCart.desktop.displayVariant","Display Variant"),onFocus:()=>s("field5"),onChange:e=>n(e,"show_variant"),checked:a.show_variant},"show_variant"),t.jsx(g,{label:o("StickyCart.desktop.barHeightLabel","Bar Height"),options:Z,onFocus:()=>s("field6"),onChange:e=>n(e,"sticky_height"),value:a.sticky_height},"sticky_height"),t.jsx(b,{label:o("StickyCart.desktop.displayTitle","Display Title"),onFocus:()=>s("field7"),onChange:e=>n(e,"show_product_title"),checked:a.show_product_title},"show_product_title"),t.jsx(g,{label:o("StickyCart.desktop.buttonSize","Button Size"),options:tt,onFocus:()=>s("field8"),onChange:e=>n(e,"button_size"),value:a.button_size},"button_size")]})})})})})})]}),t.jsxs(B,{columns:["oneThird","twoThirds"],children:[t.jsx(S,{variant:"headingMd",as:"h6",children:o("StickyCart.mobile.forMobile","For Mobile")}
1),t.jsx(_,{children:t.jsx(_.Section,{children:t.jsx(w,{roundedAbove:"sm",children:t.jsx(d,{gap:"400",children:t.jsx("div",{className:"checkbox_section",children:t.jsxs(d,{gap:"300",children:[t.jsx(b,{label:o("StickyCart.mobile.showMobile","Show on Mobile"),onFocus:()=>s("field_1"),checked:a.show_on_mobile,onChange:e=>n(e,"show_on_mobile")}),t.jsx(g,{label:o("StickyCart.mobile.mobileLabel","Mobile Position"),options:et,onFocus:()=>s("field_2"),onChange:e=>n(e,"mobile_position"),value:a.mobile_position}),t.jsx(g,{name:"show_sticky_cart_mobile",label:o("StickyCart.mobile.showStickyCartMobile","Show Sticky Cart Mobile"),options:[{label:o("StickyCart.mobile.whenScrollPast","When user scrolls past the Add to cart button"),value:"When user scrolls past the Add to cart button"},{label:o("StickyCart.mobile.always","Always"),value:"Always"}],onFocus:()=>s("field_3"),onChange:e=>n(e,"show_sticky_cart_mobile"),value:a.show_sticky_cart_mobile}),t.jsx(b,{label:o("StickyCart.mobile.displayQuantity","Display Quantity"),onFocus:()=>s("field_4"),checked:a.show_quantity_mobile,onChange:e=>n(e,"show_quantity_mobile")}),t.jsx(b,{label:o("StickyCart.mobile.displayVariant","Display Variant"),onFocus:()=>s("field_5"),checked:a.show_variant_mobile,onChange:e=>n(e,"show_variant_mobile")})]})})})})})})]}),t.jsxs(B,{columns:["oneThird","twoThirds"],children:[t.jsx(S,{variant:"headingMd",as:"h6",children:o("StickyCart.look.title","Look & Feel")}),t.jsx(_,{children:t.jsx(_.Section,{children:t.jsx(w,{roundedAbove:"sm",children:t.jsx(d,{gap:"400",children:t.jsx("div",{className:"checkbox_section",children:t.jsxs(d,{gap:"300",children:[t.jsx("div",{className:"color_section",children:t.jsx(x,{label:o("StickyCart.look.bgColor","Background Color"),type:"text",onFocus:()=>s("field-1"),value:a.background_color,onChange:e=>{s("field-1"),n(e,"background_color")},autoComplete:"off",connectedLeft:t.jsx("input",{type:"color",onFocus:()=>s("field-1"),value:a.background_color,onChange:e=>{s("field-1"),m(e,"background_color")},style:{boxShadow:a.background_color==="#ffffff"?"inset 0 0 0 1px rgba(0, 0, 0, .19)":"none",width:a.background_color==="#ffffff"?"34px":"38px",height:a.background_color==="#ffffff"?"34px":"38px"}})})}),t.jsx("div",{className:"color_section",children:t.jsx(x,{onFocus:()=>s("field-2"),label:o("StickyCart.look.textColor","Text Color"),type:"text",value:a.text_color,onChange:e=>{s("field-2"),n(e,"text_color")},autoComplete:"off",connectedLeft:t.jsx("input",{type:"color",onFocus:()=>s("field-2"),value:a.text_color,onChange:e=>{s("field-2"),m(e,"text_color")},style:{boxShadow:a.text_color==="#ffffff"?"inset 0 0 0 1px rgba(0, 0, 0, .19)":"none",width:a.text_color==="#ffffff"?"34px":"38px",height:a.text_color==="#ffffff"?"34px":"38px"}})})}),t.jsx("div",{className:"color_section",children:t.jsx(x,{onFocus:()=>s("field-inner1"),label:o("StickyCart.look.btnColor","Button Color"),type:"text",value:a.button_color,onChange:e=>{s("field-inner1"),n(e,"button_color")},autoComplete:"off",connectedLeft:t.jsx("input",{type:"color",onFocus:()=>s("field-inner1"),value:a.button_color,onChange:e=>{s("field-inner1"),m(e,"button_color")},style:{boxShadow:a.button_color==="#ffffff"?"inset 0 0 0 1px rgba(0, 0, 0, .19)":"none",width:a.button_color==="#ffffff"?"34px":"38px",height:a.button_color==="#ffffff"?"34px":"38px"}})})}),t.jsx("div",{className:"color_section",children:t.jsx(x,{onFocus:()=>s("field-inner2"),label:o("StickyCart.look.btnTextColor","Button Text Color"),type:"text",value:a.button_text_color,onChange:e=>{s("field-inner2"),n(e,"button_text_color")},autoComplete:"off",connectedLeft:t.jsx("input",{type:"color",onFocus:()=>s("field-inner2"),value:a.button_text_color,onChange:e=>{s("field-inner2"),m(e,"button_text_color")},style:{boxShadow:a.button_text_color==="#ffffff"?"inset 0 0 0 1px rgba(0, 0, 0, .19)":"none",width:a.button_text_color==="#ffffff"?"34px":"38px",height:a.button_text_color==="#ffffff"?"34px":"38px"}})})}),t.jsx(x,{label:t.jsxs(F,{children:[o("StickyCart.look.borderRadius","Border Radius")," ",t.jsx(N,{content:o("StickyCart.look.borderTooltip","Border radius tooltip"),children:t.jsx(I,{source:P,tone:"base"})})]}),value:a.border_radius,onChange:e=>{s("field-inner3"),n(e,"border_radius")},autoComplete:"off",placeholder:"4px"}),t.jsx(x,{label:t.jsxs(F,{children:[o("StickyCart.look.borderColor","Border Color")," ",t.jsx(N,{content:o("StickyCart.look.borderColorToltip","Border color tooltip"),children:t.jsx(I,{source:P,tone:"base"})})]}),type:"text",value:a.border_color,onChange:e=>{s("field-inner4"),n(e,"border_color")},autoComplete:"off",connectedLeft:t.jsx("input",{type:"color",onFocus:()=>s("field-inner4"),value:a.border_color,onChange:e=>{s("field-inner4"),m(e,"border_color")},style:{boxShadow:a.border_color==="#ffffff"?"inset 0 0 0 1px rgba(0, 0, 0, .19)":"none",width:a.border_color==="#ffffff"?"34px":"38px",height:a.border_color==="#ffffff"?"34px":"38px"}})})]})})})})})})]})]})});o("defaultSettings.settings","Settings"),l.useEffect(()=>{shopify.loading(!1)},[]),o("StickyCart.appTitle","Sticky Add to Cart");const at=()=>{V("/app"),shopify.loading(!0)};return t.jsx("div",{className:"Sticky_cart_page_page",children:t.jsxs(lt,{backAction:{content:o("common.back","Back"),onAction:at},title:o("StickyCart.appTitle","Sticky Add to Cart"),subtitle:o("StickyCart.appdsec","Keep the add to cart button visible as customers scroll through your product pages."),primaryAction:{content:y?o("defaultSettings.deactivateBtn","Deactivate"):o("defaultSettings.activateBtn","Activate"),tone:y?"critical":"success",onAction:X,loading:D},children:[t.jsx("div",{className:"intant_search",children:t.jsxs(d,{gap:"500",children:[t.jsx(w,{children:t.jsx(d,{gap:"400",children:t.jsxs(F,{align:"space-between",blockAlign:"center",children:[t.jsxs(d,{gap:"200",children:[t.jsx(S,{variant:"headingMd",as:"h2",children:o("StickyCart.status_title","Application Status")}),t.jsx(S,{as:"p",tone:"subdued",children:y?o("StickyCart.status_active_desc","The Sticky Cart feature is currently active on your store."):o("StickyCart.status_inactive_desc","Activate the app to display the Sticky Cart on your store.")})]}),t.jsx(rt,{tone:y?"success":"attention",children:y?o("StickyCart.status_active","Active"):o("StickyCart.status_inactive","Inactive")})]})})}),t.jsx("div",{className:"intant_search_TabsField",children:t.jsx(d,{gap:"200",children:ot})})]})}),U&&t.jsx(z,{logo:{width:86,contextualSaveBarSource:"https://cdn.shopify.com/s/files/1/2376/3301/files/Shopify_Secondary_Inverted.png"},children:t.jsx(dt,{message:o("defaultSettings.content","Unsaved changes"),saveAction:{onAction:$,loading:D,disabled:!1},discardAction:{onAction:M}})}),K,t.jsx(st,{toggleModal:L,handleDiscard:M,activemodal:H})]})})}export{Bt 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.