1import{a as x,h,Y as l,j as t,a0 as v,a3 as y,a4 as I,a1 as C,S as f,B as u,af as m,t as j}from"./index-COb3BWG8.js";import{u as E}from"./useMutation-BQY-xsoU.js";import"./useIsomorphicLayoutEffect-D8rpVvO2.js";const O=m` 2 query NoonEventDestination($storeConnectionId: ID!) { 3 noonEventDestination(storeConnectionId: $storeConnectionId) { 4 name status lastErrorCode 5 } 6 } 7`,g=m` 8 mutation RetryNoonDestinationProvisioning($storeConnectionId: ID!) { 9 retryNoonDestinationProvisioning(storeConnectionId: $storeConnectionId) { 10 name status lastErrorCode 11 } 12 } 13`;function D({destination:o,copy:i}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{role:"status",className:"text-sm font-medium",children:i("Event destination active")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:i("Destination name")}),t.jsx("p",{className:"text-sm font-medium",children:o.name})]})}function b({storeConnectionId:o}){const{locale:i}=x(),s=p=>j(p,i),{data:d,loading:n,error:a,refetch:c}=h(O,{variables:{storeConnectionId:o},fetchPolicy:"network-only",notifyOnNetworkStatusChange:!0}),[N,{loading:r}]=E(g,{fetchPolicy:"no-cache",onError:()=>l.error(s("We could not retry the Noon event destination setup. Please try again.")),onCompleted:()=>{l.success(s("Noon event destination setup restarted.")),c().catch(()=>l.error(s("Setup restarted, but its status could not be refreshed. Please retry.")))}}),e=d==null?void 0:d.noonEventDestination;return t.jsxs(v,{className:"rounded-2xl",children:[t.jsx(y,{children:t.jsx(I,{children:s("Noon event destination")})}),t.jsxs(C,{className:"space-y-4",children:[n&&t.jsx(f,{className:"h-32 w-full","aria-label":s("Checking Noon event destination")}),a&&t.jsx("p",{role:"alert",children:s("We could not load your Noon event destination. Please retry.")}),!n&&!a&&!e&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:s("Your Noon event destination is not set up yet.")}),t.jsx(u,{type:"button",variant:"outline",disabled:r,onClick:()=>{N({variables:{storeConnectionId:o}})},children:s(r?"Setting up destinationâ¦":"Set up destination")})]}),!n&&!a&&(e==null?void 0:e.status)==="PROVISIONING"&&t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:s("PrintaRex is setting up your Noon event destinationâ¦")}),!n&&!a&&((e==null?void 0:e.status)==="FAILED"||(e==null?void 0:e.status)==="NOT_PROVISIONED")&&e&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("p",{role:"status",className:"text-sm font-medium",children:e.status==="NOT_PROVISIONED"?s("Your Noon event destination is not set up yet."):s("We could not finish the Noon event destination setup.")}),e.lastErrorCode&&t.jsx("p",{className:"text-sm text-muted-foreground",children:s("Last error: {errorCode}").replace("{errorCode}",e.lastErrorCode)}),t.jsx(u,{type:"button",variant:"outline",disabled:r,onClick:()=>{N({variables:{storeConnectionId:o}})},children:s(r?e.status==="NOT_PROVISIONED"?"Setting up destinationâ¦":"Retrying setupâ¦":e.status==="NOT_PROVISIONED"?"Set up destination":"Retry setup")}),e.status==="FAILED"&&t.jsx("p",{className:"text-sm text-muted-foreground",children:s("If this keeps failing, contact PrintaRex support.")})]}),!n&&!a&&(e==null?void 0:e.status)==="ACTIVE"&&e&&t.jsx(D,{destination:e,copy:s}),t.jsx(u,{type:"button",variant:"outline",disabled:n||r,onClick:()=>{c().catch(()=>l.error(s("We could not refresh your Noon event destination. Please retry.")))},children:s("Refresh status")})]})]})}export{b as NoonEventDestinationCard};
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.