@kedge/admin 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/app/assets/{account-BAdVy9E2.js → account-nyHWydUe.js} +1 -1
- package/dist/app/assets/{home-BCCZ6txc.js → home-BSbCq4oE.js} +1 -1
- package/dist/app/assets/{index-kv11NdsY.js → index-BbBCe4by.js} +2 -2
- package/dist/app/assets/{invite-C4IwtpZf.js → invite-D1jP1Fll.js} +1 -1
- package/dist/app/assets/{resource-detail-CRWJVEL8.js → resource-detail-DgoKUNuA.js} +1 -1
- package/dist/app/assets/{resource-form-DulAO-yd.js → resource-form-BrN_LHPu.js} +1 -1
- package/dist/app/assets/{resource-list-wxhtKedG.js → resource-list-Bi1UweqT.js} +1 -1
- package/dist/app/assets/{setup-CBpGZMzZ.js → setup-Bk_lO3sV.js} +1 -1
- package/dist/app/assets/{use-command-CVgCpnG6.js → use-command-CzhIJrhd.js} +1 -1
- package/dist/app/assets/{work-lists-CKGWNjSC.js → work-lists-De9QWmyy.js} +1 -1
- package/dist/app/build.json +1 -1
- package/dist/app/index.html +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @kedge/admin
|
|
2
|
+
|
|
3
|
+
Part of [Kedge](https://www.npmjs.com/package/create-kedge), an open-source headless commerce backend on Cloudflare Workers and D1. Kedge's admin (P0.9): a React single-page app at /app/, built here and shipped prebuilt as static assets, so a store installs no React.
|
|
4
|
+
|
|
5
|
+
A store gets it as a dependency of `npm create kedge@latest`; you rarely install it alone.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,i as t,l as n,n as r,r as i,t as a,u as o}from"./card-CH9fCW35.js";import{f as s,i as c,n as l,p as u,u as d}from"./index-
|
|
1
|
+
import{f as e,i as t,l as n,n as r,r as i,t as a,u as o}from"./card-CH9fCW35.js";import{f as s,i as c,n as l,p as u,u as d}from"./index-BbBCe4by.js";var f=e(o(),1),p=n();function m(){let e=s(),n=u(),o=n.kind===`admin`?n.me:null,[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(null),b=o?`${o.principal.kind}:${o.principal.id}`:``,[x,S]=(0,f.useState)(()=>b?d.all(b):[]);if(!o||n.kind!==`admin`)return null;let C=o.session?.fresh_until?Date.parse(o.session.fresh_until)-(Date.now()+n.serverOffset)>0:!1;return(0,p.jsxs)(l,{id:`core.account`,title:`Your account`,children:[(0,p.jsx)(a,{title:`Who you are`,block:`core.account.who`,children:(0,p.jsxs)(`dl`,{className:`space-y-1 text-sm`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`inline text-neutral-500`,children:`Signed in as `}),(0,p.jsx)(`dd`,{className:`inline`,children:o.principal.email})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`inline text-neutral-500`,children:`Roles `}),(0,p.jsx)(`dd`,{className:`inline`,children:(o.roles??[]).map(e=>`${e.name}${e.counted?``:` (needs a sign-in with your authenticator)`}`).join(`, `)||`none`})]})]})}),(0,p.jsxs)(a,{title:`Change your password`,block:`core.account.password`,children:[C?(0,p.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),y(null);try{await e.client.request(`POST`,`/auth/admin/password`,{body:{current_password:m,new_password:g},expect:o.authz}),y({tone:`info`,text:`Changed. Your other sessions have ended.`})}catch(n){if(n instanceof t&&n.code===`VIEW_CHANGED`)return e.viewChanged();n instanceof t&&n.status===401&&n.session!==null?y({tone:`error`,text:`Your current password didn't match.`}):n instanceof t&&n.status===403?y({tone:`error`,text:`This needs a sign-in with your authenticator in the last ten minutes. Sign out and in again.`}):y({tone:`error`,text:n instanceof t?n.message:`The store didn't answer.`})}},className:`max-w-sm space-y-2`,children:[(0,p.jsx)(`input`,{className:c,type:`password`,placeholder:`Current password`,value:m,onChange:e=>h(e.target.value)}),(0,p.jsx)(`input`,{className:c,type:`password`,placeholder:`New password`,value:g,onChange:e=>_(e.target.value)}),(0,p.jsx)(i,{type:`submit`,disabled:!m||!g,children:`Change password`})]}):(0,p.jsxs)(r,{tone:`warn`,children:[`Changing your password needs a sign-in with your authenticator in the last ten minutes.`,` `,(0,p.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void e.signOut(),children:`Sign in again`}),`.`]}),v?(0,p.jsx)(r,{tone:v.tone,children:v.text}):null]}),x.length>0?(0,p.jsx)(a,{title:`Changes whose outcome isn't known`,block:`core.account.pending`,children:(0,p.jsx)(`ul`,{className:`space-y-1 text-sm`,children:x.map(e=>(0,p.jsxs)(`li`,{children:[e.label,`, sent `,new Date(e.at).toLocaleString(),`: open`,` `,(0,p.jsx)(`a`,{className:`underline`,href:`/app${e.reconcile}`,children:`where it would be`}),`, or`,` `,(0,p.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>{d.settle(e.key),S(d.all(b))},children:`abandon it (it may have happened)`}),`.`]},e.key))})}):null,(0,p.jsx)(i,{variant:`secondary`,onClick:()=>void e.signOut(!0),children:`Sign out everywhere`})]})}export{m as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,n as t,r as n,t as r}from"./card-CH9fCW35.js";import{S as i,f as a,h as o,n as s,o as c,s as l}from"./index-
|
|
1
|
+
import{l as e,n as t,r as n,t as r}from"./card-CH9fCW35.js";import{S as i,f as a,h as o,n as s,o as c,s as l}from"./index-BbBCe4by.js";var u=e();function d(){let e=a(),d=l(),f=i({queryKey:[e.generation,`deliveries`,`health`],enabled:c(d,`delivery:read`),queryFn:async()=>(await e.client.request(`GET`,`/admin/deliveries/health`)).body}),p=Object.values(f.data?.failed??{}).reduce((e,t)=>e+t,0);return(0,u.jsx)(s,{id:`core.home`,title:`Home`,children:(0,u.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[c(d,`delivery:read`)?(0,u.jsxs)(r,{title:`Deliveries`,block:`core.home.deliveries`,children:[f.data?(0,u.jsxs)(`dl`,{className:`grid grid-cols-3 gap-2 text-sm`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`dt`,{className:`text-neutral-500`,children:`Failed`}),(0,u.jsx)(`dd`,{className:`text-lg font-semibold`,children:p})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`dt`,{className:`text-neutral-500`,children:`Blocked`}),(0,u.jsx)(`dd`,{className:`text-lg font-semibold`,children:f.data.blocked??0})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`dt`,{className:`text-neutral-500`,children:`Orphaned`}),(0,u.jsx)(`dd`,{className:`text-lg font-semibold`,children:f.data.orphaned??0})]})]}):f.isError?(0,u.jsxs)(t,{tone:`error`,children:[`Couldn't read the delivery health.`,` `,(0,u.jsx)(n,{variant:`secondary`,onClick:()=>void f.refetch(),children:`Retry`})]}):(0,u.jsx)(`p`,{className:`text-sm text-neutral-500`,children:`Loading…`}),(0,u.jsx)(o,{to:`/system/deliveries`,className:`mt-3 inline-block text-sm underline`,children:`See deliveries`})]}):null,c(d,`effect:read`)?(0,u.jsxs)(r,{title:`External calls`,block:`core.home.effects`,children:[(0,u.jsx)(`p`,{className:`text-sm text-neutral-600`,children:`Calls no observation settled are listed for staff to decide.`}),(0,u.jsx)(o,{to:`/system/effects`,className:`mt-3 inline-block text-sm underline`,children:`See unresolved effects`})]}):null,(0,u.jsx)(r,{title:`Setting up`,block:`core.home.setup`,children:(0,u.jsx)(o,{to:`/setup`,className:`text-sm underline`,children:`Open the setup checklist`})})]})})}export{d as HomePage};
|