1import{r as v,j as e}from"./jsx-runtime-kF-aRxYe.js";import{u as D,b as L,a as w,c as N}from"./components-Bg6F3iAF.js";import{P as q,B,I as P,T as r,a as H,d as p,c as _}from"./Page-RCHDyLd1.js";import{L as x}from"./Layout-BAcNQvwh.js";import{C}from"./Card-S6K8GLCp.js";import{B as f}from"./Banner-BTCmU1jz.js";import"./context-ClUtXUi6.js";import"./banner-context-BgvF_mjc.js";import"./XIcon.svg-BFgNHS0e.js";const F="63613c447644d2972927afbd6750beda%2Fhide-bestsellers";function K(){const s=D(),A=L(),j=w(),k=N(),{translations:l,currentLanguage:u}=s,t=(a,n)=>{if(l&&l[u]){const T=a.split(".");let o=l[u];for(const b of T)if(o&&o[b])o=o[b];else return n;return o}return n},c=(s==null?void 0:s.isActive)||!1,d=s==null?void 0:s.appInstallationId,m=s==null?void 0:s.shopName,[i,g]=v.useState(c);v.useEffect(()=>{g(c)},[c]);const S=A.state==="submitting",y=()=>{if(!d){alert(t("common.error","Error")+": "+t("hideBestsellers.missingAppIdError","App Installation ID not found"));return}const a=!i;g(a);const n=new FormData;n.append("status",a?"true":"false"),n.append("appInstallationId",d),j(n,{method:"post"})},h=()=>{const n=`https://admin.shopify.com/store/${m.replace(".myshopify.com","")}/themes/current/editor?context=apps&activateAppId=${F}`;window.open(n,"_blank")},I=()=>{k("/app")},E=[{content:t("hideBestsellers.theme_button_label","Enable App in Theme"),onAction:h,disabled:!m}];return e.jsx(q,{title:t("hideBestsellers.page_title","Hide Best Sellers Page"),backAction:{content:t("hideBestsellers.back_to_dashboard","Dashboard"),onAction:I},primaryAction:{content:i?t("hideBestsellers.deactivate_btn","Deactivate"):t("hideBestsellers.activate_btn","Activate"),tone:i?"critical":"success",onAction:y,loading:S,disabled:!d},secondaryActions:E,children:e.jsx(x,{children:e.jsxs(x.Section,{children:[e.jsx(C,{children:e.jsxs(B,{gap:"400",children:[e.jsxs(P,{align:"space-between",blockAlign:"center",children:[e.jsxs(B,{gap:"200",children:[e.jsx(r,{variant:"headingMd",as:"h2",children:t("hideBestsellers.status_title","Feature Status")}),e.jsx(r,{as:"p",tone:"subdued",children:i?t("hideBestsellers.status_active_desc","The protection is currently **Active** (Best Sellers page is hidden)."):t("hideBestsellers.status_inactive_desc","The protection is currently **Inactive** (Best Sellers page is visible).")})]}),e.jsx(H,{tone:i?"success":"critical",children:i?t("hideBestsellers.status_active_badge","Active (Hidden)"):t("hideBestsellers.status_inactive_badge","Inactive (Visible)")})]}),i&&e.jsxs(f,{title:t("hideBestsellers.deactivation_required_title","Theme Deactivation Required"),tone:"warning",children:[e.jsx(r,{as:"p",children:t("hideBestsellers.deactivation_required_desc","To **completely disable** the feature and make the Best Sellers page visible, you must first click **Deactivate** above, **AND** then disable the App Embed Block from your theme settings.")}),e.jsx(p,{paddingBlockStart:"100",children:e.jsx(_,{onClick:h,variant:"secondary",size:"slim",external:!0,icon:"LinkExternal",fullWidth:!1,children:t("hideBestsellers.go_to_theme_settings_disable","Go to Theme Settings to Disable Embed")})})]}),!i&&e.jsxs(f,{title:t("hideBestsellers.activation_required_title","Theme Activation Required"),tone:"info",children:[e.jsx(r,{as:"p",children:t("hideBestsellers.activation_required_desc","To activate the **Hiding** feature, click **Activate** above, then click the button below to enable the App Embed Block in your theme settings.")}),e.jsx(p,{paddingBlockStart:"100",children:e.jsx(_,{onClick:h,variant:"primary",size:"slim",external:!0,icon:"LinkExternal",fullWidth:!1,children:t("hideBestsellers.go_to_theme_settings","Go to Theme Settings")})})]})]})}),e.jsx(p,{paddingBlockStart:"400",children:e.jsx(r,{as:"p",variant:"bodySm",tone:"subdued",alignment:"center",children:t("hideBestsellers.footer_version","Hide Best Sellers Extension ⢠Version 1.0")})})]})})})}export{K 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.